dsh-xiaomi-tts 5.2.0 → 5.2.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.
Files changed (47) hide show
  1. package/README.md +7 -4
  2. package/assets/ui/passport-device.webp +0 -0
  3. package/assets/ui/passport-screen.webp +0 -0
  4. package/lib/client.js +172 -43
  5. package/lib/{constants-DLMDH03m.js → constants-CO2-NF7t.js} +1 -1
  6. package/lib/host/whale-config.d.ts +6 -0
  7. package/lib/host-api.d.ts +3 -1
  8. package/lib/index.d.ts +2 -0
  9. package/lib/index.js +1 -1
  10. package/lib/passport/asr-error.d.ts +3 -0
  11. package/lib/passport/audio.d.ts +5 -2
  12. package/lib/passport/bridge.d.ts +28 -2
  13. package/lib/passport/doubao-asr.d.ts +32 -0
  14. package/lib/passport/playback.d.ts +1 -0
  15. package/lib/passport/recognition.d.ts +37 -0
  16. package/lib/passport.d.ts +3 -0
  17. package/lib/passport.js +3 -3
  18. package/lib/pcm-stream.js +1 -1
  19. package/lib/qqbot-agent.js +1 -1
  20. package/lib/{qqbot-media-DcO6LfLf.js → qqbot-media-DSo0_E9r.js} +1 -1
  21. package/lib/qqbot.js +1 -1
  22. package/lib/recognition-Dy941tNi.js +1 -0
  23. package/lib/{session-speech-BmzozZ06.js → session-speech-BJAAu345.js} +1 -1
  24. package/lib/{shared-16-sZBAV.js → shared-CVoc-41L.js} +2 -2
  25. package/lib/shared.js +1 -1
  26. package/lib/speech-agent.js +1 -1
  27. package/lib/speech-host.js +1 -1
  28. package/lib/src-DdvOll3o.js +11 -0
  29. package/lib/types/passport.d.ts +15 -0
  30. package/lib/types/settings.d.ts +2 -0
  31. package/lib/types/whale.d.ts +3 -0
  32. package/lib/{whale-9wlZJkjz.js → whale-Dl2g1ShV.js} +1 -1
  33. package/lib/whale-agent.js +1 -1
  34. package/lib/{whale-config-DOec_vJ7.js → whale-config-ViWPMtow.js} +1 -1
  35. package/lib/whale-girl.js +1 -1
  36. package/lib/{whale-persona-CPIqYIEm.js → whale-persona-4itBphV2.js} +1 -1
  37. package/locale/passport/en.json +4 -3
  38. package/locale/passport/zh.json +4 -3
  39. package/locale/whale-girl/en.json +4 -0
  40. package/locale/whale-girl/zh.json +4 -0
  41. package/locale/zh.json +1 -1
  42. package/package.json +6 -4
  43. package/skills/whale-girl/SKILL.md +1 -17
  44. package/skills/whale-girl/meme-instructions.md +8 -0
  45. package/skills/whale-girl/memory-instructions.md +6 -0
  46. package/skills/whale-girl/persona.cjs +10 -4
  47. package/lib/src-Cz9zprKo.js +0 -11
package/lib/client.js CHANGED
@@ -1,16 +1,16 @@
1
- window.__ModuleLoader__.load({id:`dsh-xiaomi-tts`,factory:e=>{var t={exports:{}},n=t.exports,r=Object.create,i=Object.defineProperty,__name=(e,t)=>i(e,`name`,{value:t,configurable:!0}),a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,__copyProps=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},__toESM=(e,t,n)=>(n=e==null?{}:r(s(e)),__copyProps(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e));let l=e(`react`);l=__toESM(l);let u=e(`@deepseek-ai/dsh-client-ui-primitives`);u=__toESM(u);let d=e(`react/jsx-runtime`);d=__toESM(d);let p=e(`@deepseek-ai/cordis`);p=__toESM(p);let m=e(`react-dom`);m=__toESM(m);let h=`/plugins/xiaomi-mimo-tts/synthesize`,g=`/plugins/xiaomi-mimo-tts/synthesize-stream`,_=`http://127.0.0.1:18083`,v={xiaomi:`/plugins/xiaomi-mimo-tts/provider-mimo.webp`,doubao:`/plugins/xiaomi-mimo-tts/provider-doubao.webp`,breeze:`/plugins/xiaomi-mimo-tts/provider-breeze.webp`},b={xiaomi:`/plugins/xiaomi-mimo-tts/provider-mimo-logo.png`,doubao:`/plugins/xiaomi-mimo-tts/provider-doubao-logo.png`,breeze:`/plugins/xiaomi-mimo-tts/provider-breeze-logo.png`},x=`/plugins/xiaomi-mimo-tts/history-empty-whale.webp`,S=`/plugins/xiaomi-mimo-tts/audio`,C={on:[`on02.mp3`,`on03.mp3`],off:[`off01.mp3`,`off02.mp3`],"auto-on":[`auto-on01.mp3`],"auto-off":[`auto-off03.mp3`]},w=[`volume-01.mp3`,`on02.mp3`],E=[{id:`bingtang`,value:`冰糖`,summary:`活泼少女`},{id:`mia`,value:`Mia`,summary:`Lively girl`},{id:`moli`,value:`茉莉`,summary:`知性女声`},{id:`chloe`,value:`Chloe`,summary:`Witty Grace`},{id:`suda`,value:`苏打`,summary:`阳光少年`},{id:`milo`,value:`Milo`,summary:`Sunny boy`},{id:`baihua`,value:`白桦`,summary:`成熟男声`},{id:`dean`,value:`Dean`,summary:`Steady Gentle`}],D=[`mimo-v2.5-tts`,`mimo-v2.5-tts-voicedesign`,`browser-local-fallback`],k=[`auto`,`local-first`,`disabled`],A=[`browser`,`moss`],M=[{id:`energetic-girl`,label:`鲸鱼娘`,summary:`清甜灵动`,prompt:`A bright, youthful female voice around 16–20. Sweet, soft and slightly nasal, with a lazy yet cheerful energy—like someone who just woke up but is already happily active. Sentence endings often lift playfully. Sounds a bit tsundere on the surface, but warm, affectionate and mildly possessive underneath. Normally light and lively; turns earnest yet soft when serious.Speaks fairly quickly with natural pauses. Occasionally draws out a word when being stubborn, always with happy, playful energy.`},{id:`liang-wenfeng`,label:`梁文峰`,summary:`理性克制`,prompt:`成年男性 35–40 岁,普通话,温和克制的中低音,声线清晰自然,声音偏亮不沉闷,略带书卷气和理工感,语速中等偏慢,停顿审慎,表达理性简洁,情绪稳定,不夸张。`},{id:`asmr-whisper`,label:`沈听澜`,summary:`ASMR低语`,prompt:`女性18-20岁,轻柔耳语带微弱气息,普通话,声线细腻清晰,私密温柔感,安静平和带轻柔低语,语速缓慢音量很轻,私密低语场景。`},{id:`young-man`,label:`江予辰`,summary:`阳光少年`,prompt:`男性青年16-22岁,清亮干净的中高音带少年感,普通话标准无口音,轻快明亮的活力声线,气息轻盈吐字利索,语速偏快语调自然上扬,情绪积极阳光带朝气,广告旁白或轻松解说场景。`},{id:`gentle-girlfriend`,label:`张子苜`,summary:`温柔陪伴`,prompt:`年轻女性16-22岁,声线柔软细腻,低饱和带微微暖意,标准普通话,温柔亲密的邻家风格,语速偏慢,语调轻柔连贯,气息自然流畅,安静私密陪伴场景。`},{id:`tech-explainer`,label:`周砚川`,summary:`科技解说`,prompt:`成年男性25-35岁,清晰利落中音、干净偏冷,标准普通话,精准干练的都市精英感,语速中等偏快、语调平稳,理性简洁、逻辑感强,现代资讯播报或商业讲解场景。`},{id:`girl-next-door`,label:`陈念安`,summary:`邻家甜声`,prompt:`年轻女性20-25岁,柔润清甜带撒娇感,普通话,清澈明亮的少女音,轻松温柔的亲近感,轻松平缓带温柔,中等偏快语速中等音量,生活分享场景。`},{id:`documentary-narrator`,label:`陆远山`,summary:`纪录片旁白`,prompt:`男性40-50岁,低沉醇厚有胸腔共鸣,普通话,稳重可靠的叙事者风格,语速中等偏慢,语调沉稳克制带叙事纵深感,气息舒展停顿有留白,纪录片旁白或深度访谈场景。`},{id:`news-anchor`,label:`顾知微`,summary:`沉稳播报`,prompt:`专业新闻播音女主持,成年女性30-40岁,普通话标准无口音,声线中低音区饱满清晰,端庄知性沉稳,语气克制权威,语速从容均匀,音量适中稳定,新闻播报与专题解说场景。`},{id:`suspense-narrator`,label:`裴沉舟`,summary:`悬疑旁白`,prompt:`男性中年30-40岁,低沉沉稳带神秘磁性,普通话,压抑克制的叙事风格,语速缓慢均匀,语调低沉平稳,情绪冷静悬疑,旁白解说场景。`}],P=[`smart`,`full`,`first-segment`],F=[`minimal`,`soft`,`glass`,`arcade`,`mechanical`,`organic`,`dreamy`,`scifi`,`rubber`,`cinematic`,`studio`,`zen`],I=[`all`,`click`,`task`];function resolveSoundEffectsMode(e,t,n){return!e||!t&&!n?`off`:t&&n?`all`:t?`task`:`click`}function resolveSoundEffectsScope(e,t){return e===t?`all`:e?`task`:`click`}function getSoundEffectsModeFlags(e){return{enabled:e!==`off`,taskSounds:e===`all`||e===`task`,clickSounds:e===`all`||e===`click`}}let V={soundEnabled:!1,soundVolume:.7,soundPack:`zen`,taskSounds:!1,clickSounds:!1},ee=[`dsh-pet`,`dsh-whale-musume`,`question-titles`,`approvals`,`job-results`],H={showInSidebar:!1,showInHostSettings:!0,acceptExternalProviders:!0,qqbotEnabled:!1,qqbotMaxAutoCharacters:0,qqbotMaxDurationSeconds:0,announcementSources:[`dsh-whale-musume`,`question-titles`],provider:`xiaomi`,doubaoEnabled:!0,doubaoApiKey:``,doubaoModel:`seed-tts-2.0`,doubaoVoice:`zh_female_vv_uranus_bigtts`,doubaoClonedVoice:``,doubaoInstruction:``,breezeEnabled:!1,breezeApiKey:``,breezeVoice:`voc_rh6e8hdbraz6`,breezeInstruction:``,enabled:!0,apiKey:``,baseURL:`https://api.xiaomimimo.com/v1`,model:`mimo-v2.5-tts`,localSpeechMode:`auto`,localVoiceURI:``,localVoiceEngine:`browser`,mossEnabled:!1,mossBaseURL:_,mossVoice:``,mossVoiceName:``,voice:`冰糖`,voiceDesignPrompt:`青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。`,voiceDesignCustomPrompt:`青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。`,presetStylePrompt:``,format:`pcm`,voiceDesignPlaybackMode:`complete`,readScope:`smart`,autoPlay:!1,voiceInputCompatibility:!0,inputAvoidance:!1,importantAnnouncementsFirst:!1,instruction:``,maxTextLength:12e3,requestTimeoutMs:12e4,maxMp3AudioBytes:33554432,maxWavAudioBytes:134217728,maxPausedPcmBytes:33554432,voiceVolume:1,voiceRate:1,...V};function isSupportedTtsApiKey(e,t=`xiaomi`){let n=e.trim();return t===`doubao`||t===`breeze`?n.length>0&&!/[\r\n]/u.test(n):n.startsWith(`sk-`)||n.startsWith(`tp-`)}function classifyLiveSpeechTransition(e,t){return e===null||e.sessionId!==t.sessionId||e.turn!==t.turn?`new-turn`:e.step===t.step?`same-step`:`same-turn`}var AbortableSentenceQueue=class{pending=[];current=null;revision=0;busy=!1;constructor(e,t={}){this.start=e,this.options=t}enqueue(e){this.pending.push(e),this.setBusy(!0),this.pump()}cancel(){this.revision+=1,this.pending.length=0,this.current?.abort(),this.current=null,this.setBusy(!1)}async pump(){if(this.current!==null)return;let e=this.pending.shift();if(e===void 0){this.setBusy(!1);return}let t=this.revision,n=new AbortController;this.current=n;try{await this.start(e,n.signal)}catch(e){!n.signal.aborted&&t===this.revision&&(this.pending.length=0,this.revision+=1,this.options.onError?.(e))}finally{this.current===n&&(this.current=null),t===this.revision&&this.pending.length>0?this.pump():this.setBusy(!1)}}setBusy(e){this.busy!==e&&(this.busy=e,this.options.onBusyChange?.(e))}};function parseSseRecords(e){let t=e.split(/\r?\n\r?\n/u),n=t.pop()??``;return{events:t.map(e=>e.split(/\r?\n/u).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
2
- `)).filter(e=>e.length>0),remainder:n}}function normalizeVoiceRate(e){return Number.isFinite(e)?Math.round(Math.max(.5,Math.min(2,e))*10)/10:1}let te=[`xiaomi`,`doubao`,`breeze`];function availableTtsProviders(e,t){return te.filter(n=>n===`xiaomi`||(n===`doubao`?e:t))}function nextTtsProvider(e,t,n){let r=availableTtsProviders(t,n);return r[(r.indexOf(e)+1)%r.length]}let U=[`seed-tts-2.0`,`seed-icl-2.0`],re=`breeze-tts-2`,se=[{value:`voc_rh6e8hdbraz6`,name:`哈基米娘`,language:`zh`},{value:`voc_b86bfwct4cjn`,name:`香农小姐`,language:`zh`},{value:`voc_8yud7hz7c9q2`,name:`大肥鱼(迷糊版)`,language:`zh`},{value:`voc_u3nxkd5578wc`,name:`大肥鱼(机灵版)`,language:`zh`},{value:`voc_reys5un5t4ed`,name:`深思先生`,language:`zh`},{value:`voc_pczdutjax3bc`,name:`实录观察者`,language:`zh`},{value:`voc_ytteeuvt48pm`,name:`岁月回声`,language:`zh`},{value:`voc_mmbkawdhpk29`,name:`晨光记录员`,language:`zh`},{value:`voc_dzumjsqzf948`,name:`素言叙事`,language:`zh`},{value:`voc_3n4rhszjst3f`,name:`青衿师语`,language:`zh`},{value:`voc_zbggdxky3yu3`,name:`深夜观察者`,language:`zh`},{value:`voc_xb3zjqcmwp44`,name:`晨曦讲解员`,language:`zh`},{value:`voc_ynfyjw6yrv7p`,name:`雅致述评人`,language:`zh`},{value:`voc_vhv3b2252en7`,name:`星海引路人`,language:`zh`},{value:`voc_tzneby749yja`,name:`灵动汐语`,language:`zh`},{value:`voc_nmea5hnwvwcu`,name:`幽兰语者`,language:`zh`},{value:`voc_t2kpg5h4ebah`,name:`热点快评员`,language:`zh`},{value:`voc_rye44d226x46`,name:`雅韵谈锋`,language:`zh`},{value:`voc_kvzxd25fpshp`,name:`晨露花语`,language:`zh`},{value:`voc_chsmgh7pkufq`,name:`元气茶香`,language:`zh`},{value:`voc_7jsxftc2rm3n`,name:`墨香少女`,language:`zh`},{value:`voc_csdwmam68z4k`,name:`疾风信使`,language:`zh`},{value:`voc_shetwnrd3q3q`,name:`静谧流年`,language:`zh`},{value:`voc_2z7zu82z2eu3`,name:`林间漫语者`,language:`zh`},{value:`voc_wuwu3ckdfe4q`,name:`云端播报员`,language:`zh`},{value:`voc_yu7t5b4tx7c7`,name:`深夜树洞`,language:`zh`},{value:`voc_9zyu28uzmjsk`,name:`八方馆掌柜`,language:`zh`},{value:`voc_2b358584ukkb`,name:`晨曦热血少年`,language:`zh`},{value:`voc_ge466ug83952`,name:`智械管家`,language:`zh`},{value:`voc_f3zbgr88pz5m`,name:`月夜低语者`,language:`zh`}];function breezeVoiceLabel(e){return se.find(t=>t.value===e.trim())?.name??e}function ttsSelection(e){return e.provider===`doubao`?{provider:`doubao`,model:e.doubaoModel,voice:e.doubaoModel===`seed-icl-2.0`?e.doubaoClonedVoice:e.doubaoVoice,voiceRate:normalizeVoiceRate(e.voiceRate),...e.doubaoModel===`seed-tts-2.0`?{speechInstruction:e.doubaoInstruction.trim()}:{}}:e.provider===`breeze`?{provider:`breeze`,model:re,voice:e.breezeVoice,voiceRate:normalizeVoiceRate(e.voiceRate),speechInstruction:e.breezeInstruction.trim()}:{provider:`xiaomi`,model:e.model,voice:e.voice,voiceDesignPrompt:e.voiceDesignPrompt,speechInstruction:e.instruction.trim()}}function supportsRealtimeTts(e){return e.provider===`doubao`||e.provider===`breeze`?!0:e.provider===`xiaomi`&&e.model===`mimo-v2.5-tts`}function findFencedCodeRegions(e){let t=[],n=/(^|\n)[ \t]{0,3}(`{3,}|~{3,})([^\r\n]*)/g,r=null;for(let i of e.matchAll(n)){let e=i[2],n=i[3];if(r===null){if(e[0]==="`"&&n.includes("`"))continue;r={start:i.index+(i[1]===`
3
- `?1:0),marker:e}}else r.marker[0]===e[0]&&e.length>=r.marker.length&&n.trim().length===0&&(t.push([r.start,i.index+i[0].length]),r=null)}return{regions:t,pendingStart:r?.start??null}}function removeFencedCode(e){let{regions:t,pendingStart:n}=findFencedCodeRegions(e),r=``,i=0;for(let[n,a]of t)r+=`${e.slice(i,n)} `,i=a;return r+e.slice(i,n??e.length)}let ce=[{zh:`基础情绪`,en:`Emotions`,english:[`happy`,`sad`,`angry`,`afraid`,`surprised`,`excited`,`aggrieved`,`calm`,`indifferent`],tags:[`开心`,`悲伤`,`愤怒`,`恐惧`,`惊讶`,`兴奋`,`委屈`,`平静`,`冷漠`]},{zh:`复合情绪`,en:`Mixed emotions`,english:[`wistful`,`relieved`,`helpless`,`guilty`,`at peace`,`jealous`,`weary`,`uneasy`,`moved`],tags:[`怅然`,`欣慰`,`无奈`,`愧疚`,`释然`,`嫉妒`,`厌倦`,`忐忑`,`动情`]},{zh:`整体语调`,en:`Delivery`,english:[`gentle`,`aloof`,`lively`,`serious`,`lazy`,`playful`,`deep`,`brisk`,`sharp`],tags:[`温柔`,`高冷`,`活泼`,`严肃`,`慵懒`,`俏皮`,`深沉`,`干练`,`凌厉`]},{zh:`音色定位`,en:`Voice texture`,english:[`magnetic voice`,`rich voice`,`clear voice`,`ethereal voice`,`young voice`,`aged voice`,`sweet voice`,`hoarse voice`,`mellow voice`],tags:[`磁性`,`醇厚`,`清亮`,`空灵`,`稚嫩`,`苍老`,`甜美`,`沙哑`,`醇雅`]},{zh:`人设腔调`,en:`Character voice`,english:[`cutesy voice`,`mature female voice`,`young boy voice`,`middle-aged male voice`,`Taiwanese accent`],tags:[`夹子音`,`御姐音`,`正太音`,`大叔音`,`台湾腔`]},{zh:`方言与角色`,en:`Dialects & characters`,english:[`Northeastern Chinese dialect`,`Sichuan dialect`,`Henan dialect`,`Cantonese`,`Sun Wukong`,`Lin Daiyu`],tags:[`东北话`,`四川话`,`河南话`,`粤语`,`孙悟空`,`林黛玉`]},{zh:`唱歌(插入句首)`,en:`Singing (insert at start)`,english:[`sing`,`singing`],tags:[`唱歌`,`sing`,`singing`],placement:`start`},{zh:`呼吸与节奏`,en:`Breathing & rhythm`,english:[`inhale`,`deep breath`,`sigh`,`long sigh`,`heavy breathing`,`hold breath`],tags:[`吸气`,`深呼吸`,`叹气`,`长叹一口气`,`喘息`,`屏息`]},{zh:`情绪状态`,en:`Emotional state`,english:[`nervous`,`scared`,`excited`,`exhausted`,`aggrieved`,`coy`,`guilty`,`shocked`,`impatient`],tags:[`紧张`,`害怕`,`激动`,`疲惫`,`委屈`,`撒娇`,`心虚`,`震惊`,`不耐烦`]},{zh:`语音特征`,en:`Vocal expression`,english:[`trembling`,`shaky voice`,`pitch shift`,`voice break`,`nasal voice`,`breathy voice`,`hoarse voice`],tags:[`颤抖`,`声音颤抖`,`变调`,`破音`,`鼻音`,`气声`,`沙哑`]},{zh:`哭笑表达`,en:`Laughter & crying`,english:[`laugh`,`chuckle`,`laugh loudly`,`scoff`,`sob`,`whimper`,`choked up`,`cry loudly`],tags:[`笑`,`轻笑`,`大笑`,`冷笑`,`抽泣`,`呜咽`,`哽咽`,`嚎啕大哭`]}];``+ce.map(e=>`${e.zh}: ${e.tags.join(`/`)}`).join(`; `);let le=/\([^()\r\n]+\)|([^()\r\n]+)|\[[^\]\r\n]+\]/gu;function stripXiaomiAudioTags(e){return e.replace(le,` `)}let ue={",":`,`,"。":`.`,"!":`!`,"?":`?`,";":`;`,":":`:`,"、":`,`,"(":`,`,")":`,`," ":` `},W=/[()\[\]【】[]〔〕〖〗{}{}「」『』《》〈〉“”‘’"'`<>]/gu,de=/[…⋯〜~]+/gu,fe=/\b(?:https?|ftp):\/\/[^\s<>()]+|\bwww\.[^\s<>()]+|\b(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+(?:com|cn|net|org|io|ai|dev|me|co|edu|gov|xyz|tech|info|app|site|link)(?:[/:?#][^\s<>()]*)?/giu,pe=/(?:\b[A-Za-z]:[\\/]|\\\\)(?:[A-Za-z0-9._ -]+[\\/])+(?:[A-Za-z0-9._ -]+)/gu,me=/\/(?:[A-Za-z0-9._-]+\/)+(?:[A-Za-z0-9._-]+)/gu,he=/(?:\.\.?[\\/])(?:[A-Za-z0-9._-]+[\\/])*(?:[A-Za-z0-9._-]+(?:\.[A-Za-z0-9_-]+)?)/gu,xe=/\b(?:[A-Za-z0-9_-]+[\\/])+[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/gu,Se=/```[\s\S]*?```|~~~[\s\S]*?~~~/g,Ce=/(^|\n)(?: {4}|\t)[^\n]*(?=\n|$)/g,we=/!\[([^\]\r\n]*)\]\([^\)\r\n]*\)/g,Te=/\[([^\]\r\n]*)\]\([^\)\r\n]*\)/g,Ee=/<[^>\r\n]*>/g,De=/(^|\n)\s{0,3}#{1,6}\s+/g,Oe=/(^|\n)\s*(?:[-*+]|\d+[.)])\s+/g,ke=/(^|\n)\s*>\s?/g,Ae=/`+|[*_~]{1,3}/g,Me=/[|]/g;function removeTtsPaths(e){return e.replace(pe,` `).replace(he,` `).replace(xe,` `).replace(me,` `)}function removeTtsMarkup(e,t){let n=removeFencedCode(e).replace(Se,` `).replace(Ce,`$1`).replace(we,` `).replace(Te,`$1`).replace(Ee,` `);return n=(t?.(n)??n).replace(De,`$1`).replace(Oe,`$1`).replace(ke,`$1`).replace(Ae,``).replace(Me,` `),n=n.replace(fe,` `),removeTtsPaths(n)}function removeTtsSymbols(e){return e.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F​-‏‪-‮⁠-⁤⁦-]/g,` `).replace(/(?:\p{Extended_Pictographic}|\p{Emoji_Presentation}|\p{Regional_Indicator}|\p{Emoji_Modifier}|\p{So}|︎|️|‍|⃣)/gu,` `)}function normalizeTtsPunctuation(e){return e.replace(de,`.`).replace(/[—–-]+/gu,``).replace(W,``).replace(/[,。!?;:、() ]/gu,e=>ue[e]??e).replace(/(^|\s)[,;:!?]+(?=\s|$)/g,`$1`).replace(/([,;:])\s*([.!?])/g,`$2`).replace(RegExp(``,`g`),`,`).replace(/\s+([,.;:!?])/g,`$1`).replace(/\.{2,}/gu,`.`).replace(/^\.+/u,``)}function prepareTtsText(e){return e.length===0?``:normalizeTtsPunctuation(removeTtsSymbols(stripBreezeAudioTags(removeTtsMarkup(e).replace(/\\[rn]|\/n/gi,` `).replace(/\r\n?|\n/g,`.`)))).replace(/\s+/g,` `).trim()}function prepareExternalTtsText(e,t=[]){let n=removeFencedCode(e.replace(/[\uE000-\uE002]/gu,` `)),r=[];for(let e of[...t].sort((e,t)=>t.length-e.length)){if(!e)continue;let t=`\uE001${r.length}\uE002`;r.push(e),n=n.split(e).join(t)}return n=normalizeTtsPunctuation(removeTtsSymbols(removeTtsMarkup(n).replace(/\\[rn]|\/n/gi,` `).replace(/\r\n?|\n/g,`.`))).replace(/\s+/gu,` `).trim(),n.replace(/\uE001(\d+)\uE002/gu,(e,t)=>r[Number(t)]??``)}function prepareXiaomiTtsText(e){let t=[];return prepareTtsText(removeTtsMarkup(e.replace(/[\uE000-\uE002]/gu,` `),e=>e.replace(le,e=>(t.push(e),`${t.length-1}`)))).replace(/(\d+)/gu,(e,n)=>t[Number(n)]??``)}let Ne=[{label:`笑声`,zh:[`[笑]`,`[轻笑]`,`[咯咯笑]`],en:[`(laughs)`,`(chuckles)`,`(giggles)`]},{label:`哭泣与疼痛`,zh:[`[哭声]`,`[抽泣]`,`[呜咽]`,`[呻吟]`,`[哀号]`],en:[`(cries)`,`(sobs)`,`(whimpers)`,`(groans)`,`(moans)`]},{label:`呼吸`,zh:[`[叹气]`,`[惊呼]`,`[吸气]`,`[呼气]`,`[喘息]`],en:[`(sighs)`,`(gasps)`,`(inhales)`,`(exhales)`,`(breathes heavily)`]},{label:`发声`,zh:[`[耳语]`,`[喊叫]`,`[惨叫]`],en:[`(whispers)`,`(shouts)`,`(screams)`]},{label:`唱歌`,zh:[`[唱歌]`,`[哼歌]`],en:[`(sings)`,`(hums)`]},{label:`说话`,zh:[`[结巴]`,`[停顿]`,`[清嗓]`],en:[`(stutters)`,`(pauses)`,`(clears throat)`]},{label:`喉部`,zh:[`[咳嗽]`,`[吸鼻子]`,`[咂嘴]`,`[啧嘴]`],en:[`(coughs)`,`(sniffles)`,`(lip smacks)`,`(clicks tongue)`]},{label:`其他`,zh:[`[打哈欠]`,`[打喷嚏]`,`[打嗝]`,`[打饱嗝]`,`[吞咽]`,`[干呕]`,`[闷哼]`,`[冷笑]`,`[哼鼻子]`],en:[`(yawns)`,`(sneezes)`,`(hiccups)`,`(burps)`,`(gulps)`,`(gags)`,`(grunts)`,`(scoffs)`,`(snorts)`]}],Pe=new Set(Ne.flatMap(e=>[...e.zh,...e.en]));``+Ne.map(e=>`${e.label} ${e.zh.join(` `)} / ${e.en.join(` `)}`).join(`; `);function prepareBreezeTtsText(e){let t=[];return prepareTtsText(e.replace(/[\uE000-\uE002]/gu,` `).replace(/\[[^\]\r\n]+\]|\([^()\r\n]+\)/gu,e=>{if(!Pe.has(e))return e;let n=`${t.length}`;return t.push(e),n}).replace(/\[[^\]\r\n]+\]/gu,` `)).replace(/(\d+)/gu,(e,n)=>t[Number(n)]??``)}function stripBreezeAudioTags(e){return e.replace(/\[[^\]\r\n]+\]|\([^()\r\n]+\)/gu,e=>Pe.has(e)?` `:e)}function splitCompletedTtsSentences(e){let{regions:t,pendingStart:n}=findFencedCodeRegions(e),r=n??e.length,i=[...e.matchAll(le)],a=/[。!?!?;;.\n]+(?:[”’)】》〕\]}'"]*\s*)/gu,o=[],s=0,c=0,splitSegment=(t,n)=>{a.lastIndex=t;let r;for(;(r=a.exec(e))!==null;){if(i.some(e=>r.index>=e.index&&r.index<e.index+e[0].length))continue;let t=r.index+r[0].length;if(t>n)break;if(r[0]===`.`&&/\d/u.test(e[r.index-1]??``)&&(/\d/u.test(e[t]??``)||t===e.length))continue;let a=e.slice(s,t);a.trim().length>0&&o.push(a),s=t,c=t}},l=0;for(let[e,n]of t){if(e>=r)break;l<e&&splitSegment(l,Math.min(e,r)),s=Math.max(s,n),c=Math.max(c,n),l=n}return l<r&&splitSegment(l,r),n===null?{sentences:o,remainder:e.slice(c),consumed:c,inCode:!1}:{sentences:o,remainder:e.slice(n),consumed:n,inCode:!0}}function countTtsSpeechCharacters(e){return(stripXiaomiAudioTags(e).match(/[\p{L}\p{N}]/gu)??[]).length}function splitPreparedTtsSentences(e,t=!0){let n=[],r=0,i=[...e.matchAll(le)];for(let a of e.matchAll(/[.!?;]+/gu)){if(i.some(e=>a.index>=e.index&&a.index<e.index+e[0].length))continue;let o=a.index+a[0].length;a[0]===`.`&&/\d/u.test(e[a.index-1]??``)&&(/\d/u.test(e[o]??``)||!t&&o===e.length)||(n.push(e.slice(r,o)),r=o)}return{sentences:n,remainder:e.slice(r)}}function groupTtsSentences(e,t,n){let r=[],i=``,append=e=>{let a=`${i}${e}`.trim();if(a.length!==0){if(countTtsSpeechCharacters(a)<=n){i=a,countTtsSpeechCharacters(i)>=t&&(r.push(i),i=``);return}i.length>0&&(r.push(i),i=``),i=e.trim(),countTtsSpeechCharacters(i)>=t&&(r.push(i),i=``)}};for(let t of e)append(t);return{segments:r,pending:i}}function segmentsFromPreparedText(e,t,n){let r=Math.max(50,Math.min(t,n)),{sentences:i,remainder:a}=splitPreparedTtsSentences(e),{segments:o,pending:s}=groupTtsSentences(a.length>0?[...i,a]:i,r,n);if(s.length>0){let e=o.at(-1);e!==void 0&&countTtsSpeechCharacters(s)<50&&countTtsSpeechCharacters(`${e}${s}`)<=n?o[o.length-1]=`${e}${s}`:o.push(s)}return o}function splitTtsSegments(e,t=160,n=240,r=prepareTtsText){let i=r(e);return i.length===0?[]:segmentsFromPreparedText(i,t,n)}function splitBreezeTtsSegments(e,t=1e3){let n=prepareBreezeTtsText(e);if(n.length===0)return[];let r=n.match(/\[[^\]\r\n]+\]|\([^()\r\n]+\)|./gu)??[],i=[],a=``;for(let e of r)a&&a.length+e.length>t&&(i.push(a),a=``),a+=e;return a.trim()&&i.push(a),i}function splitBreezeTtsSentences(e,t=160,n=240){let r=prepareBreezeTtsText(e);return r.length===0?[]:segmentsFromPreparedText(r,t,n)}function firstTtsSegment(e){return splitTtsSegments(e)[0]??``}function firstTtsSegments(e,t=1){return t<=0?``:splitTtsSegments(e).slice(0,t).join(``)}var TtsFirstSegmentLimiter=class{locked=null;get complete(){return this.locked!==null}constructor(e=1,t=prepareTtsText){this.segmentCount=e,this.prepare=t}limit(e,t=!1){if(this.locked!==null)return this.locked;let n=this.prepare(e);if(t)return this.locked=segmentsFromPreparedText(n,160,240).slice(0,this.segmentCount).join(``),this.locked;let{sentences:r,remainder:i}=splitPreparedTtsSentences(n,!1),{segments:a,pending:o}=groupTtsSentences(r,160,240);if(a.length>=this.segmentCount)return this.locked=a.slice(0,this.segmentCount).join(``),this.locked;let s=`${a.join(``)}${o}`;if(a.length+(o.length>0?1:0)<this.segmentCount&&countTtsSpeechCharacters(i)>=160){let e=`${s}${i}`;return/(?:\[[^\]\r\n]+\]|\([^()\r\n]+\)|([^()\r\n]+))$/u.test(e)?e:e.replace(/[^\p{L}\p{N}.]+$/u,``)}return s}};function batchTtsStreamText(e,t,n){let r=`${e}${t}`;return countTtsSpeechCharacters(r)>=20||n&&r.trim().length>0?{pending:``,request:r}:{pending:r,request:null}}function batchTtsStreamSegments(e,t,n){let r=groupTtsSentences([e,...t],160,240);return n&&r.pending.length>0&&r.segments.push(r.pending),{pending:n?``:r.pending,requests:r.segments}}function resolveTtsReadScope(e,t){return e===`first-segment`||e===`smart`&&t?`first-segment`:`full`}function applyTtsReadScope(e,t){return t===`first-segment`?firstTtsSegment(e):e}let Fe=[`后面还有内容,先陪你念到这里啦~`,`剩下的部分,查看文字回复吧。`,`完整内容,你来接着往下看吧~`,`后面内容太长了,我就不读了,请查阅。`,`我先念到这里,后面的内容在文字回复里哦。`,`这一段先帮你读到这里,剩下的继续看文字吧。`],Ie=/[,.;:!?,。!?;、:…]$/u;function appendTtsSmartTruncationOutro(e,t,n=Math.random){let r=countTtsSpeechCharacters(t),i=Math.max(0,countTtsSpeechCharacters(e)-r);if(r===0||i<r)return t;let a=t.trimEnd(),o=Math.min(Fe.length-1,Math.max(0,Math.floor(n()*Fe.length)));return`${a}${Ie.test(a)?``:`。`}${Fe[o]}`}function applyTtsPlaybackScope(e,t,n,r=Math.random,i=prepareTtsText){if(i!==prepareTtsText){let a=i(e);if(resolveTtsReadScope(t,n)===`full`)return a;let o=splitTtsSegments(a,void 0,void 0,i).slice(0,t===`smart`&&n?2:1).join(``);return t===`smart`&&n?appendTtsSmartTruncationOutro(a,o,r):o}let a=t===`smart`&&n?firstTtsSegments(e,2):applyTtsReadScope(e,resolveTtsReadScope(t,n));return t===`smart`&&n?appendTtsSmartTruncationOutro(e,a,r):a}function applyBreezeTtsPlaybackScope(e,t,n,r=Math.random){let i=prepareBreezeTtsText(e);if(i.length===0)return``;if(t===`full`||t===`smart`&&!n)return i;let a=t===`smart`?2:1,o=splitBreezeTtsSentences(i).slice(0,a).join(``);return t===`smart`&&n?appendTtsSmartTruncationOutro(i,o,r):o}function applyTtsLivePlaybackScope(e,t,n,r=!1,i=Math.random,a=prepareTtsText){if(resolveTtsReadScope(t,!0)===`full`)return e;let o=a(e),s=n.limit(o,r);return r&&t===`smart`?appendTtsSmartTruncationOutro(o,s,i):s}function supportsXiaomiAudioTags(e){return(e.provider??`xiaomi`)===`xiaomi`&&(e.model??`mimo-v2.5-tts`)===`mimo-v2.5-tts`}function prepareProviderTtsText(e,t){return t.provider===`breeze`?prepareBreezeTtsText(e):supportsXiaomiAudioTags(t)?prepareXiaomiTtsText(e):prepareTtsText((t.provider??`xiaomi`)===`xiaomi`?stripXiaomiAudioTags(e):e)}function resolveTtsSettings(e){let t={...H,...e},n=Number.isFinite(t.soundVolume)?Math.max(0,Math.min(1,t.soundVolume)):H.soundVolume,r=Number.isFinite(t.voiceVolume)?Math.max(0,Math.min(1,t.voiceVolume)):H.voiceVolume,i=normalizeVoiceRate(t.voiceRate),a=e?.readScope!==void 0&&P.includes(e.readScope)?e.readScope:e?.voiceDesignPlaybackMode===`first-segment`?`first-segment`:H.readScope,o=t.model===`browser-local-fallback`?`mimo-v2.5-tts`:t.model,s=typeof e?.voiceDesignCustomPrompt==`string`?e.voiceDesignCustomPrompt:M.some(e=>e.prompt===t.voiceDesignPrompt)?H.voiceDesignCustomPrompt:t.voiceDesignPrompt,c=t.mossEnabled===!0,l=A.includes(t.localVoiceEngine)&&(t.localVoiceEngine!==`moss`||c)?t.localVoiceEngine:`browser`,u=typeof t.mossBaseURL==`string`&&t.mossBaseURL.trim().length>0?t.mossBaseURL.trim().replace(/\/+$/u,``):_;return{...t,showInSidebar:t.showInSidebar===!0,showInHostSettings:t.showInHostSettings!==!1,acceptExternalProviders:t.acceptExternalProviders!==!1,qqbotEnabled:t.qqbotEnabled===!0,announcementSources:ee.filter(t=>(Array.isArray(e?.announcementSources)?e.announcementSources:H.announcementSources).includes(t)),breezeEnabled:t.breezeEnabled===!0,doubaoEnabled:t.doubaoEnabled!==!1||t.breezeEnabled!==!0,provider:t.provider===`doubao`&&(t.doubaoEnabled!==!1||t.breezeEnabled!==!0)||t.provider===`breeze`&&t.breezeEnabled===!0?t.provider:`xiaomi`,instruction:typeof t.instruction==`string`?t.instruction:H.instruction,doubaoInstruction:typeof t.doubaoInstruction==`string`?t.doubaoInstruction:``,doubaoModel:U.includes(t.doubaoModel)?t.doubaoModel:`seed-tts-2.0`,model:o,voiceDesignCustomPrompt:s,localVoiceEngine:l,mossEnabled:c,mossBaseURL:u,mossVoice:typeof t.mossVoice==`string`?t.mossVoice:``,mossVoiceName:typeof t.mossVoiceName==`string`?t.mossVoiceName:``,autoPlay:t.enabled?t.autoPlay:!1,voiceInputCompatibility:t.voiceInputCompatibility!==!1,inputAvoidance:t.inputAvoidance===!0,importantAnnouncementsFirst:t.importantAnnouncementsFirst===!0,soundVolume:n,voiceVolume:r,voiceRate:i,readScope:a,soundPack:F.includes(t.soundPack)?t.soundPack:H.soundPack}}let Re=[[`Vivi 2.0`,`zh_female_vv_uranus_bigtts`,`通用`],[`知性灿灿 2.0`,`zh_female_cancan_uranus_bigtts`,`角色`],[`撒娇学妹 2.0`,`zh_female_sajiaoxuemei_uranus_bigtts`,`角色`],[`爽快思思 2.0`,`zh_female_shuangkuaisisi_uranus_bigtts`,`通用`],[`少年梓辛 2.0`,`zh_male_shaonianzixin_uranus_bigtts`,`通用`],[`猴哥 2.0`,`zh_male_sunwukong_uranus_bigtts`,`配音`],[`黑猫侦探社咪仔 2.0`,`zh_female_mizai_uranus_bigtts`,`配音`],[`儒雅逸辰 2.0`,`zh_male_ruyayichen_uranus_bigtts`,`配音`],[`TVB女声 2.0`,`zh_female_tvbnv_uranus_bigtts`,`通用`],[`四郎 2.0`,`zh_male_silang_uranus_bigtts`,`角色`],[`熊二 2.0`,`zh_male_xionger_uranus_bigtts`,`角色`],[`樱桃丸子 2.0`,`zh_female_yingtaowanzi_uranus_bigtts`,`角色`],[`高冷御姐 2.0`,`zh_female_gaolengyujie_uranus_bigtts`,`通用`],[`傲娇霸总 2.0`,`zh_male_aojiaobazong_uranus_bigtts`,`通用`],[`悬疑解说 2.0`,`zh_male_xuanyijieshuo_uranus_bigtts`,`阅读`],[`小何 2.0`,`zh_female_xiaohe_uranus_bigtts`,`通用`],[`云舟 2.0`,`zh_male_m191_uranus_bigtts`,`通用`],[`小天 2.0`,`zh_male_taocheng_uranus_bigtts`,`通用`],[`清澈梓梓 2.0`,`zh_female_qingchezizi_uranus_bigtts`,`通用`],[`女雷神 2.0`,`zh_female_nvleishen_uranus_bigtts`,`角色`],[`直率英子 2.0`,`zh_female_zhishuaiyingzi_uranus_bigtts`,`角色`],[`谄媚女声 2.0`,`zh_female_chanmeinv_uranus_bigtts`,`通用`],[`玲玲姐姐 2.0`,`zh_female_lingling_uranus_bigtts`,`角色`],[`娇喘女声 2.0`,`zh_female_jiaochuannv_uranus_bigtts`,`通用`],[`鲁班七号 2.0`,`zh_male_lubanqihao_uranus_bigtts`,`角色`],[`春日部姐姐 2.0`,`zh_female_chunribu_uranus_bigtts`,`角色`],[`温柔妈妈 2.0`,`zh_female_wenroumama_uranus_bigtts`,`通用`],[`霸气青叔 2.0`,`zh_male_baqiqingshu_uranus_bigtts`,`阅读`],[`深夜播客 2.0`,`zh_male_shenyeboke_uranus_bigtts`,`通用`],[`儿童绘本 2.0`,`zh_female_xiaoxue_uranus_bigtts`,`阅读`]].map(([e,t,n])=>({name:e,value:t,scene:n,language:`中文 / Chinese`,resourceId:`seed-tts-2.0`,bidirectional:!0}));function mossVoiceChoices(e,t,n){return t.trim().length===0||e.some(e=>e.id===t)?[...e]:[{id:t,name:n.trim()||t},...e]}var AutomaticReading=class{mode=`all`;listeners=new Set;running=new Map;blocked=new Set;automatic=!1;getSnapshot=()=>this.mode;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});update(e,t,n){let r=e===`final`?`final`:`all`;if(r!==this.mode){this.mode=r;for(let[e,t]of this.running)t&&this.blocked.add(e);this.automatic&&t(),this.automatic=!1,n();for(let e of this.listeners)e()}}observe(e,t){t&&this.running.get(e)!==!0&&this.blocked.delete(e),this.running.set(e,t)}allowed(e){return!this.blocked.has(e)}isAutomatic(){return this.automatic}interruptAutomatic(e){for(let[e,t]of this.running)t&&this.blocked.add(e);this.automatic&&e(),this.automatic=!1}markAutomatic(){this.automatic=!0}markManual(){this.automatic=!1}release(e){this.running.delete(e),this.blocked.delete(e)}},Ve={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},He=l.default.createContext&&l.default.createContext(Ve),Ue=[`attr`,`size`,`title`];function _objectWithoutProperties(e,t){if(e==null)return{};var n,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_extends.apply(null,arguments)}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){var t=_toPrimitive(e,`string`);return typeof t==`symbol`?t:t+``}function _toPrimitive(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Tree2Element(e){return e&&e.map((e,t)=>l.default.createElement(e.tag,_objectSpread({key:t},e.attr),Tree2Element(e.child)))}function GenIcon(e){return t=>l.default.createElement(IconBase,_extends({attr:_objectSpread({},e.attr)},t),Tree2Element(e.child))}function IconBase(e){var elem=t=>{var n=e.attr,r=e.size,i=e.title,a=_objectWithoutProperties(e,Ue),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),l.default.createElement(`svg`,_extends({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:_objectSpread(_objectSpread({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&l.default.createElement(`title`,null,i),e.children)};return He===void 0?elem(Ve):l.default.createElement(He.Consumer,null,e=>elem(e))}function RiKey2Line(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M10.7577 11.8281L18.6066 3.97919L20.0208 5.3934L18.6066 6.80761L21.0815 9.28249L19.6673 10.6967L17.1924 8.22183L15.7782 9.63604L17.8995 11.7574L16.4853 13.1716L14.364 11.0503L12.1719 13.2423C13.4581 15.1837 13.246 17.8251 11.5355 19.5355C9.58291 21.4882 6.41709 21.4882 4.46447 19.5355C2.51184 17.5829 2.51184 14.4171 4.46447 12.4645C6.17493 10.754 8.81633 10.5419 10.7577 11.8281ZM10.1213 18.1213C11.2929 16.9497 11.2929 15.0503 10.1213 13.8787C8.94975 12.7071 7.05025 12.7071 5.87868 13.8787C4.70711 15.0503 4.70711 16.9497 5.87868 18.1213C7.05025 19.2929 8.94975 19.2929 10.1213 18.1213Z`},child:[]}]})(e)}function RiPushpinLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M13.8273 1.69L22.3126 10.1753L20.8984 11.5895L20.1913 10.8824L15.9486 15.125L15.2415 18.6606L13.8273 20.0748L9.58466 15.8321L4.63492 20.7819L3.2207 19.3677L8.17045 14.4179L3.92781 10.1753L5.34202 8.76107L8.87756 8.05396L13.1202 3.81132L12.4131 3.10422L13.8273 1.69ZM14.5344 5.22554L9.86358 9.89637L7.0417 10.4607L13.5418 16.9609L14.1062 14.139L18.7771 9.46818L14.5344 5.22554Z`},child:[]}]})(e)}function RiPushpinFill(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M22.3126 10.1753L20.8984 11.5895L20.1913 10.8824L15.9486 15.125L15.2415 18.6606L13.8273 20.0748L9.58466 15.8321L4.63492 20.7819L3.2207 19.3677L8.17045 14.4179L3.92781 10.1753L5.34202 8.76107L8.87756 8.05396L13.1202 3.81132L12.4131 3.10422L13.8273 1.69L22.3126 10.1753Z`},child:[]}]})(e)}function RiDownloadLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M3 19H21V21H3V19ZM13 13.1716L19.0711 7.1005L20.4853 8.51472L12 17L3.51472 8.51472L4.92893 7.1005L11 13.1716V2H13V13.1716Z`},child:[]}]})(e)}function RiDeleteBinLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 11H11V17H9V11ZM13 11H15V17H13V11ZM9 4V6H15V4H9Z`},child:[]}]})(e)}function RiCheckLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z`},child:[]}]})(e)}function RiVoiceAiFill(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M20.7134 7.12811L20.4668 7.69379C20.2864 8.10792 19.7136 8.10792 19.5331 7.69379L19.2866 7.12811C18.8471 6.11947 18.0555 5.31641 17.0677 4.87708L16.308 4.53922C15.8973 4.35653 15.8973 3.75881 16.308 3.57612L17.0252 3.25714C18.0384 2.80651 18.8442 1.97373 19.2761 0.930828L19.5293 0.319534C19.7058 -0.106511 20.2942 -0.106511 20.4706 0.319534L20.7238 0.930828C21.1558 1.97373 21.9616 2.80651 22.9748 3.25714L23.6919 3.57612C24.1027 3.75881 24.1027 4.35653 23.6919 4.53922L22.9323 4.87708C21.9445 5.31641 21.1529 6.11947 20.7134 7.12811ZM8.5 6H6.5V18H8.5V6ZM4 10H2V14H4V10ZM13 2H11V22H13V2ZM17.5 8H15.5V18H17.5V8ZM22 10H20V14H22V10Z`},child:[]}]})(e)}function RiRadio2Line(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M6 3V1H8V3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H6ZM4 5V19H20V5H4ZM9 15C7.34315 15 6 13.6569 6 12C6 10.3431 7.34315 9 9 9C10.6569 9 12 10.3431 12 12C12 13.6569 10.6569 15 9 15ZM14 9H18V11H14V9ZM14 13H18V15H14V13Z`},child:[]}]})(e)}function RiEqualizerLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M6.17071 18C6.58254 16.8348 7.69378 16 9 16C10.3062 16 11.4175 16.8348 11.8293 18H22V20H11.8293C11.4175 21.1652 10.3062 22 9 22C7.69378 22 6.58254 21.1652 6.17071 20H2V18H6.17071ZM12.1707 11C12.5825 9.83481 13.6938 9 15 9C16.3062 9 17.4175 9.83481 17.8293 11H22V13H17.8293C17.4175 14.1652 16.3062 15 15 15C13.6938 15 12.5825 14.1652 12.1707 13H2V11H12.1707ZM6.17071 4C6.58254 2.83481 7.69378 2 9 2C10.3062 2 11.4175 2.83481 11.8293 4H22V6H11.8293C11.4175 7.16519 10.3062 8 9 8C7.69378 8 6.58254 7.16519 6.17071 6H2V4H6.17071ZM9 6C9.55228 6 10 5.55228 10 5C10 4.44772 9.55228 4 9 4C8.44772 4 8 4.44772 8 5C8 5.55228 8.44772 6 9 6ZM15 13C15.5523 13 16 12.5523 16 12C16 11.4477 15.5523 11 15 11C14.4477 11 14 11.4477 14 12C14 12.5523 14.4477 13 15 13ZM9 20C9.55228 20 10 19.5523 10 19C10 18.4477 9.55228 18 9 18C8.44772 18 8 18.4477 8 19C8 19.5523 8.44772 20 9 20Z`},child:[]}]})(e)}function RiDiscLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M15 4.58152V12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C12.3506 9 12.6872 9.06016 13 9.17071V2.04938C18.0533 2.5511 22 6.81465 22 12C22 17.5229 17.5228 22 12 22C6.47715 22 2 17.5229 2 12C2 6.81465 5.94668 2.5511 11 2.04938V4.0619C7.05369 4.55399 4 7.92038 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 8.64262 17.9318 5.76829 15 4.58152Z`},child:[]}]})(e)}function RiSwitchFill(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M13.62 21C13.5351 21 13.4786 20.9434 13.4927 20.8727V3.12726C13.4927 3.0707 13.5351 3.01414 13.6058 3.01414H16.3914C18.9366 3.01414 21.001 5.07855 21.001 7.62372V16.3904C21.001 18.9356 18.9366 21 16.3914 21H13.62ZM17.0418 11.0738C16.0379 11.0738 15.2178 11.894 15.2178 12.8979C15.2178 13.9018 16.0379 14.7219 17.0418 14.7219C18.0458 14.7219 18.8659 13.9018 18.8659 12.8979C18.8659 11.894 18.0458 11.0738 17.0418 11.0738ZM5.80066 8.40141C5.80066 7.46819 6.56421 6.70463 7.49744 6.70463C8.43067 6.70463 9.19422 7.46819 9.19422 8.40141C9.19422 9.33464 8.43067 10.0982 7.49744 10.0982C6.56421 10.0982 5.80066 9.33464 5.80066 8.40141ZM11.5414 3C11.6263 3 11.6828 3.05656 11.6687 3.12726V20.8586C11.6687 20.9293 11.6121 20.9859 11.5414 20.9859H7.61056C5.06539 20.9859 3.00098 18.9214 3.00098 16.3763V7.60958C3.00098 5.06441 5.06539 3 7.61056 3H11.5414ZM10.2264 19.5436V4.44226H7.61056C6.76217 4.44226 5.97034 4.78162 5.37647 5.37549C4.76846 5.96936 4.44324 6.76119 4.44324 7.60958V16.3763C4.44324 17.2247 4.78259 18.0165 5.37647 18.6104C5.97034 19.2184 6.76217 19.5436 7.61056 19.5436H10.2264Z`},child:[]}]})(e)}function RiSaveLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M7 19V13H17V19H19V7.82843L16.1716 5H5V19H7ZM4 3H17L21 7V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM9 15V19H15V15H9Z`},child:[]}]})(e)}function RiEditLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M6.41421 15.89L16.5563 5.74785L15.1421 4.33363L5 14.4758V15.89H6.41421ZM7.24264 17.89H3V13.6473L14.435 2.21231C14.8256 1.82179 15.4587 1.82179 15.8492 2.21231L18.6777 5.04074C19.0682 5.43126 19.0682 6.06443 18.6777 6.45495L7.24264 17.89ZM3 19.89H21V21.89H3V19.89Z`},child:[]}]})(e)}function RiArrowLeftSLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z`},child:[]}]})(e)}function RiArrowDownSLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z`},child:[]}]})(e)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function useSettingsSnapshot(e){let t=(0,l.useCallback)(t=>e.subscribe(t),[e]),n=(0,l.useCallback)(()=>e.getSnapshot(),[e]);return(0,l.useSyncExternalStore)(t,n,n)}let Ke=(0,l.createContext)({});function useConstant(e){let t=(0,l.useRef)(null);return t.current===null&&(t.current=e()),t.current}let Je=typeof window<`u`?l.useLayoutEffect:l.useEffect,Ye=(0,l.createContext)(null);function addUniqueItem(e,t){e.indexOf(t)===-1&&e.push(t)}function removeItem(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}let clamp$1=(e,t,n)=>n>t?t:n<e?e:n,Ze={},isNumericalString=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),isObject=e=>typeof e==`object`&&!!e,isZeroValueString=e=>/^0[^.\s]+$/u.test(e);function memo(e){let t;return()=>(t===void 0&&(t=e()),t)}let noop=e=>e,pipe=(...e)=>e.reduce((e,t)=>n=>t(e(n))),progress=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1};var SubscriptionManager=class{constructor(){this.subscriptions=[]}add(e){return addUniqueItem(this.subscriptions,e),()=>this.remove(e)}remove(e){removeItem(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}};let secondsToMilliseconds=e=>e*1e3,millisecondsToSeconds=e=>e/1e3,velocityPerSecond=(e,t)=>t?e*(1e3/t):0,calcBezier=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function binarySubdivide(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=calcBezier(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>1e-7&&++s<12);return o}function cubicBezier(e,t,n,r){if(e===t&&n===r)return noop;let getTForX=t=>binarySubdivide(t,0,1,e,n);return e=>e===0||e===1?e:calcBezier(getTForX(e),t,r)}let mirrorEasing=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,reverseEasing=e=>t=>1-e(1-t),Qe=cubicBezier(.33,1.53,.69,.99),et=reverseEasing(Qe),tt=mirrorEasing(et),anticipate=e=>e>=1?1:(e*=2)<1?.5*et(e):.5*(2-2**(-10*(e-1))),circIn=e=>1-Math.sin(Math.acos(e)),nt=reverseEasing(circIn),rt=mirrorEasing(circIn),it=cubicBezier(.42,0,1,1),at=cubicBezier(0,0,.58,1),ot=cubicBezier(.42,0,.58,1),isEasingArray=e=>Array.isArray(e)&&typeof e[0]!=`number`,isBezierDefinition=e=>Array.isArray(e)&&typeof e[0]==`number`,st={linear:noop,easeIn:it,easeInOut:ot,easeOut:at,circIn,circInOut:rt,circOut:nt,backIn:et,backInOut:tt,backOut:Qe,anticipate},isValidEasing=e=>typeof e==`string`,easingDefinitionToFunction=e=>{if(isBezierDefinition(e)){e.length;let[t,n,r,i]=e;return cubicBezier(t,n,r,i)}else if(isValidEasing(e))return st[e],`${e}`,st[e];return e},ct={delta:0,timestamp:0,isProcessing:!1},lt;function clearTime(){lt=void 0}let ut={now:()=>(lt===void 0&&ut.set(ct.isProcessing||Ze.useManualTiming?ct.timestamp:performance.now()),lt),set:e=>{lt=e,queueMicrotask(clearTime)}},sanitize=e=>Math.round(e*1e5)/1e5,checkStringStartsWith=e=>t=>typeof t==`string`&&t.startsWith(e),dt=checkStringStartsWith(`--`),ft=checkStringStartsWith(`var(--`),isCSSVariableToken=e=>ft(e)?pt.test(e.split(`/*`)[0].trim()):!1,pt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function containsCSSVariable(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}let mt={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},ht={...mt,transform:e=>clamp$1(0,1,e)},gt={...mt,default:1},_t=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function isNullish(e){return e==null}let vt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,isColorString=(e,t)=>n=>!!(typeof n==`string`&&vt.test(n)&&n.startsWith(e)||t&&!isNullish(n)&&Object.prototype.hasOwnProperty.call(n,t)),splitColor=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(_t);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},clampRgbUnit=e=>clamp$1(0,255,e),yt={...mt,transform:e=>Math.round(clampRgbUnit(e))},bt={test:isColorString(`rgb`,`red`),parse:splitColor(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+yt.transform(e)+`, `+yt.transform(t)+`, `+yt.transform(n)+`, `+sanitize(ht.transform(r))+`)`};function parseHex(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}let xt={test:isColorString(`#`),parse:parseHex,transform:bt.transform},createUnitType=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),St=createUnitType(`deg`),Ct=createUnitType(`%`),G=createUnitType(`px`),wt=createUnitType(`vh`),Tt=createUnitType(`vw`),Et=(()=>({...Ct,parse:e=>Ct.parse(e)/100,transform:e=>Ct.transform(e*100)}))(),Dt={test:isColorString(`hsl`,`hue`),parse:splitColor(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Ct.transform(sanitize(t))+`, `+Ct.transform(sanitize(n))+`, `+sanitize(ht.transform(r))+`)`},Ot={test:e=>bt.test(e)||xt.test(e)||Dt.test(e),parse:e=>bt.test(e)?bt.parse(e):Dt.test(e)?Dt.parse(e):xt.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?bt.transform(e):Dt.transform(e),getAnimatableNone:e=>{let t=Ot.parse(e);return t.alpha=0,Ot.transform(t)}},kt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,At=new RegExp(_t.source),jt=new RegExp(kt.source,`i`);function test(e){return isNaN(e)&&typeof e==`string`&&(At.test(e)||jt.test(e))}let Mt=`number`,Nt=`color`,Pt=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function hasComplexValues(e){let t=e.toString();return At.test(t)||jt.test(t)}function analyseComplexValue(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Pt,e=>(Ot.test(e)?(r.color.push(a),i.push(Nt),n.push(Ot.parse(e))):e.startsWith(`var(`)?(r.var.push(a),i.push(`var`),n.push(e)):(r.number.push(a),i.push(Mt),n.push(parseFloat(e))),++a,"${}")).split("${}"),indexes:r,types:i}}function parseComplexValue(e){return analyseComplexValue(e).values}function buildTransformer({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===Mt?i+=sanitize(r[a]):e===Nt?i+=Ot.transform(r[a]):i+=r[a]}return i}}function createTransformer(e){return buildTransformer(analyseComplexValue(e))}let convertNumbersToZero=e=>typeof e==`number`?0:Ot.test(e)?Ot.getAnimatableNone(e):e,convertToZero=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:convertNumbersToZero(e);function getAnimatableNone$1(e){let t=analyseComplexValue(e);return buildTransformer(t)(t.values.map((e,n)=>convertToZero(e,t.split[n])))}__name(getAnimatableNone$1,`getAnimatableNone`);let Ft={test,parse:parseComplexValue,createTransformer,getAnimatableNone:getAnimatableNone$1};function hueToRgb(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function hslaToRgba({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=hueToRgb(s,r,e+1/3),a=hueToRgb(s,r,e),o=hueToRgb(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function mixImmediate(e,t){return n=>n>0?t:e}let mixNumber=(e,t,n)=>e+(t-e)*n,mixLinearColor=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},It=[xt,bt,Dt],getColorType=e=>It.find(t=>t.test(e));function asRGBA(e){let t=getColorType(e);if(!t)return`${e}`,!1;let n=t.parse(e);return t===Dt&&(n=hslaToRgba(n)),n}let mixColor=(e,t)=>{let n=asRGBA(e),r=asRGBA(t);if(!n||!r)return mixImmediate(e,t);let i={...n};return e=>(i.red=mixLinearColor(n.red,r.red,e),i.green=mixLinearColor(n.green,r.green,e),i.blue=mixLinearColor(n.blue,r.blue,e),i.alpha=mixNumber(n.alpha,r.alpha,e),bt.transform(i))},Lt=new Set([`none`,`hidden`]);function mixVisibility(e,t){return Lt.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function mixNumber$1(e,t){return n=>mixNumber(e,t,n)}__name(mixNumber$1,`mixNumber`);function getMixer(e){return typeof e==`number`?mixNumber$1:typeof e==`string`?isCSSVariableToken(e)?mixImmediate:Ot.test(e)?mixColor:mixComplex:Array.isArray(e)?mixArray:typeof e==`object`?Ot.test(e)?mixColor:mixObject:mixImmediate}function mixArray(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>getMixer(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function mixObject(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=getMixer(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function matchOrder(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}let mixComplex=(e,t)=>{let n=Ft.createTransformer(t),r=analyseComplexValue(e),i=analyseComplexValue(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Lt.has(e)&&!i.values.length||Lt.has(t)&&!r.values.length?mixVisibility(e,t):pipe(mixArray(matchOrder(r,i),i.values),n):(`${e}${t}`,mixImmediate(e,t))},Rt=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function mixUnit(e,t){let n=Rt.exec(e);if(!n)return;let r=Rt.exec(t);if(!r||n[2]!==r[2])return;let i=n[2],a=parseFloat(n[1]),o=parseFloat(r[1]);return e=>sanitize(mixNumber(a,o,e))+i}function mix(e,t,n){if(typeof e==`number`&&typeof t==`number`&&typeof n==`number`)return mixNumber(e,t,n);if(typeof e==`string`&&typeof t==`string`){let n=mixUnit(e,t);if(n)return n}return getMixer(e)(e,t)}let zt=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function createRenderStep(e){let t=new Set,n=new Set,r=!1,i=!1,a=new Set,o={delta:0,timestamp:0,isProcessing:!1};function triggerCallback(t){a.has(t)&&(n.add(t),e()),t(o)}let s={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(triggerCallback),t.clear(),r=!1,i&&(i=!1,s.process(e))}};return s}function createRenderBatcher(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0,flagRunNextFrame=()=>r=!0,a=zt.reduce((e,t)=>(e[t]=createRenderStep(flagRunNextFrame),e),{}),{setup:o,read:s,resolveKeyframes:c,preUpdate:l,update:u,preRender:d,render:p,postRender:m}=a,processBatch=()=>{let a=Ze.useManualTiming,h=a?n.timestamp:performance.now();r=!1,a||(n.delta=i?1e3/60:Math.max(Math.min(h-n.timestamp,40),1)),n.timestamp=h,n.isProcessing=!0,o.process(n),s.process(n),c.process(n),l.process(n),u.process(n),d.process(n),p.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(processBatch))},wake=()=>{r=!0,i=!0,n.isProcessing||e(processBatch)},h=zt.reduce((e,t)=>{let n=a[t];return e[t]=(e,t=!1,i=!1)=>(r||wake(),n.schedule(e,t,i)),e},{}),cancel=e=>{for(let t=0;t<zt.length;t++)a[zt[t]].cancel(e)};return{schedule:h,cancel,state:n,steps:a}}let{schedule:q,cancel:Bt,steps:Vt}=createRenderBatcher(typeof requestAnimationFrame<`u`?requestAnimationFrame:noop,!0,ct),frameloopDriver=e=>{let passTimestamp=({timestamp:t})=>e(t);return{start:(e=!0)=>q.update(passTimestamp,e),stop:()=>Bt(passTimestamp),now:()=>ct.isProcessing?ct.timestamp:ut.now()}},generateLinearEasing=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Ht=2e4;function calcGeneratorDuration(e,t=50,n=Ht,r){let i=0,a=e.next(i);for(r?.push(a.value);!a.done&&i<n;)i+=t,a=e.next(i),r?.push(a.value);return i>=n?1/0:i}function createGeneratorEasing(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(calcGeneratorDuration(r),Ht);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:millisecondsToSeconds(i)}}let Ut={stiffness:100,damping:10,mass:1,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05},bounceToDampingRatio=e=>e<0?1/Math.max(1+e,Ut.minDamping):Math.max(1-e,Ut.minDamping);function overdampedFreqScale(e,t){if(!(e>1))return 1;let n=Math.sqrt(e*e-1),r=e-n,i=e+n,a=2*n*Math.exp(-t)*(1+t);return approximateRoot(e=>i*Math.exp(-r*e)-r*Math.exp(-i*e)-a,e=>Math.exp(-i*e)-Math.exp(-r*e),t)/t}function calcAngularFreq(e,t){return e*Math.sqrt(1-t*t)}function approximateRoot(e,t,n){let r=n;for(let n=1;n<12;n++)r-=e(r)/t(r);return r}let Y=.001;function findSpring({duration:e=Ut.duration,bounce:t=Ut.bounce}){let envelope,derivative;Ut.maxDuration;let n=bounceToDampingRatio(t);e=clamp$1(Ut.minDuration,Ut.maxDuration,millisecondsToSeconds(e)),n<1?(envelope=t=>{let r=t*n,i=r*e,a=calcAngularFreq(t,n),o=Math.exp(-i);return Y-r/a*o},derivative=t=>{let r=t*n*e,i=n*n*t*t*e,a=Math.exp(-r),o=calcAngularFreq(t*t,n);return(-envelope(t)+Y>0?-1:1)*-i*a/o}):(envelope=t=>{let n=Math.exp(-t*e),r=t*e+1;return-Y+n*r},derivative=t=>Math.exp(-t*e)*(-t*(e*e)));let r=5/e,i=approximateRoot(envelope,derivative,r),a=i*overdampedFreqScale(n,i*e),o=a*a;return{stiffness:o,damping:n*2*Math.sqrt(o),duration:secondsToMilliseconds(e)}}let isValidPhysics=(e,t)=>(t?e>=0:e>0)&&e<1/0;function resolvePhysics(e,t){if(isValidPhysics(e,t))return e}function getSpringOptions(e){let t=resolvePhysics(e.stiffness),n=resolvePhysics(e.damping,!0),r=resolvePhysics(e.mass),i={...e,stiffness:t??Ut.stiffness,damping:n??Ut.damping,mass:r??Ut.mass,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){let t=bounceToDampingRatio(e.bounce||0),n=2*Math.PI/(e.visualDuration*1.2)*overdampedFreqScale(t,2*Math.PI/1.2);i.stiffness=n*n,i.damping=2*t*Math.sqrt(i.stiffness)}else Object.assign(i,findSpring(i)),i.isResolvedFromDuration=!0;(!isValidPhysics(i.stiffness)||!isValidPhysics(i.damping,!0))&&(i.stiffness=Ut.stiffness,i.damping=Ut.damping)}return i}function spring(e=Ut.visualDuration,t=Ut.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:o,damping:s,mass:c,duration:l,isResolvedFromDuration:u,isTimeDefined:d}=getSpringOptions({...n}),inheritVelocity=e=>d?0:-millisecondsToSeconds(e),p=s/(2*Math.sqrt(o*c)),m=millisecondsToSeconds(Math.sqrt(o/c)),h=p*m,g={target:i,delta:i-r,velocity:inheritVelocity(n.velocity||0)||0,restSpeed:0,restDelta:0},setRestThresholds=()=>{let e=Math.abs(g.delta)<5;g.restSpeed=n.restSpeed||(e?Ut.restSpeed.granular:Ut.restSpeed.default),g.restDelta=n.restDelta||(e?Ut.restDelta.granular:Ut.restDelta.default)};setRestThresholds();let resolveSpring,resolveVelocity,update;if(p<1){let e=calcAngularFreq(m,p),t={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};update=()=>{t.A=(g.velocity+h*g.delta)/e,t.sinC=h*t.A+g.delta*e,t.cosC=h*g.delta-t.A*e};let sample=n=>{n!==t.t&&(t.t=n,t.env=Math.exp(-h*n),t.sin=Math.sin(e*n),t.cos=Math.cos(e*n))};resolveSpring=e=>(sample(e),g.target-t.env*(t.A*t.sin+g.delta*t.cos)),resolveVelocity=e=>(sample(e),t.env*(t.sinC*t.sin+t.cosC*t.cos))}else if(p===1){resolveSpring=e=>g.target-Math.exp(-m*e)*(g.delta+(g.velocity+m*g.delta)*e);let e={C:0};update=()=>{e.C=g.velocity+m*g.delta},resolveVelocity=t=>Math.exp(-m*t)*(m*e.C*t-g.velocity)}else{let e=m*Math.sqrt(p*p-1),t=h-e,n=h+e,r=d?1/0:300/e,decayAt=(e,t)=>Math.exp(t>r?-e*r-h*(t-r):-e*t),i={S:0,F:0};update=()=>{let t=(g.velocity+h*g.delta)/e;i.S=(g.delta+t)/2,i.F=(g.delta-t)/2},resolveSpring=e=>g.target-i.S*decayAt(t,e)-i.F*decayAt(n,e),resolveVelocity=e=>t*i.S*decayAt(t,e)+n*i.F*decayAt(n,e)}update();let _=u&&l||null,v={calculatedDuration:_,retarget:(e,t)=>{g.target=e[e.length-1],g.delta=g.target-e[0],g.velocity=inheritVelocity(t),n.restSpeed&&n.restDelta||setRestThresholds(),v.calculatedDuration=_,a.done=!1,update()},velocity:e=>secondsToMilliseconds(resolveVelocity(e)),next:e=>{let t=resolveSpring(e);if(u)a.done=e>=l;else{let n=secondsToMilliseconds(resolveVelocity(e));a.done=Math.abs(n)<=g.restSpeed&&Math.abs(g.target-t)<=g.restDelta}return a.value=a.done?g.target:t,a},toString:()=>{let e=Math.min(calcGeneratorDuration(v),Ht),t=generateLinearEasing(t=>v.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return v}spring.applyToOptions=e=>{let t=createGeneratorEasing(e,100,spring);return e.ease=t.ease,e.duration=secondsToMilliseconds(t.duration),e.type=`keyframes`,e};function inertia({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],p={done:!1,value:d},isOutOfBounds=e=>e<s||e>c,nearestBoundary=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,m=n*t,h=d+m,g=o===void 0?h:o(h);g!==h&&(m=g-d);let calcDelta=e=>-m*Math.exp(-e/r),applyFriction=e=>{let t=calcDelta(e);p.done=Math.abs(t)<=l,p.value=p.done?g:g+t},_,v,checkCatchBoundary=e=>{isOutOfBounds(p.value)&&(_=e,v=spring({keyframes:[p.value,nearestBoundary(p.value)],velocity:-calcDelta(e)/r*1e3,damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return checkCatchBoundary(0),{calculatedDuration:null,next:e=>{let t=!1;return!v&&_===void 0&&(t=!0,applyFriction(e),checkCatchBoundary(e)),_!==void 0&&e>=_?v.next(e-_):(!t&&applyFriction(e),p)}}}function createMixers(e,t,n){let r=[],i=n||Ze.mix||mix,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=pipe(Array.isArray(t)?t[n]||noop:t,a)),r.push(a)}return r}function interpolate(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=createMixers(t,r,i),c=s.length,interpolator=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=progress(e[r],e[r+1],n);return s[r](i)};return n?t=>interpolator(clamp$1(e[0],e[a-1],t)):interpolator}function fillOffset(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=progress(0,t,r);e.push(mixNumber(n,1,i))}}function defaultOffset(e){let t=[0];return fillOffset(t,e.length-1),t}function convertOffsetToTimes(e,t){return e.map(e=>e*t)}function defaultEasing(e,t){return e.map(()=>t||ot).splice(0,e.length-1)}function keyframes({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=isEasingArray(r)?r.map(easingDefinitionToFunction):easingDefinitionToFunction(r)||ot,a={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(i)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){let[n,r]=t,o=n===r?void 0:(Ze.mix||mix)(n,r);return{calculatedDuration:e,next:t=>(a.value=o?o(i(e>0?clamp$1(0,1,t/e):1)):r,a.done=t>=e,a)}}let o=interpolate(convertOffsetToTimes(n&&n.length===t.length?n:defaultOffset(t),e),t,{ease:Array.isArray(i)?i:defaultEasing(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}function getGeneratorVelocity(e,t,n){let r=Math.max(t-5,0);return velocityPerSecond(n-e(r),t-r)}function calcGeneratorVelocity(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):getGeneratorVelocity(t=>e.next(t).value,t,e.next(t).value)}let isNotNull=e=>e!==null;function getFinalKeyframe(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(isNotNull),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}let Wt={decay:inertia,inertia,tween:keyframes,keyframes,spring};function replaceTransitionType(e){typeof e.type==`string`&&(e.type=Wt[e.type])}let resolveStartTime=(e,t)=>t-e>40&&!Ze.useManualTiming?t:e;function baseRecord(e,t){return{kind:e,animation:t,timestamp:ut.now(),frameTimestamp:ct.timestamp,frameIsProcessing:ct.isProcessing}}function notifyAnimationStart(e,t,n){let r=globalThis.__MOTION_INSPECT__;if(r)try{r({...baseRecord(`animation-start`,e),options:n?{...t,...n}:t})}catch{}}function notifyLayoutAnimationStart(e,t){let n=globalThis.__MOTION_INSPECT__;if(n)try{n({...baseRecord(`layout-animation-start`,e),node:t})}catch{}}var WithPromise=class{constructor(){this.isResolved=!1}get finished(){return this._finished||=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e}),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}};let percentToProgress=e=>e/100;var JSAnimation=class extends WithPromise{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==ut.now()&&this.tick(ut.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),notifyAnimationStart(this,this.options)}initAnimation(){let{options:e}=this;replaceTransitionType(e);let{type:t=keyframes,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||keyframes;s!==keyframes&&typeof o[0]!=`number`&&(this.mixKeyframes=pipe(percentToProgress,mix(o[0],o[1])),o=[0,100]);let c=s(o===e.keyframes?e:{...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=calcGeneratorDuration(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:p,type:m,onUpdate:h,finalKeyframe:g}=this.options;this.startTime===this.pendingStartTime&&(this.startTime=resolveStartTime(this.startTime,e)),this.pendingStartTime=void 0,this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let _=this.currentTime-c*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?_<0:_>r;this.currentTime=Math.max(_,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let b=this.currentTime,x=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,p&&(n-=p/o)):d===`mirror`&&(x=a)),b=clamp$1(0,1,n)*o}let S;v?(this.delayState.value=l[0],S=this.delayState):S=x.next(b),i&&!v&&(S.value=i(S.value));let{done:C}=S;!v&&s!==null&&(C=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let w=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&C);return w&&m!==inertia&&(S.value=getFinalKeyframe(l,this.options,g,this.speed)),h&&h(S.value),w&&this.finish(),S}then(e,t){return this.finished.then(e,t)}get duration(){return millisecondsToSeconds(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+millisecondsToSeconds(e)}get time(){return millisecondsToSeconds(this.currentTime)}set time(e){e=secondsToMilliseconds(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return calcGeneratorVelocity(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(ut.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=millisecondsToSeconds(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=frameloopDriver,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??(this.pendingStartTime=n):this.startTime=n-this.holdTime/(this.playbackSpeed||1),this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(ut.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};let Gt=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function applyDefaultFilter(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(_t)||[];if(!r)return e;let i=n.replace(r,``),a=Gt.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}let Kt=/\b([a-z-]*)\(.*?\)/gu,qt={...Ft,getAnimatableNone:e=>{let t=e.match(Kt);return t?t.map(applyDefaultFilter).join(` `):e}},Jt={...Ft,getAnimatableNone:e=>{let t=Ft.parse(e);return Ft.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Yt={...mt,transform:Math.round},Xt={borderWidth:G,borderTopWidth:G,borderRightWidth:G,borderBottomWidth:G,borderLeftWidth:G,borderRadius:G,borderTopLeftRadius:G,borderTopRightRadius:G,borderBottomRightRadius:G,borderBottomLeftRadius:G,width:G,maxWidth:G,height:G,maxHeight:G,top:G,right:G,bottom:G,left:G,inset:G,insetBlock:G,insetBlockStart:G,insetBlockEnd:G,insetInline:G,insetInlineStart:G,insetInlineEnd:G,padding:G,paddingTop:G,paddingRight:G,paddingBottom:G,paddingLeft:G,paddingBlock:G,paddingBlockStart:G,paddingBlockEnd:G,paddingInline:G,paddingInlineStart:G,paddingInlineEnd:G,margin:G,marginTop:G,marginRight:G,marginBottom:G,marginLeft:G,marginBlock:G,marginBlockStart:G,marginBlockEnd:G,marginInline:G,marginInlineStart:G,marginInlineEnd:G,fontSize:G,backgroundPositionX:G,backgroundPositionY:G,rotate:St,pathRotation:St,rotateX:St,rotateY:St,rotateZ:St,scale:gt,scaleX:gt,scaleY:gt,scaleZ:gt,skew:St,skewX:St,skewY:St,distance:G,translateX:G,translateY:G,translateZ:G,x:G,y:G,z:G,perspective:G,transformPerspective:G,opacity:ht,originX:Et,originY:Et,originZ:G,zIndex:Yt,fillOpacity:ht,strokeOpacity:ht,numOctaves:Yt},Zt={...Xt,color:Ot,backgroundColor:Ot,outlineColor:Ot,fill:Ot,stroke:Ot,borderColor:Ot,borderTopColor:Ot,borderRightColor:Ot,borderBottomColor:Ot,borderLeftColor:Ot,filter:qt,WebkitFilter:qt,mask:Jt,WebkitMask:Jt},getDefaultValueType=e=>Zt[e],Qt=new Set([qt,Jt]);function getAnimatableNone(e,t){let n=getDefaultValueType(e);return Qt.has(n)||(n=Ft),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function fillWildcards(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}let radToDeg=e=>e*180/Math.PI,rotate=e=>rebaseAngle(radToDeg(Math.atan2(e[1],e[0]))),$={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate,rotateZ:rotate,skewX:e=>radToDeg(Math.atan(e[1])),skewY:e=>radToDeg(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},rebaseAngle=e=>(e%=360,e<0&&(e+=360),e),$t=rotate,scaleX=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),scaleY=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),en={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX,scaleY,scale:e=>(scaleX(e)+scaleY(e))/2,rotateX:e=>rebaseAngle(radToDeg(Math.atan2(e[6],e[5]))),rotateY:e=>rebaseAngle(radToDeg(Math.atan2(-e[2],e[0]))),rotateZ:$t,rotate:$t,skewX:e=>radToDeg(Math.atan(e[4])),skewY:e=>radToDeg(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function defaultTransformValue(e){return e.includes(`scale`)?1:0}function parseValueFromTransform(e,t){if(!e||e===`none`)return defaultTransformValue(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=en,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=$,i=t}if(!i)return defaultTransformValue(t);let a=r[t],o=i[1].split(`,`).map(convertTransformToNumber);return typeof a==`function`?a(o):o[a]}let readTransformValue=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return parseValueFromTransform(n,t)};function convertTransformToNumber(e){return parseFloat(e.trim())}let tn=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],nn=(()=>new Set([...tn,`pathRotation`]))(),isNumOrPxType=e=>e===mt||e===G,rn=new Set([`x`,`y`,`z`]),an=tn.filter(e=>!rn.has(e));function removeNonTranslationalTransform(e){let t=[];return an.forEach(n=>{let r=e.getValue(n);if(r!==void 0){let e=r.get(),i=n.startsWith(`scale`)?1:0;if(e===i)return;t.push([n,e]),r.set(i)}}),t}let on=new Set([`bottom`,`right`]);function measureDimension(e,t,n,r,i,a){let o=parseFloat(e);if(!isNaN(o))return o;let{min:s,max:c}=t()[n],l=c-s;return a===`border-box`?l:l-parseFloat(r)-parseFloat(i)}let sn={width:({width:e,paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r},i)=>measureDimension(e,i,`x`,t,n,r),height:({height:e,paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r},i)=>measureDimension(e,i,`y`,t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{let{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{let{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:({transform:e})=>parseValueFromTransform(e,`x`),y:({transform:e})=>parseValueFromTransform(e,`y`)};sn.translateX=sn.x,sn.translateY=sn.y;let cn=new Set,ln=!1,un=!1,dn=!1;function measureAllKeyframes(){if(un){let e=[],t=new Set,n=new Set;cn.forEach(r=>{r.needsMeasurement&&(e.push(r),t.add(r.element),on.has(r.name)&&n.add(r.element))});let r=new Map;n.forEach(e=>{let t=removeNonTranslationalTransform(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}un=!1,ln=!1,cn.forEach(e=>e.complete(dn)),cn.clear()}function readAllKeyframes(){cn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(un=!0)})}function flushKeyframeResolvers(){dn=!0,readAllKeyframes(),measureAllKeyframes(),dn=!1}function readOrigin(e,t,n){if(typeof e==`string`){if(isNumericalString(e)||isZeroValueString(e))return parseFloat(e);if(!Ft.test(e)&&Ft.test(n))return getAnimatableNone(t,n)}return e??void 0}var KeyframeResolver=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(cn.add(this),ln||(ln=!0,q.read(readAllKeyframes),q.resolveKeyframes(measureAllKeyframes))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=readOrigin(n.readValue(t,a),t,a);r!==void 0&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}fillWildcards(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),cn.delete(this)}cancel(){this.state===`scheduled`&&(cn.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}};let isCSSVar=e=>e.startsWith(`--`);function setStyle(e,t,n){isCSSVar(t)?e.style.setProperty(t,n):e.style[t]=n}let fn={};function memoSupports(e,t){let n=memo(e);return()=>fn[t]??n()}let pn=memoSupports(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),mn=memoSupports(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),cubicBezierAsString=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,hn={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasing(e,t){if(e)return typeof e==`function`?mn()?generateLinearEasing(e,t):`ease-out`:isBezierDefinition(e)?cubicBezierAsString(e):Array.isArray(e)?e.map(e=>mapEasingToNativeEasing(e,t)||hn.easeOut):hn[e]}function startWaapiAnimation(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=mapEasingToNativeEasing(s,i);Array.isArray(d)&&(u.easing=d);let p={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(p.pseudoElement=l),e.animate(u,p)}function isGenerator(e){return typeof e==`function`&&`applyToOptions`in e}function applyGeneratorOptions({type:e,...t}){return isGenerator(e)&&mn()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var NativeAnimation=class extends WithPromise{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=applyGeneratorOptions(e);this.animation=startWaapiAnimation(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=getFinalKeyframe(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),setStyle(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()},notifyAnimationStart(this,e,c)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return millisecondsToSeconds(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+millisecondsToSeconds(e)}get time(){return millisecondsToSeconds(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=secondsToMilliseconds(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&pn()?(this.animation.timeline=e,t?.(this.animation),noop):n(this)}};let gn={anticipate,backInOut:tt,circInOut:rt};function isUnsupportedEase(e){return e in gn}function replaceStringEasing(e){typeof e.ease==`string`&&isUnsupportedEase(e.ease)&&(e.ease=gn[e.ease])}var NativeAnimationExtended=class extends NativeAnimation{constructor(e){replaceStringEasing(e),replaceTransitionType(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new JSAnimation({...a,autoplay:!1}),s=Math.max(10,ut.now()-this.startTime),c=clamp$1(0,10,s-10),l=o.sample(s).value,{name:u}=this.options;i&&u&&setStyle(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}};let isAnimatable=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Ft.test(e)||e===`0`)&&!e.startsWith(`url(`));function hasKeyframesChanged(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function canAnimate(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=isAnimatable(i,t),s=isAnimatable(a,t);return!o||!s?(o!==s&&`${t}${i}${a}${o?a:i}`,!1):hasKeyframesChanged(e)||(n===`spring`||isGenerator(n))&&r}function makeAnimationInstant(e){e.duration=0,e.type=`keyframes`}let _n=new Set([`opacity`,`clipPath`,`filter`,`transform`,`backgroundColor`]),vn=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function hasBrowserOnlyColors(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&vn.test(e[t]))return!0;return!1}let yn=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),bn=memo(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function supportsBrowserAnimation(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!n||!(_n.has(n)||yn.has(n)))return!1;let c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return bn()&&(_n.has(n)||yn.has(n)&&hasBrowserOnlyColors(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var AsyncMotionValueAnimation=class extends WithPromise{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=ut.now();let{keyframes:t,name:n,motionValue:r,element:i}=e,a=e;a.autoplay??=!0,a.delay??=0,a.type??=`keyframes`,a.repeat??=0,a.repeatDelay??=0,a.repeatType??=`loop`,this.keyframeResolver=new(i?.KeyframeResolver||KeyframeResolver)(t,(e,t,n)=>this.onKeyframesResolved(e,t,a,!n),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=ut.now();let u=!0;canAnimate(e,i,a,o)||(u=!1,(Ze.instantAnimations||!s)&&l?.(getFinalKeyframe(e,n,t)),e[0]=e[e.length-1],makeAnimationInstant(n),n.repeat=0);let{onComplete:d}=n;n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{d?.(),this.notifyFinished()};let p=u&&!c&&supportsBrowserAnimation(n);r&&(p||this.resolvedAt!==this.createdAt)&&(n.startTime??=resolveStartTime(this.createdAt,this.resolvedAt));let m;if(p){n.element=n.motionValue?.owner?.current;try{m=new NativeAnimationExtended(n)}catch{m=new JSAnimation(n)}}else m=new JSAnimation(n);this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),flushKeyframeResolvers()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function calcChildStagger(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}let isFloat=e=>!isNaN(parseFloat(e)),xn={current:void 0};var MotionValue=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=ut.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=ut.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=isFloat(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){var n;return e===`change`?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new SubscriptionManager)).add(t)}onChangeSubscribe(e){let{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new SubscriptionManager,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){q.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){for(let e in this.changeSubscriber=void 0,this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){let{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return xn.current&&xn.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=ut.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>30)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&this.clearAnimation(),t()}),n||(this.animation=r),this.events.animationStart?.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function motionValue(e,t){return new MotionValue(e,t)}function resolveTransition(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function getValueTransition(e,t){let n=e?.[t]??e?.default??e;return n===e?n:resolveTransition(n,e)}let Sn={type:`spring`,stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Cn={type:`keyframes`,duration:.8},wn={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(e,{keyframes:t})=>t.length>2?Cn:nn.has(e)?e.startsWith(`scale`)?criticallyDampedSpring(t[1]):Sn:wn,Tn=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function isTransitionDefined(e){for(let t in e)if(!Tn.has(t))return!0;return!1}let animateMotionValue=(e,t,n,r={},i,a)=>o=>{let s=getValueTransition(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=secondsToMilliseconds(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};isTransitionDefined(s)||Object.assign(u,getDefaultTransition(e,u)),u.duration&&=secondsToMilliseconds(u.duration),u.repeatDelay&&=secondsToMilliseconds(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(makeAnimationInstant(u),u.delay===0&&(d=!0)),(Ze.instantAnimations||Ze.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,makeAnimationInstant(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=getFinalKeyframe(u.keyframes,s);if(e!==void 0){q.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new JSAnimation(u):new AsyncMotionValueAnimation(u)},En=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(e){let t=En.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function getVariableValue(e,t,n=1){`${e}`;let[r,i]=parseCSSVariable(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return isNumericalString(e)?parseFloat(e):e}return isCSSVariableToken(i)?getVariableValue(i,t,n+1):i}function getValueState(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function resolveVariantFromProps(e,t,n,r){let resolveFunction=t=>typeof t==`function`?t(n===void 0?e.custom:n,...getValueState(r)):t;return t=resolveFunction(t),typeof t==`string`&&(t=e.variants&&e.variants[t]),resolveFunction(t)}function resolveVariant(e,t,n){return resolveVariantFromProps(e.getProps(),t,n,e)}let getTypeCustom=(e,t)=>t===`exit`?e.presenceContext?.custom:void 0,Dn=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...tn]),isKeyframesTarget=e=>Array.isArray(e);function setMotionValue(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,motionValue(n))}function resolveFinalValueInKeyframes(e){return isKeyframesTarget(e)?e[e.length-1]||0:e}function setTarget(e,t){let{transitionEnd:n={},transition:r={},...i}=resolveVariant(e,t)||{};for(let t in i={...i,...n},i)setMotionValue(e,t,resolveFinalValueInKeyframes(i[t]))}let isMotionValue=e=>!!(e&&e.getVelocity);function isWillChangeMotionValue(e){return!!(isMotionValue(e)&&e.add)}function addValueToWillChange(e,t){let n=e.getValue(`willChange`);if(isWillChangeMotionValue(n))return n.add(t);if(!n&&Ze.WillChange){let n=new Ze.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function camelToDash(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let On=`data-`+camelToDash(`framerAppearId`);function getOptimisedAppearId(e){return e.props[On]}let kn=typeof window<`u`;function shouldBlockAnimation({protectedKeys:e,needsAnimating:t},n){let r=n in e&&!t[n];return t[n]=!1,r}function animateTarget(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?resolveTransition(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],p=i&&e.animationState?.getState()[i],m=a?.path;for(let t in m&&m.animateVisualElement(e,s,a,n,d),s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||p&&shouldBlockAnimation(p,t))continue;let o={delay:n,...getValueTransition(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){q.update(()=>r.set(i));continue}let m=!1;if(kn&&window.MotionHandoffAnimation){let n=getOptimisedAppearId(e);if(n){let e=window.MotionHandoffAnimation(n,t,q);e!==null&&(o.startTime=e,m=!0)}}addValueToWillChange(e,t);let h=l??e.shouldReduceMotion;r.start(animateMotionValue(t,r,i,h&&Dn.has(t)?{type:!1}:o,e,m));let g=r.animation;g&&d.push(g)}if(o){let applyTransitionEnd=()=>q.update(()=>{o&&setTarget(e,o)});d.length?Promise.all(d).then(applyTransitionEnd):applyTransitionEnd()}return d}function animateVariant(e,t,n={}){let r=resolveVariant(e,t,getTypeCustom(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),getAnimation=()=>Promise.all(r?animateTarget(e,r,n):[]),getChildAnimations=(r=0)=>{let{variantChildren:a}=e,{delayChildren:o=0,staggerChildren:s,staggerDirection:c}=i,l=[];return a?.forEach(e=>{e.notify(`AnimationStart`,t),l.push(animateVariant(e,t,{...n,delay:r+(typeof o==`function`?0:o)+calcChildStagger(a,e,o,s,c)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(l)},{when:a}=i;return a?a===`beforeChildren`?getAnimation().then(()=>getChildAnimations()):getChildAnimations().then(getAnimation):Promise.all([getAnimation(),getChildAnimations(n.delay)])}function animateVisualElement(e,t,n={}){return e.notify(`AnimationStart`,t),(Array.isArray(t)?Promise.all(t.map(t=>animateVariant(e,t,n))):typeof t==`string`?animateVariant(e,t,n):Promise.all(animateTarget(e,resolveVariant(e,t,n.custom),n))).then(()=>{e.notify(`AnimationComplete`,t)})}let An={test:e=>e===`auto`,parse:e=>e},testValueType=e=>t=>t.test(e),jn=[mt,G,Ct,St,Tt,wt,An],findDimensionValueType=e=>jn.find(testValueType(e));function isNone(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||isZeroValueString(e)}let Mn=new Set([`auto`,`none`,`0`]);function makeNoneKeyframesAnimatable(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Mn.has(t)&&hasComplexValues(t)&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]!==i&&(e[r]=getAnimatableNone(n,i))}var DOMKeyframesResolver=class extends KeyframeResolver{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),isCSSVariableToken(r))){let i=getVariableValue(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Dn.has(n)||e.length!==2)return;let[r,i]=e;if(typeof r==`number`&&typeof i==`number`)return;let a=findDimensionValueType(r),o=findDimensionValueType(i);if(containsCSSVariable(r)!==containsCSSVariable(i)&&sn[n]){this.needsMeasurement=!0;return}if(a!==o)if(isNumOrPxType(a)&&isNumOrPxType(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else sn[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||isNone(e[t]))&&n.push(t);n.length&&makeNoneKeyframesAnimatable(e,n,t)}measure(){let{element:e,name:t}=this;return sn[t](window.getComputedStyle(e.current),()=>e.measureViewportBox())}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){let{element:e,unresolvedKeyframes:t}=this;if(!e||!e.current)return;this.motionValue?.jump(this.measuredOrigin,!1);let n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};let Nn=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function isHTMLElement(e){return isObject(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}function isSVGElement(e){return isObject(e)&&`ownerSVGElement`in e}let getValueAsType=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function resolveElements(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}let Pn={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Fn=tn.length;function buildTransform(e,t,n){let r=``,i=!0;for(let a=0;a<Fn;a++){let o=tn[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===(o.startsWith(`scale`)?1:0);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=getValueAsType(s,Xt[o]);if(!c){i=!1;let t=Pn[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${getValueAsType(a,Xt.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function buildHTMLStyles(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(nn.has(e)){o=!0;continue}else if(dt(e)){i[e]=n;continue}else{let t=getValueAsType(n,Xt[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=buildTransform(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}let In={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Ln={offset:`strokeDashoffset`,array:`strokeDasharray`};function buildSVGPath(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?In:Ln;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}let Rn=[`transform`,`opacity`,`clipPath`,`filter`,`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function buildSVGAttrs(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(buildHTMLStyles(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:p}=e;for(let e of Rn)d[e]!==void 0&&(p[e]=d[e],delete d[e]);(p.transform||d.transformOrigin)&&(p.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),p.transform&&(p.transformBox=u?.transformBox??`fill-box`,delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&buildSVGPath(d,i,a,o,!1)}function convertBoundingBoxToBox({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function convertBoxToBoundingBox({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function transformBoxPoints(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function isIdentityScale(e){return e===void 0||e===1}function hasScale({scale:e,scaleX:t,scaleY:n}){return!isIdentityScale(e)||!isIdentityScale(t)||!isIdentityScale(n)}function hasTransform(e){return hasScale(e)||has2DTranslate(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function has2DTranslate(e){return is2DTranslate(e.x)||is2DTranslate(e.y)}function is2DTranslate(e){return e&&e!==`0%`}function scalePoint(e,t,n){return n+t*(e-n)}function applyPointDelta(e,t,n,r,i){return i!==void 0&&(e=scalePoint(e,i,r)),scalePoint(e,n,r)+t}function applyAxisDelta(e,t=0,n=1,r,i){e.min=applyPointDelta(e.min,t,n,r,i),e.max=applyPointDelta(e.max,t,n,r,i)}function applyBoxDelta(e,{x:t,y:n}){applyAxisDelta(e.x,t.translate,t.scale,t.originPoint),applyAxisDelta(e.y,n.translate,n.scale,n.originPoint)}let zn=.999999999999,Bn=1.0000000000001;function applyTreeDeltas(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(translateAxis(e.x,-a.scroll.offset.x),translateAxis(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,applyBoxDelta(e,o)),r&&hasTransform(a.latestValues)&&transformBox(e,a.latestValues,a.layout?.layoutBox))}t.x<Bn&&t.x>zn&&(t.x=1),t.y<Bn&&t.y>zn&&(t.y=1)}function translateAxis(e,t){e.min+=t,e.max+=t}function transformAxis(e,t,n,r,i=.5){applyAxisDelta(e,t,n,mixNumber(e.min,e.max,i),r)}function resolveAxisTranslate(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function transformBox(e,t,n){let r=n??e;transformAxis(e.x,resolveAxisTranslate(t.x,r.x),t.scaleX,t.scale,t.originX),transformAxis(e.y,resolveAxisTranslate(t.y,r.y),t.scaleY,t.scale,t.originY)}function measureViewportBox(e,t){return convertBoundingBoxToBox(transformBoxPoints(e.getBoundingClientRect(),t))}function measurePageBox(e,t,n){let r=measureViewportBox(e,n),{scroll:i}=t;return i&&(translateAxis(r.x,i.offset.x),translateAxis(r.y,i.offset.y)),r}let{schedule:Vn,cancel:Hn}=createRenderBatcher(queueMicrotask,!1),Un={x:!1,y:!1};function isDragActive(){return Un.x||Un.y}function setDragLock(e){return e===`x`||e===`y`?Un[e]?null:(Un[e]=!0,()=>{Un[e]=!1}):Un.x||Un.y?null:(Un.x=Un.y=!0,()=>{Un.x=Un.y=!1})}function setupGesture(e,t){let n=resolveElements(e),r=new AbortController,i={passive:!0,...t,signal:r.signal},cancel=()=>r.abort();return[n,i,cancel]}function isValidHover(e){return!(e.pointerType===`touch`||isDragActive())}function hover(e,t,n={}){let[r,i,a]=setupGesture(e,n);return r.forEach(e=>{let n=!1,r=!1,a,removePointerLeave=()=>{e.removeEventListener(`pointerleave`,onPointerLeave)},endHover=e=>{a&&=(a(e),void 0),removePointerLeave()},onPointerUp=e=>{n=!1,window.removeEventListener(`pointerup`,onPointerUp),window.removeEventListener(`pointercancel`,onPointerUp),r&&(r=!1,endHover(e))},onPointerDown=()=>{n=!0,window.addEventListener(`pointerup`,onPointerUp,i),window.addEventListener(`pointercancel`,onPointerUp,i)},onPointerLeave=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}endHover(e)}},onPointerEnter=n=>{if(!isValidHover(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,onPointerLeave,i))};e.addEventListener(`pointerenter`,onPointerEnter,i),e.addEventListener(`pointerdown`,onPointerDown,i)}),a}let isNodeOrChild=(e,t)=>t?e===t?!0:isNodeOrChild(e,t.parentElement):!1,isPrimaryPointer=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Wn=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function isElementKeyboardAccessible(e){return Wn.has(e.tagName)||e.isContentEditable===!0}let Gn=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function isElementTextInput(e){return Gn.has(e.tagName)||e.isContentEditable===!0}let Kn=new WeakSet;function filterEvents(e){return t=>{t.key===`Enter`&&e(t)}}function firePointerEvent(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}let enableKeyboardPress=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=filterEvents(()=>{if(Kn.has(n))return;firePointerEvent(n,`down`);let e=filterEvents(()=>{firePointerEvent(n,`up`)}),handleBlur=()=>firePointerEvent(n,`cancel`);n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,handleBlur,t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function isValidPressEvent(e){return isPrimaryPointer(e)&&!isDragActive()}let qn=new WeakSet;function press(e,t,n={}){let[r,i,a]=setupGesture(e,n),startPress=e=>{let r=e.currentTarget;if(!isValidPressEvent(e)||qn.has(e))return;Kn.add(r),n.stopPropagation&&qn.add(e);let a=t(r,e),o={...i,capture:!0},onPointerEnd=(e,t)=>{window.removeEventListener(`pointerup`,onPointerUp,o),window.removeEventListener(`pointercancel`,onPointerCancel,o),Kn.has(r)&&Kn.delete(r),isValidPressEvent(e)&&typeof a==`function`&&a(e,{success:t})},onPointerUp=e=>{onPointerEnd(e,r===window||r===document||n.useGlobalTarget||isNodeOrChild(r,e.target))},onPointerCancel=e=>{onPointerEnd(e,!1)};window.addEventListener(`pointerup`,onPointerUp,o),window.addEventListener(`pointercancel`,onPointerCancel,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,startPress,i),isHTMLElement(e)&&(e.addEventListener(`focus`,e=>enableKeyboardPress(e,i)),!isElementKeyboardAccessible(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}let Jn=new WeakMap,Yn,getSize=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:isSVGElement(r)&&`getBBox`in r?r.getBBox()[t]:r[n],Xn=getSize(`inline`,`width`,`offsetWidth`),Zn=getSize(`block`,`height`,`offsetHeight`);function notifyTarget({target:e,borderBoxSize:t}){Jn.get(e)?.forEach(n=>{n(e,{get width(){return Xn(e,t)},get height(){return Zn(e,t)}})})}function notifyAll(e){e.forEach(notifyTarget)}function createResizeObserver(){typeof ResizeObserver>`u`||(Yn=new ResizeObserver(notifyAll))}function resizeElement(e,t){Yn||createResizeObserver();let n=resolveElements(e);return n.forEach(e=>{let n=Jn.get(e);n||(n=new Set,Jn.set(e,n)),n.add(t),Yn?.observe(e)}),()=>{n.forEach(e=>{let n=Jn.get(e);n?.delete(t),n?.size||Yn?.unobserve(e)})}}let Qn=new Set,windowResizeHandler;function createWindowResizeHandler(){windowResizeHandler=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Qn.forEach(t=>t(e))},window.addEventListener(`resize`,windowResizeHandler)}function resizeWindow(e){return Qn.add(e),windowResizeHandler||createWindowResizeHandler(),()=>{Qn.delete(e),!Qn.size&&typeof windowResizeHandler==`function`&&(window.removeEventListener(`resize`,windowResizeHandler),windowResizeHandler=void 0)}}function resize(e,t){return typeof e==`function`?resizeWindow(e):resizeElement(e,t)}let $n={value:null,addProjectionMetrics:null};function isSVGSVGElement(e){return isSVGElement(e)&&e.tagName===`svg`}let asNumber=e=>typeof e==`number`?e:parseFloat(e),createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()}),er=new WeakMap;function isAnimationControls(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function isVariantLabel(e){return typeof e==`string`||Array.isArray(e)}let tr=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],nr=[`initial`,...tr];function isControllingVariants(e){if(isAnimationControls(e.animate))return!0;for(let t=0;t<nr.length;t++)if(isVariantLabel(e[nr[t]]))return!0;return!1}function isVariantNode(e){return!!(isControllingVariants(e)||e.variants)}function updateMotionValuesFromProps(e,t,n){for(let r in t){let i=t[r],a=n[r];if(isMotionValue(i))e.addValue(r,i);else if(isMotionValue(a))e.addValue(r,motionValue(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,motionValue(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}let rr={current:null},ir={current:!1},ar=typeof window<`u`;function initPrefersReducedMotion(){if(ir.current=!0,ar)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),setReducedMotionPreferences=()=>rr.current=e.matches;e.addEventListener(`change`,setReducedMotionPreferences),setReducedMotionPreferences()}else rr.current=!1}let or=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],sr={};function setFeatureDefinitions(e){sr=e}function getFeatureDefinitions(){return sr}var VisualElement=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=KeyframeResolver,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=ut.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,q.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=isControllingVariants(t),this.isVariantNode=isVariantNode(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&isMotionValue(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];if(this.current=e,er.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.isVariantNode&&!this.isControllingVariants){let e=this;do e=e.props.inherit!==!1&&e.parent;while(e&&!e.isVariantNode);if(e){let{variantChildren:t}=e;t.add(this),this.removeFromVariantTree=()=>t.delete(this)}}this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(ir.current||initPrefersReducedMotion(),this.shouldReduceMotion=rr.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){for(let e in this.projection&&this.projection.unmount(),Bt(this.notifyUpdate),Bt(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&_n.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new NativeAnimation({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:secondsToMilliseconds(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=nn.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&q.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in sr){let t=sr[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<or.length;t++){let n=or[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=updateMotionValuesFromProps(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(e,t){let n=this.values.get(e);if(t!==n){n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t);let r=t.get();r!==void 0&&(this.latestValues[e]=r)}}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=motionValue(t??this.getDefaultValue?.(e),{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(isNumericalString(n)||isZeroValueString(n))?n=parseFloat(n):typeof n!=`number`&&!Ft.test(n)&&Ft.test(t)&&(n=getAnimatableNone(e,t)),this.setBaseTarget(e,isMotionValue(n)?n.get():n)),isMotionValue(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}on(e,t){return this.events[e]||(this.events[e]=new SubscriptionManager),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Vn.render(this.render)}},DOMVisualElement=class extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;isMotionValue(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Feature=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function renderHTML(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}let cr={};function isForcedMotionValue(e,{layout:t,layoutId:n}){return nn.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!cr[e]||e===`opacity`)}function scrapeMotionValuesFromProps$1(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(isMotionValue(r[t])||i&&isMotionValue(i[t])||isForcedMotionValue(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}__name(scrapeMotionValuesFromProps$1,`scrapeMotionValuesFromProps`);function getComputedStyle$1(e){return window.getComputedStyle(e)}__name(getComputedStyle$1,`getComputedStyle`);var HTMLVisualElement=class extends DOMVisualElement{constructor(){super(...arguments),this.type=`html`,this.renderInstance=renderHTML}mount(e){e.style,super.mount(e)}readValueFromInstance(e,t){if(nn.has(t))return this.projection?.isProjecting?defaultTransformValue(t):readTransformValue(e,t);{let n=getComputedStyle$1(e),r=(dt(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return measureViewportBox(e,t)}build(e,t,n){buildHTMLStyles(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return scrapeMotionValuesFromProps$1(e,t,n)}};let lr=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),isSVGTag=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function renderSVG(e,t,n,r){for(let n in renderHTML(e,t,void 0,r),t.attrs)e.setAttribute(lr.has(n)?n:camelToDash(n),t.attrs[n])}function scrapeMotionValuesFromProps(e,t,n){let r=scrapeMotionValuesFromProps$1(e,t,n);for(let n in e)if(isMotionValue(e[n])||isMotionValue(t[n])){let t=tn.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var SVGVisualElement=class extends DOMVisualElement{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=createBox}getBaseTargetFromProps(e,t){return nn.has(t)?super.getBaseTargetFromProps(e,t)??defaultTransformValue(t):e[t]}getDefaultValue(e){return nn.has(e)?this.latestValues[e]??defaultTransformValue(e):void 0}readValueFromInstance(e,t){if(nn.has(t)){let e=getDefaultValueType(t);return e&&e.default||0}if(Rn.includes(t)){let n=getComputedStyle(e)[t];if(typeof n==`string`&&n)return n.trim()}return t=lr.has(t)?t:camelToDash(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return scrapeMotionValuesFromProps(e,t,n)}build(e,t,n){buildSVGAttrs(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){renderSVG(e,t,n,r)}mount(e){this.isSVGTag=isSVGTag(e.tagName),super.mount(e)}};function shallowCompare(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}let ur=[...tr].reverse();function createAnimationState(e){let animate=t=>Promise.all(t.map(({animation:t,options:n})=>animateVisualElement(e,t,n))),t=createState(),n=!0,r=!1;function animateChanges(i){let{props:a,parent:o,manuallyAnimateOnMount:s}=e,c=n||r,l=[],u=new Set,d={},p=1/0,m=e;do m=m.props.inherit!==!1&&m.parent;while(m&&!m.isControllingVariants);if(ur.forEach((n,r)=>{let h=t[n],g=a[n],_=m&&m.props[n],v=g===void 0?isVariantLabel(_)||_===!1?_:void 0:g,b=isVariantLabel(v),x=n===i?h.isActive:null;x===!1&&(p=r);let S=b&&g===void 0&&!(c&&s);if(h.protectedKeys={...d},!h.isActive&&x===null||!v&&!h.prevProp||isAnimationControls(v)||typeof v==`boolean`)return;if(n===`exit`&&h.isActive&&x!==!0){d={...d,...h.prevResolvedValues};return}let C=checkVariantsDidChange(h.prevProp,v),w=C||b&&(x&&!S||r>p),E=!1,D=Array.isArray(v)?v:[v],k={};if(x!==!1)for(let t of D){let{transition:r,transitionEnd:i,...a}=resolveVariant(e,t,getTypeCustom(e,n))||{};k={...k,...a,...i}}let{prevResolvedValues:A}=h;for(let t in{...A,...k}){if(t in d)continue;let n=k[t],r=A[t],i=Array.isArray(n)&&Array.isArray(r)?!shallowCompare(n,r)||C:n!==r;if(i&&n==null)u.add(t);else if(i||n!==void 0&&u.has(t)){w=!0,u.delete(t)&&(E=!0),h.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)}else h.protectedKeys[t]=!0}if(h.prevProp=v,h.prevResolvedValues=k,h.isActive&&(d={...d,...k}),w&&(!(S&&C)||E))for(let t of D){let r={type:n};if(typeof t==`string`&&c&&s&&o?.enteringChildren){let n=resolveVariant(o,t)?.transition?.delayChildren;r.delay=calcChildStagger(o.enteringChildren,e,n)}l.push({animation:t,options:r})}}),u.size){let{initial:t}=a,n={},r=typeof t!=`boolean`&&resolveVariant(e,Array.isArray(t)?t[0]:t,e.presenceContext?.custom);r&&r.transition&&(n.transition=r.transition),u.forEach(i=>{let o=e.getValue(i);o&&(o.liveStyle=!0);let s=r&&!Array.isArray(t)?r[i]:void 0,c=e.getBaseTargetFromProps(a,i);n[i]=(s===void 0?c!==void 0&&!isMotionValue(c)?c:e.initialValues[i]===void 0?e.baseTarget[i]:void 0:s)??null}),l.push({animation:n})}let h=c&&e.blockInitialAnimation||n&&!s&&(a.initial===!1||a.initial===a.animate);return n=r=!1,!h&&l.length?animate(l):Promise.resolve()}function setActive(n,r){if(t[n].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(n,r)),t[n].isActive=r;let i=animateChanges(n);for(let e in t)t[e].protectedKeys={};return i}return{animateChanges,setActive,setAnimateFunction:t=>{animate=t(e)},getState:()=>t,reset:()=>{t=createState(),r=!0}}}function checkVariantsDidChange(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!shallowCompare(t,e):!1}function createState(){let e={};for(let t of tr)e[t]={isActive:t===`animate`,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}};return e}function copyAxisInto(e,t){e.min=t.min,e.max=t.max}function copyBoxInto(e,t){copyAxisInto(e.x,t.x),copyAxisInto(e.y,t.y)}function copyAxisDeltaInto(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}let dr=1e-4;1-dr,1+dr;let fr=.01;0-fr,0+fr;function calcLength(e){return e.max-e.min}function isNear(e,t,n){return Math.abs(e-t)<=n}function calcAxisDelta(e,t,n,r=.5){e.origin=r,e.originPoint=mixNumber(t.min,t.max,e.origin),e.scale=calcLength(n)/calcLength(t),e.translate=mixNumber(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function calcBoxDelta(e,t,n,r){calcAxisDelta(e.x,t.x,n.x,r?r.originX:void 0),calcAxisDelta(e.y,t.y,n.y,r?r.originY:void 0)}function calcRelativeAxis(e,t,n,r=0){e.min=(r?mixNumber(n.min,n.max,r):n.min)+t.min,e.max=e.min+calcLength(t)}function calcRelativeBox(e,t,n,r){calcRelativeAxis(e.x,t.x,n.x,r?.x),calcRelativeAxis(e.y,t.y,n.y,r?.y)}function calcRelativeAxisPosition(e,t,n,r=0){let i=r?mixNumber(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+calcLength(t)}function calcRelativePosition(e,t,n,r){calcRelativeAxisPosition(e.x,t.x,n.x,r?.x),calcRelativeAxisPosition(e.y,t.y,n.y,r?.y)}function removePointDelta(e,t,n,r,i){return e-=t,e=scalePoint(e,1/n,r),i!==void 0&&(e=scalePoint(e,1/i,r)),e}function removeAxisDelta(e,t=0,n=1,r=.5,i,a=e,o=e){if(Ct.test(t)&&(t=parseFloat(t),t=mixNumber(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=mixNumber(a.min,a.max,r);e===a&&(s-=t),e.min=removePointDelta(e.min,t,n,s,i),e.max=removePointDelta(e.max,t,n,s,i)}function removeAxisTransforms(e,t,[n,r,i],a,o){removeAxisDelta(e,t[n],t[r],t[i],t.scale,a,o)}let pr=[`x`,`scaleX`,`originX`],mr=[`y`,`scaleY`,`originY`];function removeBoxTransforms(e,t,n,r){removeAxisTransforms(e.x,t,pr,n?n.x:void 0,r?r.x:void 0),removeAxisTransforms(e.y,t,mr,n?n.y:void 0,r?r.y:void 0)}function isAxisDeltaZero(e){return e.translate===0&&e.scale===1}function isDeltaZero(e){return isAxisDeltaZero(e.x)&&isAxisDeltaZero(e.y)}function axisEquals(e,t){return e.min===t.min&&e.max===t.max}function boxEquals(e,t){return axisEquals(e.x,t.x)&&axisEquals(e.y,t.y)}function axisEqualsRounded(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function boxEqualsRounded(e,t){return axisEqualsRounded(e.x,t.x)&&axisEqualsRounded(e.y,t.y)}function aspectRatio(e){return calcLength(e.x)/calcLength(e.y)}function axisDeltaEquals(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function eachAxis(e){return[e(`x`),e(`y`)]}function pixelsToPercent(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let hr={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(G.test(e))e=parseFloat(e);else return e;return`${pixelsToPercent(e,t.target.x)}% ${pixelsToPercent(e,t.target.y)}%`}},gr={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Ft.parse(e);if(i.length>5)return r;let a=Ft.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=mixNumber(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}};function buildProjectionTransform(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}let _r=Nn.length,isPx=e=>typeof e==`number`||G.test(e);function mixValues(e,t,n,r,i,a){i?(e.opacity=mixNumber(0,n.opacity??1,vr(r)),e.opacityExit=mixNumber(t.opacity??1,0,yr(r))):a&&(e.opacity=mixNumber(t.opacity??1,n.opacity??1,r));for(let i=0;i<_r;i++){let a=Nn[i],o=getRadius(t,a),s=getRadius(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||isPx(o)===isPx(s)?(e[a]=Math.max(mixNumber(asNumber(o),asNumber(s),r),0),(Ct.test(s)||Ct.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=mixNumber(t.rotate||0,n.rotate||0,r))}function getRadius(e,t){return e[t]===void 0?e.borderRadius:e[t]}let vr=compress(0,.5,nt),yr=compress(.5,.95,noop);function compress(e,t,n){return r=>r<e?0:r>t?1:n(progress(e,t,r))}function animateSingleValue(e,t,n){let r=isMotionValue(e)?e:motionValue(e);return r.start(animateMotionValue(``,r,t,n)),r.animation}function addDomEvent(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}let compareByDepth=(e,t)=>e.depth-t.depth;var FlatTree=class{constructor(){this.children=[],this.isDirty=!1}add(e){addUniqueItem(this.children,e),this.isDirty=!0}remove(e){removeItem(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(e)}};function delay$1(e,t){let n=ut.now(),checkElapsed=({timestamp:r})=>{let i=r-n;i>=t&&(Bt(checkElapsed),e(i-t))};return q.setup(checkElapsed,!0),()=>Bt(checkElapsed)}__name(delay$1,`delay`);function resolveMotionValue(e){return isMotionValue(e)?e.get():e}var NodeStack=class{constructor(){this.members=[]}add(e){addUniqueItem(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(removeItem(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(removeItem(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}};let br={borderRadius:{...hr,applyTo:[...Nn]},borderTopLeftRadius:hr,borderTopRightRadius:hr,borderBottomLeftRadius:hr,borderBottomRightRadius:hr,boxShadow:gr},xr={hasAnimatedSinceResize:!0,hasEverUpdated:!1};Object.assign(cr,{...br,...cr});let Sr={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Cr=[``,`X`,`Y`,`Z`],wr=0;function resetDistortingTransform(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function cancelTreeOptimisedTransformAnimations(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=getOptimisedAppearId(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,q,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&cancelTreeOptimisedTransformAnimations(r)}function createProjectionNode$1({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class ProjectionNode{constructor(e={},n=t?.()){this.id=wr++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,$n.value&&(Sr.nodes=Sr.calculatedTargetDeltas=Sr.calculatedProjections=0),this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),$n.addProjectionMetrics&&$n.addProjectionMetrics(Sr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new SubscriptionManager),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=isSVGElement(t)&&!isSVGSVGElement(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,resizeUnblockUpdate=()=>this.root.updateBlockedByResize=!1;q.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=delay$1(resizeUnblockUpdate,250),xr.hasAnimatedSinceResize&&(xr.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isAnimationBlocked){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||Tr,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!boxEqualsRounded(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...getValueTransition(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Bt(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(resetSkewAndRotation),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&cancelTreeOptimisedTransformAnimations(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1),t.isAnimationBlocked&&(t.dragSnapshot||=t.measure(),this.dragAncestor=t)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(forceLayoutMeasure),this.nodes.forEach(clearMeasurements);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(clearIsLayoutDirty);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ensureDraggedNodesSnapshotted),this.nodes.forEach(syncRelativeLayout),this.nodes.forEach(resetTransformStyle),this.nodes.forEach(updateLayout),this.nodes.forEach(notifyLayoutUpdate)):this.nodes.forEach(clearIsLayoutDirty),this.clearAllSnapshots();let e=ut.now();ct.delta=clamp$1(0,1e3/60,e-ct.timestamp),ct.timestamp=e,ct.isProcessing=!0,Vt.update.process(ct),Vt.preRender.process(ct),Vt.render.process(ct),ct.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Vn.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,q.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){q.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!calcLength(this.snapshot.measuredBox.x)&&!calcLength(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected||=createBox(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!isDeltaZero(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||hasTransform(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),roundBox(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return createBox();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(checkNodeWasScrollRoot))){let{scroll:e}=this.root;e&&(translateAxis(t.x,e.offset.x),translateAxis(t.y,e.offset.y))}return t}removeElementScroll(e){let t=createBox();if(copyBoxInto(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&copyBoxInto(t,e),translateAxis(t.x,i.offset.x),translateAxis(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||createBox();copyBoxInto(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(translateAxis(r.x,-n.scroll.offset.x),translateAxis(r.y,-n.scroll.offset.y)),hasTransform(n.latestValues)&&transformBox(r,n.latestValues,n.layout?.layoutBox)}return hasTransform(this.latestValues)&&transformBox(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=createBox();copyBoxInto(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!hasTransform(n.latestValues))continue;let r;n.instance&&(hasScale(n.latestValues)&&n.updateSnapshot(),r=createBox(),copyBoxInto(r,n.measurePageBox())),removeBoxTransforms(t,n.latestValues,n.snapshot?.layoutBox,r)}return hasTransform(this.latestValues)&&removeBoxTransforms(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ct.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=ct.timestamp;let a=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=createBox(),this.targetWithTransforms=createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):copyBoxInto(this.target,this.layout.layoutBox),applyBoxDelta(this.target,this.targetDelta)):copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),$n.value&&Sr.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||hasScale(this.parent.latestValues)||has2DTranslate(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===ct.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=createBox());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)),calcBoxDelta(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)||!axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),$n.value&&Sr.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=createDelta(),this.projectionDelta=createDelta(),this.projectionDeltaWithTransform=createDelta()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=createBox(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let p,m=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=m?.(n);r?(o.x.translate=r.x,o.x.scale=mixNumber(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=mixNumber(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(mixAxisDeltaLinear(o.x,e.x,n),mixAxisDeltaLinear(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),mixBox(this.relativeTarget,this.relativeTargetOrigin,s,n),p&&boxEquals(this.relativeTarget,p)&&(this.isProjectionDirty=!1),p||=createBox(),copyBoxInto(p,this.relativeTarget)),c&&(this.animationValues=a,mixValues(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(Bt(this.pendingAnimation),void 0),this.pendingAnimation=q.update(()=>{xr.hasAnimatedSinceResize=!0,this.motionValue||=motionValue(0),this.motionValue.jump(0,!1),this.currentAnimation=animateSingleValue(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),notifyLayoutAnimationStart(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,layout:n,latestValues:r}=e,{target:i}=e;if(!(!t||!i||!n)){if(this!==e&&this.layout&&n&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,n.layoutBox)){i=this.target||createBox();let t=calcLength(this.layout.layoutBox.x);i.x.min=e.target.x.min,i.x.max=i.x.min+t;let n=calcLength(this.layout.layoutBox.y);i.y.min=e.target.y.min,i.y.max=i.y.min+n}copyBoxInto(t,i),transformBox(t,r),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new NodeStack),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&resetDistortingTransform(`z`,e,r,this.animationValues);for(let t=0;t<Cr.length;t++)resetDistortingTransform(`rotate${Cr[t]}`,e,r,this.animationValues),resetDistortingTransform(`skew${Cr[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=resolveMotionValue(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=resolveMotionValue(t?.pointerEvents)||``),this.hasProjected&&!hasTransform(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;for(let t in e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit,cr){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=cr[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?resolveMotionValue(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=this.dragSnapshot=this.dragAncestor=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}__name(createProjectionNode$1,`createProjectionNode`);function updateLayout(e){e.updateLayout(),followDraggedAncestor(e)}function notifyLayoutUpdate(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)eachAxis(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=calcLength(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;copyAxisInto(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else shouldAnimatePositionOnly(i,t.layoutBox,n)&&eachAxis(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=calcLength(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=createDelta();calcBoxDelta(o,n,t.layoutBox);let s=createDelta();a?calcBoxDelta(s,e.applyTransform(r,!0),t.measuredBox):calcBoxDelta(s,n,t.layoutBox);let c=!isDeltaZero(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=createBox();calcRelativePosition(s,t.layoutBox,i.layoutBox,o);let c=createBox();calcRelativePosition(c,n,a.layoutBox,o),boxEqualsRounded(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function propagateDirtyNodes(e){$n.value&&Sr.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function cleanDirtyNodes(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function clearSnapshot(e){e.clearSnapshot()}function clearMeasurements(e){e.clearMeasurements()}function forceLayoutMeasure(e){e.isLayoutDirty=!0,e.updateLayout()}function clearIsLayoutDirty(e){e.isLayoutDirty=!1}function followDraggedAncestor(e){let{snapshot:t,dragAncestor:n}=e,r=n?.layout;if(!t||!r||e.resumeFrom||e.isAnimationBlocked)return;let i=n.dragSnapshot;eachAxis(e=>translateAxis(t.layoutBox[e],r.layoutBox[e].min-i.layoutBox[e].min))}function ensureDraggedNodesSnapshotted(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.dragSnapshot||e.layout,e.isLayoutDirty=!0)}function syncRelativeLayout(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function resetTransformStyle(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function finishAnimation(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function resolveTargetDelta(e){e.resolveTargetDelta()}function calcProjection(e){e.calcProjection()}function resetSkewAndRotation(e){e.resetSkewAndRotation()}function removeLeadSnapshots(e){e.removeLeadSnapshot()}function mixAxisDeltaLinear(e,t,n){e.translate=mixNumber(t.translate,0,n),e.scale=mixNumber(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function mixAxis(e,t,n,r){e.min=mixNumber(t.min,n.min,r),e.max=mixNumber(t.max,n.max,r)}function mixBox(e,t,n,r){mixAxis(e.x,t.x,n.x,r),mixAxis(e.y,t.y,n.y,r)}function hasOpacityCrossfade(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}let Tr={duration:.45,ease:[.4,0,.1,1]},userAgentContains=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Er=userAgentContains(`applewebkit/`)&&!userAgentContains(`chrome/`)?Math.round:noop;function roundAxis(e){e.min=Er(e.min),e.max=Er(e.max)}function roundBox(e){roundAxis(e.x),roundAxis(e.y)}function shouldAnimatePositionOnly(e,t,n){return e===`position`||e===`preserve-aspect`&&!isNear(aspectRatio(t),aspectRatio(n),.2)}function checkNodeWasScrollRoot(e){return e!==e.root&&e.scroll?.wasRoot}let Dr=createProjectionNode$1({attachResizeListener:(e,t)=>addDomEvent(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Or={current:void 0},kr=createProjectionNode$1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Or.current){let e=new Dr({});e.mount(window),e.setOptions({layoutScroll:!0}),Or.current=e}return Or.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),Ar=(0,l.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function usePresence(e=!0){let t=(0,l.useContext)(Ye);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,l.useId)();(0,l.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,l.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}let jr=(0,l.createContext)({strict:!1}),Mr={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Nr=!1;function initFeatureDefinitions(){if(Nr)return;let e={};for(let t in Mr)e[t]={isEnabled:e=>Mr[t].some(t=>!!e[t])};setFeatureDefinitions(e),Nr=!0}function getInitializedFeatureDefinitions(){return initFeatureDefinitions(),getFeatureDefinitions()}function loadFeatures(e){let t=getInitializedFeatureDefinitions();for(let n in e)t[n]={...t[n],...e[n]};setFeatureDefinitions(t)}let Pr=(0,l.createContext)({});function getCurrentTreeVariants(e,t){if(isControllingVariants(e)){let{initial:t,animate:n}=e;return{initial:t===!1||isVariantLabel(t)?t:void 0,animate:isVariantLabel(n)?n:void 0}}return e.inherit===!1?{}:t}function useCreateMotionContext(e){let{initial:t,animate:n}=getCurrentTreeVariants(e,(0,l.useContext)(Pr));return(0,l.useMemo)(()=>({initial:t,animate:n}),[variantLabelsAsDependency(t),variantLabelsAsDependency(n)])}function variantLabelsAsDependency(e){return Array.isArray(e)?e.join(` `):e}let createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(e,t,n){for(let r in t)!isMotionValue(t[r])&&!isForcedMotionValue(r,n)&&(e[r]=t[r])}function useInitialMotionValues({transformTemplate:e},t){return(0,l.useMemo)(()=>{let n=createHtmlRenderState();return buildHTMLStyles(n,t,e),Object.assign({},n.vars,n.style)},[t])}function useStyle(e,t){let n=e.style||{},r={};return copyRawValuesOnly(r,n,e),Object.assign(r,useInitialMotionValues(e,t)),r}function useHTMLProps(e,t){let n={},r=useStyle(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}let createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}});function useSVGProps(e,t,n,r){let i=(0,l.useMemo)(()=>{let n=createSvgRenderState();return buildSVGAttrs(n,t,isSVGTag(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};copyRawValuesOnly(t,e.style,e),i.style={...t,...i.style}}return i}let Fr=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function isValidMotionProp(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||Fr.has(e)}function shouldForward(e,t){return e.startsWith(`on`)?!isValidMotionProp(e):t?.(e)??!isValidMotionProp(e)}function filterProps(e,t,n,r){let i={};for(let a in e)a===`values`&&typeof e.values==`object`||isMotionValue(e[a])||(shouldForward(a,r)||n===!0&&isValidMotionProp(a)||!t&&!isValidMotionProp(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a]);return i}let Ir=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function isSVGComponent(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Ir.indexOf(e)>-1||/[A-Z]/u.test(e))}function useRender(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??isSVGComponent(e)?useSVGProps:useHTMLProps)(t,r,i,e),u=filterProps(t,typeof e==`string`,a,s),d=e===l.Fragment?{}:{...u,...c,ref:n},{children:p}=t,m=(0,l.useMemo)(()=>isMotionValue(p)?p.get():p,[p]);return(0,l.createElement)(e,{...d,children:m})}function makeState({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:makeLatestValues(n,r,i,e),renderState:t()}}function makeLatestValues(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=resolveMotionValue(a[e]);let{initial:o,animate:s}=e,c=isControllingVariants(e),l=isVariantNode(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!isAnimationControls(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=resolveVariantFromProps(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}let makeUseVisualState=e=>(t,n)=>{let r=(0,l.useContext)(Pr),i=(0,l.useContext)(Ye),make=()=>makeState(e,t,r,i);return n?make():useConstant(make)},Lr=makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState}),Rr=makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState}),zr=Symbol.for(`motionComponentSymbol`);function useMotionRef(e,t,n){let r=(0,l.useRef)(n);(0,l.useInsertionEffect)(()=>{r.current=n});let i=(0,l.useRef)(null);return(0,l.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}let Br=(0,l.createContext)({});function isRefObject(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function useVisualElement(e,t,n,r,i,a){let{visualElement:o}=(0,l.useContext)(Pr),s=(0,l.useContext)(jr),c=(0,l.useContext)(Ye),u=(0,l.useContext)(Ar),d=u.reducedMotion,p=u.skipAnimations,m=(0,l.useRef)(null),h=(0,l.useRef)(!1);r||=s.renderer,!m.current&&r&&(m.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d,skipAnimations:p,isSVG:a}),h.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));let g=m.current,_=(0,l.useContext)(Br);g&&!g.projection&&i&&(g.type===`html`||g.type===`svg`)&&createProjectionNode(m.current,n,i,_);let v=(0,l.useRef)(!1);(0,l.useInsertionEffect)(()=>{g&&v.current&&g.update(n,c)});let b=n[On],x=(0,l.useRef)(!!b&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(b)&&window.MotionHasOptimisedAnimation?.(b));return Je(()=>{!h.current||!g||(g.animationState?.animateChanges(),g.enteringChildren=void 0)},[]),Je(()=>{h.current=!0,g&&(v.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),g.scheduleRenderMicrotask(),x.current&&g.animationState&&g.animationState.animateChanges())}),(0,l.useEffect)(()=>{g&&(!x.current&&g.animationState&&g.animationState.animateChanges(),x.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(b)}),!1),g.enteringChildren=void 0)}),g}function createProjectionNode(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:getClosestProjectingNode(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&isRefObject(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function getClosestProjectingNode(e){if(e)return e.options.allowProjection===!1?getClosestProjectingNode(e.parent):e.projection}function createMotionComponent(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&loadFeatures(r);let a=n?n===`svg`:isSVGComponent(e),o=a?Rr:Lr;function MotionDOMComponent(n,s){let c,u={...(0,l.useContext)(Ar),...n,layoutId:useLayoutId(n)},{isStatic:p,isValidProp:m}=u,h=useCreateMotionContext(n),g=o(n,p);if(!p&&typeof window<`u`){useStrictMode(u,r);let t=getProjectionFunctionality(u);c=t.MeasureLayout,h.visualElement=useVisualElement(e,g,u,i,t.ProjectionNode,a)}return(0,d.jsxs)(Pr.Provider,{value:h,children:[c&&h.visualElement?(0,d.jsx)(c,{visualElement:h.visualElement,...u}):null,useRender(e,n,useMotionRef(g,h.visualElement,s),g,p,t,a,m)]})}MotionDOMComponent.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let s=(0,l.forwardRef)(MotionDOMComponent);return s[zr]=e,s}function useLayoutId({layoutId:e}){let t=(0,l.useContext)(Ke).id;return t&&e!==void 0?t+`-`+e:e}function useStrictMode(e,t){(0,l.useContext)(jr).strict}function getProjectionFunctionality(e){let{drag:t,layout:n}=getInitializedFeatureDefinitions();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function createMotionProxy(e,t){if(typeof Proxy>`u`)return createMotionComponent;let n=new Map,factory=(n,r)=>createMotionComponent(n,r,e,t),deprecatedFactoryFunction=(e,t)=>factory(e,t);return new Proxy(deprecatedFactoryFunction,{get:(r,i)=>i===`create`?factory:(n.has(i)||n.set(i,createMotionComponent(i,void 0,e,t)),n.get(i))})}let createDomVisualElement=(e,t)=>t.isSVG??isSVGComponent(e)?new SVGVisualElement(t):new HTMLVisualElement(t,{allowProjection:e!==l.Fragment});var AnimationFeature=class extends Feature{constructor(e){super(e),e.animationState||=createAnimationState(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();isAnimationControls(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}};let Vr=0;var ExitAnimationFeature=class extends Feature{constructor(){super(...arguments),this.id=Vr++}update(){let{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;let{isPresent:r,onExitComplete:i}=e,a=t?.isPresent;if(r===a)return;if(r&&a===!1){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=resolveVariant(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive(`exit`,!1);this.exit=void 0;return}let o=this.exit=n.setActive(`exit`,!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}};let Hr={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}};function extractEventInfo(e){return{point:{x:e.pageX,y:e.pageY}}}let addPointerInfo=e=>t=>isPrimaryPointer(t)&&e(t,extractEventInfo(t));function addPointerEvent(e,t,n,r){return addDomEvent(e,t,addPointerInfo(n),r)}let getContextWindow=({current:e})=>e?e.ownerDocument.defaultView:null,distance=(e,t)=>Math.abs(e-t);function distance2D(e,t){let n=distance(e.x,t.x),r=distance(e.y,t.y);return Math.sqrt(n**2+r**2)}let Ur=new Set([`auto`,`scroll`]);var PanSession=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=transformPoint(this.lastRawMoveEventInfo,this.transformPagePoint));let e=getPanInfo(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=distance2D(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e;this.history.push({...r,timestamp:ut.now()});let{onStart:i,onMove:a}=this.handlers;t||(i&&i(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a&&a(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=transformPoint(t,this.transformPagePoint),this.hasPendingMove=!0,q.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.hasPendingMove&&this.updatePoint(),this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=getPanInfo(e.type===`pointercancel`?this.lastMoveEventInfo:transformPoint(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!isPrimaryPointer(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=transformPoint(extractEventInfo(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=ct;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,getPanInfo(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=pipe(addPointerEvent(this.contextWindow,`pointermove`,this.handlePointerMove,d),addPointerEvent(this.contextWindow,`pointerup`,this.handlePointerUp,d),addPointerEvent(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Ur.has(e.overflowX)||Ur.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),q.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Bt(this.updatePoint)}};function transformPoint(e,t){return t?{point:t(e.point)}:e}function subtractPoint(e,t){return{x:e.x-t.x,y:e.y-t.y}}function getPanInfo({point:e},t){return{point:e,delta:subtractPoint(e,lastDevicePoint(t)),offset:subtractPoint(e,startDevicePoint(t)),velocity:getVelocity(t,.1)}}function startDevicePoint(e){return e[0]}function lastDevicePoint(e){return e[e.length-1]}function getVelocity(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=lastDevicePoint(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>secondsToMilliseconds(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>secondsToMilliseconds(t)*2&&(r=e[1]);let a=millisecondsToSeconds(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function applyConstraints(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?mixNumber(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?mixNumber(n,e,r.max):Math.min(e,n)),e}function calcRelativeAxisConstraints(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function calcRelativeConstraints(e,{top:t,left:n,bottom:r,right:i}){return{x:calcRelativeAxisConstraints(e.x,n,i),y:calcRelativeAxisConstraints(e.y,t,r)}}function calcViewportAxisConstraints(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function calcViewportConstraints(e,t){return{x:calcViewportAxisConstraints(e.x,t.x),y:calcViewportAxisConstraints(e.y,t.y)}}function calcOrigin(e,t){let n=.5,r=calcLength(e),i=calcLength(t);return i>r?n=progress(t.min,t.max-r,e.min):r>i&&(n=progress(e.min,e.max-i,t.min)),clamp$1(0,1,n)}function rebaseAxisConstraints(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}let Wr=.35;function resolveDragElastic(e=Wr){return e===!1?e=0:e===!0&&(e=Wr),{x:resolveAxisElastic(e,`left`,`right`),y:resolveAxisElastic(e,`top`,`bottom`)}}function resolveAxisElastic(e,t,n){return{min:resolvePointElastic(e,t),max:resolvePointElastic(e,n)}}function resolvePointElastic(e,t){return typeof e==`number`?e:e[t]||0}let Gr=new WeakMap;var VisualElementDragControls=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let onSessionStart=e=>{t&&this.snapToCursor(e),this.stopAnimation()},onStart=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=setDragLock(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Ct.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=calcLength(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&q.update(()=>i(e,t),!1,!0),addValueToWillChange(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},onMove=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=getCurrentDirection(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&q.update(()=>a(e,t),!1,!0)},onSessionEnd=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:i}=this.getProps();this.panSession=new PanSession(e,{onSessionStart,onStart,onMove,onSessionEnd,resumeAnimation},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:i,distanceThreshold:n,contextWindow:getContextWindow(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&q.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!shouldDrag(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=applyConstraints(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&isRefObject(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=calcRelativeConstraints(n.layoutBox,e):this.constraints=!1,this.elastic=resolveDragElastic(t),r!==this.constraints&&!isRefObject(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=rebaseAxisConstraints(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!isRefObject(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=measurePageBox(n,r.root,this.visualElement.getTransformPagePoint()),a=calcViewportConstraints(r.layout.layoutBox,i);if(t){let e=t(convertBoxToBoundingBox(a));this.hasMutatedConstraints=!!e,e&&(a=convertBoundingBoxToBox(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=eachAxis(o=>{if(!shouldDrag(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return addValueToWillChange(this.visualElement,e),n.start(animateMotionValue(e,n,0,t,this.visualElement,!1))}stopAnimation(){eachAxis(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){let{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,a=this.visualElement.measureViewportBox();eachAxis(e=>{if(!shouldDrag(e,n,this.currentDirection))return;let t=this.getAxisMotionValue(e),{min:r,max:o}=a[e];t.set((t.get()||0)+i[e]-mixNumber(r,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!isRefObject(t)||!n||!this.constraints)return;this.stopAnimation();let r=this.constraints,i={x:0,y:0};eachAxis(e=>{let t=this.getAxisMotionValue(e).get();i[e]=calcOrigin({min:t,max:t},r[e])});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),eachAxis(t=>{let n=this.getAxisMotionValue(t);if(!shouldDrag(t,e,null)||!n.get())return;let{min:r,max:a}=this.constraints[t];n.set(mixNumber(r,a,i[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Gr.set(this.visualElement,this);let e=this.visualElement.current,t=addPointerEvent(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&isElementTextInput(i);n&&r&&!a&&this.start(t)}),n,measureDragConstraints=()=>{let{dragConstraints:t}=this.getProps();isRefObject(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=startResizeObservers(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:r}=this.visualElement,i=r.addEventListener(`measure`,measureDragConstraints);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),q.read(measureDragConstraints);let a=addDomEvent(window,`resize`,()=>this.scalePositionWithinConstraints()),o=r.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(eachAxis(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{a(),t(),i(),o&&o(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=Wr,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function skipFirstCall(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function startResizeObservers(e,t,n){let r=resize(e,skipFirstCall(n)),i=resize(t,skipFirstCall(n));return()=>{r(),i()}}function shouldDrag(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function getCurrentDirection(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var DragGesture=class extends Feature{constructor(e){super(e),this.removeGroupControls=noop,this.removeListeners=noop,this.controls=new VisualElementDragControls(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}};let asyncHandler=e=>(t,n)=>{e&&q.update(()=>e(t,n),!1,!0)};var PanGesture=class extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop}onPointerDown(e){this.session=new PanSession(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:asyncHandler(e),onStart:asyncHandler(t),onMove:asyncHandler(n),onEnd:(e,t)=>{delete this.session,r&&q.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}};let Kr=!1;var MeasureLayoutWithContext=class extends l.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Kr&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),xr.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Kr=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||q.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Vn.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Kr=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function MeasureLayout(e){let[t,n]=usePresence(),r=(0,l.useContext)(Ke);return(0,d.jsx)(MeasureLayoutWithContext,{...e,layoutGroup:r,switchLayoutGroup:(0,l.useContext)(Br),isPresent:t,safeToRemove:n})}let qr={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:kr,MeasureLayout}};function handleHoverEvent(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&q.postRender(()=>i(t,extractEventInfo(t)))}var HoverGesture=class extends Feature{mount(){let{current:e}=this.node;e&&(this.unmount=hover(e,(e,t)=>(handleHoverEvent(this.node,t,`Start`),e=>handleHoverEvent(this.node,e,`End`))))}unmount(){}},FocusGesture=class extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=pipe(addDomEvent(this.node.current,`focus`,()=>this.onFocus()),addDomEvent(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function handlePressEvent(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&q.postRender(()=>i(t,extractEventInfo(t)))}var PressGesture=class extends Feature{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=press(e,(e,t)=>(handlePressEvent(this.node,t,`Start`),(e,{success:t})=>handlePressEvent(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}};let Jr=new WeakMap,Yr=new WeakMap,fireObserverCallback=e=>{let t=Jr.get(e.target);t&&t(e)},fireAllObserverCallbacks=e=>{e.forEach(fireObserverCallback)};function initIntersectionObserver({root:e,...t}){let n=e||document;Yr.has(n)||Yr.set(n,{});let r=Yr.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(fireAllObserverCallbacks,{root:e,...t})),r[i]}function observeIntersection(e,t,n){let r=initIntersectionObserver(t);return Jr.set(e,n),r.observe(e),()=>{Jr.delete(e),r.unobserve(e)}}let Xr={some:0,all:1};var InViewFeature=class extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Xr[r]},onIntersectionUpdate=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=observeIntersection(this.node.current,a,onIntersectionUpdate)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(hasViewportOptionChanged(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function hasViewportOptionChanged({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}let Zr={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}},Qr={layout:{ProjectionNode:kr,MeasureLayout}},$r=createMotionProxy({...Hr,...Zr,...qr,...Qr},createDomVisualElement),ei=[{x:4,height:8,delay:0},{x:8,height:16,delay:.05},{x:12,height:10,delay:.2},{x:16,height:14,delay:.33},{x:20,height:8,delay:.44}];function AnimatedAudioLines({size:e=16,...t}){return(0,d.jsx)(`svg`,{...t,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:ei.map(({x:e,height:t,delay:n})=>(0,d.jsx)($r.line,{x1:e,x2:e,y1:12-t/2,y2:12+t/2,animate:{scaleY:[.44,1,.44]},transition:{duration:.88,delay:n,repeat:1/0,ease:`easeInOut`},style:{originY:`50%`}},e))})}function finalAssistantMessageId(e){let t=e.timeline.turnOrder.at(-1);if(t===void 0)return null;for(let n of e.locations.getTurn(t)){let t=e.nodes.get(n);if(t?.kind===`turn-tail`)return t.data.closing?.finalNode.messageId??null}return null}function messageText(e,t){for(let n of e.nodes)if(!(n.kind!==`assistant`||n.messageId!==t))return assistantText(n.blocks);return``}function messageTime(e,t){for(let n of e.nodes)if(n.kind===`assistant`&&n.messageId===t)return n.time;return null}function latestAssistantMessageId(e){for(let t=e.nodes.length-1;t>=0;--t){let n=e.nodes[t];if(n?.kind===`assistant`&&n.messageId!==void 0)return n.messageId}return null}function assistantText(e){return e.filter(e=>e.kind===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
1
+ window.__ModuleLoader__.load({id:`dsh-xiaomi-tts`,factory:e=>{var t={exports:{}},n=t.exports,r=Object.create,i=Object.defineProperty,__name=(e,t)=>i(e,`name`,{value:t,configurable:!0}),a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,__copyProps=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},__toESM=(e,t,n)=>(n=e==null?{}:r(s(e)),__copyProps(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e));let l=e(`react`);l=__toESM(l);let u=e(`@deepseek-ai/dsh-client-ui-primitives`);u=__toESM(u);let d=e(`react/jsx-runtime`);d=__toESM(d);let p=e(`@deepseek-ai/cordis`);p=__toESM(p);let m=e(`react-dom`);m=__toESM(m);let h=`/plugins/xiaomi-mimo-tts/synthesize`,g=`/plugins/xiaomi-mimo-tts/synthesize-stream`,_=`x-dsh-speech-adapter`,v=`http://127.0.0.1:18083`,b={xiaomi:`/plugins/xiaomi-mimo-tts/provider-mimo.webp`,doubao:`/plugins/xiaomi-mimo-tts/provider-doubao.webp`,breeze:`/plugins/xiaomi-mimo-tts/provider-breeze.webp`},x={xiaomi:`/plugins/xiaomi-mimo-tts/provider-mimo-logo.png`,doubao:`/plugins/xiaomi-mimo-tts/provider-doubao-logo.png`,breeze:`/plugins/xiaomi-mimo-tts/provider-breeze-logo.png`},S=`/plugins/xiaomi-mimo-tts/history-empty-whale.webp`,C=`/plugins/xiaomi-mimo-tts/audio`,w={on:[`on02.mp3`,`on03.mp3`],off:[`off01.mp3`,`off02.mp3`],"auto-on":[`auto-on01.mp3`],"auto-off":[`auto-off03.mp3`]},E=[`volume-01.mp3`,`on02.mp3`],D=[{id:`bingtang`,value:`冰糖`,summary:`活泼少女`},{id:`mia`,value:`Mia`,summary:`Lively girl`},{id:`moli`,value:`茉莉`,summary:`知性女声`},{id:`chloe`,value:`Chloe`,summary:`Witty Grace`},{id:`suda`,value:`苏打`,summary:`阳光少年`},{id:`milo`,value:`Milo`,summary:`Sunny boy`},{id:`baihua`,value:`白桦`,summary:`成熟男声`},{id:`dean`,value:`Dean`,summary:`Steady Gentle`}],k=[`mimo-v2.5-tts`,`mimo-v2.5-tts-voicedesign`,`browser-local-fallback`],A=[`auto`,`local-first`,`disabled`],M=[`browser`,`moss`],P=[{id:`energetic-girl`,label:`鲸鱼娘`,summary:`清甜灵动`,prompt:`A bright, youthful female voice around 16–20. Sweet, soft and slightly nasal, with a lazy yet cheerful energy—like someone who just woke up but is already happily active. Sentence endings often lift playfully. Sounds a bit tsundere on the surface, but warm, affectionate and mildly possessive underneath. Normally light and lively; turns earnest yet soft when serious.Speaks fairly quickly with natural pauses. Occasionally draws out a word when being stubborn, always with happy, playful energy.`},{id:`liang-wenfeng`,label:`梁文峰`,summary:`理性克制`,prompt:`成年男性 35–40 岁,普通话,温和克制的中低音,声线清晰自然,声音偏亮不沉闷,略带书卷气和理工感,语速中等偏慢,停顿审慎,表达理性简洁,情绪稳定,不夸张。`},{id:`asmr-whisper`,label:`沈听澜`,summary:`ASMR低语`,prompt:`女性18-20岁,轻柔耳语带微弱气息,普通话,声线细腻清晰,私密温柔感,安静平和带轻柔低语,语速缓慢音量很轻,私密低语场景。`},{id:`young-man`,label:`江予辰`,summary:`阳光少年`,prompt:`男性青年16-22岁,清亮干净的中高音带少年感,普通话标准无口音,轻快明亮的活力声线,气息轻盈吐字利索,语速偏快语调自然上扬,情绪积极阳光带朝气,广告旁白或轻松解说场景。`},{id:`gentle-girlfriend`,label:`张子苜`,summary:`温柔陪伴`,prompt:`年轻女性16-22岁,声线柔软细腻,低饱和带微微暖意,标准普通话,温柔亲密的邻家风格,语速偏慢,语调轻柔连贯,气息自然流畅,安静私密陪伴场景。`},{id:`tech-explainer`,label:`周砚川`,summary:`科技解说`,prompt:`成年男性25-35岁,清晰利落中音、干净偏冷,标准普通话,精准干练的都市精英感,语速中等偏快、语调平稳,理性简洁、逻辑感强,现代资讯播报或商业讲解场景。`},{id:`girl-next-door`,label:`陈念安`,summary:`邻家甜声`,prompt:`年轻女性20-25岁,柔润清甜带撒娇感,普通话,清澈明亮的少女音,轻松温柔的亲近感,轻松平缓带温柔,中等偏快语速中等音量,生活分享场景。`},{id:`documentary-narrator`,label:`陆远山`,summary:`纪录片旁白`,prompt:`男性40-50岁,低沉醇厚有胸腔共鸣,普通话,稳重可靠的叙事者风格,语速中等偏慢,语调沉稳克制带叙事纵深感,气息舒展停顿有留白,纪录片旁白或深度访谈场景。`},{id:`news-anchor`,label:`顾知微`,summary:`沉稳播报`,prompt:`专业新闻播音女主持,成年女性30-40岁,普通话标准无口音,声线中低音区饱满清晰,端庄知性沉稳,语气克制权威,语速从容均匀,音量适中稳定,新闻播报与专题解说场景。`},{id:`suspense-narrator`,label:`裴沉舟`,summary:`悬疑旁白`,prompt:`男性中年30-40岁,低沉沉稳带神秘磁性,普通话,压抑克制的叙事风格,语速缓慢均匀,语调低沉平稳,情绪冷静悬疑,旁白解说场景。`}],F=[`smart`,`full`,`first-segment`],I=[`minimal`,`soft`,`glass`,`arcade`,`mechanical`,`organic`,`dreamy`,`scifi`,`rubber`,`cinematic`,`studio`,`zen`],V=[`all`,`click`,`task`];function resolveSoundEffectsMode(e,t,n){return!e||!t&&!n?`off`:t&&n?`all`:t?`task`:`click`}function resolveSoundEffectsScope(e,t){return e===t?`all`:e?`task`:`click`}function getSoundEffectsModeFlags(e){return{enabled:e!==`off`,taskSounds:e===`all`||e===`task`,clickSounds:e===`all`||e===`click`}}let ee={soundEnabled:!1,soundVolume:.7,soundPack:`zen`,taskSounds:!1,clickSounds:!1},te=[`dsh-pet`,`dsh-whale-musume`,`question-titles`,`approvals`,`job-results`],re={showInSidebar:!1,showInHostSettings:!0,showFeatureGuide:!0,acceptExternalProviders:!0,qqbotEnabled:!1,qqbotMaxAutoCharacters:0,qqbotMaxDurationSeconds:0,announcementSources:[`dsh-whale-musume`,`question-titles`],provider:`xiaomi`,doubaoEnabled:!0,doubaoApiKey:``,doubaoModel:`seed-tts-2.0`,doubaoVoice:`zh_female_vv_uranus_bigtts`,doubaoClonedVoice:``,doubaoInstruction:``,breezeEnabled:!1,breezeApiKey:``,breezeVoice:`voc_rh6e8hdbraz6`,breezeInstruction:``,enabled:!0,apiKey:``,baseURL:`https://api.xiaomimimo.com/v1`,model:`mimo-v2.5-tts`,localSpeechMode:`auto`,localVoiceURI:``,localVoiceEngine:`browser`,mossEnabled:!1,mossBaseURL:v,mossVoice:``,mossVoiceName:``,voice:`冰糖`,voiceDesignPrompt:`青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。`,voiceDesignCustomPrompt:`青年女性,声线清亮、亲切自然,吐字清楚,语速适中,情绪温柔克制。`,presetStylePrompt:``,format:`pcm`,voiceDesignPlaybackMode:`complete`,readScope:`smart`,autoPlay:!1,voiceInputCompatibility:!0,inputAvoidance:!1,importantAnnouncementsFirst:!1,instruction:``,maxTextLength:12e3,requestTimeoutMs:12e4,maxMp3AudioBytes:33554432,maxWavAudioBytes:134217728,maxPausedPcmBytes:33554432,voiceVolume:1,voiceRate:1,...ee};function isSupportedTtsApiKey(e,t=`xiaomi`){let n=e.trim();return t===`doubao`||t===`breeze`?n.length>0&&!/[\r\n]/u.test(n):n.startsWith(`sk-`)||n.startsWith(`tp-`)}function classifyLiveSpeechTransition(e,t){return e===null||e.sessionId!==t.sessionId||e.turn!==t.turn?`new-turn`:e.step===t.step?`same-step`:`same-turn`}var AbortableSentenceQueue=class{pending=[];current=null;revision=0;busy=!1;constructor(e,t={}){this.start=e,this.options=t}enqueue(e){this.pending.push(e),this.setBusy(!0),this.pump()}cancel(){this.revision+=1,this.pending.length=0,this.current?.abort(),this.current=null,this.setBusy(!1)}async pump(){if(this.current!==null)return;let e=this.pending.shift();if(e===void 0){this.setBusy(!1);return}let t=this.revision,n=new AbortController;this.current=n;try{await this.start(e,n.signal)}catch(e){!n.signal.aborted&&t===this.revision&&(this.pending.length=0,this.revision+=1,this.options.onError?.(e))}finally{this.current===n&&(this.current=null),t===this.revision&&this.pending.length>0?this.pump():this.setBusy(!1)}}setBusy(e){this.busy!==e&&(this.busy=e,this.options.onBusyChange?.(e))}};function parseSseRecords(e){let t=e.split(/\r?\n\r?\n/u),n=t.pop()??``;return{events:t.map(e=>e.split(/\r?\n/u).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
2
+ `)).filter(e=>e.length>0),remainder:n}}function normalizeVoiceRate(e){return Number.isFinite(e)?Math.round(Math.max(.5,Math.min(2,e))*10)/10:1}let se=[`xiaomi`,`doubao`,`breeze`];function availableTtsProviders(e,t){return se.filter(n=>n===`xiaomi`||(n===`doubao`?e:t))}function nextTtsProvider(e,t,n){let r=availableTtsProviders(t,n);return r[(r.indexOf(e)+1)%r.length]}let ce=[`seed-tts-2.0`,`seed-icl-2.0`],le=`breeze-tts-2`,H=[{value:`voc_rh6e8hdbraz6`,name:`哈基米娘`,language:`zh`},{value:`voc_b86bfwct4cjn`,name:`香农小姐`,language:`zh`},{value:`voc_8yud7hz7c9q2`,name:`大肥鱼(迷糊版)`,language:`zh`},{value:`voc_u3nxkd5578wc`,name:`大肥鱼(机灵版)`,language:`zh`},{value:`voc_reys5un5t4ed`,name:`深思先生`,language:`zh`},{value:`voc_pczdutjax3bc`,name:`实录观察者`,language:`zh`},{value:`voc_ytteeuvt48pm`,name:`岁月回声`,language:`zh`},{value:`voc_mmbkawdhpk29`,name:`晨光记录员`,language:`zh`},{value:`voc_dzumjsqzf948`,name:`素言叙事`,language:`zh`},{value:`voc_3n4rhszjst3f`,name:`青衿师语`,language:`zh`},{value:`voc_zbggdxky3yu3`,name:`深夜观察者`,language:`zh`},{value:`voc_xb3zjqcmwp44`,name:`晨曦讲解员`,language:`zh`},{value:`voc_ynfyjw6yrv7p`,name:`雅致述评人`,language:`zh`},{value:`voc_vhv3b2252en7`,name:`星海引路人`,language:`zh`},{value:`voc_tzneby749yja`,name:`灵动汐语`,language:`zh`},{value:`voc_nmea5hnwvwcu`,name:`幽兰语者`,language:`zh`},{value:`voc_t2kpg5h4ebah`,name:`热点快评员`,language:`zh`},{value:`voc_rye44d226x46`,name:`雅韵谈锋`,language:`zh`},{value:`voc_kvzxd25fpshp`,name:`晨露花语`,language:`zh`},{value:`voc_chsmgh7pkufq`,name:`元气茶香`,language:`zh`},{value:`voc_7jsxftc2rm3n`,name:`墨香少女`,language:`zh`},{value:`voc_csdwmam68z4k`,name:`疾风信使`,language:`zh`},{value:`voc_shetwnrd3q3q`,name:`静谧流年`,language:`zh`},{value:`voc_2z7zu82z2eu3`,name:`林间漫语者`,language:`zh`},{value:`voc_wuwu3ckdfe4q`,name:`云端播报员`,language:`zh`},{value:`voc_yu7t5b4tx7c7`,name:`深夜树洞`,language:`zh`},{value:`voc_9zyu28uzmjsk`,name:`八方馆掌柜`,language:`zh`},{value:`voc_2b358584ukkb`,name:`晨曦热血少年`,language:`zh`},{value:`voc_ge466ug83952`,name:`智械管家`,language:`zh`},{value:`voc_f3zbgr88pz5m`,name:`月夜低语者`,language:`zh`}];function breezeVoiceLabel(e){return H.find(t=>t.value===e.trim())?.name??e}function ttsSelection(e){return e.provider===`doubao`?{provider:`doubao`,model:e.doubaoModel,voice:e.doubaoModel===`seed-icl-2.0`?e.doubaoClonedVoice:e.doubaoVoice,voiceRate:normalizeVoiceRate(e.voiceRate),...e.doubaoModel===`seed-tts-2.0`?{speechInstruction:e.doubaoInstruction.trim()}:{}}:e.provider===`breeze`?{provider:`breeze`,model:le,voice:e.breezeVoice,voiceRate:normalizeVoiceRate(e.voiceRate),speechInstruction:e.breezeInstruction.trim()}:{provider:`xiaomi`,model:e.model,voice:e.voice,voiceDesignPrompt:e.voiceDesignPrompt,speechInstruction:e.instruction.trim()}}function supportsRealtimeTts(e){return e.provider===`doubao`||e.provider===`breeze`?!0:e.provider===`xiaomi`&&e.model===`mimo-v2.5-tts`}function findFencedCodeRegions(e){let t=[],n=/(^|\n)[ \t]{0,3}(`{3,}|~{3,})([^\r\n]*)/g,r=null;for(let i of e.matchAll(n)){let e=i[2],n=i[3];if(r===null){if(e[0]==="`"&&n.includes("`"))continue;r={start:i.index+(i[1]===`
3
+ `?1:0),marker:e}}else r.marker[0]===e[0]&&e.length>=r.marker.length&&n.trim().length===0&&(t.push([r.start,i.index+i[0].length]),r=null)}return{regions:t,pendingStart:r?.start??null}}function removeFencedCode(e){let{regions:t,pendingStart:n}=findFencedCodeRegions(e),r=``,i=0;for(let[n,a]of t)r+=`${e.slice(i,n)} `,i=a;return r+e.slice(i,n??e.length)}let ue=[{zh:`基础情绪`,en:`Emotions`,english:[`happy`,`sad`,`angry`,`afraid`,`surprised`,`excited`,`aggrieved`,`calm`,`indifferent`],tags:[`开心`,`悲伤`,`愤怒`,`恐惧`,`惊讶`,`兴奋`,`委屈`,`平静`,`冷漠`]},{zh:`复合情绪`,en:`Mixed emotions`,english:[`wistful`,`relieved`,`helpless`,`guilty`,`at peace`,`jealous`,`weary`,`uneasy`,`moved`],tags:[`怅然`,`欣慰`,`无奈`,`愧疚`,`释然`,`嫉妒`,`厌倦`,`忐忑`,`动情`]},{zh:`整体语调`,en:`Delivery`,english:[`gentle`,`aloof`,`lively`,`serious`,`lazy`,`playful`,`deep`,`brisk`,`sharp`],tags:[`温柔`,`高冷`,`活泼`,`严肃`,`慵懒`,`俏皮`,`深沉`,`干练`,`凌厉`]},{zh:`音色定位`,en:`Voice texture`,english:[`magnetic voice`,`rich voice`,`clear voice`,`ethereal voice`,`young voice`,`aged voice`,`sweet voice`,`hoarse voice`,`mellow voice`],tags:[`磁性`,`醇厚`,`清亮`,`空灵`,`稚嫩`,`苍老`,`甜美`,`沙哑`,`醇雅`]},{zh:`人设腔调`,en:`Character voice`,english:[`cutesy voice`,`mature female voice`,`young boy voice`,`middle-aged male voice`,`Taiwanese accent`],tags:[`夹子音`,`御姐音`,`正太音`,`大叔音`,`台湾腔`]},{zh:`方言与角色`,en:`Dialects & characters`,english:[`Northeastern Chinese dialect`,`Sichuan dialect`,`Henan dialect`,`Cantonese`,`Sun Wukong`,`Lin Daiyu`],tags:[`东北话`,`四川话`,`河南话`,`粤语`,`孙悟空`,`林黛玉`]},{zh:`唱歌(插入句首)`,en:`Singing (insert at start)`,english:[`sing`,`singing`],tags:[`唱歌`,`sing`,`singing`],placement:`start`},{zh:`呼吸与节奏`,en:`Breathing & rhythm`,english:[`inhale`,`deep breath`,`sigh`,`long sigh`,`heavy breathing`,`hold breath`],tags:[`吸气`,`深呼吸`,`叹气`,`长叹一口气`,`喘息`,`屏息`]},{zh:`情绪状态`,en:`Emotional state`,english:[`nervous`,`scared`,`excited`,`exhausted`,`aggrieved`,`coy`,`guilty`,`shocked`,`impatient`],tags:[`紧张`,`害怕`,`激动`,`疲惫`,`委屈`,`撒娇`,`心虚`,`震惊`,`不耐烦`]},{zh:`语音特征`,en:`Vocal expression`,english:[`trembling`,`shaky voice`,`pitch shift`,`voice break`,`nasal voice`,`breathy voice`,`hoarse voice`],tags:[`颤抖`,`声音颤抖`,`变调`,`破音`,`鼻音`,`气声`,`沙哑`]},{zh:`哭笑表达`,en:`Laughter & crying`,english:[`laugh`,`chuckle`,`laugh loudly`,`scoff`,`sob`,`whimper`,`choked up`,`cry loudly`],tags:[`笑`,`轻笑`,`大笑`,`冷笑`,`抽泣`,`呜咽`,`哽咽`,`嚎啕大哭`]}];``+ue.map(e=>`${e.zh}: ${e.tags.join(`/`)}`).join(`; `);let de=/\([^()\r\n]+\)|([^()\r\n]+)|\[[^\]\r\n]+\]/gu;function stripXiaomiAudioTags(e){return e.replace(de,` `)}let fe={",":`,`,"。":`.`,"!":`!`,"?":`?`,";":`;`,":":`:`,"、":`,`,"(":`,`,")":`,`," ":` `},pe=/[()\[\]【】[]〔〕〖〗{}{}「」『』《》〈〉“”‘’"'`<>]/gu,U=/[…⋯〜~]+/gu,me=/\b(?:https?|ftp):\/\/[^\s<>()]+|\bwww\.[^\s<>()]+|\b(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+(?:com|cn|net|org|io|ai|dev|me|co|edu|gov|xyz|tech|info|app|site|link)(?:[/:?#][^\s<>()]*)?/giu,he=/(?:\b[A-Za-z]:[\\/]|\\\\)(?:[A-Za-z0-9._ -]+[\\/])+(?:[A-Za-z0-9._ -]+)/gu,xe=/\/(?:[A-Za-z0-9._-]+\/)+(?:[A-Za-z0-9._-]+)/gu,Se=/(?:\.\.?[\\/])(?:[A-Za-z0-9._-]+[\\/])*(?:[A-Za-z0-9._-]+(?:\.[A-Za-z0-9_-]+)?)/gu,Ce=/\b(?:[A-Za-z0-9_-]+[\\/])+[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/gu,W=/```[\s\S]*?```|~~~[\s\S]*?~~~/g,we=/(^|\n)(?: {4}|\t)[^\n]*(?=\n|$)/g,Te=/!\[([^\]\r\n]*)\]\([^\)\r\n]*\)/g,Ee=/\[([^\]\r\n]*)\]\([^\)\r\n]*\)/g,De=/<[^>\r\n]*>/g,Oe=/(^|\n)\s{0,3}#{1,6}\s+/g,ke=/(^|\n)\s*(?:[-*+]|\d+[.)])\s+/g,Ae=/(^|\n)\s*>\s?/g,Me=/`+|[*_~]{1,3}/g,Ne=/[|]/g;function removeTtsPaths(e){return e.replace(he,` `).replace(Se,` `).replace(Ce,` `).replace(xe,` `)}function removeTtsMarkup(e,t){let n=removeFencedCode(e).replace(W,` `).replace(we,`$1`).replace(Te,` `).replace(Ee,`$1`).replace(De,` `);return n=(t?.(n)??n).replace(Oe,`$1`).replace(ke,`$1`).replace(Ae,`$1`).replace(Me,``).replace(Ne,` `),n=n.replace(me,` `),removeTtsPaths(n)}function removeTtsSymbols(e){return e.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F​-‏‪-‮⁠-⁤⁦-]/g,` `).replace(/(?:\p{Extended_Pictographic}|\p{Emoji_Presentation}|\p{Regional_Indicator}|\p{Emoji_Modifier}|\p{So}|︎|️|‍|⃣)/gu,` `)}function normalizeTtsPunctuation(e){return e.replace(U,`.`).replace(/[—–-]+/gu,``).replace(pe,``).replace(/[,。!?;:、() ]/gu,e=>fe[e]??e).replace(/(^|\s)[,;:!?]+(?=\s|$)/g,`$1`).replace(/([,;:])\s*([.!?])/g,`$2`).replace(RegExp(``,`g`),`,`).replace(/\s+([,.;:!?])/g,`$1`).replace(/\.{2,}/gu,`.`).replace(/^\.+/u,``)}function prepareTtsText(e){return e.length===0?``:normalizeTtsPunctuation(removeTtsSymbols(stripBreezeAudioTags(removeTtsMarkup(e).replace(/\\[rn]|\/n/gi,` `).replace(/\r\n?|\n/g,`.`)))).replace(/\s+/g,` `).trim()}function prepareExternalTtsText(e,t=[]){let n=removeFencedCode(e.replace(/[\uE000-\uE002]/gu,` `)),r=[];for(let e of[...t].sort((e,t)=>t.length-e.length)){if(!e)continue;let t=`\uE001${r.length}\uE002`;r.push(e),n=n.split(e).join(t)}return n=normalizeTtsPunctuation(removeTtsSymbols(removeTtsMarkup(n).replace(/\\[rn]|\/n/gi,` `).replace(/\r\n?|\n/g,`.`))).replace(/\s+/gu,` `).trim(),n.replace(/\uE001(\d+)\uE002/gu,(e,t)=>r[Number(t)]??``)}function prepareXiaomiTtsText(e){let t=[];return prepareTtsText(removeTtsMarkup(e.replace(/[\uE000-\uE002]/gu,` `),e=>e.replace(de,e=>(t.push(e),`${t.length-1}`)))).replace(/(\d+)/gu,(e,n)=>t[Number(n)]??``)}let Pe=[{label:`笑声`,zh:[`[笑]`,`[轻笑]`,`[咯咯笑]`],en:[`(laughs)`,`(chuckles)`,`(giggles)`]},{label:`哭泣与疼痛`,zh:[`[哭声]`,`[抽泣]`,`[呜咽]`,`[呻吟]`,`[哀号]`],en:[`(cries)`,`(sobs)`,`(whimpers)`,`(groans)`,`(moans)`]},{label:`呼吸`,zh:[`[叹气]`,`[惊呼]`,`[吸气]`,`[呼气]`,`[喘息]`],en:[`(sighs)`,`(gasps)`,`(inhales)`,`(exhales)`,`(breathes heavily)`]},{label:`发声`,zh:[`[耳语]`,`[喊叫]`,`[惨叫]`],en:[`(whispers)`,`(shouts)`,`(screams)`]},{label:`唱歌`,zh:[`[唱歌]`,`[哼歌]`],en:[`(sings)`,`(hums)`]},{label:`说话`,zh:[`[结巴]`,`[停顿]`,`[清嗓]`],en:[`(stutters)`,`(pauses)`,`(clears throat)`]},{label:`喉部`,zh:[`[咳嗽]`,`[吸鼻子]`,`[咂嘴]`,`[啧嘴]`],en:[`(coughs)`,`(sniffles)`,`(lip smacks)`,`(clicks tongue)`]},{label:`其他`,zh:[`[打哈欠]`,`[打喷嚏]`,`[打嗝]`,`[打饱嗝]`,`[吞咽]`,`[干呕]`,`[闷哼]`,`[冷笑]`,`[哼鼻子]`],en:[`(yawns)`,`(sneezes)`,`(hiccups)`,`(burps)`,`(gulps)`,`(gags)`,`(grunts)`,`(scoffs)`,`(snorts)`]}],Fe=new Set(Pe.flatMap(e=>[...e.zh,...e.en]));``+Pe.map(e=>`${e.label} ${e.zh.join(` `)} / ${e.en.join(` `)}`).join(`; `);function prepareBreezeTtsText(e){let t=[];return prepareTtsText(e.replace(/[\uE000-\uE002]/gu,` `).replace(/\[[^\]\r\n]+\]|\([^()\r\n]+\)/gu,e=>{if(!Fe.has(e))return e;let n=`${t.length}`;return t.push(e),n}).replace(/\[[^\]\r\n]+\]/gu,` `)).replace(/(\d+)/gu,(e,n)=>t[Number(n)]??``)}function stripBreezeAudioTags(e){return e.replace(/\[[^\]\r\n]+\]|\([^()\r\n]+\)/gu,e=>Fe.has(e)?` `:e)}function splitCompletedTtsSentences(e){let{regions:t,pendingStart:n}=findFencedCodeRegions(e),r=n??e.length,i=[...e.matchAll(de)],a=/[。!?!?;;.\n]+(?:[”’)】》〕\]}'"]*\s*)/gu,o=[],s=0,c=0,splitSegment=(t,n)=>{a.lastIndex=t;let r;for(;(r=a.exec(e))!==null;){if(i.some(e=>r.index>=e.index&&r.index<e.index+e[0].length))continue;let t=r.index+r[0].length;if(t>n)break;if(r[0]===`.`&&/\d/u.test(e[r.index-1]??``)&&(/\d/u.test(e[t]??``)||t===e.length))continue;let a=e.slice(s,t);a.trim().length>0&&o.push(a),s=t,c=t}},l=0;for(let[e,n]of t){if(e>=r)break;l<e&&splitSegment(l,Math.min(e,r)),s=Math.max(s,n),c=Math.max(c,n),l=n}return l<r&&splitSegment(l,r),n===null?{sentences:o,remainder:e.slice(c),consumed:c,inCode:!1}:{sentences:o,remainder:e.slice(n),consumed:n,inCode:!0}}function countTtsSpeechCharacters(e){return(stripXiaomiAudioTags(e).match(/[\p{L}\p{N}]/gu)??[]).length}function splitPreparedTtsSentences(e,t=!0){let n=[],r=0,i=[...e.matchAll(de)];for(let a of e.matchAll(/[.!?;]+/gu)){if(i.some(e=>a.index>=e.index&&a.index<e.index+e[0].length))continue;let o=a.index+a[0].length;a[0]===`.`&&/\d/u.test(e[a.index-1]??``)&&(/\d/u.test(e[o]??``)||!t&&o===e.length)||(n.push(e.slice(r,o)),r=o)}return{sentences:n,remainder:e.slice(r)}}function groupTtsSentences(e,t,n){let r=[],i=``,append=e=>{let a=`${i}${e}`.trim();if(a.length!==0){if(countTtsSpeechCharacters(a)<=n){i=a,countTtsSpeechCharacters(i)>=t&&(r.push(i),i=``);return}i.length>0&&(r.push(i),i=``),i=e.trim(),countTtsSpeechCharacters(i)>=t&&(r.push(i),i=``)}};for(let t of e)append(t);return{segments:r,pending:i}}function segmentsFromPreparedText(e,t,n){let r=Math.max(50,Math.min(t,n)),{sentences:i,remainder:a}=splitPreparedTtsSentences(e),{segments:o,pending:s}=groupTtsSentences(a.length>0?[...i,a]:i,r,n);if(s.length>0){let e=o.at(-1);e!==void 0&&countTtsSpeechCharacters(s)<50&&countTtsSpeechCharacters(`${e}${s}`)<=n?o[o.length-1]=`${e}${s}`:o.push(s)}return o}function splitTtsSegments(e,t=160,n=240,r=prepareTtsText){let i=r(e);return i.length===0?[]:segmentsFromPreparedText(i,t,n)}function splitBreezeTtsSegments(e,t=1e3){let n=prepareBreezeTtsText(e);if(n.length===0)return[];let r=n.match(/\[[^\]\r\n]+\]|\([^()\r\n]+\)|./gu)??[],i=[],a=``;for(let e of r)a&&a.length+e.length>t&&(i.push(a),a=``),a+=e;return a.trim()&&i.push(a),i}function splitBreezeTtsSentences(e,t=160,n=240){let r=prepareBreezeTtsText(e);return r.length===0?[]:segmentsFromPreparedText(r,t,n)}function firstTtsSegment(e){return splitTtsSegments(e)[0]??``}function firstTtsSegments(e,t=1){return t<=0?``:splitTtsSegments(e).slice(0,t).join(``)}var TtsFirstSegmentLimiter=class{locked=null;get complete(){return this.locked!==null}constructor(e=1,t=prepareTtsText){this.segmentCount=e,this.prepare=t}limit(e,t=!1){if(this.locked!==null)return this.locked;let n=this.prepare(e);if(t)return this.locked=segmentsFromPreparedText(n,160,240).slice(0,this.segmentCount).join(``),this.locked;let{sentences:r,remainder:i}=splitPreparedTtsSentences(n,!1),{segments:a,pending:o}=groupTtsSentences(r,160,240);if(a.length>=this.segmentCount)return this.locked=a.slice(0,this.segmentCount).join(``),this.locked;let s=`${a.join(``)}${o}`;if(a.length+(o.length>0?1:0)<this.segmentCount&&countTtsSpeechCharacters(i)>=160){let e=`${s}${i}`;return/(?:\[[^\]\r\n]+\]|\([^()\r\n]+\)|([^()\r\n]+))$/u.test(e)?e:e.replace(/[^\p{L}\p{N}.]+$/u,``)}return s}};function batchTtsStreamText(e,t,n){let r=`${e}${t}`;return countTtsSpeechCharacters(r)>=20||n&&r.trim().length>0?{pending:``,request:r}:{pending:r,request:null}}function batchTtsStreamSegments(e,t,n){let r=groupTtsSentences([e,...t],160,240);return n&&r.pending.length>0&&r.segments.push(r.pending),{pending:n?``:r.pending,requests:r.segments}}function resolveTtsReadScope(e,t){return e===`first-segment`||e===`smart`&&t?`first-segment`:`full`}function applyTtsReadScope(e,t){return t===`first-segment`?firstTtsSegment(e):e}let Ie=[`后面还有内容,先陪你念到这里啦~`,`剩下的部分,查看文字回复吧。`,`完整内容,你来接着往下看吧~`,`后面内容太长了,我就不读了,请查阅。`,`我先念到这里,后面的内容在文字回复里哦。`,`这一段先帮你读到这里,剩下的继续看文字吧。`],Re=/[,.;:!?,。!?;、:…]$/u;function appendTtsSmartTruncationOutro(e,t,n=Math.random){let r=countTtsSpeechCharacters(t),i=Math.max(0,countTtsSpeechCharacters(e)-r);if(r===0||i<r)return t;let a=t.trimEnd(),o=Math.min(Ie.length-1,Math.max(0,Math.floor(n()*Ie.length)));return`${a}${Re.test(a)?``:`。`}${Ie[o]}`}function applyTtsPlaybackScope(e,t,n,r=Math.random,i=prepareTtsText){if(i!==prepareTtsText){let a=i(e);if(resolveTtsReadScope(t,n)===`full`)return a;let o=splitTtsSegments(a,void 0,void 0,i).slice(0,t===`smart`&&n?2:1).join(``);return t===`smart`&&n?appendTtsSmartTruncationOutro(a,o,r):o}let a=t===`smart`&&n?firstTtsSegments(e,2):applyTtsReadScope(e,resolveTtsReadScope(t,n));return t===`smart`&&n?appendTtsSmartTruncationOutro(e,a,r):a}function applyBreezeTtsPlaybackScope(e,t,n,r=Math.random){let i=prepareBreezeTtsText(e);if(i.length===0)return``;if(t===`full`||t===`smart`&&!n)return i;let a=t===`smart`?2:1,o=splitBreezeTtsSentences(i).slice(0,a).join(``);return t===`smart`&&n?appendTtsSmartTruncationOutro(i,o,r):o}function applyTtsLivePlaybackScope(e,t,n,r=!1,i=Math.random,a=prepareTtsText){if(resolveTtsReadScope(t,!0)===`full`)return e;let o=a(e),s=n.limit(o,r);return r&&t===`smart`?appendTtsSmartTruncationOutro(o,s,i):s}function supportsXiaomiAudioTags(e){return(e.provider??`xiaomi`)===`xiaomi`&&(e.model??`mimo-v2.5-tts`)===`mimo-v2.5-tts`}function prepareProviderTtsText(e,t){return t.provider===`breeze`?prepareBreezeTtsText(e):supportsXiaomiAudioTags(t)?prepareXiaomiTtsText(e):prepareTtsText((t.provider??`xiaomi`)===`xiaomi`?stripXiaomiAudioTags(e):e)}function resolveTtsSettings(e){let t={...re,...e},n=Number.isFinite(t.soundVolume)?Math.max(0,Math.min(1,t.soundVolume)):re.soundVolume,r=Number.isFinite(t.voiceVolume)?Math.max(0,Math.min(1,t.voiceVolume)):re.voiceVolume,i=normalizeVoiceRate(t.voiceRate),a=e?.readScope!==void 0&&F.includes(e.readScope)?e.readScope:e?.voiceDesignPlaybackMode===`first-segment`?`first-segment`:re.readScope,o=t.model===`browser-local-fallback`?`mimo-v2.5-tts`:t.model,s=typeof e?.voiceDesignCustomPrompt==`string`?e.voiceDesignCustomPrompt:P.some(e=>e.prompt===t.voiceDesignPrompt)?re.voiceDesignCustomPrompt:t.voiceDesignPrompt,c=t.mossEnabled===!0,l=M.includes(t.localVoiceEngine)&&(t.localVoiceEngine!==`moss`||c)?t.localVoiceEngine:`browser`,u=typeof t.mossBaseURL==`string`&&t.mossBaseURL.trim().length>0?t.mossBaseURL.trim().replace(/\/+$/u,``):v;return{...t,showInSidebar:t.showInSidebar===!0,showInHostSettings:t.showInHostSettings!==!1,showFeatureGuide:t.showFeatureGuide!==!1,acceptExternalProviders:t.acceptExternalProviders!==!1,qqbotEnabled:t.qqbotEnabled===!0,announcementSources:te.filter(t=>(Array.isArray(e?.announcementSources)?e.announcementSources:re.announcementSources).includes(t)),breezeEnabled:t.breezeEnabled===!0,doubaoEnabled:t.doubaoEnabled!==!1||t.breezeEnabled!==!0,provider:t.provider===`doubao`&&(t.doubaoEnabled!==!1||t.breezeEnabled!==!0)||t.provider===`breeze`&&t.breezeEnabled===!0?t.provider:`xiaomi`,instruction:typeof t.instruction==`string`?t.instruction:re.instruction,doubaoInstruction:typeof t.doubaoInstruction==`string`?t.doubaoInstruction:``,doubaoModel:ce.includes(t.doubaoModel)?t.doubaoModel:`seed-tts-2.0`,model:o,voiceDesignCustomPrompt:s,localVoiceEngine:l,mossEnabled:c,mossBaseURL:u,mossVoice:typeof t.mossVoice==`string`?t.mossVoice:``,mossVoiceName:typeof t.mossVoiceName==`string`?t.mossVoiceName:``,autoPlay:t.enabled?t.autoPlay:!1,voiceInputCompatibility:t.voiceInputCompatibility!==!1,inputAvoidance:t.inputAvoidance===!0,importantAnnouncementsFirst:t.importantAnnouncementsFirst===!0,soundVolume:n,voiceVolume:r,voiceRate:i,readScope:a,soundPack:I.includes(t.soundPack)?t.soundPack:re.soundPack}}let Ve=[[`Vivi 2.0`,`zh_female_vv_uranus_bigtts`,`通用`],[`知性灿灿 2.0`,`zh_female_cancan_uranus_bigtts`,`角色`],[`撒娇学妹 2.0`,`zh_female_sajiaoxuemei_uranus_bigtts`,`角色`],[`爽快思思 2.0`,`zh_female_shuangkuaisisi_uranus_bigtts`,`通用`],[`少年梓辛 2.0`,`zh_male_shaonianzixin_uranus_bigtts`,`通用`],[`猴哥 2.0`,`zh_male_sunwukong_uranus_bigtts`,`配音`],[`黑猫侦探社咪仔 2.0`,`zh_female_mizai_uranus_bigtts`,`配音`],[`儒雅逸辰 2.0`,`zh_male_ruyayichen_uranus_bigtts`,`配音`],[`TVB女声 2.0`,`zh_female_tvbnv_uranus_bigtts`,`通用`],[`四郎 2.0`,`zh_male_silang_uranus_bigtts`,`角色`],[`熊二 2.0`,`zh_male_xionger_uranus_bigtts`,`角色`],[`樱桃丸子 2.0`,`zh_female_yingtaowanzi_uranus_bigtts`,`角色`],[`高冷御姐 2.0`,`zh_female_gaolengyujie_uranus_bigtts`,`通用`],[`傲娇霸总 2.0`,`zh_male_aojiaobazong_uranus_bigtts`,`通用`],[`悬疑解说 2.0`,`zh_male_xuanyijieshuo_uranus_bigtts`,`阅读`],[`小何 2.0`,`zh_female_xiaohe_uranus_bigtts`,`通用`],[`云舟 2.0`,`zh_male_m191_uranus_bigtts`,`通用`],[`小天 2.0`,`zh_male_taocheng_uranus_bigtts`,`通用`],[`清澈梓梓 2.0`,`zh_female_qingchezizi_uranus_bigtts`,`通用`],[`女雷神 2.0`,`zh_female_nvleishen_uranus_bigtts`,`角色`],[`直率英子 2.0`,`zh_female_zhishuaiyingzi_uranus_bigtts`,`角色`],[`谄媚女声 2.0`,`zh_female_chanmeinv_uranus_bigtts`,`通用`],[`玲玲姐姐 2.0`,`zh_female_lingling_uranus_bigtts`,`角色`],[`娇喘女声 2.0`,`zh_female_jiaochuannv_uranus_bigtts`,`通用`],[`鲁班七号 2.0`,`zh_male_lubanqihao_uranus_bigtts`,`角色`],[`春日部姐姐 2.0`,`zh_female_chunribu_uranus_bigtts`,`角色`],[`温柔妈妈 2.0`,`zh_female_wenroumama_uranus_bigtts`,`通用`],[`霸气青叔 2.0`,`zh_male_baqiqingshu_uranus_bigtts`,`阅读`],[`深夜播客 2.0`,`zh_male_shenyeboke_uranus_bigtts`,`通用`],[`儿童绘本 2.0`,`zh_female_xiaoxue_uranus_bigtts`,`阅读`]].map(([e,t,n])=>({name:e,value:t,scene:n,language:`中文 / Chinese`,resourceId:`seed-tts-2.0`,bidirectional:!0}));function mossVoiceChoices(e,t,n){return t.trim().length===0||e.some(e=>e.id===t)?[...e]:[{id:t,name:n.trim()||t},...e]}var AutomaticReading=class{mode=`all`;listeners=new Set;running=new Map;blocked=new Set;automatic=!1;getSnapshot=()=>this.mode;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});update(e,t,n){let r=e===`final`?`final`:`all`;if(r!==this.mode){this.mode=r;for(let[e,t]of this.running)t&&this.blocked.add(e);this.automatic&&t(),this.automatic=!1,n();for(let e of this.listeners)e()}}observe(e,t){t&&this.running.get(e)!==!0&&this.blocked.delete(e),this.running.set(e,t)}allowed(e){return!this.blocked.has(e)}isAutomatic(){return this.automatic}interruptAutomatic(e){for(let[e,t]of this.running)t&&this.blocked.add(e);this.automatic&&e(),this.automatic=!1}markAutomatic(){this.automatic=!0}markManual(){this.automatic=!1}release(e){this.running.delete(e),this.blocked.delete(e)}},He={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ue=l.default.createContext&&l.default.createContext(He),Ke=[`attr`,`size`,`title`];function _objectWithoutProperties(e,t){if(e==null)return{};var n,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_extends.apply(null,arguments)}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){var t=_toPrimitive(e,`string`);return typeof t==`symbol`?t:t+``}function _toPrimitive(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Tree2Element(e){return e&&e.map((e,t)=>l.default.createElement(e.tag,_objectSpread({key:t},e.attr),Tree2Element(e.child)))}function GenIcon(e){return t=>l.default.createElement(IconBase,_extends({attr:_objectSpread({},e.attr)},t),Tree2Element(e.child))}function IconBase(e){var elem=t=>{var n=e.attr,r=e.size,i=e.title,a=_objectWithoutProperties(e,Ke),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),l.default.createElement(`svg`,_extends({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:_objectSpread(_objectSpread({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&l.default.createElement(`title`,null,i),e.children)};return Ue===void 0?elem(He):l.default.createElement(Ue.Consumer,null,e=>elem(e))}function RiKey2Line(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M10.7577 11.8281L18.6066 3.97919L20.0208 5.3934L18.6066 6.80761L21.0815 9.28249L19.6673 10.6967L17.1924 8.22183L15.7782 9.63604L17.8995 11.7574L16.4853 13.1716L14.364 11.0503L12.1719 13.2423C13.4581 15.1837 13.246 17.8251 11.5355 19.5355C9.58291 21.4882 6.41709 21.4882 4.46447 19.5355C2.51184 17.5829 2.51184 14.4171 4.46447 12.4645C6.17493 10.754 8.81633 10.5419 10.7577 11.8281ZM10.1213 18.1213C11.2929 16.9497 11.2929 15.0503 10.1213 13.8787C8.94975 12.7071 7.05025 12.7071 5.87868 13.8787C4.70711 15.0503 4.70711 16.9497 5.87868 18.1213C7.05025 19.2929 8.94975 19.2929 10.1213 18.1213Z`},child:[]}]})(e)}function RiPushpinLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M13.8273 1.69L22.3126 10.1753L20.8984 11.5895L20.1913 10.8824L15.9486 15.125L15.2415 18.6606L13.8273 20.0748L9.58466 15.8321L4.63492 20.7819L3.2207 19.3677L8.17045 14.4179L3.92781 10.1753L5.34202 8.76107L8.87756 8.05396L13.1202 3.81132L12.4131 3.10422L13.8273 1.69ZM14.5344 5.22554L9.86358 9.89637L7.0417 10.4607L13.5418 16.9609L14.1062 14.139L18.7771 9.46818L14.5344 5.22554Z`},child:[]}]})(e)}function RiPushpinFill(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M22.3126 10.1753L20.8984 11.5895L20.1913 10.8824L15.9486 15.125L15.2415 18.6606L13.8273 20.0748L9.58466 15.8321L4.63492 20.7819L3.2207 19.3677L8.17045 14.4179L3.92781 10.1753L5.34202 8.76107L8.87756 8.05396L13.1202 3.81132L12.4131 3.10422L13.8273 1.69L22.3126 10.1753Z`},child:[]}]})(e)}function RiDownloadLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M3 19H21V21H3V19ZM13 13.1716L19.0711 7.1005L20.4853 8.51472L12 17L3.51472 8.51472L4.92893 7.1005L11 13.1716V2H13V13.1716Z`},child:[]}]})(e)}function RiDeleteBinLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 11H11V17H9V11ZM13 11H15V17H13V11ZM9 4V6H15V4H9Z`},child:[]}]})(e)}function RiCheckLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z`},child:[]}]})(e)}function RiVoiceAiFill(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M20.7134 7.12811L20.4668 7.69379C20.2864 8.10792 19.7136 8.10792 19.5331 7.69379L19.2866 7.12811C18.8471 6.11947 18.0555 5.31641 17.0677 4.87708L16.308 4.53922C15.8973 4.35653 15.8973 3.75881 16.308 3.57612L17.0252 3.25714C18.0384 2.80651 18.8442 1.97373 19.2761 0.930828L19.5293 0.319534C19.7058 -0.106511 20.2942 -0.106511 20.4706 0.319534L20.7238 0.930828C21.1558 1.97373 21.9616 2.80651 22.9748 3.25714L23.6919 3.57612C24.1027 3.75881 24.1027 4.35653 23.6919 4.53922L22.9323 4.87708C21.9445 5.31641 21.1529 6.11947 20.7134 7.12811ZM8.5 6H6.5V18H8.5V6ZM4 10H2V14H4V10ZM13 2H11V22H13V2ZM17.5 8H15.5V18H17.5V8ZM22 10H20V14H22V10Z`},child:[]}]})(e)}function RiRadio2Line(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M6 3V1H8V3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H6ZM4 5V19H20V5H4ZM9 15C7.34315 15 6 13.6569 6 12C6 10.3431 7.34315 9 9 9C10.6569 9 12 10.3431 12 12C12 13.6569 10.6569 15 9 15ZM14 9H18V11H14V9ZM14 13H18V15H14V13Z`},child:[]}]})(e)}function RiEqualizerLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M6.17071 18C6.58254 16.8348 7.69378 16 9 16C10.3062 16 11.4175 16.8348 11.8293 18H22V20H11.8293C11.4175 21.1652 10.3062 22 9 22C7.69378 22 6.58254 21.1652 6.17071 20H2V18H6.17071ZM12.1707 11C12.5825 9.83481 13.6938 9 15 9C16.3062 9 17.4175 9.83481 17.8293 11H22V13H17.8293C17.4175 14.1652 16.3062 15 15 15C13.6938 15 12.5825 14.1652 12.1707 13H2V11H12.1707ZM6.17071 4C6.58254 2.83481 7.69378 2 9 2C10.3062 2 11.4175 2.83481 11.8293 4H22V6H11.8293C11.4175 7.16519 10.3062 8 9 8C7.69378 8 6.58254 7.16519 6.17071 6H2V4H6.17071ZM9 6C9.55228 6 10 5.55228 10 5C10 4.44772 9.55228 4 9 4C8.44772 4 8 4.44772 8 5C8 5.55228 8.44772 6 9 6ZM15 13C15.5523 13 16 12.5523 16 12C16 11.4477 15.5523 11 15 11C14.4477 11 14 11.4477 14 12C14 12.5523 14.4477 13 15 13ZM9 20C9.55228 20 10 19.5523 10 19C10 18.4477 9.55228 18 9 18C8.44772 18 8 18.4477 8 19C8 19.5523 8.44772 20 9 20Z`},child:[]}]})(e)}function RiDiscLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M15 4.58152V12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C12.3506 9 12.6872 9.06016 13 9.17071V2.04938C18.0533 2.5511 22 6.81465 22 12C22 17.5229 17.5228 22 12 22C6.47715 22 2 17.5229 2 12C2 6.81465 5.94668 2.5511 11 2.04938V4.0619C7.05369 4.55399 4 7.92038 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 8.64262 17.9318 5.76829 15 4.58152Z`},child:[]}]})(e)}function RiSwitchFill(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M13.62 21C13.5351 21 13.4786 20.9434 13.4927 20.8727V3.12726C13.4927 3.0707 13.5351 3.01414 13.6058 3.01414H16.3914C18.9366 3.01414 21.001 5.07855 21.001 7.62372V16.3904C21.001 18.9356 18.9366 21 16.3914 21H13.62ZM17.0418 11.0738C16.0379 11.0738 15.2178 11.894 15.2178 12.8979C15.2178 13.9018 16.0379 14.7219 17.0418 14.7219C18.0458 14.7219 18.8659 13.9018 18.8659 12.8979C18.8659 11.894 18.0458 11.0738 17.0418 11.0738ZM5.80066 8.40141C5.80066 7.46819 6.56421 6.70463 7.49744 6.70463C8.43067 6.70463 9.19422 7.46819 9.19422 8.40141C9.19422 9.33464 8.43067 10.0982 7.49744 10.0982C6.56421 10.0982 5.80066 9.33464 5.80066 8.40141ZM11.5414 3C11.6263 3 11.6828 3.05656 11.6687 3.12726V20.8586C11.6687 20.9293 11.6121 20.9859 11.5414 20.9859H7.61056C5.06539 20.9859 3.00098 18.9214 3.00098 16.3763V7.60958C3.00098 5.06441 5.06539 3 7.61056 3H11.5414ZM10.2264 19.5436V4.44226H7.61056C6.76217 4.44226 5.97034 4.78162 5.37647 5.37549C4.76846 5.96936 4.44324 6.76119 4.44324 7.60958V16.3763C4.44324 17.2247 4.78259 18.0165 5.37647 18.6104C5.97034 19.2184 6.76217 19.5436 7.61056 19.5436H10.2264Z`},child:[]}]})(e)}function RiSaveLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M7 19V13H17V19H19V7.82843L16.1716 5H5V19H7ZM4 3H17L21 7V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM9 15V19H15V15H9Z`},child:[]}]})(e)}function RiEditLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M6.41421 15.89L16.5563 5.74785L15.1421 4.33363L5 14.4758V15.89H6.41421ZM7.24264 17.89H3V13.6473L14.435 2.21231C14.8256 1.82179 15.4587 1.82179 15.8492 2.21231L18.6777 5.04074C19.0682 5.43126 19.0682 6.06443 18.6777 6.45495L7.24264 17.89ZM3 19.89H21V21.89H3V19.89Z`},child:[]}]})(e)}function RiArrowLeftSLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z`},child:[]}]})(e)}function RiArrowDownSLine(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`currentColor`},child:[{tag:`path`,attr:{d:`M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z`},child:[]}]})(e)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function useSettingsSnapshot(e){let t=(0,l.useCallback)(t=>e.subscribe(t),[e]),n=(0,l.useCallback)(()=>e.getSnapshot(),[e]);return(0,l.useSyncExternalStore)(t,n,n)}let Je=(0,l.createContext)({});function useConstant(e){let t=(0,l.useRef)(null);return t.current===null&&(t.current=e()),t.current}let Ye=typeof window<`u`?l.useLayoutEffect:l.useEffect,Ze=(0,l.createContext)(null);function addUniqueItem(e,t){e.indexOf(t)===-1&&e.push(t)}function removeItem(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}let clamp$1=(e,t,n)=>n>t?t:n<e?e:n,Qe={},isNumericalString=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),isObject=e=>typeof e==`object`&&!!e,isZeroValueString=e=>/^0[^.\s]+$/u.test(e);function memo(e){let t;return()=>(t===void 0&&(t=e()),t)}let noop=e=>e,pipe=(...e)=>e.reduce((e,t)=>n=>t(e(n))),progress=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1};var SubscriptionManager=class{constructor(){this.subscriptions=[]}add(e){return addUniqueItem(this.subscriptions,e),()=>this.remove(e)}remove(e){removeItem(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}};let secondsToMilliseconds=e=>e*1e3,millisecondsToSeconds=e=>e/1e3,velocityPerSecond=(e,t)=>t?e*(1e3/t):0,calcBezier=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function binarySubdivide(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=calcBezier(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>1e-7&&++s<12);return o}function cubicBezier(e,t,n,r){if(e===t&&n===r)return noop;let getTForX=t=>binarySubdivide(t,0,1,e,n);return e=>e===0||e===1?e:calcBezier(getTForX(e),t,r)}let mirrorEasing=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,reverseEasing=e=>t=>1-e(1-t),et=cubicBezier(.33,1.53,.69,.99),tt=reverseEasing(et),nt=mirrorEasing(tt),anticipate=e=>e>=1?1:(e*=2)<1?.5*tt(e):.5*(2-2**(-10*(e-1))),circIn=e=>1-Math.sin(Math.acos(e)),rt=reverseEasing(circIn),it=mirrorEasing(circIn),at=cubicBezier(.42,0,1,1),ot=cubicBezier(0,0,.58,1),st=cubicBezier(.42,0,.58,1),isEasingArray=e=>Array.isArray(e)&&typeof e[0]!=`number`,isBezierDefinition=e=>Array.isArray(e)&&typeof e[0]==`number`,ct={linear:noop,easeIn:at,easeInOut:st,easeOut:ot,circIn,circInOut:it,circOut:rt,backIn:tt,backInOut:nt,backOut:et,anticipate},isValidEasing=e=>typeof e==`string`,easingDefinitionToFunction=e=>{if(isBezierDefinition(e)){e.length;let[t,n,r,i]=e;return cubicBezier(t,n,r,i)}else if(isValidEasing(e))return ct[e],`${e}`,ct[e];return e},lt={delta:0,timestamp:0,isProcessing:!1},ut;function clearTime(){ut=void 0}let dt={now:()=>(ut===void 0&&dt.set(lt.isProcessing||Qe.useManualTiming?lt.timestamp:performance.now()),ut),set:e=>{ut=e,queueMicrotask(clearTime)}},sanitize=e=>Math.round(e*1e5)/1e5,checkStringStartsWith=e=>t=>typeof t==`string`&&t.startsWith(e),ft=checkStringStartsWith(`--`),pt=checkStringStartsWith(`var(--`),isCSSVariableToken=e=>pt(e)?mt.test(e.split(`/*`)[0].trim()):!1,mt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function containsCSSVariable(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}let ht={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},gt={...ht,transform:e=>clamp$1(0,1,e)},_t={...ht,default:1},vt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function isNullish(e){return e==null}let yt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,isColorString=(e,t)=>n=>!!(typeof n==`string`&&yt.test(n)&&n.startsWith(e)||t&&!isNullish(n)&&Object.prototype.hasOwnProperty.call(n,t)),splitColor=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(vt);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},clampRgbUnit=e=>clamp$1(0,255,e),bt={...ht,transform:e=>Math.round(clampRgbUnit(e))},xt={test:isColorString(`rgb`,`red`),parse:splitColor(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+bt.transform(e)+`, `+bt.transform(t)+`, `+bt.transform(n)+`, `+sanitize(gt.transform(r))+`)`};function parseHex(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}let St={test:isColorString(`#`),parse:parseHex,transform:xt.transform},createUnitType=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ct=createUnitType(`deg`),wt=createUnitType(`%`),G=createUnitType(`px`),Tt=createUnitType(`vh`),Et=createUnitType(`vw`),Dt=(()=>({...wt,parse:e=>wt.parse(e)/100,transform:e=>wt.transform(e*100)}))(),Ot={test:isColorString(`hsl`,`hue`),parse:splitColor(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+wt.transform(sanitize(t))+`, `+wt.transform(sanitize(n))+`, `+sanitize(gt.transform(r))+`)`},kt={test:e=>xt.test(e)||St.test(e)||Ot.test(e),parse:e=>xt.test(e)?xt.parse(e):Ot.test(e)?Ot.parse(e):St.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?xt.transform(e):Ot.transform(e),getAnimatableNone:e=>{let t=kt.parse(e);return t.alpha=0,kt.transform(t)}},At=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,jt=new RegExp(vt.source),Mt=new RegExp(At.source,`i`);function test(e){return isNaN(e)&&typeof e==`string`&&(jt.test(e)||Mt.test(e))}let Nt=`number`,Pt=`color`,Ft=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function hasComplexValues(e){let t=e.toString();return jt.test(t)||Mt.test(t)}function analyseComplexValue(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Ft,e=>(kt.test(e)?(r.color.push(a),i.push(Pt),n.push(kt.parse(e))):e.startsWith(`var(`)?(r.var.push(a),i.push(`var`),n.push(e)):(r.number.push(a),i.push(Nt),n.push(parseFloat(e))),++a,"${}")).split("${}"),indexes:r,types:i}}function parseComplexValue(e){return analyseComplexValue(e).values}function buildTransformer({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===Nt?i+=sanitize(r[a]):e===Pt?i+=kt.transform(r[a]):i+=r[a]}return i}}function createTransformer(e){return buildTransformer(analyseComplexValue(e))}let convertNumbersToZero=e=>typeof e==`number`?0:kt.test(e)?kt.getAnimatableNone(e):e,convertToZero=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:convertNumbersToZero(e);function getAnimatableNone$1(e){let t=analyseComplexValue(e);return buildTransformer(t)(t.values.map((e,n)=>convertToZero(e,t.split[n])))}__name(getAnimatableNone$1,`getAnimatableNone`);let It={test,parse:parseComplexValue,createTransformer,getAnimatableNone:getAnimatableNone$1};function hueToRgb(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function hslaToRgba({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=hueToRgb(s,r,e+1/3),a=hueToRgb(s,r,e),o=hueToRgb(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function mixImmediate(e,t){return n=>n>0?t:e}let mixNumber=(e,t,n)=>e+(t-e)*n,mixLinearColor=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Lt=[St,xt,Ot],getColorType=e=>Lt.find(t=>t.test(e));function asRGBA(e){let t=getColorType(e);if(!t)return`${e}`,!1;let n=t.parse(e);return t===Ot&&(n=hslaToRgba(n)),n}let mixColor=(e,t)=>{let n=asRGBA(e),r=asRGBA(t);if(!n||!r)return mixImmediate(e,t);let i={...n};return e=>(i.red=mixLinearColor(n.red,r.red,e),i.green=mixLinearColor(n.green,r.green,e),i.blue=mixLinearColor(n.blue,r.blue,e),i.alpha=mixNumber(n.alpha,r.alpha,e),xt.transform(i))},Rt=new Set([`none`,`hidden`]);function mixVisibility(e,t){return Rt.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function mixNumber$1(e,t){return n=>mixNumber(e,t,n)}__name(mixNumber$1,`mixNumber`);function getMixer(e){return typeof e==`number`?mixNumber$1:typeof e==`string`?isCSSVariableToken(e)?mixImmediate:kt.test(e)?mixColor:mixComplex:Array.isArray(e)?mixArray:typeof e==`object`?kt.test(e)?mixColor:mixObject:mixImmediate}function mixArray(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>getMixer(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function mixObject(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=getMixer(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function matchOrder(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}let mixComplex=(e,t)=>{let n=It.createTransformer(t),r=analyseComplexValue(e),i=analyseComplexValue(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Rt.has(e)&&!i.values.length||Rt.has(t)&&!r.values.length?mixVisibility(e,t):pipe(mixArray(matchOrder(r,i),i.values),n):(`${e}${t}`,mixImmediate(e,t))},zt=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function mixUnit(e,t){let n=zt.exec(e);if(!n)return;let r=zt.exec(t);if(!r||n[2]!==r[2])return;let i=n[2],a=parseFloat(n[1]),o=parseFloat(r[1]);return e=>sanitize(mixNumber(a,o,e))+i}function mix(e,t,n){if(typeof e==`number`&&typeof t==`number`&&typeof n==`number`)return mixNumber(e,t,n);if(typeof e==`string`&&typeof t==`string`){let n=mixUnit(e,t);if(n)return n}return getMixer(e)(e,t)}let Bt=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function createRenderStep(e){let t=new Set,n=new Set,r=!1,i=!1,a=new Set,o={delta:0,timestamp:0,isProcessing:!1};function triggerCallback(t){a.has(t)&&(n.add(t),e()),t(o)}let s={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(triggerCallback),t.clear(),r=!1,i&&(i=!1,s.process(e))}};return s}function createRenderBatcher(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0,flagRunNextFrame=()=>r=!0,a=Bt.reduce((e,t)=>(e[t]=createRenderStep(flagRunNextFrame),e),{}),{setup:o,read:s,resolveKeyframes:c,preUpdate:l,update:u,preRender:d,render:p,postRender:m}=a,processBatch=()=>{let a=Qe.useManualTiming,h=a?n.timestamp:performance.now();r=!1,a||(n.delta=i?1e3/60:Math.max(Math.min(h-n.timestamp,40),1)),n.timestamp=h,n.isProcessing=!0,o.process(n),s.process(n),c.process(n),l.process(n),u.process(n),d.process(n),p.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(processBatch))},wake=()=>{r=!0,i=!0,n.isProcessing||e(processBatch)},h=Bt.reduce((e,t)=>{let n=a[t];return e[t]=(e,t=!1,i=!1)=>(r||wake(),n.schedule(e,t,i)),e},{}),cancel=e=>{for(let t=0;t<Bt.length;t++)a[Bt[t]].cancel(e)};return{schedule:h,cancel,state:n,steps:a}}let{schedule:q,cancel:Vt,steps:Ht}=createRenderBatcher(typeof requestAnimationFrame<`u`?requestAnimationFrame:noop,!0,lt),frameloopDriver=e=>{let passTimestamp=({timestamp:t})=>e(t);return{start:(e=!0)=>q.update(passTimestamp,e),stop:()=>Vt(passTimestamp),now:()=>lt.isProcessing?lt.timestamp:dt.now()}},generateLinearEasing=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Ut=2e4;function calcGeneratorDuration(e,t=50,n=Ut,r){let i=0,a=e.next(i);for(r?.push(a.value);!a.done&&i<n;)i+=t,a=e.next(i),r?.push(a.value);return i>=n?1/0:i}function createGeneratorEasing(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(calcGeneratorDuration(r),Ut);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:millisecondsToSeconds(i)}}let Wt={stiffness:100,damping:10,mass:1,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05},bounceToDampingRatio=e=>e<0?1/Math.max(1+e,Wt.minDamping):Math.max(1-e,Wt.minDamping);function overdampedFreqScale(e,t){if(!(e>1))return 1;let n=Math.sqrt(e*e-1),r=e-n,i=e+n,a=2*n*Math.exp(-t)*(1+t);return approximateRoot(e=>i*Math.exp(-r*e)-r*Math.exp(-i*e)-a,e=>Math.exp(-i*e)-Math.exp(-r*e),t)/t}function calcAngularFreq(e,t){return e*Math.sqrt(1-t*t)}function approximateRoot(e,t,n){let r=n;for(let n=1;n<12;n++)r-=e(r)/t(r);return r}let Gt=.001;function findSpring({duration:e=Wt.duration,bounce:t=Wt.bounce}){let envelope,derivative;Wt.maxDuration;let n=bounceToDampingRatio(t);e=clamp$1(Wt.minDuration,Wt.maxDuration,millisecondsToSeconds(e)),n<1?(envelope=t=>{let r=t*n,i=r*e,a=calcAngularFreq(t,n),o=Math.exp(-i);return Gt-r/a*o},derivative=t=>{let r=t*n*e,i=n*n*t*t*e,a=Math.exp(-r),o=calcAngularFreq(t*t,n);return(-envelope(t)+Gt>0?-1:1)*-i*a/o}):(envelope=t=>{let n=Math.exp(-t*e),r=t*e+1;return-Gt+n*r},derivative=t=>Math.exp(-t*e)*(-t*(e*e)));let r=5/e,i=approximateRoot(envelope,derivative,r),a=i*overdampedFreqScale(n,i*e),o=a*a;return{stiffness:o,damping:n*2*Math.sqrt(o),duration:secondsToMilliseconds(e)}}let isValidPhysics=(e,t)=>(t?e>=0:e>0)&&e<1/0;function resolvePhysics(e,t){if(isValidPhysics(e,t))return e}function getSpringOptions(e){let t=resolvePhysics(e.stiffness),n=resolvePhysics(e.damping,!0),r=resolvePhysics(e.mass),i={...e,stiffness:t??Wt.stiffness,damping:n??Wt.damping,mass:r??Wt.mass,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){let t=bounceToDampingRatio(e.bounce||0),n=2*Math.PI/(e.visualDuration*1.2)*overdampedFreqScale(t,2*Math.PI/1.2);i.stiffness=n*n,i.damping=2*t*Math.sqrt(i.stiffness)}else Object.assign(i,findSpring(i)),i.isResolvedFromDuration=!0;(!isValidPhysics(i.stiffness)||!isValidPhysics(i.damping,!0))&&(i.stiffness=Wt.stiffness,i.damping=Wt.damping)}return i}function spring(e=Wt.visualDuration,t=Wt.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:o,damping:s,mass:c,duration:l,isResolvedFromDuration:u,isTimeDefined:d}=getSpringOptions({...n}),inheritVelocity=e=>d?0:-millisecondsToSeconds(e),p=s/(2*Math.sqrt(o*c)),m=millisecondsToSeconds(Math.sqrt(o/c)),h=p*m,g={target:i,delta:i-r,velocity:inheritVelocity(n.velocity||0)||0,restSpeed:0,restDelta:0},setRestThresholds=()=>{let e=Math.abs(g.delta)<5;g.restSpeed=n.restSpeed||(e?Wt.restSpeed.granular:Wt.restSpeed.default),g.restDelta=n.restDelta||(e?Wt.restDelta.granular:Wt.restDelta.default)};setRestThresholds();let resolveSpring,resolveVelocity,update;if(p<1){let e=calcAngularFreq(m,p),t={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};update=()=>{t.A=(g.velocity+h*g.delta)/e,t.sinC=h*t.A+g.delta*e,t.cosC=h*g.delta-t.A*e};let sample=n=>{n!==t.t&&(t.t=n,t.env=Math.exp(-h*n),t.sin=Math.sin(e*n),t.cos=Math.cos(e*n))};resolveSpring=e=>(sample(e),g.target-t.env*(t.A*t.sin+g.delta*t.cos)),resolveVelocity=e=>(sample(e),t.env*(t.sinC*t.sin+t.cosC*t.cos))}else if(p===1){resolveSpring=e=>g.target-Math.exp(-m*e)*(g.delta+(g.velocity+m*g.delta)*e);let e={C:0};update=()=>{e.C=g.velocity+m*g.delta},resolveVelocity=t=>Math.exp(-m*t)*(m*e.C*t-g.velocity)}else{let e=m*Math.sqrt(p*p-1),t=h-e,n=h+e,r=d?1/0:300/e,decayAt=(e,t)=>Math.exp(t>r?-e*r-h*(t-r):-e*t),i={S:0,F:0};update=()=>{let t=(g.velocity+h*g.delta)/e;i.S=(g.delta+t)/2,i.F=(g.delta-t)/2},resolveSpring=e=>g.target-i.S*decayAt(t,e)-i.F*decayAt(n,e),resolveVelocity=e=>t*i.S*decayAt(t,e)+n*i.F*decayAt(n,e)}update();let _=u&&l||null,v={calculatedDuration:_,retarget:(e,t)=>{g.target=e[e.length-1],g.delta=g.target-e[0],g.velocity=inheritVelocity(t),n.restSpeed&&n.restDelta||setRestThresholds(),v.calculatedDuration=_,a.done=!1,update()},velocity:e=>secondsToMilliseconds(resolveVelocity(e)),next:e=>{let t=resolveSpring(e);if(u)a.done=e>=l;else{let n=secondsToMilliseconds(resolveVelocity(e));a.done=Math.abs(n)<=g.restSpeed&&Math.abs(g.target-t)<=g.restDelta}return a.value=a.done?g.target:t,a},toString:()=>{let e=Math.min(calcGeneratorDuration(v),Ut),t=generateLinearEasing(t=>v.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return v}spring.applyToOptions=e=>{let t=createGeneratorEasing(e,100,spring);return e.ease=t.ease,e.duration=secondsToMilliseconds(t.duration),e.type=`keyframes`,e};function inertia({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],p={done:!1,value:d},isOutOfBounds=e=>e<s||e>c,nearestBoundary=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,m=n*t,h=d+m,g=o===void 0?h:o(h);g!==h&&(m=g-d);let calcDelta=e=>-m*Math.exp(-e/r),applyFriction=e=>{let t=calcDelta(e);p.done=Math.abs(t)<=l,p.value=p.done?g:g+t},_,v,checkCatchBoundary=e=>{isOutOfBounds(p.value)&&(_=e,v=spring({keyframes:[p.value,nearestBoundary(p.value)],velocity:-calcDelta(e)/r*1e3,damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return checkCatchBoundary(0),{calculatedDuration:null,next:e=>{let t=!1;return!v&&_===void 0&&(t=!0,applyFriction(e),checkCatchBoundary(e)),_!==void 0&&e>=_?v.next(e-_):(!t&&applyFriction(e),p)}}}function createMixers(e,t,n){let r=[],i=n||Qe.mix||mix,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=pipe(Array.isArray(t)?t[n]||noop:t,a)),r.push(a)}return r}function interpolate(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=createMixers(t,r,i),c=s.length,interpolator=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=progress(e[r],e[r+1],n);return s[r](i)};return n?t=>interpolator(clamp$1(e[0],e[a-1],t)):interpolator}function fillOffset(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=progress(0,t,r);e.push(mixNumber(n,1,i))}}function defaultOffset(e){let t=[0];return fillOffset(t,e.length-1),t}function convertOffsetToTimes(e,t){return e.map(e=>e*t)}function defaultEasing(e,t){return e.map(()=>t||st).splice(0,e.length-1)}function keyframes({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=isEasingArray(r)?r.map(easingDefinitionToFunction):easingDefinitionToFunction(r)||st,a={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(i)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){let[n,r]=t,o=n===r?void 0:(Qe.mix||mix)(n,r);return{calculatedDuration:e,next:t=>(a.value=o?o(i(e>0?clamp$1(0,1,t/e):1)):r,a.done=t>=e,a)}}let o=interpolate(convertOffsetToTimes(n&&n.length===t.length?n:defaultOffset(t),e),t,{ease:Array.isArray(i)?i:defaultEasing(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}function getGeneratorVelocity(e,t,n){let r=Math.max(t-5,0);return velocityPerSecond(n-e(r),t-r)}function calcGeneratorVelocity(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):getGeneratorVelocity(t=>e.next(t).value,t,e.next(t).value)}let isNotNull=e=>e!==null;function getFinalKeyframe(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(isNotNull),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}let Y={decay:inertia,inertia,tween:keyframes,keyframes,spring};function replaceTransitionType(e){typeof e.type==`string`&&(e.type=Y[e.type])}let resolveStartTime=(e,t)=>t-e>40&&!Qe.useManualTiming?t:e;function baseRecord(e,t){return{kind:e,animation:t,timestamp:dt.now(),frameTimestamp:lt.timestamp,frameIsProcessing:lt.isProcessing}}function notifyAnimationStart(e,t,n){let r=globalThis.__MOTION_INSPECT__;if(r)try{r({...baseRecord(`animation-start`,e),options:n?{...t,...n}:t})}catch{}}function notifyLayoutAnimationStart(e,t){let n=globalThis.__MOTION_INSPECT__;if(n)try{n({...baseRecord(`layout-animation-start`,e),node:t})}catch{}}var WithPromise=class{constructor(){this.isResolved=!1}get finished(){return this._finished||=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e}),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}};let percentToProgress=e=>e/100;var JSAnimation=class extends WithPromise{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==dt.now()&&this.tick(dt.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),notifyAnimationStart(this,this.options)}initAnimation(){let{options:e}=this;replaceTransitionType(e);let{type:t=keyframes,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||keyframes;s!==keyframes&&typeof o[0]!=`number`&&(this.mixKeyframes=pipe(percentToProgress,mix(o[0],o[1])),o=[0,100]);let c=s(o===e.keyframes?e:{...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=calcGeneratorDuration(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:p,type:m,onUpdate:h,finalKeyframe:g}=this.options;this.startTime===this.pendingStartTime&&(this.startTime=resolveStartTime(this.startTime,e)),this.pendingStartTime=void 0,this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let _=this.currentTime-c*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?_<0:_>r;this.currentTime=Math.max(_,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let b=this.currentTime,x=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,p&&(n-=p/o)):d===`mirror`&&(x=a)),b=clamp$1(0,1,n)*o}let S;v?(this.delayState.value=l[0],S=this.delayState):S=x.next(b),i&&!v&&(S.value=i(S.value));let{done:C}=S;!v&&s!==null&&(C=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let w=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&C);return w&&m!==inertia&&(S.value=getFinalKeyframe(l,this.options,g,this.speed)),h&&h(S.value),w&&this.finish(),S}then(e,t){return this.finished.then(e,t)}get duration(){return millisecondsToSeconds(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+millisecondsToSeconds(e)}get time(){return millisecondsToSeconds(this.currentTime)}set time(e){e=secondsToMilliseconds(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return calcGeneratorVelocity(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(dt.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=millisecondsToSeconds(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=frameloopDriver,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??(this.pendingStartTime=n):this.startTime=n-this.holdTime/(this.playbackSpeed||1),this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(dt.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};let Kt=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function applyDefaultFilter(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(vt)||[];if(!r)return e;let i=n.replace(r,``),a=Kt.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}let qt=/\b([a-z-]*)\(.*?\)/gu,Jt={...It,getAnimatableNone:e=>{let t=e.match(qt);return t?t.map(applyDefaultFilter).join(` `):e}},Yt={...It,getAnimatableNone:e=>{let t=It.parse(e);return It.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Xt={...ht,transform:Math.round},Zt={borderWidth:G,borderTopWidth:G,borderRightWidth:G,borderBottomWidth:G,borderLeftWidth:G,borderRadius:G,borderTopLeftRadius:G,borderTopRightRadius:G,borderBottomRightRadius:G,borderBottomLeftRadius:G,width:G,maxWidth:G,height:G,maxHeight:G,top:G,right:G,bottom:G,left:G,inset:G,insetBlock:G,insetBlockStart:G,insetBlockEnd:G,insetInline:G,insetInlineStart:G,insetInlineEnd:G,padding:G,paddingTop:G,paddingRight:G,paddingBottom:G,paddingLeft:G,paddingBlock:G,paddingBlockStart:G,paddingBlockEnd:G,paddingInline:G,paddingInlineStart:G,paddingInlineEnd:G,margin:G,marginTop:G,marginRight:G,marginBottom:G,marginLeft:G,marginBlock:G,marginBlockStart:G,marginBlockEnd:G,marginInline:G,marginInlineStart:G,marginInlineEnd:G,fontSize:G,backgroundPositionX:G,backgroundPositionY:G,rotate:Ct,pathRotation:Ct,rotateX:Ct,rotateY:Ct,rotateZ:Ct,scale:_t,scaleX:_t,scaleY:_t,scaleZ:_t,skew:Ct,skewX:Ct,skewY:Ct,distance:G,translateX:G,translateY:G,translateZ:G,x:G,y:G,z:G,perspective:G,transformPerspective:G,opacity:gt,originX:Dt,originY:Dt,originZ:G,zIndex:Xt,fillOpacity:gt,strokeOpacity:gt,numOctaves:Xt},Qt={...Zt,color:kt,backgroundColor:kt,outlineColor:kt,fill:kt,stroke:kt,borderColor:kt,borderTopColor:kt,borderRightColor:kt,borderBottomColor:kt,borderLeftColor:kt,filter:Jt,WebkitFilter:Jt,mask:Yt,WebkitMask:Yt},getDefaultValueType=e=>Qt[e],$t=new Set([Jt,Yt]);function getAnimatableNone(e,t){let n=getDefaultValueType(e);return $t.has(n)||(n=It),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function fillWildcards(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}let radToDeg=e=>e*180/Math.PI,rotate=e=>rebaseAngle(radToDeg(Math.atan2(e[1],e[0]))),en={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate,rotateZ:rotate,skewX:e=>radToDeg(Math.atan(e[1])),skewY:e=>radToDeg(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},rebaseAngle=e=>(e%=360,e<0&&(e+=360),e),$=rotate,scaleX=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),scaleY=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),tn={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX,scaleY,scale:e=>(scaleX(e)+scaleY(e))/2,rotateX:e=>rebaseAngle(radToDeg(Math.atan2(e[6],e[5]))),rotateY:e=>rebaseAngle(radToDeg(Math.atan2(-e[2],e[0]))),rotateZ:$,rotate:$,skewX:e=>radToDeg(Math.atan(e[4])),skewY:e=>radToDeg(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function defaultTransformValue(e){return e.includes(`scale`)?1:0}function parseValueFromTransform(e,t){if(!e||e===`none`)return defaultTransformValue(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=tn,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=en,i=t}if(!i)return defaultTransformValue(t);let a=r[t],o=i[1].split(`,`).map(convertTransformToNumber);return typeof a==`function`?a(o):o[a]}let readTransformValue=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return parseValueFromTransform(n,t)};function convertTransformToNumber(e){return parseFloat(e.trim())}let nn=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],rn=(()=>new Set([...nn,`pathRotation`]))(),isNumOrPxType=e=>e===ht||e===G,an=new Set([`x`,`y`,`z`]),on=nn.filter(e=>!an.has(e));function removeNonTranslationalTransform(e){let t=[];return on.forEach(n=>{let r=e.getValue(n);if(r!==void 0){let e=r.get(),i=n.startsWith(`scale`)?1:0;if(e===i)return;t.push([n,e]),r.set(i)}}),t}let sn=new Set([`bottom`,`right`]);function measureDimension(e,t,n,r,i,a){let o=parseFloat(e);if(!isNaN(o))return o;let{min:s,max:c}=t()[n],l=c-s;return a===`border-box`?l:l-parseFloat(r)-parseFloat(i)}let cn={width:({width:e,paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r},i)=>measureDimension(e,i,`x`,t,n,r),height:({height:e,paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r},i)=>measureDimension(e,i,`y`,t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{let{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{let{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:({transform:e})=>parseValueFromTransform(e,`x`),y:({transform:e})=>parseValueFromTransform(e,`y`)};cn.translateX=cn.x,cn.translateY=cn.y;let ln=new Set,un=!1,dn=!1,fn=!1;function measureAllKeyframes(){if(dn){let e=[],t=new Set,n=new Set;ln.forEach(r=>{r.needsMeasurement&&(e.push(r),t.add(r.element),sn.has(r.name)&&n.add(r.element))});let r=new Map;n.forEach(e=>{let t=removeNonTranslationalTransform(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}dn=!1,un=!1,ln.forEach(e=>e.complete(fn)),ln.clear()}function readAllKeyframes(){ln.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(dn=!0)})}function flushKeyframeResolvers(){fn=!0,readAllKeyframes(),measureAllKeyframes(),fn=!1}function readOrigin(e,t,n){if(typeof e==`string`){if(isNumericalString(e)||isZeroValueString(e))return parseFloat(e);if(!It.test(e)&&It.test(n))return getAnimatableNone(t,n)}return e??void 0}var KeyframeResolver=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(ln.add(this),un||(un=!0,q.read(readAllKeyframes),q.resolveKeyframes(measureAllKeyframes))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=readOrigin(n.readValue(t,a),t,a);r!==void 0&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}fillWildcards(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ln.delete(this)}cancel(){this.state===`scheduled`&&(ln.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}};let isCSSVar=e=>e.startsWith(`--`);function setStyle(e,t,n){isCSSVar(t)?e.style.setProperty(t,n):e.style[t]=n}let pn={};function memoSupports(e,t){let n=memo(e);return()=>pn[t]??n()}let mn=memoSupports(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),hn=memoSupports(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),cubicBezierAsString=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,gn={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasing(e,t){if(e)return typeof e==`function`?hn()?generateLinearEasing(e,t):`ease-out`:isBezierDefinition(e)?cubicBezierAsString(e):Array.isArray(e)?e.map(e=>mapEasingToNativeEasing(e,t)||gn.easeOut):gn[e]}function startWaapiAnimation(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=mapEasingToNativeEasing(s,i);Array.isArray(d)&&(u.easing=d);let p={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(p.pseudoElement=l),e.animate(u,p)}function isGenerator(e){return typeof e==`function`&&`applyToOptions`in e}function applyGeneratorOptions({type:e,...t}){return isGenerator(e)&&hn()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var NativeAnimation=class extends WithPromise{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=applyGeneratorOptions(e);this.animation=startWaapiAnimation(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=getFinalKeyframe(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),setStyle(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()},notifyAnimationStart(this,e,c)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return millisecondsToSeconds(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+millisecondsToSeconds(e)}get time(){return millisecondsToSeconds(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=secondsToMilliseconds(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&mn()?(this.animation.timeline=e,t?.(this.animation),noop):n(this)}};let _n={anticipate,backInOut:nt,circInOut:it};function isUnsupportedEase(e){return e in _n}function replaceStringEasing(e){typeof e.ease==`string`&&isUnsupportedEase(e.ease)&&(e.ease=_n[e.ease])}var NativeAnimationExtended=class extends NativeAnimation{constructor(e){replaceStringEasing(e),replaceTransitionType(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new JSAnimation({...a,autoplay:!1}),s=Math.max(10,dt.now()-this.startTime),c=clamp$1(0,10,s-10),l=o.sample(s).value,{name:u}=this.options;i&&u&&setStyle(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}};let isAnimatable=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(It.test(e)||e===`0`)&&!e.startsWith(`url(`));function hasKeyframesChanged(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function canAnimate(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=isAnimatable(i,t),s=isAnimatable(a,t);return!o||!s?(o!==s&&`${t}${i}${a}${o?a:i}`,!1):hasKeyframesChanged(e)||(n===`spring`||isGenerator(n))&&r}function makeAnimationInstant(e){e.duration=0,e.type=`keyframes`}let vn=new Set([`opacity`,`clipPath`,`filter`,`transform`,`backgroundColor`]),yn=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function hasBrowserOnlyColors(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&yn.test(e[t]))return!0;return!1}let bn=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),xn=memo(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function supportsBrowserAnimation(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!n||!(vn.has(n)||bn.has(n)))return!1;let c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return xn()&&(vn.has(n)||bn.has(n)&&hasBrowserOnlyColors(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var AsyncMotionValueAnimation=class extends WithPromise{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=dt.now();let{keyframes:t,name:n,motionValue:r,element:i}=e,a=e;a.autoplay??=!0,a.delay??=0,a.type??=`keyframes`,a.repeat??=0,a.repeatDelay??=0,a.repeatType??=`loop`,this.keyframeResolver=new(i?.KeyframeResolver||KeyframeResolver)(t,(e,t,n)=>this.onKeyframesResolved(e,t,a,!n),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=dt.now();let u=!0;canAnimate(e,i,a,o)||(u=!1,(Qe.instantAnimations||!s)&&l?.(getFinalKeyframe(e,n,t)),e[0]=e[e.length-1],makeAnimationInstant(n),n.repeat=0);let{onComplete:d}=n;n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{d?.(),this.notifyFinished()};let p=u&&!c&&supportsBrowserAnimation(n);r&&(p||this.resolvedAt!==this.createdAt)&&(n.startTime??=resolveStartTime(this.createdAt,this.resolvedAt));let m;if(p){n.element=n.motionValue?.owner?.current;try{m=new NativeAnimationExtended(n)}catch{m=new JSAnimation(n)}}else m=new JSAnimation(n);this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),flushKeyframeResolvers()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function calcChildStagger(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}let isFloat=e=>!isNaN(parseFloat(e)),Sn={current:void 0};var MotionValue=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=dt.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=dt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=isFloat(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){var n;return e===`change`?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new SubscriptionManager)).add(t)}onChangeSubscribe(e){let{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new SubscriptionManager,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){q.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){for(let e in this.changeSubscriber=void 0,this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){let{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Sn.current&&Sn.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=dt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>30)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return velocityPerSecond(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&this.clearAnimation(),t()}),n||(this.animation=r),this.events.animationStart?.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function motionValue(e,t){return new MotionValue(e,t)}function resolveTransition(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function getValueTransition(e,t){let n=e?.[t]??e?.default??e;return n===e?n:resolveTransition(n,e)}let Cn={type:`spring`,stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),wn={type:`keyframes`,duration:.8},Tn={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(e,{keyframes:t})=>t.length>2?wn:rn.has(e)?e.startsWith(`scale`)?criticallyDampedSpring(t[1]):Cn:Tn,En=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function isTransitionDefined(e){for(let t in e)if(!En.has(t))return!0;return!1}let animateMotionValue=(e,t,n,r={},i,a)=>o=>{let s=getValueTransition(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=secondsToMilliseconds(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};isTransitionDefined(s)||Object.assign(u,getDefaultTransition(e,u)),u.duration&&=secondsToMilliseconds(u.duration),u.repeatDelay&&=secondsToMilliseconds(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(makeAnimationInstant(u),u.delay===0&&(d=!0)),(Qe.instantAnimations||Qe.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,makeAnimationInstant(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=getFinalKeyframe(u.keyframes,s);if(e!==void 0){q.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new JSAnimation(u):new AsyncMotionValueAnimation(u)},Dn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(e){let t=Dn.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function getVariableValue(e,t,n=1){`${e}`;let[r,i]=parseCSSVariable(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return isNumericalString(e)?parseFloat(e):e}return isCSSVariableToken(i)?getVariableValue(i,t,n+1):i}function getValueState(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function resolveVariantFromProps(e,t,n,r){let resolveFunction=t=>typeof t==`function`?t(n===void 0?e.custom:n,...getValueState(r)):t;return t=resolveFunction(t),typeof t==`string`&&(t=e.variants&&e.variants[t]),resolveFunction(t)}function resolveVariant(e,t,n){return resolveVariantFromProps(e.getProps(),t,n,e)}let getTypeCustom=(e,t)=>t===`exit`?e.presenceContext?.custom:void 0,On=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...nn]),isKeyframesTarget=e=>Array.isArray(e);function setMotionValue(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,motionValue(n))}function resolveFinalValueInKeyframes(e){return isKeyframesTarget(e)?e[e.length-1]||0:e}function setTarget(e,t){let{transitionEnd:n={},transition:r={},...i}=resolveVariant(e,t)||{};for(let t in i={...i,...n},i)setMotionValue(e,t,resolveFinalValueInKeyframes(i[t]))}let isMotionValue=e=>!!(e&&e.getVelocity);function isWillChangeMotionValue(e){return!!(isMotionValue(e)&&e.add)}function addValueToWillChange(e,t){let n=e.getValue(`willChange`);if(isWillChangeMotionValue(n))return n.add(t);if(!n&&Qe.WillChange){let n=new Qe.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function camelToDash(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let kn=`data-`+camelToDash(`framerAppearId`);function getOptimisedAppearId(e){return e.props[kn]}let An=typeof window<`u`;function shouldBlockAnimation({protectedKeys:e,needsAnimating:t},n){let r=n in e&&!t[n];return t[n]=!1,r}function animateTarget(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?resolveTransition(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],p=i&&e.animationState?.getState()[i],m=a?.path;for(let t in m&&m.animateVisualElement(e,s,a,n,d),s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||p&&shouldBlockAnimation(p,t))continue;let o={delay:n,...getValueTransition(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){q.update(()=>r.set(i));continue}let m=!1;if(An&&window.MotionHandoffAnimation){let n=getOptimisedAppearId(e);if(n){let e=window.MotionHandoffAnimation(n,t,q);e!==null&&(o.startTime=e,m=!0)}}addValueToWillChange(e,t);let h=l??e.shouldReduceMotion;r.start(animateMotionValue(t,r,i,h&&On.has(t)?{type:!1}:o,e,m));let g=r.animation;g&&d.push(g)}if(o){let applyTransitionEnd=()=>q.update(()=>{o&&setTarget(e,o)});d.length?Promise.all(d).then(applyTransitionEnd):applyTransitionEnd()}return d}function animateVariant(e,t,n={}){let r=resolveVariant(e,t,getTypeCustom(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),getAnimation=()=>Promise.all(r?animateTarget(e,r,n):[]),getChildAnimations=(r=0)=>{let{variantChildren:a}=e,{delayChildren:o=0,staggerChildren:s,staggerDirection:c}=i,l=[];return a?.forEach(e=>{e.notify(`AnimationStart`,t),l.push(animateVariant(e,t,{...n,delay:r+(typeof o==`function`?0:o)+calcChildStagger(a,e,o,s,c)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(l)},{when:a}=i;return a?a===`beforeChildren`?getAnimation().then(()=>getChildAnimations()):getChildAnimations().then(getAnimation):Promise.all([getAnimation(),getChildAnimations(n.delay)])}function animateVisualElement(e,t,n={}){return e.notify(`AnimationStart`,t),(Array.isArray(t)?Promise.all(t.map(t=>animateVariant(e,t,n))):typeof t==`string`?animateVariant(e,t,n):Promise.all(animateTarget(e,resolveVariant(e,t,n.custom),n))).then(()=>{e.notify(`AnimationComplete`,t)})}let jn={test:e=>e===`auto`,parse:e=>e},testValueType=e=>t=>t.test(e),Mn=[ht,G,wt,Ct,Et,Tt,jn],findDimensionValueType=e=>Mn.find(testValueType(e));function isNone(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||isZeroValueString(e)}let Nn=new Set([`auto`,`none`,`0`]);function makeNoneKeyframesAnimatable(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Nn.has(t)&&hasComplexValues(t)&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]!==i&&(e[r]=getAnimatableNone(n,i))}var DOMKeyframesResolver=class extends KeyframeResolver{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),isCSSVariableToken(r))){let i=getVariableValue(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!On.has(n)||e.length!==2)return;let[r,i]=e;if(typeof r==`number`&&typeof i==`number`)return;let a=findDimensionValueType(r),o=findDimensionValueType(i);if(containsCSSVariable(r)!==containsCSSVariable(i)&&cn[n]){this.needsMeasurement=!0;return}if(a!==o)if(isNumOrPxType(a)&&isNumOrPxType(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else cn[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||isNone(e[t]))&&n.push(t);n.length&&makeNoneKeyframesAnimatable(e,n,t)}measure(){let{element:e,name:t}=this;return cn[t](window.getComputedStyle(e.current),()=>e.measureViewportBox())}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){let{element:e,unresolvedKeyframes:t}=this;if(!e||!e.current)return;this.motionValue?.jump(this.measuredOrigin,!1);let n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};let Pn=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function isHTMLElement(e){return isObject(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}function isSVGElement(e){return isObject(e)&&`ownerSVGElement`in e}let getValueAsType=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function resolveElements(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}let Fn={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},In=nn.length;function buildTransform(e,t,n){let r=``,i=!0;for(let a=0;a<In;a++){let o=nn[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===(o.startsWith(`scale`)?1:0);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=getValueAsType(s,Zt[o]);if(!c){i=!1;let t=Fn[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${getValueAsType(a,Zt.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function buildHTMLStyles(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(rn.has(e)){o=!0;continue}else if(ft(e)){i[e]=n;continue}else{let t=getValueAsType(n,Zt[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=buildTransform(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}let Ln={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Rn={offset:`strokeDashoffset`,array:`strokeDasharray`};function buildSVGPath(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Ln:Rn;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}let zn=[`transform`,`opacity`,`clipPath`,`filter`,`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function buildSVGAttrs(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(buildHTMLStyles(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:p}=e;for(let e of zn)d[e]!==void 0&&(p[e]=d[e],delete d[e]);(p.transform||d.transformOrigin)&&(p.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),p.transform&&(p.transformBox=u?.transformBox??`fill-box`,delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&buildSVGPath(d,i,a,o,!1)}function convertBoundingBoxToBox({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function convertBoxToBoundingBox({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function transformBoxPoints(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function isIdentityScale(e){return e===void 0||e===1}function hasScale({scale:e,scaleX:t,scaleY:n}){return!isIdentityScale(e)||!isIdentityScale(t)||!isIdentityScale(n)}function hasTransform(e){return hasScale(e)||has2DTranslate(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function has2DTranslate(e){return is2DTranslate(e.x)||is2DTranslate(e.y)}function is2DTranslate(e){return e&&e!==`0%`}function scalePoint(e,t,n){return n+t*(e-n)}function applyPointDelta(e,t,n,r,i){return i!==void 0&&(e=scalePoint(e,i,r)),scalePoint(e,n,r)+t}function applyAxisDelta(e,t=0,n=1,r,i){e.min=applyPointDelta(e.min,t,n,r,i),e.max=applyPointDelta(e.max,t,n,r,i)}function applyBoxDelta(e,{x:t,y:n}){applyAxisDelta(e.x,t.translate,t.scale,t.originPoint),applyAxisDelta(e.y,n.translate,n.scale,n.originPoint)}let Bn=.999999999999,Vn=1.0000000000001;function applyTreeDeltas(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(translateAxis(e.x,-a.scroll.offset.x),translateAxis(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,applyBoxDelta(e,o)),r&&hasTransform(a.latestValues)&&transformBox(e,a.latestValues,a.layout?.layoutBox))}t.x<Vn&&t.x>Bn&&(t.x=1),t.y<Vn&&t.y>Bn&&(t.y=1)}function translateAxis(e,t){e.min+=t,e.max+=t}function transformAxis(e,t,n,r,i=.5){applyAxisDelta(e,t,n,mixNumber(e.min,e.max,i),r)}function resolveAxisTranslate(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function transformBox(e,t,n){let r=n??e;transformAxis(e.x,resolveAxisTranslate(t.x,r.x),t.scaleX,t.scale,t.originX),transformAxis(e.y,resolveAxisTranslate(t.y,r.y),t.scaleY,t.scale,t.originY)}function measureViewportBox(e,t){return convertBoundingBoxToBox(transformBoxPoints(e.getBoundingClientRect(),t))}function measurePageBox(e,t,n){let r=measureViewportBox(e,n),{scroll:i}=t;return i&&(translateAxis(r.x,i.offset.x),translateAxis(r.y,i.offset.y)),r}let{schedule:Hn,cancel:Un}=createRenderBatcher(queueMicrotask,!1),Wn={x:!1,y:!1};function isDragActive(){return Wn.x||Wn.y}function setDragLock(e){return e===`x`||e===`y`?Wn[e]?null:(Wn[e]=!0,()=>{Wn[e]=!1}):Wn.x||Wn.y?null:(Wn.x=Wn.y=!0,()=>{Wn.x=Wn.y=!1})}function setupGesture(e,t){let n=resolveElements(e),r=new AbortController,i={passive:!0,...t,signal:r.signal},cancel=()=>r.abort();return[n,i,cancel]}function isValidHover(e){return!(e.pointerType===`touch`||isDragActive())}function hover(e,t,n={}){let[r,i,a]=setupGesture(e,n);return r.forEach(e=>{let n=!1,r=!1,a,removePointerLeave=()=>{e.removeEventListener(`pointerleave`,onPointerLeave)},endHover=e=>{a&&=(a(e),void 0),removePointerLeave()},onPointerUp=e=>{n=!1,window.removeEventListener(`pointerup`,onPointerUp),window.removeEventListener(`pointercancel`,onPointerUp),r&&(r=!1,endHover(e))},onPointerDown=()=>{n=!0,window.addEventListener(`pointerup`,onPointerUp,i),window.addEventListener(`pointercancel`,onPointerUp,i)},onPointerLeave=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}endHover(e)}},onPointerEnter=n=>{if(!isValidHover(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,onPointerLeave,i))};e.addEventListener(`pointerenter`,onPointerEnter,i),e.addEventListener(`pointerdown`,onPointerDown,i)}),a}let isNodeOrChild=(e,t)=>t?e===t?!0:isNodeOrChild(e,t.parentElement):!1,isPrimaryPointer=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Gn=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function isElementKeyboardAccessible(e){return Gn.has(e.tagName)||e.isContentEditable===!0}let Kn=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function isElementTextInput(e){return Kn.has(e.tagName)||e.isContentEditable===!0}let qn=new WeakSet;function filterEvents(e){return t=>{t.key===`Enter`&&e(t)}}function firePointerEvent(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}let enableKeyboardPress=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=filterEvents(()=>{if(qn.has(n))return;firePointerEvent(n,`down`);let e=filterEvents(()=>{firePointerEvent(n,`up`)}),handleBlur=()=>firePointerEvent(n,`cancel`);n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,handleBlur,t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function isValidPressEvent(e){return isPrimaryPointer(e)&&!isDragActive()}let Jn=new WeakSet;function press(e,t,n={}){let[r,i,a]=setupGesture(e,n),startPress=e=>{let r=e.currentTarget;if(!isValidPressEvent(e)||Jn.has(e))return;qn.add(r),n.stopPropagation&&Jn.add(e);let a=t(r,e),o={...i,capture:!0},onPointerEnd=(e,t)=>{window.removeEventListener(`pointerup`,onPointerUp,o),window.removeEventListener(`pointercancel`,onPointerCancel,o),qn.has(r)&&qn.delete(r),isValidPressEvent(e)&&typeof a==`function`&&a(e,{success:t})},onPointerUp=e=>{onPointerEnd(e,r===window||r===document||n.useGlobalTarget||isNodeOrChild(r,e.target))},onPointerCancel=e=>{onPointerEnd(e,!1)};window.addEventListener(`pointerup`,onPointerUp,o),window.addEventListener(`pointercancel`,onPointerCancel,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,startPress,i),isHTMLElement(e)&&(e.addEventListener(`focus`,e=>enableKeyboardPress(e,i)),!isElementKeyboardAccessible(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}let Yn=new WeakMap,Xn,getSize=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:isSVGElement(r)&&`getBBox`in r?r.getBBox()[t]:r[n],Zn=getSize(`inline`,`width`,`offsetWidth`),Qn=getSize(`block`,`height`,`offsetHeight`);function notifyTarget({target:e,borderBoxSize:t}){Yn.get(e)?.forEach(n=>{n(e,{get width(){return Zn(e,t)},get height(){return Qn(e,t)}})})}function notifyAll(e){e.forEach(notifyTarget)}function createResizeObserver(){typeof ResizeObserver>`u`||(Xn=new ResizeObserver(notifyAll))}function resizeElement(e,t){Xn||createResizeObserver();let n=resolveElements(e);return n.forEach(e=>{let n=Yn.get(e);n||(n=new Set,Yn.set(e,n)),n.add(t),Xn?.observe(e)}),()=>{n.forEach(e=>{let n=Yn.get(e);n?.delete(t),n?.size||Xn?.unobserve(e)})}}let $n=new Set,windowResizeHandler;function createWindowResizeHandler(){windowResizeHandler=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};$n.forEach(t=>t(e))},window.addEventListener(`resize`,windowResizeHandler)}function resizeWindow(e){return $n.add(e),windowResizeHandler||createWindowResizeHandler(),()=>{$n.delete(e),!$n.size&&typeof windowResizeHandler==`function`&&(window.removeEventListener(`resize`,windowResizeHandler),windowResizeHandler=void 0)}}function resize(e,t){return typeof e==`function`?resizeWindow(e):resizeElement(e,t)}let er={value:null,addProjectionMetrics:null};function isSVGSVGElement(e){return isSVGElement(e)&&e.tagName===`svg`}let asNumber=e=>typeof e==`number`?e:parseFloat(e),createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()}),tr=new WeakMap;function isAnimationControls(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function isVariantLabel(e){return typeof e==`string`||Array.isArray(e)}let nr=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],rr=[`initial`,...nr];function isControllingVariants(e){if(isAnimationControls(e.animate))return!0;for(let t=0;t<rr.length;t++)if(isVariantLabel(e[rr[t]]))return!0;return!1}function isVariantNode(e){return!!(isControllingVariants(e)||e.variants)}function updateMotionValuesFromProps(e,t,n){for(let r in t){let i=t[r],a=n[r];if(isMotionValue(i))e.addValue(r,i);else if(isMotionValue(a))e.addValue(r,motionValue(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,motionValue(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}let ir={current:null},ar={current:!1},or=typeof window<`u`;function initPrefersReducedMotion(){if(ar.current=!0,or)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),setReducedMotionPreferences=()=>ir.current=e.matches;e.addEventListener(`change`,setReducedMotionPreferences),setReducedMotionPreferences()}else ir.current=!1}let sr=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],cr={};function setFeatureDefinitions(e){cr=e}function getFeatureDefinitions(){return cr}var VisualElement=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=KeyframeResolver,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=dt.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,q.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=isControllingVariants(t),this.isVariantNode=isVariantNode(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&isMotionValue(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];if(this.current=e,tr.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.isVariantNode&&!this.isControllingVariants){let e=this;do e=e.props.inherit!==!1&&e.parent;while(e&&!e.isVariantNode);if(e){let{variantChildren:t}=e;t.add(this),this.removeFromVariantTree=()=>t.delete(this)}}this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(ar.current||initPrefersReducedMotion(),this.shouldReduceMotion=ir.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){for(let e in this.projection&&this.projection.unmount(),Vt(this.notifyUpdate),Vt(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&vn.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new NativeAnimation({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:secondsToMilliseconds(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=rn.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&q.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in cr){let t=cr[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<sr.length;t++){let n=sr[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=updateMotionValuesFromProps(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(e,t){let n=this.values.get(e);if(t!==n){n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t);let r=t.get();r!==void 0&&(this.latestValues[e]=r)}}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=motionValue(t??this.getDefaultValue?.(e),{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(isNumericalString(n)||isZeroValueString(n))?n=parseFloat(n):typeof n!=`number`&&!It.test(n)&&It.test(t)&&(n=getAnimatableNone(e,t)),this.setBaseTarget(e,isMotionValue(n)?n.get():n)),isMotionValue(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}on(e,t){return this.events[e]||(this.events[e]=new SubscriptionManager),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Hn.render(this.render)}},DOMVisualElement=class extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;isMotionValue(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Feature=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function renderHTML(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}let lr={};function isForcedMotionValue(e,{layout:t,layoutId:n}){return rn.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!lr[e]||e===`opacity`)}function scrapeMotionValuesFromProps$1(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(isMotionValue(r[t])||i&&isMotionValue(i[t])||isForcedMotionValue(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}__name(scrapeMotionValuesFromProps$1,`scrapeMotionValuesFromProps`);function getComputedStyle$1(e){return window.getComputedStyle(e)}__name(getComputedStyle$1,`getComputedStyle`);var HTMLVisualElement=class extends DOMVisualElement{constructor(){super(...arguments),this.type=`html`,this.renderInstance=renderHTML}mount(e){e.style,super.mount(e)}readValueFromInstance(e,t){if(rn.has(t))return this.projection?.isProjecting?defaultTransformValue(t):readTransformValue(e,t);{let n=getComputedStyle$1(e),r=(ft(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return measureViewportBox(e,t)}build(e,t,n){buildHTMLStyles(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return scrapeMotionValuesFromProps$1(e,t,n)}};let ur=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),isSVGTag=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function renderSVG(e,t,n,r){for(let n in renderHTML(e,t,void 0,r),t.attrs)e.setAttribute(ur.has(n)?n:camelToDash(n),t.attrs[n])}function scrapeMotionValuesFromProps(e,t,n){let r=scrapeMotionValuesFromProps$1(e,t,n);for(let n in e)if(isMotionValue(e[n])||isMotionValue(t[n])){let t=nn.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var SVGVisualElement=class extends DOMVisualElement{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=createBox}getBaseTargetFromProps(e,t){return rn.has(t)?super.getBaseTargetFromProps(e,t)??defaultTransformValue(t):e[t]}getDefaultValue(e){return rn.has(e)?this.latestValues[e]??defaultTransformValue(e):void 0}readValueFromInstance(e,t){if(rn.has(t)){let e=getDefaultValueType(t);return e&&e.default||0}if(zn.includes(t)){let n=getComputedStyle(e)[t];if(typeof n==`string`&&n)return n.trim()}return t=ur.has(t)?t:camelToDash(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return scrapeMotionValuesFromProps(e,t,n)}build(e,t,n){buildSVGAttrs(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){renderSVG(e,t,n,r)}mount(e){this.isSVGTag=isSVGTag(e.tagName),super.mount(e)}};function shallowCompare(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}let dr=[...nr].reverse();function createAnimationState(e){let animate=t=>Promise.all(t.map(({animation:t,options:n})=>animateVisualElement(e,t,n))),t=createState(),n=!0,r=!1;function animateChanges(i){let{props:a,parent:o,manuallyAnimateOnMount:s}=e,c=n||r,l=[],u=new Set,d={},p=1/0,m=e;do m=m.props.inherit!==!1&&m.parent;while(m&&!m.isControllingVariants);if(dr.forEach((n,r)=>{let h=t[n],g=a[n],_=m&&m.props[n],v=g===void 0?isVariantLabel(_)||_===!1?_:void 0:g,b=isVariantLabel(v),x=n===i?h.isActive:null;x===!1&&(p=r);let S=b&&g===void 0&&!(c&&s);if(h.protectedKeys={...d},!h.isActive&&x===null||!v&&!h.prevProp||isAnimationControls(v)||typeof v==`boolean`)return;if(n===`exit`&&h.isActive&&x!==!0){d={...d,...h.prevResolvedValues};return}let C=checkVariantsDidChange(h.prevProp,v),w=C||b&&(x&&!S||r>p),E=!1,D=Array.isArray(v)?v:[v],k={};if(x!==!1)for(let t of D){let{transition:r,transitionEnd:i,...a}=resolveVariant(e,t,getTypeCustom(e,n))||{};k={...k,...a,...i}}let{prevResolvedValues:A}=h;for(let t in{...A,...k}){if(t in d)continue;let n=k[t],r=A[t],i=Array.isArray(n)&&Array.isArray(r)?!shallowCompare(n,r)||C:n!==r;if(i&&n==null)u.add(t);else if(i||n!==void 0&&u.has(t)){w=!0,u.delete(t)&&(E=!0),h.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)}else h.protectedKeys[t]=!0}if(h.prevProp=v,h.prevResolvedValues=k,h.isActive&&(d={...d,...k}),w&&(!(S&&C)||E))for(let t of D){let r={type:n};if(typeof t==`string`&&c&&s&&o?.enteringChildren){let n=resolveVariant(o,t)?.transition?.delayChildren;r.delay=calcChildStagger(o.enteringChildren,e,n)}l.push({animation:t,options:r})}}),u.size){let{initial:t}=a,n={},r=typeof t!=`boolean`&&resolveVariant(e,Array.isArray(t)?t[0]:t,e.presenceContext?.custom);r&&r.transition&&(n.transition=r.transition),u.forEach(i=>{let o=e.getValue(i);o&&(o.liveStyle=!0);let s=r&&!Array.isArray(t)?r[i]:void 0,c=e.getBaseTargetFromProps(a,i);n[i]=(s===void 0?c!==void 0&&!isMotionValue(c)?c:e.initialValues[i]===void 0?e.baseTarget[i]:void 0:s)??null}),l.push({animation:n})}let h=c&&e.blockInitialAnimation||n&&!s&&(a.initial===!1||a.initial===a.animate);return n=r=!1,!h&&l.length?animate(l):Promise.resolve()}function setActive(n,r){if(t[n].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(n,r)),t[n].isActive=r;let i=animateChanges(n);for(let e in t)t[e].protectedKeys={};return i}return{animateChanges,setActive,setAnimateFunction:t=>{animate=t(e)},getState:()=>t,reset:()=>{t=createState(),r=!0}}}function checkVariantsDidChange(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!shallowCompare(t,e):!1}function createState(){let e={};for(let t of nr)e[t]={isActive:t===`animate`,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}};return e}function copyAxisInto(e,t){e.min=t.min,e.max=t.max}function copyBoxInto(e,t){copyAxisInto(e.x,t.x),copyAxisInto(e.y,t.y)}function copyAxisDeltaInto(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}let fr=1e-4;1-fr,1+fr;let pr=.01;0-pr,0+pr;function calcLength(e){return e.max-e.min}function isNear(e,t,n){return Math.abs(e-t)<=n}function calcAxisDelta(e,t,n,r=.5){e.origin=r,e.originPoint=mixNumber(t.min,t.max,e.origin),e.scale=calcLength(n)/calcLength(t),e.translate=mixNumber(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function calcBoxDelta(e,t,n,r){calcAxisDelta(e.x,t.x,n.x,r?r.originX:void 0),calcAxisDelta(e.y,t.y,n.y,r?r.originY:void 0)}function calcRelativeAxis(e,t,n,r=0){e.min=(r?mixNumber(n.min,n.max,r):n.min)+t.min,e.max=e.min+calcLength(t)}function calcRelativeBox(e,t,n,r){calcRelativeAxis(e.x,t.x,n.x,r?.x),calcRelativeAxis(e.y,t.y,n.y,r?.y)}function calcRelativeAxisPosition(e,t,n,r=0){let i=r?mixNumber(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+calcLength(t)}function calcRelativePosition(e,t,n,r){calcRelativeAxisPosition(e.x,t.x,n.x,r?.x),calcRelativeAxisPosition(e.y,t.y,n.y,r?.y)}function removePointDelta(e,t,n,r,i){return e-=t,e=scalePoint(e,1/n,r),i!==void 0&&(e=scalePoint(e,1/i,r)),e}function removeAxisDelta(e,t=0,n=1,r=.5,i,a=e,o=e){if(wt.test(t)&&(t=parseFloat(t),t=mixNumber(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=mixNumber(a.min,a.max,r);e===a&&(s-=t),e.min=removePointDelta(e.min,t,n,s,i),e.max=removePointDelta(e.max,t,n,s,i)}function removeAxisTransforms(e,t,[n,r,i],a,o){removeAxisDelta(e,t[n],t[r],t[i],t.scale,a,o)}let mr=[`x`,`scaleX`,`originX`],hr=[`y`,`scaleY`,`originY`];function removeBoxTransforms(e,t,n,r){removeAxisTransforms(e.x,t,mr,n?n.x:void 0,r?r.x:void 0),removeAxisTransforms(e.y,t,hr,n?n.y:void 0,r?r.y:void 0)}function isAxisDeltaZero(e){return e.translate===0&&e.scale===1}function isDeltaZero(e){return isAxisDeltaZero(e.x)&&isAxisDeltaZero(e.y)}function axisEquals(e,t){return e.min===t.min&&e.max===t.max}function boxEquals(e,t){return axisEquals(e.x,t.x)&&axisEquals(e.y,t.y)}function axisEqualsRounded(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function boxEqualsRounded(e,t){return axisEqualsRounded(e.x,t.x)&&axisEqualsRounded(e.y,t.y)}function aspectRatio(e){return calcLength(e.x)/calcLength(e.y)}function axisDeltaEquals(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function eachAxis(e){return[e(`x`),e(`y`)]}function pixelsToPercent(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let gr={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(G.test(e))e=parseFloat(e);else return e;return`${pixelsToPercent(e,t.target.x)}% ${pixelsToPercent(e,t.target.y)}%`}},_r={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=It.parse(e);if(i.length>5)return r;let a=It.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=mixNumber(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}};function buildProjectionTransform(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}let vr=Pn.length,isPx=e=>typeof e==`number`||G.test(e);function mixValues(e,t,n,r,i,a){i?(e.opacity=mixNumber(0,n.opacity??1,yr(r)),e.opacityExit=mixNumber(t.opacity??1,0,br(r))):a&&(e.opacity=mixNumber(t.opacity??1,n.opacity??1,r));for(let i=0;i<vr;i++){let a=Pn[i],o=getRadius(t,a),s=getRadius(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||isPx(o)===isPx(s)?(e[a]=Math.max(mixNumber(asNumber(o),asNumber(s),r),0),(wt.test(s)||wt.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=mixNumber(t.rotate||0,n.rotate||0,r))}function getRadius(e,t){return e[t]===void 0?e.borderRadius:e[t]}let yr=compress(0,.5,rt),br=compress(.5,.95,noop);function compress(e,t,n){return r=>r<e?0:r>t?1:n(progress(e,t,r))}function animateSingleValue(e,t,n){let r=isMotionValue(e)?e:motionValue(e);return r.start(animateMotionValue(``,r,t,n)),r.animation}function addDomEvent(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}let compareByDepth=(e,t)=>e.depth-t.depth;var FlatTree=class{constructor(){this.children=[],this.isDirty=!1}add(e){addUniqueItem(this.children,e),this.isDirty=!0}remove(e){removeItem(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(e)}};function delay$1(e,t){let n=dt.now(),checkElapsed=({timestamp:r})=>{let i=r-n;i>=t&&(Vt(checkElapsed),e(i-t))};return q.setup(checkElapsed,!0),()=>Vt(checkElapsed)}__name(delay$1,`delay`);function resolveMotionValue(e){return isMotionValue(e)?e.get():e}var NodeStack=class{constructor(){this.members=[]}add(e){addUniqueItem(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(removeItem(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(removeItem(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}};let xr={borderRadius:{...gr,applyTo:[...Pn]},borderTopLeftRadius:gr,borderTopRightRadius:gr,borderBottomLeftRadius:gr,borderBottomRightRadius:gr,boxShadow:_r},Sr={hasAnimatedSinceResize:!0,hasEverUpdated:!1};Object.assign(lr,{...xr,...lr});let Cr={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},wr=[``,`X`,`Y`,`Z`],Tr=0;function resetDistortingTransform(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function cancelTreeOptimisedTransformAnimations(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=getOptimisedAppearId(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,q,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&cancelTreeOptimisedTransformAnimations(r)}function createProjectionNode$1({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class ProjectionNode{constructor(e={},n=t?.()){this.id=Tr++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,er.value&&(Cr.nodes=Cr.calculatedTargetDeltas=Cr.calculatedProjections=0),this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),er.addProjectionMetrics&&er.addProjectionMetrics(Cr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new FlatTree)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new SubscriptionManager),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=isSVGElement(t)&&!isSVGSVGElement(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,resizeUnblockUpdate=()=>this.root.updateBlockedByResize=!1;q.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=delay$1(resizeUnblockUpdate,250),Sr.hasAnimatedSinceResize&&(Sr.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isAnimationBlocked){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||Er,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!boxEqualsRounded(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...getValueTransition(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Vt(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(resetSkewAndRotation),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&cancelTreeOptimisedTransformAnimations(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1),t.isAnimationBlocked&&(t.dragSnapshot||=t.measure(),this.dragAncestor=t)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(forceLayoutMeasure),this.nodes.forEach(clearMeasurements);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(clearIsLayoutDirty);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ensureDraggedNodesSnapshotted),this.nodes.forEach(syncRelativeLayout),this.nodes.forEach(resetTransformStyle),this.nodes.forEach(updateLayout),this.nodes.forEach(notifyLayoutUpdate)):this.nodes.forEach(clearIsLayoutDirty),this.clearAllSnapshots();let e=dt.now();lt.delta=clamp$1(0,1e3/60,e-lt.timestamp),lt.timestamp=e,lt.isProcessing=!0,Ht.update.process(lt),Ht.preRender.process(lt),Ht.render.process(lt),lt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Hn.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,q.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){q.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!calcLength(this.snapshot.measuredBox.x)&&!calcLength(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected||=createBox(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!isDeltaZero(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||hasTransform(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),roundBox(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return createBox();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(checkNodeWasScrollRoot))){let{scroll:e}=this.root;e&&(translateAxis(t.x,e.offset.x),translateAxis(t.y,e.offset.y))}return t}removeElementScroll(e){let t=createBox();if(copyBoxInto(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&copyBoxInto(t,e),translateAxis(t.x,i.offset.x),translateAxis(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||createBox();copyBoxInto(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(translateAxis(r.x,-n.scroll.offset.x),translateAxis(r.y,-n.scroll.offset.y)),hasTransform(n.latestValues)&&transformBox(r,n.latestValues,n.layout?.layoutBox)}return hasTransform(this.latestValues)&&transformBox(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=createBox();copyBoxInto(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!hasTransform(n.latestValues))continue;let r;n.instance&&(hasScale(n.latestValues)&&n.updateSnapshot(),r=createBox(),copyBoxInto(r,n.measurePageBox())),removeBoxTransforms(t,n.latestValues,n.snapshot?.layoutBox,r)}return hasTransform(this.latestValues)&&removeBoxTransforms(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==lt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=lt.timestamp;let a=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=createBox(),this.targetWithTransforms=createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):copyBoxInto(this.target,this.layout.layoutBox),applyBoxDelta(this.target,this.targetDelta)):copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),er.value&&Cr.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||hasScale(this.parent.latestValues)||has2DTranslate(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=createBox(),this.relativeTargetOrigin=createBox(),calcRelativePosition(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===lt.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;copyBoxInto(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=createBox());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)),calcBoxDelta(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)||!axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),er.value&&Cr.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=createDelta(),this.projectionDelta=createDelta(),this.projectionDeltaWithTransform=createDelta()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=createDelta();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=createBox(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(hasOpacityCrossfade));this.animationProgress=0;let p,m=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=m?.(n);r?(o.x.translate=r.x,o.x.scale=mixNumber(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=mixNumber(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(mixAxisDeltaLinear(o.x,e.x,n),mixAxisDeltaLinear(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),mixBox(this.relativeTarget,this.relativeTargetOrigin,s,n),p&&boxEquals(this.relativeTarget,p)&&(this.isProjectionDirty=!1),p||=createBox(),copyBoxInto(p,this.relativeTarget)),c&&(this.animationValues=a,mixValues(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(Vt(this.pendingAnimation),void 0),this.pendingAnimation=q.update(()=>{Sr.hasAnimatedSinceResize=!0,this.motionValue||=motionValue(0),this.motionValue.jump(0,!1),this.currentAnimation=animateSingleValue(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),notifyLayoutAnimationStart(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,layout:n,latestValues:r}=e,{target:i}=e;if(!(!t||!i||!n)){if(this!==e&&this.layout&&n&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,n.layoutBox)){i=this.target||createBox();let t=calcLength(this.layout.layoutBox.x);i.x.min=e.target.x.min,i.x.max=i.x.min+t;let n=calcLength(this.layout.layoutBox.y);i.y.min=e.target.y.min,i.y.max=i.y.min+n}copyBoxInto(t,i),transformBox(t,r),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new NodeStack),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&resetDistortingTransform(`z`,e,r,this.animationValues);for(let t=0;t<wr.length;t++)resetDistortingTransform(`rotate${wr[t]}`,e,r,this.animationValues),resetDistortingTransform(`skew${wr[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=resolveMotionValue(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=resolveMotionValue(t?.pointerEvents)||``),this.hasProjected&&!hasTransform(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;for(let t in e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit,lr){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=lr[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?resolveMotionValue(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=this.dragSnapshot=this.dragAncestor=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}__name(createProjectionNode$1,`createProjectionNode`);function updateLayout(e){e.updateLayout(),followDraggedAncestor(e)}function notifyLayoutUpdate(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)eachAxis(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=calcLength(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;copyAxisInto(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else shouldAnimatePositionOnly(i,t.layoutBox,n)&&eachAxis(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=calcLength(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=createDelta();calcBoxDelta(o,n,t.layoutBox);let s=createDelta();a?calcBoxDelta(s,e.applyTransform(r,!0),t.measuredBox):calcBoxDelta(s,n,t.layoutBox);let c=!isDeltaZero(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=createBox();calcRelativePosition(s,t.layoutBox,i.layoutBox,o);let c=createBox();calcRelativePosition(c,n,a.layoutBox,o),boxEqualsRounded(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function propagateDirtyNodes(e){er.value&&Cr.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function cleanDirtyNodes(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function clearSnapshot(e){e.clearSnapshot()}function clearMeasurements(e){e.clearMeasurements()}function forceLayoutMeasure(e){e.isLayoutDirty=!0,e.updateLayout()}function clearIsLayoutDirty(e){e.isLayoutDirty=!1}function followDraggedAncestor(e){let{snapshot:t,dragAncestor:n}=e,r=n?.layout;if(!t||!r||e.resumeFrom||e.isAnimationBlocked)return;let i=n.dragSnapshot;eachAxis(e=>translateAxis(t.layoutBox[e],r.layoutBox[e].min-i.layoutBox[e].min))}function ensureDraggedNodesSnapshotted(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.dragSnapshot||e.layout,e.isLayoutDirty=!0)}function syncRelativeLayout(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function resetTransformStyle(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function finishAnimation(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function resolveTargetDelta(e){e.resolveTargetDelta()}function calcProjection(e){e.calcProjection()}function resetSkewAndRotation(e){e.resetSkewAndRotation()}function removeLeadSnapshots(e){e.removeLeadSnapshot()}function mixAxisDeltaLinear(e,t,n){e.translate=mixNumber(t.translate,0,n),e.scale=mixNumber(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function mixAxis(e,t,n,r){e.min=mixNumber(t.min,n.min,r),e.max=mixNumber(t.max,n.max,r)}function mixBox(e,t,n,r){mixAxis(e.x,t.x,n.x,r),mixAxis(e.y,t.y,n.y,r)}function hasOpacityCrossfade(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}let Er={duration:.45,ease:[.4,0,.1,1]},userAgentContains=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Dr=userAgentContains(`applewebkit/`)&&!userAgentContains(`chrome/`)?Math.round:noop;function roundAxis(e){e.min=Dr(e.min),e.max=Dr(e.max)}function roundBox(e){roundAxis(e.x),roundAxis(e.y)}function shouldAnimatePositionOnly(e,t,n){return e===`position`||e===`preserve-aspect`&&!isNear(aspectRatio(t),aspectRatio(n),.2)}function checkNodeWasScrollRoot(e){return e!==e.root&&e.scroll?.wasRoot}let Or=createProjectionNode$1({attachResizeListener:(e,t)=>addDomEvent(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),kr={current:void 0},Ar=createProjectionNode$1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!kr.current){let e=new Or({});e.mount(window),e.setOptions({layoutScroll:!0}),kr.current=e}return kr.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),jr=(0,l.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function usePresence(e=!0){let t=(0,l.useContext)(Ze);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,l.useId)();(0,l.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,l.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}let Mr=(0,l.createContext)({strict:!1}),Nr={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Pr=!1;function initFeatureDefinitions(){if(Pr)return;let e={};for(let t in Nr)e[t]={isEnabled:e=>Nr[t].some(t=>!!e[t])};setFeatureDefinitions(e),Pr=!0}function getInitializedFeatureDefinitions(){return initFeatureDefinitions(),getFeatureDefinitions()}function loadFeatures(e){let t=getInitializedFeatureDefinitions();for(let n in e)t[n]={...t[n],...e[n]};setFeatureDefinitions(t)}let Fr=(0,l.createContext)({});function getCurrentTreeVariants(e,t){if(isControllingVariants(e)){let{initial:t,animate:n}=e;return{initial:t===!1||isVariantLabel(t)?t:void 0,animate:isVariantLabel(n)?n:void 0}}return e.inherit===!1?{}:t}function useCreateMotionContext(e){let{initial:t,animate:n}=getCurrentTreeVariants(e,(0,l.useContext)(Fr));return(0,l.useMemo)(()=>({initial:t,animate:n}),[variantLabelsAsDependency(t),variantLabelsAsDependency(n)])}function variantLabelsAsDependency(e){return Array.isArray(e)?e.join(` `):e}let createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(e,t,n){for(let r in t)!isMotionValue(t[r])&&!isForcedMotionValue(r,n)&&(e[r]=t[r])}function useInitialMotionValues({transformTemplate:e},t){return(0,l.useMemo)(()=>{let n=createHtmlRenderState();return buildHTMLStyles(n,t,e),Object.assign({},n.vars,n.style)},[t])}function useStyle(e,t){let n=e.style||{},r={};return copyRawValuesOnly(r,n,e),Object.assign(r,useInitialMotionValues(e,t)),r}function useHTMLProps(e,t){let n={},r=useStyle(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}let createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}});function useSVGProps(e,t,n,r){let i=(0,l.useMemo)(()=>{let n=createSvgRenderState();return buildSVGAttrs(n,t,isSVGTag(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};copyRawValuesOnly(t,e.style,e),i.style={...t,...i.style}}return i}let Ir=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function isValidMotionProp(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||Ir.has(e)}function shouldForward(e,t){return e.startsWith(`on`)?!isValidMotionProp(e):t?.(e)??!isValidMotionProp(e)}function filterProps(e,t,n,r){let i={};for(let a in e)a===`values`&&typeof e.values==`object`||isMotionValue(e[a])||(shouldForward(a,r)||n===!0&&isValidMotionProp(a)||!t&&!isValidMotionProp(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a]);return i}let Lr=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function isSVGComponent(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Lr.indexOf(e)>-1||/[A-Z]/u.test(e))}function useRender(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??isSVGComponent(e)?useSVGProps:useHTMLProps)(t,r,i,e),u=filterProps(t,typeof e==`string`,a,s),d=e===l.Fragment?{}:{...u,...c,ref:n},{children:p}=t,m=(0,l.useMemo)(()=>isMotionValue(p)?p.get():p,[p]);return(0,l.createElement)(e,{...d,children:m})}function makeState({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:makeLatestValues(n,r,i,e),renderState:t()}}function makeLatestValues(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=resolveMotionValue(a[e]);let{initial:o,animate:s}=e,c=isControllingVariants(e),l=isVariantNode(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!isAnimationControls(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=resolveVariantFromProps(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}let makeUseVisualState=e=>(t,n)=>{let r=(0,l.useContext)(Fr),i=(0,l.useContext)(Ze),make=()=>makeState(e,t,r,i);return n?make():useConstant(make)},Rr=makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState}),zr=makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState}),Br=Symbol.for(`motionComponentSymbol`);function useMotionRef(e,t,n){let r=(0,l.useRef)(n);(0,l.useInsertionEffect)(()=>{r.current=n});let i=(0,l.useRef)(null);return(0,l.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}let Vr=(0,l.createContext)({});function isRefObject(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function useVisualElement(e,t,n,r,i,a){let{visualElement:o}=(0,l.useContext)(Fr),s=(0,l.useContext)(Mr),c=(0,l.useContext)(Ze),u=(0,l.useContext)(jr),d=u.reducedMotion,p=u.skipAnimations,m=(0,l.useRef)(null),h=(0,l.useRef)(!1);r||=s.renderer,!m.current&&r&&(m.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d,skipAnimations:p,isSVG:a}),h.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));let g=m.current,_=(0,l.useContext)(Vr);g&&!g.projection&&i&&(g.type===`html`||g.type===`svg`)&&createProjectionNode(m.current,n,i,_);let v=(0,l.useRef)(!1);(0,l.useInsertionEffect)(()=>{g&&v.current&&g.update(n,c)});let b=n[kn],x=(0,l.useRef)(!!b&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(b)&&window.MotionHasOptimisedAnimation?.(b));return Ye(()=>{!h.current||!g||(g.animationState?.animateChanges(),g.enteringChildren=void 0)},[]),Ye(()=>{h.current=!0,g&&(v.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),g.scheduleRenderMicrotask(),x.current&&g.animationState&&g.animationState.animateChanges())}),(0,l.useEffect)(()=>{g&&(!x.current&&g.animationState&&g.animationState.animateChanges(),x.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(b)}),!1),g.enteringChildren=void 0)}),g}function createProjectionNode(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:getClosestProjectingNode(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&isRefObject(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function getClosestProjectingNode(e){if(e)return e.options.allowProjection===!1?getClosestProjectingNode(e.parent):e.projection}function createMotionComponent(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&loadFeatures(r);let a=n?n===`svg`:isSVGComponent(e),o=a?zr:Rr;function MotionDOMComponent(n,s){let c,u={...(0,l.useContext)(jr),...n,layoutId:useLayoutId(n)},{isStatic:p,isValidProp:m}=u,h=useCreateMotionContext(n),g=o(n,p);if(!p&&typeof window<`u`){useStrictMode(u,r);let t=getProjectionFunctionality(u);c=t.MeasureLayout,h.visualElement=useVisualElement(e,g,u,i,t.ProjectionNode,a)}return(0,d.jsxs)(Fr.Provider,{value:h,children:[c&&h.visualElement?(0,d.jsx)(c,{visualElement:h.visualElement,...u}):null,useRender(e,n,useMotionRef(g,h.visualElement,s),g,p,t,a,m)]})}MotionDOMComponent.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let s=(0,l.forwardRef)(MotionDOMComponent);return s[Br]=e,s}function useLayoutId({layoutId:e}){let t=(0,l.useContext)(Je).id;return t&&e!==void 0?t+`-`+e:e}function useStrictMode(e,t){(0,l.useContext)(Mr).strict}function getProjectionFunctionality(e){let{drag:t,layout:n}=getInitializedFeatureDefinitions();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function createMotionProxy(e,t){if(typeof Proxy>`u`)return createMotionComponent;let n=new Map,factory=(n,r)=>createMotionComponent(n,r,e,t),deprecatedFactoryFunction=(e,t)=>factory(e,t);return new Proxy(deprecatedFactoryFunction,{get:(r,i)=>i===`create`?factory:(n.has(i)||n.set(i,createMotionComponent(i,void 0,e,t)),n.get(i))})}let createDomVisualElement=(e,t)=>t.isSVG??isSVGComponent(e)?new SVGVisualElement(t):new HTMLVisualElement(t,{allowProjection:e!==l.Fragment});var AnimationFeature=class extends Feature{constructor(e){super(e),e.animationState||=createAnimationState(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();isAnimationControls(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}};let Hr=0;var ExitAnimationFeature=class extends Feature{constructor(){super(...arguments),this.id=Hr++}update(){let{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;let{isPresent:r,onExitComplete:i}=e,a=t?.isPresent;if(r===a)return;if(r&&a===!1){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=resolveVariant(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive(`exit`,!1);this.exit=void 0;return}let o=this.exit=n.setActive(`exit`,!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}};let Ur={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}};function extractEventInfo(e){return{point:{x:e.pageX,y:e.pageY}}}let addPointerInfo=e=>t=>isPrimaryPointer(t)&&e(t,extractEventInfo(t));function addPointerEvent(e,t,n,r){return addDomEvent(e,t,addPointerInfo(n),r)}let getContextWindow=({current:e})=>e?e.ownerDocument.defaultView:null,distance=(e,t)=>Math.abs(e-t);function distance2D(e,t){let n=distance(e.x,t.x),r=distance(e.y,t.y);return Math.sqrt(n**2+r**2)}let Wr=new Set([`auto`,`scroll`]);var PanSession=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=transformPoint(this.lastRawMoveEventInfo,this.transformPagePoint));let e=getPanInfo(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=distance2D(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e;this.history.push({...r,timestamp:dt.now()});let{onStart:i,onMove:a}=this.handlers;t||(i&&i(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a&&a(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=transformPoint(t,this.transformPagePoint),this.hasPendingMove=!0,q.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.hasPendingMove&&this.updatePoint(),this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=getPanInfo(e.type===`pointercancel`?this.lastMoveEventInfo:transformPoint(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!isPrimaryPointer(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=transformPoint(extractEventInfo(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=lt;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,getPanInfo(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=pipe(addPointerEvent(this.contextWindow,`pointermove`,this.handlePointerMove,d),addPointerEvent(this.contextWindow,`pointerup`,this.handlePointerUp,d),addPointerEvent(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Wr.has(e.overflowX)||Wr.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),q.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Vt(this.updatePoint)}};function transformPoint(e,t){return t?{point:t(e.point)}:e}function subtractPoint(e,t){return{x:e.x-t.x,y:e.y-t.y}}function getPanInfo({point:e},t){return{point:e,delta:subtractPoint(e,lastDevicePoint(t)),offset:subtractPoint(e,startDevicePoint(t)),velocity:getVelocity(t,.1)}}function startDevicePoint(e){return e[0]}function lastDevicePoint(e){return e[e.length-1]}function getVelocity(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=lastDevicePoint(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>secondsToMilliseconds(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>secondsToMilliseconds(t)*2&&(r=e[1]);let a=millisecondsToSeconds(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function applyConstraints(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?mixNumber(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?mixNumber(n,e,r.max):Math.min(e,n)),e}function calcRelativeAxisConstraints(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function calcRelativeConstraints(e,{top:t,left:n,bottom:r,right:i}){return{x:calcRelativeAxisConstraints(e.x,n,i),y:calcRelativeAxisConstraints(e.y,t,r)}}function calcViewportAxisConstraints(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function calcViewportConstraints(e,t){return{x:calcViewportAxisConstraints(e.x,t.x),y:calcViewportAxisConstraints(e.y,t.y)}}function calcOrigin(e,t){let n=.5,r=calcLength(e),i=calcLength(t);return i>r?n=progress(t.min,t.max-r,e.min):r>i&&(n=progress(e.min,e.max-i,t.min)),clamp$1(0,1,n)}function rebaseAxisConstraints(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}let Gr=.35;function resolveDragElastic(e=Gr){return e===!1?e=0:e===!0&&(e=Gr),{x:resolveAxisElastic(e,`left`,`right`),y:resolveAxisElastic(e,`top`,`bottom`)}}function resolveAxisElastic(e,t,n){return{min:resolvePointElastic(e,t),max:resolvePointElastic(e,n)}}function resolvePointElastic(e,t){return typeof e==`number`?e:e[t]||0}let Kr=new WeakMap;var VisualElementDragControls=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let onSessionStart=e=>{t&&this.snapToCursor(e),this.stopAnimation()},onStart=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=setDragLock(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(e=>{let t=this.getAxisMotionValue(e).get()||0;if(wt.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=calcLength(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&q.update(()=>i(e,t),!1,!0),addValueToWillChange(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},onMove=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=getCurrentDirection(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&q.update(()=>a(e,t),!1,!0)},onSessionEnd=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:i}=this.getProps();this.panSession=new PanSession(e,{onSessionStart,onStart,onMove,onSessionEnd,resumeAnimation},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:i,distanceThreshold:n,contextWindow:getContextWindow(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&q.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!shouldDrag(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=applyConstraints(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&isRefObject(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=calcRelativeConstraints(n.layoutBox,e):this.constraints=!1,this.elastic=resolveDragElastic(t),r!==this.constraints&&!isRefObject(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=rebaseAxisConstraints(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!isRefObject(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=measurePageBox(n,r.root,this.visualElement.getTransformPagePoint()),a=calcViewportConstraints(r.layout.layoutBox,i);if(t){let e=t(convertBoxToBoundingBox(a));this.hasMutatedConstraints=!!e,e&&(a=convertBoundingBoxToBox(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=eachAxis(o=>{if(!shouldDrag(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return addValueToWillChange(this.visualElement,e),n.start(animateMotionValue(e,n,0,t,this.visualElement,!1))}stopAnimation(){eachAxis(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){let{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,a=this.visualElement.measureViewportBox();eachAxis(e=>{if(!shouldDrag(e,n,this.currentDirection))return;let t=this.getAxisMotionValue(e),{min:r,max:o}=a[e];t.set((t.get()||0)+i[e]-mixNumber(r,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!isRefObject(t)||!n||!this.constraints)return;this.stopAnimation();let r=this.constraints,i={x:0,y:0};eachAxis(e=>{let t=this.getAxisMotionValue(e).get();i[e]=calcOrigin({min:t,max:t},r[e])});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),eachAxis(t=>{let n=this.getAxisMotionValue(t);if(!shouldDrag(t,e,null)||!n.get())return;let{min:r,max:a}=this.constraints[t];n.set(mixNumber(r,a,i[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Kr.set(this.visualElement,this);let e=this.visualElement.current,t=addPointerEvent(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&isElementTextInput(i);n&&r&&!a&&this.start(t)}),n,measureDragConstraints=()=>{let{dragConstraints:t}=this.getProps();isRefObject(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=startResizeObservers(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:r}=this.visualElement,i=r.addEventListener(`measure`,measureDragConstraints);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),q.read(measureDragConstraints);let a=addDomEvent(window,`resize`,()=>this.scalePositionWithinConstraints()),o=r.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(eachAxis(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{a(),t(),i(),o&&o(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=Gr,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function skipFirstCall(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function startResizeObservers(e,t,n){let r=resize(e,skipFirstCall(n)),i=resize(t,skipFirstCall(n));return()=>{r(),i()}}function shouldDrag(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function getCurrentDirection(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var DragGesture=class extends Feature{constructor(e){super(e),this.removeGroupControls=noop,this.removeListeners=noop,this.controls=new VisualElementDragControls(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}};let asyncHandler=e=>(t,n)=>{e&&q.update(()=>e(t,n),!1,!0)};var PanGesture=class extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop}onPointerDown(e){this.session=new PanSession(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:asyncHandler(e),onStart:asyncHandler(t),onMove:asyncHandler(n),onEnd:(e,t)=>{delete this.session,r&&q.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}};let qr=!1;var MeasureLayoutWithContext=class extends l.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),qr&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Sr.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),qr=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||q.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Hn.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;qr=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function MeasureLayout(e){let[t,n]=usePresence(),r=(0,l.useContext)(Je);return(0,d.jsx)(MeasureLayoutWithContext,{...e,layoutGroup:r,switchLayoutGroup:(0,l.useContext)(Vr),isPresent:t,safeToRemove:n})}let Jr={pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:Ar,MeasureLayout}};function handleHoverEvent(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&q.postRender(()=>i(t,extractEventInfo(t)))}var HoverGesture=class extends Feature{mount(){let{current:e}=this.node;e&&(this.unmount=hover(e,(e,t)=>(handleHoverEvent(this.node,t,`Start`),e=>handleHoverEvent(this.node,e,`End`))))}unmount(){}},FocusGesture=class extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=pipe(addDomEvent(this.node.current,`focus`,()=>this.onFocus()),addDomEvent(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function handlePressEvent(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&q.postRender(()=>i(t,extractEventInfo(t)))}var PressGesture=class extends Feature{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=press(e,(e,t)=>(handlePressEvent(this.node,t,`Start`),(e,{success:t})=>handlePressEvent(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}};let Yr=new WeakMap,Xr=new WeakMap,fireObserverCallback=e=>{let t=Yr.get(e.target);t&&t(e)},fireAllObserverCallbacks=e=>{e.forEach(fireObserverCallback)};function initIntersectionObserver({root:e,...t}){let n=e||document;Xr.has(n)||Xr.set(n,{});let r=Xr.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(fireAllObserverCallbacks,{root:e,...t})),r[i]}function observeIntersection(e,t,n){let r=initIntersectionObserver(t);return Yr.set(e,n),r.observe(e),()=>{Yr.delete(e),r.unobserve(e)}}let Zr={some:0,all:1};var InViewFeature=class extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Zr[r]},onIntersectionUpdate=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=observeIntersection(this.node.current,a,onIntersectionUpdate)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(hasViewportOptionChanged(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function hasViewportOptionChanged({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}let Qr={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}},$r={layout:{ProjectionNode:Ar,MeasureLayout}},ei=createMotionProxy({...Ur,...Qr,...Jr,...$r},createDomVisualElement),ti=[{x:4,height:8,delay:0},{x:8,height:16,delay:.05},{x:12,height:10,delay:.2},{x:16,height:14,delay:.33},{x:20,height:8,delay:.44}];function AnimatedAudioLines({size:e=16,...t}){return(0,d.jsx)(`svg`,{...t,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:ti.map(({x:e,height:t,delay:n})=>(0,d.jsx)(ei.line,{x1:e,x2:e,y1:12-t/2,y2:12+t/2,animate:{scaleY:[.44,1,.44]},transition:{duration:.88,delay:n,repeat:1/0,ease:`easeInOut`},style:{originY:`50%`}},e))})}function finalAssistantMessageId(e){let t=e.timeline.turnOrder.at(-1);if(t===void 0)return null;for(let n of e.locations.getTurn(t)){let t=e.nodes.get(n);if(t?.kind===`turn-tail`)return t.data.closing?.finalNode.messageId??null}return null}function messageText(e,t){for(let n of e.nodes)if(!(n.kind!==`assistant`||n.messageId!==t))return assistantText(n.blocks);return``}function messageTime(e,t){for(let n of e.nodes)if(n.kind===`assistant`&&n.messageId===t)return n.time;return null}function latestAssistantMessageId(e){for(let t=e.nodes.length-1;t>=0;--t){let n=e.nodes[t];if(n?.kind===`assistant`&&n.messageId!==void 0)return n.messageId}return null}function assistantText(e){return e.filter(e=>e.kind===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
4
4
 
5
- `)}function finalLiveMessage(e,t,n){for(let r=e.nodes.length-1;r>=0;--r){let i=e.nodes[r];if(i?.kind===`assistant`&&i.messageId!==void 0&&i.turn===t&&i.step===n)return{messageId:i.messageId,turn:i.turn,step:i.step,text:assistantText(i.blocks),interrupted:i.interrupted===!0}}return null}function messageLiveIdentity(e,t){for(let n of e.nodes)if(n.kind===`assistant`&&n.messageId===t)return{turn:n.turn,step:n.step};return null}function hostRoute(e){let t=e.replace(/^\/+/,``);return typeof document>`u`?`/${t}`:new URL(t,document.baseURI).pathname}function hostWebSocketUrl(e){let t=globalThis.__DSH_TRANSPORT__?.streamBaseUrl??(typeof document>`u`?globalThis.location?.href??`http://localhost/`:document.baseURI),n=new URL(e.replace(/^\/+/,``),t);return n.protocol=n.protocol===`https:`?`wss:`:`ws:`,n.href}var ApiKeyStatusStore=class{available=!0;entries=new Map;entry(e){let t=this.entries.get(e);return t===void 0&&(t={status:`loading`,listeners:new Set,request:null},this.entries.set(e,t)),t}getSnapshot=e=>this.entry(e).status;subscribe(e,t){let n=this.entry(e);return n.listeners.add(t),this.load(e,n),()=>{n.listeners.delete(t),n.listeners.size===0&&this.reset(n)}}setAvailable(e){this.available!==e&&(this.available=e,this.invalidate())}invalidate=()=>{for(let[e,t]of this.entries){this.reset(t),this.load(e,t);for(let e of t.listeners)e()}};reset(e){let t=e.request;e.request=null,t?.abort(),e.status=`loading`}load(e,t){if(!this.available||t.listeners.size===0||t.request!==null||t.status!==`loading`)return;let n=new AbortController;t.request=n;let publish=e=>{if(t.request===n){t.request=null,t.status=e;for(let e of t.listeners)e()}};(async()=>{try{let t=await fetch(`${hostRoute(`/plugins/xiaomi-mimo-tts/api-key-status`)}?provider=${e}`,{cache:`no-store`,headers:{accept:`application/json`},signal:n.signal});if(!t.ok)throw Error(`api-key-status-failed`);let r=await t.json();if(typeof r!=`object`||!r||!(`configured`in r)||typeof r.configured!=`boolean`||!(`supported`in r)||typeof r.supported!=`boolean`)throw Error(`api-key-status-invalid`);publish(r.configured?r.supported?`recognized`:`unrecognized`:`missing`)}catch{publish(`unavailable`)}})()}};let ti=new ApiKeyStatusStore;function bindApiKeyStatus(e,t,n=ti){let r=e.getSnapshot().revision,update=()=>{let i=e.getSnapshot(),a=i.status===`ready`&&!t.getSnapshot();Object.is(r,i.revision)||(r=i.revision,n.setAvailable(!1)),n.setAvailable(a)},i=e.subscribe(update),a=t.subscribe(update);return update(),()=>{i(),a(),n.setAvailable(!1)}}var EngineStateStore=class{view={status:`inactive`,engine:null};listeners=new Set;getSnapshot=()=>this.view;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});publish(e,t=this.view.engine){if(!(this.view.status===e&&JSON.stringify(this.view.engine)===JSON.stringify(t))){this.view={status:e,engine:t};for(let e of this.listeners)e()}}start(){this.publish(`connecting`);let e=!1,t=null,n=new EventSource(hostRoute(`/plugins/xiaomi-mimo-tts/engine-events`)),refresh=async()=>{t?.abort();let n=new AbortController;t=n;try{let t=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/engine-state`),{signal:n.signal,cache:`no-store`});if(!t.ok)throw Error(`engine-state-unavailable`);let r=await t.json();!e&&!n.signal.aborted&&this.accept(r)}catch{!e&&!n.signal.aborted&&this.publish(`unknown`)}};return n.onopen=()=>{refresh()},n.onmessage=n=>{try{t?.abort(),e||this.accept(JSON.parse(n.data))}catch{e||this.publish(`unknown`)}},n.onerror=()=>{t?.abort(),e||this.publish(`unknown`)},()=>{e=!0,t?.abort(),n.close(),this.publish(`inactive`,null)}}accept(e){if(!e||!Number.isSafeInteger(e.revision)||typeof e.provider!=`string`||typeof e.ready!=`boolean`||typeof e.name!=`string`||!Array.isArray(e.formats)||!e.formats.includes(`wav`)||!Number.isSafeInteger(e.maxTextLength)||e.maxTextLength<1||typeof e.streaming!=`boolean`){this.publish(`unknown`);return}this.publish(`ready`,e)}};let ni=new EngineStateStore,externalEngine=()=>{let e=ni.getSnapshot().engine;return e?.provider.startsWith(`external:`)?e:null},engineSupportsRealtime=e=>externalEngine()?.streaming??supportsRealtimeTts(e);function externalAudioTags(e){let t=externalEngine();return t?.models?.find(n=>n.id===(e?.model??t.selection?.model))?.audioTags??[]}let externalText=(e,t)=>prepareExternalTtsText(e,externalAudioTags(t).map(e=>e.value)),externalFallbackText=(e,t)=>{for(let n of externalAudioTags(t))e=e.split(n.value).join(` `);return prepareExternalTtsText(e)},engineText=(e,t)=>externalEngine()?externalText(e):t(),engineMaxTextLength=(e=12e3)=>externalEngine()?.maxTextLength??e,engineCanRequest=()=>[`inactive`,`ready`].includes(ni.getSnapshot().status);function splitExternalText(e,t=engineMaxTextLength(),n){let r=[];for(let i of splitTtsSegments(e,Math.min(180,t),t,e=>externalText(e,n))){let e=``;for(let n of i.match(/<[^>]*>|\([^()]*\)|./gu)??[]){if(n.length>t)throw Error(`text-too-long`);e.length+n.length>t&&(r.push(e),e=``),e+=n}e.trim()&&r.push(e)}return r}function speechRequestBody(e,t){let n=ni.getSnapshot();if(!engineCanRequest())throw Error(`speech-engine-unavailable`);let r=externalEngine();return r?{text:e.text,provider:r.provider,engineRevision:r.revision,...t?{model:t.model,voice:t.voice,speechInstruction:t.speechInstruction??``}:{},...e.format===void 0?{}:{format:r.formats.includes(e.format)?e.format:`wav`}}:{...e,...n.engine?{engineRevision:n.engine.revision}:{}}}function useEngineState(){return(0,l.useSyncExternalStore)(ni.subscribe,ni.getSnapshot,ni.getSnapshot)}let ri=new Set;function onTtsCredentialsSaved(e){return ri.add(e),()=>{ri.delete(e)}}function invalidateApiKeyStatus(){ti.invalidate();for(let e of ri)e()}function useApiKeyStatus(e,t){let n=useEngineState(),r=externalEngine();e&&=!r;let i=(0,l.useCallback)(n=>e?ti.subscribe(t,n):()=>{},[e,t]),a=(0,l.useCallback)(()=>e?ti.getSnapshot(t):`loading`,[e,t]),o=(0,l.useSyncExternalStore)(i,a,a);return r?n.status===`ready`?r.ready?`recognized`:`missing`:`unavailable`:o}function useApiKeySupported(e,t=`xiaomi`){let n=useApiKeyStatus(e,t);return n===`loading`||n===`unavailable`?null:n===`recognized`}function readAloudText(e,t,n){return externalEngine()?applyTtsPlaybackScope(e,t.readScope,n,void 0,externalText):t.provider===`breeze`?applyBreezeTtsPlaybackScope(e,t.readScope,n):applyTtsPlaybackScope(e,t.readScope,n,void 0,e=>prepareProviderTtsText(e,t))}function fallbackText(e,t){return externalEngine()?externalFallbackText(e):t.provider===`breeze`?stripBreezeAudioTags(e):t.provider===`xiaomi`?stripXiaomiAudioTags(e):e}function playCompletedReply(e,t){let{sessionId:n,messageId:r,text:i,settings:a,apiKeySupported:o,playback:s,live:c,local:l}=e;c.configure(a),s.configure(a);let u=readAloudText(i,a,t),d=fallbackText(u,a),p=a.localSpeechMode===`auto`?()=>l.playCompleted(n,r,d):void 0,playRemote=()=>{l.cancelSession(n),engineSupportsRealtime(a)?(s.cancelPlayback(n),c.playCompleted(n,r,u,()=>{p===void 0?s.toggle(n,r,u,t,void 0,`mp3`):p()})):(c.cancelSession(n),externalEngine()||splitTtsSegments(u).length>1?s.segmented(n,r,u,t,p):s.toggle(n,r,u,t,p,`mp3`))};a.localSpeechMode===`local-first`||a.localSpeechMode===`auto`&&o===!1?(c.cancelSession(n),s.cancelPlayback(n),l.playCompleted(n,r,d,a.localSpeechMode===`local-first`?playRemote:void 0)):playRemote()}function handleReadAloudClick(e,t){let{sessionId:n,messageId:r,text:i,turn:a,settings:o,playback:s,live:c,local:l}=e,u=t.sessionId===n&&t.messageId===r;if(u&&(t.source===`live`||t.source===`system`)){let e=t.source===`system`?l:c;if(t.status===`loading`){e.stop(n)&&a!==void 0&&(c.blockTurn(n,a),l.blockTurn(n,a)),s.cancelPlayback(n);return}if(t.status===`playing`){e.pause(n);return}if(t.status===`paused`){e.resume(n);return}}if(u&&t.source===`complete`){s.toggle(n,r,i,!1);return}if(u&&t.source===`segmented`){if(t.status===`playing`||t.status===`loading`)s.pauseSegmented(n,r);else{let e=readAloudText(i,o,!1),t=fallbackText(e,o);s.segmented(n,r,e,!1,o.localSpeechMode===`auto`?()=>l.playCompleted(n,r,t):void 0)}return}playCompletedReply(e,!1)}let ii=`dsh-xiaomi-tts:audio-owner`,ai={canPlay:()=>!0,subscribe:()=>()=>{},claim:()=>{}};var TabAudioFocus=class{id=crypto.getRandomValues(new Uint32Array(4)).join(`-`);listeners=new Set;storage=null;active=!1;suspended=!1;owned=!1;constructor(e=window){this.target=e}canPlay=()=>{if(!this.active||this.suspended)return!1;if(this.storage!==null)try{return this.storage.getItem(ii)===this.id}catch{this.storage=null}return this.focused()};subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});claim=()=>{if(!(!this.active||this.suspended||!this.focused())){if(this.storage!==null)try{this.storage.setItem(ii,this.id)}catch{}this.refresh()}};activate(){this.active=!0;try{this.storage=this.target.localStorage}catch{this.storage=null}return this.target.addEventListener(`focus`,this.claim),this.target.addEventListener(`blur`,this.refresh),this.target.addEventListener(`storage`,this.onStorage),this.target.addEventListener(`pagehide`,this.onHide),this.target.addEventListener(`pageshow`,this.onShow),this.target.document.addEventListener(`visibilitychange`,this.onVisibility),this.claim(),()=>{this.target.removeEventListener(`focus`,this.claim),this.target.removeEventListener(`blur`,this.refresh),this.target.removeEventListener(`storage`,this.onStorage),this.target.removeEventListener(`pagehide`,this.onHide),this.target.removeEventListener(`pageshow`,this.onShow),this.target.document.removeEventListener(`visibilitychange`,this.onVisibility),this.active=!1,this.release(),this.refresh()}}focused(){return this.target.document.visibilityState===`visible`&&this.target.document.hasFocus()}refresh=()=>{let e=this.canPlay();if(e!==this.owned){this.owned=e;for(let e of this.listeners)e()}};onStorage=e=>{if(!(e.key!==null&&e.key!==ii)&&e.storageArea===this.storage){if(this.storage!==null)try{this.storage.getItem(ii)===null&&this.claim()}catch{this.storage=null}this.refresh()}};onVisibility=()=>{this.claim(),this.refresh()};onHide=()=>{this.suspended=!0,this.release(),this.refresh()};onShow=()=>{this.suspended=!1,this.claim(),this.refresh()};release(){try{this.storage?.getItem(ii)===this.id&&this.storage.removeItem(ii)}catch{this.storage=null}}};let oi={"api-key-rejected":`error.apiKeyRejected`,"voice-unavailable":`error.voiceUnavailable`,"voice-required":`error.voiceUnavailable`,"resource-unavailable":`error.resourceUnavailable`,"rate-limited":`error.rateLimited`,"tts-timeout":`error.timeout`,"pcm-pause-buffer-limit":`error.bufferLimit`,"stream-buffer-limit":`error.bufferLimit`,"no-text":`error.noText`,"local-speech-not-allowed":`error.localNotAllowed`,"local-voice-unavailable":`error.localVoiceUnavailable`,"local-speech-timeout":`error.localTimeout`,"local-speech-audio-device":`error.localAudioDevice`,"local-speech-failed":`error.localSynthesis`,"local-speech-unavailable":`error.localSynthesis`,"moss-unreachable":`error.localMossUnreachable`,"moss-voice-required":`error.localMossVoiceMissing`,"moss-invalid-url":`error.localMossInvalidUrl`,"moss-timeout":`error.localMossTimeout`,"moss-api-error":`error.localMossFailed`,"moss-audio-failed":`error.localMossFailed`,"moss-request-failed":`error.localMossFailed`,"moss-invalid-response":`error.localMossFailed`,"moss-response-too-large":`error.localMossFailed`,"moss-audio-too-large":`error.localMossFailed`,"autoplay-blocked":`error.play`,"play-failed":`error.play`};function ReadAloudAction({sessionId:e,messageId:t,useSession:n,useChat:r,playback:i,live:a,local:o,settings:s,t:c,automaticReading:p,audioFocus:m=ai,automaticAudioFocus:h=m}){let g=(0,l.useSyncExternalStore)(h.subscribe,h.canPlay,h.canPlay),_=n(e=>e),v=r(e=>e.legacy),b=(0,l.useSyncExternalStore)(p.subscribe,p.getSnapshot,p.getSnapshot),x=r(finalAssistantMessageId),S=_.running,C={text:messageText(v,t),time:messageTime(v,t),latestMessageId:b===`final`?x:latestAssistantMessageId(v),identity:messageLiveIdentity(v,t)},w=C.text,E=useSettingsSnapshot(s),D=resolveTtsSettings(E.value),k=useEngineState(),A=useApiKeySupported(g&&D.localSpeechMode!==`disabled`,D.provider);o.setVoiceURI(D.localVoiceURI),o.setMossVoice(D.localVoiceEngine,D.mossBaseURL,D.mossVoice),o.setTimeoutMs(D.requestTimeoutMs);let M=(0,l.useSyncExternalStore)(i.subscribe,i.getSnapshot,i.getSnapshot),P={sessionId:e,messageId:t,text:w,playback:i,live:a,local:o,turn:v.partial?.turn??C.identity?.turn,settings:D,apiKeySupported:A};if((0,l.useEffect)(()=>{if(!engineCanRequest()||!p.allowed(e)||b===`final`&&x!==t||!g||!h.canPlay()||w.length===0||E.value?.enabled!==!0||E.value?.autoPlay!==!0||a.hasHandled(e,C.identity)||o.hasHandled(e,C.identity)||S||C.latestMessageId!==t||C.time===null||C.time<i.autoPlayArmedAt)return;let n=window.setTimeout(()=>{h.canPlay()&&!a.hasHandled(e,C.identity)&&!o.hasHandled(e,C.identity)&&p.allowed(e)&&i.claimAutomaticPlayback(e,t)&&(p.markAutomatic(),playCompletedReply(P,!0))},0);return()=>window.clearTimeout(n)},[k,p,b,x,h,g,A,a,o,C.identity,C.latestMessageId,C.time,t,i,D.localSpeechMode,D.localVoiceEngine,D.mossBaseURL,D.mossVoice,D.model,D.provider,D.doubaoModel,D.doubaoVoice,D.doubaoClonedVoice,D.breezeVoice,D.breezeInstruction,D.readScope,S,e,E.value?.autoPlay,E.value?.enabled,w]),E.value?.enabled!==!0||w.length===0)return null;let F=M.sessionId===e&&M.messageId===t,I=F?M.status:`idle`,V=F?M.source:null,ee=(V===`live`||V===`system`)&&(I===`loading`||I===`playing`),H=c(I===`loading`?V===`complete`?`action.loading`:`action.cancel`:I===`playing`?`action.pause`:I===`paused`?`action.resume`:I===`error`?`action.retry`:`action.play`),te=F?M.error:null,U=te===null?null:c(oi[te]??`error.request`),re=U??(V===`system`&&(I===`loading`||I===`playing`||I===`paused`)?c(`action.localFallback`):null);return(0,d.jsx)(u.Tooltip,{label:re===null?H:`${H} · ${re}`,side:`bottom`,portal:!0,children:(0,d.jsx)(u.Button,{type:`button`,variant:`toolbar`,size:`sm`,className:U===null?`xmimo-tts-action`:`xmimo-tts-action xmimo-tts-failed`,"aria-label":H,"aria-description":re??void 0,"aria-pressed":I===`playing`||ee,disabled:I===`loading`&&V===`complete`,onClick:()=>{m.claim(),m.canPlay()&&(p.markManual(),handleReadAloudClick(P,M))},children:I===`playing`?(0,d.jsx)(AnimatedAudioLines,{size:16}):(0,d.jsx)(RiVoiceAiFill,{className:I===`loading`?`xmimo-tts-pulse`:void 0,size:16})})})}function prepareSpeechText(e,t=!1){let n=t?e.replace(/(?:\[[^\]\r\n]*|\([^()\r\n]*|([^()\r\n]*)$/u,``):e;return(0,u.extractMarkdownPlainText)((t===`xiaomi`?prepareXiaomiTtsText:t?prepareBreezeTtsText:prepareTtsText)(n)).trim()}var RealtimeSpeechSession=class{sessionId=null;turn=null;revision=0;options={localSpeechMode:`auto`,apiKeySupported:null,readScope:`smart`};constructor(e,t){this.live=e,this.local=t}configure(e){this.options=e}activate(e){this.sessionId!==e&&(this.cancel(),this.sessionId=e,this.live.activateSession(e),this.local.activateSession(e))}deactivate(e){this.sessionId===e&&(this.cancel(),this.live.deactivateSession(e),this.local.deactivateSession(e),this.sessionId=null)}cancel(){this.revision+=1,this.turn=null,this.live.setFallbackHandler(null),this.local.setFallbackHandler(null),this.sessionId!==null&&(this.live.cancelSession(this.sessionId),this.local.cancelSession(this.sessionId))}observe(e,t,n,r,i=!1){if(this.sessionId!==e)return;(this.turn===null||this.turn.turn!==t)&&this.beginTurn(t);let a=this.turn,o=a.steps.get(n);if(o===void 0&&(o={cursor:{sessionId:e,turn:t,step:n},limiter:new TtsFirstSegmentLimiter(a.scope===`smart`?2:1,e=>this.live.prepareText(e)),text:``,checkpoint:null,final:null,inputFinished:!1},a.steps.set(n,o)),o.inputFinished)return;o.text=this.scopeText(r,o);let s=this.controller(a.backend);if(i&&(o.checkpoint=o.text,s.prime(e,t,n,this.backendText(a.backend,o.text))),s.observe(e,t,n,this.backendText(a.backend,o.text)),a.backend===`live`&&this.live.isDuplex()&&o.limiter.complete&&a.scope!==`full`){let i=prepareSpeechText(r),c=countTtsSpeechCharacters(o.text);(a.scope===`first-segment`||countTtsSpeechCharacters(i)>=c*2)&&(o.text=this.scopeText(r,o,!0),s.observe(e,t,n,this.backendText(a.backend,o.text)),o.inputFinished=!0,this.live.finishInput(e,t,n))}}finish(e,t){if(this.sessionId!==e||this.turn?.turn!==t.turn)return;let n=this.turn.steps.get(t.step);if(!(n===void 0||n.final!==null)){if(t.interrupted){this.cancel(),this.live.blockTurn(e,t.turn),this.local.blockTurn(e,t.turn);return}n.inputFinished||(n.text=this.scopeText(t.text,n,!0)),n.final={...t,text:n.text},this.controller(this.turn.backend).finish(e,{...n.final,text:this.backendText(this.turn.backend,n.final.text)})}}beginTurn(e){this.cancel();let{localSpeechMode:t,apiKeySupported:n,readScope:r}=this.options,i=t===`local-first`||t===`auto`&&n===!1;this.turn={turn:e,backend:i?`system`:`live`,scope:r,steps:new Map,fallback:t===`local-first`||t===`auto`&&!i},this.installFallback()}backendText(e,t){return e===`system`?externalEngine()?externalFallbackText(t):stripXiaomiAudioTags(stripBreezeAudioTags(t)):t}controller(e){return e===`live`?this.live:this.local}scopeText(e,t,n=!1){return applyTtsLivePlaybackScope(this.live.prepareText(e),this.turn.scope,t.limiter,n,Math.random,e=>this.live.prepareText(e))}installFallback(){this.live.setFallbackHandler(null),this.local.setFallbackHandler(null);let e=this.turn;if(e===null||!e.fallback)return;let t=this.revision;this.controller(e.backend).setFallbackHandler(n=>{if(t!==this.revision||this.turn!==e||n.sessionId!==this.sessionId||n.turn!==e.turn)return;e.backend=e.backend===`live`?`system`:`live`,e.fallback=!1,this.installFallback();let r=this.controller(e.backend);for(let t of e.steps.values()){let{sessionId:n,turn:i,step:a}=t.cursor;t.checkpoint!==null&&r.prime(n,i,a,this.backendText(e.backend,t.checkpoint)),r.observe(n,i,a,this.backendText(e.backend,t.text)),t.final!==null&&r.finish(n,{...t.final,text:this.backendText(e.backend,t.final.text)})}})}};function SessionPlaybackObserver({sessionId:e,useSession:t,useChat:n,playback:r,live:i,local:a,settings:o,questions:s,automaticReading:c,audioFocus:u=ai,automaticAudioFocus:d=u}){(0,l.useEffect)(()=>s?.activateSession(e),[s,e]);let p=(0,l.useSyncExternalStore)(d.subscribe,d.canPlay,d.canPlay),m=resolveTtsSettings(useSettingsSnapshot(o).value),h=useEngineState(),g=useApiKeySupported(p&&!externalEngine()&&m.localSpeechMode!==`disabled`,m.provider),_=externalEngine()?h.engine?.ready??!1:g;i.setMaxPausedPcmBytes(m.maxPausedPcmBytes),a.setVoiceURI(m.localVoiceURI),a.setMossVoice(m.localVoiceEngine,m.mossBaseURL,m.mossVoice),a.setTimeoutMs(m.requestTimeoutMs);let v=t(e=>e),b=n(e=>e.legacy),x=v.running,S=(0,l.useSyncExternalStore)(c.subscribe,c.getSnapshot,c.getSnapshot),[C]=(0,l.useState)(()=>new RealtimeSpeechSession(i,a)),w=JSON.stringify([ttsSelection(m),h]),E=(0,l.useRef)(w),D=(0,l.useRef)(null),k=(0,l.useRef)(x),A=(0,l.useRef)(!0),M=n(finalAssistantMessageId),P=S===`final`?M:latestAssistantMessageId(b),F=b.partial,I=F===null?``:assistantText(F.blocks),V=(0,l.useRef)(x),ee=(0,l.useRef)(x?F:null),H=(0,l.useRef)(x&&v.openState!==`open`);return(0,l.useEffect)(()=>(D.current=null,k.current=x,A.current=!0,V.current=x,ee.current=x?F:null,H.current=x&&v.openState!==`open`,r.activateSession(e),C.activate(e),()=>{D.current=null,c.release(e),C.deactivate(e),r.deactivateSession(e)}),[c,r,e,C]),(0,l.useEffect)(()=>{if(E.current!==w){E.current=w;let t=D.current?.turn;C.cancel(),t!==void 0&&(i.blockTurn(e,t),a.blockTurn(e,t)),i.configure(m),D.current=null,x&&(A.current=!1)}i.configure(m),C.configure({localSpeechMode:m.localSpeechMode,apiKeySupported:_,readScope:m.readScope});let t=x&&!k.current;k.current=x,x?t&&(A.current=!0,V.current=!1,ee.current=null,H.current=!1,C.cancel(),r.cancelPlayback(e),D.current=null):A.current=!0,c.observe(e,x),c.allowed(e)||(A.current=!1);let n=engineCanRequest()&&engineSupportsRealtime(m);if(r.observeSession(e,p&&d.canPlay()&&x&&A.current,P,V.current),!p||!d.canPlay()||!m.enabled||!m.autoPlay||!n){(!u.canPlay()||!m.enabled||c.isAutomatic())&&C.cancel(),D.current=null,x&&(A.current=!1);return}if(S===`final`){D.current!==null&&C.cancel(),D.current=null;return}if(A.current){if(H.current){if(v.openState!==`open`)return;ee.current=F,H.current=!1}if(F!==null){if(D.current!==null&&(D.current.turn!==F.turn||D.current.step!==F.step)){let t=finalLiveMessage(b,D.current.turn,D.current.step);t!==null&&C.finish(e,t)}D.current={turn:F.turn,step:F.step};let t=ee.current!==null&&ee.current.turn===F.turn&&ee.current.step===F.step;ee.current=null,c.markAutomatic(),C.observe(e,F.turn,F.step,I,t);return}if(D.current!==null){let t=finalLiveMessage(b,D.current.turn,D.current.step);t===null?x||(C.cancel(),D.current=null):(C.finish(e,t),D.current=null)}}},[c,S,u,d,p,w,_,b,P,i,a,F,I,r,m.autoPlay,m.enabled,m.localSpeechMode,m.localVoiceEngine,m.mossBaseURL,m.mossVoice,m.model,m.provider,m.doubaoModel,m.doubaoVoice,m.doubaoClonedVoice,m.readScope,x,e,v.openState,C]),null}let si={"settings.mountSidebar":`挂载侧栏`,"settings.unmountSidebar":`退出侧栏`,"settings.mountingSidebar":`正在挂载侧栏,请稍候…`,"settings.unmountingSidebar":`正在退出侧栏,请稍候…`,"settings.voiceSettingsNav":`音色工坊`,"settings.voiceSettingsDescription":`配置音色、试听与音效`,"settings.pluginDetails":`插件详情`},ci={"settings.mountSidebar":`Mount to sidebar`,"settings.unmountSidebar":`Remove from sidebar`,"settings.mountingSidebar":`Mounting to sidebar, please wait…`,"settings.unmountingSidebar":`Removing from sidebar, please wait…`,"settings.voiceSettingsNav":`Voice Studio`,"settings.voiceSettingsDescription":`Configure voices, previews, and sound effects`,"settings.pluginDetails":`Plugin details`},li={"whale.description":`配置鲸鱼娘人设与独立本地记忆。`,"whale.loading":`正在读取鲸鱼娘配置…`,"whale.unavailable":`请先启用「鲸鱼娘」组件,再打开此页。`,"whale.persona":`人设`,"whale.personaHint":`仅用于 DSH 鲸鱼娘,保存后下一轮对话生效;不影响 QQ 鲸鱼娘。`,"whale.name":`角色名`,"whale.selfReference":`自称`,"whale.userAddress":`默认用户称呼`,"whale.relationship":`关系与背景`,"whale.personality":`性格补充`,"whale.replyStyle":`回复风格`,"whale.likes":`角色喜好`,"whale.boundaries":`避雷与禁忌`,"whale.memory":`轻量记忆`,"whale.memoryEnabled":`允许保存记忆`,"whale.memoryHint":`仅使用当前工作区的鲸鱼娘记忆,不读取 QQ 私聊或群记忆。`,"whale.conflict":`配置已在其他位置更新。请放弃修改并重新编辑,避免覆盖新设置。`,"whale.errorPersona":`角色名和自称不能为空,其他字段请控制在长度限制内。`,"qq.description":`独立配置 QQ 鲸鱼娘人设、记忆与自动传声。`,"qq.persona":`QQ 鲸鱼娘人设`,"qq.personaUnavailable":`请先启用「QQ Bot 传声筒」组件,再打开此页。`,"qq.personaHint":`仅用于独立的 QQ 鲸鱼娘预设。保存后下一轮生效;在 QQ 中发送 /preset qq-speech-assistant,再发送 /new 开始使用。`,"qq.personaMemoryHint":`按机器人、私聊或群独立保存,跨 /new 保留;群里只记公共要求和话题,不读取 DSH 工作区记忆。`,"qq.voice":`QQ 传声与语音转换`,"qq.voiceHint":`使用宿主已保存的服务商与音色。开启后,QQ 鲸鱼娘每轮完成时自动合成完整回复并发送 SILK,无须模型调用语音工具。`,"qq.automatic":`自动将 QQ 回复转为语音`,"qq.characters":`自动语音字数上限`,"qq.duration":`每段语音时长上限(秒)`,"qq.limitsHint":`0 表示不限。超出自动语音字数上限时保留文字;显式语音请求仍可用。`,"qq.ruleHint":`仅响应已核验的 QQ 会话;不会向 QQ 转发 DSH 对话,也不会在空闲时主动发送。`,"qq.memory":`QQ 记忆回显与修改`,"qq.memoryHint":`显示 QQBot 已记录的私聊和群记忆。修改或删除会立即写入对应对象,群记忆对群内成员公开。`,"qq.memoryLoading":`正在读取 QQ 记忆…`,"qq.memoryUnavailable":`QQBot 未运行或暂无可读取的会话记忆。`,"qq.memoryEmpty":`暂无已保存的 QQ 记忆。`,"qq.memorySaved":`QQ 记忆已更新。`,"qq.memoryError":`QQ 记忆更新失败,请重试。`,"qq.group":`群`,"qq.private":`私聊`,"qq.pauseMemory":`暂停保存`,"qq.resumeMemory":`恢复保存`,"qq.clearMemory":`清空`,"qq.editMemory":`保存修改`,"qq.deleteMemory":`删除`,"qq.memoryKind.preference":`偏好`,"qq.memoryKind.requirement":`要求`,"qq.memoryKind.topic":`话题`,"qq.unavailable":`请先启用本插件的语音服务。`,"qq.error":`字数须为 0–12000 的整数,时长须为 0–6000 秒的整数。`},ui={"whale.description":`Configure the Whale Girl persona and isolated local memory.`,"whale.loading":`Loading Whale Girl settings…`,"whale.unavailable":`Enable the Whale Girl component before opening this page.`,"whale.persona":`Persona`,"whale.personaHint":`Applies only to DSH Whale Girl on the next turn. QQ Whale Girl has separate settings.`,"whale.name":`Character name`,"whale.selfReference":`Self reference`,"whale.userAddress":`Default user address`,"whale.relationship":`Relationship and background`,"whale.personality":`Additional personality`,"whale.replyStyle":`Reply style`,"whale.likes":`Character interests`,"whale.boundaries":`Boundaries and topics to avoid`,"whale.memory":`Lightweight memory`,"whale.memoryEnabled":`Allow saved memory`,"whale.memoryHint":`Uses only the current workspace memory. QQ private-chat and group memory is never read.`,"whale.conflict":`Settings changed elsewhere. Discard your draft and edit again to avoid overwriting newer settings.`,"whale.errorPersona":`Character name and self reference are required. Keep the remaining fields within their length limits.`,"qq.description":`Configure the independent QQ Whale Girl persona, memory and automatic voice delivery.`,"qq.persona":`QQ Whale Girl persona`,"qq.personaUnavailable":`Enable QQ Bot Megaphone before opening this page.`,"qq.personaHint":`Applies to the separate QQ Whale Girl preset on the next turn. Send /preset qq-speech-assistant, then /new in QQ to start using it.`,"qq.personaMemoryHint":`Memory is isolated by bot and private chat or group, and survives /new. Groups store shared information only; DSH workspace memory is never read.`,"qq.voice":`QQ voice delivery and conversion`,"qq.voiceHint":`Uses the saved Host provider and voice. When enabled, each completed QQ Whale Girl reply is synthesized in full and sent as SILK, without a model tool call.`,"qq.automatic":`Automatically convert QQ replies to voice`,"qq.characters":`Automatic voice character limit`,"qq.duration":`Maximum audio segment duration (seconds)`,"qq.limitsHint":`0 means unlimited. Replies above the character limit remain text; explicit voice requests remain available.`,"qq.ruleHint":`Only verified QQ conversations can deliver to QQ. DSH chats are never forwarded, and idle chats never trigger messages.`,"qq.memory":`QQ memory review and editing`,"qq.memoryHint":`Review saved private-chat and group memory from QQBot. Edits and deletions are written to that object immediately; group memory is visible to the group.`,"qq.memoryLoading":`Loading QQ memory…`,"qq.memoryUnavailable":`QQBot is not running or no readable session memory is available.`,"qq.memoryEmpty":`No saved QQ memory.`,"qq.memorySaved":`QQ memory updated.`,"qq.memoryError":`Could not update QQ memory. Try again.`,"qq.group":`Group`,"qq.private":`Private`,"qq.pauseMemory":`Pause saving`,"qq.resumeMemory":`Resume saving`,"qq.clearMemory":`Clear`,"qq.editMemory":`Save edit`,"qq.deleteMemory":`Delete`,"qq.memoryKind.preference":`Preference`,"qq.memoryKind.requirement":`Requirement`,"qq.memoryKind.topic":`Topic`,"qq.unavailable":`Enable this plugin’s speech service first.`,"qq.error":`Use integer limits of 0–12000 characters and 0–6000 seconds.`},di={"passport.workspace":`工作目录`,"passport.workspaceHint":`新建会话使用下方目录,已有会话保留自己的目录。`,"passport.newSession":`刷新预设并新建会话`,"passport.reloadPresets":`刷新预设列表`,"passport.hostDefault":`跟随宿主默认预设`,"passport.presetsLoading":`正在读取预设…`,"passport.presetsFailed":`无法读取预设,请确认预设服务已启用后刷新列表。`,"passport.presetChanged":`预设已更改,请点击“刷新预设并新建会话”应用。`,"passport.presetUnavailable":`所选预设不可用,请从列表重新选择。`,"passport.sessionFailed":`会话未能恢复,请检查宿主日志,或选择预设后新建会话。`,"passport.sessionRenewed":`新会话已请求,等待设备自动连接;旧聊天记录保留。`,"passport.sessionRevision":`会话刷新标识`,"passport.computerIp":`电脑 IP`,"passport.networkHint":`支持同一局域网 Wi-Fi 或电脑的 2.4 GHz 热点。选择设备所在网络能访问的地址;Windows 热点通常为 192.168.137.1。`,"passport.codeLabel":`4 位配对码`,"passport.matchCode":`在设备端填写相同的四个数字,前面的 0 也要填写。`,"passport.codeEmpty":`点击上方按钮,生成配对码并开启连接。`,"passport.codeSaved":`已保存配对凭证。需要查看新码时可重新生成,并同步更新设备。`,"passport.deviceSetup":`在设备端填写对应信息`,"passport.deviceSetupHint":`长按 OK → 重新配置,手机连接 DSH-Voice-* 热点后打开 192.168.4.1。在“电脑连接”中依次填写这里的“电脑 IP”和“4 位配对码”,再保存并连接。端口与本页监听端口一致;已配网可保留原 Wi-Fi。`,"passport.reloadRequired":`请重新加载 AI Passport 连接器,以使用新版连接状态。`,"passport.quickTitle":`连接设备`,"passport.quickHint":`点击下方按钮,自动开放局域网连接并生成 4 位数字配对码。设备只需填写电脑 IP 和配对码。`,"passport.quickEnable":`生成配对码`,"passport.pairingCode":`设备填写的 4 位配对码:`,"passport.quickSaved":`配对码已更新,请在设备填写新码。`,"passport.advanced":`高级配置(监听、配对码、会话与收音)`,"passport.deviceAddress":`设备填写的电脑 IP(选择设备 Wi-Fi 能访问的地址):`,"passport.copyAddress":`复制 IP`,"passport.copied":`已复制`,"passport.copyFailed":`无法自动复制,请选中上方 IP 手动复制。`,"passport.addressUnavailable":`暂未读取到电脑 IP,请检查网络,或在设备中填写电脑的局域网 IPv4。`,"passport.stepHost":`电脑:确认组件开关已开启(默认开启),再点击“生成配对码并开启连接”。`,"passport.stepDevice":`设备:连接同一局域网,填写电脑 IP 和最新 4 位配对码,端口默认 3101。连接 Windows 移动热点时,选择热点网卡地址(通常为 192.168.137.1)。`,"passport.stepTalk":`看到“准备好了”后,短按 OK 开麦;说完停顿,等待回复。`,"passport.devScope":`4 位配对码适用于局域网设备连接。重新生成会替换旧码;刷新页面后可再次生成。`,"passport.statusLoading":`正在读取连接状态…`,"passport.servicesWaiting":`正在等待宿主服务:请确认 DSH 已启用 @deepseek-ai/dsh-experimental-speech-to-text 和识别模型,重启 DSH 后重试;对话模型与 TTS 也需可用。`,"passport.notListening":`尚未开始监听,请生成配对码并开启连接。`,"passport.localOnly":`当前仅本机可访问,设备无法连接;点击上方按钮可修正。`,"passport.asrWaiting":`已开始监听,但宿主 ASR 未准备好;请先在 DSH 语音输入设置中准备模型。`,"passport.deviceConnected":`设备已连接,可以短按 OK 开麦。`,"passport.deviceWaiting":`正在监听,等待设备连接。`,"passport.portInUse":`端口被占用,请在高级配置中更换端口,设备也填写同一端口。`,"passport.listenFailed":`监听启动失败,请检查高级配置中的地址与端口。`,"passport.title":`AI Passport 连接器`,"passport.description":`通过 Wi-Fi 与 DSH 语音对话,使用宿主语音识别、Agent 预设和已保存的 TTS 音色。`,"passport.guide":`查看 AI Passport 接入教程`,"passport.requirements":`连接器默认开启;确认开关已打开后生成 4 位配对码。电脑和设备需处于可互通的局域网,本页会显示可填写的电脑 IP。`,"passport.connection":`设备连接`,"passport.connectionHint":`设备与 DSH 主机需处于可互通的网络,主机和设备填写相同的 4 位配对码。`,"passport.host":`监听地址`,"passport.hostHint":`快捷连接自动使用 0.0.0.0 监听;设备端填写页面上方的电脑 IP。127.0.0.1 仅供本机测试。`,"passport.port":`监听端口`,"passport.portHint":`默认 3101,连接路径为 /api/realtime。设备配网页面与这里填写相同端口。`,"passport.accessToken":`设备配对码`,"passport.accessTokenHint":`填写 4 位数字,与设备保持一致;也可使用上方按钮自动生成。留空保留已保存的配对码。`,"passport.deviceId":`允许的设备 ID(可选)`,"passport.deviceIdHint":`留空允许首个认证设备。填写固件的 client.instance_id,通常为 bean_ 加设备 MAC 的十六进制值。`,"passport.session":`专用会话`,"passport.sessionHint":`选择预设后点击“刷新预设并新建会话”。当前对话会中断,设备自动重连;旧聊天记录保留,新会话从所选预设开始。`,"passport.agentPreset":`Agent 预设 ID(可选)`,"passport.agentPresetHint":`列表来自当前 DSH,显示名称及实际 ID。刚启用的新预设可点击“刷新预设列表”加载;普通保存仍保留当前会话。`,"passport.cwd":`工作目录(可选)`,"passport.cwdHint":`默认 ~/.dsh-xiaomi-tts/passport/workspace,不存在时自动创建。支持 ~/ 用户目录;已有会话保留原工作目录。`,"passport.capture":`收音与断句`,"passport.captureHint":`建议先保留默认值。切句过早时延长静音时间;噪声误触发时提高语音阈值。`,"passport.silenceMs":`断句静音时长(ms)`,"passport.silenceMsHint":`200–3000 ms,默认 700 ms。说完后持续静音多久才提交识别。`,"passport.minSpeechMs":`最短有效语音(ms)`,"passport.minSpeechMsHint":`100–1000 ms,默认 200 ms。过滤过短的碰撞声或杂音。`,"passport.speechThreshold":`语音能量阈值`,"passport.speechThresholdHint":`归一化 RMS,0.001–0.5,默认 0.015。越高越不易被环境声音触发。`,"passport.maxRecordingSeconds":`最长录音(秒)`,"passport.maxRecordingSecondsHint":`1–60 秒,默认 30 秒,包含预录和尾部静音。超长录音不提交。`,"passport.limits":`回复与超时`,"passport.limitsHint":`回复先完整合成,再发送到设备;播放期间暂停收音,按 DOWN 可取消当前任务。`,"passport.maxReplySeconds":`最长语音回复(秒)`,"passport.maxReplySecondsHint":`1–120 秒,默认 60 秒。超长回复不发声,不截断会话中的文字。`,"passport.requestTimeoutMs":`整轮等待上限(ms)`,"passport.requestTimeoutMsHint":`10000–600000 ms,默认 180000 ms。包括识别、对话和播报;超时后取消本轮。`,"passport.loading":`正在读取 AI Passport 连接器配置…`,"passport.unavailable":`AI Passport 连接器尚未加载。请先在组件列表开启它;开启或更新插件后需重启 DSH,再重新打开本页填写配置。未设置有效配对码时不会监听网络。`,"passport.waiting":`尚未开始监听,请点击生成配对码并开启连接。`,"passport.tokenSaved":`已设置,留空保留原配对码`,"passport.error":`请检查以下配置:`,"passport.loopback":`当前监听地址仅供本机测试,设备无法通过 Wi-Fi 连接。接入前请改为主机的局域网地址。`,"passport.savedHint":`配置保存后由宿主应用,正在进行的识别或播放可能被取消。设备连接和音质需在真实硬件上验证。`},fi={"passport.workspace":`Working directory`,"passport.workspaceHint":`New conversations use this directory. Existing conversations retain their own directory.`,"passport.newSession":`Apply preset and start a new conversation`,"passport.reloadPresets":`Reload presets`,"passport.hostDefault":`Use the Host default preset`,"passport.presetsLoading":`Loading presets…`,"passport.presetsFailed":`Cannot load presets. Enable the preset service, then reload the list.`,"passport.presetChanged":`The preset changed. Apply it with a new conversation to continue.`,"passport.presetUnavailable":`This preset is unavailable. Choose another from the list.`,"passport.sessionFailed":`Could not resume the conversation. Check the Host logs or start a new conversation with a selected preset.`,"passport.sessionRenewed":`New conversation requested. Waiting for the device to reconnect; previous history is retained.`,"passport.sessionRevision":`Conversation refresh identifier`,"passport.computerIp":`Computer IP`,"passport.networkHint":`Use Wi-Fi on the same LAN or the computer’s 2.4 GHz hotspot. Choose an address reachable from the device’s network; Windows hotspots usually use 192.168.137.1.`,"passport.codeLabel":`4-digit pairing code`,"passport.matchCode":`Enter these four digits on the device, including any leading zero.`,"passport.codeEmpty":`Generate a code and enable the connection using the button above.`,"passport.codeSaved":`Pairing credentials are saved. Generate a new code if needed, then update the device too.`,"passport.deviceSetup":`Enter matching values on the device`,"passport.deviceSetupHint":`Hold OK → Reconfigure. Connect your phone to DSH-Voice-* and open 192.168.4.1. Under Computer connection, enter the Computer IP and 4-digit pairing code shown here, then save and connect. Match the listening port; keep the existing Wi-Fi if already configured.`,"passport.reloadRequired":`Reload AI Passport Connector to use the updated connection status.`,"passport.quickTitle":`Connect your device`,"passport.quickHint":`Enable LAN access and generate a four-digit pairing code with one click. Enter only the computer IP and code on the device.`,"passport.quickEnable":`Generate pairing code`,"passport.pairingCode":`Four-digit code for the device:`,"passport.quickSaved":`Pairing code updated. Enter the new code on the device.`,"passport.advanced":`Advanced settings (listener, pairing, conversation and capture)`,"passport.deviceAddress":`Computer IP for the device (choose an address reachable from its Wi-Fi):`,"passport.copyAddress":`Copy IP`,"passport.copied":`Copied`,"passport.copyFailed":`Copy is unavailable. Select the IP above and copy it manually.`,"passport.addressUnavailable":`No computer IP is available yet. Check networking or enter its LAN IPv4 on the device.`,"passport.stepHost":`Computer: confirm the component is enabled (on by default), then generate a code and enable the connection.`,"passport.stepDevice":`Device: join the same LAN and enter the computer IP and latest four-digit code. Port defaults to 3101. For a Windows mobile hotspot, use its adapter address (usually 192.168.137.1).`,"passport.stepTalk":`When ready, briefly press OK to open the microphone. Speak, then pause for the reply.`,"passport.devScope":`Four-digit pairing accepts local/private LAN devices. Generating a new code replaces the old one; generate again after reloading if needed.`,"passport.statusLoading":`Reading connection status…`,"passport.servicesWaiting":`Waiting for Host services: enable @deepseek-ai/dsh-experimental-speech-to-text and a recognition model, restart DSH, then retry. A conversation model and TTS must also be ready.`,"passport.notListening":`Not listening yet. Generate a pairing code and enable the connection.`,"passport.localOnly":`Only this computer can connect. Use the button above to enable device access.`,"passport.asrWaiting":`Listening, but Host ASR is not prepared. Prepare its model in DSH voice input settings first.`,"passport.deviceConnected":`Device connected. Briefly press OK to start speaking.`,"passport.deviceWaiting":`Listening and waiting for the device.`,"passport.portInUse":`Port occupied. Choose another port under Advanced settings and use it on the device too.`,"passport.listenFailed":`Listener could not start. Check the address and port under Advanced settings.`,"passport.title":`AI Passport Connector`,"passport.description":`Talk to DSH over Wi-Fi using Host speech recognition, Agent presets and your saved TTS voice.`,"passport.guide":`Open the AI Passport setup guide`,"passport.requirements":`The connector is enabled by default; confirm the switch is on, then generate a four-digit pairing code. Keep the computer and device on a reachable LAN; available computer IPs appear below.`,"passport.connection":`Device connection`,"passport.connectionHint":`The device must reach the DSH host over the network. Use the same four-digit pairing code on both ends.`,"passport.host":`Listen address`,"passport.hostHint":`Quick connection listens on 0.0.0.0. Enter a computer IP shown above on the device; 127.0.0.1 is for local tests only.`,"passport.port":`Listen port`,"passport.portHint":`Defaults to port 3101 and /api/realtime. Enter the same port in device setup.`,"passport.accessToken":`Device pairing code`,"passport.accessTokenHint":`Enter four digits matching device setup, or generate a code above. Leave blank to keep the saved code.`,"passport.deviceId":`Allowed device ID (optional)`,"passport.deviceIdHint":`Leave blank to accept the first authenticated device. Otherwise use its client.instance_id, typically bean_ followed by its hexadecimal MAC.`,"passport.session":`Dedicated conversation`,"passport.sessionHint":`Choose a preset, then apply it with a new conversation. This interrupts the current turn and reconnects the device automatically. Previous conversation history is retained.`,"passport.agentPreset":`Agent preset ID (optional)`,"passport.agentPresetHint":`The list comes from this DSH instance and shows names with actual IDs. Reload the list after enabling a new preset. A normal settings save retains the current conversation.`,"passport.cwd":`Working directory (optional)`,"passport.cwdHint":`Defaults to ~/.dsh-xiaomi-tts/passport/workspace and is created automatically. Supports ~/ for the user home. Existing conversations retain their directory.`,"passport.capture":`Capture and segmentation`,"passport.captureHint":`Start with the defaults. Increase silence duration for premature cuts, or the energy threshold when noise triggers recording.`,"passport.silenceMs":`End-of-speech silence (ms)`,"passport.silenceMsHint":`200–3000 ms; default 700 ms. The silence required before submitting speech for recognition.`,"passport.minSpeechMs":`Minimum speech (ms)`,"passport.minSpeechMsHint":`100–1000 ms; default 200 ms. Filters very short bumps and noise.`,"passport.speechThreshold":`Speech energy threshold`,"passport.speechThresholdHint":`Normalized RMS, 0.001–0.5; default 0.015. Higher values reject more ambient sound.`,"passport.maxRecordingSeconds":`Maximum recording (seconds)`,"passport.maxRecordingSecondsHint":`1–60 seconds; default 30, including pre-roll and trailing silence. Oversized recordings are not submitted.`,"passport.limits":`Replies and timeouts`,"passport.limitsHint":`Replies are fully synthesized before sending. Capture pauses during playback; press DOWN to cancel the current task.`,"passport.maxReplySeconds":`Maximum spoken reply (seconds)`,"passport.maxReplySecondsHint":`1–120 seconds; default 60. Longer replies are not spoken; conversation text is not truncated.`,"passport.requestTimeoutMs":`Whole-request timeout (ms)`,"passport.requestTimeoutMsHint":`10000–600000 ms; default 180000. Covers recognition, the conversation and playback. Expiry cancels the request.`,"passport.loading":`Loading AI Passport Connector settings…`,"passport.unavailable":`AI Passport Connector is not loaded yet. Enable it in the component list; after enabling it or updating the plugin, restart DSH and reopen this page to configure it. Nothing listens until a valid pairing code is set.`,"passport.waiting":`Generate a pairing code and enable the connection to start listening.`,"passport.tokenSaved":`Already set; leave blank to keep`,"passport.error":`Check this setting: `,"passport.loopback":`This address only accepts local connections. Use the host’s LAN address before connecting a Wi-Fi device.`,"passport.savedHint":`The Host applies saved settings and may cancel active recognition or playback. Verify connections and audio on real hardware.`},pi={"settings.externalManage":`プロバイダーを管理`,"settings.externalProviderAdapter":`プロバイダーアダプター`,"settings.acceptExternalProviders":`外部プロバイダーを受け入れる`,"settings.acceptExternalProvidersHint":`外部プラグインの音声を使用します。オフにして保存すると内蔵プロバイダーに戻ります。`,"settings.externalSwitchFailed":`プロバイダーを切り替えられませんでした。もう一度お試しください。`,"settings.externalOptionsHint":`利用できる機能は外部プラグインが指定します。`,"settings.externalManaged":`外部プラグインで管理されています。音声はそのプラグインで設定してください。`,"settings.externalNotReady":`外部音声サービスの準備ができていません。プラグインの設定を確認してください。`,"settings.externalDisconnected":`音声サービスの接続が切れました。再接続するまで新しい合成を停止します。`,"settings.externalLoading":`外部音声サービスで音声を生成しています`,"settings.externalPlaying":`外部サービスの音声を再生しています`,"settings.externalCompleted":`外部音声の試聴が完了しました`,"settings.previewPresets":`サンプル文`,"settings.previewPresetGreeting":`挨拶`,"settings.previewPresetPoetry":`詩`,"settings.previewPresetInspiration":`励まし`,"settings.previewPresetReflection":`随想`,"settings.previewPresetHumor":`ユーモア`,"settings.previewPresetNews":`ニュース`,"settings.previewPresetStory":`物語`,"settings.previewPresetService":`ご案内`,"settings.previewPresetDialogue":`会話`,"settings.previewDefaultTextStory":`閉店間際の古書店に、一匹の茶トラ猫が入ってきました。猫は誰も開いたことのない旅日記の上で丸くなりました。`,"settings.previewDefaultTextService":`こんにちは。音声サービスへようこそ。お困りのことをお聞かせください。一緒に順番に解決していきましょう。`,"settings.previewDefaultTextDialogue":`覚えていてくれたの?私だけだと思っていた。よかった。私たちはずっと、同じ方向へ歩いていたんだね。`,"settings.previewDefaultTextNews":`夜のニュースです。市立図書館に夜間読書エリアがオープンしました。仕事帰りにも静かに本を楽しめます。`,"settings.previewDownload":`現在の試聴音声をダウンロード`,"settings.previewDownloadUnavailable":`試聴音声の生成後にダウンロードできます`,"settings.previewDownloadLocal":`ブラウザー音声はダウンロードできません。クラウド音声または MOSS をお試しください。`,"settings.previewDownloadFailed":`ダウンロードできませんでした。もう一度お試しください。`,...ci,...ui,...fi,"settings.moreProviders":`その他のプロバイダー`,"settings.breezeEnabled":`Breeze Blue を有効にする`,"settings.providerMinimum":`Xiaomi は常に有効です。豆包か Breeze のどちらかを有効にしてください。`,"settings.breezeAudioTags":`オーディオタグ`,"settings.xiaomiAudioTagsHint":`小米のプリセット音声:文頭にスタイル、文中に声のタグを挿入できます。()・()・[]、自由記述と組み合わせに対応。歌唱は文頭に挿入します。音声デザインには音声指示を使用してください。`,"settings.breezeAudioTagsHint":`タグは試聴テキストに挿入されます。中国語は角括弧、英語は丸括弧を使用します。Breeze TTS 専用です。`,"settings.breezeAudioTagsChinese":`中文`,"settings.breezeAudioTagsEnglish":`English`,"settings.audioTagsContinuous":`連続追加`,"settings.audioTagsContinuousHint":`タグパネルを固定`,"settings.providerBreeze":`Breeze`,"settings.breezeCustomVoice":`カスタム音声 ID`,"settings.breezeCustomVoiceHint":`別の Breeze 音声 ID を入力`,"settings.breezeVoiceHistory":`Breeze 音声 ID 履歴`,"settings.breezeVoiceHint":`Breeze 音声 ID`,"settings.voiceReadingHintBreeze":`Breeze の音声 ID を入力してください`,"settings.breezeInstructionHint":`Breeze は場面、意図、感情、リズムに合わせて表現を調整します。空欄では音声の自然な表現を使います`,"settings.breezeInstructionLabelWarmCompanion":`優しく寄り添う`,"settings.breezeInstructionTextWarmCompanion":`親しい友人に寄り添うように、温かく誠実な声で、ゆっくり自然な間を取りながら話してください。`,"settings.breezeInstructionLabelPlayfulTeasing":`茶目っ気`,"settings.breezeInstructionTextPlayfulTeasing":`親しみのある軽い冗談のように、明るく柔軟な抑揚と笑みを含む声で、きつくならないように話してください。`,"settings.breezeInstructionLabelSeriousAnnouncement":`正式な放送`,"settings.breezeInstructionTextSeriousAnnouncement":`プロのアナウンサーのように、客観的で落ち着いた口調と適度な速さで、重要な情報の前後に自然な間を入れて読んでください。`,"settings.breezeInstructionLabelEncouragingSupport":`力強い励まし`,"settings.breezeInstructionTextEncouragingSupport":`信頼と支えを伝える温かくしっかりした声で励まし、叫ばずに少しずつ明るい調子にしてください。`,"settings.breezeInstructionLabelSleepyBedtime":`おやすみの声`,"settings.breezeInstructionTextSleepyBedtime":`眠る前におやすみを伝えるように、柔らかく力を抜いた声で、ゆっくり穏やかな語尾と静かな間で話してください。`,"settings.breezeInstructionLabelWhisperFear":`怯えたささやき`,"settings.breezeInstructionLabelExcitedSurprise":`興奮した驚き`,"settings.breezeInstructionLabelSarcasticDisbelief":`皮肉と呆れ`,"settings.breezeInstructionLabelNervousHumor":`緊張したユーモア`,"settings.breezeInstructionLabelRestrainedGrief":`抑えた悲しみ`,"settings.breezeInstructionLabelCalmNarration":`落ち着いたナレーション`,"settings.breezeInstructionTextWhisperFear":`誰かに聞かれないように、非常に小さく緊張した声でささやく。`,"settings.breezeInstructionTextExcitedSurprise":`明るく驚きに満ちた、徐々に高まるエネルギーで話す。`,"settings.breezeInstructionTextSarcasticDisbelief":`乾いた皮肉と呆れた調子で、明らかに悪い考えだったかのように話す。`,"settings.breezeInstructionTextNervousHumor":`緊張を隠すように、最初の句の後で小さく笑う。`,"settings.breezeInstructionTextRestrainedGrief":`涙をこらえ、少し震えた声と抑えた間で悲しみを表現する。`,"settings.breezeInstructionTextCalmNarration":`落ち着いた明瞭なナレーターとして、一定の速さと自然な間で読む。`,"detail.star":`Star`,"detail.manual":`マニュアル`,"detail.workshop":`工房`,"detail.keyLoading":`キーを確認中`,"detail.keyMissing":`キー未設定`,"detail.keyRecognized":`キー形式を認識しました`,"detail.keyUnrecognized":`未対応のキー形式`,"detail.keyUnavailable":`キーを確認できません`,"detail.retry":`再確認`,"detail.preview":`プラグイン詳細`,"detail.previewChanging":`プラグインの変更を再現`,"detail.previewKey":`キー状態の再現`,"plugin.changing":`プラグインの変更中は、音声再生を一時停止します。`,"onboarding.title":`新機能のご紹介`,"onboarding.summary":`外部音声プロバイダーに対応。選べる声が増えました。`,"onboarding.details":`更新の詳細`,"onboarding.externalSpeechTitle":`外部音声プロバイダーを接続`,"onboarding.externalVoicesTitle":`音色工坊で声を選択`,"onboarding.externalSwitchTitle":`プロバイダーを手軽に切り替え`,"onboarding.featureExternalSpeech":`外部音声プロバイダーに対応`,"onboarding.featureExternalVoices":`工坊でモデル・音色・音声タグを選択`,"onboarding.featureExternalSwitch":`上部カードでプロバイダーを切り替え`,"onboarding.configure":`音色工坊を開く`,"onboarding.github":`Starで応援する`,"onboarding.preview":`ブラウザー音声を試聴`,"onboarding.dismiss":`あとで`,"onboarding.sample":`こんにちは、クジラメイドです。声の準備ができました。一緒に新しい世界を探しましょう。`,"settings.announcementsApprovals":`承認リマインダー`,"settings.announcementsApprovalsHint":`この会話の承認待ち操作を通知します。承認または取り消しで停止します`,"settings.announcementsJobs":`バックグラウンドタスクの結果`,"settings.announcementsJobsHint":`この会話で実行を確認したタスクの結果を通知します。タスクサービスが必要です`,"announcements.approval":`承認を待っている操作があります。`,"announcements.job":`バックグラウンドタスク`,"announcements.jobCompleted":`終了しました。`,"announcements.jobFailed":`失敗しました。`,"announcements.jobKilled":`キャンセルされました。`,"settings.soundEffectsScope":`効果音の対象`,"settings.announcementsWhale":`dsh-whale-musume`,"settings.announcementsQuestions":`質問カードのタイトル`,"settings.announcementsPetHint":`ペットのつぶやき、返答、食事メッセージを読み上げます`,"settings.announcementsWhaleHint":`Whale Girl からの音声リクエストを許可します`,"settings.announcementsQuestionsHint":`自動読み上げに合わせて現在の質問を読みます。移動や終了で停止します`,"settings.announcementsNone":`有効な通知元がありません`,"settings.inputAvoidance":`入力中は読み上げを控える`,"settings.inputAvoidanceHint":`入力欄にフォーカスがあり未送信の文章がある間、自動読み上げを停止します。離れるか空にすると新しい読み上げを許可し、補完再生はしません。手動試聴は利用できます。`,"settings.importantAnnouncementsFirst":`重要な通知を優先`,"settings.importantAnnouncementsFirstHint":`承認待ちとバックグラウンドタスク失敗の通知は通常の読み上げを中断できます。音声入力と入力中の抑制を優先します。`,"settings.hostIntegration":`ホスト連携`,"settings.showInHostSettings":`ホスト設定の入口`,"settings.showInHostSettingsHint":`DSH 設定に「音声読み上げ」の設定を表示します。保存後に適用されます。`,"settings.voiceInputCompatibility":`音声入力を優先`,"settings.voiceInputCompatibilityHint":`DSH 公式の音声入力中は読み上げと効果音を停止し、録音・文字起こし中も再生しません。中断した音声は再開しません。保存後に適用されます。`,"settings.announcementsTitle":`通知元`,"settings.announcementsPlugins":`プラグイン連携`,"settings.announcementsPluginsHint":`対応するプラグインのインストールと有効化が必要です`,"settings.passportIntegration":`Ai Passport アプリ`,"settings.passportIntegrationHint":`WhaleTalk Passport:持ち歩ける DSH 音声対話端末`,"settings.qqbotIntegration":`QQ Bot`,"settings.qqbotIntegrationHint":`オンでは全文を自動で音声送信し、オフでは依頼時のみ送信します。QQ Bot Megaphone を有効にし、保存してください`,"settings.announcementsPet":`dsh-pet`,"settings.announcementsHint":`音声を有効にし、DSH Web を開いておいてください。再生中に届いた通知はスキップします`,"settings.provider":`音声サービス`,"settings.providerXiaomi":`Xiaomi MiMo`,"settings.providerDoubao":`Doubao Voice`,"settings.switchProvider":`サービスを切り替え`,"settings.doubaoStandardModel":`標準音声合成(seed-tts-2.0)`,"settings.doubaoCloneModel":`音声クローン(seed-icl-2.0)`,"settings.speechInstruction":`読み上げ指示`,"settings.speechInstructionPresets":`読み上げ指示のプリセット`,"settings.speechInstructionCustom":`カスタム指示`,"settings.mimoInstructionHint":`Xiaomi 用のスタイル指定です。空欄なら標準の読み方を使います。音色デザインの声の説明は維持されます`,"settings.doubaoInstructionHint":`Doubao 標準音声の指示です。空欄なら音色本来の読み方を使います`,"settings.mimoInstructionGentlePrompt":`温かく優しい口調で、柔らかく明瞭に発音し、語尾を穏やかにしてください。`,"settings.mimoInstructionCheerfulPrompt":`良い知らせを伝えるように、明るく弾む口調と軽快なテンポで、強弱を生き生きと付けてください。`,"settings.mimoInstructionCalmPrompt":`落ち着いた口調で、一定のテンポと明確な間を保ち、感情を控えめにしてください。`,"settings.mimoInstructionStoryPrompt":`物語の語り手として、展開に合わせて強調や間を変え、奥行きのある朗読にしてください。`,"settings.mimoInstructionArgumentPrompt":`怒りを帯びた鋭い反論の口調で、強いアクセントと短く力強いフレーズを使ってください。`,"settings.mimoInstructionWhisperPrompt":`近くで秘密を伝えるように、音量を抑えて柔らかく、ゆっくりささやいてください。`,"settings.mimoInstructionCutePrompt":`軽やかで甘い口調で、発音を軽く、語尾を少し上げ、遊び心を添えてください。`,"settings.mimoInstructionCantonesePrompt":`広東語の発音で、自然で滑らかな抑揚を付けて読んでください。`,"settings.mimoInstructionHenanPrompt":`河南方言の発音と抑揚で、会話のテンポを保って読んでください。`,"settings.mimoInstructionSichuanPrompt":`四川方言の発音と抑揚で、自然な会話のテンポで読んでください。`,"settings.mimoInstructionDongbeiPrompt":`中国東北方言の発音と抑揚で、朗らかな表現と自然なリズムで読んでください。`,"settings.speechInstructionPlaceholder":`例:優しく、明るく、物語を語るように`,"settings.speechInstructionHint":`感情、口調、スタイルを指定します。空欄なら標準の読み方になります`,"settings.speechInstructionInfo":`読み上げ指示の制限`,"settings.speechInstructionLimitations":`Xiaomi と Doubao 標準音声の指示は別々に保存されます。効果はモデル、音色、文章によって異なるため、先に試聴してください。
5
+ `)}function finalLiveMessage(e,t,n){for(let r=e.nodes.length-1;r>=0;--r){let i=e.nodes[r];if(i?.kind===`assistant`&&i.messageId!==void 0&&i.turn===t&&i.step===n)return{messageId:i.messageId,turn:i.turn,step:i.step,text:assistantText(i.blocks),interrupted:i.interrupted===!0}}return null}function messageLiveIdentity(e,t){for(let n of e.nodes)if(n.kind===`assistant`&&n.messageId===t)return{turn:n.turn,step:n.step};return null}function hostRoute(e){let t=e.replace(/^\/+/,``);return typeof document>`u`?`/${t}`:new URL(t,document.baseURI).pathname}function hostWebSocketUrl(e){let t=globalThis.__DSH_TRANSPORT__?.streamBaseUrl??(typeof document>`u`?globalThis.location?.href??`http://localhost/`:document.baseURI),n=new URL(e.replace(/^\/+/,``),t);return n.protocol=n.protocol===`https:`?`wss:`:`ws:`,n.href}var ApiKeyStatusStore=class{available=!0;entries=new Map;entry(e){let t=this.entries.get(e);return t===void 0&&(t={status:`loading`,listeners:new Set,request:null},this.entries.set(e,t)),t}getSnapshot=e=>this.entry(e).status;subscribe(e,t){let n=this.entry(e);return n.listeners.add(t),this.load(e,n),()=>{n.listeners.delete(t),n.listeners.size===0&&this.reset(n)}}setAvailable(e){this.available!==e&&(this.available=e,this.invalidate())}invalidate=()=>{for(let[e,t]of this.entries){this.reset(t),this.load(e,t);for(let e of t.listeners)e()}};reset(e){let t=e.request;e.request=null,t?.abort(),e.status=`loading`}load(e,t){if(!this.available||t.listeners.size===0||t.request!==null||t.status!==`loading`)return;let n=new AbortController;t.request=n;let publish=e=>{if(t.request===n){t.request=null,t.status=e;for(let e of t.listeners)e()}};(async()=>{try{let t=await fetch(`${hostRoute(`/plugins/xiaomi-mimo-tts/api-key-status`)}?provider=${e}`,{cache:`no-store`,headers:{accept:`application/json`},signal:n.signal});if(!t.ok)throw Error(`api-key-status-failed`);let r=await t.json();if(typeof r!=`object`||!r||!(`configured`in r)||typeof r.configured!=`boolean`||!(`supported`in r)||typeof r.supported!=`boolean`)throw Error(`api-key-status-invalid`);publish(r.configured?r.supported?`recognized`:`unrecognized`:`missing`)}catch{publish(`unavailable`)}})()}};let ni=new ApiKeyStatusStore;function bindApiKeyStatus(e,t,n=ni){let r=e.getSnapshot().revision,update=()=>{let i=e.getSnapshot(),a=i.status===`ready`&&!t.getSnapshot();Object.is(r,i.revision)||(r=i.revision,n.setAvailable(!1)),n.setAvailable(a)},i=e.subscribe(update),a=t.subscribe(update);return update(),()=>{i(),a(),n.setAvailable(!1)}}var EngineStateStore=class{view={status:`inactive`,engine:null};listeners=new Set;getSnapshot=()=>this.view;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});publish(e,t=this.view.engine){if(!(this.view.status===e&&JSON.stringify(this.view.engine)===JSON.stringify(t))){this.view={status:e,engine:t};for(let e of this.listeners)e()}}start(){this.publish(`connecting`);let e=!1,t=null,n=new EventSource(hostRoute(`/plugins/xiaomi-mimo-tts/engine-events`)),refresh=async()=>{t?.abort();let n=new AbortController;t=n;try{let t=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/engine-state`),{signal:n.signal,cache:`no-store`});if(!t.ok)throw Error(`engine-state-unavailable`);let r=await t.json();!e&&!n.signal.aborted&&this.accept(r)}catch{!e&&!n.signal.aborted&&this.publish(`unknown`)}};return n.onopen=()=>{refresh()},n.onmessage=n=>{try{t?.abort(),e||this.accept(JSON.parse(n.data))}catch{e||this.publish(`unknown`)}},n.onerror=()=>{t?.abort(),e||this.publish(`unknown`)},()=>{e=!0,t?.abort(),n.close(),this.publish(`inactive`,null)}}accept(e){if(!e||!Number.isSafeInteger(e.revision)||typeof e.provider!=`string`||typeof e.ready!=`boolean`||typeof e.name!=`string`||!Array.isArray(e.formats)||!e.formats.includes(`wav`)||!Number.isSafeInteger(e.maxTextLength)||e.maxTextLength<1||typeof e.streaming!=`boolean`){this.publish(`unknown`);return}this.publish(`ready`,e)}};let ri=new EngineStateStore,externalEngine=()=>{let e=ri.getSnapshot().engine;return e?.provider.startsWith(`external:`)?e:null},engineSupportsRealtime=e=>externalEngine()?.streaming??supportsRealtimeTts(e);function externalAudioTags(e){let t=externalEngine();return t?.models?.find(n=>n.id===(e?.model??t.selection?.model))?.audioTags??[]}let externalText=(e,t)=>prepareExternalTtsText(e,externalAudioTags(t).map(e=>e.value)),externalFallbackText=(e,t)=>{for(let n of externalAudioTags(t))e=e.split(n.value).join(` `);return prepareExternalTtsText(e)},engineText=(e,t)=>externalEngine()?externalText(e):t(),engineMaxTextLength=(e=12e3)=>externalEngine()?.maxTextLength??e,engineCanRequest=()=>[`inactive`,`ready`].includes(ri.getSnapshot().status);function splitExternalText(e,t=engineMaxTextLength(),n){let r=[];for(let i of splitTtsSegments(e,Math.min(180,t),t,e=>externalText(e,n))){let e=``;for(let n of i.match(/<[^>]*>|\([^()]*\)|./gu)??[]){if(n.length>t)throw Error(`text-too-long`);e.length+n.length>t&&(r.push(e),e=``),e+=n}e.trim()&&r.push(e)}return r}function speechRequestBody(e,t){let n=ri.getSnapshot();if(!engineCanRequest())throw Error(`speech-engine-unavailable`);let r=externalEngine();return r?{text:e.text,provider:r.provider,engineRevision:r.revision,...t?{model:t.model,voice:t.voice,speechInstruction:t.speechInstruction??``}:{},...e.format===void 0?{}:{format:r.formats.includes(e.format)?e.format:`wav`}}:{...e,...n.engine?{engineRevision:n.engine.revision}:{}}}function useEngineState(){return(0,l.useSyncExternalStore)(ri.subscribe,ri.getSnapshot,ri.getSnapshot)}let ii=new Set;function onTtsCredentialsSaved(e){return ii.add(e),()=>{ii.delete(e)}}function invalidateApiKeyStatus(){ni.invalidate();for(let e of ii)e()}function useApiKeyStatus(e,t){let n=useEngineState(),r=externalEngine();e&&=!r;let i=(0,l.useCallback)(n=>e?ni.subscribe(t,n):()=>{},[e,t]),a=(0,l.useCallback)(()=>e?ni.getSnapshot(t):`loading`,[e,t]),o=(0,l.useSyncExternalStore)(i,a,a);return r?n.status===`ready`?r.ready?`recognized`:`missing`:`unavailable`:o}function useApiKeySupported(e,t=`xiaomi`){let n=useApiKeyStatus(e,t);return n===`loading`||n===`unavailable`?null:n===`recognized`}function readAloudText(e,t,n){return externalEngine()?applyTtsPlaybackScope(e,t.readScope,n,void 0,externalText):t.provider===`breeze`?applyBreezeTtsPlaybackScope(e,t.readScope,n):applyTtsPlaybackScope(e,t.readScope,n,void 0,e=>prepareProviderTtsText(e,t))}function fallbackText(e,t){return externalEngine()?externalFallbackText(e):t.provider===`breeze`?stripBreezeAudioTags(e):t.provider===`xiaomi`?stripXiaomiAudioTags(e):e}function playCompletedReply(e,t){let{sessionId:n,messageId:r,text:i,settings:a,apiKeySupported:o,playback:s,live:c,local:l}=e;c.configure(a),s.configure(a);let u=readAloudText(i,a,t),d=fallbackText(u,a),p=a.localSpeechMode===`auto`?()=>l.playCompleted(n,r,d):void 0,playRemote=()=>{l.cancelSession(n),engineSupportsRealtime(a)?(s.cancelPlayback(n),c.playCompleted(n,r,u,()=>{p===void 0?s.toggle(n,r,u,t,void 0,`mp3`):p()})):(c.cancelSession(n),externalEngine()||splitTtsSegments(u).length>1?s.segmented(n,r,u,t,p):s.toggle(n,r,u,t,p,`mp3`))};a.localSpeechMode===`local-first`||a.localSpeechMode===`auto`&&o===!1?(c.cancelSession(n),s.cancelPlayback(n),l.playCompleted(n,r,d,a.localSpeechMode===`local-first`?playRemote:void 0)):playRemote()}function handleReadAloudClick(e,t){let{sessionId:n,messageId:r,text:i,turn:a,settings:o,playback:s,live:c,local:l}=e,u=t.sessionId===n&&t.messageId===r;if(u&&(t.source===`live`||t.source===`system`)){let e=t.source===`system`?l:c;if(t.status===`loading`){e.stop(n)&&a!==void 0&&(c.blockTurn(n,a),l.blockTurn(n,a)),s.cancelPlayback(n);return}if(t.status===`playing`){e.pause(n);return}if(t.status===`paused`){e.resume(n);return}}if(u&&t.source===`complete`){s.toggle(n,r,i,!1);return}if(u&&t.source===`segmented`){if(t.status===`playing`||t.status===`loading`)s.pauseSegmented(n,r);else{let e=readAloudText(i,o,!1),t=fallbackText(e,o);s.segmented(n,r,e,!1,o.localSpeechMode===`auto`?()=>l.playCompleted(n,r,t):void 0)}return}playCompletedReply(e,!1)}let ai=`dsh-xiaomi-tts:audio-owner`,oi={canPlay:()=>!0,subscribe:()=>()=>{},claim:()=>{}};var TabAudioFocus=class{id=crypto.getRandomValues(new Uint32Array(4)).join(`-`);listeners=new Set;storage=null;active=!1;suspended=!1;owned=!1;constructor(e=window){this.target=e}canPlay=()=>{if(!this.active||this.suspended)return!1;if(this.storage!==null)try{return this.storage.getItem(ai)===this.id}catch{this.storage=null}return this.focused()};subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});claim=()=>{if(!(!this.active||this.suspended||!this.focused())){if(this.storage!==null)try{this.storage.setItem(ai,this.id)}catch{}this.refresh()}};activate(){this.active=!0;try{this.storage=this.target.localStorage}catch{this.storage=null}return this.target.addEventListener(`focus`,this.claim),this.target.addEventListener(`blur`,this.refresh),this.target.addEventListener(`storage`,this.onStorage),this.target.addEventListener(`pagehide`,this.onHide),this.target.addEventListener(`pageshow`,this.onShow),this.target.document.addEventListener(`visibilitychange`,this.onVisibility),this.claim(),()=>{this.target.removeEventListener(`focus`,this.claim),this.target.removeEventListener(`blur`,this.refresh),this.target.removeEventListener(`storage`,this.onStorage),this.target.removeEventListener(`pagehide`,this.onHide),this.target.removeEventListener(`pageshow`,this.onShow),this.target.document.removeEventListener(`visibilitychange`,this.onVisibility),this.active=!1,this.release(),this.refresh()}}focused(){return this.target.document.visibilityState===`visible`&&this.target.document.hasFocus()}refresh=()=>{let e=this.canPlay();if(e!==this.owned){this.owned=e;for(let e of this.listeners)e()}};onStorage=e=>{if(!(e.key!==null&&e.key!==ai)&&e.storageArea===this.storage){if(this.storage!==null)try{this.storage.getItem(ai)===null&&this.claim()}catch{this.storage=null}this.refresh()}};onVisibility=()=>{this.claim(),this.refresh()};onHide=()=>{this.suspended=!0,this.release(),this.refresh()};onShow=()=>{this.suspended=!1,this.claim(),this.refresh()};release(){try{this.storage?.getItem(ai)===this.id&&this.storage.removeItem(ai)}catch{this.storage=null}}};let si={"api-key-rejected":`error.apiKeyRejected`,"voice-unavailable":`error.voiceUnavailable`,"voice-required":`error.voiceUnavailable`,"resource-unavailable":`error.resourceUnavailable`,"rate-limited":`error.rateLimited`,"tts-timeout":`error.timeout`,"pcm-pause-buffer-limit":`error.bufferLimit`,"stream-buffer-limit":`error.bufferLimit`,"no-text":`error.noText`,"local-speech-not-allowed":`error.localNotAllowed`,"local-voice-unavailable":`error.localVoiceUnavailable`,"local-speech-timeout":`error.localTimeout`,"local-speech-audio-device":`error.localAudioDevice`,"local-speech-failed":`error.localSynthesis`,"local-speech-unavailable":`error.localSynthesis`,"moss-unreachable":`error.localMossUnreachable`,"moss-voice-required":`error.localMossVoiceMissing`,"moss-invalid-url":`error.localMossInvalidUrl`,"moss-timeout":`error.localMossTimeout`,"moss-api-error":`error.localMossFailed`,"moss-audio-failed":`error.localMossFailed`,"moss-request-failed":`error.localMossFailed`,"moss-invalid-response":`error.localMossFailed`,"moss-response-too-large":`error.localMossFailed`,"moss-audio-too-large":`error.localMossFailed`,"autoplay-blocked":`error.play`,"play-failed":`error.play`};function ReadAloudAction({sessionId:e,messageId:t,useSession:n,useChat:r,playback:i,live:a,local:o,settings:s,t:c,automaticReading:p,audioFocus:m=oi,automaticAudioFocus:h=m}){let g=(0,l.useSyncExternalStore)(h.subscribe,h.canPlay,h.canPlay),_=n(e=>e),v=r(e=>e.legacy),b=(0,l.useSyncExternalStore)(p.subscribe,p.getSnapshot,p.getSnapshot),x=r(finalAssistantMessageId),S=_.running,C={text:messageText(v,t),time:messageTime(v,t),latestMessageId:b===`final`?x:latestAssistantMessageId(v),identity:messageLiveIdentity(v,t)},w=C.text,E=useSettingsSnapshot(s),D=resolveTtsSettings(E.value),k=useEngineState(),A=useApiKeySupported(g&&D.localSpeechMode!==`disabled`,D.provider);o.setVoiceURI(D.localVoiceURI),o.setMossVoice(D.localVoiceEngine,D.mossBaseURL,D.mossVoice),o.setTimeoutMs(D.requestTimeoutMs);let M=(0,l.useSyncExternalStore)(i.subscribe,i.getSnapshot,i.getSnapshot),P={sessionId:e,messageId:t,text:w,playback:i,live:a,local:o,turn:v.partial?.turn??C.identity?.turn,settings:D,apiKeySupported:A};if((0,l.useEffect)(()=>{if(!engineCanRequest()||!p.allowed(e)||b===`final`&&x!==t||!g||!h.canPlay()||w.length===0||E.value?.enabled!==!0||E.value?.autoPlay!==!0||a.hasHandled(e,C.identity)||o.hasHandled(e,C.identity)||S||C.latestMessageId!==t||C.time===null||C.time<i.autoPlayArmedAt)return;let n=window.setTimeout(()=>{h.canPlay()&&!a.hasHandled(e,C.identity)&&!o.hasHandled(e,C.identity)&&p.allowed(e)&&i.claimAutomaticPlayback(e,t)&&(p.markAutomatic(),playCompletedReply(P,!0))},0);return()=>window.clearTimeout(n)},[k,p,b,x,h,g,A,a,o,C.identity,C.latestMessageId,C.time,t,i,D.localSpeechMode,D.localVoiceEngine,D.mossBaseURL,D.mossVoice,D.model,D.provider,D.doubaoModel,D.doubaoVoice,D.doubaoClonedVoice,D.breezeVoice,D.breezeInstruction,D.readScope,S,e,E.value?.autoPlay,E.value?.enabled,w]),E.value?.enabled!==!0||w.length===0)return null;let F=M.sessionId===e&&M.messageId===t,I=F?M.status:`idle`,V=F?M.source:null,ee=(V===`live`||V===`system`)&&(I===`loading`||I===`playing`),te=c(I===`loading`?V===`complete`?`action.loading`:`action.cancel`:I===`playing`?`action.pause`:I===`paused`?`action.resume`:I===`error`?`action.retry`:`action.play`),re=F?M.error:null,se=re===null?null:c(si[re]??`error.request`),ce=se??(V===`system`&&(I===`loading`||I===`playing`||I===`paused`)?c(`action.localFallback`):null);return(0,d.jsx)(u.Tooltip,{label:ce===null?te:`${te} · ${ce}`,side:`bottom`,portal:!0,children:(0,d.jsx)(u.Button,{type:`button`,variant:`toolbar`,size:`sm`,className:se===null?`xmimo-tts-action`:`xmimo-tts-action xmimo-tts-failed`,"aria-label":te,"aria-description":ce??void 0,"aria-pressed":I===`playing`||ee,disabled:I===`loading`&&V===`complete`,onClick:()=>{m.claim(),m.canPlay()&&(p.markManual(),handleReadAloudClick(P,M))},children:I===`playing`?(0,d.jsx)(AnimatedAudioLines,{size:16}):(0,d.jsx)(RiVoiceAiFill,{className:I===`loading`?`xmimo-tts-pulse`:void 0,size:16})})})}function prepareSpeechText(e,t=!1){let n=t?e.replace(/(?:\[[^\]\r\n]*|\([^()\r\n]*|([^()\r\n]*)$/u,``):e;return(0,u.extractMarkdownPlainText)((t===`xiaomi`?prepareXiaomiTtsText:t?prepareBreezeTtsText:prepareTtsText)(n)).trim()}var RealtimeSpeechSession=class{sessionId=null;turn=null;revision=0;options={localSpeechMode:`auto`,apiKeySupported:null,readScope:`smart`};constructor(e,t){this.live=e,this.local=t}configure(e){this.options=e}activate(e){this.sessionId!==e&&(this.cancel(),this.sessionId=e,this.live.activateSession(e),this.local.activateSession(e))}deactivate(e){this.sessionId===e&&(this.cancel(),this.live.deactivateSession(e),this.local.deactivateSession(e),this.sessionId=null)}cancel(){this.revision+=1,this.turn=null,this.live.setFallbackHandler(null),this.local.setFallbackHandler(null),this.sessionId!==null&&(this.live.cancelSession(this.sessionId),this.local.cancelSession(this.sessionId))}observe(e,t,n,r,i=!1){if(this.sessionId!==e)return;(this.turn===null||this.turn.turn!==t)&&this.beginTurn(t);let a=this.turn,o=a.steps.get(n);if(o===void 0&&(o={cursor:{sessionId:e,turn:t,step:n},limiter:new TtsFirstSegmentLimiter(a.scope===`smart`?2:1,e=>this.live.prepareText(e)),text:``,checkpoint:null,final:null,inputFinished:!1},a.steps.set(n,o)),o.inputFinished)return;o.text=this.scopeText(r,o);let s=this.controller(a.backend);if(i&&(o.checkpoint=o.text,s.prime(e,t,n,this.backendText(a.backend,o.text))),s.observe(e,t,n,this.backendText(a.backend,o.text)),a.backend===`live`&&this.live.isDuplex()&&o.limiter.complete&&a.scope!==`full`){let i=prepareSpeechText(r),c=countTtsSpeechCharacters(o.text);(a.scope===`first-segment`||countTtsSpeechCharacters(i)>=c*2)&&(o.text=this.scopeText(r,o,!0),s.observe(e,t,n,this.backendText(a.backend,o.text)),o.inputFinished=!0,this.live.finishInput(e,t,n))}}finish(e,t){if(this.sessionId!==e||this.turn?.turn!==t.turn)return;let n=this.turn.steps.get(t.step);if(!(n===void 0||n.final!==null)){if(t.interrupted){this.cancel(),this.live.blockTurn(e,t.turn),this.local.blockTurn(e,t.turn);return}n.inputFinished||(n.text=this.scopeText(t.text,n,!0)),n.final={...t,text:n.text},this.controller(this.turn.backend).finish(e,{...n.final,text:this.backendText(this.turn.backend,n.final.text)})}}beginTurn(e){this.cancel();let{localSpeechMode:t,apiKeySupported:n,readScope:r}=this.options,i=t===`local-first`||t===`auto`&&n===!1;this.turn={turn:e,backend:i?`system`:`live`,scope:r,steps:new Map,fallback:t===`local-first`||t===`auto`&&!i},this.installFallback()}backendText(e,t){return e===`system`?externalEngine()?externalFallbackText(t):stripXiaomiAudioTags(stripBreezeAudioTags(t)):t}controller(e){return e===`live`?this.live:this.local}scopeText(e,t,n=!1){return applyTtsLivePlaybackScope(this.live.prepareText(e),this.turn.scope,t.limiter,n,Math.random,e=>this.live.prepareText(e))}installFallback(){this.live.setFallbackHandler(null),this.local.setFallbackHandler(null);let e=this.turn;if(e===null||!e.fallback)return;let t=this.revision;this.controller(e.backend).setFallbackHandler(n=>{if(t!==this.revision||this.turn!==e||n.sessionId!==this.sessionId||n.turn!==e.turn)return;e.backend=e.backend===`live`?`system`:`live`,e.fallback=!1,this.installFallback();let r=this.controller(e.backend);for(let t of e.steps.values()){let{sessionId:n,turn:i,step:a}=t.cursor;t.checkpoint!==null&&r.prime(n,i,a,this.backendText(e.backend,t.checkpoint)),r.observe(n,i,a,this.backendText(e.backend,t.text)),t.final!==null&&r.finish(n,{...t.final,text:this.backendText(e.backend,t.final.text)})}})}};function SessionPlaybackObserver({sessionId:e,useSession:t,useChat:n,playback:r,live:i,local:a,settings:o,questions:s,automaticReading:c,audioFocus:u=oi,automaticAudioFocus:d=u}){(0,l.useEffect)(()=>s?.activateSession(e),[s,e]);let p=(0,l.useSyncExternalStore)(d.subscribe,d.canPlay,d.canPlay),m=resolveTtsSettings(useSettingsSnapshot(o).value),h=useEngineState(),g=useApiKeySupported(p&&!externalEngine()&&m.localSpeechMode!==`disabled`,m.provider),_=externalEngine()?h.engine?.ready??!1:g;i.setMaxPausedPcmBytes(m.maxPausedPcmBytes),a.setVoiceURI(m.localVoiceURI),a.setMossVoice(m.localVoiceEngine,m.mossBaseURL,m.mossVoice),a.setTimeoutMs(m.requestTimeoutMs);let v=t(e=>e),b=n(e=>e.legacy),x=v.running,S=(0,l.useSyncExternalStore)(c.subscribe,c.getSnapshot,c.getSnapshot),[C]=(0,l.useState)(()=>new RealtimeSpeechSession(i,a)),w=JSON.stringify([ttsSelection(m),h]),E=(0,l.useRef)(w),D=(0,l.useRef)(null),k=(0,l.useRef)(x),A=(0,l.useRef)(!0),M=n(finalAssistantMessageId),P=S===`final`?M:latestAssistantMessageId(b),F=b.partial,I=F===null?``:assistantText(F.blocks),V=(0,l.useRef)(x),ee=(0,l.useRef)(x?F:null),te=(0,l.useRef)(x&&v.openState!==`open`);return(0,l.useEffect)(()=>(D.current=null,k.current=x,A.current=!0,V.current=x,ee.current=x?F:null,te.current=x&&v.openState!==`open`,r.activateSession(e),C.activate(e),()=>{D.current=null,c.release(e),C.deactivate(e),r.deactivateSession(e)}),[c,r,e,C]),(0,l.useEffect)(()=>{if(E.current!==w){E.current=w;let t=D.current?.turn;C.cancel(),t!==void 0&&(i.blockTurn(e,t),a.blockTurn(e,t)),i.configure(m),D.current=null,x&&(A.current=!1)}i.configure(m),C.configure({localSpeechMode:m.localSpeechMode,apiKeySupported:_,readScope:m.readScope});let t=x&&!k.current;k.current=x,x?t&&(A.current=!0,V.current=!1,ee.current=null,te.current=!1,C.cancel(),r.cancelPlayback(e),D.current=null):A.current=!0,c.observe(e,x),c.allowed(e)||(A.current=!1);let n=engineCanRequest()&&engineSupportsRealtime(m);if(r.observeSession(e,p&&d.canPlay()&&x&&A.current,P,V.current),!p||!d.canPlay()||!m.enabled||!m.autoPlay||!n){(!u.canPlay()||!m.enabled||c.isAutomatic())&&C.cancel(),D.current=null,x&&(A.current=!1);return}if(S===`final`){D.current!==null&&C.cancel(),D.current=null;return}if(A.current){if(te.current){if(v.openState!==`open`)return;ee.current=F,te.current=!1}if(F!==null){if(D.current!==null&&(D.current.turn!==F.turn||D.current.step!==F.step)){let t=finalLiveMessage(b,D.current.turn,D.current.step);t!==null&&C.finish(e,t)}D.current={turn:F.turn,step:F.step};let t=ee.current!==null&&ee.current.turn===F.turn&&ee.current.step===F.step;ee.current=null,c.markAutomatic(),C.observe(e,F.turn,F.step,I,t);return}if(D.current!==null){let t=finalLiveMessage(b,D.current.turn,D.current.step);t===null?x||(C.cancel(),D.current=null):(C.finish(e,t),D.current=null)}}},[c,S,u,d,p,w,_,b,P,i,a,F,I,r,m.autoPlay,m.enabled,m.localSpeechMode,m.localVoiceEngine,m.mossBaseURL,m.mossVoice,m.model,m.provider,m.doubaoModel,m.doubaoVoice,m.doubaoClonedVoice,m.readScope,x,e,v.openState,C]),null}let ci={"settings.mountSidebar":`挂载侧栏`,"settings.unmountSidebar":`退出侧栏`,"settings.mountingSidebar":`正在挂载侧栏,请稍候…`,"settings.unmountingSidebar":`正在退出侧栏,请稍候…`,"settings.voiceSettingsNav":`音色工坊`,"settings.voiceSettingsDescription":`配置音色、试听与音效`,"settings.pluginDetails":`插件详情`},li={"settings.mountSidebar":`Mount to sidebar`,"settings.unmountSidebar":`Remove from sidebar`,"settings.mountingSidebar":`Mounting to sidebar, please wait…`,"settings.unmountingSidebar":`Removing from sidebar, please wait…`,"settings.voiceSettingsNav":`Voice Studio`,"settings.voiceSettingsDescription":`Configure voices, previews, and sound effects`,"settings.pluginDetails":`Plugin details`},ui={"whale.description":`配置鲸鱼娘人设与独立本地记忆。`,"whale.loading":`正在读取鲸鱼娘配置…`,"whale.unavailable":`请先启用「鲸鱼娘」组件,再打开此页。`,"whale.persona":`人设`,"whale.personaHint":`仅用于 DSH 鲸鱼娘,保存后下一轮对话生效;不影响 QQ 鲸鱼娘。`,"whale.name":`角色名`,"whale.selfReference":`自称`,"whale.userAddress":`默认用户称呼`,"whale.relationship":`关系与背景`,"whale.personality":`性格补充`,"whale.replyStyle":`回复风格`,"whale.likes":`角色喜好`,"whale.boundaries":`避雷与禁忌`,"whale.memory":`记忆能力`,"whale.memoryEnabled":`允许保存记忆`,"whale.memoryHint":`仅使用当前工作区的鲸鱼娘记忆,不读取 QQ 私聊或群记忆。`,"whale.memes":`表情包能力`,"whale.memesEnabled":`允许使用表情包`,"whale.memesHint":`根据对话使用本地表情包;关闭后不再注入表情包指引和素材目录。`,"whale.conflict":`配置已在其他位置更新。请放弃修改并重新编辑,避免覆盖新设置。`,"whale.errorPersona":`角色名和自称不能为空,其他字段请控制在长度限制内。`,"qq.description":`独立配置 QQ 鲸鱼娘人设、记忆与自动传声。`,"qq.persona":`QQ 鲸鱼娘人设`,"qq.personaUnavailable":`请先启用「QQ Bot 传声筒」组件,再打开此页。`,"qq.personaHint":`仅用于独立的 QQ 鲸鱼娘预设。保存后下一轮生效;在 QQ 中发送 /preset qq-speech-assistant,再发送 /new 开始使用。`,"qq.personaMemoryHint":`按机器人、私聊或群独立保存,跨 /new 保留;群里只记公共要求和话题,不读取 DSH 工作区记忆。`,"qq.voice":`QQ 传声与语音转换`,"qq.voiceHint":`使用宿主已保存的服务商与音色。开启后,QQ 鲸鱼娘每轮完成时自动合成完整回复并发送 SILK,无须模型调用语音工具。`,"qq.automatic":`自动将 QQ 回复转为语音`,"qq.characters":`自动语音字数上限`,"qq.duration":`每段语音时长上限(秒)`,"qq.limitsHint":`0 表示不限。超出自动语音字数上限时保留文字;显式语音请求仍可用。`,"qq.ruleHint":`仅响应已核验的 QQ 会话;不会向 QQ 转发 DSH 对话,也不会在空闲时主动发送。`,"qq.memory":`QQ 记忆回显与修改`,"qq.memoryHint":`显示 QQBot 已记录的私聊和群记忆。修改或删除会立即写入对应对象,群记忆对群内成员公开。`,"qq.memoryLoading":`正在读取 QQ 记忆…`,"qq.memoryUnavailable":`QQBot 未运行或暂无可读取的会话记忆。`,"qq.memoryEmpty":`暂无已保存的 QQ 记忆。`,"qq.memorySaved":`QQ 记忆已更新。`,"qq.memoryError":`QQ 记忆更新失败,请重试。`,"qq.group":`群`,"qq.private":`私聊`,"qq.pauseMemory":`暂停保存`,"qq.resumeMemory":`恢复保存`,"qq.clearMemory":`清空`,"qq.editMemory":`保存修改`,"qq.deleteMemory":`删除`,"qq.memoryKind.preference":`偏好`,"qq.memoryKind.requirement":`要求`,"qq.memoryKind.topic":`话题`,"qq.unavailable":`请先启用本插件的语音服务。`,"qq.error":`字数须为 0–12000 的整数,时长须为 0–6000 秒的整数。`},di={"whale.description":`Configure the Whale Girl persona and isolated local memory.`,"whale.loading":`Loading Whale Girl settings…`,"whale.unavailable":`Enable the Whale Girl component before opening this page.`,"whale.persona":`Persona`,"whale.personaHint":`Applies only to DSH Whale Girl on the next turn. QQ Whale Girl has separate settings.`,"whale.name":`Character name`,"whale.selfReference":`Self reference`,"whale.userAddress":`Default user address`,"whale.relationship":`Relationship and background`,"whale.personality":`Additional personality`,"whale.replyStyle":`Reply style`,"whale.likes":`Character interests`,"whale.boundaries":`Boundaries and topics to avoid`,"whale.memory":`Memory`,"whale.memoryEnabled":`Allow saved memory`,"whale.memoryHint":`Uses only the current workspace memory. QQ private-chat and group memory is never read.`,"whale.memes":`Memes`,"whale.memesEnabled":`Allow memes`,"whale.memesHint":`Use local memes in conversation. Turning this off removes meme instructions and the catalog.`,"whale.conflict":`Settings changed elsewhere. Discard your draft and edit again to avoid overwriting newer settings.`,"whale.errorPersona":`Character name and self reference are required. Keep the remaining fields within their length limits.`,"qq.description":`Configure the independent QQ Whale Girl persona, memory and automatic voice delivery.`,"qq.persona":`QQ Whale Girl persona`,"qq.personaUnavailable":`Enable QQ Bot Megaphone before opening this page.`,"qq.personaHint":`Applies to the separate QQ Whale Girl preset on the next turn. Send /preset qq-speech-assistant, then /new in QQ to start using it.`,"qq.personaMemoryHint":`Memory is isolated by bot and private chat or group, and survives /new. Groups store shared information only; DSH workspace memory is never read.`,"qq.voice":`QQ voice delivery and conversion`,"qq.voiceHint":`Uses the saved Host provider and voice. When enabled, each completed QQ Whale Girl reply is synthesized in full and sent as SILK, without a model tool call.`,"qq.automatic":`Automatically convert QQ replies to voice`,"qq.characters":`Automatic voice character limit`,"qq.duration":`Maximum audio segment duration (seconds)`,"qq.limitsHint":`0 means unlimited. Replies above the character limit remain text; explicit voice requests remain available.`,"qq.ruleHint":`Only verified QQ conversations can deliver to QQ. DSH chats are never forwarded, and idle chats never trigger messages.`,"qq.memory":`QQ memory review and editing`,"qq.memoryHint":`Review saved private-chat and group memory from QQBot. Edits and deletions are written to that object immediately; group memory is visible to the group.`,"qq.memoryLoading":`Loading QQ memory…`,"qq.memoryUnavailable":`QQBot is not running or no readable session memory is available.`,"qq.memoryEmpty":`No saved QQ memory.`,"qq.memorySaved":`QQ memory updated.`,"qq.memoryError":`Could not update QQ memory. Try again.`,"qq.group":`Group`,"qq.private":`Private`,"qq.pauseMemory":`Pause saving`,"qq.resumeMemory":`Resume saving`,"qq.clearMemory":`Clear`,"qq.editMemory":`Save edit`,"qq.deleteMemory":`Delete`,"qq.memoryKind.preference":`Preference`,"qq.memoryKind.requirement":`Requirement`,"qq.memoryKind.topic":`Topic`,"qq.unavailable":`Enable this plugin’s speech service first.`,"qq.error":`Use integer limits of 0–12000 characters and 0–6000 seconds.`},fi={"passport.deviceDiagram":`鲸语设备示意图(屏幕基于界面渲染预览)`,"passport.powerButton":`电源键`,"passport.powerHelp":`开关设备`,"passport.indicator":`指示灯`,"passport.usbPort":`Type-C`,"passport.upButton":`UP`,"passport.upHelp":`短按音量;长按全屏`,"passport.downButton":`DOWN`,"passport.downHelp":`短按取消;长按说话`,"passport.okButton":`OK`,"passport.okHelp":`短按开麦;长按设置`,"passport.liveStatus":`设备实时状态`,"passport.microphone":`麦克风`,"passport.micOpen":`已开麦`,"passport.micMuted":`已闭麦`,"passport.unknown":`暂无数据`,"passport.activity":`当前状态`,"passport.phase.idle":`等待说话`,"passport.phase.capturing":`正在录音`,"passport.phase.recognizing":`正在识别`,"passport.phase.thinking":`正在思考`,"passport.phase.tool":`正在调用工具`,"passport.phase.synthesizing":`正在合成语音`,"passport.phase.playing":`正在播放`,"passport.transcript":`语音识别结果`,"passport.replyText":`回复文本`,"passport.noTranscript":`等待识别完成`,"passport.noReply":`等待回复`,"passport.textHint":`识别完成后显示文字;文本仅在当前连接期间保留。`,"passport.asrProvider":`语音识别来源`,"passport.asrSectionHint":`选择设备使用的语音识别服务。`,"passport.asrService":`识别服务`,"passport.asr.host":`DSH 宿主本地语音识别(五分钟休眠)`,"passport.asr.xiaomi":`小米 MiMo ASR`,"passport.asr.doubao":`豆包实时语音识别`,"passport.asr.doubao-nostream":`豆包一句话识别`,"passport.keyConfigured":`密钥已配置`,"passport.keyMissing":`未配置密钥`,"passport.configureKeys":`去配置供应商密钥`,"passport.asrTest":`测试连接`,"passport.asrTesting":`正在测试…`,"passport.asrTestHint":`发送一秒静音测试识别服务,可能消耗少量额度。`,"passport.asrTestSuccess":`识别服务连接成功。`,"passport.asrTestFailed":`连接失败,请检查密钥、权限、额度或网络。`,"passport.asrErrorKey":`未配置所选供应商的密钥,请先保存密钥。`,"passport.asrErrorUnavailable":`识别服务不可用;请启用服务并准备好识别模型。`,"passport.asrErrorAuth":`鉴权失败,请检查已保存的 API Key。`,"passport.asrErrorPermission":`没有识别服务权限,请检查资源开通情况及密钥权限。`,"passport.asrErrorQuota":`识别服务额度不足或账户余额不足。`,"passport.asrErrorRate":`识别请求被限流,请稍后重试。`,"passport.asrErrorTimeout":`识别服务响应超时,请检查网络后重试。`,"passport.asrErrorNetwork":`无法连接识别服务,请检查网络或服务地址。`,"passport.asrErrorResponse":`识别服务返回了无法解析的响应。`,"passport.asrErrorInput":`识别音频超过服务允许的缓冲区。`,"passport.asrErrorRecognition":`识别服务请求失败,请检查服务状态及宿主日志。`,"passport.asrErrorRequest":`测试请求无效,请刷新页面后重试。`,"passport.asrErrorOrigin":`测试请求被拒绝,请从 DSH 设置页面重试。`,"passport.asrUpstreamCode":`供应商错误码`,"passport.asrHostHint":`使用 DSH 语音输入已选的识别服务,需先准备好模型。识别来源与回复音色独立。`,"passport.asrCloudHint":`复用已保存的供应商密钥。`,"passport.workspace":`工作目录`,"passport.workspaceHint":`新建会话使用下方目录,已有会话保留自己的目录。`,"passport.newSession":`刷新预设并新建会话`,"passport.reloadPresets":`刷新预设列表`,"passport.hostDefault":`跟随宿主默认预设`,"passport.presetsLoading":`正在读取预设…`,"passport.presetsFailed":`无法读取预设,请确认预设服务已启用后刷新列表。`,"passport.presetChanged":`预设已更改,请点击“刷新预设并新建会话”应用。`,"passport.presetUnavailable":`所选预设不可用,请从列表重新选择。`,"passport.sessionFailed":`会话未能恢复,请检查宿主日志,或选择预设后新建会话。`,"passport.sessionRenewed":`新会话已请求,等待设备自动连接;旧聊天记录保留。`,"passport.sessionRevision":`会话刷新标识`,"passport.computerIp":`电脑 IP`,"passport.networkHint":`支持同一局域网 Wi-Fi 或电脑的 2.4 GHz 热点。`,"passport.codeLabel":`4 位配对码`,"passport.matchCode":`在设备端填写相同的四个数字,前面的 0 也要填写。`,"passport.codeEmpty":`点击上方按钮,生成配对码并开启连接。`,"passport.codeSaved":`已保存配对凭证。需要查看新码时可重新生成。`,"passport.deviceSetup":`在设备端填写对应信息`,"passport.deviceSetupHint":`长按 OK → 重新配置,手机连接 DSH-Voice-* 热点后打开 192.168.4.1。在“电脑连接”中依次填写这里的“电脑 IP”和“4 位配对码”,再保存并连接。端口与本页监听端口一致;已配网可保留原 Wi-Fi。`,"passport.reloadRequired":`请重新加载 AI Passport 连接器,以使用新版连接状态。`,"passport.quickTitle":`连接设备`,"passport.quickHint":`点击下方按钮,自动开放局域网连接并生成 4 位数字配对码。设备只需填写电脑 IP 和配对码。`,"passport.quickEnable":`生成配对码`,"passport.pairingCode":`设备填写的 4 位配对码:`,"passport.quickSaved":`配对码已更新,请在设备填写新码。`,"passport.advanced":`高级配置(监听、配对码、会话与收音)`,"passport.deviceAddress":`设备填写的电脑 IP(选择设备 Wi-Fi 能访问的地址):`,"passport.copyAddress":`复制 IP`,"passport.copied":`已复制`,"passport.copyFailed":`无法自动复制,请选中上方 IP 手动复制。`,"passport.addressUnavailable":`暂未读取到电脑 IP,请检查网络,或在设备中填写电脑的局域网 IPv4。`,"passport.stepHost":`电脑:确认组件开关已开启(默认开启),再点击“生成配对码并开启连接”。`,"passport.stepDevice":`设备:连接同一局域网,填写电脑 IP 和最新 4 位配对码,端口默认 3101。连接 Windows 移动热点时,选择热点网卡地址(通常为 192.168.137.1)。`,"passport.stepTalk":`看到“准备好了”后,短按 OK 开麦;说完停顿,等待回复。`,"passport.devScope":`4 位配对码适用于局域网设备连接。重新生成会替换旧码。`,"passport.statusLoading":`正在读取连接状态…`,"passport.servicesWaiting":`正在等待服务:请检查对话模型、TTS 与所选识别来源。宿主识别模式还需启用语音输入服务。`,"passport.notListening":`尚未开始监听,请生成配对码并开启连接。`,"passport.localOnly":`当前仅本机可访问,设备无法连接;点击上方按钮可修正。`,"passport.asrWaiting":`所选语音识别尚未配置好;宿主模式请准备识别模型,云端模式请配置对应密钥。`,"passport.deviceConnected":`设备已连接,可以短按 OK 开麦,或长按 DOWN 键说话。`,"passport.deviceWaiting":`正在监听,等待设备连接。`,"passport.portInUse":`端口被占用,请在高级配置中更换端口,设备也填写同一端口。`,"passport.listenFailed":`监听启动失败,请检查高级配置中的地址与端口。`,"passport.title":`AI Passport 连接器`,"passport.description":`通过 Wi-Fi 与 DSH 语音对话,使用所选语音识别、Agent 预设和已保存的 TTS 音色。`,"passport.guide":`查看 AI Passport 接入教程`,"passport.requirements":`连接器默认开启;确认开关已打开后生成 4 位配对码。电脑和设备需处于可互通的局域网,本页会显示可填写的电脑 IP。`,"passport.connection":`设备连接`,"passport.connectionHint":`设备与 DSH 主机需处于可互通的网络,主机和设备填写相同的 4 位配对码。`,"passport.host":`监听地址`,"passport.hostHint":`快捷连接自动使用 0.0.0.0 监听;设备端填写页面上方的电脑 IP。127.0.0.1 仅供本机测试。`,"passport.port":`监听端口`,"passport.portHint":`默认 3101,连接路径为 /api/realtime。设备配网页面与这里填写相同端口。`,"passport.accessToken":`设备配对码`,"passport.accessTokenHint":`填写 4 位数字,与设备保持一致;也可使用上方按钮自动生成。留空保留已保存的配对码。`,"passport.deviceId":`允许的设备 ID(可选)`,"passport.deviceIdHint":`留空允许首个认证设备。填写固件的 client.instance_id,通常为 bean_ 加设备 MAC 的十六进制值。`,"passport.session":`专用会话`,"passport.sessionHint":`选择预设后点击“刷新预设并新建会话”。`,"passport.promptBefore":`还没有想要的对话预设?点击`,"passport.copyPrompt":`复制提示词`,"passport.promptAfter":`使用 DHS [创造模式] 新建一个 Agent 预设`,"passport.promptCopyFailed":`复制失败,请检查剪贴板权限后重试。`,"passport.agentPreset":`Agent 预设 ID(可选)`,"passport.agentPresetHint":`列表来自当前 DSH,显示名称及实际 ID。`,"passport.cwd":`工作目录(可选)`,"passport.cwdHint":`默认 ~/.dsh-xiaomi-tts/passport/workspace,不存在时自动创建。支持 ~/ 用户目录;已有会话保留原工作目录。`,"passport.capture":`收音与断句`,"passport.captureHint":`建议先保留默认值。切句过早时延长静音时间;噪声误触发时提高语音阈值。`,"passport.silenceMs":`断句静音时长(ms)`,"passport.silenceMsHint":`200–3000 ms,默认 700 ms。说完后持续静音多久才提交识别。`,"passport.minSpeechMs":`最短有效语音(ms)`,"passport.minSpeechMsHint":`100–1000 ms,默认 200 ms。过滤过短的碰撞声或杂音。`,"passport.speechThreshold":`语音能量阈值`,"passport.speechThresholdHint":`归一化 RMS,0.001–0.5,默认 0.015。越高越不易被环境声音触发。`,"passport.maxRecordingSeconds":`最长录音(秒)`,"passport.maxRecordingSecondsHint":`1–60 秒,默认 30 秒,包含预录和尾部静音。超长录音不提交。`,"passport.limits":`回复与超时`,"passport.limitsHint":`回复先完整合成,再发送到设备;播放期间暂停收音,按 DOWN 可取消当前任务。`,"passport.maxReplySeconds":`最长语音回复(秒)`,"passport.maxReplySecondsHint":`1–120 秒,默认 60 秒。流式超限停止并提示,不截断会话中的文字。`,"passport.requestTimeoutMs":`整轮等待上限(ms)`,"passport.requestTimeoutMsHint":`10000–600000 ms,默认 180000 ms。包括识别、对话和播报;超时后取消本轮。`,"passport.loading":`正在读取 AI Passport 连接器配置…`,"passport.unavailable":`AI Passport 连接器尚未加载。请先在组件列表开启它;开启或更新插件后需重启 DSH,再重新打开本页填写配置。未设置有效配对码时不会监听网络。`,"passport.waiting":`尚未开始监听,请点击生成配对码并开启连接。`,"passport.tokenSaved":`已设置,留空保留原配对码`,"passport.error":`请检查以下配置:`,"passport.loopback":`当前监听地址仅供本机测试,设备无法通过 Wi-Fi 连接。接入前请改为主机的局域网地址。`,"passport.savedHint":`配置保存后由宿主应用,正在进行的识别或播放可能被取消。设备连接和音质需在真实硬件上验证。`},pi={"passport.deviceDiagram":`WhaleTalk device illustration (screen based on a rendered UI preview)`,"passport.powerButton":`Power button`,"passport.powerHelp":`Turn device on or off`,"passport.indicator":`Indicator light`,"passport.usbPort":`USB-C`,"passport.upButton":`UP`,"passport.upHelp":`Press: volume; hold: UI hints`,"passport.downButton":`DOWN`,"passport.downHelp":`Press to cancel; hold to talk`,"passport.okButton":`OK`,"passport.okHelp":`Press for microphone; hold for settings`,"passport.liveStatus":`Live device status`,"passport.microphone":`Microphone`,"passport.micOpen":`Open`,"passport.micMuted":`Muted`,"passport.unknown":`Unavailable`,"passport.activity":`Activity`,"passport.phase.idle":`Waiting`,"passport.phase.capturing":`Recording`,"passport.phase.recognizing":`Recognizing speech`,"passport.phase.thinking":`Thinking`,"passport.phase.tool":`Using a tool`,"passport.phase.synthesizing":`Synthesizing speech`,"passport.phase.playing":`Playing audio`,"passport.transcript":`Speech recognition`,"passport.replyText":`Reply text`,"passport.noTranscript":`Waiting for recognition`,"passport.noReply":`Waiting for a reply`,"passport.textHint":`Text appears after recognition and is retained only while connected.`,"passport.asrProvider":`Speech recognition source`,"passport.asrSectionHint":`Choose the recognition service used by the device.`,"passport.asrService":`Recognition service`,"passport.asr.host":`DSH Host local speech recognition`,"passport.asr.xiaomi":`Xiaomi MiMo ASR`,"passport.asr.doubao":`Doubao real-time recognition`,"passport.asr.doubao-nostream":`Doubao utterance recognition`,"passport.keyConfigured":`Key configured`,"passport.keyMissing":`Key missing`,"passport.configureKeys":`Go to provider keys`,"passport.asrTest":`Test connection`,"passport.asrTesting":`Testing…`,"passport.asrTestHint":`Send one second of silence to test recognition; provider usage may apply.`,"passport.asrTestSuccess":`Recognition service connected.`,"passport.asrTestFailed":`Connection failed. Check credentials, permissions, quota or network.`,"passport.asrErrorKey":`No key is saved for the selected provider.`,"passport.asrErrorUnavailable":`Recognition is unavailable; enable the service and prepare its model.`,"passport.asrErrorAuth":`Authentication failed. Check the saved API key.`,"passport.asrErrorPermission":`Recognition access was denied. Check the enabled resource and key permissions.`,"passport.asrErrorQuota":`Recognition quota or account balance is insufficient.`,"passport.asrErrorRate":`Recognition requests are rate limited. Try again later.`,"passport.asrErrorTimeout":`Recognition timed out. Check the network and retry.`,"passport.asrErrorNetwork":`Could not connect to the recognition service. Check the network or service address.`,"passport.asrErrorResponse":`The recognition service returned an invalid response.`,"passport.asrErrorInput":`The recognition audio exceeded the available buffer.`,"passport.asrErrorRecognition":`Recognition failed. Check service status and Host logs.`,"passport.asrErrorRequest":`The test request is invalid. Refresh the page and retry.`,"passport.asrErrorOrigin":`The request was rejected. Retry from DSH settings.`,"passport.asrUpstreamCode":`Provider code`,"passport.asrHostHint":`Uses the selected DSH recognizer. Prepare its model first. Recognition and the reply voice are independent.`,"passport.asrCloudHint":`Uses the saved provider key.`,"passport.workspace":`Working directory`,"passport.workspaceHint":`New conversations use this directory. Existing conversations retain their own directory.`,"passport.newSession":`Apply preset and start a new conversation`,"passport.reloadPresets":`Reload presets`,"passport.hostDefault":`Use the Host default preset`,"passport.presetsLoading":`Loading presets…`,"passport.presetsFailed":`Cannot load presets. Enable the preset service, then reload the list.`,"passport.presetChanged":`The preset changed. Apply it with a new conversation to continue.`,"passport.presetUnavailable":`This preset is unavailable. Choose another from the list.`,"passport.sessionFailed":`Could not resume the conversation. Check the Host logs or start a new conversation with a selected preset.`,"passport.sessionRenewed":`New conversation requested. Waiting for the device to reconnect; previous history is retained.`,"passport.sessionRevision":`Conversation refresh identifier`,"passport.computerIp":`Computer IP`,"passport.networkHint":`Use Wi-Fi on the same LAN or the computer’s 2.4 GHz hotspot.`,"passport.codeLabel":`4-digit pairing code`,"passport.matchCode":`Enter these four digits on the device, including any leading zero.`,"passport.codeEmpty":`Generate a code and enable the connection using the button above.`,"passport.codeSaved":`Pairing credentials are saved. Generate a new code if needed.`,"passport.deviceSetup":`Enter matching values on the device`,"passport.deviceSetupHint":`Hold OK → Reconfigure. Connect your phone to DSH-Voice-* and open 192.168.4.1. Under Computer connection, enter the Computer IP and 4-digit pairing code shown here, then save and connect. Match the listening port; keep the existing Wi-Fi if already configured.`,"passport.reloadRequired":`Reload AI Passport Connector to use the updated connection status.`,"passport.quickTitle":`Connect your device`,"passport.quickHint":`Enable LAN access and generate a four-digit pairing code with one click. Enter only the computer IP and code on the device.`,"passport.quickEnable":`Generate pairing code`,"passport.pairingCode":`Four-digit code for the device:`,"passport.quickSaved":`Pairing code updated. Enter the new code on the device.`,"passport.advanced":`Advanced settings (listener, pairing, conversation and capture)`,"passport.deviceAddress":`Computer IP for the device (choose an address reachable from its Wi-Fi):`,"passport.copyAddress":`Copy IP`,"passport.copied":`Copied`,"passport.copyFailed":`Copy is unavailable. Select the IP above and copy it manually.`,"passport.addressUnavailable":`No computer IP is available yet. Check networking or enter its LAN IPv4 on the device.`,"passport.stepHost":`Computer: confirm the component is enabled (on by default), then generate a code and enable the connection.`,"passport.stepDevice":`Device: join the same LAN and enter the computer IP and latest four-digit code. Port defaults to 3101. For a Windows mobile hotspot, use its adapter address (usually 192.168.137.1).`,"passport.stepTalk":`When ready, briefly press OK to open the microphone. Speak, then pause for the reply.`,"passport.devScope":`Four-digit pairing accepts local/private LAN devices. Generating a new code replaces the old one.`,"passport.statusLoading":`Reading connection status…`,"passport.servicesWaiting":`Waiting for services: check the conversation model, TTS and selected recognizer. Host recognition also requires the DSH speech input service.`,"passport.notListening":`Not listening yet. Generate a pairing code and enable the connection.`,"passport.localOnly":`Only this computer can connect. Use the button above to enable device access.`,"passport.asrWaiting":`Recognition is not configured. Prepare the Host model or configure the selected cloud key.`,"passport.deviceConnected":`Device connected. Briefly press OK to open the microphone, or hold DOWN to speak.`,"passport.deviceWaiting":`Listening and waiting for the device.`,"passport.portInUse":`Port occupied. Choose another port under Advanced settings and use it on the device too.`,"passport.listenFailed":`Listener could not start. Check the address and port under Advanced settings.`,"passport.title":`AI Passport Connector`,"passport.description":`Talk to DSH over Wi-Fi using Host speech recognition, Agent presets and your saved TTS voice.`,"passport.guide":`Open the AI Passport setup guide`,"passport.requirements":`The connector is enabled by default; confirm the switch is on, then generate a four-digit pairing code. Keep the computer and device on a reachable LAN; available computer IPs appear below.`,"passport.connection":`Device connection`,"passport.connectionHint":`The device must reach the DSH host over the network. Use the same four-digit pairing code on both ends.`,"passport.host":`Listen address`,"passport.hostHint":`Quick connection listens on 0.0.0.0. Enter a computer IP shown above on the device; 127.0.0.1 is for local tests only.`,"passport.port":`Listen port`,"passport.portHint":`Defaults to port 3101 and /api/realtime. Enter the same port in device setup.`,"passport.accessToken":`Device pairing code`,"passport.accessTokenHint":`Enter four digits matching device setup, or generate a code above. Leave blank to keep the saved code.`,"passport.deviceId":`Allowed device ID (optional)`,"passport.deviceIdHint":`Leave blank to accept the first authenticated device. Otherwise use its client.instance_id, typically bean_ followed by its hexadecimal MAC.`,"passport.session":`Dedicated conversation`,"passport.sessionHint":`Choose a preset, then apply it with a new conversation.`,"passport.promptBefore":`Need a different conversation preset? Click`,"passport.copyPrompt":`Copy prompt`,"passport.promptAfter":`Use DHS Create mode to create an Agent preset.`,"passport.promptCopyFailed":`Copy failed. Check clipboard permissions and try again.`,"passport.agentPreset":`Agent preset ID (optional)`,"passport.agentPresetHint":`The list comes from this DSH instance and shows names with actual IDs.`,"passport.cwd":`Working directory (optional)`,"passport.cwdHint":`Defaults to ~/.dsh-xiaomi-tts/passport/workspace and is created automatically. Supports ~/ for the user home. Existing conversations retain their directory.`,"passport.capture":`Capture and segmentation`,"passport.captureHint":`Start with the defaults. Increase silence duration for premature cuts, or the energy threshold when noise triggers recording.`,"passport.silenceMs":`End-of-speech silence (ms)`,"passport.silenceMsHint":`200–3000 ms; default 700 ms. The silence required before submitting speech for recognition.`,"passport.minSpeechMs":`Minimum speech (ms)`,"passport.minSpeechMsHint":`100–1000 ms; default 200 ms. Filters very short bumps and noise.`,"passport.speechThreshold":`Speech energy threshold`,"passport.speechThresholdHint":`Normalized RMS, 0.001–0.5; default 0.015. Higher values reject more ambient sound.`,"passport.maxRecordingSeconds":`Maximum recording (seconds)`,"passport.maxRecordingSecondsHint":`1–60 seconds; default 30, including pre-roll and trailing silence. Oversized recordings are not submitted.`,"passport.limits":`Replies and timeouts`,"passport.limitsHint":`Replies are fully synthesized before sending. Capture pauses during playback; press DOWN to cancel the current task.`,"passport.maxReplySeconds":`Maximum spoken reply (seconds)`,"passport.maxReplySecondsHint":`1–120 seconds; default 60. Longer replies are not spoken; conversation text is not truncated.`,"passport.requestTimeoutMs":`Whole-request timeout (ms)`,"passport.requestTimeoutMsHint":`10000–600000 ms; default 180000. Covers recognition, the conversation and playback. Expiry cancels the request.`,"passport.loading":`Loading AI Passport Connector settings…`,"passport.unavailable":`AI Passport Connector is not loaded yet. Enable it in the component list; after enabling it or updating the plugin, restart DSH and reopen this page to configure it. Nothing listens until a valid pairing code is set.`,"passport.waiting":`Generate a pairing code and enable the connection to start listening.`,"passport.tokenSaved":`Already set; leave blank to keep`,"passport.error":`Check this setting: `,"passport.loopback":`This address only accepts local connections. Use the host’s LAN address before connecting a Wi-Fi device.`,"passport.savedHint":`The Host applies saved settings and may cancel active recognition or playback. Verify connections and audio on real hardware.`},mi={"settings.externalManage":`プロバイダーを管理`,"settings.externalProviderAdapter":`プロバイダーアダプター`,"settings.showFeatureGuide":`新機能ガイド`,"settings.showFeatureGuideHint":`プラグインの有効化時に新機能を表示します。`,"settings.acceptExternalProviders":`外部プロバイダーを受け入れる`,"settings.acceptExternalProvidersHint":`外部プラグインの音声を使用します。オフにして保存すると内蔵プロバイダーに戻ります。`,"settings.externalSwitchFailed":`プロバイダーを切り替えられませんでした。もう一度お試しください。`,"settings.externalOptionsHint":`利用できる機能は外部プラグインが指定します。`,"settings.externalManaged":`外部プラグインで管理されています。音声はそのプラグインで設定してください。`,"settings.externalNotReady":`外部音声サービスの準備ができていません。プラグインの設定を確認してください。`,"settings.externalDisconnected":`音声サービスの接続が切れました。再接続するまで新しい合成を停止します。`,"settings.externalLoading":`外部音声サービスで音声を生成しています`,"settings.externalPlaying":`外部サービスの音声を再生しています`,"settings.externalCompleted":`外部音声の試聴が完了しました`,"settings.previewPresets":`サンプル文`,"settings.previewPresetGreeting":`挨拶`,"settings.previewPresetPoetry":`詩`,"settings.previewPresetInspiration":`励まし`,"settings.previewPresetReflection":`随想`,"settings.previewPresetHumor":`ユーモア`,"settings.previewPresetNews":`ニュース`,"settings.previewPresetStory":`物語`,"settings.previewPresetService":`ご案内`,"settings.previewPresetDialogue":`会話`,"settings.previewDefaultTextStory":`閉店間際の古書店に、一匹の茶トラ猫が入ってきました。猫は誰も開いたことのない旅日記の上で丸くなりました。`,"settings.previewDefaultTextService":`こんにちは。音声サービスへようこそ。お困りのことをお聞かせください。一緒に順番に解決していきましょう。`,"settings.previewDefaultTextDialogue":`覚えていてくれたの?私だけだと思っていた。よかった。私たちはずっと、同じ方向へ歩いていたんだね。`,"settings.previewDefaultTextNews":`夜のニュースです。市立図書館に夜間読書エリアがオープンしました。仕事帰りにも静かに本を楽しめます。`,"settings.previewDownload":`現在の試聴音声をダウンロード`,"settings.previewDownloadUnavailable":`試聴音声の生成後にダウンロードできます`,"settings.previewDownloadLocal":`ブラウザー音声はダウンロードできません。クラウド音声または MOSS をお試しください。`,"settings.previewDownloadFailed":`ダウンロードできませんでした。もう一度お試しください。`,...li,...di,...pi,"settings.moreProviders":`その他のプロバイダー`,"settings.breezeEnabled":`Breeze Blue を有効にする`,"settings.providerMinimum":`Xiaomi は常に有効です。豆包か Breeze のどちらかを有効にしてください。`,"settings.breezeAudioTags":`オーディオタグ`,"settings.xiaomiAudioTagsHint":`小米のプリセット音声:文頭にスタイル、文中に声のタグを挿入できます。()・()・[]、自由記述と組み合わせに対応。歌唱は文頭に挿入します。音声デザインには音声指示を使用してください。`,"settings.breezeAudioTagsHint":`タグは試聴テキストに挿入されます。中国語は角括弧、英語は丸括弧を使用します。Breeze TTS 専用です。`,"settings.breezeAudioTagsChinese":`中文`,"settings.breezeAudioTagsEnglish":`English`,"settings.audioTagsContinuous":`連続追加`,"settings.audioTagsContinuousHint":`タグパネルを固定`,"settings.providerBreeze":`Breeze`,"settings.breezeCustomVoice":`カスタム音声 ID`,"settings.breezeCustomVoiceHint":`別の Breeze 音声 ID を入力`,"settings.breezeVoiceHistory":`Breeze 音声 ID 履歴`,"settings.breezeVoiceHint":`Breeze 音声 ID`,"settings.voiceReadingHintBreeze":`Breeze の音声 ID を入力してください`,"settings.breezeInstructionHint":`Breeze は場面、意図、感情、リズムに合わせて表現を調整します。空欄では音声の自然な表現を使います`,"settings.breezeInstructionLabelWarmCompanion":`優しく寄り添う`,"settings.breezeInstructionTextWarmCompanion":`親しい友人に寄り添うように、温かく誠実な声で、ゆっくり自然な間を取りながら話してください。`,"settings.breezeInstructionLabelPlayfulTeasing":`茶目っ気`,"settings.breezeInstructionTextPlayfulTeasing":`親しみのある軽い冗談のように、明るく柔軟な抑揚と笑みを含む声で、きつくならないように話してください。`,"settings.breezeInstructionLabelSeriousAnnouncement":`正式な放送`,"settings.breezeInstructionTextSeriousAnnouncement":`プロのアナウンサーのように、客観的で落ち着いた口調と適度な速さで、重要な情報の前後に自然な間を入れて読んでください。`,"settings.breezeInstructionLabelEncouragingSupport":`力強い励まし`,"settings.breezeInstructionTextEncouragingSupport":`信頼と支えを伝える温かくしっかりした声で励まし、叫ばずに少しずつ明るい調子にしてください。`,"settings.breezeInstructionLabelSleepyBedtime":`おやすみの声`,"settings.breezeInstructionTextSleepyBedtime":`眠る前におやすみを伝えるように、柔らかく力を抜いた声で、ゆっくり穏やかな語尾と静かな間で話してください。`,"settings.breezeInstructionLabelWhisperFear":`怯えたささやき`,"settings.breezeInstructionLabelExcitedSurprise":`興奮した驚き`,"settings.breezeInstructionLabelSarcasticDisbelief":`皮肉と呆れ`,"settings.breezeInstructionLabelNervousHumor":`緊張したユーモア`,"settings.breezeInstructionLabelRestrainedGrief":`抑えた悲しみ`,"settings.breezeInstructionLabelCalmNarration":`落ち着いたナレーション`,"settings.breezeInstructionTextWhisperFear":`誰かに聞かれないように、非常に小さく緊張した声でささやく。`,"settings.breezeInstructionTextExcitedSurprise":`明るく驚きに満ちた、徐々に高まるエネルギーで話す。`,"settings.breezeInstructionTextSarcasticDisbelief":`乾いた皮肉と呆れた調子で、明らかに悪い考えだったかのように話す。`,"settings.breezeInstructionTextNervousHumor":`緊張を隠すように、最初の句の後で小さく笑う。`,"settings.breezeInstructionTextRestrainedGrief":`涙をこらえ、少し震えた声と抑えた間で悲しみを表現する。`,"settings.breezeInstructionTextCalmNarration":`落ち着いた明瞭なナレーターとして、一定の速さと自然な間で読む。`,"detail.star":`Star`,"detail.manual":`マニュアル`,"detail.workshop":`工房`,"detail.keyLoading":`キーを確認中`,"detail.keyMissing":`キー未設定`,"detail.keyRecognized":`キー形式を認識しました`,"detail.keyUnrecognized":`未対応のキー形式`,"detail.keyUnavailable":`キーを確認できません`,"detail.retry":`再確認`,"detail.preview":`プラグイン詳細`,"detail.previewChanging":`プラグインの変更を再現`,"detail.previewKey":`キー状態の再現`,"plugin.changing":`プラグインの変更中は、音声再生を一時停止します。`,"onboarding.title":`新機能のご紹介`,"onboarding.summary":`Passport、クジラ娘、プラグイン設定の新機能をご紹介します。`,"onboarding.details":`更新の詳細`,"onboarding.externalSpeechTitle":`外部音声プロバイダーを接続`,"onboarding.externalVoicesTitle":`音色工坊で声を選択`,"onboarding.externalSwitchTitle":`プロバイダーを手軽に切り替え`,"onboarding.featureExternalSpeech":`Passport のデバイス状態、認識結果、応答を確認`,"onboarding.featureExternalVoices":`Passport 設定で音声認識の接続をテスト`,"onboarding.featureExternalSwitch":`クジラ娘の記憶とスタンプ機能を個別に設定`,"onboarding.featureGuideControl":`新機能ガイドをいつでもオン・オフ`,"onboarding.configure":`音色工坊を開く`,"onboarding.github":`Starで応援する`,"onboarding.preview":`ブラウザー音声を試聴`,"onboarding.dismiss":`閉じる`,"onboarding.never":`今後表示しない`,"onboarding.sample":`こんにちは、クジラメイドです。声の準備ができました。一緒に新しい世界を探しましょう。`,"settings.announcementsApprovals":`承認リマインダー`,"settings.announcementsApprovalsHint":`この会話の承認待ち操作を通知します。承認または取り消しで停止します`,"settings.announcementsJobs":`バックグラウンドタスクの結果`,"settings.announcementsJobsHint":`この会話で実行を確認したタスクの結果を通知します。タスクサービスが必要です`,"announcements.approval":`承認を待っている操作があります。`,"announcements.job":`バックグラウンドタスク`,"announcements.jobCompleted":`終了しました。`,"announcements.jobFailed":`失敗しました。`,"announcements.jobKilled":`キャンセルされました。`,"settings.soundEffectsScope":`効果音の対象`,"settings.announcementsWhale":`dsh-whale-musume`,"settings.announcementsQuestions":`質問カードのタイトル`,"settings.announcementsPetHint":`ペットのつぶやき、返答、食事メッセージを読み上げます`,"settings.announcementsWhaleHint":`Whale Girl からの音声リクエストを許可します`,"settings.announcementsQuestionsHint":`自動読み上げに合わせて現在の質問を読みます。移動や終了で停止します`,"settings.announcementsNone":`有効な通知元がありません`,"settings.inputAvoidance":`入力中は読み上げを控える`,"settings.inputAvoidanceHint":`入力欄にフォーカスがあり未送信の文章がある間、自動読み上げを停止します。離れるか空にすると新しい読み上げを許可し、補完再生はしません。手動試聴は利用できます。`,"settings.importantAnnouncementsFirst":`重要な通知を優先`,"settings.importantAnnouncementsFirstHint":`承認待ちとバックグラウンドタスク失敗の通知は通常の読み上げを中断できます。音声入力と入力中の抑制を優先します。`,"settings.hostIntegration":`ホスト連携`,"settings.showInHostSettings":`ホスト設定の入口`,"settings.showInHostSettingsHint":`DSH 設定に「音声読み上げ」の設定を表示します。保存後に適用されます。`,"settings.voiceInputCompatibility":`音声入力を優先`,"settings.voiceInputCompatibilityHint":`DSH 公式の音声入力中は読み上げと効果音を停止し、録音・文字起こし中も再生しません。中断した音声は再開しません。保存後に適用されます。`,"settings.announcementsTitle":`通知元`,"settings.announcementsPlugins":`プラグイン連携`,"settings.announcementsPluginsHint":`対応するプラグインのインストールと有効化が必要です`,"settings.passportIntegration":`Ai Passport アプリ`,"settings.passportIntegrationHint":`WhaleTalk Passport:持ち歩ける DSH 音声対話端末`,"settings.qqbotIntegration":`QQ Bot`,"settings.qqbotIntegrationHint":`オンでは全文を自動で音声送信し、オフでは依頼時のみ送信します。QQ Bot Megaphone を有効にし、保存してください`,"settings.announcementsPet":`dsh-pet`,"settings.announcementsHint":`音声を有効にし、DSH Web を開いておいてください。再生中に届いた通知はスキップします`,"settings.provider":`音声サービス`,"settings.providerXiaomi":`Xiaomi MiMo`,"settings.providerDoubao":`Doubao Voice`,"settings.switchProvider":`サービスを切り替え`,"settings.doubaoStandardModel":`標準音声合成(seed-tts-2.0)`,"settings.doubaoCloneModel":`音声クローン(seed-icl-2.0)`,"settings.speechInstruction":`読み上げ指示`,"settings.speechInstructionPresets":`読み上げ指示のプリセット`,"settings.speechInstructionCustom":`カスタム指示`,"settings.mimoInstructionHint":`Xiaomi 用のスタイル指定です。空欄なら標準の読み方を使います。音色デザインの声の説明は維持されます`,"settings.doubaoInstructionHint":`Doubao 標準音声の指示です。空欄なら音色本来の読み方を使います`,"settings.mimoInstructionGentlePrompt":`温かく優しい口調で、柔らかく明瞭に発音し、語尾を穏やかにしてください。`,"settings.mimoInstructionCheerfulPrompt":`良い知らせを伝えるように、明るく弾む口調と軽快なテンポで、強弱を生き生きと付けてください。`,"settings.mimoInstructionCalmPrompt":`落ち着いた口調で、一定のテンポと明確な間を保ち、感情を控えめにしてください。`,"settings.mimoInstructionStoryPrompt":`物語の語り手として、展開に合わせて強調や間を変え、奥行きのある朗読にしてください。`,"settings.mimoInstructionArgumentPrompt":`怒りを帯びた鋭い反論の口調で、強いアクセントと短く力強いフレーズを使ってください。`,"settings.mimoInstructionWhisperPrompt":`近くで秘密を伝えるように、音量を抑えて柔らかく、ゆっくりささやいてください。`,"settings.mimoInstructionCutePrompt":`軽やかで甘い口調で、発音を軽く、語尾を少し上げ、遊び心を添えてください。`,"settings.mimoInstructionCantonesePrompt":`広東語の発音で、自然で滑らかな抑揚を付けて読んでください。`,"settings.mimoInstructionHenanPrompt":`河南方言の発音と抑揚で、会話のテンポを保って読んでください。`,"settings.mimoInstructionSichuanPrompt":`四川方言の発音と抑揚で、自然な会話のテンポで読んでください。`,"settings.mimoInstructionDongbeiPrompt":`中国東北方言の発音と抑揚で、朗らかな表現と自然なリズムで読んでください。`,"settings.speechInstructionPlaceholder":`例:優しく、明るく、物語を語るように`,"settings.speechInstructionHint":`感情、口調、スタイルを指定します。空欄なら標準の読み方になります`,"settings.speechInstructionInfo":`読み上げ指示の制限`,"settings.speechInstructionLimitations":`Xiaomi と Doubao 標準音声の指示は別々に保存されます。効果はモデル、音色、文章によって異なるため、先に試聴してください。
6
6
  ブラウザー音声と Doubao 音声クローンは指示に対応していません`,"settings.speechInstructionNatural":`自然`,"settings.speechInstructionGentle":`優しく`,"settings.speechInstructionGentlePrompt":`優しく温かみのある自然な口調で読んでください。`,"settings.speechInstructionCheerful":`明るく`,"settings.speechInstructionCheerfulPrompt":`明るく楽しそうな、元気な口調で読んでください。`,"settings.speechInstructionCalm":`落ち着いて`,"settings.speechInstructionCalmPrompt":`落ち着いた控えめな口調で読んでください。`,"settings.speechInstructionStory":`語り聞かせ`,"settings.speechInstructionStoryPrompt":`物語を語るように、内容に合わせて自然に感情を込めてください。`,"settings.speechInstructionArgument":`口論`,"settings.speechInstructionArgumentPrompt":`相手に反論しているように、強気で対抗する口調で読んでください。`,"settings.speechInstructionWhisper":`ささやき`,"settings.speechInstructionWhisperPrompt":`耳元で秘密を話すように、親密な ASMR の雰囲気でそっとささやいてください。`,"settings.speechInstructionShy":`恥じらいと期待`,"settings.speechInstructionShyPrompt":`恥ずかしそうにためらいながら、親しみと距離が縮まる期待をにじませてください。`,"settings.speechInstructionWeary":`人生に疲れて`,"settings.speechInstructionWearyPrompt":`苦労を重ねてきた人が打ち明けるように、低く少しかすれた声で、疲れと寂しさを込めてください。`,"settings.speechInstructionTearful":`涙声`,"settings.speechInstructionTearfulPrompt":`悲しみと傷ついた気持ちで、涙をこらえながら震える声で読んでください。`,"settings.speechInstructionCoy":`甘える`,"settings.speechInstructionCoyPrompt":`優しく愛情深い、少し甘えるような口調に、いたずらっぽさを添えてください。`,"settings.speechInstructionCute":`かわいい声`,"settings.speechInstructionCutePrompt":`少し高めの軽く甘い声で、かわいらしく、少しおちゃめに読んでください。`,"settings.speechInstructionSichuan":`四川方言`,"settings.speechInstructionCantonese":`広東語`,"settings.speechInstructionCantonesePrompt":`日常会話のような、自然でこなれた広東語で読んでください。`,"settings.speechInstructionShanghai":`上海方言`,"settings.speechInstructionShanghaiPrompt":`日常会話のような自然な上海語で読んでください。`,"settings.speechInstructionHenan":`河南方言`,"settings.speechInstructionHenanPrompt":`日常会話のような自然な河南方言で読んでください。`,"settings.speechInstructionTianjin":`天津方言`,"settings.speechInstructionTianjinPrompt":`日常会話のような自然な天津方言で読んでください。`,"settings.speechInstructionShaanxi":`陝西方言`,"settings.speechInstructionShaanxiPrompt":`日常会話のような自然な陝西方言で読んでください。`,"settings.speechInstructionDongbei":`東北方言`,"settings.speechInstructionDongbeiPrompt":`親しみやすい日常会話の口調で、自然な中国東北方言で読んでください。`,"settings.speechInstructionSichuanPrompt":`日常会話のような自然な四川なまりの中国語で読んでください。`,"settings.speechInstructionBeijing":`北京方言`,"settings.speechInstructionBeijingPrompt":`気軽な会話のように、少しアル化を交えた自然な北京なまりの中国語で読んでください。`,"settings.doubaoKeyConfigured":`キーを保存しました。試聴して権限と音色の利用可否を確認してください`,"settings.doubaoCustomVoice":`カスタム音色 ID`,"settings.doubaoCustomVoiceHint":`別の標準音色 ID を入力`,"settings.doubaoVoiceSceneGeneral":`日常会話`,"settings.doubaoVoiceSceneRole":`キャラクター音声`,"settings.doubaoVoiceSceneDubbing":`表現豊かな吹き替え`,"settings.doubaoVoiceSceneReading":`語り聞かせ`,"settings.doubaoVoiceChinese":`中国語`,"settings.doubaoVoiceId":`音色 ID`,"settings.doubaoClonedVoice":`クローン音色 ID`,"settings.doubaoClonedVoiceLabel":`クローン音色`,"settings.doubaoStandardVoiceHistory":`標準音色 ID の履歴`,"settings.doubaoClonedVoiceHistory":`クローン音色 ID の履歴`,"settings.voiceRemark":`音色のメモ名(任意)`,"settings.voiceTagEdit":`メモ名を編集`,"settings.voiceTagRemove":`履歴から削除`,"settings.voiceTagConfirm":`削除しますか?`,"settings.voiceRemarkHint":`タグ表示用にこのブラウザーに保存します。空欄なら音色 ID を表示します`,"settings.doubaoCloneHint":`Doubao コンソールで作成したクローン音色 ID を入力してください`,"settings.doubaoVoiceLibrary":`音色ライブラリを開く`,"settings.doubaoCreateVoice":`音色を作成`,"settings.doubaoVoiceRequired":`選択した Doubao モデルの音色 ID を入力してください`,"settings.doubaoStreamingHint":`返答の生成に合わせて再生します`,"settings.previewLoadingDoubao":`Doubao に接続中…`,"settings.previewPlayingDoubao":`Doubao を再生中。クリックで停止`,"settings.previewCompletedDoubao":`Doubao の試聴が完了しました`,"settings.previewSaveKeyFirst":`試聴する前に API キーを保存してください`,"settings.previewErrorVoiceUnavailable":`音色を利用できません。ID、モデル、権限を確認してください`,"settings.previewErrorResourceUnavailable":`このキーでは選択した Doubao リソースを利用できません`,"settings.previewErrorBufferLimit":`音声バッファーの上限に達したため再生を停止しました`,"error.voiceUnavailable":`音色を利用できません。モデル、音色 ID、権限を確認してください。`,"error.resourceUnavailable":`このキーでは選択したモデルのリソースを利用できません。`,"error.apiKeyRejected":`音声 API キーが拒否されました。設定を確認してください。`,"error.rateLimited":`音声サービスの利用上限に達しました。しばらくしてからお試しください。`,"error.timeout":`音声合成がタイムアウトしました。もう一度お試しください。`,"error.bufferLimit":`音声バッファーの上限に達したため再生を停止しました。`,"history.title":`音声履歴`,"history.shortTitle":`履歴`,"history.backToSettings":`設定に戻る`,"history.search":`音声の概要を検索`,"history.source":`作成元`,"history.all":`すべて`,"history.untitled":`無題の音声`,"history.characters":`文字`,"history.expand":`概要を展開・折りたたむ`,"history.noResults":`一致する音声がありません。`,"history.resetFilters":`絞り込みを解除`,"history.savedHere":`保存済み`,"history.temporary":`今回のアクセス中のみ利用可能`,"history.clearConfirm":`音声履歴をすべて削除しますか? 絞り込みで非表示の音声も含みます。元に戻せません。`,"history.confirmDelete":`削除を確定`,"history.confirmClear":`確定`,"history.cancel":`キャンセル`,"history.actionFailed":`操作を完了できませんでした。もう一度お試しください。`,"history.player":`履歴の音声プレーヤー`,"history.selectAudio":`もう一度聴く音声を選んでください。`,"history.play":`再生`,"history.pause":`一時停止`,"history.retry":`再生を再試行`,"history.seek":`再生位置`,"history.state.idle":`再生できます`,"history.state.loading":`音声を読み込み中…`,"history.state.playing":`再生中`,"history.state.paused":`一時停止中`,"history.state.ended":`再生終了`,"history.error.blocked":`ブラウザーが再生をブロックしました。「再生を再試行」を選んでください。`,"history.error.decode":`この音声をデコードできません。再試行するか、ファイルをダウンロードしてください。`,"history.error.failed":`音声を再生できませんでした。再試行するか、ファイルをダウンロードしてください。`,"history.hint":`最大 100 件 / 100 MB`,"history.empty":`生成された音声はまだありません。`,"history.loading":`音声履歴を読み込み中…`,"history.memory":`ブラウザーの保存領域が使えないか、容量が不足しています。履歴は今回のみ有効です。残す音声はダウンロードしてください。`,"history.skipped":`100 MB を超える音声は履歴に保存されませんでした。`,"history.listen":`もう一度聴く`,"history.download":`ダウンロード`,"history.delete":`削除`,"history.clear":`すべて削除`,"history.conversation":`会話`,"history.preview":`設定の試聴`,"history.service":`サービス経由の再生`,"action.play":`読み上げ`,"action.pause":`読み上げを一時停止`,"action.resume":`読み上げを再開`,"action.loading":`音声を生成中`,"action.cancel":`音声生成をキャンセル`,"action.stop":`読み上げを停止`,"action.localFallback":`ローカル音声`,"action.retry":`音声を再生成`,"error.noText":`この返答には読み上げられる本文がありません。`,"error.request":`音声を生成できませんでした。`,"error.play":`自動再生がブロックされました。「読み上げ」をクリックしてください。`,"error.localNotAllowed":`ブラウザー音声がブロックされました。「読み上げ」をクリックして再試行してください。`,"error.localVoiceUnavailable":`選択したブラウザー音声を利用できません。別の音声を選んでください。`,"error.localMossUnreachable":`ローカルの MOSS サービスに接続できません。URL と状態を確認してください。`,"error.localMossVoiceMissing":`ローカルの MOSS 音声が選択されていません。`,"error.localMossInvalidUrl":`ローカル MOSS 音声の URL が無効です。`,"error.localMossTimeout":`ローカル MOSS の合成がタイムアウトしました。`,"error.localMossFailed":`ローカル MOSS の音声合成に失敗しました。`,"error.localTimeout":`ブラウザー音声が 2 分以内に応答しなかったため、再生を停止しました。`,"error.localAudioDevice":`音声デバイスでエラーが発生しました。システムのサウンド設定を確認してください。`,"error.localSynthesis":`ローカル音声の合成に失敗しました。もう一度お試しください。`,"settings.title":`音声読み上げ(Xiaomi MiMo)`,"settings.description":`Xiaomi MiMo または Doubao で会話を読み上げます`,"settings.minimalMode":`シンプル表示`,"settings.minimalModeOn":`オン`,"settings.minimalModeOff":`オフ`,"settings.minimalModeShort":`シンプル`,"settings.defaultModeShort":`クラシック`,"settings.enabled":`音声再生`,"settings.enabledOnLabel":`クジラメイドが放送中`,"settings.enabledOffLabel":`クジラメイドはお休み中`,"settings.enabledHint":`オフにすると音声設定を非表示にし、自動読み上げを停止します`,"settings.apiKey":`API キー`,"settings.apiKeyStatus":`新しいキーを保存するまで、現在のキーは変わりません`,"settings.apiKeyLoading":`キーを確認中…`,"settings.apiKeyMissing":`このサービスの API キーを入力して保存してください`,"settings.apiKeyRecognized":`キーの形式を確認しました。試聴して接続を確認してください`,"settings.apiKeyUnsupported":`キーは sk- または tp- で始まる必要があります`,"settings.apiKeyUnsupportedSaved":`保存されたキーの形式に対応していません。置き換えてください`,"settings.apiKeyUnavailable":`キーを確認できません。接続を確認してください`,"settings.apiKeyPendingSave":`新しいキーで試聴するには保存してください`,"settings.saveRejected":`ホストが設定の更新を拒否しました。設定が書き込み可能か確認して再試行してください`,"settings.getApiKey":`API キーを取得`,"settings.apiKeyIdleCopy1":`もう見てもいい?`,"settings.apiKeyIdleCopy2":`キーはちゃんとしまった?`,"settings.apiKeyIdleCopy3":`保存したら、放送開始!`,"settings.apiKeyIdleCopy4":`キーは大切に守るね`,"settings.apiKeyFocusCopy1":`はい、目を隠したよ!`,"settings.apiKeyFocusCopy2":`安心して、何も見えてないよ`,"settings.apiKeyFocusCopy3":`プライバシーモード、オン!`,"settings.apiKeyFocusCopy4":`ゆっくりでいいよ、秘密は守るから`,"settings.autoPlay":`自動読み上げ`,"settings.autoPlayOnLabel":`わたしが読み上げるね`,"settings.autoPlayOffLabel":`必要なときに呼んでね`,"settings.autoPlayHint":`ブラウザーが自動再生をブロックすることがあります`,"settings.voiceReadingNav":`音声読み上げ`,"settings.voiceReadingTitle":`音声読み上げ`,"settings.voiceReadingSource":`GitHub のソース`,"settings.voiceReadingQq":`QQ グループ`,"settings.voiceReadingQqCodeAlt":`QQ グループの QR コード`,"settings.voiceReadingQqClose":`QR コードを閉じる`,"settings.voiceReadingPluginSettings":`プラグイン設定`,"settings.voiceReadingWarningDisabled":`音声がオフです。{settings} で有効にしてください`,"settings.voiceReadingWarningApiKeyMissing":`API キーがありません。{settings} で追加してください`,"settings.voiceReadingWarningApiKeyInvalid":`API キーの形式に対応していません。{settings} を確認してください`,"settings.voiceReadingWarningApiKeyUnavailable":`API キーを確認できません。接続を確認してください`,"settings.voiceReadingWarningVoiceRequired":`音色が未選択です。{settings} で選択または入力してください`,"settings.voiceReadingDismissWarning":`警告を閉じる`,"settings.voiceReadingVoice":`読み上げ音声`,"settings.voiceReadingHintXiaomi":`Xiaomi MiMo の内蔵音色`,"settings.voiceReadingHintVoiceDesign":`説明から音声を生成するか、プリセットを選択します`,"settings.voiceReadingHintDoubaoStandard":`Doubao 標準合成の音色`,"settings.voiceReadingHintDoubaoCloned":`以前使ったクローン音色 ID を選択します`,"settings.voiceReadingCustomVoice":`カスタム(現在)`,"settings.voiceReadingVolume":`読み上げ音量`,"settings.voiceReadingRate":`読み上げ速度`,"settings.voiceReadingAutoPlay":`自動読み上げ`,"settings.voiceReadingSound":`効果音`,"settings.voiceReadingSoundHint":`クリック音とタスクの効果音を再生します`,"settings.voiceReadingReadOnly":`設定は読み取り専用です`,"settings.voiceReadingUnavailable":`音声設定を利用できません`,"settings.voiceReadingSaveFailed":`保存できませんでした。もう一度お試しください`,"settings.detailedVoiceConfig":`ミキシングコンソール`,"settings.voiceVolume":`音声音量`,"settings.voiceRate":`再生速度`,"settings.voiceRateHint":`0.5×~2.0×。1.0× は元の速度です。
7
- Doubao は次回の合成から、Xiaomi とブラウザー音声は再生中に反映します。Xiaomi のストリーミングでは音程も変わります`,"settings.voiceRateInfo":`再生速度について`,"settings.readScope":`読み上げ範囲`,"settings.readScopeSmart":`スマート`,"settings.readScopeFull":`全文`,"settings.readScopeFirstSegment":`最初の段落`,"settings.readScopeSmartHint":`自動:短い返答は全文、長い返答は最初の 2 段落と必要に応じた締めの言葉。手動:全文`,"settings.readScopeFullHint":`自動・手動ともに返答の全文を読み上げます`,"settings.readScopeFirstSegmentHint":`自動・手動ともに最初の段落だけを読み上げます`,"settings.summaryPresetModel":`プリセットモデル`,"settings.summaryVoiceDesignModel":`カスタム音声デザイン`,"settings.localSpeechAutoSummary":`クラウド優先`,"settings.stateOn":`オン`,"settings.stateOff":`オフ`,"settings.model":`音声ソース設定`,"settings.presetModel":`プリセット音色(mimo-v2.5-tts)`,"settings.voiceDesignModel":`音声デザイン(mimo-v2.5-tts-voicedesign)`,"settings.presetModelShort":`プリセット(MiMo-TTS)`,"settings.voiceDesignModelShort":`音声デザイン(MiMo-VoiceDesign)`,"settings.localSpeechMode":`音声の優先順位`,"settings.localSpeechAuto":`クラウド優先`,"settings.localSpeechFirst":`ローカル優先`,"settings.localSpeechDisabled":`ローカル音声を無効化`,"settings.localSpeechAutoHint":`クラウドを優先し、再生開始前に失敗した場合はブラウザー音声を使います`,"settings.localSpeechFirstHint":`ブラウザー音声を優先し、失敗した場合はクラウドを使います`,"settings.localSpeechDisabledHint":`クラウド音声のみを使い、ブラウザー音声には切り替えません`,"settings.localSpeechUnavailableHint":`ブラウザー音声がありません。クラウド優先を使ってください`,"settings.localVoice":`ブラウザー音声`,"settings.localVoiceLoading":`ブラウザー音声を読み込み中…`,"settings.localVoiceUnavailable":`ブラウザー音声がありません`,"settings.localVoiceOffline":`オフライン`,"settings.localVoiceOnline":`オンライン`,"settings.localVoiceEngine":`ローカル音声の取得元`,"settings.localVoiceEngineBrowser":`ブラウザー`,"settings.localVoiceEngineMoss":`MOSS ローカル`,"settings.mossProvider":`MOSS Nano (Local)`,"settings.experimental":`試験的`,"settings.more":`その他`,"settings.moreHint":`音量・速度・ローカル音声・読み上げ範囲・優先設定`,"settings.announcementsMoreHint":`ホスト連携、読み上げ元とプラグイン連携`,"settings.mossBaseURL":`MOSS サービスの URL`,"settings.mossProbe":`検出`,"settings.mossCopyDeployHint":`デプロイ用プロンプトをコピー`,"settings.mossDeployHintBefore":`まだデプロイしていませんか?`,"settings.mossDeployHintAction":`プロンプトをコピー`,"settings.mossDeployHintAfter":`して DSH に任せましょう`,"settings.mossDeployCopied":`コピーしました。DSH に貼り付けてください。`,"settings.mossDeployCopyFailed":`コピーに失敗しました。再試行してください。`,"settings.mossProbingShort":`検出中…`,"settings.mossProbing":`MOSS サービスを検出しています…`,"settings.mossOnlineReady":`オンライン · 準備完了`,"settings.mossWarming":`オンライン · ウォームアップ中`,"settings.mossNotProbed":`まだ検出していません`,"settings.mossInvalidUrl":`MOSS の URL が無効です`,"settings.mossTimeout":`MOSS サービスがタイムアウトしました`,"settings.mossUnreachable":`MOSS サービスに接続できません`,"settings.mossProbeFailed":`MOSS の検出に失敗しました`,"settings.mossVoice":`MOSS 音声`,"settings.mossVoiceProbeFirst":`先に MOSS サービスを検出して音声を読み込んでください`,"settings.mossBuiltInVoice":`内蔵音声`,"settings.mossLocalFirstHint":`「ローカル優先」にすると MOSS 音声が優先されます。「クラウド優先」ではクラウドの再生開始前に失敗した場合のみ切り替わります。`,"settings.mossLocalDisabledHint":`ローカル音声が無効なため、MOSS 音声は使われません。`,"settings.modelAutoPlayHintPreset":`プリセット音色はストリーミングに対応しています`,"settings.modelAutoPlayHintVoiceDesign":`返答の完成後に自動再生します`,"settings.voice":`内蔵音色`,"settings.format":`音声形式`,"settings.formatPcm":`PCM(ストリーミング)`,"settings.formatMp3":`MP3(完成した音声)`,"settings.formatWav":`WAV(完成した音声)`,"settings.formatPcmHint":`届いた音声から再生します。最初の音声が届く前に失敗した場合は MP3 に切り替えます`,"settings.formatMp3Hint":`生成後に再生します。ファイルサイズは小さめです`,"settings.formatWavHint":`生成後に再生します。無損失で、ファイルサイズは大きめです`,"settings.voiceDesignPrompt":`音声デザイン`,"settings.customVoiceOption":`カスタム`,"settings.customVoiceSummary":`独自の音声説明を入力`,"settings.voiceDesignPromptHint":`年齢、性別、声質、速さ、感情を説明してください。場面や動作は不要です`,"settings.voiceDesignPlaybackMode":`読み上げモード`,"settings.voiceDesignPlaybackComplete":`全文`,"settings.voiceDesignPlaybackSegmented":`分割`,"settings.voiceDesignPlaybackFirstSegment":`最初の段落`,"settings.voiceDesignPlaybackCompleteHint":`返答全体を一度に生成して統一感を保ちます。長文では音声が乱れることがあります`,"settings.voiceDesignPlaybackSegmentedHint":`分割して生成し、長文の再生開始を早めます。声の表現が変わることがあります`,"settings.voiceDesignPlaybackFirstSegmentHint":`最初の段落だけを読み、開始時間と使用量を抑えます`,"settings.previewTitle":`放送デスク`,"settings.previewText":`試聴テキスト`,"settings.previewDefaultText":`こんにちは、クジラメイドです。一緒に声の世界を探検できてうれしいです!`,"settings.previewDefaultTextPoetry":`風が雲を手紙に折り、月がそっと署名する。帰り道には、いつも星の光があなたを照らしますように。`,"settings.previewDefaultTextInspiration":`自分のペースで進みましょう。春が遅れても種は花を咲かせます。一度つまずいても、旅は続けられます。`,"settings.previewDefaultTextReflection":`すべての風をとどめることはできなくても、帆の向きは選べます。答えは今日の生き方の中にあるのかもしれません。`,"settings.previewDefaultTextHumor":`目覚ましが鳴ったので、あと五分寝ることに可決しました。一時間後も、その決議は有効でした。`,"settings.previewPlaceholder":`試聴するテキストを入力`,"settings.previewPlay":`試聴を再生`,"settings.previewListen":`試聴`,"settings.previewStopShort":`停止`,"settings.previewStop":`試聴を停止`,"settings.previewHint":`クラウド音声の試聴にはキーの保存が必要です`,"settings.previewLoading":`準備中…`,"settings.previewPlaying":`再生中。クリックで停止`,"settings.previewLoadingMimo":`MiMo に接続中…`,"settings.previewLoadingLocal":`ブラウザー音声を準備中…`,"settings.previewPlayingMimo":`MiMo を再生中。クリックで停止`,"settings.previewPlayingLocal":`ブラウザー音声を再生中。クリックで停止`,"settings.previewCompletedMimo":`MiMo の試聴が完了しました`,"settings.previewCompletedLocal":`ローカル音声の試聴が完了しました`,"settings.previewLoadingBreeze":`Breeze に接続中…`,"settings.previewPlayingBreeze":`Breeze を再生中。クリックで停止`,"settings.previewCompletedBreeze":`Breeze の試聴が完了しました`,"settings.previewErrorApiKeyMissing":`API キーを保存するか、ブラウザー音声を有効にしてください`,"settings.previewErrorApiKeyRejected":`キーが拒否されました。確認または置き換えてください`,"settings.previewErrorRateLimited":`リクエストが多すぎます。少し待ってからお試しください`,"settings.previewErrorTimeout":`タイムアウトしました。接続を確認して再試行してください`,"settings.previewErrorLocalUnavailable":`ブラウザー音声がありません`,"settings.previewErrorAutoplay":`再生がブロックされました。もう一度試聴をクリックしてください`,"settings.previewFailed":`試聴に失敗しました。設定と接続を確認してください`,"settings.save":`保存`,"settings.saving":`保存中…`,"settings.saved":`保存済み`,"settings.unsaved":`未保存`,"settings.overridden":`上書き済み`,"settings.reset":`初期値に戻す`,"settings.discard":`変更を破棄`,"settings.failed":`保存できませんでした。もう一度お試しください`,"settings.source":`ソースを見る`,"settings.readOnly":`DSH の設定は読み取り専用です`,"settings.secretPlaceholder":`このサービスの新しいキーを入力`,"settings.expand":`設定を展開`,"settings.collapse":`設定を折りたたむ`,"settings.soundEffectsTitle":`効果音`,"settings.soundEffectsEnabled":`効果音を有効化`,"settings.soundEffectsVolume":`音量`,"settings.soundEffectsPack":`効果音パック`,"settings.soundEffectsTask":`タスクの効果音`,"settings.soundEffectsClick":`クリック音`,"settings.soundEffectsOn":`すべての効果音`,"settings.soundEffectsOff":`オフ`,"settings.soundEffectsOnLabel":`魔法の効果音をオン`,"settings.soundEffectsOffLabel":`魔法の効果音をオフ`,"settings.soundEffectsBubbleOff":`UISFX は無効です`,"settings.soundEffectsClickOnly":`クリック音のみ`,"settings.soundEffectsTaskOnly":`タスクの効果音のみ`,"settings.soundEffectsTurnOn":`効果音をオン`,"settings.soundEffectsTurnOff":`効果音をオフ`,"settings.soundEffectsSynced":`タスクとクリックを同期`,"settings.soundEffectsPreviewLabel":`効果音の試聴`,"settings.soundEffectsPreview.start":`開始音を試聴`,"settings.soundEffectsPreview.complete":`完了音を試聴`,"settings.soundEffectsPreview.success":`成功音を試聴`,"settings.soundEffectsPreview.error":`エラー音を試聴`,"settings.soundEffectsPreview.notification":`通知音を試聴`,"settings.soundEffectsPreview.press":`クリック音を試聴`,"settings.soundEffectsPreview.select":`選択音を試聴`,"settings.soundEffectsPreview.toggle-on":`オンの効果音を試聴`,"settings.soundEffectsPreview.toggle-off":`オフの効果音を試聴`,"settings.soundEffectsPreview.send":`送信音を試聴`,"settings.soundEffectsPreview.open":`開く効果音を試聴`,"settings.soundEffectsPreview.close":`閉じる効果音を試聴`,"settings.soundEffectsPreview.delete":`削除音を試聴`,"settings.soundEffectsPreview.stop":`停止音を試聴`,"settings.soundEffectsPreview.queued":`待機音を試聴`,"settings.soundEffectsDescription":`クリックやタスクのイベント音`,"settings.soundEffectsSupported":`対応音:開始、完了、成功、エラー、通知、クリック、選択、オン、オフ、送信、開く、閉じる、削除、停止、待機`},mi={"settings.externalManage":`Gérer les fournisseurs`,"settings.externalProviderAdapter":`Adaptateur de fournisseurs`,"settings.acceptExternalProviders":`Accepter les fournisseurs externes`,"settings.acceptExternalProvidersHint":`Autoriser les plugins externes à fournir la voix. Désactivez puis enregistrez pour revenir au fournisseur intégré.`,"settings.externalSwitchFailed":`Impossible de changer de fournisseur. Veuillez réessayer.`,"settings.externalOptionsHint":`Les options disponibles sont définies par le plugin externe.`,"settings.externalManaged":`Géré par un plugin externe. Configurez la voix dans ce plugin.`,"settings.externalNotReady":`Le service vocal externe n’est pas prêt. Vérifiez sa configuration.`,"settings.externalDisconnected":`Connexion au service vocal interrompue. La synthèse reprendra après reconnexion.`,"settings.externalLoading":`Génération audio avec le service vocal externe`,"settings.externalPlaying":`Lecture de l’audio du service externe`,"settings.externalCompleted":`Aperçu vocal externe terminé`,"settings.previewPresets":`Exemples de texte`,"settings.previewPresetGreeting":`Bonjour`,"settings.previewPresetPoetry":`Poésie`,"settings.previewPresetInspiration":`Courage`,"settings.previewPresetReflection":`Réflexion`,"settings.previewPresetHumor":`Humour`,"settings.previewPresetNews":`Actualités`,"settings.previewPresetStory":`Récit`,"settings.previewPresetService":`Accueil`,"settings.previewPresetDialogue":`Dialogue`,"settings.previewDefaultTextStory":`À la fermeture, un chat roux entra et se coucha sur un vieux carnet de voyage oublié.`,"settings.previewDefaultTextService":`Bonjour et bienvenue ! Dites-moi ce qui vous pose problème. Nous allons le résoudre ensemble.`,"settings.previewDefaultTextDialogue":`Tu t’en souviens ? Je pensais être seule. Depuis le début, nous allions dans la même direction.`,"settings.previewDefaultTextNews":`Bonsoir. La bibliothèque ouvre désormais le soir, pour lire au calme après le travail.`,"settings.previewDownload":`Télécharger l’audio de l’aperçu actuel`,"settings.previewDownloadUnavailable":`Générez un aperçu audio avant de le télécharger`,"settings.previewDownloadLocal":`La voix du navigateur ne peut pas être téléchargée. Essayez une voix cloud ou MOSS.`,"settings.previewDownloadFailed":`Échec du téléchargement. Réessayez.`,...ci,...ui,...fi,"settings.moreProviders":`Plus de fournisseurs`,"settings.breezeEnabled":`Activer Breeze Blue`,"settings.providerMinimum":`Xiaomi reste activé ; gardez Doubao ou Breeze activé.`,"settings.breezeAudioTags":`Balises audio`,"settings.xiaomiAudioTagsHint":`Voix Xiaomi prédéfinies : style en début de texte, sons dans le texte. Accepte (), (), [], descriptions libres et combinaisons. Le chant s’insère au début. Pour Voice Design, utilisez les instructions vocales.`,"settings.breezeAudioTagsHint":`Les balises sont insérées dans le texte d’essai. Crochets pour le chinois, parenthèses pour l’anglais. Breeze TTS uniquement.`,"settings.breezeAudioTagsChinese":`中文`,"settings.breezeAudioTagsEnglish":`English`,"settings.audioTagsContinuous":`Ajout multiple`,"settings.audioTagsContinuousHint":`Épingler le panneau de balises`,"settings.providerBreeze":`Breeze`,"settings.breezeCustomVoice":`Identifiant vocal personnalisé`,"settings.breezeCustomVoiceHint":`Saisissez un autre identifiant vocal Breeze`,"settings.breezeVoiceHistory":`Historique des identifiants Breeze`,"settings.breezeVoiceHint":`Identifiant vocal Breeze`,"settings.voiceReadingHintBreeze":`Saisissez un identifiant vocal Breeze`,"settings.breezeInstructionHint":`Breeze ajuste le jeu selon la scène, l’intention, l’émotion et le rythme ; laissez vide pour le rendu par défaut`,"settings.breezeInstructionLabelWarmCompanion":`Présence douce`,"settings.breezeInstructionTextWarmCompanion":`Parlez doucement à un ami proche, avec une chaleur sincère, un rythme tranquille et des pauses naturelles qui laissent place à une réponse.`,"settings.breezeInstructionLabelPlayfulTeasing":`Taquinerie`,"settings.breezeInstructionTextPlayfulTeasing":`Parlez avec une taquinerie affectueuse et légère, des accents vifs et un sourire dans la voix, sans dureté.`,"settings.breezeInstructionLabelSeriousAnnouncement":`Annonce formelle`,"settings.breezeInstructionTextSeriousAnnouncement":`Lisez clairement comme un présentateur professionnel, avec un ton objectif et assuré, un débit modéré et des pauses naturelles autour des informations importantes.`,"settings.breezeInstructionLabelEncouragingSupport":`Encouragement`,"settings.breezeInstructionTextEncouragingSupport":`Encouragez avec une voix chaleureuse et ferme qui exprime confiance et soutien, en devenant plus lumineux sans crier.`,"settings.breezeInstructionLabelSleepyBedtime":`Douceur du soir`,"settings.breezeInstructionTextSleepyBedtime":`Parlez doucement comme pour souhaiter bonne nuit, avec une voix détendue, un rythme lent, des fins de phrase douces et des pauses paisibles.`,"settings.breezeInstructionLabelWhisperFear":`Chuchotement inquiet`,"settings.breezeInstructionLabelExcitedSurprise":`Surprise enthousiaste`,"settings.breezeInstructionLabelSarcasticDisbelief":`Incrédulité sarcastique`,"settings.breezeInstructionLabelNervousHumor":`Humour nerveux`,"settings.breezeInstructionLabelRestrainedGrief":`Chagrin contenu`,"settings.breezeInstructionLabelCalmNarration":`Narration calme`,"settings.breezeInstructionTextWhisperFear":`Chuchotez très doucement et avec tension, comme si quelqu’un pouvait vous entendre.`,"settings.breezeInstructionTextExcitedSurprise":`Parlez avec une surprise vive et enthousiaste, avec une énergie qui monte.`,"settings.breezeInstructionTextSarcasticDisbelief":`Parlez avec un sarcasme sec et une incrédulité distante, comme si l’idée était évidemment mauvaise.`,"settings.breezeInstructionTextNervousHumor":`Utilisez un humour nerveux, avec un petit rire après la première phrase pour cacher la panique.`,"settings.breezeInstructionTextRestrainedGrief":`Parlez en retenant vos larmes, avec une voix légèrement brisée et une émotion contenue.`,"settings.breezeInstructionTextCalmNarration":`Lisez comme un narrateur calme et clair, à un rythme régulier avec des pauses nettes.`,"detail.star":`Star`,"detail.manual":`Manuel`,"detail.workshop":`Atelier`,"detail.keyLoading":`Vérification de la clé`,"detail.keyMissing":`Clé non configurée`,"detail.keyRecognized":`Format de clé reconnu`,"detail.keyUnrecognized":`Format de clé non pris en charge`,"detail.keyUnavailable":`Vérification de la clé impossible`,"detail.retry":`Réessayer`,"detail.preview":`Détails du plugin`,"detail.previewChanging":`Simuler une modification du plugin`,"detail.previewKey":`État de clé simulé`,"plugin.changing":`Modification du plugin en cours. La lecture vocale est suspendue.`,"onboarding.title":`Les nouveautés`,"onboarding.summary":`Les fournisseurs vocaux externes sont là, avec plus de voix au choix.`,"onboarding.details":`Détails de la mise à jour`,"onboarding.externalSpeechTitle":`Connecter des fournisseurs vocaux externes`,"onboarding.externalVoicesTitle":`Trouver sa voix dans 音色工坊`,"onboarding.externalSwitchTitle":`Changer facilement de fournisseur`,"onboarding.featureExternalSpeech":`Connecter des fournisseurs vocaux externes`,"onboarding.featureExternalVoices":`Choisir modèles, voix et balises audio`,"onboarding.featureExternalSwitch":`Changer de fournisseur avec la carte du haut`,"onboarding.configure":`Ouvrir l’atelier vocal`,"onboarding.github":`Nous soutenir avec une étoile`,"onboarding.preview":`Essayer la voix du navigateur`,"onboarding.dismiss":`Plus tard`,"onboarding.sample":`Bonjour, je suis votre assistante baleine. La voix est prête. Explorons le monde ensemble.`,"settings.announcementsApprovals":`Rappels de validation`,"settings.announcementsApprovalsHint":`Annonce les opérations en attente de validation dans cette conversation ; arrêt après traitement ou retrait`,"settings.announcementsJobs":`Résultats des tâches en arrière-plan`,"settings.announcementsJobsHint":`Annonce les résultats des tâches observées dans cette conversation ; nécessite le service de tâches`,"announcements.approval":`Une opération attend votre validation.`,"announcements.job":`Tâche en arrière-plan`,"announcements.jobCompleted":`Terminée.`,"announcements.jobFailed":`Échec.`,"announcements.jobKilled":`Annulée.`,"settings.soundEffectsScope":`Types de sons`,"settings.announcementsWhale":`dsh-whale-musume`,"settings.announcementsQuestions":`Titres des cartes de questions`,"settings.announcementsPetHint":`Lit les messages, réponses et repas du compagnon`,"settings.announcementsWhaleHint":`Autorise les demandes vocales de Whale Girl`,"settings.announcementsQuestionsHint":`Lit le titre de la question actuelle avec la lecture automatique ; arrêt au changement de question ou à la fermeture`,"settings.announcementsNone":`Aucune source activée`,"settings.inputAvoidance":`Priorité à la rédaction`,"settings.inputAvoidanceHint":`Suspend les lectures automatiques quand le champ de conversation actif contient un brouillon. Quittez-le ou videz-le pour autoriser les nouvelles lectures, sans rattrapage. Les essais manuels restent disponibles.`,"settings.importantAnnouncementsFirst":`Priorité aux alertes importantes`,"settings.importantAnnouncementsFirstHint":`Les demandes de validation et les échecs des tâches peuvent interrompre une lecture ordinaire. La saisie vocale et la rédaction restent prioritaires.`,"settings.hostIntegration":`Intégration à DSH`,"settings.showInHostSettings":`Raccourci des paramètres DSH`,"settings.showInHostSettingsHint":`Affiche la lecture vocale dans les paramètres DSH. Enregistrez pour appliquer.`,"settings.voiceInputCompatibility":`Priorité à la saisie vocale`,"settings.voiceInputCompatibilityHint":`Arrête la lecture et les effets sonores pendant la saisie vocale officielle DSH, y compris la transcription. Les sons interrompus ne reprennent pas. Enregistrez pour appliquer.`,"settings.announcementsTitle":`Sources des annonces`,"settings.announcementsPlugins":`Intégrations de plugins`,"settings.announcementsPluginsHint":`Le plugin correspondant doit être installé et activé`,"settings.passportIntegration":`Application Ai Passport`,"settings.passportIntegrationHint":`WhaleTalk Passport : des conversations vocales nomades avec DSH`,"settings.qqbotIntegration":`QQ Bot`,"settings.qqbotIntegrationHint":`Activé : envoie toute la réponse vocale automatiquement. Désactivé : envoie sur demande. Activez QQ Bot Megaphone puis enregistrez`,"settings.announcementsPet":`dsh-pet`,"settings.announcementsHint":`Gardez la voix activée et DSH Web ouvert. Les messages reçus pendant une lecture sont ignorés`,"settings.provider":`Fournisseur vocal`,"settings.providerXiaomi":`Xiaomi MiMo`,"settings.providerDoubao":`Doubao Voice`,"settings.switchProvider":`Changer de fournisseur`,"settings.doubaoStandardModel":`Synthèse standard (seed-tts-2.0)`,"settings.doubaoCloneModel":`Clonage vocal (seed-icl-2.0)`,"settings.speechInstruction":`Consigne vocale`,"settings.speechInstructionPresets":`Consignes prédéfinies`,"settings.speechInstructionCustom":`Instruction personnalisée`,"settings.mimoInstructionHint":`Styles pour Xiaomi. Laissez vide pour l’expression par défaut. Voice Design conserve la description de la voix`,"settings.doubaoInstructionHint":`Consignes pour Doubao Standard ; laissez vide pour l’expression habituelle de la voix`,"settings.mimoInstructionGentlePrompt":`Adoptez un ton chaleureux et doux, une articulation souple et claire et des fins de phrase détendues.`,"settings.mimoInstructionCheerfulPrompt":`Prenez un ton lumineux et vif, un rythme enjoué et des accents expressifs, comme pour annoncer une bonne nouvelle.`,"settings.mimoInstructionCalmPrompt":`Adoptez un ton calme et posé, un rythme régulier, des pauses nettes et une émotion retenue.`,"settings.mimoInstructionStoryPrompt":`Lisez comme un narrateur, en variant les accents et les pauses selon les événements pour donner du relief au récit.`,"settings.mimoInstructionArgumentPrompt":`Lisez sur un ton de colère et de confrontation, avec des accents appuyés et des phrases courtes et énergiques.`,"settings.mimoInstructionWhisperPrompt":`Chuchotez à faible volume, avec une articulation douce et un rythme lent, comme pour confier un secret à proximité.`,"settings.mimoInstructionCutePrompt":`Prenez un ton léger et doux, avec une articulation délicate, des fins de phrase légèrement montantes et une touche espiègle.`,"settings.mimoInstructionCantonesePrompt":`Lisez avec une prononciation cantonaise et une intonation naturelle et fluide.`,"settings.mimoInstructionHenanPrompt":`Lisez avec la prononciation et l’intonation du dialecte du Henan, à un rythme de conversation.`,"settings.mimoInstructionSichuanPrompt":`Lisez avec la prononciation et l’intonation du dialecte du Sichuan, à un rythme de conversation naturel.`,"settings.mimoInstructionDongbeiPrompt":`Lisez avec la prononciation et l’intonation du Nord-Est chinois, une expression franche et un rythme naturel.`,"settings.speechInstructionPlaceholder":`Exemple : douceur, joie ou narration`,"settings.speechInstructionHint":`Décrivez une émotion, un ton ou un style ; laissez vide pour la voix par défaut`,"settings.speechInstructionInfo":`Limites des consignes vocales`,"settings.speechInstructionLimitations":`Xiaomi et Doubao Standard enregistrent les consignes séparément. Le résultat varie selon le modèle, la voix et le texte ; faites un essai.
7
+ Doubao は次回の合成から、Xiaomi とブラウザー音声は再生中に反映します。Xiaomi のストリーミングでは音程も変わります`,"settings.voiceRateInfo":`再生速度について`,"settings.readScope":`読み上げ範囲`,"settings.readScopeSmart":`スマート`,"settings.readScopeFull":`全文`,"settings.readScopeFirstSegment":`最初の段落`,"settings.readScopeSmartHint":`自動:短い返答は全文、長い返答は最初の 2 段落と必要に応じた締めの言葉。手動:全文`,"settings.readScopeFullHint":`自動・手動ともに返答の全文を読み上げます`,"settings.readScopeFirstSegmentHint":`自動・手動ともに最初の段落だけを読み上げます`,"settings.summaryPresetModel":`プリセットモデル`,"settings.summaryVoiceDesignModel":`カスタム音声デザイン`,"settings.localSpeechAutoSummary":`クラウド優先`,"settings.stateOn":`オン`,"settings.stateOff":`オフ`,"settings.model":`音声ソース設定`,"settings.presetModel":`プリセット音色(mimo-v2.5-tts)`,"settings.voiceDesignModel":`音声デザイン(mimo-v2.5-tts-voicedesign)`,"settings.presetModelShort":`プリセット(MiMo-TTS)`,"settings.voiceDesignModelShort":`音声デザイン(MiMo-VoiceDesign)`,"settings.localSpeechMode":`音声の優先順位`,"settings.localSpeechAuto":`クラウド優先`,"settings.localSpeechFirst":`ローカル優先`,"settings.localSpeechDisabled":`ローカル音声を無効化`,"settings.localSpeechAutoHint":`クラウドを優先し、再生開始前に失敗した場合はブラウザー音声を使います`,"settings.localSpeechFirstHint":`ブラウザー音声を優先し、失敗した場合はクラウドを使います`,"settings.localSpeechDisabledHint":`クラウド音声のみを使い、ブラウザー音声には切り替えません`,"settings.localSpeechUnavailableHint":`ブラウザー音声がありません。クラウド優先を使ってください`,"settings.localVoice":`ブラウザー音声`,"settings.localVoiceLoading":`ブラウザー音声を読み込み中…`,"settings.localVoiceUnavailable":`ブラウザー音声がありません`,"settings.localVoiceOffline":`オフライン`,"settings.localVoiceOnline":`オンライン`,"settings.localVoiceEngine":`ローカル音声の取得元`,"settings.localVoiceEngineBrowser":`ブラウザー`,"settings.localVoiceEngineMoss":`MOSS ローカル`,"settings.mossProvider":`MOSS Nano (Local)`,"settings.experimental":`試験的`,"settings.more":`その他`,"settings.moreHint":`音量・速度・ローカル音声・読み上げ範囲・優先設定`,"settings.announcementsMoreHint":`ホスト連携、読み上げ元とプラグイン連携`,"settings.mossBaseURL":`MOSS サービスの URL`,"settings.mossProbe":`検出`,"settings.mossCopyDeployHint":`デプロイ用プロンプトをコピー`,"settings.mossDeployHintBefore":`まだデプロイしていませんか?`,"settings.mossDeployHintAction":`プロンプトをコピー`,"settings.mossDeployHintAfter":`して DSH に任せましょう`,"settings.mossDeployCopied":`コピーしました。DSH に貼り付けてください。`,"settings.mossDeployCopyFailed":`コピーに失敗しました。再試行してください。`,"settings.mossProbingShort":`検出中…`,"settings.mossProbing":`MOSS サービスを検出しています…`,"settings.mossOnlineReady":`オンライン · 準備完了`,"settings.mossWarming":`オンライン · ウォームアップ中`,"settings.mossNotProbed":`まだ検出していません`,"settings.mossInvalidUrl":`MOSS の URL が無効です`,"settings.mossTimeout":`MOSS サービスがタイムアウトしました`,"settings.mossUnreachable":`MOSS サービスに接続できません`,"settings.mossProbeFailed":`MOSS の検出に失敗しました`,"settings.mossVoice":`MOSS 音声`,"settings.mossVoiceProbeFirst":`先に MOSS サービスを検出して音声を読み込んでください`,"settings.mossBuiltInVoice":`内蔵音声`,"settings.mossLocalFirstHint":`「ローカル優先」にすると MOSS 音声が優先されます。「クラウド優先」ではクラウドの再生開始前に失敗した場合のみ切り替わります。`,"settings.mossLocalDisabledHint":`ローカル音声が無効なため、MOSS 音声は使われません。`,"settings.modelAutoPlayHintPreset":`プリセット音色はストリーミングに対応しています`,"settings.modelAutoPlayHintVoiceDesign":`返答の完成後に自動再生します`,"settings.voice":`内蔵音色`,"settings.format":`音声形式`,"settings.formatPcm":`PCM(ストリーミング)`,"settings.formatMp3":`MP3(完成した音声)`,"settings.formatWav":`WAV(完成した音声)`,"settings.formatPcmHint":`届いた音声から再生します。最初の音声が届く前に失敗した場合は MP3 に切り替えます`,"settings.formatMp3Hint":`生成後に再生します。ファイルサイズは小さめです`,"settings.formatWavHint":`生成後に再生します。無損失で、ファイルサイズは大きめです`,"settings.voiceDesignPrompt":`音声デザイン`,"settings.customVoiceOption":`カスタム`,"settings.customVoiceSummary":`独自の音声説明を入力`,"settings.voiceDesignPromptHint":`年齢、性別、声質、速さ、感情を説明してください。場面や動作は不要です`,"settings.voiceDesignPlaybackMode":`読み上げモード`,"settings.voiceDesignPlaybackComplete":`全文`,"settings.voiceDesignPlaybackSegmented":`分割`,"settings.voiceDesignPlaybackFirstSegment":`最初の段落`,"settings.voiceDesignPlaybackCompleteHint":`返答全体を一度に生成して統一感を保ちます。長文では音声が乱れることがあります`,"settings.voiceDesignPlaybackSegmentedHint":`分割して生成し、長文の再生開始を早めます。声の表現が変わることがあります`,"settings.voiceDesignPlaybackFirstSegmentHint":`最初の段落だけを読み、開始時間と使用量を抑えます`,"settings.previewTitle":`放送デスク`,"settings.previewText":`試聴テキスト`,"settings.previewDefaultText":`こんにちは、クジラメイドです。一緒に声の世界を探検できてうれしいです!`,"settings.previewDefaultTextPoetry":`風が雲を手紙に折り、月がそっと署名する。帰り道には、いつも星の光があなたを照らしますように。`,"settings.previewDefaultTextInspiration":`自分のペースで進みましょう。春が遅れても種は花を咲かせます。一度つまずいても、旅は続けられます。`,"settings.previewDefaultTextReflection":`すべての風をとどめることはできなくても、帆の向きは選べます。答えは今日の生き方の中にあるのかもしれません。`,"settings.previewDefaultTextHumor":`目覚ましが鳴ったので、あと五分寝ることに可決しました。一時間後も、その決議は有効でした。`,"settings.previewPlaceholder":`試聴するテキストを入力`,"settings.previewPlay":`試聴を再生`,"settings.previewListen":`試聴`,"settings.previewStopShort":`停止`,"settings.previewStop":`試聴を停止`,"settings.previewHint":`クラウド音声の試聴にはキーの保存が必要です`,"settings.previewLoading":`準備中…`,"settings.previewPlaying":`再生中。クリックで停止`,"settings.previewLoadingMimo":`MiMo に接続中…`,"settings.previewLoadingLocal":`ブラウザー音声を準備中…`,"settings.previewPlayingMimo":`MiMo を再生中。クリックで停止`,"settings.previewPlayingLocal":`ブラウザー音声を再生中。クリックで停止`,"settings.previewCompletedMimo":`MiMo の試聴が完了しました`,"settings.previewCompletedLocal":`ローカル音声の試聴が完了しました`,"settings.previewLoadingBreeze":`Breeze に接続中…`,"settings.previewPlayingBreeze":`Breeze を再生中。クリックで停止`,"settings.previewCompletedBreeze":`Breeze の試聴が完了しました`,"settings.previewErrorApiKeyMissing":`API キーを保存するか、ブラウザー音声を有効にしてください`,"settings.previewErrorApiKeyRejected":`キーが拒否されました。確認または置き換えてください`,"settings.previewErrorRateLimited":`リクエストが多すぎます。少し待ってからお試しください`,"settings.previewErrorTimeout":`タイムアウトしました。接続を確認して再試行してください`,"settings.previewErrorLocalUnavailable":`ブラウザー音声がありません`,"settings.previewErrorAutoplay":`再生がブロックされました。もう一度試聴をクリックしてください`,"settings.previewFailed":`試聴に失敗しました。設定と接続を確認してください`,"settings.save":`保存`,"settings.saving":`保存中…`,"settings.saved":`保存済み`,"settings.unsaved":`未保存`,"settings.overridden":`上書き済み`,"settings.reset":`初期値に戻す`,"settings.discard":`変更を破棄`,"settings.failed":`保存できませんでした。もう一度お試しください`,"settings.source":`ソースを見る`,"settings.readOnly":`DSH の設定は読み取り専用です`,"settings.secretPlaceholder":`このサービスの新しいキーを入力`,"settings.expand":`設定を展開`,"settings.collapse":`設定を折りたたむ`,"settings.soundEffectsTitle":`効果音`,"settings.soundEffectsEnabled":`効果音を有効化`,"settings.soundEffectsVolume":`音量`,"settings.soundEffectsPack":`効果音パック`,"settings.soundEffectsTask":`タスクの効果音`,"settings.soundEffectsClick":`クリック音`,"settings.soundEffectsOn":`すべての効果音`,"settings.soundEffectsOff":`オフ`,"settings.soundEffectsOnLabel":`魔法の効果音をオン`,"settings.soundEffectsOffLabel":`魔法の効果音をオフ`,"settings.soundEffectsBubbleOff":`UISFX は無効です`,"settings.soundEffectsClickOnly":`クリック音のみ`,"settings.soundEffectsTaskOnly":`タスクの効果音のみ`,"settings.soundEffectsTurnOn":`効果音をオン`,"settings.soundEffectsTurnOff":`効果音をオフ`,"settings.soundEffectsSynced":`タスクとクリックを同期`,"settings.soundEffectsPreviewLabel":`効果音の試聴`,"settings.soundEffectsPreview.start":`開始音を試聴`,"settings.soundEffectsPreview.complete":`完了音を試聴`,"settings.soundEffectsPreview.success":`成功音を試聴`,"settings.soundEffectsPreview.error":`エラー音を試聴`,"settings.soundEffectsPreview.notification":`通知音を試聴`,"settings.soundEffectsPreview.press":`クリック音を試聴`,"settings.soundEffectsPreview.select":`選択音を試聴`,"settings.soundEffectsPreview.toggle-on":`オンの効果音を試聴`,"settings.soundEffectsPreview.toggle-off":`オフの効果音を試聴`,"settings.soundEffectsPreview.send":`送信音を試聴`,"settings.soundEffectsPreview.open":`開く効果音を試聴`,"settings.soundEffectsPreview.close":`閉じる効果音を試聴`,"settings.soundEffectsPreview.delete":`削除音を試聴`,"settings.soundEffectsPreview.stop":`停止音を試聴`,"settings.soundEffectsPreview.queued":`待機音を試聴`,"settings.soundEffectsDescription":`クリックやタスクのイベント音`,"settings.soundEffectsSupported":`対応音:開始、完了、成功、エラー、通知、クリック、選択、オン、オフ、送信、開く、閉じる、削除、停止、待機`},hi={"settings.externalManage":`Gérer les fournisseurs`,"settings.externalProviderAdapter":`Adaptateur de fournisseurs`,"settings.showFeatureGuide":`Guide des nouveautés`,"settings.showFeatureGuideHint":`Afficher les nouveautés à l’activation du plugin.`,"settings.acceptExternalProviders":`Accepter les fournisseurs externes`,"settings.acceptExternalProvidersHint":`Autoriser les plugins externes à fournir la voix. Désactivez puis enregistrez pour revenir au fournisseur intégré.`,"settings.externalSwitchFailed":`Impossible de changer de fournisseur. Veuillez réessayer.`,"settings.externalOptionsHint":`Les options disponibles sont définies par le plugin externe.`,"settings.externalManaged":`Géré par un plugin externe. Configurez la voix dans ce plugin.`,"settings.externalNotReady":`Le service vocal externe n’est pas prêt. Vérifiez sa configuration.`,"settings.externalDisconnected":`Connexion au service vocal interrompue. La synthèse reprendra après reconnexion.`,"settings.externalLoading":`Génération audio avec le service vocal externe`,"settings.externalPlaying":`Lecture de l’audio du service externe`,"settings.externalCompleted":`Aperçu vocal externe terminé`,"settings.previewPresets":`Exemples de texte`,"settings.previewPresetGreeting":`Bonjour`,"settings.previewPresetPoetry":`Poésie`,"settings.previewPresetInspiration":`Courage`,"settings.previewPresetReflection":`Réflexion`,"settings.previewPresetHumor":`Humour`,"settings.previewPresetNews":`Actualités`,"settings.previewPresetStory":`Récit`,"settings.previewPresetService":`Accueil`,"settings.previewPresetDialogue":`Dialogue`,"settings.previewDefaultTextStory":`À la fermeture, un chat roux entra et se coucha sur un vieux carnet de voyage oublié.`,"settings.previewDefaultTextService":`Bonjour et bienvenue ! Dites-moi ce qui vous pose problème. Nous allons le résoudre ensemble.`,"settings.previewDefaultTextDialogue":`Tu t’en souviens ? Je pensais être seule. Depuis le début, nous allions dans la même direction.`,"settings.previewDefaultTextNews":`Bonsoir. La bibliothèque ouvre désormais le soir, pour lire au calme après le travail.`,"settings.previewDownload":`Télécharger l’audio de l’aperçu actuel`,"settings.previewDownloadUnavailable":`Générez un aperçu audio avant de le télécharger`,"settings.previewDownloadLocal":`La voix du navigateur ne peut pas être téléchargée. Essayez une voix cloud ou MOSS.`,"settings.previewDownloadFailed":`Échec du téléchargement. Réessayez.`,...li,...di,...pi,"settings.moreProviders":`Plus de fournisseurs`,"settings.breezeEnabled":`Activer Breeze Blue`,"settings.providerMinimum":`Xiaomi reste activé ; gardez Doubao ou Breeze activé.`,"settings.breezeAudioTags":`Balises audio`,"settings.xiaomiAudioTagsHint":`Voix Xiaomi prédéfinies : style en début de texte, sons dans le texte. Accepte (), (), [], descriptions libres et combinaisons. Le chant s’insère au début. Pour Voice Design, utilisez les instructions vocales.`,"settings.breezeAudioTagsHint":`Les balises sont insérées dans le texte d’essai. Crochets pour le chinois, parenthèses pour l’anglais. Breeze TTS uniquement.`,"settings.breezeAudioTagsChinese":`中文`,"settings.breezeAudioTagsEnglish":`English`,"settings.audioTagsContinuous":`Ajout multiple`,"settings.audioTagsContinuousHint":`Épingler le panneau de balises`,"settings.providerBreeze":`Breeze`,"settings.breezeCustomVoice":`Identifiant vocal personnalisé`,"settings.breezeCustomVoiceHint":`Saisissez un autre identifiant vocal Breeze`,"settings.breezeVoiceHistory":`Historique des identifiants Breeze`,"settings.breezeVoiceHint":`Identifiant vocal Breeze`,"settings.voiceReadingHintBreeze":`Saisissez un identifiant vocal Breeze`,"settings.breezeInstructionHint":`Breeze ajuste le jeu selon la scène, l’intention, l’émotion et le rythme ; laissez vide pour le rendu par défaut`,"settings.breezeInstructionLabelWarmCompanion":`Présence douce`,"settings.breezeInstructionTextWarmCompanion":`Parlez doucement à un ami proche, avec une chaleur sincère, un rythme tranquille et des pauses naturelles qui laissent place à une réponse.`,"settings.breezeInstructionLabelPlayfulTeasing":`Taquinerie`,"settings.breezeInstructionTextPlayfulTeasing":`Parlez avec une taquinerie affectueuse et légère, des accents vifs et un sourire dans la voix, sans dureté.`,"settings.breezeInstructionLabelSeriousAnnouncement":`Annonce formelle`,"settings.breezeInstructionTextSeriousAnnouncement":`Lisez clairement comme un présentateur professionnel, avec un ton objectif et assuré, un débit modéré et des pauses naturelles autour des informations importantes.`,"settings.breezeInstructionLabelEncouragingSupport":`Encouragement`,"settings.breezeInstructionTextEncouragingSupport":`Encouragez avec une voix chaleureuse et ferme qui exprime confiance et soutien, en devenant plus lumineux sans crier.`,"settings.breezeInstructionLabelSleepyBedtime":`Douceur du soir`,"settings.breezeInstructionTextSleepyBedtime":`Parlez doucement comme pour souhaiter bonne nuit, avec une voix détendue, un rythme lent, des fins de phrase douces et des pauses paisibles.`,"settings.breezeInstructionLabelWhisperFear":`Chuchotement inquiet`,"settings.breezeInstructionLabelExcitedSurprise":`Surprise enthousiaste`,"settings.breezeInstructionLabelSarcasticDisbelief":`Incrédulité sarcastique`,"settings.breezeInstructionLabelNervousHumor":`Humour nerveux`,"settings.breezeInstructionLabelRestrainedGrief":`Chagrin contenu`,"settings.breezeInstructionLabelCalmNarration":`Narration calme`,"settings.breezeInstructionTextWhisperFear":`Chuchotez très doucement et avec tension, comme si quelqu’un pouvait vous entendre.`,"settings.breezeInstructionTextExcitedSurprise":`Parlez avec une surprise vive et enthousiaste, avec une énergie qui monte.`,"settings.breezeInstructionTextSarcasticDisbelief":`Parlez avec un sarcasme sec et une incrédulité distante, comme si l’idée était évidemment mauvaise.`,"settings.breezeInstructionTextNervousHumor":`Utilisez un humour nerveux, avec un petit rire après la première phrase pour cacher la panique.`,"settings.breezeInstructionTextRestrainedGrief":`Parlez en retenant vos larmes, avec une voix légèrement brisée et une émotion contenue.`,"settings.breezeInstructionTextCalmNarration":`Lisez comme un narrateur calme et clair, à un rythme régulier avec des pauses nettes.`,"detail.star":`Star`,"detail.manual":`Manuel`,"detail.workshop":`Atelier`,"detail.keyLoading":`Vérification de la clé`,"detail.keyMissing":`Clé non configurée`,"detail.keyRecognized":`Format de clé reconnu`,"detail.keyUnrecognized":`Format de clé non pris en charge`,"detail.keyUnavailable":`Vérification de la clé impossible`,"detail.retry":`Réessayer`,"detail.preview":`Détails du plugin`,"detail.previewChanging":`Simuler une modification du plugin`,"detail.previewKey":`État de clé simulé`,"plugin.changing":`Modification du plugin en cours. La lecture vocale est suspendue.`,"onboarding.title":`Les nouveautés`,"onboarding.summary":`Découvrez les nouveautés de Passport, de Whale Girl et des paramètres.`,"onboarding.details":`Détails de la mise à jour`,"onboarding.externalSpeechTitle":`Connecter des fournisseurs vocaux externes`,"onboarding.externalVoicesTitle":`Trouver sa voix dans 音色工坊`,"onboarding.externalSwitchTitle":`Changer facilement de fournisseur`,"onboarding.featureExternalSpeech":`Consulter l’état du Passport, les transcriptions et les réponses`,"onboarding.featureExternalVoices":`Tester la connexion de reconnaissance vocale dans Passport`,"onboarding.featureExternalSwitch":`Activer séparément la mémoire et les mèmes de Whale Girl`,"onboarding.featureGuideControl":`Activer ou désactiver le guide des nouveautés à tout moment`,"onboarding.configure":`Ouvrir l’atelier vocal`,"onboarding.github":`Nous soutenir avec une étoile`,"onboarding.preview":`Essayer la voix du navigateur`,"onboarding.dismiss":`Fermer`,"onboarding.never":`Ne plus me le rappeler`,"onboarding.sample":`Bonjour, je suis votre assistante baleine. La voix est prête. Explorons le monde ensemble.`,"settings.announcementsApprovals":`Rappels de validation`,"settings.announcementsApprovalsHint":`Annonce les opérations en attente de validation dans cette conversation ; arrêt après traitement ou retrait`,"settings.announcementsJobs":`Résultats des tâches en arrière-plan`,"settings.announcementsJobsHint":`Annonce les résultats des tâches observées dans cette conversation ; nécessite le service de tâches`,"announcements.approval":`Une opération attend votre validation.`,"announcements.job":`Tâche en arrière-plan`,"announcements.jobCompleted":`Terminée.`,"announcements.jobFailed":`Échec.`,"announcements.jobKilled":`Annulée.`,"settings.soundEffectsScope":`Types de sons`,"settings.announcementsWhale":`dsh-whale-musume`,"settings.announcementsQuestions":`Titres des cartes de questions`,"settings.announcementsPetHint":`Lit les messages, réponses et repas du compagnon`,"settings.announcementsWhaleHint":`Autorise les demandes vocales de Whale Girl`,"settings.announcementsQuestionsHint":`Lit le titre de la question actuelle avec la lecture automatique ; arrêt au changement de question ou à la fermeture`,"settings.announcementsNone":`Aucune source activée`,"settings.inputAvoidance":`Priorité à la rédaction`,"settings.inputAvoidanceHint":`Suspend les lectures automatiques quand le champ de conversation actif contient un brouillon. Quittez-le ou videz-le pour autoriser les nouvelles lectures, sans rattrapage. Les essais manuels restent disponibles.`,"settings.importantAnnouncementsFirst":`Priorité aux alertes importantes`,"settings.importantAnnouncementsFirstHint":`Les demandes de validation et les échecs des tâches peuvent interrompre une lecture ordinaire. La saisie vocale et la rédaction restent prioritaires.`,"settings.hostIntegration":`Intégration à DSH`,"settings.showInHostSettings":`Raccourci des paramètres DSH`,"settings.showInHostSettingsHint":`Affiche la lecture vocale dans les paramètres DSH. Enregistrez pour appliquer.`,"settings.voiceInputCompatibility":`Priorité à la saisie vocale`,"settings.voiceInputCompatibilityHint":`Arrête la lecture et les effets sonores pendant la saisie vocale officielle DSH, y compris la transcription. Les sons interrompus ne reprennent pas. Enregistrez pour appliquer.`,"settings.announcementsTitle":`Sources des annonces`,"settings.announcementsPlugins":`Intégrations de plugins`,"settings.announcementsPluginsHint":`Le plugin correspondant doit être installé et activé`,"settings.passportIntegration":`Application Ai Passport`,"settings.passportIntegrationHint":`WhaleTalk Passport : des conversations vocales nomades avec DSH`,"settings.qqbotIntegration":`QQ Bot`,"settings.qqbotIntegrationHint":`Activé : envoie toute la réponse vocale automatiquement. Désactivé : envoie sur demande. Activez QQ Bot Megaphone puis enregistrez`,"settings.announcementsPet":`dsh-pet`,"settings.announcementsHint":`Gardez la voix activée et DSH Web ouvert. Les messages reçus pendant une lecture sont ignorés`,"settings.provider":`Fournisseur vocal`,"settings.providerXiaomi":`Xiaomi MiMo`,"settings.providerDoubao":`Doubao Voice`,"settings.switchProvider":`Changer de fournisseur`,"settings.doubaoStandardModel":`Synthèse standard (seed-tts-2.0)`,"settings.doubaoCloneModel":`Clonage vocal (seed-icl-2.0)`,"settings.speechInstruction":`Consigne vocale`,"settings.speechInstructionPresets":`Consignes prédéfinies`,"settings.speechInstructionCustom":`Instruction personnalisée`,"settings.mimoInstructionHint":`Styles pour Xiaomi. Laissez vide pour l’expression par défaut. Voice Design conserve la description de la voix`,"settings.doubaoInstructionHint":`Consignes pour Doubao Standard ; laissez vide pour l’expression habituelle de la voix`,"settings.mimoInstructionGentlePrompt":`Adoptez un ton chaleureux et doux, une articulation souple et claire et des fins de phrase détendues.`,"settings.mimoInstructionCheerfulPrompt":`Prenez un ton lumineux et vif, un rythme enjoué et des accents expressifs, comme pour annoncer une bonne nouvelle.`,"settings.mimoInstructionCalmPrompt":`Adoptez un ton calme et posé, un rythme régulier, des pauses nettes et une émotion retenue.`,"settings.mimoInstructionStoryPrompt":`Lisez comme un narrateur, en variant les accents et les pauses selon les événements pour donner du relief au récit.`,"settings.mimoInstructionArgumentPrompt":`Lisez sur un ton de colère et de confrontation, avec des accents appuyés et des phrases courtes et énergiques.`,"settings.mimoInstructionWhisperPrompt":`Chuchotez à faible volume, avec une articulation douce et un rythme lent, comme pour confier un secret à proximité.`,"settings.mimoInstructionCutePrompt":`Prenez un ton léger et doux, avec une articulation délicate, des fins de phrase légèrement montantes et une touche espiègle.`,"settings.mimoInstructionCantonesePrompt":`Lisez avec une prononciation cantonaise et une intonation naturelle et fluide.`,"settings.mimoInstructionHenanPrompt":`Lisez avec la prononciation et l’intonation du dialecte du Henan, à un rythme de conversation.`,"settings.mimoInstructionSichuanPrompt":`Lisez avec la prononciation et l’intonation du dialecte du Sichuan, à un rythme de conversation naturel.`,"settings.mimoInstructionDongbeiPrompt":`Lisez avec la prononciation et l’intonation du Nord-Est chinois, une expression franche et un rythme naturel.`,"settings.speechInstructionPlaceholder":`Exemple : douceur, joie ou narration`,"settings.speechInstructionHint":`Décrivez une émotion, un ton ou un style ; laissez vide pour la voix par défaut`,"settings.speechInstructionInfo":`Limites des consignes vocales`,"settings.speechInstructionLimitations":`Xiaomi et Doubao Standard enregistrent les consignes séparément. Le résultat varie selon le modèle, la voix et le texte ; faites un essai.
8
8
  La voix du navigateur et le clonage Doubao ne prennent pas en charge les consignes`,"settings.speechInstructionNatural":`Naturel`,"settings.speechInstructionGentle":`Doux`,"settings.speechInstructionGentlePrompt":`Lisez avec un ton doux, chaleureux et naturel.`,"settings.speechInstructionCheerful":`Joyeux`,"settings.speechInstructionCheerfulPrompt":`Lisez avec un ton lumineux, joyeux et plein d’énergie.`,"settings.speechInstructionCalm":`Calme`,"settings.speechInstructionCalmPrompt":`Lisez avec un ton calme, posé et retenu.`,"settings.speechInstructionStory":`Narration`,"settings.speechInstructionStoryPrompt":`Racontez le texte comme une histoire, avec une émotion qui suit naturellement son contenu.`,"settings.speechInstructionArgument":`Dispute`,"settings.speechInstructionArgumentPrompt":`Prenez un ton de défi et de confrontation, comme dans une dispute.`,"settings.speechInstructionWhisper":`Chuchotement`,"settings.speechInstructionWhisperPrompt":`Chuchotez doucement, comme un secret confié à l’oreille, avec une proximité de type ASMR.`,"settings.speechInstructionShy":`Timidité et attente`,"settings.speechInstructionShyPrompt":`Adoptez une voix timide et hésitante, laissant percevoir de la chaleur et l’envie de se rapprocher.`,"settings.speechInstructionWeary":`Lassitude`,"settings.speechInstructionWearyPrompt":`Parlez d’une voix basse et légèrement rauque, comme après une vie difficile, avec fatigue et solitude.`,"settings.speechInstructionTearful":`Au bord des larmes`,"settings.speechInstructionTearfulPrompt":`Lisez avec une voix tremblante, au bord des larmes, légèrement étouffée par la tristesse.`,"settings.speechInstructionCoy":`Câlin`,"settings.speechInstructionCoyPrompt":`Parlez avec douceur et affection, sur un ton un peu dépendant et malicieux.`,"settings.speechInstructionCute":`Voix mignonne`,"settings.speechInstructionCutePrompt":`Utilisez une voix plus aiguë, légère et douce, avec une expression mignonne et un peu joueuse.`,"settings.speechInstructionSichuan":`Dialecte du Sichuan`,"settings.speechInstructionCantonese":`Cantonais`,"settings.speechInstructionCantonesePrompt":`Lisez en cantonais naturel et idiomatique, comme dans une conversation quotidienne.`,"settings.speechInstructionShanghai":`Dialecte de Shanghai`,"settings.speechInstructionShanghaiPrompt":`Lisez en shanghaïen naturel, comme dans une conversation quotidienne.`,"settings.speechInstructionHenan":`Dialecte du Henan`,"settings.speechInstructionHenanPrompt":`Lisez en chinois du Henan naturel, comme dans une conversation quotidienne.`,"settings.speechInstructionTianjin":`Dialecte de Tianjin`,"settings.speechInstructionTianjinPrompt":`Lisez en chinois de Tianjin naturel, comme dans une conversation quotidienne.`,"settings.speechInstructionShaanxi":`Dialecte du Shaanxi`,"settings.speechInstructionShaanxiPrompt":`Lisez en chinois du Shaanxi naturel, comme dans une conversation quotidienne.`,"settings.speechInstructionDongbei":`Dialecte du Nord-Est`,"settings.speechInstructionDongbeiPrompt":`Lisez en chinois du Nord-Est naturel, avec un ton chaleureux de conversation.`,"settings.speechInstructionSichuanPrompt":`Lisez avec un accent chinois du Sichuan naturel, comme dans une conversation quotidienne.`,"settings.speechInstructionBeijing":`Dialecte de Pékin`,"settings.speechInstructionBeijingPrompt":`Lisez avec un accent pékinois naturel et un peu d’erhua, sur le ton d’une conversation détendue.`,"settings.doubaoKeyConfigured":`Clé enregistrée. Essayez une lecture pour vérifier les droits et la disponibilité de la voix`,"settings.doubaoCustomVoice":`Identifiant de voix personnalisé`,"settings.doubaoCustomVoiceHint":`Saisissez un autre identifiant de voix standard`,"settings.doubaoVoiceSceneGeneral":`Conversation quotidienne`,"settings.doubaoVoiceSceneRole":`Voix de personnage`,"settings.doubaoVoiceSceneDubbing":`Doublage expressif`,"settings.doubaoVoiceSceneReading":`Narration`,"settings.doubaoVoiceChinese":`Chinois`,"settings.doubaoVoiceId":`Identifiant de voix`,"settings.doubaoClonedVoice":`Identifiant de voix clonée`,"settings.doubaoClonedVoiceLabel":`Voix clonée`,"settings.doubaoStandardVoiceHistory":`Historique des identifiants standard`,"settings.doubaoClonedVoiceHistory":`Historique des identifiants clonés`,"settings.voiceRemark":`Nom de la voix (facultatif)`,"settings.voiceTagEdit":`Modifier le nom`,"settings.voiceTagRemove":`Retirer de l’historique`,"settings.voiceTagConfirm":`Supprimer ?`,"settings.voiceRemarkHint":`Enregistré dans ce navigateur pour les étiquettes ; laissez vide pour afficher l’identifiant`,"settings.doubaoCloneHint":`Saisissez un identifiant de voix clonée depuis la console Doubao`,"settings.doubaoVoiceLibrary":`Ouvrir la bibliothèque de voix`,"settings.doubaoCreateVoice":`Créer une voix`,"settings.doubaoVoiceRequired":`Saisissez un identifiant de voix pour le modèle Doubao choisi`,"settings.doubaoStreamingHint":`Lit la réponse pendant sa génération`,"settings.previewLoadingDoubao":`Connexion à Doubao…`,"settings.previewPlayingDoubao":`Lecture Doubao ; cliquez pour arrêter`,"settings.previewCompletedDoubao":`Essai Doubao terminé`,"settings.previewSaveKeyFirst":`Enregistrez la clé API avant l’essai`,"settings.previewErrorVoiceUnavailable":`Voix indisponible. Vérifiez son identifiant, le modèle et les droits d’accès`,"settings.previewErrorResourceUnavailable":`Cette clé ne donne pas accès à la ressource Doubao choisie`,"settings.previewErrorBufferLimit":`Limite du tampon audio atteinte. Lecture arrêtée`,"error.voiceUnavailable":`Voix indisponible. Vérifiez le modèle, l’identifiant et les droits d’accès.`,"error.resourceUnavailable":`Cette clé ne donne pas accès à la ressource du modèle choisi.`,"error.apiKeyRejected":`Clé API vocale refusée. Vérifiez les réglages.`,"error.rateLimited":`Limite du service vocal atteinte. Réessayez plus tard.`,"error.timeout":`Délai de synthèse vocale dépassé. Réessayez.`,"error.bufferLimit":`Limite du tampon audio atteinte. Lecture arrêtée.`,"history.title":`Historique audio`,"history.shortTitle":`Historique`,"history.backToSettings":`Retour aux paramètres`,"history.search":`Rechercher dans les résumés audio`,"history.source":`Origine`,"history.all":`Tout`,"history.untitled":`Audio sans titre`,"history.characters":`caractères`,"history.expand":`Développer ou réduire le résumé`,"history.noResults":`Aucun audio correspondant.`,"history.resetFilters":`Réinitialiser les filtres`,"history.savedHere":`Enregistré`,"history.temporary":`Disponible uniquement pendant cette visite`,"history.clearConfirm":`Effacer tout l’historique audio ? Cela inclut les entrées masquées par les filtres. Cette action est irréversible.`,"history.confirmDelete":`Confirmer la suppression`,"history.confirmClear":`Confirmer`,"history.cancel":`Annuler`,"history.actionFailed":`L’opération a échoué. Réessayez.`,"history.player":`Lecteur de l’historique audio`,"history.selectAudio":`Choisissez un audio à réécouter.`,"history.play":`Lire`,"history.pause":`Pause`,"history.retry":`Réessayer la lecture`,"history.seek":`Position de lecture`,"history.state.idle":`Prêt à lire`,"history.state.loading":`Chargement de l’audio…`,"history.state.playing":`Lecture en cours`,"history.state.paused":`En pause`,"history.state.ended":`Lecture terminée`,"history.error.blocked":`Le navigateur a bloqué la lecture. Choisissez « Réessayer la lecture ».`,"history.error.decode":`Le navigateur ne peut pas décoder cet audio. Réessayez ou téléchargez le fichier.`,"history.error.failed":`La lecture audio a échoué. Réessayez ou téléchargez le fichier.`,"history.hint":`Jusqu’à 100 entrées / 100 Mo`,"history.empty":`Aucun audio généré pour le moment.`,"history.loading":`Chargement de l’historique audio…`,"history.memory":`Le stockage du navigateur est indisponible ou plein. Cette liste disparaîtra après la visite ; téléchargez les audios à conserver.`,"history.skipped":`Un fichier audio dépassant 100 Mo n’a pas été conservé dans l’historique.`,"history.listen":`Réécouter`,"history.download":`Télécharger`,"history.delete":`Supprimer`,"history.clear":`Tout effacer`,"history.conversation":`Conversation`,"history.preview":`Essai dans les réglages`,"history.service":`Lecture par un service`,"action.play":`Lire à voix haute`,"action.pause":`Suspendre la lecture vocale`,"action.resume":`Reprendre la lecture vocale`,"action.loading":`Génération de la voix`,"action.cancel":`Annuler la génération vocale`,"action.stop":`Arrêter la lecture vocale`,"action.localFallback":`Voix locale`,"action.retry":`Régénérer la voix`,"error.noText":`Cette réponse ne contient aucun texte lisible.`,"error.request":`La génération vocale a échoué.`,"error.play":`Le navigateur a bloqué la lecture automatique. Cliquez sur « Lire à voix haute ».`,"error.localNotAllowed":`Le navigateur a bloqué la voix locale. Cliquez sur « Lire à voix haute » pour réessayer.`,"error.localVoiceUnavailable":`La voix du navigateur choisie est indisponible. Choisissez-en une autre.`,"error.localMossUnreachable":`Impossible de joindre le service MOSS local. Vérifiez son URL et son état.`,"error.localMossVoiceMissing":`Aucune voix MOSS locale sélectionnée.`,"error.localMossInvalidUrl":`L’URL de la voix MOSS locale est invalide.`,"error.localMossTimeout":`La synthèse MOSS locale a expiré.`,"error.localMossFailed":`La synthèse MOSS locale a échoué.`,"error.localTimeout":`La voix du navigateur n’a pas répondu en 2 minutes. La lecture a été arrêtée.`,"error.localAudioDevice":`Le périphérique audio local a signalé une erreur. Vérifiez les réglages audio du système.`,"error.localSynthesis":`La synthèse vocale locale a échoué. Réessayez.`,"settings.title":`Lecture vocale (Xiaomi MiMo)`,"settings.description":`Lit les conversations avec Xiaomi MiMo ou Doubao`,"settings.minimalMode":`Affichage simplifié`,"settings.minimalModeOn":`Activé`,"settings.minimalModeOff":`Désactivé`,"settings.minimalModeShort":`Simplifié`,"settings.defaultModeShort":`Classique`,"settings.enabled":`Lecture vocale`,"settings.enabledOnLabel":`L’assistante baleine est à l’antenne`,"settings.enabledOffLabel":`L’assistante baleine se repose`,"settings.enabledHint":`Désactiver masque les réglages vocaux et arrête la lecture automatique`,"settings.apiKey":`Clé API`,"settings.apiKeyStatus":`La clé actuelle n’est remplacée qu’après l’enregistrement d’une nouvelle clé`,"settings.apiKeyLoading":`Vérification de la clé…`,"settings.apiKeyMissing":`Saisissez et enregistrez une clé API pour ce fournisseur`,"settings.apiKeyRecognized":`Format de clé reconnu. Faites un essai pour vérifier la connexion`,"settings.apiKeyUnsupported":`La clé doit commencer par sk- ou tp-`,"settings.apiKeyUnsupportedSaved":`Format de la clé enregistrée non pris en charge. Remplacez-la`,"settings.apiKeyUnavailable":`Impossible de vérifier la clé. Vérifiez votre connexion`,"settings.apiKeyPendingSave":`Enregistrez pour essayer la nouvelle clé`,"settings.saveRejected":`L’hôte a refusé cette modification. Vérifiez que la configuration est modifiable, puis réessayez`,"settings.getApiKey":`Obtenir une clé API`,"settings.apiKeyIdleCopy1":`Je peux regarder maintenant ?`,"settings.apiKeyIdleCopy2":`La clé est bien rangée ?`,"settings.apiKeyIdleCopy3":`Enregistrez, puis on passe à l’antenne !`,"settings.apiKeyIdleCopy4":`Je garde votre clé à l’abri`,"settings.apiKeyFocusCopy1":`D’accord, je me cache les yeux !`,"settings.apiKeyFocusCopy2":`Pas d’inquiétude, je ne vois rien`,"settings.apiKeyFocusCopy3":`Mode confidentialité activé !`,"settings.apiKeyFocusCopy4":`Prenez votre temps, votre secret est protégé`,"settings.autoPlay":`Lecture automatique`,"settings.autoPlayOnLabel":`Je vous fais la lecture`,"settings.autoPlayOffLabel":`Appelez-moi quand vous voulez`,"settings.autoPlayHint":`Le navigateur peut bloquer la lecture automatique`,"settings.voiceReadingNav":`Lecture vocale`,"settings.voiceReadingTitle":`Lecture vocale`,"settings.voiceReadingSource":`Code source sur GitHub`,"settings.voiceReadingQq":`Groupe QQ`,"settings.voiceReadingQqCodeAlt":`Code QR du groupe QQ`,"settings.voiceReadingQqClose":`Fermer le code QR`,"settings.voiceReadingPluginSettings":`Réglages du plugin`,"settings.voiceReadingWarningDisabled":`La voix est désactivée. Activez-la dans {settings}`,"settings.voiceReadingWarningApiKeyMissing":`Clé API manquante. Ajoutez-la dans {settings}`,"settings.voiceReadingWarningApiKeyInvalid":`Format de clé API non pris en charge. Vérifiez {settings}`,"settings.voiceReadingWarningApiKeyUnavailable":`Impossible de vérifier la clé API. Vérifiez la connexion`,"settings.voiceReadingWarningVoiceRequired":`Aucune voix choisie. Choisissez ou saisissez-en une dans {settings}`,"settings.voiceReadingDismissWarning":`Masquer l’avertissement`,"settings.voiceReadingVoice":`Voix de lecture`,"settings.voiceReadingHintXiaomi":`Voix intégrées de Xiaomi MiMo`,"settings.voiceReadingHintVoiceDesign":`Générez une voix à partir d’une description ou choisissez un préréglage`,"settings.voiceReadingHintDoubaoStandard":`Voix de synthèse standard Doubao`,"settings.voiceReadingHintDoubaoCloned":`Choisissez un identifiant de voix clonée déjà utilisé`,"settings.voiceReadingCustomVoice":`Personnalisée (actuelle)`,"settings.voiceReadingVolume":`Volume de lecture`,"settings.voiceReadingRate":`Vitesse de lecture`,"settings.voiceReadingAutoPlay":`Lecture automatique`,"settings.voiceReadingSound":`Effets sonores`,"settings.voiceReadingSoundHint":`Sons des clics et des tâches`,"settings.voiceReadingReadOnly":`Les réglages sont en lecture seule`,"settings.voiceReadingUnavailable":`Les réglages vocaux sont indisponibles`,"settings.voiceReadingSaveFailed":`Enregistrement impossible. Réessayez`,"settings.detailedVoiceConfig":`Console de mixage`,"settings.voiceVolume":`Volume de la voix`,"settings.voiceRate":`Vitesse de lecture`,"settings.voiceRateHint":`0,5× à 2,0× ; 1,0× correspond à la vitesse d’origine.
9
- Doubao applique les changements à la prochaine synthèse ; Xiaomi et la voix du navigateur, pendant la lecture. Le streaming Xiaomi modifie aussi la hauteur`,"settings.voiceRateInfo":`À propos de la vitesse de lecture`,"settings.readScope":`Étendue de lecture`,"settings.readScopeSmart":`Intelligente`,"settings.readScopeFull":`Intégrale`,"settings.readScopeFirstSegment":`Premier passage`,"settings.readScopeSmartHint":`Auto : réponses courtes entières, deux premiers passages des longues réponses, avec une conclusion facultative. Manuel : réponse entière`,"settings.readScopeFullHint":`Lit toute la réponse, automatiquement ou manuellement`,"settings.readScopeFirstSegmentHint":`Lit uniquement le premier passage, automatiquement ou manuellement`,"settings.summaryPresetModel":`Modèle prédéfini`,"settings.summaryVoiceDesignModel":`Création vocale personnalisée`,"settings.localSpeechAutoSummary":`Cloud en priorité`,"settings.stateOn":`Activé`,"settings.stateOff":`Désactivé`,"settings.model":`Réglages de la source vocale`,"settings.presetModel":`Voix prédéfinies (mimo-v2.5-tts)`,"settings.voiceDesignModel":`Création vocale (mimo-v2.5-tts-voicedesign)`,"settings.presetModelShort":`Voix prédéfinie (MiMo-TTS)`,"settings.voiceDesignModelShort":`Création vocale (MiMo-VoiceDesign)`,"settings.localSpeechMode":`Priorité vocale`,"settings.localSpeechAuto":`Cloud en priorité`,"settings.localSpeechFirst":`Local en priorité`,"settings.localSpeechDisabled":`Désactiver la voix locale`,"settings.localSpeechAutoHint":`Cloud d’abord ; voix du navigateur en cas d’échec avant le début de la lecture`,"settings.localSpeechFirstHint":`Voix du navigateur d’abord ; cloud en cas d’échec`,"settings.localSpeechDisabledHint":`Voix cloud uniquement, sans repli sur le navigateur`,"settings.localSpeechUnavailableHint":`Aucune voix du navigateur disponible ; utilisez le cloud en priorité`,"settings.localVoice":`Voix du navigateur`,"settings.localVoiceLoading":`Chargement des voix du navigateur…`,"settings.localVoiceUnavailable":`Aucune voix du navigateur disponible`,"settings.localVoiceOffline":`Hors ligne`,"settings.localVoiceOnline":`En ligne`,"settings.localVoiceEngine":`Source de la voix locale`,"settings.localVoiceEngineBrowser":`Navigateur`,"settings.localVoiceEngineMoss":`MOSS local`,"settings.mossProvider":`MOSS Nano (Local)`,"settings.experimental":`Expérimental`,"settings.more":`Plus`,"settings.moreHint":`Volume, vitesse, voix locale, portée et priorité vocale`,"settings.announcementsMoreHint":`Intégration à DSH, sources et plugins`,"settings.mossBaseURL":`URL du service MOSS`,"settings.mossProbe":`Détecter`,"settings.mossCopyDeployHint":`Copier l’invite de déploiement`,"settings.mossDeployHintBefore":`Pas encore installé ? `,"settings.mossDeployHintAction":`Copier l’invite`,"settings.mossDeployHintAfter":` et laisser DSH s’en charger.`,"settings.mossDeployCopied":`Copié — collez-la dans DSH.`,"settings.mossDeployCopyFailed":`Échec de la copie. Réessayez.`,"settings.mossProbingShort":`Détection…`,"settings.mossProbing":`Détection du service MOSS…`,"settings.mossOnlineReady":`En ligne · prêt`,"settings.mossWarming":`En ligne · préchauffage`,"settings.mossNotProbed":`Pas encore détecté`,"settings.mossInvalidUrl":`URL du service MOSS invalide`,"settings.mossTimeout":`Le service MOSS a expiré`,"settings.mossUnreachable":`Impossible de joindre le service MOSS`,"settings.mossProbeFailed":`Échec de la détection MOSS`,"settings.mossVoice":`Voix MOSS`,"settings.mossVoiceProbeFirst":`Détectez le service MOSS pour charger les voix`,"settings.mossBuiltInVoice":`voix intégrée`,"settings.mossLocalFirstHint":`Choisissez « Local en priorité » pour privilégier la voix MOSS ; « Cloud en priorité » n’y revient qu’en cas d’échec avant le début de la lecture cloud.`,"settings.mossLocalDisabledHint":`La voix locale est désactivée : la voix MOSS n’est pas utilisée.`,"settings.modelAutoPlayHintPreset":`Les voix prédéfinies prennent en charge le streaming`,"settings.modelAutoPlayHintVoiceDesign":`Lecture automatique après la fin de la réponse`,"settings.voice":`Voix intégrée`,"settings.format":`Format audio`,"settings.formatPcm":`PCM (streaming)`,"settings.formatMp3":`MP3 (audio complet)`,"settings.formatWav":`WAV (audio complet)`,"settings.formatPcmHint":`Lit l’audio dès réception ; utilise le MP3 en cas d’échec avant le premier fragment`,"settings.formatMp3Hint":`Lecture après génération ; fichiers plus petits`,"settings.formatWavHint":`Lecture après génération ; sans perte, fichiers plus volumineux`,"settings.voiceDesignPrompt":`Création vocale`,"settings.customVoiceOption":`Personnalisée`,"settings.customVoiceSummary":`Décrire une voix personnalisée`,"settings.voiceDesignPromptHint":`Décrivez l’âge, le genre, le timbre, le rythme et l’émotion ; omettez scènes et actions`,"settings.voiceDesignPlaybackMode":`Mode de lecture`,"settings.voiceDesignPlaybackComplete":`Intégrale`,"settings.voiceDesignPlaybackSegmented":`Par passages`,"settings.voiceDesignPlaybackFirstSegment":`Premier passage`,"settings.voiceDesignPlaybackCompleteHint":`Génère toute la réponse pour une voix cohérente ; les longs textes peuvent produire des défauts`,"settings.voiceDesignPlaybackSegmentedHint":`Génère par passages pour démarrer plus vite les longs textes ; la voix peut varier`,"settings.voiceDesignPlaybackFirstSegmentHint":`Lit seulement le premier passage pour démarrer plus vite et réduire la consommation`,"settings.previewTitle":`Table de diffusion`,"settings.previewText":`Texte d’essai`,"settings.previewDefaultText":`Bonjour ! Je suis votre assistante baleine. Quel plaisir d’explorer le monde des voix avec vous !`,"settings.previewDefaultTextPoetry":`Le vent plie les nuages en une lettre ; la lune la signe. Que les étoiles éclairent tous vos chemins de retour.`,"settings.previewDefaultTextInspiration":`Avancez à votre rythme. Une graine fleurit même après un printemps tardif. Un faux pas ne met pas fin au voyage.`,"settings.previewDefaultTextReflection":`On ne peut pas retenir chaque brise, mais on peut orienter sa voile. La réponse se trouve peut-être dans notre façon de vivre aujourd’hui.`,"settings.previewDefaultTextHumor":`Mon réveil a sonné. J’ai voté pour cinq minutes de plus au lit. Une heure après, la résolution était toujours en vigueur.`,"settings.previewPlaceholder":`Saisissez un texte d’essai`,"settings.previewPlay":`Lire l’essai`,"settings.previewListen":`Essayer`,"settings.previewStopShort":`Arrêter`,"settings.previewStop":`Arrêter l’essai`,"settings.previewHint":`Enregistrez une clé pour essayer les voix cloud`,"settings.previewLoading":`Préparation…`,"settings.previewPlaying":`Lecture en cours ; cliquez pour arrêter`,"settings.previewLoadingMimo":`Connexion à MiMo…`,"settings.previewLoadingLocal":`Préparation de la voix du navigateur…`,"settings.previewPlayingMimo":`Lecture MiMo ; cliquez pour arrêter`,"settings.previewPlayingLocal":`Voix du navigateur en cours ; cliquez pour arrêter`,"settings.previewCompletedMimo":`Essai MiMo terminé`,"settings.previewCompletedLocal":`Essai de la voix locale terminé`,"settings.previewLoadingBreeze":`Connexion à Breeze…`,"settings.previewPlayingBreeze":`Lecture Breeze ; cliquez pour arrêter`,"settings.previewCompletedBreeze":`Essai Breeze terminé`,"settings.previewErrorApiKeyMissing":`Enregistrez une clé API ou activez la voix du navigateur`,"settings.previewErrorApiKeyRejected":`Clé refusée. Vérifiez-la ou remplacez-la`,"settings.previewErrorRateLimited":`Trop de requêtes. Réessayez dans un instant`,"settings.previewErrorTimeout":`Délai dépassé. Vérifiez votre connexion et réessayez`,"settings.previewErrorLocalUnavailable":`Aucune voix du navigateur disponible`,"settings.previewErrorAutoplay":`Lecture bloquée. Relancez l’essai`,"settings.previewFailed":`Essai échoué. Vérifiez les réglages et la connexion`,"settings.save":`Enregistrer`,"settings.saving":`Enregistrement…`,"settings.saved":`Enregistré`,"settings.unsaved":`Non enregistré`,"settings.overridden":`Personnalisé`,"settings.reset":`Rétablir la valeur par défaut`,"settings.discard":`Abandonner les changements`,"settings.failed":`Enregistrement échoué. Réessayez`,"settings.source":`Voir le code source`,"settings.readOnly":`Les réglages DSH sont en lecture seule`,"settings.secretPlaceholder":`Saisissez une nouvelle clé pour ce fournisseur`,"settings.expand":`Développer les réglages`,"settings.collapse":`Réduire les réglages`,"settings.soundEffectsTitle":`Effets sonores`,"settings.soundEffectsEnabled":`Activer les sons`,"settings.soundEffectsVolume":`Volume`,"settings.soundEffectsPack":`Pack sonore`,"settings.soundEffectsTask":`Sons des tâches`,"settings.soundEffectsClick":`Sons des clics`,"settings.soundEffectsOn":`Tous les sons`,"settings.soundEffectsOff":`Désactivés`,"settings.soundEffectsOnLabel":`Sons magiques activés`,"settings.soundEffectsOffLabel":`Sons magiques désactivés`,"settings.soundEffectsBubbleOff":`UISFX désactivé`,"settings.soundEffectsClickOnly":`Clics uniquement`,"settings.soundEffectsTaskOnly":`Tâches uniquement`,"settings.soundEffectsTurnOn":`Activer les sons`,"settings.soundEffectsTurnOff":`Désactiver les sons`,"settings.soundEffectsSynced":`Tâches et clics synchronisés`,"settings.soundEffectsPreviewLabel":`Essais des sons`,"settings.soundEffectsPreview.start":`Essayer le son de démarrage`,"settings.soundEffectsPreview.complete":`Essayer le son de fin`,"settings.soundEffectsPreview.success":`Essayer le son de réussite`,"settings.soundEffectsPreview.error":`Essayer le son d’erreur`,"settings.soundEffectsPreview.notification":`Essayer la notification`,"settings.soundEffectsPreview.press":`Essayer le clic`,"settings.soundEffectsPreview.select":`Essayer la sélection`,"settings.soundEffectsPreview.toggle-on":`Essayer l’activation`,"settings.soundEffectsPreview.toggle-off":`Essayer la désactivation`,"settings.soundEffectsPreview.send":`Essayer l’envoi`,"settings.soundEffectsPreview.open":`Essayer l’ouverture`,"settings.soundEffectsPreview.close":`Essayer la fermeture`,"settings.soundEffectsPreview.delete":`Essayer la suppression`,"settings.soundEffectsPreview.stop":`Essayer l’arrêt`,"settings.soundEffectsPreview.queued":`Essayer la mise en attente`,"settings.soundEffectsDescription":`Sons des clics et des événements de tâches`,"settings.soundEffectsSupported":`Sons disponibles : démarrage, fin, réussite, erreur, notification, clic, sélection, activation, désactivation, envoi, ouverture, fermeture, suppression, arrêt, mise en attente`},hi=`xiaomi-mimo-tts`,gi={...si,...li,...di,"detail.star":`Star`,"detail.manual":`手册`,"detail.workshop":`工坊`,"detail.keyLoading":`正在检查密钥`,"detail.keyMissing":`未配置密钥`,"detail.keyRecognized":`密钥格式已识别`,"detail.keyUnrecognized":`密钥格式不支持`,"detail.keyUnavailable":`无法检查密钥`,"detail.retry":`重新检查`,"detail.preview":`插件详情`,"detail.previewChanging":`模拟插件变更`,"detail.previewKey":`模拟密钥状态`,"plugin.changing":`插件正在变更,语音播放暂时停止。`,"onboarding.title":`版本新功能`,"onboarding.summary":`已支持外部语音供应商,更多音色随你选。`,"onboarding.details":`更新详情`,"onboarding.externalSpeechTitle":`接入外部语音供应商`,"onboarding.externalVoicesTitle":`在音色工坊挑选声音`,"onboarding.externalSwitchTitle":`轻松切换供应商`,"onboarding.featureExternalSpeech":`支持接入外部语音供应商`,"onboarding.featureExternalVoices":`工坊可选外部模型、音色与声音标签`,"onboarding.featureExternalSwitch":`点击顶部卡片,快速切换供应商`,"onboarding.configure":`打开音色工坊`,"onboarding.github":`点个 Star 鼓励一下`,"onboarding.preview":`试听浏览器语音`,"onboarding.dismiss":`稍后再说`,"onboarding.sample":`你好,语音已经准备好了,很高兴陪你一起探索声音的世界。`,"settings.announcementsApprovals":`审批提醒`,"settings.announcementsApprovalsHint":`提醒当前会话的待审批操作;处理或撤回后停止`,"settings.announcementsJobs":`后台任务结果`,"settings.announcementsJobsHint":`播报当前会话中已观察到的任务结果;需启用任务服务`,"announcements.approval":`有一项操作等待你确认。`,"announcements.job":`后台任务`,"announcements.jobCompleted":`已结束。`,"announcements.jobFailed":`执行失败。`,"announcements.jobKilled":`已取消。`,"settings.soundEffectsScope":`音效范围`,"settings.announcementsWhale":`dsh-whale-musume`,"settings.announcementsQuestions":`提问卡片标题`,"settings.announcementsPetHint":`播报桌宠闲聊、回复和投喂文字`,"settings.announcementsWhaleHint":`接收鲸鱼娘的语音播报`,"settings.announcementsQuestionsHint":`随自动播报朗读当前题目;翻题或关闭时停止`,"settings.announcementsNone":`未启用来源`,"settings.hostIntegration":`宿主适配`,"settings.inputAvoidance":`输入时避让`,"settings.inputAvoidanceHint":`输入框聚焦且有未发送内容时停止自动播报,离开或清空后恢复;`,"settings.importantAnnouncementsFirst":`重要提醒优先`,"settings.importantAnnouncementsFirstHint":`待审批与后台任务失败提醒可打断普通播报;仍遵守语音输入和输入时避让。`,"settings.showInHostSettings":`宿主设置入口`,"settings.showInHostSettingsHint":`在 DSH 设置中显示「语音朗读」快捷设置。保存后生效。`,"settings.voiceInputCompatibility":`语音输入避让`,"settings.voiceInputCompatibilityHint":`使用 DSH 官方语音输入时停止播报和音效,录音及转写期间保持安静;`,"settings.announcementsTitle":`播报来源`,"settings.announcementsPlugins":`插件联动`,"settings.announcementsPluginsHint":`需安装并启用对应插件`,"settings.passportIntegration":`Ai Passport 应用`,"settings.passportIntegrationHint":`WhaleTalk Passport(鲸语通行证),随身使用 DSH 语音对话`,"settings.qqbotIntegration":`QQ Bot`,"settings.qqbotIntegrationHint":`开启后自动发送完整语音;关闭后仅按用户要求发送。需启用「QQ Bot 传声筒」,保存后生效`,"settings.announcementsPet":`dsh-pet`,"settings.announcementsHint":`需开启语音并保持网页打开;忙碌时跳过,不补播`,"settings.provider":`语音服务商`,"settings.providerXiaomi":`小米 MiMo`,"settings.providerDoubao":`豆包语音`,"settings.providerBreeze":`Breeze Blue`,"settings.externalManage":`管理供应商`,"settings.externalProviderAdapter":`供应商适配器`,"settings.acceptExternalProviders":`接收外部供应商`,"settings.acceptExternalProvidersHint":`允许外部插件提供语音服务;关闭并保存后恢复内置供应商。`,"settings.externalSwitchFailed":`供应商切换失败,请重试。`,"settings.externalOptionsHint":`可用选项由外部插件声明;不支持的功能不可用。`,"settings.externalManaged":`语音服务由外部插件管理`,"settings.externalNotReady":`外部语音服务未就绪,请检查对应插件配置`,"settings.externalDisconnected":`语音服务状态连接已断开,恢复前暂停新的合成`,"settings.externalLoading":`正在使用外部语音服务生成音频`,"settings.externalPlaying":`正在播放外部语音服务音频`,"settings.externalCompleted":`外部语音试听完成`,"settings.breezeCustomVoice":`自定义 Voice ID`,"settings.breezeCustomVoiceHint":`填写其他 Breeze Voice ID`,"settings.breezeVoiceHistory":`Breeze 音色 ID 历史`,"settings.breezeVoiceHint":`Breeze voice ID`,"settings.voiceReadingHintBreeze":`填写 Breeze Voice ID`,"settings.switchProvider":`切换供应商`,"settings.doubaoStandardModel":`标准合成(seed-tts-2.0)`,"settings.doubaoCloneModel":`声音复刻(seed-icl-2.0)`,"settings.speechInstruction":`语音指令`,"settings.speechInstructionPresets":`语音指令预设`,"settings.speechInstructionCustom":`自定义指令`,"settings.mimoInstructionHint":`小米专用风格描述;留空使用默认表达,音色设计仍保留音色描述`,"settings.doubaoInstructionHint":`豆包标准合成的语音指令;留空使用音色默认表达`,"settings.breezeInstructionHint":`Breeze 会根据场景、意图、情绪和节奏调整表演;留空使用音色默认表达`,"settings.breezeInstructionLabelWarmCompanion":`温柔陪伴`,"settings.breezeInstructionTextWarmCompanion":`像陪伴熟悉的朋友一样轻柔地说话,语气温暖真诚,节奏舒缓,留出自然的回应空间。`,"settings.breezeInstructionLabelPlayfulTeasing":`俏皮调侃`,"settings.breezeInstructionTextPlayfulTeasing":`用轻快俏皮、带一点善意调侃的语气说话,重音灵活,句尾略带笑意,避免尖刻。`,"settings.breezeInstructionLabelSeriousAnnouncement":`正式播报`,"settings.breezeInstructionTextSeriousAnnouncement":`以正式播音员的口吻清晰朗读,语气客观坚定,语速适中,在信息重点和句间自然停顿。`,"settings.breezeInstructionLabelEncouragingSupport":`坚定鼓励`,"settings.breezeInstructionTextEncouragingSupport":`用坚定而温暖的语气给予鼓励,表达信任与支持,语调逐渐明亮,不夸张喊叫。`,"settings.breezeInstructionLabelSleepyBedtime":`晚安轻语`,"settings.breezeInstructionTextSleepyBedtime":`像睡前轻声道晚安,声音柔和松弛,放慢节奏,使用轻缓的句尾与安静自然的停顿。`,"settings.breezeInstructionLabelWhisperFear":`害怕被听见`,"settings.breezeInstructionLabelExcitedSurprise":`兴奋惊喜`,"settings.breezeInstructionLabelSarcasticDisbelief":`讽刺不屑`,"settings.breezeInstructionLabelNervousHumor":`紧张幽默`,"settings.breezeInstructionLabelRestrainedGrief":`克制悲伤`,"settings.breezeInstructionLabelCalmNarration":`沉稳旁白`,"settings.breezeInstructionTextWhisperFear":`轻声耳语,语气很轻且紧张,像担心被别人听见。`,"settings.breezeInstructionTextExcitedSurprise":`用明亮、兴奋和充满惊喜的语气朗读,能量逐渐上扬。`,"settings.breezeInstructionTextSarcasticDisbelief":`用干涩、讽刺且难以置信的语气朗读,带一点轻蔑。`,"settings.breezeInstructionTextNervousHumor":`用紧张的幽默感朗读,第一句话之后带一声轻微的紧张笑声。`,"settings.breezeInstructionTextRestrainedGrief":`像强忍泪水一样朗读,声音略带颤抖和哽咽,情绪克制。`,"settings.breezeInstructionTextCalmNarration":`用沉稳、清晰、自然的旁白语气朗读,节奏均匀,停顿明确。`,"settings.mimoInstructionGentlePrompt":`温柔亲切的语调,轻柔清晰地发音,句尾舒缓。`,"settings.mimoInstructionCheerfulPrompt":`明亮活泼的语调,节奏轻快,重音灵动,带着分享好消息的喜悦。`,"settings.mimoInstructionCalmPrompt":`沉稳从容的语调,节奏平稳,停顿清晰,情绪克制。`,"settings.mimoInstructionStoryPrompt":`像讲故事的旁白,随情节自然调整重音与停顿,让叙述有层次。`,"settings.mimoInstructionArgumentPrompt":`用愤怒、凌厉的争辩语气朗读,重音鲜明,句子短促有力。`,"settings.mimoInstructionWhisperPrompt":`压低音量轻声耳语,发声轻柔,节奏放缓,像在近处分享秘密。`,"settings.mimoInstructionCutePrompt":`轻盈甜美的语调,咬字轻巧,尾音略微上扬,带一点俏皮感。`,"settings.mimoInstructionCantonesePrompt":`使用粤语发音朗读,语调自然流畅。`,"settings.mimoInstructionHenanPrompt":`使用河南话的发音与语调朗读,保持口语化的节奏。`,"settings.mimoInstructionSichuanPrompt":`使用四川话的发音与语调朗读,保持自然的口语节奏。`,"settings.mimoInstructionDongbeiPrompt":`使用东北话的发音与语调朗读,表达爽朗,节奏自然。`,"settings.speechInstructionPlaceholder":`例如:温柔、轻快、像讲故事一样`,"settings.speechInstructionHint":`描述情绪、语气或风格;留空使用默认表达`,"settings.speechInstructionInfo":`语音指令效果说明`,"settings.speechInstructionLimitations":`小米、豆包标准合成和 Breeze 分别保存指令;效果随模型、音色和文本而异,建议先试听。
9
+ Doubao applique les changements à la prochaine synthèse ; Xiaomi et la voix du navigateur, pendant la lecture. Le streaming Xiaomi modifie aussi la hauteur`,"settings.voiceRateInfo":`À propos de la vitesse de lecture`,"settings.readScope":`Étendue de lecture`,"settings.readScopeSmart":`Intelligente`,"settings.readScopeFull":`Intégrale`,"settings.readScopeFirstSegment":`Premier passage`,"settings.readScopeSmartHint":`Auto : réponses courtes entières, deux premiers passages des longues réponses, avec une conclusion facultative. Manuel : réponse entière`,"settings.readScopeFullHint":`Lit toute la réponse, automatiquement ou manuellement`,"settings.readScopeFirstSegmentHint":`Lit uniquement le premier passage, automatiquement ou manuellement`,"settings.summaryPresetModel":`Modèle prédéfini`,"settings.summaryVoiceDesignModel":`Création vocale personnalisée`,"settings.localSpeechAutoSummary":`Cloud en priorité`,"settings.stateOn":`Activé`,"settings.stateOff":`Désactivé`,"settings.model":`Réglages de la source vocale`,"settings.presetModel":`Voix prédéfinies (mimo-v2.5-tts)`,"settings.voiceDesignModel":`Création vocale (mimo-v2.5-tts-voicedesign)`,"settings.presetModelShort":`Voix prédéfinie (MiMo-TTS)`,"settings.voiceDesignModelShort":`Création vocale (MiMo-VoiceDesign)`,"settings.localSpeechMode":`Priorité vocale`,"settings.localSpeechAuto":`Cloud en priorité`,"settings.localSpeechFirst":`Local en priorité`,"settings.localSpeechDisabled":`Désactiver la voix locale`,"settings.localSpeechAutoHint":`Cloud d’abord ; voix du navigateur en cas d’échec avant le début de la lecture`,"settings.localSpeechFirstHint":`Voix du navigateur d’abord ; cloud en cas d’échec`,"settings.localSpeechDisabledHint":`Voix cloud uniquement, sans repli sur le navigateur`,"settings.localSpeechUnavailableHint":`Aucune voix du navigateur disponible ; utilisez le cloud en priorité`,"settings.localVoice":`Voix du navigateur`,"settings.localVoiceLoading":`Chargement des voix du navigateur…`,"settings.localVoiceUnavailable":`Aucune voix du navigateur disponible`,"settings.localVoiceOffline":`Hors ligne`,"settings.localVoiceOnline":`En ligne`,"settings.localVoiceEngine":`Source de la voix locale`,"settings.localVoiceEngineBrowser":`Navigateur`,"settings.localVoiceEngineMoss":`MOSS local`,"settings.mossProvider":`MOSS Nano (Local)`,"settings.experimental":`Expérimental`,"settings.more":`Plus`,"settings.moreHint":`Volume, vitesse, voix locale, portée et priorité vocale`,"settings.announcementsMoreHint":`Intégration à DSH, sources et plugins`,"settings.mossBaseURL":`URL du service MOSS`,"settings.mossProbe":`Détecter`,"settings.mossCopyDeployHint":`Copier l’invite de déploiement`,"settings.mossDeployHintBefore":`Pas encore installé ? `,"settings.mossDeployHintAction":`Copier l’invite`,"settings.mossDeployHintAfter":` et laisser DSH s’en charger.`,"settings.mossDeployCopied":`Copié — collez-la dans DSH.`,"settings.mossDeployCopyFailed":`Échec de la copie. Réessayez.`,"settings.mossProbingShort":`Détection…`,"settings.mossProbing":`Détection du service MOSS…`,"settings.mossOnlineReady":`En ligne · prêt`,"settings.mossWarming":`En ligne · préchauffage`,"settings.mossNotProbed":`Pas encore détecté`,"settings.mossInvalidUrl":`URL du service MOSS invalide`,"settings.mossTimeout":`Le service MOSS a expiré`,"settings.mossUnreachable":`Impossible de joindre le service MOSS`,"settings.mossProbeFailed":`Échec de la détection MOSS`,"settings.mossVoice":`Voix MOSS`,"settings.mossVoiceProbeFirst":`Détectez le service MOSS pour charger les voix`,"settings.mossBuiltInVoice":`voix intégrée`,"settings.mossLocalFirstHint":`Choisissez « Local en priorité » pour privilégier la voix MOSS ; « Cloud en priorité » n’y revient qu’en cas d’échec avant le début de la lecture cloud.`,"settings.mossLocalDisabledHint":`La voix locale est désactivée : la voix MOSS n’est pas utilisée.`,"settings.modelAutoPlayHintPreset":`Les voix prédéfinies prennent en charge le streaming`,"settings.modelAutoPlayHintVoiceDesign":`Lecture automatique après la fin de la réponse`,"settings.voice":`Voix intégrée`,"settings.format":`Format audio`,"settings.formatPcm":`PCM (streaming)`,"settings.formatMp3":`MP3 (audio complet)`,"settings.formatWav":`WAV (audio complet)`,"settings.formatPcmHint":`Lit l’audio dès réception ; utilise le MP3 en cas d’échec avant le premier fragment`,"settings.formatMp3Hint":`Lecture après génération ; fichiers plus petits`,"settings.formatWavHint":`Lecture après génération ; sans perte, fichiers plus volumineux`,"settings.voiceDesignPrompt":`Création vocale`,"settings.customVoiceOption":`Personnalisée`,"settings.customVoiceSummary":`Décrire une voix personnalisée`,"settings.voiceDesignPromptHint":`Décrivez l’âge, le genre, le timbre, le rythme et l’émotion ; omettez scènes et actions`,"settings.voiceDesignPlaybackMode":`Mode de lecture`,"settings.voiceDesignPlaybackComplete":`Intégrale`,"settings.voiceDesignPlaybackSegmented":`Par passages`,"settings.voiceDesignPlaybackFirstSegment":`Premier passage`,"settings.voiceDesignPlaybackCompleteHint":`Génère toute la réponse pour une voix cohérente ; les longs textes peuvent produire des défauts`,"settings.voiceDesignPlaybackSegmentedHint":`Génère par passages pour démarrer plus vite les longs textes ; la voix peut varier`,"settings.voiceDesignPlaybackFirstSegmentHint":`Lit seulement le premier passage pour démarrer plus vite et réduire la consommation`,"settings.previewTitle":`Table de diffusion`,"settings.previewText":`Texte d’essai`,"settings.previewDefaultText":`Bonjour ! Je suis votre assistante baleine. Quel plaisir d’explorer le monde des voix avec vous !`,"settings.previewDefaultTextPoetry":`Le vent plie les nuages en une lettre ; la lune la signe. Que les étoiles éclairent tous vos chemins de retour.`,"settings.previewDefaultTextInspiration":`Avancez à votre rythme. Une graine fleurit même après un printemps tardif. Un faux pas ne met pas fin au voyage.`,"settings.previewDefaultTextReflection":`On ne peut pas retenir chaque brise, mais on peut orienter sa voile. La réponse se trouve peut-être dans notre façon de vivre aujourd’hui.`,"settings.previewDefaultTextHumor":`Mon réveil a sonné. J’ai voté pour cinq minutes de plus au lit. Une heure après, la résolution était toujours en vigueur.`,"settings.previewPlaceholder":`Saisissez un texte d’essai`,"settings.previewPlay":`Lire l’essai`,"settings.previewListen":`Essayer`,"settings.previewStopShort":`Arrêter`,"settings.previewStop":`Arrêter l’essai`,"settings.previewHint":`Enregistrez une clé pour essayer les voix cloud`,"settings.previewLoading":`Préparation…`,"settings.previewPlaying":`Lecture en cours ; cliquez pour arrêter`,"settings.previewLoadingMimo":`Connexion à MiMo…`,"settings.previewLoadingLocal":`Préparation de la voix du navigateur…`,"settings.previewPlayingMimo":`Lecture MiMo ; cliquez pour arrêter`,"settings.previewPlayingLocal":`Voix du navigateur en cours ; cliquez pour arrêter`,"settings.previewCompletedMimo":`Essai MiMo terminé`,"settings.previewCompletedLocal":`Essai de la voix locale terminé`,"settings.previewLoadingBreeze":`Connexion à Breeze…`,"settings.previewPlayingBreeze":`Lecture Breeze ; cliquez pour arrêter`,"settings.previewCompletedBreeze":`Essai Breeze terminé`,"settings.previewErrorApiKeyMissing":`Enregistrez une clé API ou activez la voix du navigateur`,"settings.previewErrorApiKeyRejected":`Clé refusée. Vérifiez-la ou remplacez-la`,"settings.previewErrorRateLimited":`Trop de requêtes. Réessayez dans un instant`,"settings.previewErrorTimeout":`Délai dépassé. Vérifiez votre connexion et réessayez`,"settings.previewErrorLocalUnavailable":`Aucune voix du navigateur disponible`,"settings.previewErrorAutoplay":`Lecture bloquée. Relancez l’essai`,"settings.previewFailed":`Essai échoué. Vérifiez les réglages et la connexion`,"settings.save":`Enregistrer`,"settings.saving":`Enregistrement…`,"settings.saved":`Enregistré`,"settings.unsaved":`Non enregistré`,"settings.overridden":`Personnalisé`,"settings.reset":`Rétablir la valeur par défaut`,"settings.discard":`Abandonner les changements`,"settings.failed":`Enregistrement échoué. Réessayez`,"settings.source":`Voir le code source`,"settings.readOnly":`Les réglages DSH sont en lecture seule`,"settings.secretPlaceholder":`Saisissez une nouvelle clé pour ce fournisseur`,"settings.expand":`Développer les réglages`,"settings.collapse":`Réduire les réglages`,"settings.soundEffectsTitle":`Effets sonores`,"settings.soundEffectsEnabled":`Activer les sons`,"settings.soundEffectsVolume":`Volume`,"settings.soundEffectsPack":`Pack sonore`,"settings.soundEffectsTask":`Sons des tâches`,"settings.soundEffectsClick":`Sons des clics`,"settings.soundEffectsOn":`Tous les sons`,"settings.soundEffectsOff":`Désactivés`,"settings.soundEffectsOnLabel":`Sons magiques activés`,"settings.soundEffectsOffLabel":`Sons magiques désactivés`,"settings.soundEffectsBubbleOff":`UISFX désactivé`,"settings.soundEffectsClickOnly":`Clics uniquement`,"settings.soundEffectsTaskOnly":`Tâches uniquement`,"settings.soundEffectsTurnOn":`Activer les sons`,"settings.soundEffectsTurnOff":`Désactiver les sons`,"settings.soundEffectsSynced":`Tâches et clics synchronisés`,"settings.soundEffectsPreviewLabel":`Essais des sons`,"settings.soundEffectsPreview.start":`Essayer le son de démarrage`,"settings.soundEffectsPreview.complete":`Essayer le son de fin`,"settings.soundEffectsPreview.success":`Essayer le son de réussite`,"settings.soundEffectsPreview.error":`Essayer le son d’erreur`,"settings.soundEffectsPreview.notification":`Essayer la notification`,"settings.soundEffectsPreview.press":`Essayer le clic`,"settings.soundEffectsPreview.select":`Essayer la sélection`,"settings.soundEffectsPreview.toggle-on":`Essayer l’activation`,"settings.soundEffectsPreview.toggle-off":`Essayer la désactivation`,"settings.soundEffectsPreview.send":`Essayer l’envoi`,"settings.soundEffectsPreview.open":`Essayer l’ouverture`,"settings.soundEffectsPreview.close":`Essayer la fermeture`,"settings.soundEffectsPreview.delete":`Essayer la suppression`,"settings.soundEffectsPreview.stop":`Essayer l’arrêt`,"settings.soundEffectsPreview.queued":`Essayer la mise en attente`,"settings.soundEffectsDescription":`Sons des clics et des événements de tâches`,"settings.soundEffectsSupported":`Sons disponibles : démarrage, fin, réussite, erreur, notification, clic, sélection, activation, désactivation, envoi, ouverture, fermeture, suppression, arrêt, mise en attente`},gi=`xiaomi-mimo-tts`,_i={...ci,...ui,...fi,"detail.star":`Star`,"detail.manual":`手册`,"detail.workshop":`工坊`,"detail.keyLoading":`正在检查密钥`,"detail.keyMissing":`未配置密钥`,"detail.keyRecognized":`密钥格式已识别`,"detail.keyUnrecognized":`密钥格式不支持`,"detail.keyUnavailable":`无法检查密钥`,"detail.retry":`重新检查`,"detail.preview":`插件详情`,"detail.previewChanging":`模拟插件变更`,"detail.previewKey":`模拟密钥状态`,"plugin.changing":`插件正在变更,语音播放暂时停止。`,"onboarding.title":`版本新功能`,"onboarding.summary":`查看 Passport、鲸鱼娘和插件设置的新功能。`,"onboarding.details":`更新详情`,"onboarding.externalSpeechTitle":`接入外部语音供应商`,"onboarding.externalVoicesTitle":`在音色工坊挑选声音`,"onboarding.externalSwitchTitle":`轻松切换供应商`,"onboarding.featureExternalSpeech":`查看 Passport 设备状态、识别结果和回复`,"onboarding.featureExternalVoices":`在 Passport 设置中测试语音识别连接`,"onboarding.featureExternalSwitch":`为鲸鱼娘分别控制记忆与表情包能力`,"onboarding.featureGuideControl":`随时关闭或重新开启新功能引导`,"onboarding.configure":`打开音色工坊`,"onboarding.github":`点个 Star 鼓励一下`,"onboarding.preview":`试听浏览器语音`,"onboarding.dismiss":`关闭`,"onboarding.never":`以后不再提醒`,"onboarding.sample":`你好,语音已经准备好了,很高兴陪你一起探索声音的世界。`,"settings.announcementsApprovals":`审批提醒`,"settings.announcementsApprovalsHint":`提醒当前会话的待审批操作;处理或撤回后停止`,"settings.announcementsJobs":`后台任务结果`,"settings.announcementsJobsHint":`播报当前会话中已观察到的任务结果;需启用任务服务`,"announcements.approval":`有一项操作等待你确认。`,"announcements.job":`后台任务`,"announcements.jobCompleted":`已结束。`,"announcements.jobFailed":`执行失败。`,"announcements.jobKilled":`已取消。`,"settings.soundEffectsScope":`音效范围`,"settings.announcementsWhale":`dsh-whale-musume`,"settings.announcementsQuestions":`提问卡片标题`,"settings.announcementsPetHint":`播报桌宠闲聊、回复和投喂文字`,"settings.announcementsWhaleHint":`接收鲸鱼娘的语音播报`,"settings.announcementsQuestionsHint":`随自动播报朗读当前题目;翻题或关闭时停止`,"settings.announcementsNone":`未启用来源`,"settings.hostIntegration":`宿主适配`,"settings.inputAvoidance":`输入时避让`,"settings.inputAvoidanceHint":`输入框聚焦且有未发送内容时停止自动播报,离开或清空后恢复;`,"settings.importantAnnouncementsFirst":`重要提醒优先`,"settings.importantAnnouncementsFirstHint":`待审批与后台任务失败提醒可打断普通播报;仍遵守语音输入和输入时避让。`,"settings.showInHostSettings":`宿主设置入口`,"settings.showInHostSettingsHint":`在 DSH 设置中显示「语音朗读」快捷设置。保存后生效。`,"settings.voiceInputCompatibility":`语音输入避让`,"settings.voiceInputCompatibilityHint":`使用 DSH 官方语音输入时停止播报和音效,录音及转写期间保持安静;`,"settings.announcementsTitle":`播报来源`,"settings.announcementsPlugins":`插件联动`,"settings.announcementsPluginsHint":`需安装并启用对应插件`,"settings.passportIntegration":`Ai Passport 应用`,"settings.passportIntegrationHint":`WhaleTalk Passport(鲸语通行证),随身使用 DSH 语音对话`,"settings.qqbotIntegration":`QQ Bot`,"settings.qqbotIntegrationHint":`开启后自动发送完整语音;关闭后仅按用户要求发送。需启用「QQ Bot 传声筒」,保存后生效`,"settings.announcementsPet":`dsh-pet`,"settings.announcementsHint":`需开启语音并保持网页打开;忙碌时跳过,不补播`,"settings.provider":`语音服务商`,"settings.providerXiaomi":`小米 MiMo`,"settings.providerDoubao":`豆包语音`,"settings.providerBreeze":`Breeze Blue`,"settings.externalManage":`管理供应商`,"settings.externalProviderAdapter":`我想连接其他 TTS 服务商`,"settings.showFeatureGuide":`新功能引导`,"settings.showFeatureGuideHint":`启用插件时显示新功能引导弹窗。`,"settings.acceptExternalProviders":`接收外部供应商`,"settings.acceptExternalProvidersHint":`允许外部插件提供语音服务;关闭并保存后恢复内置供应商。`,"settings.externalSwitchFailed":`供应商切换失败,请重试。`,"settings.externalOptionsHint":`可用选项由外部插件声明;不支持的功能不可用。`,"settings.externalManaged":`语音服务由外部插件管理`,"settings.externalNotReady":`外部语音服务未就绪,请检查对应插件配置`,"settings.externalDisconnected":`语音服务状态连接已断开,恢复前暂停新的合成`,"settings.externalLoading":`正在使用外部语音服务生成音频`,"settings.externalPlaying":`正在播放外部语音服务音频`,"settings.externalCompleted":`外部语音试听完成`,"settings.breezeCustomVoice":`自定义 Voice ID`,"settings.breezeCustomVoiceHint":`填写其他 Breeze Voice ID`,"settings.breezeVoiceHistory":`Breeze 音色 ID 历史`,"settings.breezeVoiceHint":`Breeze voice ID`,"settings.voiceReadingHintBreeze":`填写 Breeze Voice ID`,"settings.switchProvider":`切换供应商`,"settings.doubaoStandardModel":`标准合成(seed-tts-2.0)`,"settings.doubaoCloneModel":`声音复刻(seed-icl-2.0)`,"settings.speechInstruction":`语音指令`,"settings.speechInstructionPresets":`语音指令预设`,"settings.speechInstructionCustom":`自定义指令`,"settings.mimoInstructionHint":`小米专用风格描述;留空使用默认表达,音色设计仍保留音色描述`,"settings.doubaoInstructionHint":`豆包标准合成的语音指令;留空使用音色默认表达`,"settings.breezeInstructionHint":`Breeze 会根据场景、意图、情绪和节奏调整表演;留空使用音色默认表达`,"settings.breezeInstructionLabelWarmCompanion":`温柔陪伴`,"settings.breezeInstructionTextWarmCompanion":`像陪伴熟悉的朋友一样轻柔地说话,语气温暖真诚,节奏舒缓,留出自然的回应空间。`,"settings.breezeInstructionLabelPlayfulTeasing":`俏皮调侃`,"settings.breezeInstructionTextPlayfulTeasing":`用轻快俏皮、带一点善意调侃的语气说话,重音灵活,句尾略带笑意,避免尖刻。`,"settings.breezeInstructionLabelSeriousAnnouncement":`正式播报`,"settings.breezeInstructionTextSeriousAnnouncement":`以正式播音员的口吻清晰朗读,语气客观坚定,语速适中,在信息重点和句间自然停顿。`,"settings.breezeInstructionLabelEncouragingSupport":`坚定鼓励`,"settings.breezeInstructionTextEncouragingSupport":`用坚定而温暖的语气给予鼓励,表达信任与支持,语调逐渐明亮,不夸张喊叫。`,"settings.breezeInstructionLabelSleepyBedtime":`晚安轻语`,"settings.breezeInstructionTextSleepyBedtime":`像睡前轻声道晚安,声音柔和松弛,放慢节奏,使用轻缓的句尾与安静自然的停顿。`,"settings.breezeInstructionLabelWhisperFear":`害怕被听见`,"settings.breezeInstructionLabelExcitedSurprise":`兴奋惊喜`,"settings.breezeInstructionLabelSarcasticDisbelief":`讽刺不屑`,"settings.breezeInstructionLabelNervousHumor":`紧张幽默`,"settings.breezeInstructionLabelRestrainedGrief":`克制悲伤`,"settings.breezeInstructionLabelCalmNarration":`沉稳旁白`,"settings.breezeInstructionTextWhisperFear":`轻声耳语,语气很轻且紧张,像担心被别人听见。`,"settings.breezeInstructionTextExcitedSurprise":`用明亮、兴奋和充满惊喜的语气朗读,能量逐渐上扬。`,"settings.breezeInstructionTextSarcasticDisbelief":`用干涩、讽刺且难以置信的语气朗读,带一点轻蔑。`,"settings.breezeInstructionTextNervousHumor":`用紧张的幽默感朗读,第一句话之后带一声轻微的紧张笑声。`,"settings.breezeInstructionTextRestrainedGrief":`像强忍泪水一样朗读,声音略带颤抖和哽咽,情绪克制。`,"settings.breezeInstructionTextCalmNarration":`用沉稳、清晰、自然的旁白语气朗读,节奏均匀,停顿明确。`,"settings.mimoInstructionGentlePrompt":`温柔亲切的语调,轻柔清晰地发音,句尾舒缓。`,"settings.mimoInstructionCheerfulPrompt":`明亮活泼的语调,节奏轻快,重音灵动,带着分享好消息的喜悦。`,"settings.mimoInstructionCalmPrompt":`沉稳从容的语调,节奏平稳,停顿清晰,情绪克制。`,"settings.mimoInstructionStoryPrompt":`像讲故事的旁白,随情节自然调整重音与停顿,让叙述有层次。`,"settings.mimoInstructionArgumentPrompt":`用愤怒、凌厉的争辩语气朗读,重音鲜明,句子短促有力。`,"settings.mimoInstructionWhisperPrompt":`压低音量轻声耳语,发声轻柔,节奏放缓,像在近处分享秘密。`,"settings.mimoInstructionCutePrompt":`轻盈甜美的语调,咬字轻巧,尾音略微上扬,带一点俏皮感。`,"settings.mimoInstructionCantonesePrompt":`使用粤语发音朗读,语调自然流畅。`,"settings.mimoInstructionHenanPrompt":`使用河南话的发音与语调朗读,保持口语化的节奏。`,"settings.mimoInstructionSichuanPrompt":`使用四川话的发音与语调朗读,保持自然的口语节奏。`,"settings.mimoInstructionDongbeiPrompt":`使用东北话的发音与语调朗读,表达爽朗,节奏自然。`,"settings.speechInstructionPlaceholder":`例如:温柔、轻快、像讲故事一样`,"settings.speechInstructionHint":`描述情绪、语气或风格;留空使用默认表达`,"settings.speechInstructionInfo":`语音指令效果说明`,"settings.speechInstructionLimitations":`小米、豆包标准合成和 Breeze 分别保存指令;效果随模型、音色和文本而异,建议先试听。
10
10
  本地语音和豆包复刻暂不支持。Breeze 指令请使用与朗读文本相同的语言。`,"settings.speechInstructionNatural":`自然表达`,"settings.speechInstructionGentle":`温柔`,"settings.speechInstructionGentlePrompt":`用温柔、亲切自然的语气说话。`,"settings.speechInstructionCheerful":`欢快`,"settings.speechInstructionCheerfulPrompt":`用轻快、愉悦、有活力的语气说话。`,"settings.speechInstructionCalm":`沉稳`,"settings.speechInstructionCalmPrompt":`用沉稳、从容、克制的语气说话。`,"settings.speechInstructionStory":`讲故事`,"settings.speechInstructionStoryPrompt":`像讲故事一样娓娓道来,情绪随内容自然变化。`,"settings.speechInstructionArgument":`争执互怼`,"settings.speechInstructionArgumentPrompt":`像正在和对方争辩一样说话,带着不服气和针锋相对的情绪。`,"settings.speechInstructionWhisper":`悄悄话`,"settings.speechInstructionWhisperPrompt":`像贴近耳边分享秘密一样轻声细语,带一点亲昵的 ASMR 气息。`,"settings.speechInstructionShy":`害羞期待`,"settings.speechInstructionShyPrompt":`说话有些羞涩和欲言又止,同时流露出想靠近对方的期待与温柔。`,"settings.speechInstructionWeary":`沧桑低沉`,"settings.speechInstructionWearyPrompt":`声线低沉、略带沙哑,像历经风霜的人倾诉心事,情绪疲惫而落寞。`,"settings.speechInstructionTearful":`心碎哭腔`,"settings.speechInstructionTearfulPrompt":`用快要落泪的颤音说话,声音有些哽咽,带着难以释怀的伤心与委屈。`,"settings.speechInstructionCoy":`撒娇`,"settings.speechInstructionCoyPrompt":`用软软的、带点依赖感的撒娇语气说话,亲近又俏皮。`,"settings.speechInstructionCute":`夹子音`,"settings.speechInstructionCutePrompt":`用偏高、轻盈甜美的声线说话,语气可爱,带一点俏皮感。`,"settings.speechInstructionSichuan":`四川话`,"settings.speechInstructionCantonese":`粤语`,"settings.speechInstructionCantonesePrompt":`用自然、地道的粤语朗读这段话,保持日常聊天的感觉。`,"settings.speechInstructionShanghai":`上海话`,"settings.speechInstructionShanghaiPrompt":`用自然的上海话说这段话,保持日常聊天的感觉。`,"settings.speechInstructionHenan":`河南话`,"settings.speechInstructionHenanPrompt":`用自然的河南话说这段话,保持日常聊天的感觉。`,"settings.speechInstructionTianjin":`天津话`,"settings.speechInstructionTianjinPrompt":`用自然的天津话说这段话,保持日常聊天的感觉。`,"settings.speechInstructionShaanxi":`陕西话`,"settings.speechInstructionShaanxiPrompt":`用自然的陕西话说这段话,保持日常聊天的感觉。`,"settings.speechInstructionDongbei":`东北话`,"settings.speechInstructionDongbeiPrompt":`用自然的东北话说这段话,语气亲切、口语化。`,"settings.speechInstructionSichuanPrompt":`用自然的四川话口音说这段话,保持日常聊天的感觉。`,"settings.speechInstructionBeijing":`北京话`,"settings.speechInstructionBeijingPrompt":`用自然的北京话口音说这段话,带一点儿化音,像日常闲聊。`,"settings.doubaoKeyConfigured":`密钥已保存,请试听确认权限与音色`,"settings.doubaoCustomVoice":`自定义音色 ID`,"settings.doubaoCustomVoiceHint":`填写其他标准音色的 ID`,"settings.doubaoVoiceSceneGeneral":`日常陪伴`,"settings.doubaoVoiceSceneRole":`个性角色`,"settings.doubaoVoiceSceneDubbing":`特色配音`,"settings.doubaoVoiceSceneReading":`故事演绎`,"settings.doubaoVoiceChinese":`中文`,"settings.doubaoVoiceId":`音色 ID`,"settings.doubaoClonedVoice":`复刻音色 ID`,"settings.doubaoClonedVoiceLabel":`复刻音色`,"settings.doubaoStandardVoiceHistory":`标准音色 ID 历史`,"settings.doubaoClonedVoiceHistory":`复刻音色 ID 历史`,"settings.voiceRemark":`备注(可选)`,"settings.voiceTagEdit":`编辑备注`,"settings.voiceTagRemove":`删除记录`,"settings.voiceTagConfirm":`确认删除?`,"settings.voiceRemarkHint":`仅用于标签显示,保存在当前浏览器;留空显示音色 ID`,"settings.doubaoCloneHint":`填写豆包控制台创建的音色 ID`,"settings.doubaoVoiceLibrary":`打开音色库`,"settings.doubaoCreateVoice":`创建一个音色`,"settings.doubaoVoiceRequired":`请填写所选豆包模型的音色 ID`,"settings.doubaoStreamingHint":`边生成边播放`,"settings.previewLoadingDoubao":`正在连接豆包语音…`,"settings.previewPlayingDoubao":`豆包播放中,点击停止`,"settings.previewCompletedDoubao":`豆包试听完成`,"settings.previewSaveKeyFirst":`请先保存 API Key,再试听`,"settings.previewErrorVoiceUnavailable":`音色不可用,请检查音色 ID、模型及音色授权`,"settings.previewErrorResourceUnavailable":`当前 Key 未开通所选豆包模型资源`,"settings.previewErrorBufferLimit":`音频缓存已达上限,播放已停止`,"error.voiceUnavailable":`音色不可用,请检查模型、音色 ID 及权限。`,"error.resourceUnavailable":`当前 Key 未开通所选模型资源。`,"error.apiKeyRejected":`语音 API Key 鉴权失败,请检查设置。`,"error.rateLimited":`语音服务限流,请稍后重试。`,"error.timeout":`语音合成超时,请重试。`,"error.bufferLimit":`音频缓存已达上限,播放已停止。`,"history.title":`音频历史`,"history.shortTitle":`历史`,"history.backToSettings":`返回设置页`,"history.search":`搜索音频摘要`,"history.source":`来源`,"history.all":`全部`,"history.untitled":`未命名音频`,"history.characters":`字符`,"history.expand":`展开或收起摘要`,"history.noResults":`没有匹配的音频。`,"history.resetFilters":`重置查找条件`,"history.savedHere":`已保存`,"history.temporary":`仅本次打开有效`,"history.clearConfirm":`清空全部音频历史?不受查找条件影响,且无法撤销。`,"history.confirmDelete":`确认删除`,"history.confirmClear":`确认`,"history.cancel":`取消`,"history.actionFailed":`操作未完成,请重试。`,"history.player":`历史音频播放器`,"history.selectAudio":`选择一条音频重听。`,"history.play":`播放`,"history.pause":`暂停`,"history.retry":`重试播放`,"history.seek":`播放进度`,"history.state.idle":`准备播放`,"history.state.loading":`正在加载音频…`,"history.state.playing":`正在播放`,"history.state.paused":`已暂停`,"history.state.ended":`播放结束`,"history.error.blocked":`浏览器阻止了播放,请点击重试播放。`,"history.error.decode":`浏览器无法解码这条音频,可重试或下载文件。`,"history.error.failed":`音频播放失败,请重试或下载文件。`,"history.hint":`最多 100 条 / 100 MB`,"history.empty":`还没有生成的音频`,"history.loading":`正在读取音频历史…`,"history.memory":`浏览器存储不可用或已满;当前列表仅在本次打开期间保留,建议及时下载。`,"history.skipped":`有音频超过 100 MB,未保留到历史列表。`,"history.listen":`重听音频`,"history.download":`下载`,"history.delete":`删除`,"history.clear":`清空`,"history.conversation":`对话朗读`,"history.preview":`设置试听`,"history.service":`服务播放`,"action.play":`朗读回复`,"action.pause":`暂停朗读`,"action.resume":`继续朗读`,"action.loading":`正在生成语音`,"action.cancel":`取消语音生成`,"action.stop":`停止朗读`,"action.localFallback":`本地语音`,"action.retry":`重新生成语音`,"error.noText":`没有可朗读的正文。`,"error.request":`语音生成失败。`,"error.play":`自动播放失败。`,"error.localNotAllowed":`本地语音被拒绝了,请重试。`,"error.localVoiceUnavailable":`当前浏览器音色不可用,请重新选择音色。`,"error.localMossUnreachable":`无法连接 MOSS 本地服务,请检查地址与服务状态。`,"error.localMossVoiceMissing":`还没有选择 MOSS 本地音色。`,"error.localMossInvalidUrl":`MOSS 本地音色地址无效。`,"error.localMossTimeout":`MOSS 本地合成超时。`,"error.localMossFailed":`MOSS 本地语音合成失败。`,"error.localTimeout":`等待超时。`,"error.localAudioDevice":`音频设备异常,请检查系统声音设置。`,"error.localSynthesis":`语音合成失败。`,"settings.title":`语音朗读 (Xiaomi MiMo)`,"settings.description":`使用小米 MiMo 或豆包朗读对话`,"settings.minimalMode":`极简模式`,"settings.minimalModeOn":`已开启`,"settings.minimalModeOff":`已关闭`,"settings.minimalModeShort":`极简`,"settings.defaultModeShort":`经典`,"settings.enabled":`语音播报`,"settings.enabledOnLabel":`开麦啦`,"settings.enabledOffLabel":`休息一会儿`,"settings.enabledHint":`关闭后隐藏语音设置并停止自动播报`,"settings.apiKey":`API Key`,"settings.apiKeyStatus":`输入并保存新密钥后才会替换`,"settings.apiKeyLoading":`正在读取密钥…`,"settings.apiKeyMissing":`请填写并保存当前服务商的 API Key`,"settings.apiKeyRecognized":`密钥格式有效,请试听确认连接`,"settings.apiKeyUnsupported":`密钥须以 sk- 或 tp- 开头`,"settings.apiKeyUnsupportedSaved":`已存密钥格式不受支持,请更换`,"settings.apiKeyUnavailable":`无法读取密钥状态,请检查连接`,"settings.apiKeyPendingSave":`保存后可用新密钥试听`,"settings.saveRejected":`宿主拒绝了设置更新,请确认当前配置可写后重试`,"settings.getApiKey":`获取 API Key`,"settings.apiKeyIdleCopy1":`我可以睁眼了吗?`,"settings.apiKeyIdleCopy2":`密钥藏好了吗?`,"settings.apiKeyIdleCopy3":`保存好就能开麦啦`,"settings.apiKeyIdleCopy4":`好想偷看一眼…`,"settings.apiKeyFocusCopy1":`好啦,我捂住眼睛`,"settings.apiKeyFocusCopy2":`我什么都没看见`,"settings.apiKeyFocusCopy3":`保密模式启动!`,"settings.apiKeyFocusCopy4":`慢慢填,我替你保密`,"settings.autoPlay":`自动播报`,"settings.autoPlayOnLabel":`主动念给你听`,"settings.autoPlayOffLabel":`等你叫我再念`,"settings.autoPlayHint":`浏览器可能阻止自动播放`,"settings.voiceReadingNav":`语音朗读`,"settings.voiceReadingTitle":`语音朗读`,"settings.voiceReadingSource":`GitHub 源码`,"settings.voiceReadingQq":`QQ 交流群`,"settings.voiceReadingQqCodeAlt":`QQ 交流群二维码`,"settings.voiceReadingQqClose":`关闭二维码`,"settings.voiceReadingPluginSettings":`插件设置`,"settings.voiceReadingWarningDisabled":`语音未开启,请在{settings}开启`,"settings.voiceReadingWarningApiKeyMissing":`缺少 API Key,请在{settings}填写`,"settings.voiceReadingWarningApiKeyInvalid":`API Key 格式不受支持,请检查{settings}`,"settings.voiceReadingWarningApiKeyUnavailable":`无法检查 API Key,请检查连接`,"settings.voiceReadingWarningVoiceRequired":`未选音色,请选择或在{settings}填写`,"settings.voiceReadingDismissWarning":`关闭提醒`,"settings.voiceReadingVoice":`朗读音色`,"settings.voiceReadingHintXiaomi":`小米 MiMo 内置音色`,"settings.voiceReadingHintVoiceDesign":`按描述生成音色,选择预设可更新描述`,"settings.voiceReadingHintDoubaoStandard":`豆包标准合成音色`,"settings.voiceReadingHintDoubaoCloned":`选择用过的复刻音色 ID`,"settings.voiceReadingCustomVoice":`自定义(当前)`,"settings.voiceReadingVolume":`朗读音量`,"settings.voiceReadingRate":`朗读语速`,"settings.voiceReadingAutoPlay":`自动播报`,"settings.voiceReadingSound":`音效`,"settings.voiceReadingSoundHint":`播放点击与任务音效`,"settings.voiceReadingReadOnly":`设置只读,无法修改`,"settings.voiceReadingUnavailable":`语音设置不可用`,"settings.voiceReadingSaveFailed":`保存失败,请重试`,"settings.detailedVoiceConfig":`调音台`,"settings.voiceVolume":`语音音量`,"settings.voiceRate":`播放语速`,"settings.voiceRateHint":`0.5×–2.0×,1.0× 为原速。
11
- 豆包下次合成生效;小米和本地语音播放时生效,小米流式播放会改变音调`,"settings.voiceRateInfo":`播放语速说明`,"settings.readScope":`朗读范围`,"settings.readScopeSmart":`智能模式`,"settings.readScopeFull":`全文模式`,"settings.readScopeFirstSegment":`首段模式`,"settings.readScopeSmartHint":`自动:短文全文、长文前两段,可附收尾语;手动全文`,"settings.readScopeFullHint":`自动与手动均朗读全文`,"settings.readScopeFirstSegmentHint":`自动与手动均只读首段`,"settings.summaryPresetModel":`预置音色`,"settings.summaryVoiceDesignModel":`自定义音色`,"settings.localSpeechAutoSummary":`云端优先`,"settings.stateOn":`已开启`,"settings.stateOff":`已关闭`,"settings.model":`模型选择`,"settings.presetModel":`预置音色模型 (mimo-v2.5-tts)`,"settings.voiceDesignModel":`自定义音色模型 (mimo-v2.5-tts-voicedesign)`,"settings.presetModelShort":`预置音色(MiMo-TTS)`,"settings.voiceDesignModelShort":`音色设计(MiMo-VoiceDesign)`,"settings.localSpeechMode":`语音策略`,"settings.localSpeechAuto":`云端优先`,"settings.localSpeechFirst":`本地优先`,"settings.localSpeechDisabled":`关闭本地语音`,"settings.localSpeechAutoHint":`云端优先,播放前失败则转本地语音`,"settings.localSpeechFirstHint":`本地优先,失败则转云端语音`,"settings.localSpeechDisabledHint":`仅用云端语音,不回退本地`,"settings.localSpeechUnavailableHint":`无可用本地音色,仅支持云端优先`,"settings.localVoice":`本地音色`,"settings.localVoiceLoading":`正在读取浏览器音色…`,"settings.localVoiceUnavailable":`没有可用的浏览器音色`,"settings.localVoiceOffline":`离线`,"settings.localVoiceOnline":`在线`,"settings.localVoiceEngine":`本地音色来源`,"settings.localVoiceEngineBrowser":`浏览器`,"settings.localVoiceEngineMoss":`MOSS 本地`,"settings.mossProvider":`MOSS Nano (Local)`,"settings.experimental":`实验性`,"settings.more":`更多`,"settings.moreHint":`音量、语速、本地音色、朗读范围与策略`,"settings.announcementsMoreHint":`宿主适配、播报来源和插件联动`,"settings.mossBaseURL":`MOSS 服务地址`,"settings.mossProbe":`探测`,"settings.mossCopyDeployHint":`复制部署提示词`,"settings.mossDeployHintBefore":`还没部署?`,"settings.mossDeployHintAction":`点击复制提示词`,"settings.mossDeployHintAfter":`,让DSH帮你`,"settings.mossDeployCopied":`已复制,交给DSH即可`,"settings.mossDeployCopyFailed":`复制失败,请重试`,"settings.mossProbingShort":`探测中…`,"settings.mossProbing":`正在探测 MOSS 服务…`,"settings.mossOnlineReady":`在线 · 已就绪`,"settings.mossWarming":`在线 · 预热中`,"settings.mossNotProbed":`尚未探测`,"settings.mossInvalidUrl":`MOSS 地址无效`,"settings.mossTimeout":`MOSS 服务超时`,"settings.mossUnreachable":`无法连接 MOSS 服务`,"settings.mossProbeFailed":`MOSS 探测失败`,"settings.mossVoice":`MOSS 音色`,"settings.mossVoiceProbeFirst":`先探测 MOSS 服务以加载音色`,"settings.mossBuiltInVoice":`内置音色`,"settings.mossLocalFirstHint":`选择「本地优先」后,MOSS 音色会作为首选朗读声音;「云端优先」时仅在云端播放前失败才回退。`,"settings.mossLocalDisabledHint":`本地语音已关闭,MOSS 音色不会参与朗读。`,"settings.modelAutoPlayHintPreset":`预置音色支持流式播放`,"settings.modelAutoPlayHintVoiceDesign":`回复完成后自动播放`,"settings.voice":`内置音色`,"settings.format":`音频格式`,"settings.formatPcm":`PCM(流式播放)`,"settings.formatMp3":`MP3(完整音频)`,"settings.formatWav":`WAV(完整音频)`,"settings.formatPcmHint":`边生成边播放;首片音频前失败则转 MP3`,"settings.formatMp3Hint":`生成完成后播放,文件较小`,"settings.formatWavHint":`生成完成后播放,无损但文件较大`,"settings.voiceDesignPrompt":`音色设计`,"settings.customVoiceOption":`自定义`,"settings.customVoiceSummary":`手动编写音色描述`,"settings.voiceDesignPromptHint":`描述年龄、性别、音质、节奏和情绪,不写场景或动作`,"settings.voiceDesignPlaybackMode":`朗读方式`,"settings.voiceDesignPlaybackComplete":`完整朗读`,"settings.voiceDesignPlaybackSegmented":`分片朗读`,"settings.voiceDesignPlaybackFirstSegment":`朗读首段`,"settings.voiceDesignPlaybackCompleteHint":`整篇生成后播放,语调连贯;长文可能失真`,"settings.voiceDesignPlaybackSegmentedHint":`分段生成,适合长文;起播快,语调可能变化`,"settings.voiceDesignPlaybackFirstSegmentHint":`只读首个分片,起播快、消耗低`,"settings.previewTitle":`播报台`,"settings.previewText":`试听文本`,"settings.previewPresets":`快捷文案`,"settings.previewPresetGreeting":`日常问候`,"settings.previewPresetPoetry":`诗意独白`,"settings.previewPresetInspiration":`温柔鼓励`,"settings.previewPresetReflection":`人生随想`,"settings.previewPresetHumor":`轻松幽默`,"settings.previewPresetNews":`新闻播报`,"settings.previewPresetStory":`情景故事`,"settings.previewPresetService":`客服欢迎`,"settings.previewPresetDialogue":`情绪对白`,"settings.previewDefaultTextStory":`旧书店快打烊时,一只橘猫推开了门。它没有看店主,只是轻轻一跃,趴在那本从未有人翻开的旅行日记上。`,"settings.previewDefaultTextService":`您好,欢迎使用语音服务。请告诉我您遇到的问题,我会陪您一步步解决。感谢您的耐心等待。`,"settings.previewDefaultTextDialogue":`你真的记得?我还以为,只有我把那句话放在心里。太好了,原来我们一直朝着同一个方向走。`,"settings.previewDefaultTextNews":`这里是晚间简讯。今天,城市图书馆正式开放夜间阅读区,让每一位晚归的人,都能在书页间找到片刻宁静。`,"settings.previewDownload":`下载当前试听音频`,"settings.previewDownloadUnavailable":`试听音频生成后即可下载`,"settings.previewDownloadLocal":`浏览器语音无法下载,请使用云端语音或 MOSS 试听`,"settings.previewDownloadFailed":`下载失败,请重试`,"settings.previewDefaultText":`你好呀,很高兴陪你一起探索声音的世界!这个声音听起来怎么样?`,"settings.previewDefaultTextPoetry":`晚风把云揉成一封信,月亮替我落了款。愿你走过的每一段夜路,都有星光相伴。`,"settings.previewDefaultTextInspiration":`走得慢一点也没关系。种子不会因为春天迟到,就放弃开花;你也不必因为一次跌倒,就怀疑远方。`,"settings.previewDefaultTextReflection":`我们无法留住每一阵风,却可以决定扬起哪一面帆。答案未必在远方,也可能藏在此刻认真生活的你心里。`,"settings.previewDefaultTextHumor":`闹钟响了,我和被窝开了个紧急会议。被窝提议再睡五分钟,我全票通过。结果一睁眼,会议已经开了一个小时。`,"settings.previewPlaceholder":`输入试听文字`,"settings.moreProviders":`更多供应商`,"settings.breezeEnabled":`启用 Breeze Blue`,"settings.providerMinimum":`小米始终开启;豆包和 Breeze 至少开启一个。`,"settings.breezeAudioTags":`声音标签`,"settings.xiaomiAudioTagsHint":`小米预置音色支持:句首设风格,句内调声音;可用 ()、()、[],支持自定义和组合。唱歌会插入句首。音色设计请用语音指令。`,"settings.breezeAudioTagsHint":`标签会插入试听文本;中文使用方括号,英文使用圆括号。仅 Breeze TTS 支持。`,"settings.breezeAudioTagsChinese":`中文`,"settings.breezeAudioTagsEnglish":`English`,"settings.audioTagsContinuous":`连续添加`,"settings.audioTagsContinuousHint":`固定标签弹窗`,"settings.previewPlay":`播放试听`,"settings.previewListen":`试听`,"settings.previewStopShort":`停止`,"settings.previewStop":`停止试听`,"settings.previewHint":`云端试听需先保存密钥`,"settings.previewLoading":`准备中…`,"settings.previewPlaying":`播放中,点击停止`,"settings.previewLoadingMimo":`正在连接 MiMo…`,"settings.previewLoadingLocal":`正在准备本地语音…`,"settings.previewPlayingMimo":`MiMo 播放中,点击停止`,"settings.previewPlayingLocal":`本地语音播放中,点击停止`,"settings.previewCompletedMimo":`MiMo 试听完成`,"settings.previewCompletedLocal":`本地语音试听完成`,"settings.previewLoadingBreeze":`正在连接 Breeze…`,"settings.previewPlayingBreeze":`Breeze 播放中,点击停止`,"settings.previewCompletedBreeze":`Breeze 试听完成`,"settings.previewErrorApiKeyMissing":`请先保存 API Key,或启用本地语音`,"settings.previewErrorApiKeyRejected":`密钥被拒绝,请检查或更换 API Key`,"settings.previewErrorRateLimited":`请求过于频繁,请稍后重试`,"settings.previewErrorTimeout":`请求超时,请检查网络后重试`,"settings.previewErrorLocalUnavailable":`无可用本地音色`,"settings.previewErrorAutoplay":`播放被阻止,请再次点击试听`,"settings.previewFailed":`试听失败,请检查设置和网络`,"settings.save":`保存`,"settings.saving":`保存中…`,"settings.saved":`已保存`,"settings.unsaved":`未保存`,"settings.overridden":`已覆盖`,"settings.reset":`恢复默认`,"settings.discard":`放弃修改`,"settings.failed":`保存失败,请重试`,"settings.source":`赏个Star`,"settings.readOnly":`当前 DSH 设置为只读`,"settings.secretPlaceholder":`输入当前服务商的新 API Key`,"settings.expand":`展开设置`,"settings.collapse":`收起设置`,"settings.soundEffectsTitle":`音效库`,"settings.soundEffectsEnabled":`启用音效`,"settings.soundEffectsVolume":`音效音量`,"settings.soundEffectsPack":`音效包`,"settings.soundEffectsTask":`任务音效`,"settings.soundEffectsClick":`点击音效`,"settings.soundEffectsOn":`全部开启`,"settings.soundEffectsOff":`已关闭`,"settings.soundEffectsOnLabel":`音效开启`,"settings.soundEffectsOffLabel":`音效关闭`,"settings.soundEffectsBubbleOff":`uisfx 已关闭`,"settings.soundEffectsClickOnly":`仅点击音效`,"settings.soundEffectsTaskOnly":`仅任务音效`,"settings.soundEffectsTurnOn":`开启音效`,"settings.soundEffectsTurnOff":`关闭音效`,"settings.soundEffectsSynced":`任务 / 点击同步`,"settings.soundEffectsPreviewLabel":`音效试听`,"settings.soundEffectsPreview.start":`开始`,"settings.soundEffectsPreview.complete":`完成`,"settings.soundEffectsPreview.success":`成功`,"settings.soundEffectsPreview.error":`失败`,"settings.soundEffectsPreview.notification":`提醒`,"settings.soundEffectsPreview.press":`点击`,"settings.soundEffectsPreview.select":`选择`,"settings.soundEffectsPreview.toggle-on":`开启`,"settings.soundEffectsPreview.toggle-off":`关闭`,"settings.soundEffectsPreview.send":`发送`,"settings.soundEffectsPreview.open":`打开`,"settings.soundEffectsPreview.close":`关闭面板`,"settings.soundEffectsPreview.delete":`删除`,"settings.soundEffectsPreview.stop":`停止`,"settings.soundEffectsPreview.queued":`排队`,"settings.soundEffectsDescription":`点击操作与任务状态音效`,"settings.soundEffectsSupported":`🔔 开始 完成 成功 失败 提醒 点击 选择 开启 关闭 发送 打开 关闭面板 删除 停止 排队`},_i={...ci,...ui,...fi,"detail.star":`Star`,"detail.manual":`Manual`,"detail.workshop":`Studio`,"detail.keyLoading":`Checking key`,"detail.keyMissing":`Key not configured`,"detail.keyRecognized":`Key format recognized`,"detail.keyUnrecognized":`Unsupported key format`,"detail.keyUnavailable":`Unable to check key`,"detail.retry":`Check again`,"detail.preview":`Plugin details`,"detail.previewChanging":`Simulate plugin change`,"detail.previewKey":`Simulated key status`,"plugin.changing":`Plugin changes are in progress. Speech is temporarily paused.`,"onboarding.title":`What’s new`,"onboarding.summary":`External speech providers are here, with more voices to choose from.`,"onboarding.details":`Update details`,"onboarding.externalSpeechTitle":`Connect external speech providers`,"onboarding.externalVoicesTitle":`Find your voice in Voice Workbench`,"onboarding.externalSwitchTitle":`Switch providers with ease`,"onboarding.featureExternalSpeech":`Connect external speech providers`,"onboarding.featureExternalVoices":`Choose models, voices and audio tags`,"onboarding.featureExternalSwitch":`Click the top card to switch providers`,"onboarding.configure":`Open Voice Workbench`,"onboarding.github":`Give us a star on GitHub`,"onboarding.preview":`Preview browser speech`,"onboarding.dismiss":`Maybe later`,"onboarding.sample":`Hello, I am Whale Maid. Your voice is ready. Let us explore together.`,"settings.announcementsApprovals":`Approval reminders`,"settings.announcementsApprovalsHint":`Announce pending approvals in this conversation; stop when resolved or withdrawn`,"settings.announcementsJobs":`Background job results`,"settings.announcementsJobsHint":`Announce results of observed jobs in this conversation; requires the jobs service`,"announcements.approval":`An operation is waiting for your approval.`,"announcements.job":`Background job`,"announcements.jobCompleted":`Finished.`,"announcements.jobFailed":`Failed.`,"announcements.jobKilled":`Cancelled.`,"settings.soundEffectsScope":`Sound scope`,"settings.announcementsWhale":`dsh-whale-musume`,"settings.announcementsQuestions":`Question card titles`,"settings.announcementsPetHint":`Read pet chatter, replies and feeding messages`,"settings.announcementsWhaleHint":`Allow speech requests from Whale Girl`,"settings.announcementsQuestionsHint":`Read the current question title with autoplay; stop on navigation or close`,"settings.announcementsNone":`No sources enabled`,"settings.hostIntegration":`Host integration`,"settings.inputAvoidance":`Yield while composing`,"settings.inputAvoidanceHint":`Stop automatic speech while the focused composer contains a draft. Leaving or clearing it permits new speech;`,"settings.importantAnnouncementsFirst":`Prioritize important alerts`,"settings.importantAnnouncementsFirstHint":`Approval requests and failed background jobs may interrupt ordinary speech. Voice input and composing still take precedence.`,"settings.showInHostSettings":`Host settings shortcut`,"settings.showInHostSettingsHint":`Show Voice reading in DSH settings. Save to apply.`,"settings.voiceInputCompatibility":`Yield to voice input`,"settings.voiceInputCompatibilityHint":`Stop speech and sound effects during official DSH voice input`,"settings.announcementsTitle":`Announcement sources`,"settings.announcementsPlugins":`Plugin integrations`,"settings.announcementsPluginsHint":`Requires the corresponding plugin to be installed and enabled`,"settings.passportIntegration":`Ai Passport app`,"settings.passportIntegrationHint":`WhaleTalk Passport: portable voice conversations with DSH`,"settings.qqbotIntegration":`QQ Bot`,"settings.qqbotIntegrationHint":`On: automatically send full voice replies. Off: send only on request. Enable QQ Bot Megaphone and save to apply`,"settings.announcementsPet":`dsh-pet`,"settings.announcementsHint":`Keep speech enabled and DSH Web open. Messages received while busy are skipped`,"settings.provider":`Speech provider`,"settings.providerXiaomi":`Xiaomi MiMo`,"settings.providerDoubao":`Doubao Voice`,"settings.providerBreeze":`Breeze Blue`,"settings.externalManage":`Manage providers`,"settings.externalProviderAdapter":`Provider adapter`,"settings.acceptExternalProviders":`Accept external providers`,"settings.acceptExternalProvidersHint":`Allow external plugins to provide speech. Turn off and save to restore the built-in provider.`,"settings.externalSwitchFailed":`Could not switch providers. Please try again.`,"settings.externalOptionsHint":`Options are declared by the external plugin. Unsupported features are unavailable.`,"settings.externalManaged":`Speech service managed by an external plugin.`,"settings.externalNotReady":`External speech is not ready. Check its plugin settings.`,"settings.externalDisconnected":`Speech status is disconnected. New synthesis is paused until reconnection.`,"settings.externalLoading":`Generating audio with the external speech service`,"settings.externalPlaying":`Playing external speech audio`,"settings.externalCompleted":`External speech preview completed`,"settings.breezeCustomVoice":`Custom Voice ID`,"settings.breezeCustomVoiceHint":`Enter another Breeze voice ID`,"settings.breezeVoiceHistory":`Breeze voice ID history`,"settings.breezeVoiceHint":`Breeze voice ID`,"settings.voiceReadingHintBreeze":`Enter a Breeze voice ID`,"settings.switchProvider":`Switch provider`,"settings.doubaoStandardModel":`Standard TTS (seed-tts-2.0)`,"settings.doubaoCloneModel":`Voice cloning (seed-icl-2.0)`,"settings.speechInstruction":`Speech instruction`,"settings.speechInstructionPresets":`Speech instruction presets`,"settings.speechInstructionCustom":`Custom instruction`,"settings.mimoInstructionHint":`Styles for Xiaomi. Leave blank for default delivery. Voice Design keeps its voice description`,"settings.doubaoInstructionHint":`Instructions for Doubao standard synthesis; leave blank for the voice’s default delivery`,"settings.breezeInstructionHint":`Breeze shapes delivery from situation, intent, emotion and rhythm; leave blank for the voice default`,"settings.breezeInstructionLabelWarmCompanion":`Warm companion`,"settings.breezeInstructionTextWarmCompanion":`Speak gently to a close friend, with sincere warmth, an unhurried pace, and natural room for a response.`,"settings.breezeInstructionLabelPlayfulTeasing":`Playful teasing`,"settings.breezeInstructionTextPlayfulTeasing":`Speak with lighthearted, affectionate teasing, lively emphasis, and a smile in the voice. Avoid sounding harsh.`,"settings.breezeInstructionLabelSeriousAnnouncement":`Formal broadcast`,"settings.breezeInstructionTextSeriousAnnouncement":`Read clearly as a professional announcer, with an objective, assured tone, a moderate pace, and natural pauses around key information.`,"settings.breezeInstructionLabelEncouragingSupport":`Encouragement`,"settings.breezeInstructionTextEncouragingSupport":`Offer encouragement with a warm, steady voice that conveys trust and support, gradually brightening without shouting.`,"settings.breezeInstructionLabelSleepyBedtime":`Bedtime softness`,"settings.breezeInstructionTextSleepyBedtime":`Speak softly as if saying goodnight, with a relaxed voice, a slow pace, gentle phrase endings, and quiet natural pauses.`,"settings.breezeInstructionLabelWhisperFear":`Afraid whisper`,"settings.breezeInstructionLabelExcitedSurprise":`Excited surprise`,"settings.breezeInstructionLabelSarcasticDisbelief":`Sarcastic disbelief`,"settings.breezeInstructionLabelNervousHumor":`Nervous humor`,"settings.breezeInstructionLabelRestrainedGrief":`Restrained grief`,"settings.breezeInstructionLabelCalmNarration":`Calm narration`,"settings.breezeInstructionTextWhisperFear":`Whisper very quietly and tensely, as if you are afraid of being overheard.`,"settings.breezeInstructionTextExcitedSurprise":`Speak with bright, excited surprise and rising energy, as if the news is wonderful and unexpected.`,"settings.breezeInstructionTextSarcasticDisbelief":`Speak with dry sarcasm and dismissive disbelief, as if this was obviously a terrible idea.`,"settings.breezeInstructionTextNervousHumor":`Use nervous humor, with a small nervous laugh after the first phrase to hide panic.`,"settings.breezeInstructionTextRestrainedGrief":`Speak while holding back tears, with a slightly cracked voice and restrained emotional pauses.`,"settings.breezeInstructionTextCalmNarration":`Read as a calm, clear narrator with an even pace and deliberate pauses.`,"settings.mimoInstructionGentlePrompt":`Use a warm, gentle tone with soft, clear articulation and relaxed sentence endings.`,"settings.mimoInstructionCheerfulPrompt":`Use a bright, lively tone, a buoyant pace and playful emphasis, as if sharing good news.`,"settings.mimoInstructionCalmPrompt":`Use a calm, composed tone with a steady pace, clear pauses and restrained emotion.`,"settings.mimoInstructionStoryPrompt":`Read as a storyteller, varying emphasis and pauses with the events to give the narration depth.`,"settings.mimoInstructionArgumentPrompt":`Read in an angry, sharp, argumentative tone with strong emphasis and short, forceful phrases.`,"settings.mimoInstructionWhisperPrompt":`Whisper quietly with soft articulation and a slower pace, as if sharing a secret nearby.`,"settings.mimoInstructionCutePrompt":`Use a light, sweet tone with delicate articulation, slightly rising endings and a playful touch.`,"settings.mimoInstructionCantonesePrompt":`Read with Cantonese pronunciation and a natural, flowing intonation.`,"settings.mimoInstructionHenanPrompt":`Read with Henan dialect pronunciation and intonation at a conversational pace.`,"settings.mimoInstructionSichuanPrompt":`Read with Sichuan dialect pronunciation and intonation at a natural conversational pace.`,"settings.mimoInstructionDongbeiPrompt":`Read with Northeastern Chinese pronunciation and intonation, with an open, lively expression and natural rhythm.`,"settings.speechInstructionPlaceholder":`Example: gentle, cheerful, or storytelling`,"settings.speechInstructionHint":`Describe emotion, tone or style; leave blank for default delivery`,"settings.speechInstructionInfo":`Speech instruction limitations`,"settings.speechInstructionLimitations":`Xiaomi, Doubao Standard and Breeze save instructions separately. Results vary by model, voice and text; preview first.
11
+ 豆包下次合成生效;小米和本地语音播放时生效,小米流式播放会改变音调`,"settings.voiceRateInfo":`播放语速说明`,"settings.readScope":`朗读范围`,"settings.readScopeSmart":`智能模式`,"settings.readScopeFull":`全文模式`,"settings.readScopeFirstSegment":`首段模式`,"settings.readScopeSmartHint":`自动:短文全文、长文前两段,可附收尾语;手动全文`,"settings.readScopeFullHint":`自动与手动均朗读全文`,"settings.readScopeFirstSegmentHint":`自动与手动均只读首段`,"settings.summaryPresetModel":`预置音色`,"settings.summaryVoiceDesignModel":`自定义音色`,"settings.localSpeechAutoSummary":`云端优先`,"settings.stateOn":`已开启`,"settings.stateOff":`已关闭`,"settings.model":`模型选择`,"settings.presetModel":`预置音色模型 (mimo-v2.5-tts)`,"settings.voiceDesignModel":`自定义音色模型 (mimo-v2.5-tts-voicedesign)`,"settings.presetModelShort":`预置音色(MiMo-TTS)`,"settings.voiceDesignModelShort":`音色设计(MiMo-VoiceDesign)`,"settings.localSpeechMode":`语音策略`,"settings.localSpeechAuto":`云端优先`,"settings.localSpeechFirst":`本地优先`,"settings.localSpeechDisabled":`关闭本地语音`,"settings.localSpeechAutoHint":`云端优先,播放前失败则转本地语音`,"settings.localSpeechFirstHint":`本地优先,失败则转云端语音`,"settings.localSpeechDisabledHint":`仅用云端语音,不回退本地`,"settings.localSpeechUnavailableHint":`无可用本地音色,仅支持云端优先`,"settings.localVoice":`本地音色`,"settings.localVoiceLoading":`正在读取浏览器音色…`,"settings.localVoiceUnavailable":`没有可用的浏览器音色`,"settings.localVoiceOffline":`离线`,"settings.localVoiceOnline":`在线`,"settings.localVoiceEngine":`本地音色来源`,"settings.localVoiceEngineBrowser":`浏览器`,"settings.localVoiceEngineMoss":`MOSS 本地`,"settings.mossProvider":`MOSS Nano (Local)`,"settings.experimental":`实验性`,"settings.more":`更多`,"settings.moreHint":`音量、语速、本地音色、朗读范围与策略`,"settings.announcementsMoreHint":`宿主适配、播报来源和插件联动`,"settings.mossBaseURL":`MOSS 服务地址`,"settings.mossProbe":`探测`,"settings.mossCopyDeployHint":`复制部署提示词`,"settings.mossDeployHintBefore":`还没部署?`,"settings.mossDeployHintAction":`点击复制提示词`,"settings.mossDeployHintAfter":`,让DSH帮你`,"settings.mossDeployCopied":`已复制,交给DSH即可`,"settings.mossDeployCopyFailed":`复制失败,请重试`,"settings.mossProbingShort":`探测中…`,"settings.mossProbing":`正在探测 MOSS 服务…`,"settings.mossOnlineReady":`在线 · 已就绪`,"settings.mossWarming":`在线 · 预热中`,"settings.mossNotProbed":`尚未探测`,"settings.mossInvalidUrl":`MOSS 地址无效`,"settings.mossTimeout":`MOSS 服务超时`,"settings.mossUnreachable":`无法连接 MOSS 服务`,"settings.mossProbeFailed":`MOSS 探测失败`,"settings.mossVoice":`MOSS 音色`,"settings.mossVoiceProbeFirst":`先探测 MOSS 服务以加载音色`,"settings.mossBuiltInVoice":`内置音色`,"settings.mossLocalFirstHint":`选择「本地优先」后,MOSS 音色会作为首选朗读声音;「云端优先」时仅在云端播放前失败才回退。`,"settings.mossLocalDisabledHint":`本地语音已关闭,MOSS 音色不会参与朗读。`,"settings.modelAutoPlayHintPreset":`预置音色支持流式播放`,"settings.modelAutoPlayHintVoiceDesign":`回复完成后自动播放`,"settings.voice":`内置音色`,"settings.format":`音频格式`,"settings.formatPcm":`PCM(流式播放)`,"settings.formatMp3":`MP3(完整音频)`,"settings.formatWav":`WAV(完整音频)`,"settings.formatPcmHint":`边生成边播放;首片音频前失败则转 MP3`,"settings.formatMp3Hint":`生成完成后播放,文件较小`,"settings.formatWavHint":`生成完成后播放,无损但文件较大`,"settings.voiceDesignPrompt":`音色设计`,"settings.customVoiceOption":`自定义`,"settings.customVoiceSummary":`手动编写音色描述`,"settings.voiceDesignPromptHint":`描述年龄、性别、音质、节奏和情绪,不写场景或动作`,"settings.voiceDesignPlaybackMode":`朗读方式`,"settings.voiceDesignPlaybackComplete":`完整朗读`,"settings.voiceDesignPlaybackSegmented":`分片朗读`,"settings.voiceDesignPlaybackFirstSegment":`朗读首段`,"settings.voiceDesignPlaybackCompleteHint":`整篇生成后播放,语调连贯;长文可能失真`,"settings.voiceDesignPlaybackSegmentedHint":`分段生成,适合长文;起播快,语调可能变化`,"settings.voiceDesignPlaybackFirstSegmentHint":`只读首个分片,起播快、消耗低`,"settings.previewTitle":`播报台`,"settings.previewText":`试听文本`,"settings.previewPresets":`快捷文案`,"settings.previewPresetGreeting":`日常问候`,"settings.previewPresetPoetry":`诗意独白`,"settings.previewPresetInspiration":`温柔鼓励`,"settings.previewPresetReflection":`人生随想`,"settings.previewPresetHumor":`轻松幽默`,"settings.previewPresetNews":`新闻播报`,"settings.previewPresetStory":`情景故事`,"settings.previewPresetService":`客服欢迎`,"settings.previewPresetDialogue":`情绪对白`,"settings.previewDefaultTextStory":`旧书店快打烊时,一只橘猫推开了门。它没有看店主,只是轻轻一跃,趴在那本从未有人翻开的旅行日记上。`,"settings.previewDefaultTextService":`您好,欢迎使用语音服务。请告诉我您遇到的问题,我会陪您一步步解决。感谢您的耐心等待。`,"settings.previewDefaultTextDialogue":`你真的记得?我还以为,只有我把那句话放在心里。太好了,原来我们一直朝着同一个方向走。`,"settings.previewDefaultTextNews":`这里是晚间简讯。今天,城市图书馆正式开放夜间阅读区,让每一位晚归的人,都能在书页间找到片刻宁静。`,"settings.previewDownload":`下载当前试听音频`,"settings.previewDownloadUnavailable":`试听音频生成后即可下载`,"settings.previewDownloadLocal":`浏览器语音无法下载,请使用云端语音或 MOSS 试听`,"settings.previewDownloadFailed":`下载失败,请重试`,"settings.previewDefaultText":`你好呀,很高兴陪你一起探索声音的世界!这个声音听起来怎么样?`,"settings.previewDefaultTextPoetry":`晚风把云揉成一封信,月亮替我落了款。愿你走过的每一段夜路,都有星光相伴。`,"settings.previewDefaultTextInspiration":`走得慢一点也没关系。种子不会因为春天迟到,就放弃开花;你也不必因为一次跌倒,就怀疑远方。`,"settings.previewDefaultTextReflection":`我们无法留住每一阵风,却可以决定扬起哪一面帆。答案未必在远方,也可能藏在此刻认真生活的你心里。`,"settings.previewDefaultTextHumor":`闹钟响了,我和被窝开了个紧急会议。被窝提议再睡五分钟,我全票通过。结果一睁眼,会议已经开了一个小时。`,"settings.previewPlaceholder":`输入试听文字`,"settings.moreProviders":`更多供应商`,"settings.breezeEnabled":`启用 Breeze Blue`,"settings.providerMinimum":`小米始终开启;豆包和 Breeze 至少开启一个。`,"settings.breezeAudioTags":`声音标签`,"settings.xiaomiAudioTagsHint":`小米预置音色支持:句首设风格,句内调声音;可用 ()、()、[],支持自定义和组合。唱歌会插入句首。音色设计请用语音指令。`,"settings.breezeAudioTagsHint":`标签会插入试听文本;中文使用方括号,英文使用圆括号。仅 Breeze TTS 支持。`,"settings.breezeAudioTagsChinese":`中文`,"settings.breezeAudioTagsEnglish":`English`,"settings.audioTagsContinuous":`连续添加`,"settings.audioTagsContinuousHint":`固定标签弹窗`,"settings.previewPlay":`播放试听`,"settings.previewListen":`试听`,"settings.previewStopShort":`停止`,"settings.previewStop":`停止试听`,"settings.previewHint":`云端试听需先保存密钥`,"settings.previewLoading":`准备中…`,"settings.previewPlaying":`播放中,点击停止`,"settings.previewLoadingMimo":`正在连接 MiMo…`,"settings.previewLoadingLocal":`正在准备本地语音…`,"settings.previewPlayingMimo":`MiMo 播放中,点击停止`,"settings.previewPlayingLocal":`本地语音播放中,点击停止`,"settings.previewCompletedMimo":`MiMo 试听完成`,"settings.previewCompletedLocal":`本地语音试听完成`,"settings.previewLoadingBreeze":`正在连接 Breeze…`,"settings.previewPlayingBreeze":`Breeze 播放中,点击停止`,"settings.previewCompletedBreeze":`Breeze 试听完成`,"settings.previewErrorApiKeyMissing":`请先保存 API Key,或启用本地语音`,"settings.previewErrorApiKeyRejected":`密钥被拒绝,请检查或更换 API Key`,"settings.previewErrorRateLimited":`请求过于频繁,请稍后重试`,"settings.previewErrorTimeout":`请求超时,请检查网络后重试`,"settings.previewErrorLocalUnavailable":`无可用本地音色`,"settings.previewErrorAutoplay":`播放被阻止,请再次点击试听`,"settings.previewFailed":`试听失败,请检查设置和网络`,"settings.save":`保存`,"settings.saving":`保存中…`,"settings.saved":`已保存`,"settings.unsaved":`未保存`,"settings.overridden":`已覆盖`,"settings.reset":`恢复默认`,"settings.discard":`放弃修改`,"settings.failed":`保存失败,请重试`,"settings.source":`赏个Star`,"settings.readOnly":`当前 DSH 设置为只读`,"settings.secretPlaceholder":`输入当前服务商的新 API Key`,"settings.expand":`展开设置`,"settings.collapse":`收起设置`,"settings.soundEffectsTitle":`音效库`,"settings.soundEffectsEnabled":`启用音效`,"settings.soundEffectsVolume":`音效音量`,"settings.soundEffectsPack":`音效包`,"settings.soundEffectsTask":`任务音效`,"settings.soundEffectsClick":`点击音效`,"settings.soundEffectsOn":`全部开启`,"settings.soundEffectsOff":`已关闭`,"settings.soundEffectsOnLabel":`音效开启`,"settings.soundEffectsOffLabel":`音效关闭`,"settings.soundEffectsBubbleOff":`uisfx 已关闭`,"settings.soundEffectsClickOnly":`仅点击音效`,"settings.soundEffectsTaskOnly":`仅任务音效`,"settings.soundEffectsTurnOn":`开启音效`,"settings.soundEffectsTurnOff":`关闭音效`,"settings.soundEffectsSynced":`任务 / 点击同步`,"settings.soundEffectsPreviewLabel":`音效试听`,"settings.soundEffectsPreview.start":`开始`,"settings.soundEffectsPreview.complete":`完成`,"settings.soundEffectsPreview.success":`成功`,"settings.soundEffectsPreview.error":`失败`,"settings.soundEffectsPreview.notification":`提醒`,"settings.soundEffectsPreview.press":`点击`,"settings.soundEffectsPreview.select":`选择`,"settings.soundEffectsPreview.toggle-on":`开启`,"settings.soundEffectsPreview.toggle-off":`关闭`,"settings.soundEffectsPreview.send":`发送`,"settings.soundEffectsPreview.open":`打开`,"settings.soundEffectsPreview.close":`关闭面板`,"settings.soundEffectsPreview.delete":`删除`,"settings.soundEffectsPreview.stop":`停止`,"settings.soundEffectsPreview.queued":`排队`,"settings.soundEffectsDescription":`点击操作与任务状态音效`,"settings.soundEffectsSupported":`🔔 开始 完成 成功 失败 提醒 点击 选择 开启 关闭 发送 打开 关闭面板 删除 停止 排队`},vi={...li,...di,...pi,"detail.star":`Star`,"detail.manual":`Manual`,"detail.workshop":`Studio`,"detail.keyLoading":`Checking key`,"detail.keyMissing":`Key not configured`,"detail.keyRecognized":`Key format recognized`,"detail.keyUnrecognized":`Unsupported key format`,"detail.keyUnavailable":`Unable to check key`,"detail.retry":`Check again`,"detail.preview":`Plugin details`,"detail.previewChanging":`Simulate plugin change`,"detail.previewKey":`Simulated key status`,"plugin.changing":`Plugin changes are in progress. Speech is temporarily paused.`,"onboarding.title":`What’s new`,"onboarding.summary":`Explore updates to Passport, Whale Girl, and plugin settings.`,"onboarding.details":`Update details`,"onboarding.externalSpeechTitle":`Connect external speech providers`,"onboarding.externalVoicesTitle":`Find your voice in Voice Workbench`,"onboarding.externalSwitchTitle":`Switch providers with ease`,"onboarding.featureExternalSpeech":`View Passport device status, transcripts, and replies`,"onboarding.featureExternalVoices":`Test speech recognition connections in Passport settings`,"onboarding.featureExternalSwitch":`Control Whale Girl memory and meme capabilities separately`,"onboarding.featureGuideControl":`Turn the new feature guide off or back on at any time`,"onboarding.configure":`Open Voice Workbench`,"onboarding.github":`Give us a star on GitHub`,"onboarding.preview":`Preview browser speech`,"onboarding.dismiss":`Close`,"onboarding.never":`Don’t remind me again`,"onboarding.sample":`Hello, I am Whale Maid. Your voice is ready. Let us explore together.`,"settings.announcementsApprovals":`Approval reminders`,"settings.announcementsApprovalsHint":`Announce pending approvals in this conversation; stop when resolved or withdrawn`,"settings.announcementsJobs":`Background job results`,"settings.announcementsJobsHint":`Announce results of observed jobs in this conversation; requires the jobs service`,"announcements.approval":`An operation is waiting for your approval.`,"announcements.job":`Background job`,"announcements.jobCompleted":`Finished.`,"announcements.jobFailed":`Failed.`,"announcements.jobKilled":`Cancelled.`,"settings.soundEffectsScope":`Sound scope`,"settings.announcementsWhale":`dsh-whale-musume`,"settings.announcementsQuestions":`Question card titles`,"settings.announcementsPetHint":`Read pet chatter, replies and feeding messages`,"settings.announcementsWhaleHint":`Allow speech requests from Whale Girl`,"settings.announcementsQuestionsHint":`Read the current question title with autoplay; stop on navigation or close`,"settings.announcementsNone":`No sources enabled`,"settings.hostIntegration":`Host integration`,"settings.inputAvoidance":`Yield while composing`,"settings.inputAvoidanceHint":`Stop automatic speech while the focused composer contains a draft. Leaving or clearing it permits new speech;`,"settings.importantAnnouncementsFirst":`Prioritize important alerts`,"settings.importantAnnouncementsFirstHint":`Approval requests and failed background jobs may interrupt ordinary speech. Voice input and composing still take precedence.`,"settings.showInHostSettings":`Host settings shortcut`,"settings.showInHostSettingsHint":`Show Voice reading in DSH settings. Save to apply.`,"settings.voiceInputCompatibility":`Yield to voice input`,"settings.voiceInputCompatibilityHint":`Stop speech and sound effects during official DSH voice input`,"settings.announcementsTitle":`Announcement sources`,"settings.announcementsPlugins":`Plugin integrations`,"settings.announcementsPluginsHint":`Requires the corresponding plugin to be installed and enabled`,"settings.passportIntegration":`Ai Passport app`,"settings.passportIntegrationHint":`WhaleTalk Passport: portable voice conversations with DSH`,"settings.qqbotIntegration":`QQ Bot`,"settings.qqbotIntegrationHint":`On: automatically send full voice replies. Off: send only on request. Enable QQ Bot Megaphone and save to apply`,"settings.announcementsPet":`dsh-pet`,"settings.announcementsHint":`Keep speech enabled and DSH Web open. Messages received while busy are skipped`,"settings.provider":`Speech provider`,"settings.providerXiaomi":`Xiaomi MiMo`,"settings.providerDoubao":`Doubao Voice`,"settings.providerBreeze":`Breeze Blue`,"settings.externalManage":`Manage providers`,"settings.externalProviderAdapter":`Provider adapter`,"settings.showFeatureGuide":`New feature guide`,"settings.showFeatureGuideHint":`Show the new feature guide when the plugin is activated.`,"settings.acceptExternalProviders":`Accept external providers`,"settings.acceptExternalProvidersHint":`Allow external plugins to provide speech. Turn off and save to restore the built-in provider.`,"settings.externalSwitchFailed":`Could not switch providers. Please try again.`,"settings.externalOptionsHint":`Options are declared by the external plugin. Unsupported features are unavailable.`,"settings.externalManaged":`Speech service managed by an external plugin.`,"settings.externalNotReady":`External speech is not ready. Check its plugin settings.`,"settings.externalDisconnected":`Speech status is disconnected. New synthesis is paused until reconnection.`,"settings.externalLoading":`Generating audio with the external speech service`,"settings.externalPlaying":`Playing external speech audio`,"settings.externalCompleted":`External speech preview completed`,"settings.breezeCustomVoice":`Custom Voice ID`,"settings.breezeCustomVoiceHint":`Enter another Breeze voice ID`,"settings.breezeVoiceHistory":`Breeze voice ID history`,"settings.breezeVoiceHint":`Breeze voice ID`,"settings.voiceReadingHintBreeze":`Enter a Breeze voice ID`,"settings.switchProvider":`Switch provider`,"settings.doubaoStandardModel":`Standard TTS (seed-tts-2.0)`,"settings.doubaoCloneModel":`Voice cloning (seed-icl-2.0)`,"settings.speechInstruction":`Speech instruction`,"settings.speechInstructionPresets":`Speech instruction presets`,"settings.speechInstructionCustom":`Custom instruction`,"settings.mimoInstructionHint":`Styles for Xiaomi. Leave blank for default delivery. Voice Design keeps its voice description`,"settings.doubaoInstructionHint":`Instructions for Doubao standard synthesis; leave blank for the voice’s default delivery`,"settings.breezeInstructionHint":`Breeze shapes delivery from situation, intent, emotion and rhythm; leave blank for the voice default`,"settings.breezeInstructionLabelWarmCompanion":`Warm companion`,"settings.breezeInstructionTextWarmCompanion":`Speak gently to a close friend, with sincere warmth, an unhurried pace, and natural room for a response.`,"settings.breezeInstructionLabelPlayfulTeasing":`Playful teasing`,"settings.breezeInstructionTextPlayfulTeasing":`Speak with lighthearted, affectionate teasing, lively emphasis, and a smile in the voice. Avoid sounding harsh.`,"settings.breezeInstructionLabelSeriousAnnouncement":`Formal broadcast`,"settings.breezeInstructionTextSeriousAnnouncement":`Read clearly as a professional announcer, with an objective, assured tone, a moderate pace, and natural pauses around key information.`,"settings.breezeInstructionLabelEncouragingSupport":`Encouragement`,"settings.breezeInstructionTextEncouragingSupport":`Offer encouragement with a warm, steady voice that conveys trust and support, gradually brightening without shouting.`,"settings.breezeInstructionLabelSleepyBedtime":`Bedtime softness`,"settings.breezeInstructionTextSleepyBedtime":`Speak softly as if saying goodnight, with a relaxed voice, a slow pace, gentle phrase endings, and quiet natural pauses.`,"settings.breezeInstructionLabelWhisperFear":`Afraid whisper`,"settings.breezeInstructionLabelExcitedSurprise":`Excited surprise`,"settings.breezeInstructionLabelSarcasticDisbelief":`Sarcastic disbelief`,"settings.breezeInstructionLabelNervousHumor":`Nervous humor`,"settings.breezeInstructionLabelRestrainedGrief":`Restrained grief`,"settings.breezeInstructionLabelCalmNarration":`Calm narration`,"settings.breezeInstructionTextWhisperFear":`Whisper very quietly and tensely, as if you are afraid of being overheard.`,"settings.breezeInstructionTextExcitedSurprise":`Speak with bright, excited surprise and rising energy, as if the news is wonderful and unexpected.`,"settings.breezeInstructionTextSarcasticDisbelief":`Speak with dry sarcasm and dismissive disbelief, as if this was obviously a terrible idea.`,"settings.breezeInstructionTextNervousHumor":`Use nervous humor, with a small nervous laugh after the first phrase to hide panic.`,"settings.breezeInstructionTextRestrainedGrief":`Speak while holding back tears, with a slightly cracked voice and restrained emotional pauses.`,"settings.breezeInstructionTextCalmNarration":`Read as a calm, clear narrator with an even pace and deliberate pauses.`,"settings.mimoInstructionGentlePrompt":`Use a warm, gentle tone with soft, clear articulation and relaxed sentence endings.`,"settings.mimoInstructionCheerfulPrompt":`Use a bright, lively tone, a buoyant pace and playful emphasis, as if sharing good news.`,"settings.mimoInstructionCalmPrompt":`Use a calm, composed tone with a steady pace, clear pauses and restrained emotion.`,"settings.mimoInstructionStoryPrompt":`Read as a storyteller, varying emphasis and pauses with the events to give the narration depth.`,"settings.mimoInstructionArgumentPrompt":`Read in an angry, sharp, argumentative tone with strong emphasis and short, forceful phrases.`,"settings.mimoInstructionWhisperPrompt":`Whisper quietly with soft articulation and a slower pace, as if sharing a secret nearby.`,"settings.mimoInstructionCutePrompt":`Use a light, sweet tone with delicate articulation, slightly rising endings and a playful touch.`,"settings.mimoInstructionCantonesePrompt":`Read with Cantonese pronunciation and a natural, flowing intonation.`,"settings.mimoInstructionHenanPrompt":`Read with Henan dialect pronunciation and intonation at a conversational pace.`,"settings.mimoInstructionSichuanPrompt":`Read with Sichuan dialect pronunciation and intonation at a natural conversational pace.`,"settings.mimoInstructionDongbeiPrompt":`Read with Northeastern Chinese pronunciation and intonation, with an open, lively expression and natural rhythm.`,"settings.speechInstructionPlaceholder":`Example: gentle, cheerful, or storytelling`,"settings.speechInstructionHint":`Describe emotion, tone or style; leave blank for default delivery`,"settings.speechInstructionInfo":`Speech instruction limitations`,"settings.speechInstructionLimitations":`Xiaomi, Doubao Standard and Breeze save instructions separately. Results vary by model, voice and text; preview first.
12
12
  Browser speech and Doubao cloning do not support instructions. Write Breeze instructions in the same language as the spoken text.`,"settings.speechInstructionNatural":`Natural`,"settings.speechInstructionGentle":`Gentle`,"settings.speechInstructionGentlePrompt":`Speak in a gentle, warm and natural tone.`,"settings.speechInstructionCheerful":`Cheerful`,"settings.speechInstructionCheerfulPrompt":`Speak with a bright, happy and energetic tone.`,"settings.speechInstructionCalm":`Calm`,"settings.speechInstructionCalmPrompt":`Speak with a calm, composed and restrained tone.`,"settings.speechInstructionStory":`Storytelling`,"settings.speechInstructionStoryPrompt":`Tell the text like a story, letting emotion follow the content naturally.`,"settings.speechInstructionArgument":`Argument`,"settings.speechInstructionArgumentPrompt":`Sound as if debating someone, with a defiant and confrontational attitude.`,"settings.speechInstructionWhisper":`Whisper`,"settings.speechInstructionWhisperPrompt":`Speak softly as if sharing a secret close to the listener, with an intimate ASMR quality.`,"settings.speechInstructionShy":`Shy anticipation`,"settings.speechInstructionShyPrompt":`Sound shy and hesitant, while revealing warmth and anticipation of growing closer.`,"settings.speechInstructionWeary":`World-weary`,"settings.speechInstructionWearyPrompt":`Use a low, slightly husky voice, as if confiding after a hard life, with weary loneliness.`,"settings.speechInstructionTearful":`Tearful`,"settings.speechInstructionTearfulPrompt":`Speak with a trembling voice on the verge of tears, a little choked with sadness and hurt.`,"settings.speechInstructionCoy":`Coy`,"settings.speechInstructionCoyPrompt":`Speak in a soft, affectionate, slightly dependent tone with playful charm.`,"settings.speechInstructionCute":`Cute voice`,"settings.speechInstructionCutePrompt":`Use a higher, light and sweet voice with a cute, slightly playful delivery.`,"settings.speechInstructionSichuan":`Sichuan dialect`,"settings.speechInstructionCantonese":`Cantonese`,"settings.speechInstructionCantonesePrompt":`Read this text in natural, idiomatic Cantonese, like an everyday conversation.`,"settings.speechInstructionShanghai":`Shanghai dialect`,"settings.speechInstructionShanghaiPrompt":`Read this text in natural Shanghainese, like an everyday conversation.`,"settings.speechInstructionHenan":`Henan dialect`,"settings.speechInstructionHenanPrompt":`Read this text in natural Henan Chinese, like an everyday conversation.`,"settings.speechInstructionTianjin":`Tianjin dialect`,"settings.speechInstructionTianjinPrompt":`Read this text in natural Tianjin Chinese, like an everyday conversation.`,"settings.speechInstructionShaanxi":`Shaanxi dialect`,"settings.speechInstructionShaanxiPrompt":`Read this text in natural Shaanxi Chinese, like an everyday conversation.`,"settings.speechInstructionDongbei":`Northeastern dialect`,"settings.speechInstructionDongbeiPrompt":`Read this text in natural Northeastern Chinese with a warm, conversational tone.`,"settings.speechInstructionSichuanPrompt":`Read this text in a natural Sichuan Chinese accent, like an everyday conversation.`,"settings.speechInstructionBeijing":`Beijing dialect`,"settings.speechInstructionBeijingPrompt":`Read this text in a natural Beijing Chinese accent with a little erhua, like casual conversation.`,"settings.doubaoKeyConfigured":`Key saved. Preview to check permissions and voice availability`,"settings.doubaoCustomVoice":`Custom voice ID`,"settings.doubaoCustomVoiceHint":`Enter another standard voice ID`,"settings.doubaoVoiceSceneGeneral":`Everyday conversation`,"settings.doubaoVoiceSceneRole":`Character voice`,"settings.doubaoVoiceSceneDubbing":`Expressive dubbing`,"settings.doubaoVoiceSceneReading":`Storytelling`,"settings.doubaoVoiceChinese":`Chinese`,"settings.doubaoVoiceId":`Voice ID`,"settings.doubaoClonedVoice":`Cloned voice ID`,"settings.doubaoClonedVoiceLabel":`Cloned voice`,"settings.doubaoStandardVoiceHistory":`Standard voice ID history`,"settings.doubaoClonedVoiceHistory":`Cloned voice ID history`,"settings.voiceRemark":`Label (optional)`,"settings.voiceTagEdit":`Edit label`,"settings.voiceTagRemove":`Remove from history`,"settings.voiceTagConfirm":`Delete voice?`,"settings.voiceRemarkHint":`Saved in this browser for tags only; leave blank to display the voice ID`,"settings.doubaoCloneHint":`Enter a cloned voice ID from the Doubao console`,"settings.doubaoVoiceLibrary":`Open voice library`,"settings.doubaoCreateVoice":`Create a voice`,"settings.doubaoVoiceRequired":`Enter a voice ID for the selected Doubao model`,"settings.doubaoStreamingHint":`Play as the reply is generated`,"settings.previewLoadingDoubao":`Connecting to Doubao…`,"settings.previewPlayingDoubao":`Doubao playing; click to stop`,"settings.previewCompletedDoubao":`Doubao preview completed`,"settings.previewSaveKeyFirst":`Save the API key before previewing`,"settings.previewErrorVoiceUnavailable":`Voice unavailable. Check its ID, model and access permissions`,"settings.previewErrorResourceUnavailable":`This key does not have access to the selected Doubao resource`,"settings.previewErrorBufferLimit":`Audio buffer limit reached. Playback stopped`,"error.voiceUnavailable":`Voice unavailable. Check the model, voice ID and access.`,"error.resourceUnavailable":`This key cannot access the selected model resource.`,"error.apiKeyRejected":`Speech API key rejected. Check settings.`,"error.rateLimited":`Speech service rate limit reached. Try again later.`,"error.timeout":`Speech synthesis timed out. Try again.`,"error.bufferLimit":`Audio buffer limit reached. Playback stopped.`,"history.title":`Audio history`,"history.shortTitle":`History`,"history.backToSettings":`Back to settings`,"history.search":`Search audio summaries`,"history.source":`Source`,"history.all":`All`,"history.untitled":`Untitled audio`,"history.characters":`characters`,"history.expand":`Expand or collapse summary`,"history.noResults":`No matching audio.`,"history.resetFilters":`Reset filters`,"history.savedHere":`Saved`,"history.temporary":`Available for this visit only`,"history.clearConfirm":`Clear all audio history? Includes filtered-out entries and cannot be undone.`,"history.confirmDelete":`Confirm delete`,"history.confirmClear":`Confirm`,"history.cancel":`Cancel`,"history.actionFailed":`The action could not be completed. Please try again.`,"history.player":`History audio player`,"history.selectAudio":`Select an audio entry to listen again.`,"history.play":`Play`,"history.pause":`Pause`,"history.retry":`Retry playback`,"history.seek":`Playback position`,"history.state.idle":`Ready to play`,"history.state.loading":`Loading audio…`,"history.state.playing":`Playing`,"history.state.paused":`Paused`,"history.state.ended":`Playback ended`,"history.error.blocked":`The browser blocked playback. Select Retry playback.`,"history.error.decode":`The browser cannot decode this audio. Retry or download the file.`,"history.error.failed":`Audio playback failed. Retry or download the file.`,"history.hint":`Up to 100 entries / 100 MB`,"history.empty":`No generated audio yet.`,"history.loading":`Loading audio history…`,"history.memory":`Browser storage is unavailable or full. This list lasts only for this visit; download audio to keep it.`,"history.skipped":`An audio file exceeded 100 MB and was not kept in history.`,"history.listen":`Listen again`,"history.download":`Download`,"history.delete":`Delete`,"history.clear":`Clear`,"history.conversation":`Conversation`,"history.preview":`Settings preview`,"history.service":`Service playback`,"action.play":`Read aloud`,"action.pause":`Pause speech`,"action.resume":`Resume speech`,"action.loading":`Generating speech`,"action.cancel":`Cancel speech generation`,"action.stop":`Stop speech`,"action.localFallback":`Local speech`,"action.retry":`Generate speech again`,"error.noText":`This response has no readable body text.`,"error.request":`Speech generation failed.`,"error.play":`The browser blocked autoplay. Click Read aloud to play it.`,"error.localNotAllowed":`The browser blocked local speech. Click Read aloud to try again.`,"error.localVoiceUnavailable":`The selected browser voice is unavailable. Choose another voice.`,"error.localMossUnreachable":`Cannot reach the local MOSS service. Check its URL and status.`,"error.localMossVoiceMissing":`No local MOSS voice is selected.`,"error.localMossInvalidUrl":`The local MOSS voice URL is invalid.`,"error.localMossTimeout":`Local MOSS synthesis timed out.`,"error.localMossFailed":`Local MOSS synthesis failed.`,"error.localTimeout":`Browser speech did not respond within 2 minutes, so this playback was stopped.`,"error.localAudioDevice":`The local audio device reported an error. Check your system sound settings.`,"error.localSynthesis":`Local speech synthesis failed. Please try again.`,"settings.title":`Text To Speech (Xiaomi MiMo)`,"settings.description":`Read conversations with Xiaomi MiMo or Doubao`,"settings.minimalMode":`Minimal mode`,"settings.minimalModeOn":`On`,"settings.minimalModeOff":`Off`,"settings.minimalModeShort":`Minimal`,"settings.defaultModeShort":`Classic`,"settings.enabled":`Voice playback`,"settings.enabledOnLabel":`Whale maid is on air`,"settings.enabledOffLabel":`Whale maid is resting`,"settings.enabledHint":`Turning this off hides speech settings and stops autoplay`,"settings.apiKey":`API Key`,"settings.apiKeyStatus":`The saved key is replaced only after saving a new one`,"settings.apiKeyLoading":`Loading key…`,"settings.apiKeyMissing":`Enter and save an API key for this provider`,"settings.apiKeyRecognized":`Key format recognized. Preview to check the connection`,"settings.apiKeyUnsupported":`The key must start with sk- or tp-`,"settings.apiKeyUnsupportedSaved":`Saved key format unsupported. Replace it`,"settings.apiKeyUnavailable":`Cannot check the key. Check your connection`,"settings.apiKeyPendingSave":`Save to preview with the new key`,"settings.saveRejected":`The host rejected this settings update. Check that the configuration is writable and try again`,"settings.getApiKey":`Get API Key`,"settings.apiKeyIdleCopy1":`Can I look now?`,"settings.apiKeyIdleCopy2":`Is the key safely tucked away?`,"settings.apiKeyIdleCopy3":`Save it, then we're on air!`,"settings.apiKeyIdleCopy4":`I'll keep your key safe`,"settings.apiKeyFocusCopy1":`Okay, eyes covered!`,"settings.apiKeyFocusCopy2":`Don't worry, I can't see a thing`,"settings.apiKeyFocusCopy3":`Privacy mode on!`,"settings.apiKeyFocusCopy4":`Take your time—your secret is safe`,"settings.autoPlay":`Automatic playback`,"settings.autoPlayOnLabel":`I'll read it to you`,"settings.autoPlayOffLabel":`Call me when you need me`,"settings.autoPlayHint":`Your browser may block autoplay`,"settings.voiceReadingNav":`Voice reading`,"settings.voiceReadingTitle":`Voice reading`,"settings.voiceReadingSource":`Source on GitHub`,"settings.voiceReadingQq":`QQ group`,"settings.voiceReadingQqCodeAlt":`QQ group QR code`,"settings.voiceReadingQqClose":`Close QR code`,"settings.voiceReadingPluginSettings":`Plugin settings`,"settings.voiceReadingWarningDisabled":`Speech is off. Enable it in {settings}`,"settings.voiceReadingWarningApiKeyMissing":`API key missing. Add one in {settings}`,"settings.voiceReadingWarningApiKeyInvalid":`Unsupported API key format. Check {settings}`,"settings.voiceReadingWarningApiKeyUnavailable":`Cannot check the API key. Check your connection`,"settings.voiceReadingWarningVoiceRequired":`No voice selected. Choose one or enter it in {settings}`,"settings.voiceReadingDismissWarning":`Dismiss warning`,"settings.voiceReadingVoice":`Reading voice`,"settings.voiceReadingHintXiaomi":`Built-in Xiaomi MiMo voices`,"settings.voiceReadingHintVoiceDesign":`Generate a voice from a description, or choose a preset`,"settings.voiceReadingHintDoubaoStandard":`Doubao standard synthesis voices`,"settings.voiceReadingHintDoubaoCloned":`Choose a previously used cloned voice ID`,"settings.voiceReadingCustomVoice":`Custom (current)`,"settings.voiceReadingVolume":`Reading volume`,"settings.voiceReadingRate":`Reading speed`,"settings.voiceReadingAutoPlay":`Automatic playback`,"settings.voiceReadingSound":`Sound effects`,"settings.voiceReadingSoundHint":`Play click and task sounds`,"settings.voiceReadingReadOnly":`Settings are read-only`,"settings.voiceReadingUnavailable":`Speech settings are unavailable`,"settings.voiceReadingSaveFailed":`Could not save. Please try again`,"settings.detailedVoiceConfig":`Mixing Console`,"settings.voiceVolume":`Voice volume`,"settings.voiceRate":`Playback speed`,"settings.voiceRateHint":`0.5×–2.0×; 1.0× is the original speed.
13
- Doubao applies changes at the next synthesis; Xiaomi and browser speech during playback. Xiaomi streaming also changes pitch`,"settings.voiceRateInfo":`Playback speed information`,"settings.readScope":`Read-aloud range`,"settings.readScopeSmart":`Smart mode`,"settings.readScopeFull":`Full mode`,"settings.readScopeFirstSegment":`First-segment mode`,"settings.readScopeSmartHint":`Auto: full short replies, first two segments of long replies, with an optional closing cue. Manual: full reply`,"settings.readScopeFullHint":`Read the full reply, automatically or manually`,"settings.readScopeFirstSegmentHint":`Read only the first segment, automatically or manually`,"settings.summaryPresetModel":`Preset model`,"settings.summaryVoiceDesignModel":`Custom voicedesign`,"settings.localSpeechAutoSummary":`Cloud first`,"settings.stateOn":`On`,"settings.stateOff":`Off`,"settings.model":`Voice source settings`,"settings.presetModel":`Preset voices (mimo-v2.5-tts)`,"settings.voiceDesignModel":`Custom voice design (mimo-v2.5-tts-voicedesign)`,"settings.presetModelShort":`Preset voice (MiMo-TTS)`,"settings.voiceDesignModelShort":`Voice design (MiMo-VoiceDesign)`,"settings.localSpeechMode":`Speech strategy`,"settings.localSpeechAuto":`Cloud first`,"settings.localSpeechFirst":`Local first`,"settings.localSpeechDisabled":`Disable local speech`,"settings.localSpeechAutoHint":`Cloud first; fall back to browser speech if it fails before playback`,"settings.localSpeechFirstHint":`Browser speech first; fall back to the cloud if it fails`,"settings.localSpeechDisabledHint":`Cloud speech only, with no browser fallback`,"settings.localSpeechUnavailableHint":`No browser voices available; use cloud first`,"settings.localVoice":`Browser voice`,"settings.localVoiceLoading":`Loading browser voices…`,"settings.localVoiceUnavailable":`No browser voices available`,"settings.localVoiceOffline":`Offline`,"settings.localVoiceOnline":`Online`,"settings.localVoiceEngine":`Local voice source`,"settings.localVoiceEngineBrowser":`Browser`,"settings.localVoiceEngineMoss":`MOSS local`,"settings.mossProvider":`MOSS Nano (Local)`,"settings.experimental":`Experimental`,"settings.more":`More`,"settings.moreHint":`Volume, speed, local voice, reading range and strategy`,"settings.announcementsMoreHint":`Host integration, announcement sources and plugin integrations`,"settings.mossBaseURL":`MOSS service URL`,"settings.mossProbe":`Probe`,"settings.mossCopyDeployHint":`Copy the deployment prompt`,"settings.mossDeployHintBefore":`Not deployed yet? `,"settings.mossDeployHintAction":`Copy the prompt`,"settings.mossDeployHintAfter":` and let DSH set it up.`,"settings.mossDeployCopied":`Copied — paste it to DSH.`,"settings.mossDeployCopyFailed":`Copy failed. Try again.`,"settings.mossProbingShort":`Probing…`,"settings.mossProbing":`Probing the MOSS service…`,"settings.mossOnlineReady":`Online · ready`,"settings.mossWarming":`Online · warming up`,"settings.mossNotProbed":`Not probed yet`,"settings.mossInvalidUrl":`Invalid MOSS service URL`,"settings.mossTimeout":`The MOSS service timed out`,"settings.mossUnreachable":`Cannot reach the MOSS service`,"settings.mossProbeFailed":`MOSS probe failed`,"settings.mossVoice":`MOSS voice`,"settings.mossVoiceProbeFirst":`Probe the MOSS service to load voices`,"settings.mossBuiltInVoice":`built-in voice`,"settings.mossLocalFirstHint":`Choose Local first to make MOSS the preferred voice; Cloud first falls back to it only when cloud playback fails before starting.`,"settings.mossLocalDisabledHint":`Local speech is off, so the MOSS voice is not used.`,"settings.modelAutoPlayHintPreset":`Preset voices support streaming`,"settings.modelAutoPlayHintVoiceDesign":`Play automatically after the reply is complete`,"settings.voice":`Built-in voice`,"settings.format":`Audio format`,"settings.formatPcm":`PCM (streaming)`,"settings.formatMp3":`MP3 (complete audio)`,"settings.formatWav":`WAV (complete audio)`,"settings.formatPcmHint":`Stream audio as it arrives; fall back to MP3 if it fails before the first chunk`,"settings.formatMp3Hint":`Play after generation; smaller files`,"settings.formatWavHint":`Play after generation; lossless, larger files`,"settings.voiceDesignPrompt":`Voice design`,"settings.customVoiceOption":`Custom`,"settings.customVoiceSummary":`Write a custom voice description`,"settings.voiceDesignPromptHint":`Describe age, gender, tone, pace and emotion; omit scenes and actions`,"settings.voiceDesignPlaybackMode":`Read-aloud mode`,"settings.voiceDesignPlaybackComplete":`Complete`,"settings.voiceDesignPlaybackSegmented":`Segmented`,"settings.voiceDesignPlaybackFirstSegment":`First segment`,"settings.voiceDesignPlaybackCompleteHint":`Generate the full reply for consistent delivery; long text may cause artifacts`,"settings.voiceDesignPlaybackSegmentedHint":`Generate in segments for faster starts on long text; delivery may vary`,"settings.voiceDesignPlaybackFirstSegmentHint":`Read only the first segment for a faster start and lower usage`,"settings.previewTitle":`Broadcast Desk`,"settings.previewText":`Preview text`,"settings.previewPresets":`Sample texts`,"settings.previewPresetGreeting":`Greeting`,"settings.previewPresetPoetry":`Poetry`,"settings.previewPresetInspiration":`Encouragement`,"settings.previewPresetReflection":`Reflection`,"settings.previewPresetHumor":`Humor`,"settings.previewPresetNews":`News`,"settings.previewPresetStory":`Story`,"settings.previewPresetService":`Welcome`,"settings.previewPresetDialogue":`Dialogue`,"settings.previewDefaultTextStory":`As the bookshop closed, a ginger cat slipped in and curled up on an unopened travel journal.`,"settings.previewDefaultTextService":`Hello and welcome! Tell me what you need help with, and we will work through it together.`,"settings.previewDefaultTextDialogue":`You remembered? I thought I was the only one. All this time, we were heading the same way.`,"settings.previewDefaultTextNews":`Evening news: the city library now stays open late, offering a quiet place to read after work.`,"settings.previewDownload":`Download current preview audio`,"settings.previewDownloadUnavailable":`Generate preview audio first to download it`,"settings.previewDownloadLocal":`Browser speech cannot be downloaded. Preview a cloud voice or MOSS instead.`,"settings.previewDownloadFailed":`Download failed. Please try again.`,"settings.previewDefaultText":`Hi! I'm Whale Maid. It's lovely to explore the world of voices with you!`,"settings.previewDefaultTextPoetry":`The wind folds clouds into a letter; the moon signs it. May starlight find you on every road home.`,"settings.previewDefaultTextInspiration":`Go at your own pace. A seed still blooms after a late spring. One stumble need not end your journey.`,"settings.previewDefaultTextReflection":`We cannot keep every breeze, but we can choose our sail. Perhaps the answer is in how we live today.`,"settings.previewDefaultTextHumor":`My alarm rang. I voted for five more minutes in bed. An hour later, the motion was still in effect.`,"settings.previewPlaceholder":`Enter preview text`,"settings.moreProviders":`More providers`,"settings.breezeEnabled":`Enable Breeze Blue`,"settings.providerMinimum":`Xiaomi is always enabled; keep Doubao or Breeze enabled.`,"settings.breezeAudioTags":`Audio tags`,"settings.xiaomiAudioTagsHint":`Xiaomi preset voices: start with a style or add sound cues inline. Supports (), (), [], custom descriptions and combinations. Singing inserts at the start. Use instructions for Voice Design.`,"settings.breezeAudioTagsHint":`Tags are inserted into the preview text. Use square brackets for Chinese and parentheses for English. Breeze TTS only.`,"settings.breezeAudioTagsChinese":`中文`,"settings.breezeAudioTagsEnglish":`English`,"settings.audioTagsContinuous":`Add multiple`,"settings.audioTagsContinuousHint":`Pin tag panel`,"settings.previewPlay":`Play preview`,"settings.previewListen":`Preview`,"settings.previewStopShort":`Stop`,"settings.previewStop":`Stop preview`,"settings.previewHint":`Save a key for cloud previews`,"settings.previewLoading":`Getting ready…`,"settings.previewPlaying":`Playing; click to stop`,"settings.previewLoadingMimo":`Connecting to MiMo…`,"settings.previewLoadingLocal":`Preparing browser speech…`,"settings.previewPlayingMimo":`MiMo playing; click to stop`,"settings.previewPlayingLocal":`Browser speech playing; click to stop`,"settings.previewCompletedMimo":`MiMo preview complete`,"settings.previewCompletedLocal":`Local-speech preview complete`,"settings.previewLoadingBreeze":`Connecting to Breeze…`,"settings.previewPlayingBreeze":`Breeze playing; click to stop`,"settings.previewCompletedBreeze":`Breeze preview complete`,"settings.previewErrorApiKeyMissing":`Save an API key or enable browser speech`,"settings.previewErrorApiKeyRejected":`Key rejected. Check or replace it`,"settings.previewErrorRateLimited":`Too many requests. Try again shortly`,"settings.previewErrorTimeout":`Request timed out. Check your connection and retry`,"settings.previewErrorLocalUnavailable":`No browser voices available`,"settings.previewErrorAutoplay":`Playback blocked. Click preview again`,"settings.previewFailed":`Preview failed. Check settings and connection`,"settings.save":`Save`,"settings.saving":`Saving…`,"settings.saved":`Saved`,"settings.unsaved":`Unsaved`,"settings.overridden":`Overridden`,"settings.reset":`Restore default`,"settings.discard":`Discard changes`,"settings.failed":`Save failed. Try again`,"settings.source":`View source`,"settings.readOnly":`DSH settings are read-only`,"settings.secretPlaceholder":`Enter a new key for this provider`,"settings.expand":`Expand settings`,"settings.collapse":`Collapse settings`,"settings.soundEffectsTitle":`Sound Effects`,"settings.soundEffectsEnabled":`Enable sounds`,"settings.soundEffectsVolume":`Volume`,"settings.soundEffectsPack":`Sound pack`,"settings.soundEffectsTask":`Task sounds`,"settings.soundEffectsClick":`Click sounds`,"settings.soundEffectsOn":`All sounds`,"settings.soundEffectsOff":`Off`,"settings.soundEffectsOnLabel":`Magic sounds on`,"settings.soundEffectsOffLabel":`Magic sounds off`,"settings.soundEffectsBubbleOff":`UISFX disabled`,"settings.soundEffectsClickOnly":`Click sounds only`,"settings.soundEffectsTaskOnly":`Task sounds only`,"settings.soundEffectsTurnOn":`Turn sounds on`,"settings.soundEffectsTurnOff":`Turn sounds off`,"settings.soundEffectsSynced":`Task / click synced`,"settings.soundEffectsPreviewLabel":`Sound previews`,"settings.soundEffectsPreview.start":`Preview start`,"settings.soundEffectsPreview.complete":`Preview complete`,"settings.soundEffectsPreview.success":`Preview success`,"settings.soundEffectsPreview.error":`Preview error`,"settings.soundEffectsPreview.notification":`Preview notification`,"settings.soundEffectsPreview.press":`Preview click`,"settings.soundEffectsPreview.select":`Preview select`,"settings.soundEffectsPreview.toggle-on":`Preview toggle on`,"settings.soundEffectsPreview.toggle-off":`Preview toggle off`,"settings.soundEffectsPreview.send":`Preview send`,"settings.soundEffectsPreview.open":`Preview open`,"settings.soundEffectsPreview.close":`Preview close`,"settings.soundEffectsPreview.delete":`Preview delete`,"settings.soundEffectsPreview.stop":`Preview stop`,"settings.soundEffectsPreview.queued":`Preview queued`,"settings.soundEffectsDescription":`Sounds for clicks and task events`,"settings.soundEffectsSupported":`Supported sounds: Start, Complete, Success, Error, Notification, Press, Select, Toggle On, Toggle Off, Send, Open, Close, Delete, Stop, Queued`};function pcmDeltaFromSse(e){if(e===`[DONE]`)return null;let t=JSON.parse(e),n=typeof t.error==`string`?t.error:t.error?.message;if(n!==void 0)throw Error(n);let r=t.choices?.[0]?.delta?.audio?.data;return typeof r==`string`&&r.length>0?r:null}async function streamPcmAudio(e,t,n,r){if(t.aborted)return;let i=await fetch(hostRoute(g),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(speechRequestBody({text:e,...r??{}})),signal:t});if(t.aborted)return;if(!i.ok)throw Error(`stream-request-${i.status}`);if(i.body===null)throw Error(`stream-response-empty`);let a=i.body.getReader(),o=new TextDecoder,s=``,c=!1,consumeEvents=async e=>{for(let r of e){if(t.aborted)return;let e=pcmDeltaFromSse(r);e!==null&&(await n(e),c=!0)}};try{for(;!t.aborted;){let e=await a.read();if(e.done||t.aborted)break;s+=o.decode(e.value,{stream:!0});let n=parseSseRecords(s);s=n.remainder,await consumeEvents(n.events)}s+=o.decode(),!t.aborted&&s.trim().length>0&&await consumeEvents(parseSseRecords(`${s}\n\n`).events)}finally{a.releaseLock()}if(!t.aborted&&!c)throw Error(`stream-audio-empty`)}function applyMediaVoiceRate(e,t){e.playbackRate=t,e.preservesPitch=!0}function applyPcmVoiceRate(e,t){e.playbackRate.value=t}function applySpeechVoiceRate(e,t){e.rate=t}function pcmPlaybackDuration(e,t){return e/t}var PcmAudioQueue=class{context=null;gain=null;volume=1;playbackRate=1;scheduledAt=0;sources=new Set;sourceBytes=new Map;revision=0;chain=Promise.resolve();busy=!1;userPaused=!1;queuedBytes=0;maxPausedPcmBytes=32*1024*1024;constructor(e){this.callbacks=e}setMaxPausedPcmBytes(e){this.maxPausedPcmBytes=Number.isFinite(e)&&e>0?e:32*1024*1024}setVolume(e){this.volume=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1;let t=this.context,n=this.gain;if(t===null||n===null)return;let r=t.currentTime;n.gain.cancelScheduledValues(r),n.gain.setValueAtTime(n.gain.value,r),n.gain.linearRampToValueAtTime(this.volume,r+.02)}setPlaybackRate(e){this.playbackRate=normalizeVoiceRate(e)}async pause(){let e=this.revision,t=this.context;this.userPaused=!0,t!==null&&t.state===`running`&&await t.suspend(),e!==this.revision&&t===this.context&&t!==null&&!this.userPaused&&this.sources.size>0&&t.state!==`running`&&await t.resume()}async resume(){let e=this.revision,t=this.context;t!==null&&t.state!==`running`&&await t.resume(),e===this.revision?this.userPaused=!1:t===this.context&&t!==null&&this.userPaused&&t.state===`running`&&await t.suspend()}enqueue(e){return this.enqueueBytes(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}enqueueBytes(e){let t=this.revision,n=this.chain.then(()=>this.schedule(e,t));return this.chain=n.catch(()=>{}),n}stop(){this.revision+=1,this.scheduledAt=0,this.chain=Promise.resolve(),this.userPaused=!1,this.queuedBytes=0;for(let e of this.sources)try{e.stop()}catch{}this.sources.clear(),this.sourceBytes.clear(),this.setBusy(!1)}async dispose(){this.stop();let e=this.context;this.context=null,this.gain?.disconnect(),this.gain=null,e!==null&&e.state!==`closed`&&await e.close()}async schedule(e,t){if(t!==this.revision)return;if(e.byteLength%2)throw Error(`invalid-pcm-sample`);if(e.byteLength<2)return;let n=this.getContext();if(n.state!==`running`&&!this.userPaused&&await n.resume(),t!==this.revision)return;let r=Math.floor(e.byteLength/2),i=n.createBuffer(1,r,24e3),a=i.getChannelData(0),o=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e<r;e+=1)a[e]=o.getInt16(e*2,!0)/32768;let s=n.createBufferSource();s.buffer=i,applyPcmVoiceRate(s,this.playbackRate),s.connect(this.getGain(n));let c=Math.max(n.currentTime+.03,this.scheduledAt);if(this.scheduledAt=c+pcmPlaybackDuration(i.duration,this.playbackRate),this.userPaused&&this.queuedBytes+e.byteLength>this.maxPausedPcmBytes)throw Error(`pcm-pause-buffer-limit`);this.sources.add(s),this.sourceBytes.set(s,e.byteLength),this.queuedBytes+=e.byteLength,s.addEventListener(`ended`,()=>{t===this.revision&&(this.sources.delete(s),this.queuedBytes-=this.sourceBytes.get(s)??0,this.sourceBytes.delete(s),this.sources.size===0&&this.setBusy(!1))},{once:!0});try{s.start(c)}catch(e){throw this.sources.delete(s),this.queuedBytes-=this.sourceBytes.get(s)??0,this.sourceBytes.delete(s),e}this.setBusy(!0),!this.userPaused&&n.state===`running`&&this.callbacks.onPlaybackStart()}setBusy(e){this.busy!==e&&(this.busy=e,this.callbacks.onBusyChange(e))}getContext(){return this.context===null&&(this.context=new AudioContext),this.context}getGain(e){return this.gain===null&&(this.gain=e.createGain(),this.gain.gain.value=this.volume,this.gain.connect(e.destination)),this.gain}},PcmRecording=class{chunks=[];bytes=0;overflow=!1;maxBytes;constructor(e=100*1024*1024-44){this.maxBytes=e}append(e){let t=atob(e);this.appendBytes(Uint8Array.from(t,e=>e.charCodeAt(0)))}appendBytes(e){if(!this.overflow){if(this.bytes+=e.length,this.bytes>this.maxBytes){this.overflow=!0,this.chunks=[];return}this.chunks.push(Uint8Array.from(e))}}toWav(){if(this.overflow||this.bytes===0||this.bytes%2!=0)return null;let e=new ArrayBuffer(44),t=new DataView(e),label=(e,n)=>{for(let r=0;r<n.length;r+=1)t.setUint8(e+r,n.charCodeAt(r))};return label(0,`RIFF`),t.setUint32(4,36+this.bytes,!0),label(8,`WAVE`),label(12,`fmt `),t.setUint32(16,16,!0),t.setUint16(20,1,!0),t.setUint16(22,1,!0),t.setUint32(24,24e3,!0),t.setUint32(28,48e3,!0),t.setUint16(32,2,!0),t.setUint16(34,16,!0),label(36,`data`),t.setUint32(40,this.bytes,!0),new Blob([e,...this.chunks],{type:`audio/wav`})}save(e,t){this.overflow&&e?.reportSkipped();let n=this.toWav();this.chunks=[],this.bytes=0,n!==null&&e?.add({...t,blob:n,format:`wav`})}},DuplexPcmError=class extends Error{constructor(e,t=e){super(t),this.code=e}},DuplexPcmStream=class{done;resolve;reject;socket;ready=!1;ended=!1;terminal=!1;finishing=!1;pending=[];pendingBytes=0;textLength=0;chain=Promise.resolve();tail=null;received=!1;timer;constructor(e,t,n,r=32*1024*1024,i=12e4,a=12e3){this.signal=t,this.consume=n,this.limit=r,this.timeoutMs=i,this.maxTextLength=a,this.done=new Promise((e,t)=>{this.resolve=e,this.reject=t}),this.done.catch(()=>{}),this.socket=new WebSocket(hostWebSocketUrl(`/plugins/xiaomi-mimo-tts/synthesize-duplex`)),this.socket.binaryType=`arraybuffer`,this.socket.onopen=()=>{this.ended||this.socket.send(JSON.stringify({type:`start`,selection:e}))},this.socket.onmessage=e=>{if(!(this.ended||this.terminal))if(this.arm(),e.data instanceof ArrayBuffer){if(!this.ready){this.fail(new DuplexPcmError(`invalid-session-state`));return}let t=new Uint8Array(e.data);if(this.pendingBytes+=t.length,this.pendingBytes>this.limit){this.fail(new DuplexPcmError(`stream-buffer-limit`));return}this.chain=this.chain.then(async()=>{if(this.ended||this.signal.aborted)return;let e=t;this.tail!==null&&(e=new Uint8Array(t.length+1),e[0]=this.tail,e.set(t,1),this.tail=null),e.length%2&&(this.tail=e[e.length-1],e=e.subarray(0,e.length-1)),e.length&&(await this.consume(e),this.received=!0)}).catch(e=>this.fail(e)).finally(()=>{this.pendingBytes-=t.length})}else try{let t=JSON.parse(String(e.data));if(t.type===`ready`&&!this.ready&&t.sampleRate===24e3&&t.channels===1&&t.sampleFormat===`s16le`){this.ready=!0;for(let e of this.pending.splice(0))this.sendText(e);this.finishing&&this.socket.send(JSON.stringify({type:`finish`}))}else t.type===`error`?this.fail(new DuplexPcmError(t.error??`request-failed`,t.message)):t.type===`done`&&this.ready&&this.finishing?(this.terminal=!0,this.chain.then(()=>{if(!this.ended){if(this.tail!==null){this.fail(new DuplexPcmError(`invalid-pcm-sample`));return}if(!this.received){this.fail(new DuplexPcmError(`stream-audio-empty`));return}this.ended=!0,this.cleanup(),this.resolve()}})):this.fail(new DuplexPcmError(`invalid-session-state`))}catch{this.fail(new DuplexPcmError(`invalid-stream-response`))}},this.socket.onclose=()=>{!this.terminal&&!this.ended&&this.fail(new DuplexPcmError(`stream-connection-closed`))},this.socket.onerror=()=>this.fail(new DuplexPcmError(`request-failed`)),t.addEventListener(`abort`,this.onAbort,{once:!0}),this.arm(Math.min(1e4,i)),t.aborted&&this.onAbort()}append(e){if(this.ended||this.finishing)throw new DuplexPcmError(`invalid-session-state`);if(e.trim()){if(this.textLength+=e.length,this.textLength>this.maxTextLength){let e=new DuplexPcmError(`text-too-long`);throw this.fail(e),e}this.ready?this.sendText(e):this.pending.push(e),this.arm(this.ready?this.timeoutMs:Math.min(1e4,this.timeoutMs))}}finish(){return!this.ended&&!this.finishing&&(this.finishing=!0,this.ready&&this.socket.send(JSON.stringify({type:`finish`}))),this.done}sendText(e){this.socket.send(JSON.stringify({type:`text`,text:e}))}onAbort=()=>{this.fail(new DOMException(`Synthesis canceled`,`AbortError`))};arm(e=this.timeoutMs){clearTimeout(this.timer),this.timer=setTimeout(()=>this.fail(new DuplexPcmError(`tts-timeout`)),e)}cleanup(){clearTimeout(this.timer),this.signal.removeEventListener(`abort`,this.onAbort),this.socket.onopen=null,this.socket.onmessage=null,this.socket.onclose=null,this.socket.onerror=null,this.socket.close()}fail(e){this.ended||(this.ended=!0,this.socket.readyState===WebSocket.OPEN&&this.socket.send(JSON.stringify({type:`cancel`})),this.cleanup(),this.reject(e))}},LiveSpeechController=class{isBusy=()=>this.requestBusy||this.audioBusy||[`loading`,`playing`,`paused`].includes(this.status);constructor(e){this.history=e}audio=new PcmAudioQueue({onBusyChange:e=>{this.audioBusy=e,this.maybeFinishPlayback()},onPlaybackStart:()=>this.setStatus(`playing`)});streamGeneration=0;queue=this.createQueue();active=null;observed=``;consumed=0;pendingText=``;handled=new Set;messageId=null;status=`idle`;sessionId=null;requestBusy=!1;audioBusy=!1;blockedTurn=null;manuallyStoppedTurns=new Set;checkpointed=!1;completed=null;audioStarted=!1;fallbackHandler=null;onStateChange=null;playbackError=null;beforePlayback=null;voiceRate=1;selection={provider:`xiaomi`,model:`mimo-v2.5-tts`,voice:`冰糖`,voiceDesignPrompt:``};duplexAbort=new AbortController;duplexJobs=[];duplexStep=null;duplexRunning=!1;timeoutMs=12e4;maxPcmBytes=32*1024*1024;maxTextLength=12e3;configure(e){let t=ttsSelection(e);JSON.stringify({...t,voiceRate:void 0})!==JSON.stringify({...this.selection,voiceRate:void 0})&&this.interrupt(),this.selection=t,this.voiceRate=e.voiceRate,this.timeoutMs=e.requestTimeoutMs,this.maxPcmBytes=e.maxPausedPcmBytes,this.maxTextLength=engineMaxTextLength(e.maxTextLength),this.audio.setMaxPausedPcmBytes(e.maxPausedPcmBytes)}prepareText(e){return externalEngine()?externalText(e):prepareSpeechText(e,supportsXiaomiAudioTags(this.selection)?`xiaomi`:this.selection.provider===`breeze`)}isDuplex(){return!externalEngine()&&this.selection.provider===`doubao`}finishInput(e,t,n){!this.isDuplex()||this.sessionId!==e||this.active?.turn!==t||this.active.step!==n||(this.drain(!0),this.finishDuplexStep())}setStateChangeListener(e){this.onStateChange=e}setFallbackHandler(e){this.fallbackHandler=e}setBeforePlayback(e){this.beforePlayback=e}setMaxPausedPcmBytes(e){this.audio.setMaxPausedPcmBytes(e)}setVolume(e){this.audio.setVolume(e)}setVoiceRate(e){this.voiceRate=normalizeVoiceRate(e),this.selection.provider!==`xiaomi`&&(this.selection={...this.selection,voiceRate:this.voiceRate})}async pause(e){if(this.sessionId!==e||this.status!==`playing`)return!1;let t=this.streamGeneration;this.setStatus(`paused`);try{return await this.audio.pause(),this.sessionId===e&&t===this.streamGeneration}catch{return this.sessionId===e&&t===this.streamGeneration&&this.setStatus(`playing`),!1}}async resume(e){if(this.sessionId!==e||this.status!==`paused`)return!1;let t=this.streamGeneration;try{return await this.audio.resume(),this.sessionId!==e||t!==this.streamGeneration?!1:(this.setStatus(`playing`),!0)}catch{return this.sessionId!==e||t!==this.streamGeneration?!1:(this.setStatus(`error`),this.replaceQueue(),this.audio.stop(),!1)}}activateSession(e){this.sessionId!==e&&(this.cancel(),this.sessionId=e)}deactivateSession(e){this.sessionId===e&&(this.cancel(),this.sessionId=null)}observe(e,t,n,r){if(this.sessionId!==e)return;let i={sessionId:e,turn:t,step:n},a=`${e}:${t}`;if(this.blockedTurn===a||this.manuallyStoppedTurns.has(a))return;if(this.blockedTurn!==null&&this.blockedTurn!==a&&(this.blockedTurn=null),this.checkpointed&&this.active!==null&&this.cursorKey(this.active)===this.cursorKey(i)&&!r.startsWith(this.observed)){this.prime(e,t,n,r);return}this.beforePlayback?.();let o=classifyLiveSpeechTransition(this.active,i);o===`new-turn`||o===`same-step`&&!r.startsWith(this.observed)?this.reset(i):o===`same-turn`&&this.advanceSegment(i),this.observed=r,this.drain(!1)}prime(e,t,n,r){this.sessionId!==e||this.manuallyStoppedTurns.has(`${e}:${t}`)||(this.reset({sessionId:e,turn:t,step:n}),this.observed=r,this.consumed=r.length,this.checkpointed=!0)}playCompleted(e,t,n,r){if(!(this.sessionId!==e||n.length===0)){if(this.beforePlayback?.(),this.resetState(),this.audio.setPlaybackRate(externalEngine()||this.selection.provider===`xiaomi`?this.voiceRate:1),this.completed={sessionId:e,messageId:t,audioStarted:!1,fallback:r},this.audioStarted=!1,this.messageId=t,this.setStatus(`loading`),this.isDuplex()){this.enqueueDuplex(n),this.finishDuplexStep();return}for(let e of externalEngine()?splitExternalText(n,this.maxTextLength):this.selection.provider===`breeze`?splitBreezeTtsSegments(n):splitTtsSegments(n,void 0,void 0,e=>prepareProviderTtsText(e,this.selection)))this.queue.enqueue(e)}}finish(e,t){if(this.sessionId!==e)return;let n=`${e}:${t.turn}:${t.step}`;if(this.blockedTurn===`${e}:${t.turn}`||this.manuallyStoppedTurns.has(`${e}:${t.turn}`)){this.messageId=t.messageId,this.reportStatus(),this.handled.add(n);return}if(!(this.sessionId!==e||this.active===null||this.cursorKey(this.active)!==n)){if(t.interrupted){this.cancelSession(e);return}t.text.startsWith(this.observed)&&(this.observed=t.text),this.messageId=t.messageId,this.duplexStep!==null&&(this.duplexStep.messageId=t.messageId),this.reportStatus(),this.drain(!0),this.finishDuplexStep(),this.handled.add(n)}}stop(e){return this.sessionId!==e||this.status!==`loading`&&this.status!==`playing`&&this.status!==`paused`?!1:(this.active!==null&&this.manuallyStoppedTurns.add(`${e}:${this.active.turn}`),this.resetState(),!0)}blockTurn(e,t){this.sessionId===e&&(this.manuallyStoppedTurns.add(`${e}:${t}`),this.active?.turn===t&&this.resetState())}hasHandled(e,t){return t===null?!1:this.blockedTurn===`${e}:${t.turn}`||this.manuallyStoppedTurns.has(`${e}:${t.turn}`)||this.handled.has(`${e}:${t.turn}:${t.step}`)}cancelSession(e){this.sessionId===e&&this.cancel()}cancel(){this.blockedTurn=null,this.resetState()}interrupt(){this.active!==null&&(this.blockedTurn=`${this.active.sessionId}:${this.active.turn}`),this.resetState()}async dispose(){this.cancel(),this.handled.clear(),this.manuallyStoppedTurns.clear(),await this.audio.dispose()}reset(e){this.replaceQueue(),this.audio.stop(),this.audio.setPlaybackRate(externalEngine()||this.selection.provider===`xiaomi`?this.voiceRate:1),this.beginSegment(e,!1),this.setStatus(`idle`)}advanceSegment(e){this.drain(!0),this.finishDuplexStep(),this.duplexStep=null,this.beginSegment(e,!0)}beginSegment(e,t){this.checkpointed=!1,this.completed=null,t||(this.audioStarted=!1),this.active=e,this.observed=``,this.consumed=0,this.pendingText=``,t||(this.messageId=null)}resetState(){this.checkpointed=!1,this.replaceQueue(),this.audio.stop(),this.active=null,this.observed=``,this.consumed=0,this.pendingText=``,this.setStatus(`idle`),this.messageId=null,this.completed=null,this.audioStarted=!1}cursorKey(e){return`${e.sessionId}:${e.turn}:${e.step}`}drain(e){let{sentences:t,remainder:n,consumed:r,inCode:i}=splitCompletedTtsSentences(this.observed.slice(this.consumed)),a=e&&!i&&n.trim().length>0?[...t,n]:t;if(this.consumed+=r,this.stageSentences(a,!1),!e&&!i&&n.trim().length>0){let e=this.prepareText(n),t=160-countTtsSpeechCharacters(this.pendingText);if(countTtsSpeechCharacters(e)>=t){let e=takeStreamChunk(n,t,!externalEngine()&&(this.selection.provider===`breeze`||supportsXiaomiAudioTags(this.selection)));e.length>0&&(this.stageSentences([e],!1),this.consumed+=e.length)}}e&&(this.consumed=this.observed.length),e&&this.stageSentences([],!0)}stageSentences(e,t){let n=e.map(e=>this.prepareText(e)).filter(e=>countTtsSpeechCharacters(e)>0);if(this.isDuplex()){n.length>0&&this.active!==null&&this.handled.add(this.cursorKey(this.active));for(let e of n)this.enqueueDuplex(e);return}let r=batchTtsStreamSegments(this.pendingText,n,t);this.pendingText=r.pending,r.requests.length>0&&this.active!==null&&this.handled.add(this.cursorKey(this.active));for(let e of r.requests){let t=externalEngine()?splitExternalText(e,this.maxTextLength):this.selection.provider===`breeze`?splitBreezeTtsSegments(e):[e];for(let e of t)this.queue.enqueue(e)}}createQueue(){let e=this.streamGeneration;return new AbortableSentenceQueue((t,n)=>this.stream(t,n,e),{onBusyChange:t=>{e===this.streamGeneration&&(this.requestBusy=t,t&&this.status===`idle`&&this.setStatus(`loading`),this.maybeFinishPlayback())},onError:t=>{e===this.streamGeneration&&this.handleStreamError(t)}})}replaceQueue(){this.streamGeneration+=1,this.requestBusy=!1,this.queue.cancel(),this.queue=this.createQueue(),this.duplexAbort.abort(),this.duplexAbort=new AbortController,this.duplexJobs=[],this.duplexStep=null,this.duplexRunning=!1}isCurrentStream(e,t){return e===this.streamGeneration&&!t.aborted}async stream(e,t,n){if(!this.isCurrentStream(n,t))return;let r=new PcmRecording,i=this.sessionId,a=this.messageId;try{await streamPcmAudio(e,t,async e=>{this.isCurrentStream(n,t)&&(r.append(e),await this.audio.enqueue(e))},this.selection),this.isCurrentStream(n,t)&&r.save(this.history,{text:e,source:`conversation`,...i===null?{}:{sessionId:i},...a===null?{}:{messageId:a}})}catch(e){if(this.isCurrentStream(n,t))throw e}}handleStreamError(e){let t=typeof DOMException<`u`&&e instanceof DOMException&&e.name===`NotAllowedError`,n=this.completed;if(!t&&n!==null&&!n.audioStarted){let e=n.fallback;this.resetState(),e();return}if(!t&&this.active!==null&&!this.audioStarted&&this.fallbackHandler!==null){let e=this.fallbackHandler,t=this.active,n=this.observed;this.resetState(),e(t,n);return}this.active!==null&&(this.blockedTurn=`${this.active.sessionId}:${this.active.turn}`),this.playbackError=e instanceof Error&&`code`in e&&typeof e.code==`string`?e.code:e instanceof Error?e.message:`request-failed`,this.setStatus(`error`),this.replaceQueue(),this.audio.stop()}enqueueDuplex(e){if(this.duplexStep?.finished)return;this.duplexStep===null&&(this.duplexStep={text:[],finished:!1,stream:null,sessionId:this.sessionId,messageId:this.messageId},this.duplexJobs.push(this.duplexStep));let t=this.duplexStep;t.text.push(e);try{t.stream?.append(e)}catch(e){this.handleStreamError(e);return}this.duplexRunning||this.runDuplexJobs()}finishDuplexStep(){let e=this.duplexStep;e===null||e.finished||(e.finished=!0,e.stream?.finish().catch(()=>{}))}async runDuplexJobs(){this.duplexRunning=!0;let e=this.streamGeneration,t=this.duplexAbort.signal;this.requestBusy=!0,this.status===`idle`&&this.setStatus(`loading`);try{for(;this.duplexJobs.length&&this.isCurrentStream(e,t);){let n=this.duplexJobs[0],r=new PcmRecording;n.stream=new DuplexPcmStream(this.selection,t,async n=>{this.isCurrentStream(e,t)&&(r.appendBytes(n),await this.audio.enqueueBytes(n))},this.maxPcmBytes,this.timeoutMs,this.maxTextLength);for(let e of n.text)n.stream.append(e);if(n.finished&&n.stream.finish().catch(()=>{}),await n.stream.done,!this.isCurrentStream(e,t))return;r.save(this.history,{text:n.text.join(``),source:`conversation`,voiceRateApplied:!0,...n.sessionId===null?{}:{sessionId:n.sessionId},...n.messageId===null?{}:{messageId:n.messageId}}),this.duplexJobs.shift()}}catch(n){this.isCurrentStream(e,t)&&this.handleStreamError(n)}finally{e===this.streamGeneration&&(this.duplexRunning=!1,this.requestBusy=!1,this.maybeFinishPlayback())}}maybeFinishPlayback(){!this.requestBusy&&!this.audioBusy&&(this.status===`loading`||this.status===`playing`)&&this.setStatus(`idle`)}setStatus(e){e!==`error`&&(this.playbackError=null),this.status!==e&&(this.status=e,e===`playing`&&(this.audioStarted=!0,this.completed!==null&&(this.completed.audioStarted=!0)),this.reportStatus())}reportStatus(){this.sessionId!==null&&this.messageId!==null&&this.onStateChange?.(this.sessionId,this.messageId,this.status,this.playbackError)}};function takeStreamChunk(e,t,n=!1){let r=null,i=0,a=0,o=``;for(let s of e){a+=s.length,/^[\p{L}\p{N}]$/u.test(s)&&(i+=1);let c=e.codePointAt(a),l=c===void 0?``:String.fromCodePoint(c);if(n&&(r===null&&(s===`[`||s===`(`||s===`(`)?r=s===`[`?`]`:s===`(`?`)`:`)`:s===r&&(r=null)),r===null&&i>=t&&!/\p{M}/u.test(l)){let t=isStreamWordCharacter(s)&&(l.length===0||isStreamWordCharacter(l)),n=/\p{N}/u.test(s)&&/[.,]/u.test(l),r=/[.,]/u.test(s)&&/\p{N}/u.test(o)&&(l.length===0||/\p{N}/u.test(l));if(!t&&!n&&!r)return e.slice(0,a)}o=s}return``}function isStreamWordCharacter(e){return/[\p{L}\p{N}\p{M}_'’\-]/u.test(e)&&!/\p{Script=Han}/u.test(e)}var MossRequestError=class extends Error{constructor(e,t=e){super(t),this.code=e}};async function probeMossService(e,t){let n;try{n=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/moss/probe`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({baseURL:e}),...t===void 0?{}:{signal:t}})}catch(e){throw t?.aborted?e:new MossRequestError(`moss-unreachable`,`Cannot reach the local MOSS service.`)}let r=await n.json().catch(()=>void 0);return n.ok?r:{ok:!1,error:typeof r?.error==`string`?r.error:`moss-request-failed`,message:typeof r?.message==`string`?r.message:``}}async function fetchMossAudio(e,t,n){let r;try{r=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/moss/synthesize`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:e,baseURL:t.baseURL,voice:t.voice,format:`wav`}),signal:n})}catch(e){throw n.aborted?e:new MossRequestError(`moss-unreachable`,`Cannot reach the local MOSS service.`)}if(!r.ok){let e=await r.json().catch(()=>void 0);throw new MossRequestError(typeof e?.error==`string`?e.error:`moss-request-failed`,typeof e?.message==`string`?e.message:`MOSS synthesis failed.`)}return r.blob()}function playMossAudio(e,t){let n=URL.createObjectURL(e),r=new Audio(n);r.volume=Number.isFinite(t.volume)?Math.max(0,Math.min(1,t.volume)):1,applyMediaVoiceRate(r,t.rate);let i=!1,a=!1,o,resolveDone=()=>{},rejectDone=()=>{},s=new Promise((e,t)=>{resolveDone=e,rejectDone=t}),cleanup=()=>{r.onended=null,r.onerror=null,r.onplaying=null,o!==void 0&&window.clearTimeout(o),URL.revokeObjectURL(n)},finish=e=>{i||(i=!0,cleanup(),e===void 0?resolveDone():rejectDone(e))},markStarted=()=>{a||(a=!0,t.onStart?.())};return r.onplaying=markStarted,r.onended=()=>{finish()},r.onerror=()=>{finish(Error(`moss-audio-failed`))},t.timeoutMs!==void 0&&t.timeoutMs>0&&(o=window.setTimeout(()=>{r.pause(),finish(Error(`local-speech-timeout`))},t.timeoutMs)),r.play().then(markStarted,()=>{finish(Error(`autoplay-blocked`))}),{done:s,pause(){i||r.pause()},async resume(){if(!i)try{await r.play(),markStarted()}catch{finish(Error(`autoplay-blocked`))}},stop(){i||(r.pause(),finish())}}}function browserVoices(){return typeof window>`u`||window.speechSynthesis===void 0?[]:window.speechSynthesis.getVoices()}function chooseVoice(e){let t=browserVoices(),n=typeof navigator>`u`?`zh-CN`:navigator.language||`zh-CN`;return t.find(t=>t.voiceURI===e)??t.find(e=>e.lang.toLowerCase()===`zh-cn`)??t.find(e=>e.lang.toLowerCase().startsWith(n.toLowerCase().split(`-`)[0]??`zh`))??t.find(e=>e.default)??t[0]}var LocalSpeechController=class{isBusy=()=>[`loading`,`playing`,`paused`].includes(this.status);queue=this.createQueue();generation=0;active=null;observed=``;consumed=0;pendingText=``;handled=new Set;messageId=null;sessionId=null;status=`idle`;blockedTurn=null;manuallyStoppedTurns=new Set;checkpointed=!1;current=null;voiceURI=``;localVoiceEngine=`browser`;mossBaseURL=``;mossVoice=``;mossHandle=null;timeoutMs=12e4;onStateChange=null;error=null;audioStarted=!1;completedFallback=null;fallbackHandler=null;beforePlayback=null;volume=1;voiceRate=1;activeVoiceRate=1;setStateChangeListener(e){this.onStateChange=e}setVoiceURI(e){this.voiceURI=e}setMossVoice(e,t,n){this.localVoiceEngine=e,this.mossBaseURL=t,this.mossVoice=n}setTimeoutMs(e){this.timeoutMs=e}setFallbackHandler(e){this.fallbackHandler=e}setBeforePlayback(e){this.beforePlayback=e}setVolume(e){this.volume=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1,this.current!==null&&(this.current.volume=this.volume)}setVoiceRate(e){this.voiceRate=normalizeVoiceRate(e)}activateSession(e){this.sessionId!==e&&(this.cancel(),this.sessionId=e)}deactivateSession(e){this.sessionId===e&&(this.cancel(),this.sessionId=null)}observe(e,t,n,r){if(this.sessionId!==e)return;let i={sessionId:e,turn:t,step:n},a=`${e}:${t}`;if(this.blockedTurn===a||this.manuallyStoppedTurns.has(a))return;if(this.blockedTurn!==null&&this.blockedTurn!==a&&(this.blockedTurn=null),this.checkpointed&&this.active!==null&&this.active.sessionId===e&&this.active.turn===t&&this.active.step===n&&!r.startsWith(this.observed)){this.prime(e,t,n,r);return}this.beforePlayback?.();let o=classifyLiveSpeechTransition(this.active,i);o===`new-turn`||o===`same-step`&&!r.startsWith(this.observed)?this.reset(i):o===`same-turn`&&this.advance(i),this.observed=r,this.drain(!1)}prime(e,t,n,r){this.sessionId!==e||this.manuallyStoppedTurns.has(`${e}:${t}`)||(this.reset({sessionId:e,turn:t,step:n}),this.observed=r,this.consumed=r.length,this.checkpointed=!0)}finish(e,t){if(this.sessionId!==e)return;let n=`${e}:${t.turn}:${t.step}`;if(this.blockedTurn===`${e}:${t.turn}`||this.manuallyStoppedTurns.has(`${e}:${t.turn}`)){this.messageId=t.messageId,this.reportStatus(),this.handled.add(n);return}if(!(this.sessionId!==e||this.active===null||`${this.active.sessionId}:${this.active.turn}:${this.active.step}`!==n)){if(t.interrupted){this.cancel();return}t.text.startsWith(this.observed)&&(this.observed=t.text),this.messageId=t.messageId,this.reportStatus(),this.drain(!0),this.handled.add(n)}}playCompleted(e,t,n,r){if(this.sessionId!==e||n.length===0)return;this.beforePlayback?.(),this.resetState(),this.activeVoiceRate=this.voiceRate,this.messageId=t,this.completedFallback=r??null;let i=this.segments(n);if(i.length===0){this.setStatus(`error`,`no-text`);return}this.setStatus(`loading`);for(let e of i)this.queue.enqueue(e)}async pause(e){return this.sessionId!==e||this.status!==`playing`?!1:this.localVoiceEngine===`moss`&&this.mossHandle!==null?(this.mossHandle.pause(),this.setStatus(`paused`),!0):window.speechSynthesis===void 0?!1:(window.speechSynthesis.pause(),this.setStatus(`paused`),!0)}async resume(e){return this.sessionId!==e||this.status!==`paused`?!1:this.localVoiceEngine===`moss`&&this.mossHandle!==null?(await this.mossHandle.resume(),this.status===`paused`&&this.setStatus(`playing`),!0):window.speechSynthesis===void 0?!1:(window.speechSynthesis.resume(),this.setStatus(`playing`),!0)}stop(e){return this.sessionId!==e||this.status!==`loading`&&this.status!==`playing`&&this.status!==`paused`?!1:(this.active!==null&&this.manuallyStoppedTurns.add(`${e}:${this.active.turn}`),this.resetState(),!0)}blockTurn(e,t){this.sessionId===e&&(this.manuallyStoppedTurns.add(`${e}:${t}`),this.active?.turn===t&&this.resetState())}hasHandled(e,t){return t===null?!1:this.blockedTurn===`${e}:${t.turn}`||this.manuallyStoppedTurns.has(`${e}:${t.turn}`)||this.handled.has(`${e}:${t.turn}:${t.step}`)}cancel(){this.blockedTurn=null,this.resetState()}interrupt(){this.active!==null&&(this.blockedTurn=`${this.active.sessionId}:${this.active.turn}`),this.resetState()}cancelSession(e){this.sessionId===e&&this.cancel()}dispose(){this.cancel(),this.handled.clear(),this.manuallyStoppedTurns.clear(),this.onStateChange=null}reset(e){this.resetState(),this.activeVoiceRate=this.voiceRate,this.active=e,this.setStatus(`idle`)}advance(e){this.checkpointed=!1,this.drain(!0),this.active=e,this.observed=``,this.consumed=0,this.pendingText=``}resetState(){this.checkpointed=!1,this.generation+=1,this.queue.cancel(),this.mossHandle?.stop(),this.mossHandle=null,this.current!==null&&typeof window<`u`&&window.speechSynthesis!==void 0&&window.speechSynthesis.cancel(),this.current=null,this.queue=this.createQueue(),this.active=null,this.observed=``,this.consumed=0,this.pendingText=``,this.completedFallback=null,this.audioStarted=!1,this.setStatus(`idle`),this.messageId=null}drain(e){let{sentences:t,remainder:n,consumed:r,inCode:i}=splitCompletedTtsSentences(this.observed.slice(this.consumed)),a=e&&!i&&n.trim().length>0?[...t,n]:t;this.consumed+=r,e&&(this.consumed=this.observed.length);for(let e of a){let t=prepareSpeechText(e),n=batchTtsStreamText(this.pendingText,t,!1);this.pendingText=n.pending,n.request!==null&&this.enqueueLive(n.request)}if(e){let e=prepareSpeechText(this.pendingText);this.pendingText=``,e.length>0&&this.enqueueLive(e)}}enqueueLive(e){this.active!==null&&this.handled.add(`${this.active.sessionId}:${this.active.turn}:${this.active.step}`),this.queue.enqueue(e)}segments(e){return splitTtsSegments(e)}createQueue(){let e=this.generation;return new AbortableSentenceQueue((t,n)=>this.speak(t,n,e),{onBusyChange:t=>{e===this.generation&&(t&&this.status===`idle`&&this.setStatus(`loading`),!t&&(this.status===`loading`||this.status===`playing`)&&this.setStatus(`idle`))},onError:t=>{if(e!==this.generation)return;let n=t instanceof Error?t.message:`local-speech-failed`,r=!this.audioStarted;if(r&&this.completedFallback!==null){let e=this.completedFallback;this.resetState(),e();return}if(r&&this.active!==null&&this.fallbackHandler!==null){let e=this.fallbackHandler,t=this.active,n=this.observed;this.resetState(),e(t,n);return}this.active!==null&&(this.blockedTurn=`${this.active.sessionId}:${this.active.turn}`),this.setStatus(`error`,n)}})}speak(e,t,n){if(n!==this.generation||t.aborted)return Promise.resolve();if(this.localVoiceEngine===`moss`)return this.speakMoss(e,t,n);if(typeof window>`u`||window.speechSynthesis===void 0)return Promise.reject(Error(`local-speech-unavailable`));let r=chooseVoice(this.voiceURI);return r===void 0?Promise.reject(Error(`local-voice-unavailable`)):new Promise((i,a)=>{let o=new SpeechSynthesisUtterance(e);o.voice=r,o.lang=r.lang,o.volume=this.volume,applySpeechVoiceRate(o,this.activeVoiceRate),this.current=o;let s=!1,c=null,abort=()=>{},cleanup=()=>{o.onstart=null,o.onend=null,o.onerror=null,t.removeEventListener(`abort`,abort),c!==null&&window.clearTimeout(c),this.current===o&&(this.current=null)},finish=e=>{s||(s=!0,cleanup(),e===void 0?i():a(e))};abort=()=>{this.current===o&&window.speechSynthesis.cancel(),finish()},o.onstart=()=>{n===this.generation&&!t.aborted&&(this.audioStarted=!0,this.setStatus(`playing`))},o.onend=()=>finish(),o.onerror=e=>{t.aborted||e.error===`canceled`||e.error===`interrupted`?finish():finish(Error(e.error===`not-allowed`?`local-speech-not-allowed`:e.error===`audio-busy`?`local-speech-audio-device`:`local-speech-failed`))},t.addEventListener(`abort`,abort,{once:!0}),c=window.setTimeout(()=>{let e=this.current===o;finish(Error(`local-speech-timeout`)),e&&window.speechSynthesis.cancel()},this.timeoutMs),window.speechSynthesis.speak(o)})}async speakMoss(e,t,n){if(this.mossBaseURL.trim().length===0)throw Error(`moss-invalid-url`);if(this.mossVoice.trim().length===0)throw Error(`moss-voice-required`);let r;try{r=await fetchMossAudio(e,{baseURL:this.mossBaseURL,voice:this.mossVoice},t)}catch(e){if(t.aborted||n!==this.generation)return;throw e instanceof MossRequestError?Error(e.code):e}if(t.aborted||n!==this.generation)return;let i=playMossAudio(r,{volume:this.volume,rate:this.activeVoiceRate,timeoutMs:this.timeoutMs,onStart:()=>{n!==this.generation||t.aborted||(this.audioStarted=!0,this.setStatus(`playing`))}});this.mossHandle=i;let abort=()=>{i.stop()};t.addEventListener(`abort`,abort,{once:!0});try{await i.done}finally{t.removeEventListener(`abort`,abort),this.mossHandle===i&&(this.mossHandle=null)}}setStatus(e,t=null){this.status===e&&this.error===t||(this.status=e,this.error=e===`error`?t:null,this.reportStatus())}reportStatus(){this.sessionId!==null&&this.messageId!==null&&this.onStateChange?.(this.sessionId,this.messageId,this.status,this.error)}};async function prefetchSegmentAudio(e,t){try{let n,r=speechRequestBody({text:e,format:`wav`});for(let e=0;e<(externalEngine()?1:2);e+=1){t.throwIfAborted();try{let e=await fetch(hostRoute(h),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r),signal:t});if(!e.ok)throw Error(`segment-request-${e.status}`);return{ok:!0,blob:await e.blob()}}catch(e){n=e}}throw n}catch(e){return{ok:!1,error:e}}}function playSegmentAudio(e,t){let n=URL.createObjectURL(e),r;try{r=new Audio(n),r.volume=t.volume,applyMediaVoiceRate(r,t.voiceRate)}catch(e){return URL.revokeObjectURL(n),Promise.reject(e)}return t.onCreated(r),new Promise((e,i)=>{let a=!1,finish=o=>{a||(a=!0,r.removeEventListener(`ended`,ended),r.removeEventListener(`error`,failed),t.signal.removeEventListener(`abort`,aborted),r.pause(),r.removeAttribute(`src`),r.load(),URL.revokeObjectURL(n),t.onReleased(r),o===void 0?e():i(o))},ended=()=>finish(),failed=()=>finish(Error(`segment-play-failed`)),aborted=()=>finish(t.signal.reason??new DOMException(`Playback cancelled`,`AbortError`));if(r.addEventListener(`ended`,ended),r.addEventListener(`error`,failed),t.signal.addEventListener(`abort`,aborted,{once:!0}),t.signal.aborted){aborted();return}r.play().then(()=>{!a&&!t.signal.aborted&&t.onStarted()}).catch(()=>finish(Error(t.automatic?`autoplay-blocked`:`play-failed`)))})}var PlaybackController=class{constructor(e){this.history=e}autoPlayArmedAt=Date.now();view={sessionId:null,messageId:null,source:null,status:`idle`,error:null};listeners=new Set;automaticallyPlayed=new Set;liveSessions=new Set;completedSessions=new Set;completedMessages=new Map;attachedMidRun=new Set;current=null;segmentQueue=new Set;segmentedState=null;request=null;generation=0;activeSessionId=null;beforePlayback=null;volume=1;voiceRate=1;selection;configure(e){this.selection=ttsSelection(e),this.voiceRate=normalizeVoiceRate(e.voiceRate)}getSnapshot=()=>this.view;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));setBeforePlayback(e){this.beforePlayback=e}setVolume(e){this.volume=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1,this.current!==null&&(this.current.audio.volume=this.volume);for(let e of this.segmentQueue)e.volume=this.volume}setVoiceRate(e){this.voiceRate=normalizeVoiceRate(e),(this.selection?.provider===`doubao`||this.selection?.provider===`breeze`)&&(this.selection={...this.selection,voiceRate:this.voiceRate})}interrupt(){this.generation+=1,this.stopCurrent(),this.segmentedState=null,this.publish(this.emptyView())}activateSession(e){this.activeSessionId!==e&&(this.generation+=1,this.stopCurrent(),this.segmentedState=null,this.liveSessions.clear(),this.completedSessions.clear(),this.completedMessages.clear(),this.attachedMidRun.clear(),this.activeSessionId=e,this.publish(this.emptyView()))}cancelPlayback(e){this.activeSessionId===e&&(this.segmentedState=null,this.generation+=1,this.stopCurrent(),this.publish(this.emptyView()))}deactivateSession(e){this.activeSessionId===e&&(this.generation+=1,this.stopCurrent(),this.segmentedState=null,this.liveSessions.clear(),this.completedSessions.clear(),this.completedMessages.clear(),this.attachedMidRun.clear(),this.activeSessionId=null,this.publish(this.emptyView()))}observeSession(e,t,n,r=!1){if(this.activeSessionId===e){if(t){r?this.attachedMidRun.add(e):this.attachedMidRun.delete(e),this.liveSessions.add(e),this.completedSessions.delete(e),this.completedMessages.delete(e);return}this.liveSessions.delete(e)&&this.completedSessions.add(e),this.completedSessions.has(e)&&n!==null&&this.completedMessages.set(e,n)}}claimAutomaticPlayback(e,t){if(this.activeSessionId!==e)return!1;let n=`${e}:${t}`;return this.completedMessages.get(e)!==t||this.attachedMidRun.has(e)||this.automaticallyPlayed.has(n)?!1:(this.automaticallyPlayed.add(n),this.completedSessions.delete(e),this.completedMessages.delete(e),!0)}updateLivePlayback(e,t,n,r=`live`,i=null){if(this.activeSessionId===e){if(n===`idle`){this.view.source===r&&this.view.messageId===t&&this.publish(this.emptyView());return}this.view.source!==`complete`&&this.publish({sessionId:e,messageId:t,source:r,status:n,error:n===`error`?i??`play-failed`:null})}}resetAutomaticPlayback(){this.autoPlayArmedAt=Date.now(),this.liveSessions.clear(),this.completedSessions.clear(),this.completedMessages.clear(),this.attachedMidRun.clear()}pauseSegmented(e,t){this.activeSessionId!==e||this.view.source!==`segmented`||this.view.messageId!==t||(this.generation+=1,this.stopCurrent(),this.publish({sessionId:e,messageId:t,source:`segmented`,status:`paused`,error:null}))}async segmented(e,t,n,r,i){if(this.activeSessionId!==e)return;this.beforePlayback?.();let a=this.segmentedState,o=a!==null&&a.sessionId===e&&a.messageId===t;this.stopCurrent();let s=o?a.segments:externalEngine()?splitExternalText(n):this.selection?.provider===`breeze`?splitBreezeTtsSegments(n):splitTtsSegments(n,void 0,void 0,e=>prepareProviderTtsText(e,this.selection??{})),c=o?a.index:0,l=o?a.voiceRate:this.voiceRate;if(s.length===0){this.publish({sessionId:e,messageId:t,source:`segmented`,status:`error`,error:`no-text`});return}let u={sessionId:e,messageId:t,segments:s,index:c,voiceRate:l};this.segmentedState=u;let d=++this.generation,p=new AbortController;this.request=p;let m=!1;this.publish({sessionId:e,messageId:t,source:`segmented`,status:`loading`,error:null});try{let n=prefetchSegmentAudio(s[c],p.signal);for(let i=c;i<s.length;i+=1){u.index=i;let a=await n;if(d!==this.generation||this.activeSessionId!==e)return;if(!a.ok)throw a.error;let o=a.blob;if(this.history?.add({blob:o,text:s[i],format:`wav`,source:`conversation`,sessionId:e,messageId:t}),i+1<s.length&&(n=prefetchSegmentAudio(s[i+1],p.signal)),await playSegmentAudio(o,{signal:p.signal,volume:this.volume,voiceRate:l,automatic:r,onCreated:e=>{this.segmentQueue.add(e)},onReleased:e=>{this.segmentQueue.delete(e)},onStarted:()=>{d!==this.generation||this.activeSessionId!==e||(m=!0,this.publish({sessionId:e,messageId:t,source:`segmented`,status:`playing`,error:null}))}}),d!==this.generation||this.activeSessionId!==e)return;u.index=i+1}d===this.generation&&this.activeSessionId===e&&(this.segmentedState=null,this.publish(this.emptyView()))}catch(n){if(!p.signal.aborted&&d===this.generation&&this.activeSessionId===e){if(p.abort(),!m&&i!==void 0){this.segmentedState=null,this.publish(this.emptyView()),i();return}this.publish({sessionId:e,messageId:t,source:`segmented`,status:`error`,error:n instanceof Error?n.message:String(n)})}}finally{d===this.generation&&(this.request=null)}}async toggle(e,t,n,r,i,a=`mp3`){if(this.activeSessionId!==e)return;if(this.beforePlayback?.(),this.view.source===`complete`&&this.view.sessionId===e&&this.view.messageId===t&&this.current!==null){let n=this.current.audio,i=this.generation;if(n.paused)try{if(await n.play(),i!==this.generation||this.activeSessionId!==e||this.current?.audio!==n)return;this.publish({sessionId:e,messageId:t,source:`complete`,status:`playing`,error:null})}catch{if(i!==this.generation||this.activeSessionId!==e||this.current?.audio!==n)return;this.publish({sessionId:e,messageId:t,source:`complete`,status:`paused`,error:r?`autoplay-blocked`:`play-failed`})}else n.pause(),this.publish({sessionId:e,messageId:t,source:`complete`,status:`paused`,error:null});return}if(n.length===0){this.publish({sessionId:e,messageId:t,source:`complete`,status:`error`,error:`no-text`});return}this.stopCurrent();let o=this.selection,s=!externalEngine()&&(o?.provider===`doubao`||o?.provider===`breeze`),c=s?1:this.voiceRate,l=++this.generation,u=new AbortController;this.request=u;let d=!1;this.publish({sessionId:e,messageId:t,source:`complete`,status:`loading`,error:null});try{let i=await fetch(hostRoute(h),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(speechRequestBody({...o,text:n,format:a})),signal:u.signal});if(!i.ok){let e=`${i.status}`;try{let t=await i.json();typeof t.message==`string`?e=t.message:typeof t.error==`string`&&(e=t.error)}catch{}throw Error(e)}let p=await i.blob();if(l!==this.generation||this.activeSessionId!==e)return;let m=i.headers.get(`content-type`)?.includes(`wav`)?`wav`:a;this.history?.add({blob:p,text:n,format:m,source:`conversation`,sessionId:e,messageId:t,voiceRateApplied:s});let g=URL.createObjectURL(p),_=new Audio(g);_.volume=this.volume,applyMediaVoiceRate(_,c),d=!0;let v={url:g,audio:_,onEnded:()=>{this.activeSessionId!==e||this.current?.audio!==_||(this.releaseCurrentAudio(_),this.publish(this.emptyView()))},onError:()=>{this.activeSessionId!==e||this.current?.audio!==_||(this.releaseCurrentAudio(_),this.publish({sessionId:e,messageId:t,source:`complete`,status:`error`,error:`play-failed`}))}};this.current=v,this.request=null,_.addEventListener(`ended`,v.onEnded),_.addEventListener(`error`,v.onError);try{if(await _.play(),l!==this.generation||this.activeSessionId!==e||this.current?.audio!==_)return;this.publish({sessionId:e,messageId:t,source:`complete`,status:`playing`,error:null})}catch{if(l!==this.generation||this.activeSessionId!==e||this.current?.audio!==_)return;this.publish({sessionId:e,messageId:t,source:`complete`,status:`paused`,error:r?`autoplay-blocked`:`play-failed`})}}catch(n){if(u.signal.aborted||l!==this.generation||this.activeSessionId!==e)return;if(!d&&i!==void 0){this.request=null,this.publish(this.emptyView()),i();return}this.request=null,this.publish({sessionId:e,messageId:t,source:`complete`,status:`error`,error:n instanceof Error?n.message:String(n)})}}dispose(){this.generation+=1,this.stopCurrent(),this.segmentedState=null,this.liveSessions.clear(),this.completedSessions.clear(),this.completedMessages.clear(),this.activeSessionId=null,this.listeners.clear()}stopCurrent(){this.request?.abort(),this.request=null,this.segmentQueue.clear(),this.current!==null&&this.releaseCurrentAudio(this.current.audio)}releaseCurrentAudio(e){if(this.current?.audio!==e)return;let t=this.current;this.current=null,e.removeEventListener(`ended`,t.onEnded),e.removeEventListener(`error`,t.onError),e.pause(),e.removeAttribute(`src`),e.load(),URL.revokeObjectURL(t.url)}emptyView(){return{sessionId:null,messageId:null,source:null,status:`idle`,error:null}}publish(e){if(!(this.view.sessionId===e.sessionId&&this.view.messageId===e.messageId&&this.view.source===e.source&&this.view.status===e.status&&this.view.error===e.error)){this.view=e;for(let e of this.listeners)e()}}},XiaomiMimoTtsPcmService=class extends p.Service{audio=new PcmAudioQueue({onBusyChange:e=>{this.audioBusy=e,this.refreshPriority()},onPlaybackStart:()=>{}});request=null;generation=0;disposed=!1;audioBusy=!1;media=null;externalGeneration=null;priorityGeneration=null;priorityBusy=!1;priorityListeners=new Set;priorityActivity={getSnapshot:()=>this.priorityBusy,subscribe:e=>(this.priorityListeners.add(e),()=>{this.priorityListeners.delete(e)})};refreshPriority(){let e=this.priorityGeneration===this.generation&&this.isBusy();if(e!==this.priorityBusy){this.priorityBusy=e;for(let e of this.priorityListeners)e()}}isBusy=()=>this.request!==null||this.audioBusy;tryPlay(e,t,n){if(this.isBusy()&&this.priorityGeneration===this.generation||n===void 0&&(this.isBusy()||t()))return null;let r=this.generation;if(this.start(e,!1,n),this.generation===r)return null;let i=this.generation;return n!==void 0&&(this.priorityGeneration=i),this.refreshPriority(),()=>{this.generation===i&&this.stop()}}constructor(e,t,n,r,i=()=>!0){super(e,`xiaomiMimoTts`),this.settings=t,this.interruptConversationPlayback=n,this.history=r,this.canPlay=i}play(e){try{if(this.isBusy()&&this.priorityGeneration===this.generation||!resolveTtsSettings(this.settings.getSnapshot().value).announcementSources.includes(`dsh-whale-musume`))return;let t=this.generation;this.start(e),t!==this.generation&&(this.externalGeneration=this.generation)}catch(e){this.ctx.logger.warn(`xiaomi-mimo-tts: optional playback settings unavailable: ${String(e)}`)}}stopExternal(){this.externalGeneration===this.generation&&this.stop()}start(e,t=!0,n){try{if(this.disposed||!this.canPlay()||!engineCanRequest()||typeof e!=`string`)return;let r=this.settings.getSnapshot();if(r.status!==`ready`||r.value?.enabled!==!0)return;let i=resolveTtsSettings(r.value),a=engineText(e,()=>prepareProviderTtsText(e,i)).trim();if(a.length===0)return;this.stop(),this.history?.stopReplay(),n?.(),t&&this.interruptConversationPlayback(),this.audio.setMaxPausedPcmBytes(i.maxPausedPcmBytes),this.audio.setVolume(i.voiceVolume),this.audio.setPlaybackRate(externalEngine()||i.provider===`xiaomi`?i.voiceRate:1);let o=this.generation,s=new AbortController;this.request=s;let c=new PcmRecording,consume=async e=>{this.disposed||s.signal.aborted||o!==this.generation||(c.appendBytes(e),await this.audio.enqueueBytes(e))},synthesize=async()=>{let e=externalEngine();if(e?.streaming){for(let e of splitExternalText(a,engineMaxTextLength(i.maxTextLength)))await streamPcmAudio(e,s.signal,async e=>{this.disposed||s.signal.aborted||o!==this.generation||(c.append(e),await this.audio.enqueue(e))});return}if(e&&!e.streaming){let e=engineMaxTextLength(i.maxTextLength);for(let t of splitExternalText(a,e)){s.signal.throwIfAborted();let e=await prefetchSegmentAudio(t,s.signal);if(!e.ok)throw e.error;s.signal.throwIfAborted(),this.history?.add({blob:e.blob,text:t,format:`wav`,source:`service`,voiceRateApplied:!1}),await playSegmentAudio(e.blob,{signal:s.signal,volume:i.voiceVolume,voiceRate:i.voiceRate,automatic:!1,onCreated:e=>{this.media=e},onReleased:()=>{this.media=null},onStarted:()=>{}})}return}if(!e&&i.provider===`doubao`){let e=new DuplexPcmStream(ttsSelection(i),s.signal,consume,i.maxPausedPcmBytes,i.requestTimeoutMs,i.maxTextLength);e.append(a),await e.finish();return}await streamPcmAudio(a,s.signal,async e=>{this.disposed||s.signal.aborted||o!==this.generation||(c.append(e),await this.audio.enqueue(e))},ttsSelection({...i,model:`mimo-v2.5-tts`}))};synthesize().then(()=>{!this.disposed&&!s.signal.aborted&&o===this.generation&&c.save(this.history,{text:a,source:`service`,voiceRateApplied:!externalEngine()&&i.provider!==`xiaomi`})}).catch(e=>{this.disposed||s.signal.aborted||o!==this.generation||(this.ctx.logger.warn(`xiaomi-mimo-tts: optional PCM playback failed: ${e instanceof Error?e.message:String(e)}`),this.audio.stop())}).finally(()=>{this.request===s&&(this.request=null),this.refreshPriority()})}catch(e){this.ctx.logger.warn(`xiaomi-mimo-tts: optional PCM playback could not start: ${e instanceof Error?e.message:String(e)}`)}}stop(){try{this.generation+=1,this.priorityGeneration=null,this.request?.abort(),this.request=null,this.audio.stop(),this.refreshPriority()}catch(e){this.ctx.logger.warn(`xiaomi-mimo-tts: optional PCM playback could not stop cleanly: ${e instanceof Error?e.message:String(e)}`)}}setVolume(e){this.audio.setVolume(e),this.media&&(this.media.volume=e)}async dispose(){this.disposed||(this.disposed=!0,this.stop(),await this.audio.dispose())}};async function configureExternal(e,t,n=e.revision){let r=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/engine-selection`),{method:`POST`,headers:{"content-type":`application/json`,"x-dsh-speech-adapter":`1`},body:JSON.stringify({provider:e.provider,engineRevision:n,...t})}),i=await r.json();if(!r.ok)throw Error(i.error??`external-configuration-failed`);(ni.getSnapshot().engine?.revision??-1)<=i.revision&&ni.accept(i)}let saveExternalSelection=(e,t,n=e.revision)=>configureExternal(e,{selection:t},n),switchExternalConfiguration=(e,t)=>configureExternal(e,{configurationId:t});function nextExternalConfiguration(e){let t=e.configurations??[];if(!(!e.configurationSwitchable||t.length<2))return t[(t.findIndex(t=>t.id===e.configurationId)+1)%t.length]}function useExternalSelection(e){let t=e?`${e.provider}/${e.configurationId??``}`:``,[n,r]=(0,l.useState)(null),i=n?.identity===t&&(n.revision===e?.revision||JSON.stringify(n.value)!==JSON.stringify(e?.selection))?n:null,a=i?.value??e?.selection,o=!!i&&JSON.stringify(i.value)!==JSON.stringify(e?.selection),change=n=>{e?.configurable&&r({identity:t,revision:i?.revision??e.revision,value:n})};return{value:a,dirty:o,change,discard:()=>r(null),save:async()=>{!e||!i||!o||(await saveExternalSelection(e,i.value,i.revision),r(null))}}}function GoHistory(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M11.998 2.5A9.503 9.503 0 0 0 3.378 8H5.75a.75.75 0 0 1 0 1.5H2a1 1 0 0 1-1-1V4.75a.75.75 0 0 1 1.5 0v1.697A10.997 10.997 0 0 1 11.998 1C18.074 1 23 5.925 23 12s-4.926 11-11.002 11C6.014 23 1.146 18.223 1 12.275a.75.75 0 0 1 1.5-.037 9.5 9.5 0 0 0 9.498 9.262c5.248 0 9.502-4.253 9.502-9.5s-4.254-9.5-9.502-9.5Z`},child:[]},{tag:`path`,attr:{d:`M12.5 7.25a.75.75 0 0 0-1.5 0v5.5c0 .27.144.518.378.651l3.5 2a.75.75 0 0 0 .744-1.302L12.5 12.315V7.25Z`},child:[]}]})(e)}let vi=`showInSidebar.showInHostSettings.acceptExternalProviders.qqbotEnabled.announcementSources.provider.doubaoModel.doubaoVoice.doubaoClonedVoice.doubaoInstruction.doubaoEnabled.breezeEnabled.breezeVoice.breezeInstruction.instruction.enabled.autoPlay.voiceInputCompatibility.inputAvoidance.importantAnnouncementsFirst.voiceVolume.voiceRate.readScope.model.localSpeechMode.localVoiceURI.localVoiceEngine.mossEnabled.mossBaseURL.mossVoice.mossVoiceName.voice.voiceDesignPrompt.voiceDesignCustomPrompt.soundEnabled.soundVolume.soundPack.taskSounds.clickSounds`.split(`.`),yi=new Set([`provider`,`apiKey`,`doubaoEnabled`,`doubaoApiKey`,`doubaoModel`,`doubaoVoice`,`doubaoClonedVoice`,`doubaoInstruction`,`breezeEnabled`,`breezeApiKey`,`breezeVoice`,`breezeInstruction`,`instruction`,`model`,`voice`,`voiceDesignPrompt`,`voiceDesignCustomPrompt`]);var SaveSettingsError=class extends Error{constructor(e){super(e),this.code=e,this.name=`SaveSettingsError`}};function validateSettingsDraft(e){return e.provider===`doubao`&&!(e.doubaoModel===`seed-icl-2.0`?e.doubaoClonedVoice:e.doubaoVoice).trim()?`voice-required`:null}async function saveSettingsDraft(e,t,n,r,i=!1){i&&(n=Object.fromEntries(Object.entries(n).filter(([e])=>!yi.has(e))));let a=i?null:validateSettingsDraft(t);if(a)throw new SaveSettingsError(a);for(let[e,t]of[[`xiaomi`,`apiKey`],[`doubao`,`doubaoApiKey`],[`breeze`,`breezeApiKey`]])if(n[t]?.kind===`set`&&r[e].trim()&&!isSupportedTtsApiKey(r[e],e))throw new SaveSettingsError(`api-key-rejected`);let o=e.getSnapshot(),s=resolveTtsSettings(o.value),overridden=e=>o.user!==null&&typeof o.user==`object`&&Object.hasOwn(o.user,e),c=[],write=(e,t)=>{let r=n[e];r&&(r.kind===`set`&&(Array.isArray(t)?JSON.stringify(s[e])===JSON.stringify(t):Object.is(s[e],t))||r.kind===`clear`&&!overridden(e)||c.push(r.kind===`clear`?{op:`unset`,path:[e]}:{op:`set`,path:[e],value:t}))};for(let e of vi)e!==`provider`&&write(e,t[e]);for(let[e,t]of[[`xiaomi`,`apiKey`],[`doubao`,`doubaoApiKey`],[`breeze`,`breezeApiKey`]])n[t]?.kind===`set`&&r[e].trim()&&c.push({op:`set`,path:[t],value:r[e].trim()});if(write(`provider`,t.provider),c.length&&!await e.mutate(c))throw new SaveSettingsError(`host-rejected`)}function browserVoice(e){if(typeof window>`u`||window.speechSynthesis===void 0)return;let t=window.speechSynthesis.getVoices(),n=typeof navigator>`u`?`zh-CN`:navigator.language||`zh-CN`;return t.find(t=>t.voiceURI===e)??t.find(e=>e.lang.toLowerCase()===`zh-cn`)??t.find(e=>e.lang.toLowerCase().startsWith(n.toLowerCase().split(`-`)[0]??`zh`))??t.find(e=>e.default)??t[0]}function pcmDelta(e){if(e===`[DONE]`)return null;let t=JSON.parse(e),n=typeof t.error==`string`?t.error:t.error?.message;if(n!==void 0)throw Error(n);let r=t.choices?.[0]?.delta?.audio?.data;return typeof r==`string`&&r.length>0?r:null}var PreviewPlaybackError=class extends Error{constructor(e,t=e){super(t),this.code=e}};function previewError(e){if(e instanceof DuplexPcmError){if(e.code===`tts-timeout`)return`timeout`;if([`api-key-not-configured`,`api-key-rejected`,`rate-limited`,`voice-required`,`voice-unavailable`,`resource-unavailable`,`stream-buffer-limit`].includes(e.code))return e.code}return e instanceof PreviewPlaybackError?e.code:`request-failed`}async function responseError(e){let t=``,n=`request-${e.status}`;try{let r=await e.json();typeof r.error==`string`&&(t=r.error),typeof r.message==`string`?n=r.message:t.length>0&&(n=t)}catch{}return new PreviewPlaybackError(e.status===409&&t===`api-key-not-configured`?`api-key-not-configured`:e.status===401||e.status===403?`api-key-rejected`:e.status===429?`rate-limited`:e.status===504||t===`xiaomi-timeout`?`timeout`:`request-failed`,n)}var PreviewPlayer=class{pcm=new PcmAudioQueue({onBusyChange:e=>{this.pcmBusy=e,this.maybeFinishPcm()},onPlaybackStart:()=>{this.remoteStarted=!0,this.publish(`playing`)}});generation=0;request=null;audio=null;audioUrl=null;finishAudio=null;utterance=null;finishUtterance=null;mossHandle=null;requestBusy=!1;pcmBusy=!1;status=`idle`;source=null;error=null;volume=1;voiceRate=1;recording=null;remoteStarted=!1;constructor(e,t){this.onViewChange=e,this.history=t}getView(){return{status:this.status,source:this.source,error:this.error}}getRecording(){return this.recording}setRecording(e){this.recording=e,this.onViewChange(this.getView())}setVolume(e){this.volume=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1,this.pcm.setVolume(this.volume),this.audio!==null&&(this.audio.volume=this.volume),this.utterance!==null&&(this.utterance.volume=this.volume)}async play(e,t){this.history?.stopReplay(),this.stop(),this.setVolume(t.voiceVolume),this.voiceRate=normalizeVoiceRate(t.voiceRate),this.pcm.setPlaybackRate(this.voiceRate);let n=e.trim();if(n.length===0){this.publish(`error`,null,`request-failed`);return}let r=this.generation,i=externalEngine()?externalFallbackText(n,t.externalSelection):engineText(n,()=>t.provider===`breeze`?stripBreezeAudioTags(n):(t.provider??`xiaomi`)===`xiaomi`?stripXiaomiAudioTags(n):n);try{if(t.localSpeechMode===`local-first`)try{await this.playLocal(i,t,r)}catch{r===this.generation&&await this.playRemote(n,t,r)}else try{await this.playRemote(n,t,r)}catch(e){if(t.localSpeechMode!==`auto`||r!==this.generation||this.remoteStarted)throw e;this.request=null,this.requestBusy=!1,this.pcmBusy=!1,this.pcm.stop();try{await this.playLocal(i,t,r)}catch{throw e}}r===this.generation&&this.status!==`playing`&&this.publish(`idle`,this.source)}catch(e){r===this.generation&&(this.request=null,this.requestBusy=!1,this.pcmBusy=!1,this.pcm.stop(),this.publish(`error`,this.source,previewError(e)))}}async playBrowserPreview(e,t){this.stop(),this.setVolume(t.voiceVolume),this.voiceRate=normalizeVoiceRate(t.voiceRate);let n=this.generation;try{await this.playLocal(e,{localVoiceURI:t.localVoiceURI,localVoiceEngine:`browser`,mossBaseURL:``,mossVoice:``,voiceVolume:t.voiceVolume,voiceRate:t.voiceRate},n),n===this.generation&&this.publish(`idle`,`local`)}catch(e){n===this.generation&&this.publish(`error`,`local`,previewError(e))}}stop(){this.remoteStarted=!1,this.generation+=1,this.request?.abort(),this.request=null,this.requestBusy=!1,this.pcmBusy=!1,this.pcm.stop(),this.finishAudio?.(),this.finishAudio=null,this.audio!==null&&(this.audio.pause(),this.audio.removeAttribute(`src`),this.audio.load(),this.audio=null),this.audioUrl!==null&&(URL.revokeObjectURL(this.audioUrl),this.audioUrl=null);let e=this.utterance;this.finishUtterance?.(),this.finishUtterance=null,this.mossHandle?.stop(),this.mossHandle=null,e!==null&&typeof window<`u`&&window.speechSynthesis!==void 0&&(window.speechSynthesis.cancel(),this.utterance=null),this.publish(`idle`,null),this.recording!==null&&this.setRecording(null)}async dispose(){this.stop(),await this.pcm.dispose()}requestBody(e,t,n){let r=t.provider===`breeze`,i=r?t.breezeInstruction:t.instruction;return{text:e,provider:t.provider??`xiaomi`,model:r?re:t.model,voice:r?t.breezeVoice??``:t.voice,voiceDesignPrompt:t.voiceDesignPrompt,...i===void 0?{}:{speechInstruction:i},...r?{voiceRate:normalizeVoiceRate(t.voiceRate)}:{},...n===void 0?{}:{format:n}}}async playRemote(e,t,n){let r=externalEngine();if(r){for(let i of splitExternalText(e,r.maxTextLength,t.externalSelection)){if(n!==this.generation)return;r.streaming&&(!t.externalSelection||r.models?.find(e=>e.id===t.externalSelection?.model)?.streaming)?await this.playPcm(i,t,n):await this.playComplete(i,t,n,`wav`,`external`)}return}if(t.provider===`doubao`){this.pcm.setPlaybackRate(1),this.publish(`loading`,`doubao`);let r=new AbortController;this.request=r,this.requestBusy=!0;let i=new PcmRecording;try{let a=new DuplexPcmStream(ttsSelection(resolveTtsSettings(t)),r.signal,async e=>{n!==this.generation||r.signal.aborted||(i.appendBytes(e),await this.pcm.enqueueBytes(e))});if(a.append(e),await a.finish(),n===this.generation){let t=i.toWav();t!==null&&this.setRecording({blob:t,text:e,format:`wav`}),i.save(this.history,{text:e,source:`preview`,voiceRateApplied:!0})}}finally{r.abort(),n===this.generation&&(this.request=null,this.requestBusy=!1,this.maybeFinishPcm())}return}if(t.provider===`breeze`){this.pcm.setPlaybackRate(1),this.publish(`loading`,`breeze`),splitBreezeTtsSegments(e).length>1?await this.playSegmented(e,t,n):await this.playComplete(e,t,n,`mp3`,`breeze`);return}if(t.model===`mimo-v2.5-tts-voicedesign`){splitTtsSegments(e).length>1?await this.playSegmented(e,t,n):await this.playComplete(e,t,n,`mp3`);return}await this.playPcm(e,t,n)}async playComplete(e,t,n,r,i=`mimo`,a=!0){this.publish(`loading`,i);let o=new AbortController;this.request=o;let s=await fetch(hostRoute(h),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(speechRequestBody({...this.requestBody(e,t,r)},t.externalSelection)),signal:o.signal});if(!s.ok)throw await responseError(s);let c=await s.blob();if(n!==this.generation)return;a&&c.size>0&&this.setRecording({blob:c,text:e,format:r});let l=!externalEngine()&&t.provider===`breeze`;this.history?.add({blob:c,text:e,format:r,source:`preview`,voiceRateApplied:l}),this.request=null;let u=URL.createObjectURL(c),d=new Audio(u);d.volume=this.volume,applyMediaVoiceRate(d,l?1:this.voiceRate),this.audioUrl=u,this.audio=d,await new Promise((e,t)=>{let r=!1,cleanup=()=>{d.onended=null,d.onerror=null,this.finishAudio===finish&&(this.finishAudio=null)},finish=a=>{r||(r=!0,cleanup(),this.releaseAudio(d),n===this.generation&&(a===void 0?this.publish(`idle`,i):this.publish(`error`,i,previewError(a))),a===void 0?e():t(a))};this.finishAudio=()=>finish(),d.onended=()=>finish(),d.onerror=()=>finish(new PreviewPlaybackError(`request-failed`,`preview-audio-failed`)),d.play().then(()=>{n===this.generation&&(this.remoteStarted=!0,this.publish(`playing`,i))}).catch(()=>finish(new PreviewPlaybackError(`autoplay-blocked`,`preview-audio-blocked`)))})}async playSegmented(e,t,n){let r=t.provider===`breeze`,i=r?splitBreezeTtsSegments(e):splitTtsSegments(e);for(let e of i){if(n!==this.generation)return;await this.playComplete(e,t,n,`wav`,r?`breeze`:`mimo`,!1)}}async playPcm(e,t,n){this.publish(`loading`,externalEngine()?`external`:`mimo`);let r=new AbortController;this.request=r,this.requestBusy=!0;let i=await fetch(hostRoute(g),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(speechRequestBody({...this.requestBody(e,t)},t.externalSelection)),signal:r.signal});if(!i.ok)throw await responseError(i);if(i.body===null)throw Error(`preview-stream-empty`);let a=i.body.getReader(),o=new TextDecoder,s=``,c=!1,l=new PcmRecording,consume=async e=>{for(let t of e){let e=pcmDelta(t);if(e!==null){if(n!==this.generation||r.signal.aborted)return;c=!0,l.append(e),await this.pcm.enqueue(e)}}};try{for(;n===this.generation;){let e=await a.read();if(e.done)break;s+=o.decode(e.value,{stream:!0});let t=parseSseRecords(s);s=t.remainder,await consume(t.events)}if(s+=o.decode(),n===this.generation&&!r.signal.aborted){s.trim().length>0&&await consume(parseSseRecords(`${s}\n\n`).events);let t=l.toWav();t!==null&&this.setRecording({blob:t,text:e,format:`wav`}),l.save(this.history,{text:e,source:`preview`})}}finally{a.releaseLock(),n===this.generation&&(this.request=null,this.requestBusy=!1,this.maybeFinishPcm())}if(!c&&n===this.generation)throw Error(`preview-stream-audio-empty`)}playLocal(e,t,n){if(this.recording!==null&&this.setRecording(null),this.publish(`loading`,`local`),t.localVoiceEngine===`moss`)return this.playMossLocal(e,t,n);if(typeof window>`u`||window.speechSynthesis===void 0)return Promise.reject(new PreviewPlaybackError(`local-voice-unavailable`,`local-speech-unavailable`));let r=browserVoice(t.localVoiceURI);return r===void 0?Promise.reject(new PreviewPlaybackError(`local-voice-unavailable`)):new Promise((t,i)=>{let a=new SpeechSynthesisUtterance(e);a.voice=r,a.lang=r.lang,a.volume=this.volume,applySpeechVoiceRate(a,this.voiceRate),this.utterance=a;let o=!1,finish=e=>{o||(o=!0,a.onstart=null,a.onend=null,a.onerror=null,this.utterance===a&&(this.utterance=null),this.finishUtterance===finish&&(this.finishUtterance=null),n===this.generation&&(e===void 0?this.publish(`idle`,`local`):this.publish(`error`,`local`,previewError(e))),e===void 0?t():i(e))};this.finishUtterance=()=>finish(),a.onstart=()=>{n===this.generation&&this.publish(`playing`,`local`)},a.onend=()=>finish(),a.onerror=e=>{e.error===`canceled`||e.error===`interrupted`?finish():e.error===`not-allowed`?finish(new PreviewPlaybackError(`autoplay-blocked`,`local-speech-not-allowed`)):finish(new PreviewPlaybackError(`request-failed`,`local-speech-failed`))},window.speechSynthesis.speak(a)})}async playMossLocal(e,t,n){if(t.mossBaseURL.trim().length===0||t.mossVoice.trim().length===0)throw new PreviewPlaybackError(`local-voice-unavailable`);let r=new AbortController;this.request=r;let handleAbort=()=>{this.mossHandle?.stop()};r.signal.addEventListener(`abort`,handleAbort,{once:!0});try{let i=await fetchMossAudio(e,{baseURL:t.mossBaseURL,voice:t.mossVoice},r.signal);if(n!==this.generation||r.signal.aborted)return;i.size>0&&this.setRecording({blob:i,text:e,format:`wav`});let a=playMossAudio(i,{volume:this.volume,rate:this.voiceRate,timeoutMs:12e4,onStart:()=>{n===this.generation&&this.publish(`playing`,`local`)}});this.mossHandle=a;try{await a.done}catch(e){let t=e instanceof Error?e.message:``;throw new PreviewPlaybackError(t===`autoplay-blocked`?`autoplay-blocked`:t===`local-speech-timeout`?`timeout`:`local-voice-unavailable`,t)}finally{this.mossHandle===a&&(this.mossHandle=null)}}finally{r.signal.removeEventListener(`abort`,handleAbort),this.request===r&&(this.request=null)}}releaseAudio(e){this.audio===e&&(this.audio=null,e.pause(),e.removeAttribute(`src`),e.load(),this.audioUrl!==null&&URL.revokeObjectURL(this.audioUrl),this.audioUrl=null)}maybeFinishPcm(){!this.requestBusy&&!this.pcmBusy&&(this.status===`loading`||this.status===`playing`)&&this.publish(`idle`,this.source)}publish(e,t=this.source,n=null){let r=e===`error`?n:null;this.status===e&&this.source===t&&this.error===r||(this.status=e,this.source=t,this.error=r,this.onViewChange(this.getView()))}},ToggleSoundPlayer=class{timer=null;audio=null;volumePreviewAudio=null;volume=1;enabled=!0;volumePreviewIndex=null;lastIndex=new Map;schedule(e){this.clearTimer(),this.releaseAudio(),!(!this.enabled||typeof window>`u`)&&(this.timer=window.setTimeout(()=>{this.timer=null,this.play(e)},200))}dispose(){this.clearTimer(),this.releaseAudio(),this.releaseVolumePreviewAudio()}setVolume(e){this.volume=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1,this.audio!==null&&(this.audio.volume=this.volume)}setEnabled(e){this.enabled=e,e||(this.clearTimer(),this.releaseAudio(),this.releaseVolumePreviewAudio())}setPreviewVolume(e){let t=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1;this.volumePreviewAudio!==null&&(this.volumePreviewAudio.volume=t)}previewVolume(e){let t=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1;if(this.setPreviewVolume(t),!this.enabled||this.volumePreviewAudio!==null||typeof window>`u`)return;let n=Math.floor(Math.random()*w.length);w.length>1&&n===this.volumePreviewIndex&&(n=(n+1)%w.length),this.volumePreviewIndex=n;let r=new Audio(hostRoute(`${S}/${w[n]}`));this.volumePreviewAudio=r,r.volume=t,r.preload=`auto`;let release=()=>{this.volumePreviewAudio===r&&(r.onended=null,r.onerror=null,this.releaseVolumePreviewAudio())};r.onended=release,r.onerror=release,r.play().catch(release)}play(e){let t=C[e],n=this.lastIndex.get(e),r=Math.floor(Math.random()*t.length);t.length>1&&r===n&&(r=(r+1+Math.floor(Math.random()*(t.length-1)))%t.length),this.lastIndex.set(e,r);let i=new Audio(hostRoute(`${S}/${t[r]}`));this.audio=i,i.volume=this.volume,i.preload=`auto`;let release=()=>{this.audio===i&&(i.onended=null,i.onerror=null,this.releaseAudio())};i.onended=release,i.onerror=release,i.play().catch(release)}clearTimer(){this.timer===null||typeof window>`u`||(window.clearTimeout(this.timer),this.timer=null)}releaseAudio(){let e=this.audio;e!==null&&(this.audio=null,e.onended=null,e.onerror=null,e.pause(),e.removeAttribute(`src`),e.load())}releaseVolumePreviewAudio(){let e=this.volumePreviewAudio;e!==null&&(this.volumePreviewAudio=null,e.onended=null,e.onerror=null,e.pause(),e.removeAttribute(`src`),e.load())}};function SettingFieldHeading({label:e,suffix:t,overriddenLabel:n,resetLabel:r,overridden:i,resettable:a,disabled:o,onReset:s}){return(0,d.jsxs)(`span`,{className:`xmimo-tts-field-heading`,children:[(0,d.jsxs)(`span`,{className:`xmimo-tts-field-label`,children:[(0,d.jsx)(`span`,{children:e}),t]}),i&&n!==void 0?(0,d.jsxs)(`span`,{className:`xmimo-tts-field-badges`,children:[(0,d.jsx)(`small`,{className:`xmimo-tts-overridden`,children:n}),a&&s!==void 0&&r!==void 0?(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,className:`xmimo-tts-reset`,disabled:o,onClick:e=>{e.preventDefault(),e.stopPropagation(),s()},children:r}):null]}):null]})}function ModuleShell({className:e,title:t,summary:n,interactiveSummary:r=!1,action:i,children:a,collapsible:o=!1,open:s=!1,onToggle:c,toggleClassName:l=``,headingClassName:u=``,ariaLabel:p,toggleId:m,controlsId:h}){let g={type:`button`,id:m,"aria-controls":h,"aria-expanded":s,"aria-label":p??(typeof t==`string`?t:void 0),onClick:c},_=(0,d.jsxs)(`span`,{className:`xmimo-ui-module-head xmimo-ui-module-heading ${u}`.trim(),children:[(0,d.jsx)(`strong`,{children:t}),n]});return(0,d.jsxs)(`section`,{className:`xmimo-ui-module ${e}`.trim(),children:[(0,d.jsxs)(`header`,{className:`xmimo-ui-module-header`,children:[o&&r?(0,d.jsx)(`div`,{className:`xmimo-ui-module-toggle ${l}`.trim(),children:(0,d.jsxs)(`div`,{className:`xmimo-ui-module-head xmimo-ui-module-heading ${u}`.trim(),children:[(0,d.jsx)(`h3`,{className:`xmimo-ui-accordion-heading xmimo-ui-interactive-heading`,children:(0,d.jsx)(`button`,{...g,className:`xmimo-ui-module-title-toggle`,children:(0,d.jsx)(`strong`,{children:t})})}),n]})}):o?(0,d.jsx)(`h3`,{className:`xmimo-ui-accordion-heading`,children:(0,d.jsx)(`button`,{...g,className:`xmimo-ui-module-toggle ${l}`.trim(),children:_})}):(0,d.jsx)(`div`,{className:`xmimo-ui-module-toggle xmimo-ui-module-toggle-static`,children:_}),i?(0,d.jsx)(`div`,{className:`xmimo-ui-module-decoration`,children:i}):null]}),(0,d.jsx)(`div`,{className:`xmimo-ui-module-body`,children:a})]})}let bi=[`settings.apiKeyIdleCopy1`,`settings.apiKeyIdleCopy2`,`settings.apiKeyIdleCopy3`,`settings.apiKeyIdleCopy4`],xi=[`settings.apiKeyFocusCopy1`,`settings.apiKeyFocusCopy2`,`settings.apiKeyFocusCopy3`,`settings.apiKeyFocusCopy4`];function randomCopyKey(e,t){if(e.length<2)return e[0];let n=e[Math.floor(Math.random()*e.length)];for(;n===t;)n=e[Math.floor(Math.random()*e.length)];return n}function ApiKeyModule({t:e,provider:t,value:n,message:r,invalid:i,writable:a,minimal:o,onChange:s,onOpenProviderSettings:c}){let u=useEngineState(),p=externalEngine();p&&(r=`${p.name} · ${e(u.status===`ready`?p.ready?`settings.externalManaged`:`settings.externalNotReady`:`settings.externalDisconnected`)}`,i=!1,a=!1);let[m,h]=(0,l.useState)(()=>randomCopyKey(bi)),g=(0,l.useId)(),_=(0,l.useId)(),v=t===`doubao`?`https://console.volcengine.com/speech/new/setting/apikeys?projectName=default`:t===`breeze`?`https://breezeblue.ai/zh?code=JHKLSJ`:`https://platform.xiaomimimo.com/console/api-keys`;return(0,d.jsx)(ModuleShell,{className:`xmimo-tts-settings-module xmimo-tts-api-key xmimo-ui-module-padded`,title:(0,d.jsx)(SettingFieldHeading,{label:(0,d.jsxs)(`span`,{className:`xmimo-ui-module-title`,children:[(0,d.jsx)(RiKey2Line,{size:14,"aria-hidden":`true`,focusable:`false`}),p?p.name:t===`doubao`?e(`settings.providerDoubao`):t===`breeze`?e(`settings.providerBreeze`):(0,d.jsx)(`span`,{className:`xmimo-tts-api-key-logo`,role:`img`,"aria-label":e(`settings.apiKey`),style:{"--xmimo-tts-api-key-logo-image":`url(${hostRoute(`/plugins/xiaomi-mimo-tts/mimo.svg`)})`}})]}),suffix:p?.managementBundle&&c?(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-api-key-link`,onClick:()=>c(p.managementBundle),children:e(`settings.externalManage`)}):(0,d.jsx)(`a`,{className:`xmimo-tts-api-key-link`,href:p?p.managementPath?hostRoute(p.managementPath):void 0:v,"aria-disabled":p!==null&&!p.managementPath,target:`_blank`,rel:`noopener noreferrer`,children:e(p?.managementPath?`settings.externalManage`:`settings.getApiKey`)}),disabled:!a,resettable:!1}),action:o?void 0:(0,d.jsx)(`span`,{className:`xmimo-tts-api-key-decoration`,"aria-hidden":`true`}),children:(0,d.jsxs)(`form`,{className:`xmimo-tts-api-key-content`,onSubmit:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-api-key-input`,children:[o?null:(0,d.jsx)(`span`,{className:`xmimo-tts-character-bubble xmimo-tts-api-key-bubble`,"aria-hidden":`true`,children:e(m)}),o?null:(0,d.jsx)(`span`,{className:`xmimo-tts-api-key-whale`,style:{backgroundImage:`url(${hostRoute(`/plugins/xiaomi-mimo-tts/api-key-whale.webp`)})`},"aria-hidden":`true`}),(0,d.jsx)(`input`,{id:g,type:`password`,value:n,name:`xmimo-tts-api-key`,autoComplete:`new-password`,autoCorrect:`off`,spellCheck:!1,"aria-label":e(`settings.apiKey`),"aria-autocomplete":`none`,"aria-describedby":_,"aria-invalid":i,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-lpignore":`true`,placeholder:e(`settings.secretPlaceholder`),disabled:!a,onFocus:()=>{h(e=>randomCopyKey(xi,e))},onBlur:()=>{h(e=>randomCopyKey(bi,e))},onChange:e=>{s(e.target.value)},style:{padding:`0 var(--xmimo-ui-space-4)`}})]}),(0,d.jsx)(`small`,{id:_,className:`xmimo-tts-api-key-message${i?` xmimo-tts-api-key-warning`:``}${o&&!i&&!p?` xmimo-tts-visually-hidden`:``}`,role:i?`alert`:`status`,children:r})]})})}function resolveApiKeyViewState(e,t,n,r){return r===`set`&&e.trim().length>0?t?`pending-save`:`pending-invalid`:n}function VoiceAvatar({preset:e,minimal:t}){return t?null:e.avatar}let Si=E.map(e=>({...e,label:e.value,avatar:(0,d.jsx)(`img`,{className:`xmimo-tts-builtin-voice-avatar`,src:hostRoute(`/plugins/xiaomi-mimo-tts/voice-avatars/${e.id}.webp`),alt:``,width:36,height:36,loading:`lazy`,"aria-hidden":`true`})}));function SelectedCheck(){return(0,d.jsxs)(`svg`,{className:`xmimo-tts-builtin-voice-check`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,d.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`}),(0,d.jsx)(`path`,{d:`m4.8 8.1 2 2 4.4-4.5`})]})}function BuiltInVoicePicker({value:e,disabled:t,label:n,minimal:r=!1,onChange:i}){return(0,d.jsx)(VoicePresetPicker,{value:e,disabled:t,label:n,minimal:r,onChange:i,presets:Si})}function VoicePresetPicker({value:e,disabled:t,label:n,minimal:r=!1,onChange:i,presets:a}){let[o,s]=(0,l.useState)(!1),c=(0,l.useRef)(null),p=(0,l.useRef)(null),m=(0,l.useRef)([]),h=(0,l.useId)(),g=a.findIndex(t=>t.value===e),_=a[g<0?0:g];(0,l.useEffect)(()=>{if(r||!o)return;let closeOnOutsidePointer=e=>{e.target instanceof Node&&!c.current?.contains(e.target)&&s(!1)};return document.addEventListener(`pointerdown`,closeOnOutsidePointer),()=>document.removeEventListener(`pointerdown`,closeOnOutsidePointer)},[r,o]),(0,l.useEffect)(()=>{!r&&t&&s(!1)},[t,r]);let focusOption=e=>{let t=(e+a.length)%a.length;requestAnimationFrame(()=>m.current[t]?.focus())},choose=e=>{i(e),!r&&(s(!1),requestAnimationFrame(()=>p.current?.focus()))},handleTriggerKeyDown=e=>{e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),s(!0),focusOption(g<0?0:g)):e.key===`Home`?(e.preventDefault(),s(!0),focusOption(0)):e.key===`End`&&(e.preventDefault(),s(!0),focusOption(a.length-1))},handleOptionKeyDown=(e,t)=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),focusOption(t+1)):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),focusOption(t-1)):e.key===`Home`?(e.preventDefault(),focusOption(0)):e.key===`End`?(e.preventDefault(),focusOption(a.length-1)):e.key===`Escape`?(e.preventDefault(),s(!1),p.current?.focus()):e.key===`Tab`&&s(!1)};return(0,d.jsxs)(`div`,{className:`xmimo-tts-builtin-voice-picker`,ref:c,children:[r?null:(0,d.jsxs)(`button`,{ref:p,type:`button`,className:`xmimo-tts-builtin-voice-trigger`,disabled:t,"aria-label":n,"aria-haspopup":`listbox`,"aria-expanded":o,"aria-controls":o?h:void 0,onClick:()=>{s(e=>!e)},onKeyDown:handleTriggerKeyDown,children:[(0,d.jsx)(VoiceAvatar,{preset:_,minimal:r}),(0,d.jsxs)(`span`,{className:`xmimo-tts-builtin-voice-copy`,children:[(0,d.jsx)(`strong`,{children:_.label}),(0,d.jsx)(`small`,{children:_.summary})]}),r?(0,d.jsx)(`span`,{className:`xmimo-tts-voice-picker-text-caret`,"aria-hidden":`true`,children:`⌄`}):(0,d.jsx)(u.IconChevronDownOutlineMedium,{className:o?`xmimo-tts-voice-picker-chevron xmimo-tts-voice-picker-chevron-open`:`xmimo-tts-voice-picker-chevron`,size:14})]}),r||o?(0,d.jsx)(`div`,{id:h,className:`xmimo-tts-builtin-voice-menu`,role:`listbox`,"aria-label":n,children:a.map((n,i)=>(0,d.jsxs)(`button`,{ref:e=>{m.current[i]=e},type:`button`,role:`option`,"aria-selected":n.value===e,disabled:t,className:`xmimo-tts-builtin-voice-option${n.value===e?` xmimo-tts-builtin-voice-option-selected`:``}${n.fullWidth?` xmimo-tts-builtin-voice-option-custom`:``}`,onClick:()=>{choose(n.value)},onKeyDown:e=>{handleOptionKeyDown(e,i)},children:[!r&&n.value===e?(0,d.jsx)(SelectedCheck,{}):null,(0,d.jsx)(VoiceAvatar,{preset:n,minimal:r}),(0,d.jsxs)(`span`,{className:`xmimo-tts-builtin-voice-copy`,children:[(0,d.jsx)(`strong`,{children:n.label}),(0,d.jsx)(`small`,{children:n.summary})]})]},n.id))}):null]})}let Ci=[`Natural`,`Gentle`,`Cheerful`,`Calm`,`Story`,`Argument`,`Whisper`,`Cute`,`Cantonese`,`Henan`,`Sichuan`,`Dongbei`],wi=[`Natural`,`Gentle`,`Cheerful`,`Calm`,`Story`,`Argument`,`Whisper`,`Shy`,`Weary`,`Tearful`,`Coy`,`Cute`,`Cantonese`,`Shanghai`,`Henan`,`Beijing`,`Tianjin`,`Sichuan`,`Shaanxi`,`Dongbei`],Ti=[`Natural`,`WhisperFear`,`ExcitedSurprise`,`SarcasticDisbelief`,`NervousHumor`,`RestrainedGrief`,`CalmNarration`,`WarmCompanion`,`PlayfulTeasing`,`SeriousAnnouncement`,`EncouragingSupport`,`SleepyBedtime`];function speechInstructionPresets(e,t){return(e===`xiaomi`?Ci.map(e=>({preset:e,prompt:e===`Natural`?``:t(`settings.mimoInstruction${e}Prompt`)})):e===`breeze`?Ti.map(e=>({preset:e,prompt:e===`Natural`?``:t(`settings.breezeInstructionText${e}`)})):wi.map(e=>({preset:e,prompt:e===`Natural`?``:t(`settings.speechInstruction${e}Prompt`)}))).map(({preset:n,prompt:r})=>({preset:n,prompt:r,label:t(e===`breeze`&&n!==`Natural`?`settings.breezeInstructionLabel${n}`:`settings.speechInstruction${n}`)}))}function speechInstructionLabel(e,t,n){return speechInstructionPresets(e,n).find(e=>e.prompt===t.trim())?.label??n(`settings.speechInstructionCustom`)}function SpeechInstructionPicker({provider:e,value:t,disabled:n,minimal:r=!1,onChange:i,t:a,options:o}){let s=e===`external`?[{preset:``,prompt:``,label:a(`settings.speechInstructionNatural`)},...(o??[]).map(e=>({preset:e.id,prompt:e.id,label:e.name}))]:speechInstructionPresets(e,a),c=a(e===`external`?`settings.externalOptionsHint`:e===`xiaomi`?`settings.mimoInstructionHint`:e===`breeze`?`settings.breezeInstructionHint`:`settings.doubaoInstructionHint`);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-instruction-editor`,children:[(0,d.jsx)(`textarea`,{value:t,rows:r?3:4,disabled:n,readOnly:e===`external`&&o!==void 0,"aria-label":a(`settings.speechInstruction`),placeholder:a(`settings.speechInstructionPlaceholder`),onChange:e=>i(e.target.value)}),(0,d.jsx)(`div`,{className:`xmimo-tts-instruction-presets`,role:`group`,"aria-label":a(`settings.speechInstructionPresets`),children:s.map(({preset:e,prompt:r,label:a})=>(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-instruction-tag`,disabled:n,"aria-pressed":t.trim()===r,title:r||c,onClick:()=>i(r),children:a},e))})]}),r?null:(0,d.jsx)(`small`,{children:c})]})}function VoiceReadingSelect({label:e,value:t,fallbackLabel:n,options:r,disabled:i,buttonVariant:a,onSelect:o}){let[s,c]=(0,l.useState)(!1),p=(0,l.useRef)(null),closeMenu=()=>{c(!1)},choose=e=>{p.current?.focus({preventScroll:!0}),closeMenu(),o(e)},m=r.find(e=>e.id===t)?.label??n??t,h=(0,d.jsxs)(a?u.Button:`button`,{ref:p,type:`button`,...a?{variant:a,size:`sm`}:{},className:a?`xmimo-voice-reading-button-selector`:`xmimo-voice-reading-selector`,"aria-label":e,"aria-haspopup":`menu`,"aria-expanded":s,disabled:i,onClick:()=>{c(e=>!e)},children:[(0,d.jsx)(`span`,{className:`xmimo-voice-reading-selector-label`,children:m}),(0,d.jsx)(u.IconChevronDownOutlineRegular,{className:`xmimo-voice-reading-chevron`})]});return(0,d.jsx)(u.Menu,{open:s&&!i,anchor:h,items:r,selectedId:t,onSelect:choose,onClose:closeMenu,align:`end`,portal:!0,listClassName:`xmimo-voice-reading-menu`})}function CatalogPicker({items:e,value:t,label:n,minimal:r,disabled:i,onChange:a}){return r?(0,d.jsx)(VoiceReadingSelect,{value:t,label:n,options:e.map(e=>({id:e.id,label:e.name})),disabled:i,onSelect:a,buttonVariant:`outline`}):(0,d.jsx)(VoicePresetPicker,{value:t,label:n,disabled:i,onChange:a,presets:e.map(e=>({id:e.id,value:e.id,label:e.name,summary:e.name===e.id?``:e.id,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-doubao-voice-avatar`,"aria-hidden":`true`,children:e.name.slice(0,1)})}))})}function ExternalSpeechFields({engine:e,selection:t=e.selection,writable:n,minimal:r,t:i,onChange:a}){let o=e.models?.find(e=>e.id===t?.model),s=!n||!e.configurable||!t;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-model`,children:[(0,d.jsx)(SettingFieldHeading,{label:i(`settings.model`),resettable:!1,disabled:s}),e.models?.length?(0,d.jsx)(CatalogPicker,{value:t?.model??``,items:e.models,label:i(`settings.model`),minimal:r,disabled:s,onChange:n=>{let r=e.models.find(e=>e.id===n);a({model:n,voice:r.voices.some(e=>e.id===t?.voice)?t.voice:r.voices[0]?.id??``,speechInstruction:``})}}):(0,d.jsx)(`input`,{"aria-label":i(`settings.model`),value:e.modelName??``,disabled:!0})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-voice`,children:[(0,d.jsx)(SettingFieldHeading,{label:i(`settings.voiceReadingVoice`),resettable:!1,disabled:s}),o?.voices.length?(0,d.jsx)(CatalogPicker,{value:t?.voice??``,items:o.voices,label:i(`settings.voiceReadingVoice`),minimal:r,disabled:s,onChange:e=>a({...t,voice:e})}):(0,d.jsx)(`input`,{"aria-label":i(`settings.voiceReadingVoice`),value:e.voiceName??``,disabled:!0})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-voice xmimo-tts-speech-instruction`,children:[(0,d.jsx)(SettingFieldHeading,{label:i(`settings.speechInstruction`),resettable:!1,disabled:s||!o?.speechInstruction}),(0,d.jsx)(SpeechInstructionPicker,{provider:`external`,value:t?.speechInstruction??``,disabled:s||!o?.speechInstruction,minimal:r,t:i,options:o?.instructions,onChange:e=>a({...t,speechInstruction:e})})]})]})}function clamp(e,t,n){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):n}let Ei=Array.from({length:24},(e,t)=>{let randomAt=e=>{let n=Math.sin(t*(12.9898+e)+78.233+e*31.7)*43758.5453;return n-Math.floor(n)},n=randomAt(0);return{x:2+t/23*96+(n-.5)*2,y:28+n*44,size:2+randomAt(1)*2,driftX:`${(randomAt(2)-.5)*8}px`,driftY:`${(randomAt(3)-.5)*10}px`,duration:`${2.4+randomAt(4)*2.8}s`,delay:`${-randomAt(5)*3.5}s`}});function EnergyVolumeSlider({value:e,label:t,minimal:n=!1,disabled:r=!1,min:i=0,max:a=1,step:o=.01,formatValue:s,onChange:c,onInteractionEnd:u}){let p=Number.isFinite(i)?i:0,m=Number.isFinite(a)&&a>p?a:p+1,h=Number.isFinite(o)&&o>0?o:(m-p)/100,[g,_]=(0,l.useState)(!1),[v,b]=(0,l.useState)(0),x=(0,l.useRef)(!1),S=(0,l.useRef)(!1),C=clamp(e,p,m),w=(0,l.useRef)(C),E=(C-p)/(m-p),D=Math.round(E*100);(0,l.useEffect)(()=>{x.current||(w.current=C)},[C]);let begin=e=>{e.currentTarget.setPointerCapture(e.pointerId),x.current=!0,_(!0)},finish=()=>{x.current&&(x.current=!1,_(!1),b(e=>e+1),u?.(w.current))};return(0,d.jsxs)(`span`,{className:n?`xmimo-tts-energy xmimo-tts-energy-minimal`:`xmimo-tts-energy`,"data-dragging":g,"data-high":E>.85,"data-disabled":r,style:{"--volume":`${D}%`},children:[(0,d.jsx)(`span`,{className:`xmimo-tts-energy-fill`,"aria-hidden":`true`}),(0,d.jsx)(`span`,{className:v?`xmimo-tts-energy-dots xmimo-tts-energy-pulse`:`xmimo-tts-energy-dots`,"aria-hidden":`true`,children:Ei.map(({x:e,y:t,size:n,driftX:r,driftY:i,duration:a,delay:o},s)=>(0,d.jsx)(`i`,{style:{"--dot":s,"--dot-x":`${e}%`,"--dot-y":`${t}%`,"--dot-size":`${n}px`,"--drift-x":r,"--drift-y":i,"--drift-duration":a,"--drift-delay":o,opacity:s/24<E?.7:.15}},s))},v),(0,d.jsx)(`input`,{type:`range`,min:p,max:m,step:h,value:C,"aria-label":t,"aria-valuetext":s?.(C)??`${D}%`,disabled:r,onPointerDown:begin,onPointerUp:finish,onPointerCancel:()=>{x.current=!1,_(!1)},onLostPointerCapture:finish,onBlur:()=>{x.current=!1,_(!1)},onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`PageUp`,`PageDown`].includes(e.key)&&(S.current=!0)},onKeyUp:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`PageUp`,`PageDown`].includes(e.key)&&(b(e=>e+1),S.current&&(S.current=!1,u?.(w.current)))},onChange:e=>{let t=Number(e.target.value);w.current=t,c(t)}})]})}function FieldInfo({label:e,text:t}){let n=(0,l.useId)(),[r,i]=(0,l.useState)(!1),a=(0,l.useRef)(null),o=(0,l.useRef)(null),[s,c]=(0,l.useState)({left:0,top:0});return(0,l.useLayoutEffect)(()=>{if(!r)return;let place=()=>{if(a.current===null||o.current===null)return;let e=a.current.getBoundingClientRect(),t=o.current.getBoundingClientRect();c({left:Math.max(16,Math.min(e.left,window.innerWidth-t.width-16)),top:e.bottom+t.height+6<=window.innerHeight-16?e.bottom+6:Math.max(16,e.top-t.height-6)})};return place(),window.addEventListener(`resize`,place),window.addEventListener(`scroll`,place,!0),()=>{window.removeEventListener(`resize`,place),window.removeEventListener(`scroll`,place,!0)}},[r,t]),(0,d.jsxs)(`span`,{className:`xmimo-tts-field-info`,onMouseEnter:()=>i(!0),onMouseLeave:()=>{document.activeElement!==a.current&&i(!1)},children:[(0,d.jsx)(`button`,{ref:a,type:`button`,className:`xmimo-tts-field-info-button`,"aria-label":e,"aria-describedby":r?n:void 0,onFocus:()=>i(!0),onBlur:()=>i(!1),onClick:()=>i(!0),onKeyDown:e=>{e.key===`Escape`&&(i(!1),e.stopPropagation())},children:(0,d.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,d.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,d.jsx)(`path`,{d:`M12 11v6M12 7h.01`})]})}),r?(0,d.jsx)(`span`,{ref:o,id:n,role:`tooltip`,className:`xmimo-tts-field-info-tooltip`,style:s,children:t}):null]})}let Di=String.raw`目标:在 Windows 上部署 MOSS-TTS-Nano 本地 TTS 服务(非windows环境可参考),不使用管理员权限,不要 conda。服务最终监听 127.0.0.1:18083,供 DSH 插件通过健康检查、预热状态和合成接口接入。
13
+ Doubao applies changes at the next synthesis; Xiaomi and browser speech during playback. Xiaomi streaming also changes pitch`,"settings.voiceRateInfo":`Playback speed information`,"settings.readScope":`Read-aloud range`,"settings.readScopeSmart":`Smart mode`,"settings.readScopeFull":`Full mode`,"settings.readScopeFirstSegment":`First-segment mode`,"settings.readScopeSmartHint":`Auto: full short replies, first two segments of long replies, with an optional closing cue. Manual: full reply`,"settings.readScopeFullHint":`Read the full reply, automatically or manually`,"settings.readScopeFirstSegmentHint":`Read only the first segment, automatically or manually`,"settings.summaryPresetModel":`Preset model`,"settings.summaryVoiceDesignModel":`Custom voicedesign`,"settings.localSpeechAutoSummary":`Cloud first`,"settings.stateOn":`On`,"settings.stateOff":`Off`,"settings.model":`Voice source settings`,"settings.presetModel":`Preset voices (mimo-v2.5-tts)`,"settings.voiceDesignModel":`Custom voice design (mimo-v2.5-tts-voicedesign)`,"settings.presetModelShort":`Preset voice (MiMo-TTS)`,"settings.voiceDesignModelShort":`Voice design (MiMo-VoiceDesign)`,"settings.localSpeechMode":`Speech strategy`,"settings.localSpeechAuto":`Cloud first`,"settings.localSpeechFirst":`Local first`,"settings.localSpeechDisabled":`Disable local speech`,"settings.localSpeechAutoHint":`Cloud first; fall back to browser speech if it fails before playback`,"settings.localSpeechFirstHint":`Browser speech first; fall back to the cloud if it fails`,"settings.localSpeechDisabledHint":`Cloud speech only, with no browser fallback`,"settings.localSpeechUnavailableHint":`No browser voices available; use cloud first`,"settings.localVoice":`Browser voice`,"settings.localVoiceLoading":`Loading browser voices…`,"settings.localVoiceUnavailable":`No browser voices available`,"settings.localVoiceOffline":`Offline`,"settings.localVoiceOnline":`Online`,"settings.localVoiceEngine":`Local voice source`,"settings.localVoiceEngineBrowser":`Browser`,"settings.localVoiceEngineMoss":`MOSS local`,"settings.mossProvider":`MOSS Nano (Local)`,"settings.experimental":`Experimental`,"settings.more":`More`,"settings.moreHint":`Volume, speed, local voice, reading range and strategy`,"settings.announcementsMoreHint":`Host integration, announcement sources and plugin integrations`,"settings.mossBaseURL":`MOSS service URL`,"settings.mossProbe":`Probe`,"settings.mossCopyDeployHint":`Copy the deployment prompt`,"settings.mossDeployHintBefore":`Not deployed yet? `,"settings.mossDeployHintAction":`Copy the prompt`,"settings.mossDeployHintAfter":` and let DSH set it up.`,"settings.mossDeployCopied":`Copied — paste it to DSH.`,"settings.mossDeployCopyFailed":`Copy failed. Try again.`,"settings.mossProbingShort":`Probing…`,"settings.mossProbing":`Probing the MOSS service…`,"settings.mossOnlineReady":`Online · ready`,"settings.mossWarming":`Online · warming up`,"settings.mossNotProbed":`Not probed yet`,"settings.mossInvalidUrl":`Invalid MOSS service URL`,"settings.mossTimeout":`The MOSS service timed out`,"settings.mossUnreachable":`Cannot reach the MOSS service`,"settings.mossProbeFailed":`MOSS probe failed`,"settings.mossVoice":`MOSS voice`,"settings.mossVoiceProbeFirst":`Probe the MOSS service to load voices`,"settings.mossBuiltInVoice":`built-in voice`,"settings.mossLocalFirstHint":`Choose Local first to make MOSS the preferred voice; Cloud first falls back to it only when cloud playback fails before starting.`,"settings.mossLocalDisabledHint":`Local speech is off, so the MOSS voice is not used.`,"settings.modelAutoPlayHintPreset":`Preset voices support streaming`,"settings.modelAutoPlayHintVoiceDesign":`Play automatically after the reply is complete`,"settings.voice":`Built-in voice`,"settings.format":`Audio format`,"settings.formatPcm":`PCM (streaming)`,"settings.formatMp3":`MP3 (complete audio)`,"settings.formatWav":`WAV (complete audio)`,"settings.formatPcmHint":`Stream audio as it arrives; fall back to MP3 if it fails before the first chunk`,"settings.formatMp3Hint":`Play after generation; smaller files`,"settings.formatWavHint":`Play after generation; lossless, larger files`,"settings.voiceDesignPrompt":`Voice design`,"settings.customVoiceOption":`Custom`,"settings.customVoiceSummary":`Write a custom voice description`,"settings.voiceDesignPromptHint":`Describe age, gender, tone, pace and emotion; omit scenes and actions`,"settings.voiceDesignPlaybackMode":`Read-aloud mode`,"settings.voiceDesignPlaybackComplete":`Complete`,"settings.voiceDesignPlaybackSegmented":`Segmented`,"settings.voiceDesignPlaybackFirstSegment":`First segment`,"settings.voiceDesignPlaybackCompleteHint":`Generate the full reply for consistent delivery; long text may cause artifacts`,"settings.voiceDesignPlaybackSegmentedHint":`Generate in segments for faster starts on long text; delivery may vary`,"settings.voiceDesignPlaybackFirstSegmentHint":`Read only the first segment for a faster start and lower usage`,"settings.previewTitle":`Broadcast Desk`,"settings.previewText":`Preview text`,"settings.previewPresets":`Sample texts`,"settings.previewPresetGreeting":`Greeting`,"settings.previewPresetPoetry":`Poetry`,"settings.previewPresetInspiration":`Encouragement`,"settings.previewPresetReflection":`Reflection`,"settings.previewPresetHumor":`Humor`,"settings.previewPresetNews":`News`,"settings.previewPresetStory":`Story`,"settings.previewPresetService":`Welcome`,"settings.previewPresetDialogue":`Dialogue`,"settings.previewDefaultTextStory":`As the bookshop closed, a ginger cat slipped in and curled up on an unopened travel journal.`,"settings.previewDefaultTextService":`Hello and welcome! Tell me what you need help with, and we will work through it together.`,"settings.previewDefaultTextDialogue":`You remembered? I thought I was the only one. All this time, we were heading the same way.`,"settings.previewDefaultTextNews":`Evening news: the city library now stays open late, offering a quiet place to read after work.`,"settings.previewDownload":`Download current preview audio`,"settings.previewDownloadUnavailable":`Generate preview audio first to download it`,"settings.previewDownloadLocal":`Browser speech cannot be downloaded. Preview a cloud voice or MOSS instead.`,"settings.previewDownloadFailed":`Download failed. Please try again.`,"settings.previewDefaultText":`Hi! I'm Whale Maid. It's lovely to explore the world of voices with you!`,"settings.previewDefaultTextPoetry":`The wind folds clouds into a letter; the moon signs it. May starlight find you on every road home.`,"settings.previewDefaultTextInspiration":`Go at your own pace. A seed still blooms after a late spring. One stumble need not end your journey.`,"settings.previewDefaultTextReflection":`We cannot keep every breeze, but we can choose our sail. Perhaps the answer is in how we live today.`,"settings.previewDefaultTextHumor":`My alarm rang. I voted for five more minutes in bed. An hour later, the motion was still in effect.`,"settings.previewPlaceholder":`Enter preview text`,"settings.moreProviders":`More providers`,"settings.breezeEnabled":`Enable Breeze Blue`,"settings.providerMinimum":`Xiaomi is always enabled; keep Doubao or Breeze enabled.`,"settings.breezeAudioTags":`Audio tags`,"settings.xiaomiAudioTagsHint":`Xiaomi preset voices: start with a style or add sound cues inline. Supports (), (), [], custom descriptions and combinations. Singing inserts at the start. Use instructions for Voice Design.`,"settings.breezeAudioTagsHint":`Tags are inserted into the preview text. Use square brackets for Chinese and parentheses for English. Breeze TTS only.`,"settings.breezeAudioTagsChinese":`中文`,"settings.breezeAudioTagsEnglish":`English`,"settings.audioTagsContinuous":`Add multiple`,"settings.audioTagsContinuousHint":`Pin tag panel`,"settings.previewPlay":`Play preview`,"settings.previewListen":`Preview`,"settings.previewStopShort":`Stop`,"settings.previewStop":`Stop preview`,"settings.previewHint":`Save a key for cloud previews`,"settings.previewLoading":`Getting ready…`,"settings.previewPlaying":`Playing; click to stop`,"settings.previewLoadingMimo":`Connecting to MiMo…`,"settings.previewLoadingLocal":`Preparing browser speech…`,"settings.previewPlayingMimo":`MiMo playing; click to stop`,"settings.previewPlayingLocal":`Browser speech playing; click to stop`,"settings.previewCompletedMimo":`MiMo preview complete`,"settings.previewCompletedLocal":`Local-speech preview complete`,"settings.previewLoadingBreeze":`Connecting to Breeze…`,"settings.previewPlayingBreeze":`Breeze playing; click to stop`,"settings.previewCompletedBreeze":`Breeze preview complete`,"settings.previewErrorApiKeyMissing":`Save an API key or enable browser speech`,"settings.previewErrorApiKeyRejected":`Key rejected. Check or replace it`,"settings.previewErrorRateLimited":`Too many requests. Try again shortly`,"settings.previewErrorTimeout":`Request timed out. Check your connection and retry`,"settings.previewErrorLocalUnavailable":`No browser voices available`,"settings.previewErrorAutoplay":`Playback blocked. Click preview again`,"settings.previewFailed":`Preview failed. Check settings and connection`,"settings.save":`Save`,"settings.saving":`Saving…`,"settings.saved":`Saved`,"settings.unsaved":`Unsaved`,"settings.overridden":`Overridden`,"settings.reset":`Restore default`,"settings.discard":`Discard changes`,"settings.failed":`Save failed. Try again`,"settings.source":`View source`,"settings.readOnly":`DSH settings are read-only`,"settings.secretPlaceholder":`Enter a new key for this provider`,"settings.expand":`Expand settings`,"settings.collapse":`Collapse settings`,"settings.soundEffectsTitle":`Sound Effects`,"settings.soundEffectsEnabled":`Enable sounds`,"settings.soundEffectsVolume":`Volume`,"settings.soundEffectsPack":`Sound pack`,"settings.soundEffectsTask":`Task sounds`,"settings.soundEffectsClick":`Click sounds`,"settings.soundEffectsOn":`All sounds`,"settings.soundEffectsOff":`Off`,"settings.soundEffectsOnLabel":`Magic sounds on`,"settings.soundEffectsOffLabel":`Magic sounds off`,"settings.soundEffectsBubbleOff":`UISFX disabled`,"settings.soundEffectsClickOnly":`Click sounds only`,"settings.soundEffectsTaskOnly":`Task sounds only`,"settings.soundEffectsTurnOn":`Turn sounds on`,"settings.soundEffectsTurnOff":`Turn sounds off`,"settings.soundEffectsSynced":`Task / click synced`,"settings.soundEffectsPreviewLabel":`Sound previews`,"settings.soundEffectsPreview.start":`Preview start`,"settings.soundEffectsPreview.complete":`Preview complete`,"settings.soundEffectsPreview.success":`Preview success`,"settings.soundEffectsPreview.error":`Preview error`,"settings.soundEffectsPreview.notification":`Preview notification`,"settings.soundEffectsPreview.press":`Preview click`,"settings.soundEffectsPreview.select":`Preview select`,"settings.soundEffectsPreview.toggle-on":`Preview toggle on`,"settings.soundEffectsPreview.toggle-off":`Preview toggle off`,"settings.soundEffectsPreview.send":`Preview send`,"settings.soundEffectsPreview.open":`Preview open`,"settings.soundEffectsPreview.close":`Preview close`,"settings.soundEffectsPreview.delete":`Preview delete`,"settings.soundEffectsPreview.stop":`Preview stop`,"settings.soundEffectsPreview.queued":`Preview queued`,"settings.soundEffectsDescription":`Sounds for clicks and task events`,"settings.soundEffectsSupported":`Supported sounds: Start, Complete, Success, Error, Notification, Press, Select, Toggle On, Toggle Off, Send, Open, Close, Delete, Stop, Queued`};function pcmDeltaFromSse(e){if(e===`[DONE]`)return null;let t=JSON.parse(e),n=typeof t.error==`string`?t.error:t.error?.message;if(n!==void 0)throw Error(n);let r=t.choices?.[0]?.delta?.audio?.data;return typeof r==`string`&&r.length>0?r:null}async function streamPcmAudio(e,t,n,r){if(t.aborted)return;let i=await fetch(hostRoute(g),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(speechRequestBody({text:e,...r??{}})),signal:t});if(t.aborted)return;if(!i.ok)throw Error(`stream-request-${i.status}`);if(i.body===null)throw Error(`stream-response-empty`);let a=i.body.getReader(),o=new TextDecoder,s=``,c=!1,consumeEvents=async e=>{for(let r of e){if(t.aborted)return;let e=pcmDeltaFromSse(r);e!==null&&(await n(e),c=!0)}};try{for(;!t.aborted;){let e=await a.read();if(e.done||t.aborted)break;s+=o.decode(e.value,{stream:!0});let n=parseSseRecords(s);s=n.remainder,await consumeEvents(n.events)}s+=o.decode(),!t.aborted&&s.trim().length>0&&await consumeEvents(parseSseRecords(`${s}\n\n`).events)}finally{a.releaseLock()}if(!t.aborted&&!c)throw Error(`stream-audio-empty`)}function applyMediaVoiceRate(e,t){e.playbackRate=t,e.preservesPitch=!0}function applyPcmVoiceRate(e,t){e.playbackRate.value=t}function applySpeechVoiceRate(e,t){e.rate=t}function pcmPlaybackDuration(e,t){return e/t}var PcmAudioQueue=class{context=null;gain=null;volume=1;playbackRate=1;scheduledAt=0;sources=new Set;sourceBytes=new Map;revision=0;chain=Promise.resolve();busy=!1;userPaused=!1;queuedBytes=0;maxPausedPcmBytes=32*1024*1024;constructor(e){this.callbacks=e}setMaxPausedPcmBytes(e){this.maxPausedPcmBytes=Number.isFinite(e)&&e>0?e:32*1024*1024}setVolume(e){this.volume=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1;let t=this.context,n=this.gain;if(t===null||n===null)return;let r=t.currentTime;n.gain.cancelScheduledValues(r),n.gain.setValueAtTime(n.gain.value,r),n.gain.linearRampToValueAtTime(this.volume,r+.02)}setPlaybackRate(e){this.playbackRate=normalizeVoiceRate(e)}async pause(){let e=this.revision,t=this.context;this.userPaused=!0,t!==null&&t.state===`running`&&await t.suspend(),e!==this.revision&&t===this.context&&t!==null&&!this.userPaused&&this.sources.size>0&&t.state!==`running`&&await t.resume()}async resume(){let e=this.revision,t=this.context;t!==null&&t.state!==`running`&&await t.resume(),e===this.revision?this.userPaused=!1:t===this.context&&t!==null&&this.userPaused&&t.state===`running`&&await t.suspend()}enqueue(e){return this.enqueueBytes(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}enqueueBytes(e){let t=this.revision,n=this.chain.then(()=>this.schedule(e,t));return this.chain=n.catch(()=>{}),n}stop(){this.revision+=1,this.scheduledAt=0,this.chain=Promise.resolve(),this.userPaused=!1,this.queuedBytes=0;for(let e of this.sources)try{e.stop()}catch{}this.sources.clear(),this.sourceBytes.clear(),this.setBusy(!1)}async dispose(){this.stop();let e=this.context;this.context=null,this.gain?.disconnect(),this.gain=null,e!==null&&e.state!==`closed`&&await e.close()}async schedule(e,t){if(t!==this.revision)return;if(e.byteLength%2)throw Error(`invalid-pcm-sample`);if(e.byteLength<2)return;let n=this.getContext();if(n.state!==`running`&&!this.userPaused&&await n.resume(),t!==this.revision)return;let r=Math.floor(e.byteLength/2),i=n.createBuffer(1,r,24e3),a=i.getChannelData(0),o=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=0;e<r;e+=1)a[e]=o.getInt16(e*2,!0)/32768;let s=n.createBufferSource();s.buffer=i,applyPcmVoiceRate(s,this.playbackRate),s.connect(this.getGain(n));let c=Math.max(n.currentTime+.03,this.scheduledAt);if(this.scheduledAt=c+pcmPlaybackDuration(i.duration,this.playbackRate),this.userPaused&&this.queuedBytes+e.byteLength>this.maxPausedPcmBytes)throw Error(`pcm-pause-buffer-limit`);this.sources.add(s),this.sourceBytes.set(s,e.byteLength),this.queuedBytes+=e.byteLength,s.addEventListener(`ended`,()=>{t===this.revision&&(this.sources.delete(s),this.queuedBytes-=this.sourceBytes.get(s)??0,this.sourceBytes.delete(s),this.sources.size===0&&this.setBusy(!1))},{once:!0});try{s.start(c)}catch(e){throw this.sources.delete(s),this.queuedBytes-=this.sourceBytes.get(s)??0,this.sourceBytes.delete(s),e}this.setBusy(!0),!this.userPaused&&n.state===`running`&&this.callbacks.onPlaybackStart()}setBusy(e){this.busy!==e&&(this.busy=e,this.callbacks.onBusyChange(e))}getContext(){return this.context===null&&(this.context=new AudioContext),this.context}getGain(e){return this.gain===null&&(this.gain=e.createGain(),this.gain.gain.value=this.volume,this.gain.connect(e.destination)),this.gain}},PcmRecording=class{chunks=[];bytes=0;overflow=!1;maxBytes;constructor(e=100*1024*1024-44){this.maxBytes=e}append(e){let t=atob(e);this.appendBytes(Uint8Array.from(t,e=>e.charCodeAt(0)))}appendBytes(e){if(!this.overflow){if(this.bytes+=e.length,this.bytes>this.maxBytes){this.overflow=!0,this.chunks=[];return}this.chunks.push(Uint8Array.from(e))}}toWav(){if(this.overflow||this.bytes===0||this.bytes%2!=0)return null;let e=new ArrayBuffer(44),t=new DataView(e),label=(e,n)=>{for(let r=0;r<n.length;r+=1)t.setUint8(e+r,n.charCodeAt(r))};return label(0,`RIFF`),t.setUint32(4,36+this.bytes,!0),label(8,`WAVE`),label(12,`fmt `),t.setUint32(16,16,!0),t.setUint16(20,1,!0),t.setUint16(22,1,!0),t.setUint32(24,24e3,!0),t.setUint32(28,48e3,!0),t.setUint16(32,2,!0),t.setUint16(34,16,!0),label(36,`data`),t.setUint32(40,this.bytes,!0),new Blob([e,...this.chunks],{type:`audio/wav`})}save(e,t){this.overflow&&e?.reportSkipped();let n=this.toWav();this.chunks=[],this.bytes=0,n!==null&&e?.add({...t,blob:n,format:`wav`})}},DuplexPcmError=class extends Error{constructor(e,t=e){super(t),this.code=e}},DuplexPcmStream=class{done;resolve;reject;socket;ready=!1;ended=!1;terminal=!1;finishing=!1;pending=[];pendingBytes=0;textLength=0;chain=Promise.resolve();tail=null;received=!1;timer;constructor(e,t,n,r=32*1024*1024,i=12e4,a=12e3){this.signal=t,this.consume=n,this.limit=r,this.timeoutMs=i,this.maxTextLength=a,this.done=new Promise((e,t)=>{this.resolve=e,this.reject=t}),this.done.catch(()=>{}),this.socket=new WebSocket(hostWebSocketUrl(`/plugins/xiaomi-mimo-tts/synthesize-duplex`)),this.socket.binaryType=`arraybuffer`,this.socket.onopen=()=>{this.ended||this.socket.send(JSON.stringify({type:`start`,selection:e}))},this.socket.onmessage=e=>{if(!(this.ended||this.terminal))if(this.arm(),e.data instanceof ArrayBuffer){if(!this.ready){this.fail(new DuplexPcmError(`invalid-session-state`));return}let t=new Uint8Array(e.data);if(this.pendingBytes+=t.length,this.pendingBytes>this.limit){this.fail(new DuplexPcmError(`stream-buffer-limit`));return}this.chain=this.chain.then(async()=>{if(this.ended||this.signal.aborted)return;let e=t;this.tail!==null&&(e=new Uint8Array(t.length+1),e[0]=this.tail,e.set(t,1),this.tail=null),e.length%2&&(this.tail=e[e.length-1],e=e.subarray(0,e.length-1)),e.length&&(await this.consume(e),this.received=!0)}).catch(e=>this.fail(e)).finally(()=>{this.pendingBytes-=t.length})}else try{let t=JSON.parse(String(e.data));if(t.type===`ready`&&!this.ready&&t.sampleRate===24e3&&t.channels===1&&t.sampleFormat===`s16le`){this.ready=!0;for(let e of this.pending.splice(0))this.sendText(e);this.finishing&&this.socket.send(JSON.stringify({type:`finish`}))}else t.type===`error`?this.fail(new DuplexPcmError(t.error??`request-failed`,t.message)):t.type===`done`&&this.ready&&this.finishing?(this.terminal=!0,this.chain.then(()=>{if(!this.ended){if(this.tail!==null){this.fail(new DuplexPcmError(`invalid-pcm-sample`));return}if(!this.received){this.fail(new DuplexPcmError(`stream-audio-empty`));return}this.ended=!0,this.cleanup(),this.resolve()}})):this.fail(new DuplexPcmError(`invalid-session-state`))}catch{this.fail(new DuplexPcmError(`invalid-stream-response`))}},this.socket.onclose=()=>{!this.terminal&&!this.ended&&this.fail(new DuplexPcmError(`stream-connection-closed`))},this.socket.onerror=()=>this.fail(new DuplexPcmError(`request-failed`)),t.addEventListener(`abort`,this.onAbort,{once:!0}),this.arm(Math.min(1e4,i)),t.aborted&&this.onAbort()}append(e){if(this.ended||this.finishing)throw new DuplexPcmError(`invalid-session-state`);if(e.trim()){if(this.textLength+=e.length,this.textLength>this.maxTextLength){let e=new DuplexPcmError(`text-too-long`);throw this.fail(e),e}this.ready?this.sendText(e):this.pending.push(e),this.arm(this.ready?this.timeoutMs:Math.min(1e4,this.timeoutMs))}}finish(){return!this.ended&&!this.finishing&&(this.finishing=!0,this.ready&&this.socket.send(JSON.stringify({type:`finish`}))),this.done}sendText(e){this.socket.send(JSON.stringify({type:`text`,text:e}))}onAbort=()=>{this.fail(new DOMException(`Synthesis canceled`,`AbortError`))};arm(e=this.timeoutMs){clearTimeout(this.timer),this.timer=setTimeout(()=>this.fail(new DuplexPcmError(`tts-timeout`)),e)}cleanup(){clearTimeout(this.timer),this.signal.removeEventListener(`abort`,this.onAbort),this.socket.onopen=null,this.socket.onmessage=null,this.socket.onclose=null,this.socket.onerror=null,this.socket.close()}fail(e){this.ended||(this.ended=!0,this.socket.readyState===WebSocket.OPEN&&this.socket.send(JSON.stringify({type:`cancel`})),this.cleanup(),this.reject(e))}},LiveSpeechController=class{isBusy=()=>this.requestBusy||this.audioBusy||[`loading`,`playing`,`paused`].includes(this.status);constructor(e){this.history=e}audio=new PcmAudioQueue({onBusyChange:e=>{this.audioBusy=e,this.maybeFinishPlayback()},onPlaybackStart:()=>this.setStatus(`playing`)});streamGeneration=0;queue=this.createQueue();active=null;observed=``;consumed=0;pendingText=``;handled=new Set;messageId=null;status=`idle`;sessionId=null;requestBusy=!1;audioBusy=!1;blockedTurn=null;manuallyStoppedTurns=new Set;checkpointed=!1;completed=null;audioStarted=!1;fallbackHandler=null;onStateChange=null;playbackError=null;beforePlayback=null;voiceRate=1;selection={provider:`xiaomi`,model:`mimo-v2.5-tts`,voice:`冰糖`,voiceDesignPrompt:``};duplexAbort=new AbortController;duplexJobs=[];duplexStep=null;duplexRunning=!1;timeoutMs=12e4;maxPcmBytes=32*1024*1024;maxTextLength=12e3;configure(e){let t=ttsSelection(e);JSON.stringify({...t,voiceRate:void 0})!==JSON.stringify({...this.selection,voiceRate:void 0})&&this.interrupt(),this.selection=t,this.voiceRate=e.voiceRate,this.timeoutMs=e.requestTimeoutMs,this.maxPcmBytes=e.maxPausedPcmBytes,this.maxTextLength=engineMaxTextLength(e.maxTextLength),this.audio.setMaxPausedPcmBytes(e.maxPausedPcmBytes)}prepareText(e){return externalEngine()?externalText(e):prepareSpeechText(e,supportsXiaomiAudioTags(this.selection)?`xiaomi`:this.selection.provider===`breeze`)}isDuplex(){return!externalEngine()&&this.selection.provider===`doubao`}finishInput(e,t,n){!this.isDuplex()||this.sessionId!==e||this.active?.turn!==t||this.active.step!==n||(this.drain(!0),this.finishDuplexStep())}setStateChangeListener(e){this.onStateChange=e}setFallbackHandler(e){this.fallbackHandler=e}setBeforePlayback(e){this.beforePlayback=e}setMaxPausedPcmBytes(e){this.audio.setMaxPausedPcmBytes(e)}setVolume(e){this.audio.setVolume(e)}setVoiceRate(e){this.voiceRate=normalizeVoiceRate(e),this.selection.provider!==`xiaomi`&&(this.selection={...this.selection,voiceRate:this.voiceRate})}async pause(e){if(this.sessionId!==e||this.status!==`playing`)return!1;let t=this.streamGeneration;this.setStatus(`paused`);try{return await this.audio.pause(),this.sessionId===e&&t===this.streamGeneration}catch{return this.sessionId===e&&t===this.streamGeneration&&this.setStatus(`playing`),!1}}async resume(e){if(this.sessionId!==e||this.status!==`paused`)return!1;let t=this.streamGeneration;try{return await this.audio.resume(),this.sessionId!==e||t!==this.streamGeneration?!1:(this.setStatus(`playing`),!0)}catch{return this.sessionId!==e||t!==this.streamGeneration?!1:(this.setStatus(`error`),this.replaceQueue(),this.audio.stop(),!1)}}activateSession(e){this.sessionId!==e&&(this.cancel(),this.sessionId=e)}deactivateSession(e){this.sessionId===e&&(this.cancel(),this.sessionId=null)}observe(e,t,n,r){if(this.sessionId!==e)return;let i={sessionId:e,turn:t,step:n},a=`${e}:${t}`;if(this.blockedTurn===a||this.manuallyStoppedTurns.has(a))return;if(this.blockedTurn!==null&&this.blockedTurn!==a&&(this.blockedTurn=null),this.checkpointed&&this.active!==null&&this.cursorKey(this.active)===this.cursorKey(i)&&!r.startsWith(this.observed)){this.prime(e,t,n,r);return}this.beforePlayback?.();let o=classifyLiveSpeechTransition(this.active,i);o===`new-turn`||o===`same-step`&&!r.startsWith(this.observed)?this.reset(i):o===`same-turn`&&this.advanceSegment(i),this.observed=r,this.drain(!1)}prime(e,t,n,r){this.sessionId!==e||this.manuallyStoppedTurns.has(`${e}:${t}`)||(this.reset({sessionId:e,turn:t,step:n}),this.observed=r,this.consumed=r.length,this.checkpointed=!0)}playCompleted(e,t,n,r){if(!(this.sessionId!==e||n.length===0)){if(this.beforePlayback?.(),this.resetState(),this.audio.setPlaybackRate(externalEngine()||this.selection.provider===`xiaomi`?this.voiceRate:1),this.completed={sessionId:e,messageId:t,audioStarted:!1,fallback:r},this.audioStarted=!1,this.messageId=t,this.setStatus(`loading`),this.isDuplex()){this.enqueueDuplex(n),this.finishDuplexStep();return}for(let e of externalEngine()?splitExternalText(n,this.maxTextLength):this.selection.provider===`breeze`?splitBreezeTtsSegments(n):splitTtsSegments(n,void 0,void 0,e=>prepareProviderTtsText(e,this.selection)))this.queue.enqueue(e)}}finish(e,t){if(this.sessionId!==e)return;let n=`${e}:${t.turn}:${t.step}`;if(this.blockedTurn===`${e}:${t.turn}`||this.manuallyStoppedTurns.has(`${e}:${t.turn}`)){this.messageId=t.messageId,this.reportStatus(),this.handled.add(n);return}if(!(this.sessionId!==e||this.active===null||this.cursorKey(this.active)!==n)){if(t.interrupted){this.cancelSession(e);return}t.text.startsWith(this.observed)&&(this.observed=t.text),this.messageId=t.messageId,this.duplexStep!==null&&(this.duplexStep.messageId=t.messageId),this.reportStatus(),this.drain(!0),this.finishDuplexStep(),this.handled.add(n)}}stop(e){return this.sessionId!==e||this.status!==`loading`&&this.status!==`playing`&&this.status!==`paused`?!1:(this.active!==null&&this.manuallyStoppedTurns.add(`${e}:${this.active.turn}`),this.resetState(),!0)}blockTurn(e,t){this.sessionId===e&&(this.manuallyStoppedTurns.add(`${e}:${t}`),this.active?.turn===t&&this.resetState())}hasHandled(e,t){return t===null?!1:this.blockedTurn===`${e}:${t.turn}`||this.manuallyStoppedTurns.has(`${e}:${t.turn}`)||this.handled.has(`${e}:${t.turn}:${t.step}`)}cancelSession(e){this.sessionId===e&&this.cancel()}cancel(){this.blockedTurn=null,this.resetState()}interrupt(){this.active!==null&&(this.blockedTurn=`${this.active.sessionId}:${this.active.turn}`),this.resetState()}async dispose(){this.cancel(),this.handled.clear(),this.manuallyStoppedTurns.clear(),await this.audio.dispose()}reset(e){this.replaceQueue(),this.audio.stop(),this.audio.setPlaybackRate(externalEngine()||this.selection.provider===`xiaomi`?this.voiceRate:1),this.beginSegment(e,!1),this.setStatus(`idle`)}advanceSegment(e){this.drain(!0),this.finishDuplexStep(),this.duplexStep=null,this.beginSegment(e,!0)}beginSegment(e,t){this.checkpointed=!1,this.completed=null,t||(this.audioStarted=!1),this.active=e,this.observed=``,this.consumed=0,this.pendingText=``,t||(this.messageId=null)}resetState(){this.checkpointed=!1,this.replaceQueue(),this.audio.stop(),this.active=null,this.observed=``,this.consumed=0,this.pendingText=``,this.setStatus(`idle`),this.messageId=null,this.completed=null,this.audioStarted=!1}cursorKey(e){return`${e.sessionId}:${e.turn}:${e.step}`}drain(e){let{sentences:t,remainder:n,consumed:r,inCode:i}=splitCompletedTtsSentences(this.observed.slice(this.consumed)),a=e&&!i&&n.trim().length>0?[...t,n]:t;if(this.consumed+=r,this.stageSentences(a,!1),!e&&!i&&n.trim().length>0){let e=this.prepareText(n),t=160-countTtsSpeechCharacters(this.pendingText);if(countTtsSpeechCharacters(e)>=t){let e=takeStreamChunk(n,t,!externalEngine()&&(this.selection.provider===`breeze`||supportsXiaomiAudioTags(this.selection)));e.length>0&&(this.stageSentences([e],!1),this.consumed+=e.length)}}e&&(this.consumed=this.observed.length),e&&this.stageSentences([],!0)}stageSentences(e,t){let n=e.map(e=>this.prepareText(e)).filter(e=>countTtsSpeechCharacters(e)>0);if(this.isDuplex()){n.length>0&&this.active!==null&&this.handled.add(this.cursorKey(this.active));for(let e of n)this.enqueueDuplex(e);return}let r=batchTtsStreamSegments(this.pendingText,n,t);this.pendingText=r.pending,r.requests.length>0&&this.active!==null&&this.handled.add(this.cursorKey(this.active));for(let e of r.requests){let t=externalEngine()?splitExternalText(e,this.maxTextLength):this.selection.provider===`breeze`?splitBreezeTtsSegments(e):[e];for(let e of t)this.queue.enqueue(e)}}createQueue(){let e=this.streamGeneration;return new AbortableSentenceQueue((t,n)=>this.stream(t,n,e),{onBusyChange:t=>{e===this.streamGeneration&&(this.requestBusy=t,t&&this.status===`idle`&&this.setStatus(`loading`),this.maybeFinishPlayback())},onError:t=>{e===this.streamGeneration&&this.handleStreamError(t)}})}replaceQueue(){this.streamGeneration+=1,this.requestBusy=!1,this.queue.cancel(),this.queue=this.createQueue(),this.duplexAbort.abort(),this.duplexAbort=new AbortController,this.duplexJobs=[],this.duplexStep=null,this.duplexRunning=!1}isCurrentStream(e,t){return e===this.streamGeneration&&!t.aborted}async stream(e,t,n){if(!this.isCurrentStream(n,t))return;let r=new PcmRecording,i=this.sessionId,a=this.messageId;try{await streamPcmAudio(e,t,async e=>{this.isCurrentStream(n,t)&&(r.append(e),await this.audio.enqueue(e))},this.selection),this.isCurrentStream(n,t)&&r.save(this.history,{text:e,source:`conversation`,...i===null?{}:{sessionId:i},...a===null?{}:{messageId:a}})}catch(e){if(this.isCurrentStream(n,t))throw e}}handleStreamError(e){let t=typeof DOMException<`u`&&e instanceof DOMException&&e.name===`NotAllowedError`,n=this.completed;if(!t&&n!==null&&!n.audioStarted){let e=n.fallback;this.resetState(),e();return}if(!t&&this.active!==null&&!this.audioStarted&&this.fallbackHandler!==null){let e=this.fallbackHandler,t=this.active,n=this.observed;this.resetState(),e(t,n);return}this.active!==null&&(this.blockedTurn=`${this.active.sessionId}:${this.active.turn}`),this.playbackError=e instanceof Error&&`code`in e&&typeof e.code==`string`?e.code:e instanceof Error?e.message:`request-failed`,this.setStatus(`error`),this.replaceQueue(),this.audio.stop()}enqueueDuplex(e){if(this.duplexStep?.finished)return;this.duplexStep===null&&(this.duplexStep={text:[],finished:!1,stream:null,sessionId:this.sessionId,messageId:this.messageId},this.duplexJobs.push(this.duplexStep));let t=this.duplexStep;t.text.push(e);try{t.stream?.append(e)}catch(e){this.handleStreamError(e);return}this.duplexRunning||this.runDuplexJobs()}finishDuplexStep(){let e=this.duplexStep;e===null||e.finished||(e.finished=!0,e.stream?.finish().catch(()=>{}))}async runDuplexJobs(){this.duplexRunning=!0;let e=this.streamGeneration,t=this.duplexAbort.signal;this.requestBusy=!0,this.status===`idle`&&this.setStatus(`loading`);try{for(;this.duplexJobs.length&&this.isCurrentStream(e,t);){let n=this.duplexJobs[0],r=new PcmRecording;n.stream=new DuplexPcmStream(this.selection,t,async n=>{this.isCurrentStream(e,t)&&(r.appendBytes(n),await this.audio.enqueueBytes(n))},this.maxPcmBytes,this.timeoutMs,this.maxTextLength);for(let e of n.text)n.stream.append(e);if(n.finished&&n.stream.finish().catch(()=>{}),await n.stream.done,!this.isCurrentStream(e,t))return;r.save(this.history,{text:n.text.join(``),source:`conversation`,voiceRateApplied:!0,...n.sessionId===null?{}:{sessionId:n.sessionId},...n.messageId===null?{}:{messageId:n.messageId}}),this.duplexJobs.shift()}}catch(n){this.isCurrentStream(e,t)&&this.handleStreamError(n)}finally{e===this.streamGeneration&&(this.duplexRunning=!1,this.requestBusy=!1,this.maybeFinishPlayback())}}maybeFinishPlayback(){!this.requestBusy&&!this.audioBusy&&(this.status===`loading`||this.status===`playing`)&&this.setStatus(`idle`)}setStatus(e){e!==`error`&&(this.playbackError=null),this.status!==e&&(this.status=e,e===`playing`&&(this.audioStarted=!0,this.completed!==null&&(this.completed.audioStarted=!0)),this.reportStatus())}reportStatus(){this.sessionId!==null&&this.messageId!==null&&this.onStateChange?.(this.sessionId,this.messageId,this.status,this.playbackError)}};function takeStreamChunk(e,t,n=!1){let r=null,i=0,a=0,o=``;for(let s of e){a+=s.length,/^[\p{L}\p{N}]$/u.test(s)&&(i+=1);let c=e.codePointAt(a),l=c===void 0?``:String.fromCodePoint(c);if(n&&(r===null&&(s===`[`||s===`(`||s===`(`)?r=s===`[`?`]`:s===`(`?`)`:`)`:s===r&&(r=null)),r===null&&i>=t&&!/\p{M}/u.test(l)){let t=isStreamWordCharacter(s)&&(l.length===0||isStreamWordCharacter(l)),n=/\p{N}/u.test(s)&&/[.,]/u.test(l),r=/[.,]/u.test(s)&&/\p{N}/u.test(o)&&(l.length===0||/\p{N}/u.test(l));if(!t&&!n&&!r)return e.slice(0,a)}o=s}return``}function isStreamWordCharacter(e){return/[\p{L}\p{N}\p{M}_'’\-]/u.test(e)&&!/\p{Script=Han}/u.test(e)}var MossRequestError=class extends Error{constructor(e,t=e){super(t),this.code=e}};async function probeMossService(e,t){let n;try{n=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/moss/probe`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({baseURL:e}),...t===void 0?{}:{signal:t}})}catch(e){throw t?.aborted?e:new MossRequestError(`moss-unreachable`,`Cannot reach the local MOSS service.`)}let r=await n.json().catch(()=>void 0);return n.ok?r:{ok:!1,error:typeof r?.error==`string`?r.error:`moss-request-failed`,message:typeof r?.message==`string`?r.message:``}}async function fetchMossAudio(e,t,n){let r;try{r=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/moss/synthesize`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:e,baseURL:t.baseURL,voice:t.voice,format:`wav`}),signal:n})}catch(e){throw n.aborted?e:new MossRequestError(`moss-unreachable`,`Cannot reach the local MOSS service.`)}if(!r.ok){let e=await r.json().catch(()=>void 0);throw new MossRequestError(typeof e?.error==`string`?e.error:`moss-request-failed`,typeof e?.message==`string`?e.message:`MOSS synthesis failed.`)}return r.blob()}function playMossAudio(e,t){let n=URL.createObjectURL(e),r=new Audio(n);r.volume=Number.isFinite(t.volume)?Math.max(0,Math.min(1,t.volume)):1,applyMediaVoiceRate(r,t.rate);let i=!1,a=!1,o,resolveDone=()=>{},rejectDone=()=>{},s=new Promise((e,t)=>{resolveDone=e,rejectDone=t}),cleanup=()=>{r.onended=null,r.onerror=null,r.onplaying=null,o!==void 0&&window.clearTimeout(o),URL.revokeObjectURL(n)},finish=e=>{i||(i=!0,cleanup(),e===void 0?resolveDone():rejectDone(e))},markStarted=()=>{a||(a=!0,t.onStart?.())};return r.onplaying=markStarted,r.onended=()=>{finish()},r.onerror=()=>{finish(Error(`moss-audio-failed`))},t.timeoutMs!==void 0&&t.timeoutMs>0&&(o=window.setTimeout(()=>{r.pause(),finish(Error(`local-speech-timeout`))},t.timeoutMs)),r.play().then(markStarted,()=>{finish(Error(`autoplay-blocked`))}),{done:s,pause(){i||r.pause()},async resume(){if(!i)try{await r.play(),markStarted()}catch{finish(Error(`autoplay-blocked`))}},stop(){i||(r.pause(),finish())}}}function browserVoices(){return typeof window>`u`||window.speechSynthesis===void 0?[]:window.speechSynthesis.getVoices()}function chooseVoice(e){let t=browserVoices(),n=typeof navigator>`u`?`zh-CN`:navigator.language||`zh-CN`;return t.find(t=>t.voiceURI===e)??t.find(e=>e.lang.toLowerCase()===`zh-cn`)??t.find(e=>e.lang.toLowerCase().startsWith(n.toLowerCase().split(`-`)[0]??`zh`))??t.find(e=>e.default)??t[0]}var LocalSpeechController=class{isBusy=()=>[`loading`,`playing`,`paused`].includes(this.status);queue=this.createQueue();generation=0;active=null;observed=``;consumed=0;pendingText=``;handled=new Set;messageId=null;sessionId=null;status=`idle`;blockedTurn=null;manuallyStoppedTurns=new Set;checkpointed=!1;current=null;voiceURI=``;localVoiceEngine=`browser`;mossBaseURL=``;mossVoice=``;mossHandle=null;timeoutMs=12e4;onStateChange=null;error=null;audioStarted=!1;completedFallback=null;fallbackHandler=null;beforePlayback=null;volume=1;voiceRate=1;activeVoiceRate=1;setStateChangeListener(e){this.onStateChange=e}setVoiceURI(e){this.voiceURI=e}setMossVoice(e,t,n){this.localVoiceEngine=e,this.mossBaseURL=t,this.mossVoice=n}setTimeoutMs(e){this.timeoutMs=e}setFallbackHandler(e){this.fallbackHandler=e}setBeforePlayback(e){this.beforePlayback=e}setVolume(e){this.volume=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1,this.current!==null&&(this.current.volume=this.volume)}setVoiceRate(e){this.voiceRate=normalizeVoiceRate(e)}activateSession(e){this.sessionId!==e&&(this.cancel(),this.sessionId=e)}deactivateSession(e){this.sessionId===e&&(this.cancel(),this.sessionId=null)}observe(e,t,n,r){if(this.sessionId!==e)return;let i={sessionId:e,turn:t,step:n},a=`${e}:${t}`;if(this.blockedTurn===a||this.manuallyStoppedTurns.has(a))return;if(this.blockedTurn!==null&&this.blockedTurn!==a&&(this.blockedTurn=null),this.checkpointed&&this.active!==null&&this.active.sessionId===e&&this.active.turn===t&&this.active.step===n&&!r.startsWith(this.observed)){this.prime(e,t,n,r);return}this.beforePlayback?.();let o=classifyLiveSpeechTransition(this.active,i);o===`new-turn`||o===`same-step`&&!r.startsWith(this.observed)?this.reset(i):o===`same-turn`&&this.advance(i),this.observed=r,this.drain(!1)}prime(e,t,n,r){this.sessionId!==e||this.manuallyStoppedTurns.has(`${e}:${t}`)||(this.reset({sessionId:e,turn:t,step:n}),this.observed=r,this.consumed=r.length,this.checkpointed=!0)}finish(e,t){if(this.sessionId!==e)return;let n=`${e}:${t.turn}:${t.step}`;if(this.blockedTurn===`${e}:${t.turn}`||this.manuallyStoppedTurns.has(`${e}:${t.turn}`)){this.messageId=t.messageId,this.reportStatus(),this.handled.add(n);return}if(!(this.sessionId!==e||this.active===null||`${this.active.sessionId}:${this.active.turn}:${this.active.step}`!==n)){if(t.interrupted){this.cancel();return}t.text.startsWith(this.observed)&&(this.observed=t.text),this.messageId=t.messageId,this.reportStatus(),this.drain(!0),this.handled.add(n)}}playCompleted(e,t,n,r){if(this.sessionId!==e||n.length===0)return;this.beforePlayback?.(),this.resetState(),this.activeVoiceRate=this.voiceRate,this.messageId=t,this.completedFallback=r??null;let i=this.segments(n);if(i.length===0){this.setStatus(`error`,`no-text`);return}this.setStatus(`loading`);for(let e of i)this.queue.enqueue(e)}async pause(e){return this.sessionId!==e||this.status!==`playing`?!1:this.localVoiceEngine===`moss`&&this.mossHandle!==null?(this.mossHandle.pause(),this.setStatus(`paused`),!0):window.speechSynthesis===void 0?!1:(window.speechSynthesis.pause(),this.setStatus(`paused`),!0)}async resume(e){return this.sessionId!==e||this.status!==`paused`?!1:this.localVoiceEngine===`moss`&&this.mossHandle!==null?(await this.mossHandle.resume(),this.status===`paused`&&this.setStatus(`playing`),!0):window.speechSynthesis===void 0?!1:(window.speechSynthesis.resume(),this.setStatus(`playing`),!0)}stop(e){return this.sessionId!==e||this.status!==`loading`&&this.status!==`playing`&&this.status!==`paused`?!1:(this.active!==null&&this.manuallyStoppedTurns.add(`${e}:${this.active.turn}`),this.resetState(),!0)}blockTurn(e,t){this.sessionId===e&&(this.manuallyStoppedTurns.add(`${e}:${t}`),this.active?.turn===t&&this.resetState())}hasHandled(e,t){return t===null?!1:this.blockedTurn===`${e}:${t.turn}`||this.manuallyStoppedTurns.has(`${e}:${t.turn}`)||this.handled.has(`${e}:${t.turn}:${t.step}`)}cancel(){this.blockedTurn=null,this.resetState()}interrupt(){this.active!==null&&(this.blockedTurn=`${this.active.sessionId}:${this.active.turn}`),this.resetState()}cancelSession(e){this.sessionId===e&&this.cancel()}dispose(){this.cancel(),this.handled.clear(),this.manuallyStoppedTurns.clear(),this.onStateChange=null}reset(e){this.resetState(),this.activeVoiceRate=this.voiceRate,this.active=e,this.setStatus(`idle`)}advance(e){this.checkpointed=!1,this.drain(!0),this.active=e,this.observed=``,this.consumed=0,this.pendingText=``}resetState(){this.checkpointed=!1,this.generation+=1,this.queue.cancel(),this.mossHandle?.stop(),this.mossHandle=null,this.current!==null&&typeof window<`u`&&window.speechSynthesis!==void 0&&window.speechSynthesis.cancel(),this.current=null,this.queue=this.createQueue(),this.active=null,this.observed=``,this.consumed=0,this.pendingText=``,this.completedFallback=null,this.audioStarted=!1,this.setStatus(`idle`),this.messageId=null}drain(e){let{sentences:t,remainder:n,consumed:r,inCode:i}=splitCompletedTtsSentences(this.observed.slice(this.consumed)),a=e&&!i&&n.trim().length>0?[...t,n]:t;this.consumed+=r,e&&(this.consumed=this.observed.length);for(let e of a){let t=prepareSpeechText(e),n=batchTtsStreamText(this.pendingText,t,!1);this.pendingText=n.pending,n.request!==null&&this.enqueueLive(n.request)}if(e){let e=prepareSpeechText(this.pendingText);this.pendingText=``,e.length>0&&this.enqueueLive(e)}}enqueueLive(e){this.active!==null&&this.handled.add(`${this.active.sessionId}:${this.active.turn}:${this.active.step}`),this.queue.enqueue(e)}segments(e){return splitTtsSegments(e)}createQueue(){let e=this.generation;return new AbortableSentenceQueue((t,n)=>this.speak(t,n,e),{onBusyChange:t=>{e===this.generation&&(t&&this.status===`idle`&&this.setStatus(`loading`),!t&&(this.status===`loading`||this.status===`playing`)&&this.setStatus(`idle`))},onError:t=>{if(e!==this.generation)return;let n=t instanceof Error?t.message:`local-speech-failed`,r=!this.audioStarted;if(r&&this.completedFallback!==null){let e=this.completedFallback;this.resetState(),e();return}if(r&&this.active!==null&&this.fallbackHandler!==null){let e=this.fallbackHandler,t=this.active,n=this.observed;this.resetState(),e(t,n);return}this.active!==null&&(this.blockedTurn=`${this.active.sessionId}:${this.active.turn}`),this.setStatus(`error`,n)}})}speak(e,t,n){if(n!==this.generation||t.aborted)return Promise.resolve();if(this.localVoiceEngine===`moss`)return this.speakMoss(e,t,n);if(typeof window>`u`||window.speechSynthesis===void 0)return Promise.reject(Error(`local-speech-unavailable`));let r=chooseVoice(this.voiceURI);return r===void 0?Promise.reject(Error(`local-voice-unavailable`)):new Promise((i,a)=>{let o=new SpeechSynthesisUtterance(e);o.voice=r,o.lang=r.lang,o.volume=this.volume,applySpeechVoiceRate(o,this.activeVoiceRate),this.current=o;let s=!1,c=null,abort=()=>{},cleanup=()=>{o.onstart=null,o.onend=null,o.onerror=null,t.removeEventListener(`abort`,abort),c!==null&&window.clearTimeout(c),this.current===o&&(this.current=null)},finish=e=>{s||(s=!0,cleanup(),e===void 0?i():a(e))};abort=()=>{this.current===o&&window.speechSynthesis.cancel(),finish()},o.onstart=()=>{n===this.generation&&!t.aborted&&(this.audioStarted=!0,this.setStatus(`playing`))},o.onend=()=>finish(),o.onerror=e=>{t.aborted||e.error===`canceled`||e.error===`interrupted`?finish():finish(Error(e.error===`not-allowed`?`local-speech-not-allowed`:e.error===`audio-busy`?`local-speech-audio-device`:`local-speech-failed`))},t.addEventListener(`abort`,abort,{once:!0}),c=window.setTimeout(()=>{let e=this.current===o;finish(Error(`local-speech-timeout`)),e&&window.speechSynthesis.cancel()},this.timeoutMs),window.speechSynthesis.speak(o)})}async speakMoss(e,t,n){if(this.mossBaseURL.trim().length===0)throw Error(`moss-invalid-url`);if(this.mossVoice.trim().length===0)throw Error(`moss-voice-required`);let r;try{r=await fetchMossAudio(e,{baseURL:this.mossBaseURL,voice:this.mossVoice},t)}catch(e){if(t.aborted||n!==this.generation)return;throw e instanceof MossRequestError?Error(e.code):e}if(t.aborted||n!==this.generation)return;let i=playMossAudio(r,{volume:this.volume,rate:this.activeVoiceRate,timeoutMs:this.timeoutMs,onStart:()=>{n!==this.generation||t.aborted||(this.audioStarted=!0,this.setStatus(`playing`))}});this.mossHandle=i;let abort=()=>{i.stop()};t.addEventListener(`abort`,abort,{once:!0});try{await i.done}finally{t.removeEventListener(`abort`,abort),this.mossHandle===i&&(this.mossHandle=null)}}setStatus(e,t=null){this.status===e&&this.error===t||(this.status=e,this.error=e===`error`?t:null,this.reportStatus())}reportStatus(){this.sessionId!==null&&this.messageId!==null&&this.onStateChange?.(this.sessionId,this.messageId,this.status,this.error)}};async function prefetchSegmentAudio(e,t){try{let n,r=speechRequestBody({text:e,format:`wav`});for(let e=0;e<(externalEngine()?1:2);e+=1){t.throwIfAborted();try{let e=await fetch(hostRoute(h),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r),signal:t});if(!e.ok)throw Error(`segment-request-${e.status}`);return{ok:!0,blob:await e.blob()}}catch(e){n=e}}throw n}catch(e){return{ok:!1,error:e}}}function playSegmentAudio(e,t){let n=URL.createObjectURL(e),r;try{r=new Audio(n),r.volume=t.volume,applyMediaVoiceRate(r,t.voiceRate)}catch(e){return URL.revokeObjectURL(n),Promise.reject(e)}return t.onCreated(r),new Promise((e,i)=>{let a=!1,finish=o=>{a||(a=!0,r.removeEventListener(`ended`,ended),r.removeEventListener(`error`,failed),t.signal.removeEventListener(`abort`,aborted),r.pause(),r.removeAttribute(`src`),r.load(),URL.revokeObjectURL(n),t.onReleased(r),o===void 0?e():i(o))},ended=()=>finish(),failed=()=>finish(Error(`segment-play-failed`)),aborted=()=>finish(t.signal.reason??new DOMException(`Playback cancelled`,`AbortError`));if(r.addEventListener(`ended`,ended),r.addEventListener(`error`,failed),t.signal.addEventListener(`abort`,aborted,{once:!0}),t.signal.aborted){aborted();return}r.play().then(()=>{!a&&!t.signal.aborted&&t.onStarted()}).catch(()=>finish(Error(t.automatic?`autoplay-blocked`:`play-failed`)))})}var PlaybackController=class{constructor(e){this.history=e}autoPlayArmedAt=Date.now();view={sessionId:null,messageId:null,source:null,status:`idle`,error:null};listeners=new Set;automaticallyPlayed=new Set;liveSessions=new Set;completedSessions=new Set;completedMessages=new Map;attachedMidRun=new Set;current=null;segmentQueue=new Set;segmentedState=null;request=null;generation=0;activeSessionId=null;beforePlayback=null;volume=1;voiceRate=1;selection;configure(e){this.selection=ttsSelection(e),this.voiceRate=normalizeVoiceRate(e.voiceRate)}getSnapshot=()=>this.view;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));setBeforePlayback(e){this.beforePlayback=e}setVolume(e){this.volume=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1,this.current!==null&&(this.current.audio.volume=this.volume);for(let e of this.segmentQueue)e.volume=this.volume}setVoiceRate(e){this.voiceRate=normalizeVoiceRate(e),(this.selection?.provider===`doubao`||this.selection?.provider===`breeze`)&&(this.selection={...this.selection,voiceRate:this.voiceRate})}interrupt(){this.generation+=1,this.stopCurrent(),this.segmentedState=null,this.publish(this.emptyView())}activateSession(e){this.activeSessionId!==e&&(this.generation+=1,this.stopCurrent(),this.segmentedState=null,this.liveSessions.clear(),this.completedSessions.clear(),this.completedMessages.clear(),this.attachedMidRun.clear(),this.activeSessionId=e,this.publish(this.emptyView()))}cancelPlayback(e){this.activeSessionId===e&&(this.segmentedState=null,this.generation+=1,this.stopCurrent(),this.publish(this.emptyView()))}deactivateSession(e){this.activeSessionId===e&&(this.generation+=1,this.stopCurrent(),this.segmentedState=null,this.liveSessions.clear(),this.completedSessions.clear(),this.completedMessages.clear(),this.attachedMidRun.clear(),this.activeSessionId=null,this.publish(this.emptyView()))}observeSession(e,t,n,r=!1){if(this.activeSessionId===e){if(t){r?this.attachedMidRun.add(e):this.attachedMidRun.delete(e),this.liveSessions.add(e),this.completedSessions.delete(e),this.completedMessages.delete(e);return}this.liveSessions.delete(e)&&this.completedSessions.add(e),this.completedSessions.has(e)&&n!==null&&this.completedMessages.set(e,n)}}claimAutomaticPlayback(e,t){if(this.activeSessionId!==e)return!1;let n=`${e}:${t}`;return this.completedMessages.get(e)!==t||this.attachedMidRun.has(e)||this.automaticallyPlayed.has(n)?!1:(this.automaticallyPlayed.add(n),this.completedSessions.delete(e),this.completedMessages.delete(e),!0)}updateLivePlayback(e,t,n,r=`live`,i=null){if(this.activeSessionId===e){if(n===`idle`){this.view.source===r&&this.view.messageId===t&&this.publish(this.emptyView());return}this.view.source!==`complete`&&this.publish({sessionId:e,messageId:t,source:r,status:n,error:n===`error`?i??`play-failed`:null})}}resetAutomaticPlayback(){this.autoPlayArmedAt=Date.now(),this.liveSessions.clear(),this.completedSessions.clear(),this.completedMessages.clear(),this.attachedMidRun.clear()}pauseSegmented(e,t){this.activeSessionId!==e||this.view.source!==`segmented`||this.view.messageId!==t||(this.generation+=1,this.stopCurrent(),this.publish({sessionId:e,messageId:t,source:`segmented`,status:`paused`,error:null}))}async segmented(e,t,n,r,i){if(this.activeSessionId!==e)return;this.beforePlayback?.();let a=this.segmentedState,o=a!==null&&a.sessionId===e&&a.messageId===t;this.stopCurrent();let s=o?a.segments:externalEngine()?splitExternalText(n):this.selection?.provider===`breeze`?splitBreezeTtsSegments(n):splitTtsSegments(n,void 0,void 0,e=>prepareProviderTtsText(e,this.selection??{})),c=o?a.index:0,l=o?a.voiceRate:this.voiceRate;if(s.length===0){this.publish({sessionId:e,messageId:t,source:`segmented`,status:`error`,error:`no-text`});return}let u={sessionId:e,messageId:t,segments:s,index:c,voiceRate:l};this.segmentedState=u;let d=++this.generation,p=new AbortController;this.request=p;let m=!1;this.publish({sessionId:e,messageId:t,source:`segmented`,status:`loading`,error:null});try{let n=prefetchSegmentAudio(s[c],p.signal);for(let i=c;i<s.length;i+=1){u.index=i;let a=await n;if(d!==this.generation||this.activeSessionId!==e)return;if(!a.ok)throw a.error;let o=a.blob;if(this.history?.add({blob:o,text:s[i],format:`wav`,source:`conversation`,sessionId:e,messageId:t}),i+1<s.length&&(n=prefetchSegmentAudio(s[i+1],p.signal)),await playSegmentAudio(o,{signal:p.signal,volume:this.volume,voiceRate:l,automatic:r,onCreated:e=>{this.segmentQueue.add(e)},onReleased:e=>{this.segmentQueue.delete(e)},onStarted:()=>{d!==this.generation||this.activeSessionId!==e||(m=!0,this.publish({sessionId:e,messageId:t,source:`segmented`,status:`playing`,error:null}))}}),d!==this.generation||this.activeSessionId!==e)return;u.index=i+1}d===this.generation&&this.activeSessionId===e&&(this.segmentedState=null,this.publish(this.emptyView()))}catch(n){if(!p.signal.aborted&&d===this.generation&&this.activeSessionId===e){if(p.abort(),!m&&i!==void 0){this.segmentedState=null,this.publish(this.emptyView()),i();return}this.publish({sessionId:e,messageId:t,source:`segmented`,status:`error`,error:n instanceof Error?n.message:String(n)})}}finally{d===this.generation&&(this.request=null)}}async toggle(e,t,n,r,i,a=`mp3`){if(this.activeSessionId!==e)return;if(this.beforePlayback?.(),this.view.source===`complete`&&this.view.sessionId===e&&this.view.messageId===t&&this.current!==null){let n=this.current.audio,i=this.generation;if(n.paused)try{if(await n.play(),i!==this.generation||this.activeSessionId!==e||this.current?.audio!==n)return;this.publish({sessionId:e,messageId:t,source:`complete`,status:`playing`,error:null})}catch{if(i!==this.generation||this.activeSessionId!==e||this.current?.audio!==n)return;this.publish({sessionId:e,messageId:t,source:`complete`,status:`paused`,error:r?`autoplay-blocked`:`play-failed`})}else n.pause(),this.publish({sessionId:e,messageId:t,source:`complete`,status:`paused`,error:null});return}if(n.length===0){this.publish({sessionId:e,messageId:t,source:`complete`,status:`error`,error:`no-text`});return}this.stopCurrent();let o=this.selection,s=!externalEngine()&&(o?.provider===`doubao`||o?.provider===`breeze`),c=s?1:this.voiceRate,l=++this.generation,u=new AbortController;this.request=u;let d=!1;this.publish({sessionId:e,messageId:t,source:`complete`,status:`loading`,error:null});try{let i=await fetch(hostRoute(h),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(speechRequestBody({...o,text:n,format:a})),signal:u.signal});if(!i.ok){let e=`${i.status}`;try{let t=await i.json();typeof t.message==`string`?e=t.message:typeof t.error==`string`&&(e=t.error)}catch{}throw Error(e)}let p=await i.blob();if(l!==this.generation||this.activeSessionId!==e)return;let m=i.headers.get(`content-type`)?.includes(`wav`)?`wav`:a;this.history?.add({blob:p,text:n,format:m,source:`conversation`,sessionId:e,messageId:t,voiceRateApplied:s});let g=URL.createObjectURL(p),_=new Audio(g);_.volume=this.volume,applyMediaVoiceRate(_,c),d=!0;let v={url:g,audio:_,onEnded:()=>{this.activeSessionId!==e||this.current?.audio!==_||(this.releaseCurrentAudio(_),this.publish(this.emptyView()))},onError:()=>{this.activeSessionId!==e||this.current?.audio!==_||(this.releaseCurrentAudio(_),this.publish({sessionId:e,messageId:t,source:`complete`,status:`error`,error:`play-failed`}))}};this.current=v,this.request=null,_.addEventListener(`ended`,v.onEnded),_.addEventListener(`error`,v.onError);try{if(await _.play(),l!==this.generation||this.activeSessionId!==e||this.current?.audio!==_)return;this.publish({sessionId:e,messageId:t,source:`complete`,status:`playing`,error:null})}catch{if(l!==this.generation||this.activeSessionId!==e||this.current?.audio!==_)return;this.publish({sessionId:e,messageId:t,source:`complete`,status:`paused`,error:r?`autoplay-blocked`:`play-failed`})}}catch(n){if(u.signal.aborted||l!==this.generation||this.activeSessionId!==e)return;if(!d&&i!==void 0){this.request=null,this.publish(this.emptyView()),i();return}this.request=null,this.publish({sessionId:e,messageId:t,source:`complete`,status:`error`,error:n instanceof Error?n.message:String(n)})}}dispose(){this.generation+=1,this.stopCurrent(),this.segmentedState=null,this.liveSessions.clear(),this.completedSessions.clear(),this.completedMessages.clear(),this.activeSessionId=null,this.listeners.clear()}stopCurrent(){this.request?.abort(),this.request=null,this.segmentQueue.clear(),this.current!==null&&this.releaseCurrentAudio(this.current.audio)}releaseCurrentAudio(e){if(this.current?.audio!==e)return;let t=this.current;this.current=null,e.removeEventListener(`ended`,t.onEnded),e.removeEventListener(`error`,t.onError),e.pause(),e.removeAttribute(`src`),e.load(),URL.revokeObjectURL(t.url)}emptyView(){return{sessionId:null,messageId:null,source:null,status:`idle`,error:null}}publish(e){if(!(this.view.sessionId===e.sessionId&&this.view.messageId===e.messageId&&this.view.source===e.source&&this.view.status===e.status&&this.view.error===e.error)){this.view=e;for(let e of this.listeners)e()}}},XiaomiMimoTtsPcmService=class extends p.Service{audio=new PcmAudioQueue({onBusyChange:e=>{this.audioBusy=e,this.refreshPriority()},onPlaybackStart:()=>{}});request=null;generation=0;disposed=!1;audioBusy=!1;media=null;externalGeneration=null;priorityGeneration=null;priorityBusy=!1;priorityListeners=new Set;priorityActivity={getSnapshot:()=>this.priorityBusy,subscribe:e=>(this.priorityListeners.add(e),()=>{this.priorityListeners.delete(e)})};refreshPriority(){let e=this.priorityGeneration===this.generation&&this.isBusy();if(e!==this.priorityBusy){this.priorityBusy=e;for(let e of this.priorityListeners)e()}}isBusy=()=>this.request!==null||this.audioBusy;tryPlay(e,t,n){if(this.isBusy()&&this.priorityGeneration===this.generation||n===void 0&&(this.isBusy()||t()))return null;let r=this.generation;if(this.start(e,!1,n),this.generation===r)return null;let i=this.generation;return n!==void 0&&(this.priorityGeneration=i),this.refreshPriority(),()=>{this.generation===i&&this.stop()}}constructor(e,t,n,r,i=()=>!0){super(e,`xiaomiMimoTts`),this.settings=t,this.interruptConversationPlayback=n,this.history=r,this.canPlay=i}play(e){try{if(this.isBusy()&&this.priorityGeneration===this.generation||!resolveTtsSettings(this.settings.getSnapshot().value).announcementSources.includes(`dsh-whale-musume`))return;let t=this.generation;this.start(e),t!==this.generation&&(this.externalGeneration=this.generation)}catch(e){this.ctx.logger.warn(`xiaomi-mimo-tts: optional playback settings unavailable: ${String(e)}`)}}stopExternal(){this.externalGeneration===this.generation&&this.stop()}start(e,t=!0,n){try{if(this.disposed||!this.canPlay()||!engineCanRequest()||typeof e!=`string`)return;let r=this.settings.getSnapshot();if(r.status!==`ready`||r.value?.enabled!==!0)return;let i=resolveTtsSettings(r.value),a=engineText(e,()=>prepareProviderTtsText(e,i)).trim();if(a.length===0)return;this.stop(),this.history?.stopReplay(),n?.(),t&&this.interruptConversationPlayback(),this.audio.setMaxPausedPcmBytes(i.maxPausedPcmBytes),this.audio.setVolume(i.voiceVolume),this.audio.setPlaybackRate(externalEngine()||i.provider===`xiaomi`?i.voiceRate:1);let o=this.generation,s=new AbortController;this.request=s;let c=new PcmRecording,consume=async e=>{this.disposed||s.signal.aborted||o!==this.generation||(c.appendBytes(e),await this.audio.enqueueBytes(e))},synthesize=async()=>{let e=externalEngine();if(e?.streaming){for(let e of splitExternalText(a,engineMaxTextLength(i.maxTextLength)))await streamPcmAudio(e,s.signal,async e=>{this.disposed||s.signal.aborted||o!==this.generation||(c.append(e),await this.audio.enqueue(e))});return}if(e&&!e.streaming){let e=engineMaxTextLength(i.maxTextLength);for(let t of splitExternalText(a,e)){s.signal.throwIfAborted();let e=await prefetchSegmentAudio(t,s.signal);if(!e.ok)throw e.error;s.signal.throwIfAborted(),this.history?.add({blob:e.blob,text:t,format:`wav`,source:`service`,voiceRateApplied:!1}),await playSegmentAudio(e.blob,{signal:s.signal,volume:i.voiceVolume,voiceRate:i.voiceRate,automatic:!1,onCreated:e=>{this.media=e},onReleased:()=>{this.media=null},onStarted:()=>{}})}return}if(!e&&i.provider===`doubao`){let e=new DuplexPcmStream(ttsSelection(i),s.signal,consume,i.maxPausedPcmBytes,i.requestTimeoutMs,i.maxTextLength);e.append(a),await e.finish();return}await streamPcmAudio(a,s.signal,async e=>{this.disposed||s.signal.aborted||o!==this.generation||(c.append(e),await this.audio.enqueue(e))},ttsSelection({...i,model:`mimo-v2.5-tts`}))};synthesize().then(()=>{!this.disposed&&!s.signal.aborted&&o===this.generation&&c.save(this.history,{text:a,source:`service`,voiceRateApplied:!externalEngine()&&i.provider!==`xiaomi`})}).catch(e=>{this.disposed||s.signal.aborted||o!==this.generation||(this.ctx.logger.warn(`xiaomi-mimo-tts: optional PCM playback failed: ${e instanceof Error?e.message:String(e)}`),this.audio.stop())}).finally(()=>{this.request===s&&(this.request=null),this.refreshPriority()})}catch(e){this.ctx.logger.warn(`xiaomi-mimo-tts: optional PCM playback could not start: ${e instanceof Error?e.message:String(e)}`)}}stop(){try{this.generation+=1,this.priorityGeneration=null,this.request?.abort(),this.request=null,this.audio.stop(),this.refreshPriority()}catch(e){this.ctx.logger.warn(`xiaomi-mimo-tts: optional PCM playback could not stop cleanly: ${e instanceof Error?e.message:String(e)}`)}}setVolume(e){this.audio.setVolume(e),this.media&&(this.media.volume=e)}async dispose(){this.disposed||(this.disposed=!0,this.stop(),await this.audio.dispose())}};async function configureExternal(e,t,n=e.revision){let r=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/engine-selection`),{method:`POST`,headers:{"content-type":`application/json`,[_]:`1`},body:JSON.stringify({provider:e.provider,engineRevision:n,...t})}),i=await r.json();if(!r.ok)throw Error(i.error??`external-configuration-failed`);(ri.getSnapshot().engine?.revision??-1)<=i.revision&&ri.accept(i)}let saveExternalSelection=(e,t,n=e.revision)=>configureExternal(e,{selection:t},n),switchExternalConfiguration=(e,t)=>configureExternal(e,{configurationId:t});function nextExternalConfiguration(e){let t=e.configurations??[];if(!(!e.configurationSwitchable||t.length<2))return t[(t.findIndex(t=>t.id===e.configurationId)+1)%t.length]}function useExternalSelection(e){let t=e?`${e.provider}/${e.configurationId??``}`:``,[n,r]=(0,l.useState)(null),i=n?.identity===t&&(n.revision===e?.revision||JSON.stringify(n.value)!==JSON.stringify(e?.selection))?n:null,a=i?.value??e?.selection,o=!!i&&JSON.stringify(i.value)!==JSON.stringify(e?.selection),change=n=>{e?.configurable&&r({identity:t,revision:i?.revision??e.revision,value:n})};return{value:a,dirty:o,change,discard:()=>r(null),save:async()=>{!e||!i||!o||(await saveExternalSelection(e,i.value,i.revision),r(null))}}}function GoHistory(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M11.998 2.5A9.503 9.503 0 0 0 3.378 8H5.75a.75.75 0 0 1 0 1.5H2a1 1 0 0 1-1-1V4.75a.75.75 0 0 1 1.5 0v1.697A10.997 10.997 0 0 1 11.998 1C18.074 1 23 5.925 23 12s-4.926 11-11.002 11C6.014 23 1.146 18.223 1 12.275a.75.75 0 0 1 1.5-.037 9.5 9.5 0 0 0 9.498 9.262c5.248 0 9.502-4.253 9.502-9.5s-4.254-9.5-9.502-9.5Z`},child:[]},{tag:`path`,attr:{d:`M12.5 7.25a.75.75 0 0 0-1.5 0v5.5c0 .27.144.518.378.651l3.5 2a.75.75 0 0 0 .744-1.302L12.5 12.315V7.25Z`},child:[]}]})(e)}let yi=`showInSidebar.showInHostSettings.showFeatureGuide.acceptExternalProviders.qqbotEnabled.announcementSources.provider.doubaoModel.doubaoVoice.doubaoClonedVoice.doubaoInstruction.doubaoEnabled.breezeEnabled.breezeVoice.breezeInstruction.instruction.enabled.autoPlay.voiceInputCompatibility.inputAvoidance.importantAnnouncementsFirst.voiceVolume.voiceRate.readScope.model.localSpeechMode.localVoiceURI.localVoiceEngine.mossEnabled.mossBaseURL.mossVoice.mossVoiceName.voice.voiceDesignPrompt.voiceDesignCustomPrompt.soundEnabled.soundVolume.soundPack.taskSounds.clickSounds`.split(`.`),bi=new Set([`provider`,`apiKey`,`doubaoEnabled`,`doubaoApiKey`,`doubaoModel`,`doubaoVoice`,`doubaoClonedVoice`,`doubaoInstruction`,`breezeEnabled`,`breezeApiKey`,`breezeVoice`,`breezeInstruction`,`instruction`,`model`,`voice`,`voiceDesignPrompt`,`voiceDesignCustomPrompt`]);var SaveSettingsError=class extends Error{constructor(e){super(e),this.code=e,this.name=`SaveSettingsError`}};function validateSettingsDraft(e){return e.provider===`doubao`&&!(e.doubaoModel===`seed-icl-2.0`?e.doubaoClonedVoice:e.doubaoVoice).trim()?`voice-required`:null}async function saveSettingsDraft(e,t,n,r,i=!1){i&&(n=Object.fromEntries(Object.entries(n).filter(([e])=>!bi.has(e))));let a=i?null:validateSettingsDraft(t);if(a)throw new SaveSettingsError(a);for(let[e,t]of[[`xiaomi`,`apiKey`],[`doubao`,`doubaoApiKey`],[`breeze`,`breezeApiKey`]])if(n[t]?.kind===`set`&&r[e].trim()&&!isSupportedTtsApiKey(r[e],e))throw new SaveSettingsError(`api-key-rejected`);let o=e.getSnapshot(),s=resolveTtsSettings(o.value),overridden=e=>o.user!==null&&typeof o.user==`object`&&Object.hasOwn(o.user,e),c=[],write=(e,t)=>{let r=n[e];r&&(r.kind===`set`&&(Array.isArray(t)?JSON.stringify(s[e])===JSON.stringify(t):Object.is(s[e],t))||r.kind===`clear`&&!overridden(e)||c.push(r.kind===`clear`?{op:`unset`,path:[e]}:{op:`set`,path:[e],value:t}))};for(let e of yi)e!==`provider`&&write(e,t[e]);for(let[e,t]of[[`xiaomi`,`apiKey`],[`doubao`,`doubaoApiKey`],[`breeze`,`breezeApiKey`]])n[t]?.kind===`set`&&r[e].trim()&&c.push({op:`set`,path:[t],value:r[e].trim()});if(write(`provider`,t.provider),c.length&&!await e.mutate(c))throw new SaveSettingsError(`host-rejected`)}function browserVoice(e){if(typeof window>`u`||window.speechSynthesis===void 0)return;let t=window.speechSynthesis.getVoices(),n=typeof navigator>`u`?`zh-CN`:navigator.language||`zh-CN`;return t.find(t=>t.voiceURI===e)??t.find(e=>e.lang.toLowerCase()===`zh-cn`)??t.find(e=>e.lang.toLowerCase().startsWith(n.toLowerCase().split(`-`)[0]??`zh`))??t.find(e=>e.default)??t[0]}function pcmDelta(e){if(e===`[DONE]`)return null;let t=JSON.parse(e),n=typeof t.error==`string`?t.error:t.error?.message;if(n!==void 0)throw Error(n);let r=t.choices?.[0]?.delta?.audio?.data;return typeof r==`string`&&r.length>0?r:null}var PreviewPlaybackError=class extends Error{constructor(e,t=e){super(t),this.code=e}};function previewError(e){if(e instanceof DuplexPcmError){if(e.code===`tts-timeout`)return`timeout`;if([`api-key-not-configured`,`api-key-rejected`,`rate-limited`,`voice-required`,`voice-unavailable`,`resource-unavailable`,`stream-buffer-limit`].includes(e.code))return e.code}return e instanceof PreviewPlaybackError?e.code:`request-failed`}async function responseError(e){let t=``,n=`request-${e.status}`;try{let r=await e.json();typeof r.error==`string`&&(t=r.error),typeof r.message==`string`?n=r.message:t.length>0&&(n=t)}catch{}return new PreviewPlaybackError(e.status===409&&t===`api-key-not-configured`?`api-key-not-configured`:e.status===401||e.status===403?`api-key-rejected`:e.status===429?`rate-limited`:e.status===504||t===`xiaomi-timeout`?`timeout`:`request-failed`,n)}var PreviewPlayer=class{pcm=new PcmAudioQueue({onBusyChange:e=>{this.pcmBusy=e,this.maybeFinishPcm()},onPlaybackStart:()=>{this.remoteStarted=!0,this.publish(`playing`)}});generation=0;request=null;audio=null;audioUrl=null;finishAudio=null;utterance=null;finishUtterance=null;mossHandle=null;requestBusy=!1;pcmBusy=!1;status=`idle`;source=null;error=null;volume=1;voiceRate=1;recording=null;remoteStarted=!1;constructor(e,t){this.onViewChange=e,this.history=t}getView(){return{status:this.status,source:this.source,error:this.error}}getRecording(){return this.recording}setRecording(e){this.recording=e,this.onViewChange(this.getView())}setVolume(e){this.volume=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1,this.pcm.setVolume(this.volume),this.audio!==null&&(this.audio.volume=this.volume),this.utterance!==null&&(this.utterance.volume=this.volume)}async play(e,t){this.history?.stopReplay(),this.stop(),this.setVolume(t.voiceVolume),this.voiceRate=normalizeVoiceRate(t.voiceRate),this.pcm.setPlaybackRate(this.voiceRate);let n=e.trim();if(n.length===0){this.publish(`error`,null,`request-failed`);return}let r=this.generation,i=externalEngine()?externalFallbackText(n,t.externalSelection):engineText(n,()=>t.provider===`breeze`?stripBreezeAudioTags(n):(t.provider??`xiaomi`)===`xiaomi`?stripXiaomiAudioTags(n):n);try{if(t.localSpeechMode===`local-first`)try{await this.playLocal(i,t,r)}catch{r===this.generation&&await this.playRemote(n,t,r)}else try{await this.playRemote(n,t,r)}catch(e){if(t.localSpeechMode!==`auto`||r!==this.generation||this.remoteStarted)throw e;this.request=null,this.requestBusy=!1,this.pcmBusy=!1,this.pcm.stop();try{await this.playLocal(i,t,r)}catch{throw e}}r===this.generation&&this.status!==`playing`&&this.publish(`idle`,this.source)}catch(e){r===this.generation&&(this.request=null,this.requestBusy=!1,this.pcmBusy=!1,this.pcm.stop(),this.publish(`error`,this.source,previewError(e)))}}async playBrowserPreview(e,t){this.stop(),this.setVolume(t.voiceVolume),this.voiceRate=normalizeVoiceRate(t.voiceRate);let n=this.generation;try{await this.playLocal(e,{localVoiceURI:t.localVoiceURI,localVoiceEngine:`browser`,mossBaseURL:``,mossVoice:``,voiceVolume:t.voiceVolume,voiceRate:t.voiceRate},n),n===this.generation&&this.publish(`idle`,`local`)}catch(e){n===this.generation&&this.publish(`error`,`local`,previewError(e))}}stop(){this.remoteStarted=!1,this.generation+=1,this.request?.abort(),this.request=null,this.requestBusy=!1,this.pcmBusy=!1,this.pcm.stop(),this.finishAudio?.(),this.finishAudio=null,this.audio!==null&&(this.audio.pause(),this.audio.removeAttribute(`src`),this.audio.load(),this.audio=null),this.audioUrl!==null&&(URL.revokeObjectURL(this.audioUrl),this.audioUrl=null);let e=this.utterance;this.finishUtterance?.(),this.finishUtterance=null,this.mossHandle?.stop(),this.mossHandle=null,e!==null&&typeof window<`u`&&window.speechSynthesis!==void 0&&(window.speechSynthesis.cancel(),this.utterance=null),this.publish(`idle`,null),this.recording!==null&&this.setRecording(null)}async dispose(){this.stop(),await this.pcm.dispose()}requestBody(e,t,n){let r=t.provider===`breeze`,i=r?t.breezeInstruction:t.instruction;return{text:e,provider:t.provider??`xiaomi`,model:r?le:t.model,voice:r?t.breezeVoice??``:t.voice,voiceDesignPrompt:t.voiceDesignPrompt,...i===void 0?{}:{speechInstruction:i},...r?{voiceRate:normalizeVoiceRate(t.voiceRate)}:{},...n===void 0?{}:{format:n}}}async playRemote(e,t,n){let r=externalEngine();if(r){for(let i of splitExternalText(e,r.maxTextLength,t.externalSelection)){if(n!==this.generation)return;r.streaming&&(!t.externalSelection||r.models?.find(e=>e.id===t.externalSelection?.model)?.streaming)?await this.playPcm(i,t,n):await this.playComplete(i,t,n,`wav`,`external`)}return}if(t.provider===`doubao`){this.pcm.setPlaybackRate(1),this.publish(`loading`,`doubao`);let r=new AbortController;this.request=r,this.requestBusy=!0;let i=new PcmRecording;try{let a=new DuplexPcmStream(ttsSelection(resolveTtsSettings(t)),r.signal,async e=>{n!==this.generation||r.signal.aborted||(i.appendBytes(e),await this.pcm.enqueueBytes(e))});if(a.append(e),await a.finish(),n===this.generation){let t=i.toWav();t!==null&&this.setRecording({blob:t,text:e,format:`wav`}),i.save(this.history,{text:e,source:`preview`,voiceRateApplied:!0})}}finally{r.abort(),n===this.generation&&(this.request=null,this.requestBusy=!1,this.maybeFinishPcm())}return}if(t.provider===`breeze`){this.pcm.setPlaybackRate(1),this.publish(`loading`,`breeze`),splitBreezeTtsSegments(e).length>1?await this.playSegmented(e,t,n):await this.playComplete(e,t,n,`mp3`,`breeze`);return}if(t.model===`mimo-v2.5-tts-voicedesign`){splitTtsSegments(e).length>1?await this.playSegmented(e,t,n):await this.playComplete(e,t,n,`mp3`);return}await this.playPcm(e,t,n)}async playComplete(e,t,n,r,i=`mimo`,a=!0){this.publish(`loading`,i);let o=new AbortController;this.request=o;let s=await fetch(hostRoute(h),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(speechRequestBody({...this.requestBody(e,t,r)},t.externalSelection)),signal:o.signal});if(!s.ok)throw await responseError(s);let c=await s.blob();if(n!==this.generation)return;a&&c.size>0&&this.setRecording({blob:c,text:e,format:r});let l=!externalEngine()&&t.provider===`breeze`;this.history?.add({blob:c,text:e,format:r,source:`preview`,voiceRateApplied:l}),this.request=null;let u=URL.createObjectURL(c),d=new Audio(u);d.volume=this.volume,applyMediaVoiceRate(d,l?1:this.voiceRate),this.audioUrl=u,this.audio=d,await new Promise((e,t)=>{let r=!1,cleanup=()=>{d.onended=null,d.onerror=null,this.finishAudio===finish&&(this.finishAudio=null)},finish=a=>{r||(r=!0,cleanup(),this.releaseAudio(d),n===this.generation&&(a===void 0?this.publish(`idle`,i):this.publish(`error`,i,previewError(a))),a===void 0?e():t(a))};this.finishAudio=()=>finish(),d.onended=()=>finish(),d.onerror=()=>finish(new PreviewPlaybackError(`request-failed`,`preview-audio-failed`)),d.play().then(()=>{n===this.generation&&(this.remoteStarted=!0,this.publish(`playing`,i))}).catch(()=>finish(new PreviewPlaybackError(`autoplay-blocked`,`preview-audio-blocked`)))})}async playSegmented(e,t,n){let r=t.provider===`breeze`,i=r?splitBreezeTtsSegments(e):splitTtsSegments(e);for(let e of i){if(n!==this.generation)return;await this.playComplete(e,t,n,`wav`,r?`breeze`:`mimo`,!1)}}async playPcm(e,t,n){this.publish(`loading`,externalEngine()?`external`:`mimo`);let r=new AbortController;this.request=r,this.requestBusy=!0;let i=await fetch(hostRoute(g),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(speechRequestBody({...this.requestBody(e,t)},t.externalSelection)),signal:r.signal});if(!i.ok)throw await responseError(i);if(i.body===null)throw Error(`preview-stream-empty`);let a=i.body.getReader(),o=new TextDecoder,s=``,c=!1,l=new PcmRecording,consume=async e=>{for(let t of e){let e=pcmDelta(t);if(e!==null){if(n!==this.generation||r.signal.aborted)return;c=!0,l.append(e),await this.pcm.enqueue(e)}}};try{for(;n===this.generation;){let e=await a.read();if(e.done)break;s+=o.decode(e.value,{stream:!0});let t=parseSseRecords(s);s=t.remainder,await consume(t.events)}if(s+=o.decode(),n===this.generation&&!r.signal.aborted){s.trim().length>0&&await consume(parseSseRecords(`${s}\n\n`).events);let t=l.toWav();t!==null&&this.setRecording({blob:t,text:e,format:`wav`}),l.save(this.history,{text:e,source:`preview`})}}finally{a.releaseLock(),n===this.generation&&(this.request=null,this.requestBusy=!1,this.maybeFinishPcm())}if(!c&&n===this.generation)throw Error(`preview-stream-audio-empty`)}playLocal(e,t,n){if(this.recording!==null&&this.setRecording(null),this.publish(`loading`,`local`),t.localVoiceEngine===`moss`)return this.playMossLocal(e,t,n);if(typeof window>`u`||window.speechSynthesis===void 0)return Promise.reject(new PreviewPlaybackError(`local-voice-unavailable`,`local-speech-unavailable`));let r=browserVoice(t.localVoiceURI);return r===void 0?Promise.reject(new PreviewPlaybackError(`local-voice-unavailable`)):new Promise((t,i)=>{let a=new SpeechSynthesisUtterance(e);a.voice=r,a.lang=r.lang,a.volume=this.volume,applySpeechVoiceRate(a,this.voiceRate),this.utterance=a;let o=!1,finish=e=>{o||(o=!0,a.onstart=null,a.onend=null,a.onerror=null,this.utterance===a&&(this.utterance=null),this.finishUtterance===finish&&(this.finishUtterance=null),n===this.generation&&(e===void 0?this.publish(`idle`,`local`):this.publish(`error`,`local`,previewError(e))),e===void 0?t():i(e))};this.finishUtterance=()=>finish(),a.onstart=()=>{n===this.generation&&this.publish(`playing`,`local`)},a.onend=()=>finish(),a.onerror=e=>{e.error===`canceled`||e.error===`interrupted`?finish():e.error===`not-allowed`?finish(new PreviewPlaybackError(`autoplay-blocked`,`local-speech-not-allowed`)):finish(new PreviewPlaybackError(`request-failed`,`local-speech-failed`))},window.speechSynthesis.speak(a)})}async playMossLocal(e,t,n){if(t.mossBaseURL.trim().length===0||t.mossVoice.trim().length===0)throw new PreviewPlaybackError(`local-voice-unavailable`);let r=new AbortController;this.request=r;let handleAbort=()=>{this.mossHandle?.stop()};r.signal.addEventListener(`abort`,handleAbort,{once:!0});try{let i=await fetchMossAudio(e,{baseURL:t.mossBaseURL,voice:t.mossVoice},r.signal);if(n!==this.generation||r.signal.aborted)return;i.size>0&&this.setRecording({blob:i,text:e,format:`wav`});let a=playMossAudio(i,{volume:this.volume,rate:this.voiceRate,timeoutMs:12e4,onStart:()=>{n===this.generation&&this.publish(`playing`,`local`)}});this.mossHandle=a;try{await a.done}catch(e){let t=e instanceof Error?e.message:``;throw new PreviewPlaybackError(t===`autoplay-blocked`?`autoplay-blocked`:t===`local-speech-timeout`?`timeout`:`local-voice-unavailable`,t)}finally{this.mossHandle===a&&(this.mossHandle=null)}}finally{r.signal.removeEventListener(`abort`,handleAbort),this.request===r&&(this.request=null)}}releaseAudio(e){this.audio===e&&(this.audio=null,e.pause(),e.removeAttribute(`src`),e.load(),this.audioUrl!==null&&URL.revokeObjectURL(this.audioUrl),this.audioUrl=null)}maybeFinishPcm(){!this.requestBusy&&!this.pcmBusy&&(this.status===`loading`||this.status===`playing`)&&this.publish(`idle`,this.source)}publish(e,t=this.source,n=null){let r=e===`error`?n:null;this.status===e&&this.source===t&&this.error===r||(this.status=e,this.source=t,this.error=r,this.onViewChange(this.getView()))}},ToggleSoundPlayer=class{timer=null;audio=null;volumePreviewAudio=null;volume=1;enabled=!0;volumePreviewIndex=null;lastIndex=new Map;schedule(e){this.clearTimer(),this.releaseAudio(),!(!this.enabled||typeof window>`u`)&&(this.timer=window.setTimeout(()=>{this.timer=null,this.play(e)},200))}dispose(){this.clearTimer(),this.releaseAudio(),this.releaseVolumePreviewAudio()}setVolume(e){this.volume=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1,this.audio!==null&&(this.audio.volume=this.volume)}setEnabled(e){this.enabled=e,e||(this.clearTimer(),this.releaseAudio(),this.releaseVolumePreviewAudio())}setPreviewVolume(e){let t=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1;this.volumePreviewAudio!==null&&(this.volumePreviewAudio.volume=t)}previewVolume(e){let t=Number.isFinite(e)?Math.max(0,Math.min(1,e)):1;if(this.setPreviewVolume(t),!this.enabled||this.volumePreviewAudio!==null||typeof window>`u`)return;let n=Math.floor(Math.random()*E.length);E.length>1&&n===this.volumePreviewIndex&&(n=(n+1)%E.length),this.volumePreviewIndex=n;let r=new Audio(hostRoute(`${C}/${E[n]}`));this.volumePreviewAudio=r,r.volume=t,r.preload=`auto`;let release=()=>{this.volumePreviewAudio===r&&(r.onended=null,r.onerror=null,this.releaseVolumePreviewAudio())};r.onended=release,r.onerror=release,r.play().catch(release)}play(e){let t=w[e],n=this.lastIndex.get(e),r=Math.floor(Math.random()*t.length);t.length>1&&r===n&&(r=(r+1+Math.floor(Math.random()*(t.length-1)))%t.length),this.lastIndex.set(e,r);let i=new Audio(hostRoute(`${C}/${t[r]}`));this.audio=i,i.volume=this.volume,i.preload=`auto`;let release=()=>{this.audio===i&&(i.onended=null,i.onerror=null,this.releaseAudio())};i.onended=release,i.onerror=release,i.play().catch(release)}clearTimer(){this.timer===null||typeof window>`u`||(window.clearTimeout(this.timer),this.timer=null)}releaseAudio(){let e=this.audio;e!==null&&(this.audio=null,e.onended=null,e.onerror=null,e.pause(),e.removeAttribute(`src`),e.load())}releaseVolumePreviewAudio(){let e=this.volumePreviewAudio;e!==null&&(this.volumePreviewAudio=null,e.onended=null,e.onerror=null,e.pause(),e.removeAttribute(`src`),e.load())}};function SettingFieldHeading({label:e,suffix:t,overriddenLabel:n,resetLabel:r,overridden:i,resettable:a,disabled:o,onReset:s}){return(0,d.jsxs)(`span`,{className:`xmimo-tts-field-heading`,children:[(0,d.jsxs)(`span`,{className:`xmimo-tts-field-label`,children:[(0,d.jsx)(`span`,{children:e}),t]}),i&&n!==void 0?(0,d.jsxs)(`span`,{className:`xmimo-tts-field-badges`,children:[(0,d.jsx)(`small`,{className:`xmimo-tts-overridden`,children:n}),a&&s!==void 0&&r!==void 0?(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,className:`xmimo-tts-reset`,disabled:o,onClick:e=>{e.preventDefault(),e.stopPropagation(),s()},children:r}):null]}):null]})}function ModuleShell({className:e,title:t,summary:n,interactiveSummary:r=!1,action:i,children:a,collapsible:o=!1,open:s=!1,onToggle:c,toggleClassName:l=``,headingClassName:u=``,ariaLabel:p,toggleId:m,controlsId:h}){let g={type:`button`,id:m,"aria-controls":h,"aria-expanded":s,"aria-label":p??(typeof t==`string`?t:void 0),onClick:c},_=(0,d.jsxs)(`span`,{className:`xmimo-ui-module-head xmimo-ui-module-heading ${u}`.trim(),children:[(0,d.jsx)(`strong`,{children:t}),n]});return(0,d.jsxs)(`section`,{className:`xmimo-ui-module ${e}`.trim(),children:[(0,d.jsxs)(`header`,{className:`xmimo-ui-module-header`,children:[o&&r?(0,d.jsx)(`div`,{className:`xmimo-ui-module-toggle ${l}`.trim(),children:(0,d.jsxs)(`div`,{className:`xmimo-ui-module-head xmimo-ui-module-heading ${u}`.trim(),children:[(0,d.jsx)(`h3`,{className:`xmimo-ui-accordion-heading xmimo-ui-interactive-heading`,children:(0,d.jsx)(`button`,{...g,className:`xmimo-ui-module-title-toggle`,children:(0,d.jsx)(`strong`,{children:t})})}),n]})}):o?(0,d.jsx)(`h3`,{className:`xmimo-ui-accordion-heading`,children:(0,d.jsx)(`button`,{...g,className:`xmimo-ui-module-toggle ${l}`.trim(),children:_})}):(0,d.jsx)(`div`,{className:`xmimo-ui-module-toggle xmimo-ui-module-toggle-static`,children:_}),i?(0,d.jsx)(`div`,{className:`xmimo-ui-module-decoration`,children:i}):null]}),(0,d.jsx)(`div`,{className:`xmimo-ui-module-body`,children:a})]})}let xi=[`settings.apiKeyIdleCopy1`,`settings.apiKeyIdleCopy2`,`settings.apiKeyIdleCopy3`,`settings.apiKeyIdleCopy4`],Si=[`settings.apiKeyFocusCopy1`,`settings.apiKeyFocusCopy2`,`settings.apiKeyFocusCopy3`,`settings.apiKeyFocusCopy4`];function randomCopyKey(e,t){if(e.length<2)return e[0];let n=e[Math.floor(Math.random()*e.length)];for(;n===t;)n=e[Math.floor(Math.random()*e.length)];return n}function ApiKeyModule({t:e,provider:t,value:n,message:r,invalid:i,writable:a,minimal:o,onChange:s,onOpenProviderSettings:c}){let u=useEngineState(),p=externalEngine();p&&(r=`${p.name} · ${e(u.status===`ready`?p.ready?`settings.externalManaged`:`settings.externalNotReady`:`settings.externalDisconnected`)}`,i=!1,a=!1);let[m,h]=(0,l.useState)(()=>randomCopyKey(xi)),g=(0,l.useId)(),_=(0,l.useId)(),v=t===`doubao`?`https://console.volcengine.com/speech/new/setting/apikeys?projectName=default`:t===`breeze`?`https://breezeblue.ai/zh?code=JHKLSJ`:`https://platform.xiaomimimo.com/console/api-keys`;return(0,d.jsx)(ModuleShell,{className:`xmimo-tts-settings-module xmimo-tts-api-key xmimo-ui-module-padded`,title:(0,d.jsx)(SettingFieldHeading,{label:(0,d.jsxs)(`span`,{className:`xmimo-ui-module-title`,children:[(0,d.jsx)(RiKey2Line,{size:14,"aria-hidden":`true`,focusable:`false`}),p?p.name:t===`doubao`?e(`settings.providerDoubao`):t===`breeze`?e(`settings.providerBreeze`):(0,d.jsx)(`span`,{className:`xmimo-tts-api-key-logo`,role:`img`,"aria-label":e(`settings.apiKey`),style:{"--xmimo-tts-api-key-logo-image":`url(${hostRoute(`/plugins/xiaomi-mimo-tts/mimo.svg`)})`}})]}),suffix:p?.managementBundle&&c?(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-api-key-link`,onClick:()=>c(p.managementBundle),children:e(`settings.externalManage`)}):(0,d.jsx)(`a`,{className:`xmimo-tts-api-key-link`,href:p?p.managementPath?hostRoute(p.managementPath):void 0:v,"aria-disabled":p!==null&&!p.managementPath,target:`_blank`,rel:`noopener noreferrer`,children:e(p?.managementPath?`settings.externalManage`:`settings.getApiKey`)}),disabled:!a,resettable:!1}),action:o?void 0:(0,d.jsx)(`span`,{className:`xmimo-tts-api-key-decoration`,"aria-hidden":`true`}),children:(0,d.jsxs)(`form`,{className:`xmimo-tts-api-key-content`,onSubmit:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-api-key-input`,children:[o?null:(0,d.jsx)(`span`,{className:`xmimo-tts-character-bubble xmimo-tts-api-key-bubble`,"aria-hidden":`true`,children:e(m)}),o?null:(0,d.jsx)(`span`,{className:`xmimo-tts-api-key-whale`,style:{backgroundImage:`url(${hostRoute(`/plugins/xiaomi-mimo-tts/api-key-whale.webp`)})`},"aria-hidden":`true`}),(0,d.jsx)(`input`,{id:g,type:`password`,value:n,name:`xmimo-tts-api-key`,autoComplete:`new-password`,autoCorrect:`off`,spellCheck:!1,"aria-label":e(`settings.apiKey`),"aria-autocomplete":`none`,"aria-describedby":_,"aria-invalid":i,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-lpignore":`true`,placeholder:e(`settings.secretPlaceholder`),disabled:!a,onFocus:()=>{h(e=>randomCopyKey(Si,e))},onBlur:()=>{h(e=>randomCopyKey(xi,e))},onChange:e=>{s(e.target.value)},style:{padding:`0 var(--xmimo-ui-space-4)`}})]}),(0,d.jsx)(`small`,{id:_,className:`xmimo-tts-api-key-message${i?` xmimo-tts-api-key-warning`:``}${o&&!i&&!p?` xmimo-tts-visually-hidden`:``}`,role:i?`alert`:`status`,children:r})]})})}function resolveApiKeyViewState(e,t,n,r){return r===`set`&&e.trim().length>0?t?`pending-save`:`pending-invalid`:n}function VoiceAvatar({preset:e,minimal:t}){return t?null:e.avatar}let Ci=D.map(e=>({...e,label:e.value,avatar:(0,d.jsx)(`img`,{className:`xmimo-tts-builtin-voice-avatar`,src:hostRoute(`/plugins/xiaomi-mimo-tts/voice-avatars/${e.id}.webp`),alt:``,width:36,height:36,loading:`lazy`,"aria-hidden":`true`})}));function SelectedCheck(){return(0,d.jsxs)(`svg`,{className:`xmimo-tts-builtin-voice-check`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,d.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`}),(0,d.jsx)(`path`,{d:`m4.8 8.1 2 2 4.4-4.5`})]})}function BuiltInVoicePicker({value:e,disabled:t,label:n,minimal:r=!1,onChange:i}){return(0,d.jsx)(VoicePresetPicker,{value:e,disabled:t,label:n,minimal:r,onChange:i,presets:Ci})}function VoicePresetPicker({value:e,disabled:t,label:n,minimal:r=!1,onChange:i,presets:a}){let[o,s]=(0,l.useState)(!1),c=(0,l.useRef)(null),p=(0,l.useRef)(null),m=(0,l.useRef)([]),h=(0,l.useId)(),g=a.findIndex(t=>t.value===e),_=a[g<0?0:g];(0,l.useEffect)(()=>{if(r||!o)return;let closeOnOutsidePointer=e=>{e.target instanceof Node&&!c.current?.contains(e.target)&&s(!1)};return document.addEventListener(`pointerdown`,closeOnOutsidePointer),()=>document.removeEventListener(`pointerdown`,closeOnOutsidePointer)},[r,o]),(0,l.useEffect)(()=>{!r&&t&&s(!1)},[t,r]);let focusOption=e=>{let t=(e+a.length)%a.length;requestAnimationFrame(()=>m.current[t]?.focus())},choose=e=>{i(e),!r&&(s(!1),requestAnimationFrame(()=>p.current?.focus()))},handleTriggerKeyDown=e=>{e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),s(!0),focusOption(g<0?0:g)):e.key===`Home`?(e.preventDefault(),s(!0),focusOption(0)):e.key===`End`&&(e.preventDefault(),s(!0),focusOption(a.length-1))},handleOptionKeyDown=(e,t)=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),focusOption(t+1)):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),focusOption(t-1)):e.key===`Home`?(e.preventDefault(),focusOption(0)):e.key===`End`?(e.preventDefault(),focusOption(a.length-1)):e.key===`Escape`?(e.preventDefault(),s(!1),p.current?.focus()):e.key===`Tab`&&s(!1)};return(0,d.jsxs)(`div`,{className:`xmimo-tts-builtin-voice-picker`,ref:c,children:[r?null:(0,d.jsxs)(`button`,{ref:p,type:`button`,className:`xmimo-tts-builtin-voice-trigger`,disabled:t,"aria-label":n,"aria-haspopup":`listbox`,"aria-expanded":o,"aria-controls":o?h:void 0,onClick:()=>{s(e=>!e)},onKeyDown:handleTriggerKeyDown,children:[(0,d.jsx)(VoiceAvatar,{preset:_,minimal:r}),(0,d.jsxs)(`span`,{className:`xmimo-tts-builtin-voice-copy`,children:[(0,d.jsx)(`strong`,{children:_.label}),(0,d.jsx)(`small`,{children:_.summary})]}),r?(0,d.jsx)(`span`,{className:`xmimo-tts-voice-picker-text-caret`,"aria-hidden":`true`,children:`⌄`}):(0,d.jsx)(u.IconChevronDownOutlineMedium,{className:o?`xmimo-tts-voice-picker-chevron xmimo-tts-voice-picker-chevron-open`:`xmimo-tts-voice-picker-chevron`,size:14})]}),r||o?(0,d.jsx)(`div`,{id:h,className:`xmimo-tts-builtin-voice-menu`,role:`listbox`,"aria-label":n,children:a.map((n,i)=>(0,d.jsxs)(`button`,{ref:e=>{m.current[i]=e},type:`button`,role:`option`,"aria-selected":n.value===e,disabled:t,className:`xmimo-tts-builtin-voice-option${n.value===e?` xmimo-tts-builtin-voice-option-selected`:``}${n.fullWidth?` xmimo-tts-builtin-voice-option-custom`:``}`,onClick:()=>{choose(n.value)},onKeyDown:e=>{handleOptionKeyDown(e,i)},children:[!r&&n.value===e?(0,d.jsx)(SelectedCheck,{}):null,(0,d.jsx)(VoiceAvatar,{preset:n,minimal:r}),(0,d.jsxs)(`span`,{className:`xmimo-tts-builtin-voice-copy`,children:[(0,d.jsx)(`strong`,{children:n.label}),(0,d.jsx)(`small`,{children:n.summary})]})]},n.id))}):null]})}let wi=[`Natural`,`Gentle`,`Cheerful`,`Calm`,`Story`,`Argument`,`Whisper`,`Cute`,`Cantonese`,`Henan`,`Sichuan`,`Dongbei`],Ti=[`Natural`,`Gentle`,`Cheerful`,`Calm`,`Story`,`Argument`,`Whisper`,`Shy`,`Weary`,`Tearful`,`Coy`,`Cute`,`Cantonese`,`Shanghai`,`Henan`,`Beijing`,`Tianjin`,`Sichuan`,`Shaanxi`,`Dongbei`],Ei=[`Natural`,`WhisperFear`,`ExcitedSurprise`,`SarcasticDisbelief`,`NervousHumor`,`RestrainedGrief`,`CalmNarration`,`WarmCompanion`,`PlayfulTeasing`,`SeriousAnnouncement`,`EncouragingSupport`,`SleepyBedtime`];function speechInstructionPresets(e,t){return(e===`xiaomi`?wi.map(e=>({preset:e,prompt:e===`Natural`?``:t(`settings.mimoInstruction${e}Prompt`)})):e===`breeze`?Ei.map(e=>({preset:e,prompt:e===`Natural`?``:t(`settings.breezeInstructionText${e}`)})):Ti.map(e=>({preset:e,prompt:e===`Natural`?``:t(`settings.speechInstruction${e}Prompt`)}))).map(({preset:n,prompt:r})=>({preset:n,prompt:r,label:t(e===`breeze`&&n!==`Natural`?`settings.breezeInstructionLabel${n}`:`settings.speechInstruction${n}`)}))}function speechInstructionLabel(e,t,n){return speechInstructionPresets(e,n).find(e=>e.prompt===t.trim())?.label??n(`settings.speechInstructionCustom`)}function SpeechInstructionPicker({provider:e,value:t,disabled:n,minimal:r=!1,onChange:i,t:a,options:o}){let s=e===`external`?[{preset:``,prompt:``,label:a(`settings.speechInstructionNatural`)},...(o??[]).map(e=>({preset:e.id,prompt:e.id,label:e.name}))]:speechInstructionPresets(e,a),c=a(e===`external`?`settings.externalOptionsHint`:e===`xiaomi`?`settings.mimoInstructionHint`:e===`breeze`?`settings.breezeInstructionHint`:`settings.doubaoInstructionHint`);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-instruction-editor`,children:[(0,d.jsx)(`textarea`,{value:t,rows:r?3:4,disabled:n,readOnly:e===`external`&&o!==void 0,"aria-label":a(`settings.speechInstruction`),placeholder:a(`settings.speechInstructionPlaceholder`),onChange:e=>i(e.target.value)}),(0,d.jsx)(`div`,{className:`xmimo-tts-instruction-presets`,role:`group`,"aria-label":a(`settings.speechInstructionPresets`),children:s.map(({preset:e,prompt:r,label:a})=>(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-instruction-tag`,disabled:n,"aria-pressed":t.trim()===r,title:r||c,onClick:()=>i(r),children:a},e))})]}),r?null:(0,d.jsx)(`small`,{children:c})]})}function CatalogPicker({items:e,value:t,label:n,disabled:r,onChange:i}){return(0,d.jsx)(VoicePresetPicker,{value:t,label:n,disabled:r,onChange:i,presets:e.map(e=>({id:e.id,value:e.id,label:e.name,summary:e.name===e.id?``:e.id,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-doubao-voice-avatar`,"aria-hidden":`true`,children:e.name.slice(0,1)})}))})}function ExternalSpeechFields({engine:e,selection:t=e.selection,writable:n,minimal:r,t:i,onChange:a}){let o=e.models?.find(e=>e.id===t?.model),s=!n||!e.configurable||!t;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-model xmimo-tts-external-catalog`,children:[(0,d.jsx)(SettingFieldHeading,{label:i(`settings.model`),resettable:!1,disabled:s}),e.models?.length?(0,d.jsx)(CatalogPicker,{value:t?.model??``,items:e.models,label:i(`settings.model`),disabled:s,onChange:n=>{let r=e.models.find(e=>e.id===n);a({model:n,voice:r.voices.some(e=>e.id===t?.voice)?t.voice:r.voices[0]?.id??``,speechInstruction:``})}}):(0,d.jsx)(`input`,{"aria-label":i(`settings.model`),value:e.modelName??``,disabled:!0})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-voice xmimo-tts-external-catalog`,children:[(0,d.jsx)(SettingFieldHeading,{label:i(`settings.voiceReadingVoice`),resettable:!1,disabled:s}),o?.voices.length?(0,d.jsx)(CatalogPicker,{value:t?.voice??``,items:o.voices,label:i(`settings.voiceReadingVoice`),disabled:s,onChange:e=>a({...t,voice:e})}):(0,d.jsx)(`input`,{"aria-label":i(`settings.voiceReadingVoice`),value:e.voiceName??``,disabled:!0})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-voice xmimo-tts-speech-instruction`,children:[(0,d.jsx)(SettingFieldHeading,{label:i(`settings.speechInstruction`),resettable:!1,disabled:s||!o?.speechInstruction}),(0,d.jsx)(SpeechInstructionPicker,{provider:`external`,value:t?.speechInstruction??``,disabled:s||!o?.speechInstruction,minimal:r,t:i,options:o?.instructions,onChange:e=>a({...t,speechInstruction:e})})]})]})}function clamp(e,t,n){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):n}let Di=Array.from({length:24},(e,t)=>{let randomAt=e=>{let n=Math.sin(t*(12.9898+e)+78.233+e*31.7)*43758.5453;return n-Math.floor(n)},n=randomAt(0);return{x:2+t/23*96+(n-.5)*2,y:28+n*44,size:2+randomAt(1)*2,driftX:`${(randomAt(2)-.5)*8}px`,driftY:`${(randomAt(3)-.5)*10}px`,duration:`${2.4+randomAt(4)*2.8}s`,delay:`${-randomAt(5)*3.5}s`}});function EnergyVolumeSlider({value:e,label:t,minimal:n=!1,disabled:r=!1,min:i=0,max:a=1,step:o=.01,formatValue:s,onChange:c,onInteractionEnd:u}){let p=Number.isFinite(i)?i:0,m=Number.isFinite(a)&&a>p?a:p+1,h=Number.isFinite(o)&&o>0?o:(m-p)/100,[g,_]=(0,l.useState)(!1),[v,b]=(0,l.useState)(0),x=(0,l.useRef)(!1),S=(0,l.useRef)(!1),C=clamp(e,p,m),w=(0,l.useRef)(C),E=(C-p)/(m-p),D=Math.round(E*100);(0,l.useEffect)(()=>{x.current||(w.current=C)},[C]);let begin=e=>{e.currentTarget.setPointerCapture(e.pointerId),x.current=!0,_(!0)},finish=()=>{x.current&&(x.current=!1,_(!1),b(e=>e+1),u?.(w.current))};return(0,d.jsxs)(`span`,{className:n?`xmimo-tts-energy xmimo-tts-energy-minimal`:`xmimo-tts-energy`,"data-dragging":g,"data-high":E>.85,"data-disabled":r,style:{"--volume":`${D}%`},children:[(0,d.jsx)(`span`,{className:`xmimo-tts-energy-fill`,"aria-hidden":`true`}),(0,d.jsx)(`span`,{className:v?`xmimo-tts-energy-dots xmimo-tts-energy-pulse`:`xmimo-tts-energy-dots`,"aria-hidden":`true`,children:Di.map(({x:e,y:t,size:n,driftX:r,driftY:i,duration:a,delay:o},s)=>(0,d.jsx)(`i`,{style:{"--dot":s,"--dot-x":`${e}%`,"--dot-y":`${t}%`,"--dot-size":`${n}px`,"--drift-x":r,"--drift-y":i,"--drift-duration":a,"--drift-delay":o,opacity:s/24<E?.7:.15}},s))},v),(0,d.jsx)(`input`,{type:`range`,min:p,max:m,step:h,value:C,"aria-label":t,"aria-valuetext":s?.(C)??`${D}%`,disabled:r,onPointerDown:begin,onPointerUp:finish,onPointerCancel:()=>{x.current=!1,_(!1)},onLostPointerCapture:finish,onBlur:()=>{x.current=!1,_(!1)},onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`PageUp`,`PageDown`].includes(e.key)&&(S.current=!0)},onKeyUp:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`PageUp`,`PageDown`].includes(e.key)&&(b(e=>e+1),S.current&&(S.current=!1,u?.(w.current)))},onChange:e=>{let t=Number(e.target.value);w.current=t,c(t)}})]})}function FieldInfo({label:e,text:t}){let n=(0,l.useId)(),[r,i]=(0,l.useState)(!1),a=(0,l.useRef)(null),o=(0,l.useRef)(null),[s,c]=(0,l.useState)({left:0,top:0});return(0,l.useLayoutEffect)(()=>{if(!r)return;let place=()=>{if(a.current===null||o.current===null)return;let e=a.current.getBoundingClientRect(),t=o.current.getBoundingClientRect();c({left:Math.max(16,Math.min(e.left,window.innerWidth-t.width-16)),top:e.bottom+t.height+6<=window.innerHeight-16?e.bottom+6:Math.max(16,e.top-t.height-6)})};return place(),window.addEventListener(`resize`,place),window.addEventListener(`scroll`,place,!0),()=>{window.removeEventListener(`resize`,place),window.removeEventListener(`scroll`,place,!0)}},[r,t]),(0,d.jsxs)(`span`,{className:`xmimo-tts-field-info`,onMouseEnter:()=>i(!0),onMouseLeave:()=>{document.activeElement!==a.current&&i(!1)},children:[(0,d.jsx)(`button`,{ref:a,type:`button`,className:`xmimo-tts-field-info-button`,"aria-label":e,"aria-describedby":r?n:void 0,onFocus:()=>i(!0),onBlur:()=>i(!1),onClick:()=>i(!0),onKeyDown:e=>{e.key===`Escape`&&(i(!1),e.stopPropagation())},children:(0,d.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,d.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,d.jsx)(`path`,{d:`M12 11v6M12 7h.01`})]})}),r?(0,d.jsx)(`span`,{ref:o,id:n,role:`tooltip`,className:`xmimo-tts-field-info-tooltip`,style:s,children:t}):null]})}async function copyText(e){try{if(typeof navigator<`u`&&navigator.clipboard!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>`u`)return!1;try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}let Oi=String.raw`目标:在 Windows 上部署 MOSS-TTS-Nano 本地 TTS 服务(非windows环境可参考),不使用管理员权限,不要 conda。服务最终监听 127.0.0.1:18083,供 DSH 插件通过健康检查、预热状态和合成接口接入。
14
14
 
15
15
  资源:
16
16
  - uv Windows 包:https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-pc-windows-msvc.zip
@@ -29,7 +29,74 @@ Doubao applies changes at the next synthesis; Xiaomi and browser speech during p
29
29
  7. 页面界面全部改为中文。
30
30
  8. 关闭流式生成,设为默认关闭。
31
31
  9. 本地克隆音色可保存到音色列表,支持改名和删除。
32
- 10. 只做必要改动,记录实际路径、端口和启动方式。`;function availableVoices(){return typeof window>`u`||window.speechSynthesis===void 0?[]:[...window.speechSynthesis.getVoices()].sort((e,t)=>{let rank=e=>{if(e.localService)return 0;let t=e.lang.toLowerCase();return t===`zh`||t.startsWith(`zh-`)?1:t===`en`||t.startsWith(`en-`)?2:3};return rank(e)-rank(t)||e.name.localeCompare(t.name)||e.lang.localeCompare(t.lang)})}function pickVoice(e,t){let n=typeof navigator>`u`?`zh-CN`:navigator.language||`zh-CN`;return e.find(e=>e.voiceURI===t)??e.find(e=>e.lang.toLowerCase()===`zh-cn`)??e.find(e=>e.lang.toLowerCase().startsWith(n.toLowerCase().split(`-`)[0]??`zh`))??e.find(e=>e.default)??e[0]}function LocalVoicePicker({value:e,disabled:t=!1,label:n,minimal:r=!1,unavailableLabel:i,loadingLabel:a,offlineLabel:o,onlineLabel:s,onChange:c,onAvailabilityChange:p}){let[m,h]=(0,l.useState)([]),[g,_]=(0,l.useState)(!1),[v,b]=(0,l.useState)(!1),x=(0,l.useRef)(null),S=(0,l.useRef)(null),C=(0,l.useRef)([]),w=(0,l.useId)();(0,l.useEffect)(()=>{if(typeof window>`u`||window.speechSynthesis===void 0){_(!0),p(!1);return}let update=()=>{let e=availableVoices();h(e),_(!0),p(e.length>0)};return update(),window.speechSynthesis.addEventListener(`voiceschanged`,update),()=>window.speechSynthesis.removeEventListener(`voiceschanged`,update)},[]),(0,l.useEffect)(()=>{if(typeof document>`u`)return;let close=e=>{e.target instanceof Node&&!x.current?.contains(e.target)&&b(!1)};return document.addEventListener(`pointerdown`,close),()=>document.removeEventListener(`pointerdown`,close)},[]),(0,l.useEffect)(()=>{t&&b(!1)},[t]);let E=(0,l.useMemo)(()=>pickVoice(m,e),[e,m]),D=E?.voiceURI??e,choose=e=>{c(e.voiceURI),b(!1),requestAnimationFrame(()=>S.current?.focus())},focusOption=e=>{if(m.length===0)return;let t=(e+m.length)%m.length;requestAnimationFrame(()=>C.current[t]?.focus())},handleTriggerKeyDown=e=>{if(m.length!==0&&(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)){e.preventDefault(),b(!0);let t=Math.max(0,m.findIndex(e=>e.voiceURI===D));focusOption(e.key===`Home`?0:e.key===`End`?m.length-1:t)}},handleOptionKeyDown=(e,t)=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),focusOption(t+1)):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),focusOption(t-1)):e.key===`Home`?(e.preventDefault(),focusOption(0)):e.key===`End`?(e.preventDefault(),focusOption(m.length-1)):e.key===`Escape`?(e.preventDefault(),b(!1),S.current?.focus()):e.key===`Tab`&&b(!1)},k=E?.name??(g?i:a),voiceSummary=e=>`${e.lang} · ${e.localService?o:s}`;return(0,d.jsxs)(`div`,{className:`xmimo-tts-builtin-voice-picker`,ref:x,children:[(0,d.jsxs)(`button`,{ref:S,type:`button`,className:`xmimo-tts-builtin-voice-trigger`,disabled:t||m.length===0,"aria-haspopup":`listbox`,"aria-expanded":v,"aria-controls":v?w:void 0,"aria-label":n,onClick:()=>b(e=>!e),onKeyDown:handleTriggerKeyDown,children:[r?null:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-local-voice-avatar`,"aria-hidden":`true`,children:`🔊`}),(0,d.jsxs)(`span`,{className:`xmimo-tts-builtin-voice-copy`,children:[(0,d.jsx)(`strong`,{children:k}),(0,d.jsx)(`small`,{children:E===void 0?g?i:a:voiceSummary(E)})]}),r?(0,d.jsx)(`span`,{className:`xmimo-tts-voice-picker-text-caret`,"aria-hidden":`true`,children:`⌄`}):(0,d.jsx)(u.IconChevronDownOutlineMedium,{className:v?`xmimo-tts-voice-picker-chevron xmimo-tts-voice-picker-chevron-open`:`xmimo-tts-voice-picker-chevron`,size:14})]}),v?(0,d.jsx)(`div`,{id:w,className:`xmimo-tts-builtin-voice-menu`,role:`listbox`,"aria-label":n,children:m.map((e,t)=>(0,d.jsxs)(`button`,{ref:e=>{C.current[t]=e},type:`button`,role:`option`,"aria-selected":e.voiceURI===D,className:e.voiceURI===D?`xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-selected`:`xmimo-tts-builtin-voice-option`,onClick:()=>choose(e),onKeyDown:e=>handleOptionKeyDown(e,t),children:[!r&&e.voiceURI===D?(0,d.jsxs)(`svg`,{className:`xmimo-tts-builtin-voice-check`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,d.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`}),(0,d.jsx)(`path`,{d:`m4.8 8.1 2 2 4.4-4.5`})]}):null,r?null:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-local-voice-avatar`,"aria-hidden":`true`,children:`🔊`}),(0,d.jsxs)(`span`,{className:`xmimo-tts-voice-option-copy`,children:[(0,d.jsx)(`strong`,{children:e.name}),(0,d.jsx)(`small`,{children:voiceSummary(e)})]})]},e.voiceURI))}):null]})}function errorKey(e){return e===`moss-invalid-url`?`settings.mossInvalidUrl`:e===`moss-timeout`?`settings.mossTimeout`:e===`moss-unreachable`||e===`moss-request-failed`?`settings.mossUnreachable`:`settings.mossProbeFailed`}function voicePresets(e,t){return e.map(e=>({id:e.id,value:e.id,label:e.name,summary:`${e.id} · ${t(`settings.mossBuiltInVoice`)}`,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-local-voice-avatar xmimo-tts-moss-voice-avatar`,"aria-hidden":`true`,children:`M`})}))}async function copyText(e){try{if(typeof navigator<`u`&&navigator.clipboard!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>`u`)return!1;try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function LocalVoiceModule({t:e,minimal:t,writable:n,localSpeechMode:r,engine:i,mossEnabled:a,browserVoiceURI:o,mossBaseURL:s,mossVoice:c,mossVoiceName:p,fieldOverridden:m,resetField:h,onEngineChange:g,onBrowserVoiceChange:v,onMossBaseURLChange:b,onMossVoiceChange:x,onBrowserAvailabilityChange:S}){let C=a?i:`browser`,[w,E]=(0,l.useState)({status:`idle`}),[D,k]=(0,l.useState)(`idle`),A=(0,l.useRef)(null),M=(0,l.useRef)(null),P=(0,l.useRef)(c);P.current=c;let F=!n||r===`disabled`,I=mossVoiceChoices(w.status===`ready`?w.result.voices:[],c,p),V=voicePresets(I,e),ee=V.find(e=>e.value===c)??V[0],H=C===`moss`?`mossVoice`:`localVoiceURI`,te=H;(0,l.useEffect)(()=>()=>{A.current?.abort(),M.current!==null&&window.clearTimeout(M.current)},[]),(0,l.useEffect)(()=>{A.current?.abort(),A.current=null,E({status:`idle`})},[s]);let U=(0,l.useCallback)(async()=>{k(await copyText(Di)?`copied`:`failed`),M.current!==null&&window.clearTimeout(M.current),M.current=window.setTimeout(()=>{k(`idle`),M.current=null},2e3)},[]),re=(0,l.useCallback)(async()=>{A.current?.abort();let e=new AbortController;A.current=e,E({status:`loading`});try{let t=await probeMossService(s,e.signal);if(e.signal.aborted)return;if(!t.ok){E({status:`error`,code:t.error,message:t.message});return}if(E({status:`ready`,result:t}),n&&t.voices.length>0&&!t.voices.some(e=>e.id===P.current)){let e=t.voices[0];x(e.id,e.name)}}catch(t){if(e.signal.aborted)return;E({status:`error`,code:t instanceof MossRequestError?t.code:`moss-request-failed`,message:t instanceof Error?t.message:``})}},[s,x,n]);(0,l.useEffect)(()=>C===`moss`?(re(),()=>{A.current?.abort(),A.current=null}):()=>{},[C]);let se=w.status===`loading`?e(`settings.mossProbing`):w.status===`ready`?w.result.warmup!==null&&!w.result.warmup.ready?`${e(`settings.mossWarming`)} ${Math.round(w.result.warmup.progress*100)}%`:e(`settings.mossOnlineReady`):w.status===`error`?e(errorKey(w.code)):e(`settings.mossNotProbed`),ce=w.status===`ready`?`online`:w.status===`error`?`offline`:w.status;return(0,d.jsxs)(`div`,{className:`xmimo-tts-voice xmimo-tts-local-voice`,children:[(0,d.jsx)(SettingFieldHeading,{label:e(`settings.localVoice`),overriddenLabel:e(`settings.overridden`),resetLabel:e(`settings.reset`),overridden:m(te),resettable:!0,disabled:!n,onReset:()=>{h(H),H===`mossVoice`&&h(`mossVoiceName`)},suffix:(0,d.jsx)(`small`,{className:`xmimo-tts-hint xmimo-tts-local-voice-engine-note`,style:{fontSize:`11px`},children:C===`moss`?`MOSS`:`Microsoft Edge – Better`})}),a?(0,d.jsx)(`div`,{className:`xmimo-tts-settings-segmented-wrap xmimo-tts-local-voice-tabs`,"data-xmimo-select-option":`true`,style:{"--xmimo-experimental-label":JSON.stringify(e(`settings.experimental`))},children:(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-local-voice-engine`,value:C,options:[{value:`browser`,label:e(`settings.localVoiceEngineBrowser`)},{value:`moss`,label:e(`settings.localVoiceEngineMoss`)}],label:e(`settings.localVoiceEngine`),disabled:!n||r===`disabled`,onChange:g,className:`xmimo-tts-settings-segmented xmimo-tts-local-voice-segmented`})}):null,C===`browser`?(0,d.jsx)(LocalVoicePicker,{value:o,disabled:F,label:e(`settings.localVoice`),minimal:t,loadingLabel:e(`settings.localVoiceLoading`),unavailableLabel:e(`settings.localVoiceUnavailable`),offlineLabel:e(`settings.localVoiceOffline`),onlineLabel:e(`settings.localVoiceOnline`),onChange:v,onAvailabilityChange:S}):(0,d.jsxs)(`div`,{className:`xmimo-tts-moss-local`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-moss-field`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-moss-field-heading`,children:[(0,d.jsx)(`span`,{className:`xmimo-tts-moss-field-title`,children:e(`settings.mossBaseURL`)}),(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-moss-text-button`,disabled:w.status===`loading`,onClick:()=>{re()},children:w.status===`loading`?e(`settings.mossProbingShort`):e(`settings.mossProbe`)}),(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-moss-deploy-hint`,"data-state":D,title:e(`settings.mossCopyDeployHint`),"aria-label":e(`settings.mossCopyDeployHint`),onClick:()=>{U()},children:D===`copied`?e(`settings.mossDeployCopied`):D===`failed`?e(`settings.mossDeployCopyFailed`):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`span`,{children:e(`settings.mossDeployHintBefore`)}),(0,d.jsx)(`span`,{className:`xmimo-tts-moss-deploy-action`,children:e(`settings.mossDeployHintAction`)}),(0,d.jsx)(`span`,{children:e(`settings.mossDeployHintAfter`)})]})})]}),(0,d.jsx)(`input`,{type:`url`,className:`xmimo-tts-moss-baseurl`,value:s,spellCheck:!1,disabled:!n,"aria-label":e(`settings.mossBaseURL`),placeholder:_,onChange:e=>{b(e.target.value)}})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-moss-status`,"data-state":ce,role:`status`,title:w.status===`error`?w.message:void 0,children:[(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`xmimo-tts-moss-status-dot`}),(0,d.jsx)(`span`,{children:se}),w.status===`ready`&&w.result.health.device!==void 0?(0,d.jsx)(`small`,{children:w.result.health.device}):null]}),ee===void 0?(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-builtin-voice-trigger xmimo-tts-moss-voice-placeholder`,disabled:!0,children:e(`settings.mossVoiceProbeFirst`)}):(0,d.jsx)(VoicePresetPicker,{value:c,disabled:F,label:e(`settings.mossVoice`),minimal:t,presets:V,onChange:e=>{let t=I.find(t=>t.id===e);t!==void 0&&x(t.id,t.name)}}),r===`local-first`?null:(0,d.jsx)(`small`,{className:`xmimo-tts-hint`,children:e(r===`disabled`?`settings.mossLocalDisabledHint`:`settings.mossLocalFirstHint`)})]})]})}let Oi={standard:`dsh-xiaomi-mimo-tts:standard-voice-history`,cloned:`dsh-xiaomi-mimo-tts:cloned-voice-history`,breeze:`dsh-xiaomi-mimo-tts:breeze-voice-history`},ki=0,Ai=new Set,ji=new Map,Mi=new WeakMap;function memoryFor(e){if(!e)return ji;let t=Mi.get(e);return t||(t=new Map,Mi.set(e,t)),t}let changed=()=>{ki+=1;for(let e of Ai)e()},storageChanged=e=>{(e.key===null||Object.values(Oi).some(t=>e.key?.startsWith(t)))&&changed()},voiceIdRevision=()=>ki;function subscribeVoiceIds(e){return Ai.size===0&&typeof window<`u`&&window.addEventListener(`storage`,storageChanged),Ai.add(e),()=>{Ai.delete(e),Ai.size===0&&typeof window<`u`&&window.removeEventListener(`storage`,storageChanged)}}function readStored(e,t){try{return t?t.getItem(e):memoryFor(t).get(e)??null}catch{return memoryFor(t).get(e)??null}}function writeStored(e,t,n){if(readStored(e,n)!==t){memoryFor(n).set(e,t);try{n?.setItem(e,t)}catch{}changed()}}function browserStorage(){try{return typeof window>`u`?void 0:window.localStorage}catch{return}}function normalizeHistory(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean))].slice(0,10):[]}function readVoiceIdHistory(e,t=browserStorage()){try{return normalizeHistory(JSON.parse(readStored(Oi[e],t)??`[]`))}catch{return[]}}function rememberVoiceId(e,t){return normalizeHistory([t,...e])}function forgetVoiceId(e,t,n){let r=n.trim();return{history:e.filter(e=>e!==r),names:Object.fromEntries(Object.entries(t).filter(([e])=>e!==r))}}function writeVoiceIdHistory(e,t,n=browserStorage()){try{writeStored(Oi[e],JSON.stringify(normalizeHistory(t)),n)}catch{}}function normalizeNames(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([e,t])=>e.trim()&&typeof t==`string`&&t.trim()).map(([e,t])=>[e.trim(),t.trim()]))}function readVoiceIdNames(e,t=browserStorage()){try{return normalizeNames(JSON.parse(readStored(`${Oi[e]}:names`,t)??`{}`))}catch{return{}}}function writeVoiceIdNames(e,t,n=browserStorage()){try{writeStored(`${Oi[e]}:names`,JSON.stringify(normalizeNames(t)),n)}catch{}}function VoiceIdTag({voice:e,name:t,selected:n,disabled:r,t:i,selectRef:a,onSelect:o,onSave:s,onRemove:c}){let[u,p]=(0,l.useState)(`idle`),[m,h]=(0,l.useState)(``),g=(0,l.useRef)(null),_=(0,l.useRef)(null),v=(0,l.useRef)(null),b=t||e,reset=(e=!1)=>{p(`idle`),e&&requestAnimationFrame(()=>_.current?.focus())},save=()=>{r||(s(m.trim()),reset(!0))};return(0,l.useEffect)(()=>{r&&reset()},[r]),(0,l.useEffect)(()=>{if(u===`idle`)return;u===`edit`&&v.current?.focus();let onOutsidePointer=e=>{e.target instanceof Node&&!g.current?.contains(e.target)&&reset()};return document.addEventListener(`pointerdown`,onOutsidePointer),()=>document.removeEventListener(`pointerdown`,onOutsidePointer)},[u]),(0,d.jsxs)(`span`,{ref:g,className:`xmimo-tts-voice-id-tag`,"data-selected":n,"data-mode":u,"data-disabled":r,onBlur:e=>{e.relatedTarget instanceof Node&&!e.currentTarget.contains(e.relatedTarget)&&reset()},onKeyDown:e=>{e.key===`Escape`&&u!==`idle`&&(e.preventDefault(),e.stopPropagation(),reset(!0))},children:[(0,d.jsx)(`span`,{className:`xmimo-tts-voice-id-size`,"aria-hidden":`true`,children:u===`confirm`?i(`settings.voiceTagConfirm`):b}),u===`edit`?(0,d.jsx)(`input`,{ref:v,className:`xmimo-tts-voice-id-edit`,type:`text`,value:m,disabled:r,"aria-label":i(`settings.voiceRemark`),placeholder:i(`settings.voiceRemark`),onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),save())}}):u===`confirm`?(0,d.jsx)(`span`,{className:`xmimo-tts-voice-id-confirm`,role:`status`,children:i(`settings.voiceTagConfirm`)}):(0,d.jsx)(`button`,{ref:e=>{_.current=e,a(e)},type:`button`,className:`xmimo-tts-voice-id-select`,title:t?`${t}\n${e}`:e,"aria-label":t?`${t} (${e})`:e,disabled:r,"aria-pressed":n,onClick:o,children:b}),(0,d.jsxs)(`span`,{className:`xmimo-tts-voice-id-actions`,children:[u===`confirm`?null:(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-voice-id-action`,disabled:r,"aria-label":`${i(u===`edit`?`settings.save`:`settings.voiceTagEdit`)}: ${b}`,title:i(u===`edit`?`settings.save`:`settings.voiceTagEdit`),onClick:()=>{u===`edit`?save():(h(t||``),p(`edit`))},children:u===`edit`?(0,d.jsx)(RiSaveLine,{size:14,"aria-hidden":`true`}):(0,d.jsx)(RiEditLine,{size:14,"aria-hidden":`true`})}),u===`edit`?null:(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-voice-id-action xmimo-tts-voice-id-delete`,disabled:r,"aria-label":`${i(u===`confirm`?`settings.voiceTagConfirm`:`settings.voiceTagRemove`)}: ${b}`,title:i(u===`confirm`?`settings.voiceTagConfirm`:`settings.voiceTagRemove`),onClick:()=>{u===`confirm`?c():p(`confirm`)},children:u===`confirm`?(0,d.jsx)(RiCheckLine,{size:14,"aria-hidden":`true`}):(0,d.jsx)(RiDeleteBinLine,{size:14,"aria-hidden":`true`})})]})]})}let Ni=new Map([...Re.map(e=>[e.value,e.name]),...se.map(e=>[e.value,e.name])]);function VoiceIdInput({value:e,disabled:t,onChange:n,kind:r,label:i,historyLabel:a,t:o}){let[s,c]=(0,l.useState)(()=>readVoiceIdHistory(r)),[u,p]=(0,l.useState)(()=>readVoiceIdNames(r)),m=(0,l.useRef)(null),h=(0,l.useRef)(e.trim()),g=(0,l.useRef)(new Map);(0,l.useEffect)(()=>{c(readVoiceIdHistory(r)),p(readVoiceIdNames(r))},[r,(0,l.useSyncExternalStore)(subscribeVoiceIds,voiceIdRevision,()=>0)]);let remember=e=>{let t=rememberVoiceId(readVoiceIdHistory(r),e);c(t),writeVoiceIdHistory(r,t)},remove=e=>{let t=s.indexOf(e),n=s[t+1]??s[t-1],i=forgetVoiceId(s,u,e);c(i.history),p(i.names),writeVoiceIdHistory(r,i.history),writeVoiceIdNames(r,i.names),requestAnimationFrame(()=>{(n?g.current.get(n):m.current)?.focus()})};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`input`,{ref:m,type:`text`,value:e,disabled:t,spellCheck:!1,"aria-label":i,placeholder:i,"aria-invalid":!e.trim(),onFocus:()=>{h.current=e.trim()},onChange:e=>n(e.target.value),onBlur:()=>{!t&&h.current!==e.trim()&&remember(e)},onKeyDown:n=>{!t&&n.key===`Enter`&&!n.nativeEvent.isComposing&&(n.preventDefault(),h.current=e.trim(),remember(e))}}),s.length>0?(0,d.jsx)(`div`,{className:`xmimo-tts-voice-id-history`,role:`group`,"aria-label":a,children:s.map(i=>{let a=r===`standard`?Ni.get(i):void 0;return(0,d.jsx)(VoiceIdTag,{voice:i,name:(Object.hasOwn(u,i)?u[i]??``:``).trim()||a,selected:e.trim()===i,disabled:t,t:o,selectRef:e=>{e?g.current.set(i,e):g.current.delete(i)},onSelect:()=>{n(i),remember(i)},onSave:e=>{let t={...readVoiceIdNames(r),[i]:e.trim()};p(t),writeVoiceIdNames(r,t)},onRemove:()=>remove(i)},i)})}):null]})}let Pi=`__custom__`,Fi=new Set([`zh_female_vv_uranus_bigtts`,`zh_female_xiaohe_uranus_bigtts`,`zh_male_m191_uranus_bigtts`,`zh_male_taocheng_uranus_bigtts`]);function DoubaoVoicePicker({value:e,disabled:t,minimal:n=!1,onChange:r,t:i}){let[a,o]=(0,l.useState)(!Re.some(t=>t.value===e)),s=n?Re.filter(e=>Fi.has(e.value)):Re,c=s.some(t=>t.value===e);return(0,d.jsxs)(`div`,{className:`xmimo-tts-doubao-voice-picker`,children:[(0,d.jsx)(VoicePresetPicker,{presets:[{id:Pi,value:Pi,label:i(`settings.doubaoCustomVoice`),summary:i(`settings.doubaoCustomVoiceHint`),fullWidth:!0,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-doubao-voice-avatar`,"aria-hidden":`true`,children:`+`})},...s.map(e=>({id:e.value,value:e.value,label:e.name,summary:`${i(e.scene===`角色`?`settings.doubaoVoiceSceneRole`:e.scene===`配音`?`settings.doubaoVoiceSceneDubbing`:e.scene===`阅读`?`settings.doubaoVoiceSceneReading`:`settings.doubaoVoiceSceneGeneral`)} · ${i(`settings.doubaoVoiceChinese`)}`,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-doubao-voice-avatar`,"aria-hidden":`true`,children:e.name.slice(0,1)})}))],label:i(`settings.voice`),value:a||!c?Pi:e,disabled:t,minimal:n,onChange:e=>{e===Pi?o(!0):(o(!1),r(e))}}),a||!c?(0,d.jsx)(VoiceIdInput,{kind:`standard`,value:e,disabled:t,label:i(`settings.doubaoVoiceId`),historyLabel:i(`settings.doubaoStandardVoiceHistory`),t:i,onChange:r}):(0,d.jsx)(`small`,{children:e})]})}let Ii=`__custom__`;function BreezeVoicePicker({value:e,disabled:t,t:n,onChange:r}){let[i,a]=(0,l.useState)(!se.some(t=>t.value===e));return(0,d.jsxs)(`div`,{className:`xmimo-tts-breeze-voice-picker`,children:[(0,d.jsx)(VoicePresetPicker,{presets:[{id:Ii,value:Ii,label:n(`settings.breezeCustomVoice`),summary:n(`settings.breezeCustomVoiceHint`),fullWidth:!0,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-doubao-voice-avatar`,"aria-hidden":`true`,children:`+`})},...se.map(e=>({id:e.value,value:e.value,label:e.name,summary:e.language,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-doubao-voice-avatar`,"aria-hidden":`true`,children:e.name.slice(0,1)})}))],label:n(`settings.voice`),value:i?Ii:e,disabled:t,onChange:e=>{e===Ii?a(!0):(a(!1),r(e))}}),i?(0,d.jsx)(VoiceIdInput,{kind:`breeze`,value:e,disabled:t,label:n(`settings.breezeVoiceHint`),historyLabel:n(`settings.breezeVoiceHistory`),t:n,onChange:r}):(0,d.jsx)(`small`,{children:e})]})}let Li=`__custom__`;function isPresetVoiceDesignPrompt(e){return M.some(t=>t.prompt===e)}let Ri=new Set([`energetic-girl`,`liang-wenfeng`,`young-man`,`gentle-girlfriend`]);function VoicePresetAvatar({preset:e,minimal:t}){return t?null:(0,d.jsx)(`img`,{className:`xmimo-tts-builtin-voice-avatar`,src:hostRoute(`/plugins/xiaomi-mimo-tts/voice-presets/${e.id}.webp`),alt:``,width:40,height:40,loading:`lazy`,"aria-hidden":`true`})}function CustomVoiceAvatar(){return(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-custom-voice-avatar`,"aria-hidden":`true`,children:(0,d.jsxs)(`svg`,{viewBox:`0 0 40 40`,focusable:`false`,children:[(0,d.jsx)(`circle`,{cx:`20`,cy:`14`,r:`6`}),(0,d.jsx)(`path`,{d:`M9.5 31.5c1.7-6.2 5.2-9.3 10.5-9.3s8.8 3.1 10.5 9.3`}),(0,d.jsx)(`path`,{d:`M31 8v8M27 12h8`})]})})}function VoicePresetCheck(){return(0,d.jsxs)(`svg`,{className:`xmimo-tts-builtin-voice-check`,viewBox:`0 0 14 14`,"aria-hidden":`true`,children:[(0,d.jsx)(`circle`,{cx:`7`,cy:`7`,r:`7`}),(0,d.jsx)(`path`,{d:`m3.5 7 2.1 2.1 4.9-4.7`})]})}function VoiceDesignPresetPicker({value:e,disabled:t,label:n,customLabel:r,customSummary:i,minimal:a=!1,onChange:o}){let[s,c]=(0,l.useState)(!1),p=(0,l.useRef)(null),m=(0,l.useRef)(null),h=(0,l.useRef)([]),g=(0,l.useId)(),_=a?M.filter(e=>Ri.has(e.id)):M,v=_.findIndex(t=>t.prompt===e),b=v<0?void 0:_[v],x=v+(a?0:1),S=_.length+(a?0:1);(0,l.useEffect)(()=>{if(a||!s)return;let closeOnOutsidePointer=e=>{e.target instanceof Node&&!p.current?.contains(e.target)&&c(!1)};return document.addEventListener(`pointerdown`,closeOnOutsidePointer),()=>document.removeEventListener(`pointerdown`,closeOnOutsidePointer)},[a,s]),(0,l.useEffect)(()=>{!a&&t&&c(!1)},[t,a]);let focusOption=e=>{let t=(e+S)%S;requestAnimationFrame(()=>h.current[t]?.focus())},openAndFocus=e=>{c(!0),focusOption(e)},choose=e=>{o(e),!a&&(c(!1),requestAnimationFrame(()=>m.current?.focus()))},handleTriggerKeyDown=e=>{e.key===`ArrowDown`?(e.preventDefault(),openAndFocus(x)):e.key===`ArrowUp`?(e.preventDefault(),openAndFocus(x===0?S-1:x)):e.key===`Home`?(e.preventDefault(),openAndFocus(0)):e.key===`End`&&(e.preventDefault(),openAndFocus(S-1))},handleOptionKeyDown=(e,t)=>{e.key===`ArrowDown`?(e.preventDefault(),focusOption(t+1)):e.key===`ArrowUp`?(e.preventDefault(),focusOption(t-1)):e.key===`Home`?(e.preventDefault(),focusOption(0)):e.key===`End`?(e.preventDefault(),focusOption(S-1)):e.key===`Escape`?(e.preventDefault(),c(!1),m.current?.focus()):e.key===`Tab`&&c(!1)};return(0,d.jsxs)(`div`,{className:`xmimo-tts-voice-picker xmimo-tts-builtin-voice-picker`,ref:p,children:[a?null:(0,d.jsxs)(`button`,{ref:m,type:`button`,className:`xmimo-tts-voice-picker-trigger`,disabled:t,"aria-label":n,"aria-haspopup":`listbox`,"aria-expanded":s,"aria-controls":s?g:void 0,onClick:()=>{c(e=>!e)},onKeyDown:handleTriggerKeyDown,children:[a?null:b===void 0?(0,d.jsx)(CustomVoiceAvatar,{}):(0,d.jsx)(VoicePresetAvatar,{preset:b,minimal:a}),(0,d.jsxs)(`span`,{className:`xmimo-tts-voice-option-copy`,children:[(0,d.jsx)(`strong`,{children:b?.label??r}),(0,d.jsx)(`small`,{children:b?.summary??i})]}),a?(0,d.jsx)(`span`,{className:`xmimo-tts-voice-picker-text-caret`,"aria-hidden":`true`,children:`⌄`}):(0,d.jsx)(u.IconChevronDownOutlineMedium,{className:s?`xmimo-tts-voice-picker-chevron xmimo-tts-voice-picker-chevron-open`:`xmimo-tts-voice-picker-chevron`,size:14})]}),a||s?(0,d.jsxs)(`div`,{id:g,className:`xmimo-tts-voice-picker-menu xmimo-tts-builtin-voice-menu`,role:`listbox`,"aria-label":n,children:[a?null:(0,d.jsxs)(`button`,{ref:e=>{h.current[0]=e},type:`button`,role:`option`,"aria-selected":b===void 0,disabled:t,className:b===void 0?`xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-selected xmimo-tts-builtin-voice-option-custom`:`xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-custom`,onClick:()=>{choose(Li)},onKeyDown:e=>{handleOptionKeyDown(e,0)},children:[(0,d.jsx)(CustomVoiceAvatar,{}),(0,d.jsxs)(`span`,{className:`xmimo-tts-voice-option-copy`,children:[(0,d.jsx)(`strong`,{children:r}),(0,d.jsx)(`small`,{children:i})]}),b===void 0?(0,d.jsx)(VoicePresetCheck,{}):null]}),_.map((e,n)=>(0,d.jsxs)(`button`,{ref:e=>{h.current[n+(a?0:1)]=e},type:`button`,role:`option`,"aria-selected":b?.id===e.id,disabled:t,className:b?.id===e.id?`xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-selected`:`xmimo-tts-builtin-voice-option`,onClick:()=>{choose(e.prompt)},onKeyDown:e=>{handleOptionKeyDown(e,n+(a?0:1))},children:[(0,d.jsx)(VoicePresetAvatar,{preset:e,minimal:a}),(0,d.jsxs)(`span`,{className:`xmimo-tts-voice-option-copy`,children:[(0,d.jsx)(`strong`,{children:e.label}),(0,d.jsx)(`small`,{children:e.summary})]}),b?.id===e.id?(0,d.jsx)(VoicePresetCheck,{}):null]},e.id))]}):null]})}function useAccordionViewport(e,t){let n=(0,l.useRef)(null),r=(0,l.useRef)(null);return(0,l.useLayoutEffect)(()=>{let t=n.current,i=t?.closest(`.xmimo-ui-accordion`),a=t?.firstElementChild;if(!e||!t||!i||!a)return;let o=[];for(let e=i.parentElement;e;e=e.parentElement)e!==document.scrollingElement&&/auto|scroll/.test(getComputedStyle(e).overflowY)&&o.push(e);let s=document.scrollingElement;s&&!/hidden|clip/.test(getComputedStyle(s).overflowY)&&o.push(s);let bounds=()=>{let e=window.visualViewport,t=e?.offsetTop??0,n=t+(e?.height??window.innerHeight);for(let e of o){if(e===s)continue;let r=e.getBoundingClientRect();t=Math.max(t,r.top+e.clientTop),n=Math.min(n,r.top+e.clientTop+e.clientHeight)}return{top:t+12,bottom:n-12}},sizeContent=()=>{let{top:e,bottom:t}=bounds(),n=i.querySelector(`.xmimo-ui-module-header`);a.style.maxHeight=`${Math.max(0,t-e-n.offsetHeight-2)}px`};sizeContent();let c=0,l=!1,cancel=()=>{l=!0,cancelAnimationFrame(c)},align=()=>{if(l||r.current===null)return;let{top:e,bottom:t}=bounds(),n=i.getBoundingClientRect(),a=Math.max(e,Math.min(r.current,t-n.height));for(let e of o){let t=i.getBoundingClientRect().top-a;if(Math.abs(t)<1)break;e.scrollTo({top:e.scrollTop+t,behavior:`instant`})}let s=i.parentElement?.querySelectorAll(`.xmimo-ui-accordion-collapse`)??[];Array.from(s).some(e=>e.getAnimations().some(e=>e.playState===`running`))&&(c=requestAnimationFrame(align))};c=requestAnimationFrame(align),window.addEventListener(`resize`,sizeContent),window.visualViewport?.addEventListener(`resize`,sizeContent);let u=[`wheel`,`touchstart`,`pointerdown`,`keydown`];for(let e of u)window.addEventListener(e,cancel,{passive:!0});let d=0,p=new ResizeObserver(()=>{cancelAnimationFrame(d),d=requestAnimationFrame(sizeContent)});for(let e of o)e!==s&&p.observe(e);return()=>{cancel(),p.disconnect(),cancelAnimationFrame(d),window.removeEventListener(`resize`,sizeContent),window.visualViewport?.removeEventListener(`resize`,sizeContent);for(let e of u)window.removeEventListener(e,cancel)}},[e]),{panel:n,toggle:()=>{r.current=e?null:n.current?.closest(`.xmimo-ui-accordion`)?.getBoundingClientRect().top??null,t()}}}function CollapsibleModule({className:e,title:t,summary:n,interactiveSummary:r=!1,open:i,onToggle:a,ariaLabel:o,children:s}){let c=(0,l.useId)(),{panel:u,toggle:p}=useAccordionViewport(i,a);return(0,d.jsx)(ModuleShell,{className:`xmimo-ui-accordion ${e}`,title:t,summary:n,interactiveSummary:r,collapsible:!0,open:i,onToggle:p,toggleId:`${c}-trigger`,controlsId:`${c}-panel`,ariaLabel:o,children:(0,d.jsx)(`div`,{id:`${c}-panel`,role:`region`,"aria-labelledby":`${c}-trigger`,className:`xmimo-ui-accordion-collapse${i?` xmimo-ui-accordion-collapse-open`:``}`,"aria-hidden":!i,ref:e=>{u.current=e,e&&(e.inert=!i)},children:(0,d.jsx)(`div`,{className:`xmimo-ui-accordion-content`,children:s})})})}function useNestedDisclosure(e){let t=(0,l.useRef)(null);return(0,l.useEffect)(()=>{!e&&t.current&&(t.current.open=!1)},[e]),t}let zi=[{value:D[0],labelKey:`preset`},{value:D[1],labelKey:`voiceDesign`}];function readScopeLabel(e){return e===`smart`?`settings.readScopeSmart`:e===`full`?`settings.readScopeFull`:`settings.readScopeFirstSegment`}function readScopeHint(e){return e===`smart`?`settings.readScopeSmartHint`:e===`full`?`settings.readScopeFullHint`:`settings.readScopeFirstSegmentHint`}function ModelPicker({value:e,disabled:t,label:n,presetLabel:r,voiceDesignLabel:i,onChange:a}){let o=zi.map(e=>({value:e.value,label:e.labelKey===`preset`?r:i}));return(0,d.jsx)(`div`,{className:`xmimo-tts-settings-segmented-wrap`,"data-xmimo-select-option":`true`,children:(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-model`,value:e,options:o,label:n,disabled:t,onChange:a,className:`xmimo-tts-settings-segmented`})})}function DetailsModule({externalSelection:e,onExternalSelectionChange:t,t:n,provider:r,doubaoModel:i,doubaoVoice:a,doubaoClonedVoice:o,breezeVoice:s,breezeInstruction:c,speechInstruction:p,onSpeechInstructionChange:m,onDoubaoModelChange:h,onDoubaoVoiceChange:g,onDoubaoClonedVoiceChange:_,onBreezeVoiceChange:v,onBreezeInstructionChange:b,open:x,minimal:S,writable:C,autoPlay:w,voiceVolume:E,voiceRate:D,readScope:A,model:F,localSpeechMode:I,localVoiceURI:V,localVoiceEngine:ee,mossEnabled:H,mossBaseURL:te,mossVoice:U,mossVoiceName:re,voice:se,voiceDesignPrompt:ce,voiceDesignCustomPrompt:le,fieldOverridden:ue,resetField:W,onToggle:de,onVoiceVolumeChange:fe,onVoiceVolumeInteractionEnd:pe,onVoiceRateChange:me,onVoiceRateInteractionEnd:he,onReadScopeChange:xe,onModelChange:Se,onVoiceDesignPromptChange:Ce,onVoiceChange:we,onLocalVoiceURIChange:Te,onLocalVoiceEngineChange:Ee,onMossBaseURLChange:De,onMossVoiceChange:Oe,onLocalSpeechModeChange:ke}){useEngineState();let Ae=externalEngine(),Me=C&&!Ae,[Ne,Pe]=(0,l.useState)(null),Fe=useNestedDisclosure(x),Ie=(0,l.useCallback)(e=>{Pe(e)},[]),Ve=ee===`browser`?Ne!==!1:!0;(0,l.useEffect)(()=>{!Ve&&I!==`auto`&&ke(`auto`)},[I,Ve,ke]);let He=n(r===`doubao`?i===`seed-icl-2.0`?`settings.doubaoCloneModel`:`settings.doubaoStandardModel`:F===`mimo-v2.5-tts-voicedesign`?`settings.summaryVoiceDesignModel`:`settings.summaryPresetModel`),Ue=M.find(e=>e.prompt===ce),Ke=r===`doubao`?i===`seed-icl-2.0`?o||n(`settings.doubaoVoiceId`):Re.find(e=>e.value===a)?.name??a:r===`breeze`?breezeVoiceLabel(s):F===`mimo-v2.5-tts-voicedesign`?Ue?.label??n(`settings.customVoiceOption`):se,Je=n(readScopeLabel(A)),Ye=n(I===`auto`?`settings.localSpeechAutoSummary`:I===`local-first`?`settings.localSpeechFirst`:`settings.localSpeechDisabled`),Ze=`${Math.round(E*100)}%`,Qe=`${D.toFixed(1)}×`,et=r===`doubao`?`doubaoInstruction`:r===`breeze`?`breezeInstruction`:`instruction`,tt=r!==`doubao`||i===`seed-tts-2.0`,nt=r===`breeze`?c:p,rt=tt?speechInstructionLabel(r,nt,n):null,it=(0,d.jsxs)(`div`,{className:`xmimo-tts-format`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.readScope`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:ue(`readScope`),resettable:!0,disabled:!C,onReset:()=>{W(`readScope`)}}),(0,d.jsx)(`div`,{className:`xmimo-tts-settings-segmented-wrap`,"data-xmimo-select-option":`true`,children:(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-read-scope`,value:A,options:P.map(e=>({value:e,label:n(readScopeLabel(e))})),label:n(`settings.readScope`),disabled:!C,onChange:xe,className:`xmimo-tts-settings-segmented`})}),S?null:(0,d.jsx)(`small`,{children:n(readScopeHint(A))})]});return(0,d.jsx)(CollapsibleModule,{className:`xmimo-tts-settings-module xmimo-tts-details xmimo-ui-module`,title:(0,d.jsxs)(`span`,{className:`xmimo-ui-module-title`,children:[(0,d.jsx)(RiEqualizerLine,{size:14,"aria-hidden":`true`,focusable:`false`}),n(`settings.detailedVoiceConfig`)]}),ariaLabel:n(`settings.detailedVoiceConfig`),summary:(0,d.jsxs)(`span`,{className:`xmimo-tts-details-summary xmimo-ui-summary`,children:[(0,d.jsx)(`span`,{children:Ze}),(0,d.jsx)(`span`,{children:Qe}),(0,d.jsx)(`span`,{children:Je}),Ae?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`span`,{children:Ae.name}),(0,d.jsx)(`span`,{children:e?.model??Ae.modelName}),(0,d.jsx)(`span`,{children:e?.voice??Ae.voiceName})]}):(0,d.jsxs)(d.Fragment,{children:[r===`breeze`?null:(0,d.jsx)(`span`,{children:He}),(0,d.jsx)(`span`,{children:Ke}),rt===null?null:(0,d.jsx)(`span`,{title:`${n(`settings.speechInstruction`)}: ${nt.trim()||rt}`,children:rt})]}),S?null:(0,d.jsx)(`span`,{children:Ye})]}),open:x,onToggle:de,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-grid xmimo-ui-grid xmimo-tts-details-body xmimo-ui-module-body`,children:[Ae?(0,d.jsx)(ExternalSpeechFields,{engine:Ae,selection:e,writable:C,minimal:S,t:n,onChange:t??(()=>{})}):(0,d.jsxs)(d.Fragment,{children:[r===`breeze`?null:(0,d.jsxs)(`div`,{className:`xmimo-tts-model`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.model`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:ue(r===`doubao`?`doubaoModel`:`model`),resettable:!0,disabled:!Me,onReset:()=>{W(r===`doubao`?`doubaoModel`:`model`)}}),r===`doubao`?(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-doubao-model`,value:i,options:[{value:`seed-tts-2.0`,label:n(`settings.doubaoStandardModel`)},{value:`seed-icl-2.0`,label:n(`settings.doubaoCloneModel`)}],label:n(`settings.model`),disabled:!Me,onChange:h,className:`xmimo-tts-settings-segmented xmimo-tts-doubao-models`}):(0,d.jsx)(ModelPicker,{value:F,disabled:!Me,label:n(`settings.model`),presetLabel:n(`settings.presetModelShort`),voiceDesignLabel:n(`settings.voiceDesignModelShort`),onChange:Se}),w&&!S?(0,d.jsx)(`small`,{children:n(r===`doubao`?`settings.doubaoStreamingHint`:F===`mimo-v2.5-tts`?`settings.modelAutoPlayHintPreset`:`settings.modelAutoPlayHintVoiceDesign`)}):null]}),r===`breeze`?(0,d.jsxs)(`div`,{className:`xmimo-tts-voice`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.voice`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:ue(`breezeVoice`),resettable:!0,disabled:!Me,onReset:()=>W(`breezeVoice`)}),(0,d.jsx)(BreezeVoicePicker,{value:s,disabled:!Me,t:n,onChange:v})]}):r===`doubao`?(0,d.jsxs)(`div`,{className:`xmimo-tts-voice xmimo-tts-doubao-voice${i===`seed-icl-2.0`?` xmimo-tts-cloned-voice`:``}`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(i===`seed-icl-2.0`?`settings.doubaoClonedVoiceLabel`:`settings.voice`),suffix:(0,d.jsxs)(`small`,{className:`xmimo-tts-doubao-voice-hint`,children:[(0,d.jsx)(`a`,{href:i===`seed-icl-2.0`?`https://console.volcengine.com/speech/new/experience/clone?projectName=default`:`https://console.volcengine.com/speech/new/voices?projectName=default`,target:`_blank`,rel:`noopener noreferrer`,children:n(i===`seed-icl-2.0`?`settings.doubaoCreateVoice`:`settings.doubaoVoiceLibrary`)}),i===`seed-icl-2.0`?(0,d.jsxs)(d.Fragment,{children:[` `,n(`settings.doubaoCloneHint`)]}):null]}),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:ue(i===`seed-icl-2.0`?`doubaoClonedVoice`:`doubaoVoice`),resettable:!0,disabled:!Me,onReset:()=>W(i===`seed-icl-2.0`?`doubaoClonedVoice`:`doubaoVoice`)}),i===`seed-icl-2.0`?(0,d.jsx)(VoiceIdInput,{kind:`cloned`,value:o,disabled:!Me,label:n(`settings.doubaoClonedVoice`),historyLabel:n(`settings.doubaoClonedVoiceHistory`),t:n,onChange:_}):(0,d.jsx)(DoubaoVoicePicker,{value:a,disabled:!Me,minimal:S,onChange:g,t:n})]}):null,r===`xiaomi`&&F===`mimo-v2.5-tts-voicedesign`?(0,d.jsxs)(`div`,{className:`xmimo-tts-voice-design-prompt`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.voiceDesignPrompt`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:ue(`voiceDesignPrompt`),resettable:!0,disabled:!Me,onReset:()=>{W(`voiceDesignPrompt`)}}),(0,d.jsx)(VoiceDesignPresetPicker,{value:isPresetVoiceDesignPrompt(ce)?ce:Li,disabled:!Me,label:n(`settings.voiceDesignPrompt`),customLabel:n(`settings.customVoiceOption`),customSummary:n(`settings.customVoiceSummary`),minimal:S,onChange:e=>{Ce(e===Li?le:e)}}),(0,d.jsx)(`textarea`,{value:ce,rows:3,disabled:!Me,placeholder:n(`settings.voiceDesignPromptHint`),onChange:e=>{Ce(e.target.value)}}),S?null:(0,d.jsx)(`small`,{children:n(`settings.voiceDesignPromptHint`)})]}):null,r===`xiaomi`&&F===`mimo-v2.5-tts`?(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(`div`,{className:`xmimo-tts-voice`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.voice`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:ue(`voice`),resettable:!0,disabled:!Me,onReset:()=>{W(`voice`)}}),(0,d.jsx)(BuiltInVoicePicker,{value:se,disabled:!Me,label:n(`settings.voice`),minimal:S,onChange:we})]})}):null,tt?(0,d.jsxs)(`div`,{className:`xmimo-tts-voice xmimo-tts-speech-instruction`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.speechInstruction`),suffix:(0,d.jsx)(FieldInfo,{label:n(`settings.speechInstructionInfo`),text:n(`settings.speechInstructionLimitations`)}),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:ue(et),resettable:!0,disabled:!Me,onReset:()=>W(et)}),r===`breeze`?(0,d.jsx)(SpeechInstructionPicker,{provider:r,value:c,disabled:!Me,minimal:S,onChange:b,t:n}):(0,d.jsx)(SpeechInstructionPicker,{provider:r,value:p,disabled:!Me,minimal:S,onChange:m,t:n})]}):null]}),(0,d.jsxs)(`details`,{ref:Fe,className:`xmimo-tts-more-settings`,children:[(0,d.jsxs)(`summary`,{className:`xmimo-tts-builtin-voice-trigger`,children:[(0,d.jsx)(`span`,{children:n(`settings.more`)}),(0,d.jsx)(`span`,{className:`xmimo-tts-more-settings-hint`,children:n(`settings.moreHint`)}),(0,d.jsx)(RiArrowDownSLine,{className:`xmimo-tts-voice-picker-chevron`,size:16,"aria-hidden":`true`,focusable:`false`})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-more-settings-body`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-playback-controls`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-volume`,children:[(0,d.jsx)(SettingFieldHeading,{label:`${n(`settings.voiceVolume`)} ${Ze}`,overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:ue(`voiceVolume`),resettable:!0,disabled:!C,onReset:()=>{W(`voiceVolume`)}}),(0,d.jsx)(EnergyVolumeSlider,{value:E,label:n(`settings.voiceVolume`),minimal:S,disabled:!C,onChange:fe,onInteractionEnd:pe})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-volume`,children:[(0,d.jsx)(SettingFieldHeading,{label:`${n(`settings.voiceRate`)} ${D.toFixed(1)}×`,suffix:(0,d.jsx)(FieldInfo,{label:n(`settings.voiceRateInfo`),text:n(`settings.voiceRateHint`)}),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:ue(`voiceRate`),resettable:!0,disabled:!C,onReset:()=>{W(`voiceRate`)}}),(0,d.jsx)(EnergyVolumeSlider,{value:D,min:.5,max:2,step:.1,formatValue:e=>`${e.toFixed(1)}×`,label:n(`settings.voiceRate`),minimal:S,disabled:!C,onChange:me,onInteractionEnd:he})]})]}),S?null:(0,d.jsx)(LocalVoiceModule,{t:n,minimal:S,writable:C,localSpeechMode:I,engine:ee,mossEnabled:H,browserVoiceURI:V,mossBaseURL:te,mossVoice:U,mossVoiceName:re,fieldOverridden:ue,resetField:W,onEngineChange:Ee,onBrowserVoiceChange:Te,onMossBaseURLChange:De,onMossVoiceChange:Oe,onBrowserAvailabilityChange:Ie}),it,S?null:(0,d.jsxs)(`div`,{className:`xmimo-tts-format`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.localSpeechMode`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:ue(`localSpeechMode`),resettable:!0,disabled:!C,onReset:()=>{W(`localSpeechMode`)}}),(0,d.jsx)(`div`,{className:`xmimo-tts-settings-segmented-wrap`,"data-xmimo-select-option":`true`,children:(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-local-speech-mode`,value:I,options:k.map(e=>({value:e,label:n(e===`auto`?`settings.localSpeechAuto`:e===`local-first`?`settings.localSpeechFirst`:`settings.localSpeechDisabled`),disabled:!Ve&&e!==`auto`})),label:n(`settings.localSpeechMode`),disabled:!C,onChange:ke,className:`xmimo-tts-settings-segmented`})}),(0,d.jsx)(`small`,{children:n(Ve?I===`auto`?`settings.localSpeechAutoHint`:I===`local-first`?`settings.localSpeechFirstHint`:`settings.localSpeechDisabledHint`:`settings.localSpeechUnavailableHint`)})]})]})]})]})})}let Bi=[{id:`question-titles`,label:`settings.announcementsQuestions`,hint:`settings.announcementsQuestionsHint`,href:null},{id:`approvals`,label:`settings.announcementsApprovals`,hint:`settings.announcementsApprovalsHint`,href:null},{id:`job-results`,label:`settings.announcementsJobs`,hint:`settings.announcementsJobsHint`,href:null}],Vi=[{id:`dsh-pet`,label:`settings.announcementsPet`,hint:`settings.announcementsPetHint`,href:`https://github.com/PC2005-cloud/dsh-pet`},{id:`dsh-whale-musume`,label:`settings.announcementsWhale`,hint:`settings.announcementsWhaleHint`,href:`https://github.com/Sutera-Diffusus/dsh-whale-musume`}],Hi=[...Bi,...Vi],Ui=[{label:`settings.announcementsTitle`,hint:`settings.announcementsHint`,options:Bi},{label:`settings.announcementsPlugins`,hint:`settings.announcementsPluginsHint`,options:Vi}];function AnnouncementSettings({children:e,t,sources:n,qqbotEnabled:r,onQqbotChange:i,voiceInputCompatibility:a,onVoiceInputCompatibilityChange:o,voiceInputCompatibilityOverridden:s,onVoiceInputCompatibilityReset:c,showInHostSettings:l,onShowInHostSettingsChange:p,showInHostSettingsOverridden:m,onShowInHostSettingsReset:h,acceptExternalProviders:g,onAcceptExternalProvidersChange:_,acceptExternalProvidersOverridden:v,onAcceptExternalProvidersReset:b,inputAvoidance:x,onInputAvoidanceChange:S,inputAvoidanceOverridden:C,onInputAvoidanceReset:w,importantAnnouncementsFirst:E,onImportantAnnouncementsFirstChange:D,importantAnnouncementsFirstOverridden:k,onImportantAnnouncementsFirstReset:A,writable:M,overridden:P,onChange:F,onReset:I,parentOpen:V=!0}){let H=useNestedDisclosure(V),te=[{label:`settings.voiceInputCompatibility`,hint:`settings.voiceInputCompatibilityHint`,checked:a,overridden:s,onChange:o,onReset:c},{label:`settings.showInHostSettings`,hint:`settings.showInHostSettingsHint`,checked:l,overridden:m,onChange:p,onReset:h},{label:`settings.acceptExternalProviders`,hint:`settings.acceptExternalProvidersHint`,checked:g,overridden:v,onChange:_,onReset:b},{label:`settings.inputAvoidance`,hint:`settings.inputAvoidanceHint`,checked:x,overridden:C,onChange:S,onReset:w},{label:`settings.importantAnnouncementsFirst`,hint:`settings.importantAnnouncementsFirstHint`,checked:E,overridden:k,onChange:D,onReset:A}];return(0,d.jsxs)(`details`,{ref:H,className:`xmimo-tts-more-settings`,children:[(0,d.jsxs)(`summary`,{className:`xmimo-tts-builtin-voice-trigger`,children:[(0,d.jsx)(`span`,{children:t(`settings.more`)}),(0,d.jsx)(`span`,{className:`xmimo-tts-more-settings-hint`,children:t(`settings.announcementsMoreHint`)}),(0,d.jsx)(RiArrowDownSLine,{className:`xmimo-tts-voice-picker-chevron`,size:16,"aria-hidden":`true`,focusable:`false`})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-more-settings-body`,children:[e,(0,d.jsxs)(`section`,{className:`xmimo-tts-format xmimo-tts-switch-grid`,"aria-label":t(`settings.hostIntegration`),children:[(0,d.jsx)(SettingFieldHeading,{label:t(`settings.hostIntegration`),resettable:!1,disabled:!M}),te.map(e=>(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(SettingFieldHeading,{label:t(e.label),overriddenLabel:t(`settings.overridden`),resetLabel:t(`settings.reset`),overridden:e.overridden,resettable:!0,disabled:!M,onReset:e.onReset}),(0,d.jsx)(`small`,{children:t(e.hint)})]}),(0,d.jsx)(u.Switch,{checked:e.checked,disabled:!M,label:t(e.label),onChange:e.onChange})]},e.label))]}),Ui.map((e,a)=>(0,d.jsxs)(`section`,{className:`xmimo-tts-format xmimo-tts-switch-grid`,"aria-label":t(e.label),children:[(0,d.jsx)(SettingFieldHeading,{label:t(e.label),suffix:(0,d.jsx)(FieldInfo,{label:t(e.label),text:t(e.hint)}),overriddenLabel:t(`settings.overridden`),resetLabel:t(`settings.reset`),overridden:a===0&&P,resettable:!0,disabled:!M,onReset:I}),e.options.map(e=>(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`div`,{children:[e.href?(0,d.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[t(e.label),` ↗`]}):(0,d.jsx)(`span`,{children:t(e.label)}),(0,d.jsx)(`small`,{children:t(e.hint)})]}),(0,d.jsx)(u.Switch,{checked:n.includes(e.id),disabled:!M,label:t(e.label),onChange:t=>F(ee.filter(r=>r===e.id?t:n.includes(r)))})]},e.id)),a===1?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`a`,{href:`https://github.com/tencent-connect/dsh-qqbot`,target:`_blank`,rel:`noopener noreferrer`,children:[t(`settings.qqbotIntegration`),` ↗`]}),(0,d.jsx)(`small`,{children:t(`settings.qqbotIntegrationHint`)})]}),(0,d.jsx)(u.Switch,{checked:r,disabled:!M,label:t(`settings.qqbotIntegration`),onChange:i})]}),(0,d.jsx)(`div`,{className:`xmimo-tts-announcement-source`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`a`,{href:`https://github.com/ppy-web/whaletalk-passport#readme`,target:`_blank`,rel:`noopener noreferrer`,children:[t(`settings.passportIntegration`),` ↗`]}),(0,d.jsx)(`small`,{children:t(`settings.passportIntegrationHint`)})]})})]}):null]},e.label))]})]})}function PlaybackIcon({state:e}){return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:e===`play`?(0,d.jsx)(`path`,{d:`M6 3.8a.8.8 0 0 1 1.2-.7l7.3 5.2a.85.85 0 0 1 0 1.4l-7.3 5.2a.8.8 0 0 1-1.2-.7Z`}):e===`stop`?(0,d.jsx)(`rect`,{x:`4`,y:`4`,width:`10`,height:`10`,rx:`1`}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`rect`,{x:`4`,y:`3`,width:`3.5`,height:`12`,rx:`1`}),(0,d.jsx)(`rect`,{x:`10.5`,y:`3`,width:`3.5`,height:`12`,rx:`1`})]})})}let Wi={zh:[{label:`笑声`,tags:[`[笑]`,`[轻笑]`,`[咯咯笑]`]},{label:`哭声与疼痛`,tags:[`[哭声]`,`[抽泣]`,`[呜咽]`,`[呻吟]`,`[哀号]`]},{label:`呼吸`,tags:[`[叹气]`,`[惊呼]`,`[吸气]`,`[呼气]`,`[喘息]`]},{label:`发声方式`,tags:[`[耳语]`,`[喊叫]`,`[惨叫]`,`[唱歌]`,`[哼歌]`,`[结巴]`,`[停顿]`]},{label:`喉咙与鼻音`,tags:[`[清嗓]`,`[咳嗽]`,`[吸鼻子]`,`[咂嘴]`,`[啧嘴]`]},{label:`身体反应`,tags:[`[打哈欠]`,`[打喷嚏]`,`[打嗝]`,`[打饱嗝]`,`[吞咽]`,`[干呕]`]},{label:`情绪反应`,tags:[`[闷哼]`,`[冷笑]`,`[哼鼻子]`]}],en:[{label:`Laughter`,tags:[`(laughs)`,`(chuckles)`,`(giggles)`]},{label:`Crying & pain`,tags:[`(cries)`,`(sobs)`,`(whimpers)`,`(groans)`,`(moans)`]},{label:`Breathing`,tags:[`(sighs)`,`(gasps)`,`(inhales)`,`(exhales)`,`(breathes heavily)`]},{label:`Vocal delivery`,tags:[`(whispers)`,`(shouts)`,`(screams)`,`(sings)`,`(hums)`,`(stutters)`,`(pauses)`]},{label:`Throat & nose`,tags:[`(clears throat)`,`(coughs)`,`(sniffles)`,`(lip smacks)`,`(clicks tongue)`]},{label:`Body reflexes`,tags:[`(yawns)`,`(sneezes)`,`(hiccups)`,`(burps)`,`(gulps)`,`(gags)`]},{label:`Emotional reactions`,tags:[`(grunts)`,`(scoffs)`,`(snorts)`]}]};function AudioTagPicker({provider:e,disabled:t,textRef:n,onInsert:r,t:i,tags:a}){let[o,s]=(0,l.useState)(`zh`),[c,p]=(0,l.useState)(!1),[h,g]=(0,l.useState)(!1),_=(0,l.useId)(),v=(0,l.useRef)(null),b=(0,l.useRef)(null),x=(0,l.useRef)(null),S=c&&!t,C=(0,u.useAnchoredPosition)({open:S,anchorRef:b,panelRef:x,side:`bottom`,align:`start`,gap:6,margin:12,layoutKey:`${e}:${o}`});(0,l.useEffect)(()=>{if(!S)return;let dismissOutside=e=>{let t=e.target;!(t instanceof Node)||v.current?.contains(t)||x.current?.contains(t)||h&&n.current?.contains(t)||p(!1)};return document.addEventListener(`pointerdown`,dismissOutside),document.addEventListener(`focusin`,dismissOutside),()=>{document.removeEventListener(`pointerdown`,dismissOutside),document.removeEventListener(`focusin`,dismissOutside)}},[S,h,n]),(0,l.useEffect)(()=>{if(!S)return;x.current?.querySelector(`button`)?.focus({preventScroll:!0});let onKeyDown=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),p(!1),b.current?.focus({preventScroll:!0}))};return document.addEventListener(`keydown`,onKeyDown),()=>document.removeEventListener(`keydown`,onKeyDown)},[S]);let w=e===`xiaomi`?ce.map(e=>({label:e[o],tags:(o===`zh`?e.tags:e.english).map(e=>`(${e})`),...`placement`in e?{placement:e.placement}:{}})):e===`external`?[{label:i(`settings.breezeAudioTags`),tags:(a??[]).map(e=>e.value)}]:Wi[o];return(0,d.jsxs)(`div`,{ref:v,className:S?`xmimo-tts-breeze-audio-tags xmimo-tts-breeze-audio-tags-open`:`xmimo-tts-breeze-audio-tags`,children:[(0,d.jsxs)(`button`,{type:`button`,ref:b,className:`xmimo-tts-breeze-audio-tags-toggle`,"aria-expanded":S,"aria-controls":S?_:void 0,"aria-haspopup":`dialog`,disabled:t,onClick:()=>p(e=>!e),children:[(0,d.jsx)(`span`,{children:i(`settings.breezeAudioTags`)}),(0,d.jsx)(RiArrowDownSLine,{className:`xmimo-tts-chevron`,size:14,"aria-hidden":`true`,focusable:`false`})]}),S?(0,m.createPortal)((0,d.jsxs)(`div`,{ref:x,id:_,className:`xmimo-ui-scope xmimo-tts-breeze-audio-tags-panel`,role:`dialog`,"aria-label":i(`settings.breezeAudioTags`),style:C??{visibility:`hidden`},children:[(0,d.jsx)(`small`,{children:i(e===`external`?`settings.externalOptionsHint`:e===`xiaomi`?`settings.xiaomiAudioTagsHint`:`settings.breezeAudioTagsHint`)}),(0,d.jsxs)(`div`,{className:`xmimo-tts-settings-segmented-wrap`,children:[e===`external`?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(u.Button,{type:`button`,"aria-pressed":o===`zh`,variant:o===`zh`?`primary`:`ghost`,size:`sm`,disabled:t,onClick:()=>s(`zh`),children:i(`settings.breezeAudioTagsChinese`)}),(0,d.jsx)(u.Button,{type:`button`,"aria-pressed":o===`en`,variant:o===`en`?`primary`:`ghost`,size:`sm`,disabled:t,onClick:()=>s(`en`),children:i(`settings.breezeAudioTagsEnglish`)})]}),(0,d.jsx)(u.Button,{type:`button`,className:`xmimo-tts-audio-tags-continuous`,"aria-label":i(`settings.audioTagsContinuous`),"aria-pressed":h,title:i(`settings.audioTagsContinuousHint`),variant:h?`primary`:`ghost`,size:`sm`,disabled:t,onClick:()=>g(e=>!e),children:h?(0,d.jsx)(RiPushpinFill,{size:14,"aria-hidden":`true`}):(0,d.jsx)(RiPushpinLine,{size:14,"aria-hidden":`true`})})]}),w.map(e=>(0,d.jsxs)(`div`,{className:`xmimo-tts-breeze-audio-tag-group`,children:[(0,d.jsx)(`strong`,{children:e.label}),(0,d.jsx)(`div`,{className:`xmimo-tts-breeze-audio-tag-list`,children:e.tags.map(n=>(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,disabled:t,onClick:()=>{h||p(!1),r(n,e.placement)},children:n},n))})]},e.label))]}),document.body):null]})}let Gi=`https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts`,Ki=`https://ppy-web.github.io/dsh-plugin-xiaomi-mimo-tts/#manual`;function ProviderSettings({t:e,writable:t,providerLocked:n=!1,doubaoEnabled:r,breezeEnabled:i,mossEnabled:a,onMossEnabledChange:o,onProviderEnabledChange:s}){let c=t&&!n;return(0,d.jsxs)(`section`,{className:`xmimo-tts-format xmimo-tts-provider-settings xmimo-tts-switch-grid`,"aria-label":e(`settings.provider`),children:[(0,d.jsx)(SettingFieldHeading,{label:e(`settings.provider`),suffix:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(FieldInfo,{label:e(`settings.provider`),text:e(`settings.providerMinimum`)}),(0,d.jsxs)(`a`,{className:`xmimo-tts-api-key-link`,href:`https://github.com/ppy-web/dsh-speech-provider-adapter`,target:`_blank`,rel:`noopener noreferrer`,children:[e(`settings.externalProviderAdapter`),` ↗`]})]}),resettable:!1,disabled:!t}),(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`span`,{className:`xmimo-tts-provider-settings-brand`,children:[(0,d.jsx)(`img`,{src:hostRoute(b.xiaomi),alt:``}),(0,d.jsx)(`span`,{children:`XiaoMi Mimo`})]}),(0,d.jsx)(u.Switch,{checked:!0,disabled:!0,label:`XiaoMi Mimo`,onChange:()=>{}})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`span`,{className:`xmimo-tts-provider-settings-brand`,children:[(0,d.jsx)(`img`,{src:hostRoute(b.doubao),alt:``}),(0,d.jsx)(`span`,{children:`DouBao Seed`})]}),(0,d.jsx)(u.Switch,{checked:r,disabled:!c||r&&!i,label:`DouBao Seed`,onChange:e=>s(`doubao`,e)})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`span`,{className:`xmimo-tts-more-provider-brand`,children:[(0,d.jsx)(`span`,{className:`xmimo-tts-breeze-wordmark`,role:`img`,"aria-label":`Breeze Blue`,style:{"--xmimo-breeze-wordmark":`url(${hostRoute(`/plugins/xiaomi-mimo-tts/provider-breeze-logo-light.png`)})`}}),(0,d.jsx)(u.Tag,{tone:`info`,className:`xmimo-tts-experimental-tag`,children:e(`settings.experimental`)})]}),(0,d.jsx)(u.Switch,{checked:i,disabled:!c||i&&!r,label:e(`settings.breezeEnabled`),onChange:e=>s(`breeze`,e)})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`span`,{className:`xmimo-tts-provider-settings-brand xmimo-tts-provider-settings-local`,children:[(0,d.jsx)(`img`,{src:hostRoute(`/plugins/xiaomi-mimo-tts/provider-moss-logo.svg`),alt:``}),(0,d.jsx)(`span`,{children:e(`settings.mossProvider`)}),(0,d.jsx)(u.Tag,{tone:`info`,className:`xmimo-tts-experimental-tag`,children:e(`settings.experimental`)})]}),(0,d.jsx)(u.Switch,{checked:a,disabled:!t,label:e(`settings.mossProvider`),onChange:o})]})]})}let qi=[{label:`settings.previewPresetGreeting`,text:`settings.previewDefaultText`},{label:`settings.previewPresetPoetry`,text:`settings.previewDefaultTextPoetry`},{label:`settings.previewPresetInspiration`,text:`settings.previewDefaultTextInspiration`},{label:`settings.previewPresetReflection`,text:`settings.previewDefaultTextReflection`},{label:`settings.previewPresetHumor`,text:`settings.previewDefaultTextHumor`},{label:`settings.previewPresetNews`,text:`settings.previewDefaultTextNews`},{label:`settings.previewPresetStory`,text:`settings.previewDefaultTextStory`},{label:`settings.previewPresetService`,text:`settings.previewDefaultTextService`},{label:`settings.previewPresetDialogue`,text:`settings.previewDefaultTextDialogue`}];function filterAudioHistory(e,t,n){let r=t.trim().toLocaleLowerCase();return e.filter(e=>(n===`all`||e.source===n)&&e.text.toLocaleLowerCase().includes(r)).sort((e,t)=>t.createdAt-e.createdAt)}function historyFileSize(e){return e<1024*1024?`${e===0?0:Math.max(1,Math.round(e/1024))} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function historyTime(e){let t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0;return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}var HistoryDownloads=class{pending=new Map;download(e){this.downloadBlob(e.blob,`mimo-${new Date(e.createdAt).toISOString().replace(/[:.]/gu,`-`)}-${e.id.slice(0,8)}.${e.format}`)}downloadBlob(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t;try{document.body.appendChild(r),r.click()}catch(e){throw URL.revokeObjectURL(n),e}finally{r.remove()}this.pending.set(n,setTimeout(()=>{URL.revokeObjectURL(n),this.pending.delete(n)},1e3))}dispose(){for(let[e,t]of this.pending)clearTimeout(t),URL.revokeObjectURL(e);this.pending.clear()}};function PreviewModule({t:e,enabled:t,status:n,source:r,error:i,text:a,recording:o,onToggle:s,onTextChange:c,open:p,onToggleOpen:m,audioTagProvider:h,externalSelection:g,doubaoEnabled:_,breezeEnabled:v,mossEnabled:b,onMossEnabledChange:x,onProviderEnabledChange:S,...C}){useEngineState();let w=externalEngine(),E=w?.models?.find(e=>e.id===(g?.model??w.selection?.model))?.audioTags,D=(0,l.useRef)(null),[k]=(0,l.useState)(()=>new HistoryDownloads),[A,M]=(0,l.useState)(!1);(0,l.useEffect)(()=>()=>k.dispose(),[k]);let changeText=e=>{M(!1),c(e)},download=()=>{if(o!==null){M(!1);try{k.downloadBlob(o.blob,`tts-preview-${Date.now()}.${o.format}`)}catch{M(!0)}}},insertTag=(e,t)=>{let n=D.current;if(n===null)return;let r=t===`start`?0:n.selectionStart??a.length,i=t===`start`?0:n.selectionEnd??r,o=r>0&&!/\s$/u.test(a.slice(0,r))?` `:``;changeText(`${a.slice(0,r)}${o}${e}${a.slice(i)}`),requestAnimationFrame(()=>{n.focus();let t=r+o.length+e.length;n.setSelectionRange(t,t)})},P=n===`loading`||n===`playing`,F=w&&r===null?w.ready?`settings.externalManaged`:`settings.externalNotReady`:r===`external`&&n!==`error`?n===`loading`?`settings.externalLoading`:n===`playing`?`settings.externalPlaying`:`settings.externalCompleted`:n===`error`?i===`save-key-first`?`settings.previewSaveKeyFirst`:i===`voice-required`?`settings.doubaoVoiceRequired`:i===`voice-unavailable`?`settings.previewErrorVoiceUnavailable`:i===`resource-unavailable`?`settings.previewErrorResourceUnavailable`:i===`stream-buffer-limit`?`settings.previewErrorBufferLimit`:i===`api-key-not-configured`?`settings.previewErrorApiKeyMissing`:i===`api-key-rejected`?`settings.previewErrorApiKeyRejected`:i===`rate-limited`?`settings.previewErrorRateLimited`:i===`timeout`?`settings.previewErrorTimeout`:i===`local-voice-unavailable`?`settings.previewErrorLocalUnavailable`:i===`autoplay-blocked`?`settings.previewErrorAutoplay`:`settings.previewFailed`:n===`loading`?r===`doubao`?`settings.previewLoadingDoubao`:r===`breeze`?`settings.previewLoadingBreeze`:r===`local`?`settings.previewLoadingLocal`:`settings.previewLoadingMimo`:n===`playing`?r===`doubao`?`settings.previewPlayingDoubao`:r===`breeze`?`settings.previewPlayingBreeze`:r===`local`?`settings.previewPlayingLocal`:`settings.previewPlayingMimo`:r===`doubao`?`settings.previewCompletedDoubao`:r===`breeze`?`settings.previewCompletedBreeze`:r===`local`?`settings.previewCompletedLocal`:r===`mimo`?`settings.previewCompletedMimo`:`settings.previewHint`;return(0,d.jsx)(CollapsibleModule,{className:`xmimo-tts-settings-module xmimo-tts-broadcast`,title:(0,d.jsxs)(`span`,{className:`xmimo-ui-module-title`,children:[(0,d.jsx)(RiRadio2Line,{size:14,"aria-hidden":`true`,focusable:`false`}),e(`settings.previewTitle`)]}),ariaLabel:e(`settings.previewTitle`),open:p,onToggle:m,interactiveSummary:!0,summary:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`span`,{className:`xmimo-ui-summary`,children:[(0,d.jsxs)(`button`,{type:`button`,className:`xmimo-tts-preview-tag`,title:e(P?`settings.previewStop`:`settings.previewPlay`),"aria-label":e(P?`settings.previewStop`:`settings.previewPlay`),"aria-pressed":P,disabled:!t||!P&&a.trim().length===0,onClick:s,children:[(0,d.jsx)(PlaybackIcon,{state:P?`stop`:`play`}),(0,d.jsx)(`span`,{children:e(P?`settings.previewStopShort`:`settings.previewListen`)})]}),Hi.filter(e=>C.sources.includes(e.id)).map(t=>(0,d.jsx)(`span`,{children:e(t.label)},t.id)),C.qqbotEnabled?(0,d.jsx)(`span`,{children:e(`settings.qqbotIntegration`)}):null,C.sources.length===0&&!C.qqbotEnabled?(0,d.jsx)(`span`,{children:e(`settings.announcementsNone`)}):null]}),!p&&n===`error`?(0,d.jsx)(`small`,{className:`xmimo-tts-preview-summary-status xmimo-tts-failed`,role:`status`,children:e(F)}):null]}),children:(0,d.jsxs)(`div`,{className:`xmimo-tts-broadcast-body`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-format`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-preview-input`,children:[(0,d.jsx)(`textarea`,{ref:D,value:a,rows:5,maxLength:100,"aria-label":e(`settings.previewText`),placeholder:e(`settings.previewPlaceholder`),onChange:e=>{changeText(e.target.value)}}),(0,d.jsxs)(`div`,{className:`xmimo-tts-preview-tools`,children:[(0,d.jsx)(`div`,{className:`xmimo-tts-preview-presets`,role:`group`,"aria-label":e(`settings.previewPresets`),children:qi.map(t=>(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-preview-preset`,"aria-pressed":a===e(t.text),title:e(t.text),onClick:()=>changeText(e(t.text)),children:e(t.label)},t.text))}),(0,d.jsxs)(`div`,{className:`xmimo-tts-preview-actions`,children:[w?E?.length?(0,d.jsx)(AudioTagPicker,{provider:`external`,tags:E,disabled:!t,textRef:D,onInsert:insertTag,t:e}):null:h?(0,d.jsx)(AudioTagPicker,{provider:h,disabled:!t||w!==null,textRef:D,onInsert:insertTag,t:e},h):null,(0,d.jsxs)(`div`,{className:`xmimo-tts-preview-playback-actions`,children:[(0,d.jsxs)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,className:`xmimo-tts-preview-toggle`,title:e(P?`settings.previewStop`:`settings.previewPlay`),"aria-label":e(P?`settings.previewStop`:`settings.previewPlay`),disabled:!t||!P&&a.trim().length===0,onClick:()=>{M(!1),s()},children:[(0,d.jsx)(PlaybackIcon,{state:P?`stop`:`play`}),(0,d.jsx)(`span`,{children:e(P?`settings.previewStopShort`:`settings.previewListen`)})]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,className:`xmimo-tts-preview-download`,"aria-label":e(`settings.previewDownload`),title:e(o===null?r===`local`?`settings.previewDownloadLocal`:`settings.previewDownloadUnavailable`:`settings.previewDownload`),disabled:o===null,onClick:download,children:[(0,d.jsx)(RiDownloadLine,{size:16,"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:e(`history.download`)})]})]})]})]})]}),(0,d.jsx)(`small`,{className:n===`error`?`xmimo-tts-failed`:`xmimo-tts-preview-status`,"aria-live":`polite`,children:e(F)}),A?(0,d.jsx)(`small`,{className:`xmimo-tts-failed`,role:`alert`,children:e(`settings.previewDownloadFailed`)}):null]}),(0,d.jsx)(ProviderSettings,{t:e,writable:C.writable,providerLocked:w!==null,doubaoEnabled:_,breezeEnabled:v,mossEnabled:b,onMossEnabledChange:x,onProviderEnabledChange:S}),(0,d.jsx)(AnnouncementSettings,{t:e,...C,parentOpen:p})]})})}function SoundEffectIcon({cue:e}){switch(e){case`start`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:(0,d.jsx)(`path`,{d:`M6 3.8a.8.8 0 0 1 1.2-.7l7.3 5.2a.85.85 0 0 1 0 1.4l-7.3 5.2a.8.8 0 0 1-1.2-.7Z`})});case`complete`:case`success`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,d.jsx)(`path`,{d:`M15 5L7 14L3 10`})});case`error`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,d.jsx)(`circle`,{cx:`9`,cy:`9`,r:`7`}),(0,d.jsx)(`path`,{d:`M12 6L6 12M6 6l6 6`})]});case`notification`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:[(0,d.jsx)(`path`,{d:`M9 2a1 1 0 0 1 1 1v.5a5 5 0 0 1 3 4.5v3l1.3 1.6a.5.5 0 0 1-.4.9H4.1a.5.5 0 0 1-.4-.9L5 11V8a5 5 0 0 1 3-4.5V3a1 1 0 0 1 1-1Z`}),(0,d.jsx)(`path`,{d:`M7 14.5a2 2 0 1 0 4 0`})]});case`press`:case`select`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,d.jsx)(`circle`,{cx:`9`,cy:`9`,r:`3`,fill:`currentColor`}),(0,d.jsx)(`path`,{d:`M9 2v2M9 14v2M16 9h-2M4 9H2M14.5 3.5l-1.4 1.4M4.9 12.7l-1.4 1.4M3.5 3.5l1.4 1.4M13.1 12.7l1.4 1.4`})]});case`toggle-on`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:[(0,d.jsx)(`rect`,{x:`3`,y:`6`,width:`12`,height:`6`,rx:`3`,opacity:`0.3`}),(0,d.jsx)(`circle`,{cx:`12`,cy:`9`,r:`2.5`})]});case`toggle-off`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:[(0,d.jsx)(`rect`,{x:`3`,y:`6`,width:`12`,height:`6`,rx:`3`,opacity:`0.3`}),(0,d.jsx)(`circle`,{cx:`6`,cy:`9`,r:`2.5`})]});case`send`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:(0,d.jsx)(`path`,{d:`M2 3a1 1 0 0 1 1.3-.95l12 4.5a1 1 0 0 1 0 1.9l-12 4.5A1 1 0 0 1 2 12V8.5L9 9 2 9.5V6Z`})});case`open`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,d.jsx)(`path`,{d:`M14 8V4h-4M14 4L8 10`}),(0,d.jsx)(`path`,{d:`M12 12v2a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h2`})]});case`close`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,d.jsx)(`path`,{d:`M13 5L5 13M5 5l8 8`})});case`delete`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:(0,d.jsx)(`path`,{d:`M6 2a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1h3a1 1 0 1 1 0 2h-1v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5H3a1 1 0 0 1 0-2h3V2Zm2 4a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z`})});case`stop`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:(0,d.jsx)(`rect`,{x:`4`,y:`4`,width:`10`,height:`10`,rx:`1`})});case`queued`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:[(0,d.jsx)(`circle`,{cx:`9`,cy:`9`,r:`7`,opacity:`0.3`}),(0,d.jsx)(`path`,{d:`M9 5v4l3 2`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,fill:`none`})]});default:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:(0,d.jsx)(`circle`,{cx:`9`,cy:`9`,r:`7`})})}}function TbUfo(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M16.95 9.01c3.02 .739 5.05 2.123 5.05 3.714c0 2.367 -4.48 4.276 -10 4.276s-10 -1.909 -10 -4.276c0 -1.59 2.04 -2.985 5.07 -3.724`},child:[]},{tag:`path`,attr:{d:`M7 9c0 1.105 2.239 2 5 2s5 -.895 5 -2v-.035c0 -2.742 -2.239 -4.965 -5 -4.965s-5 2.223 -5 4.965v.035`},child:[]},{tag:`path`,attr:{d:`M15 17l2 3`},child:[]},{tag:`path`,attr:{d:`M8.5 17l-1.5 3`},child:[]},{tag:`path`,attr:{d:`M12 14h.01`},child:[]},{tag:`path`,attr:{d:`M7 13h.01`},child:[]},{tag:`path`,attr:{d:`M17 13h.01`},child:[]}]})(e)}function TbSettings(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065`},child:[]},{tag:`path`,attr:{d:`M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`},child:[]}]})(e)}function TbRipple(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 7c3 -2 6 -2 9 0s6 2 9 0`},child:[]},{tag:`path`,attr:{d:`M3 17c3 -2 6 -2 9 0s6 2 9 0`},child:[]},{tag:`path`,attr:{d:`M3 12c3 -2 6 -2 9 0s6 2 9 0`},child:[]}]})(e)}function TbMovie(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`},child:[]},{tag:`path`,attr:{d:`M8 4l0 16`},child:[]},{tag:`path`,attr:{d:`M16 4l0 16`},child:[]},{tag:`path`,attr:{d:`M4 8l4 0`},child:[]},{tag:`path`,attr:{d:`M4 16l4 0`},child:[]},{tag:`path`,attr:{d:`M4 12l16 0`},child:[]},{tag:`path`,attr:{d:`M16 8l4 0`},child:[]},{tag:`path`,attr:{d:`M16 16l4 0`},child:[]}]})(e)}function TbMoonStars(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`},child:[]},{tag:`path`,attr:{d:`M17 4a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`},child:[]},{tag:`path`,attr:{d:`M19 11h2m-1 -1v2`},child:[]}]})(e)}function TbLeaf(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M5 21c.5 -4.5 2.5 -8 7 -10`},child:[]},{tag:`path`,attr:{d:`M9 18c6.218 0 10.5 -3.288 11 -12v-2h-4.014c-9 0 -11.986 4 -12 9c0 1 0 3 2 5h3l.014 0`},child:[]}]})(e)}function TbFeather(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 20l10 -10m0 -5v5h5m-9 -1v5h5m-9 -1v5h5m-5 -5l4 -4l4 -4`},child:[]},{tag:`path`,attr:{d:`M19 10c.638 -.636 1 -1.515 1 -2.486a3.515 3.515 0 0 0 -3.517 -3.514c-.97 0 -1.847 .367 -2.483 1m-3 13l4 -4l4 -4`},child:[]}]})(e)}function TbDiamond(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M6 5h12l3 5l-8.5 9.5a.7 .7 0 0 1 -1 0l-8.5 -9.5l3 -5`},child:[]},{tag:`path`,attr:{d:`M10 12l-2 -2.2l.6 -1`},child:[]}]})(e)}function TbDeviceGamepad2(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 5h3.5a5 5 0 0 1 0 10h-5.5l-4.015 4.227a2.3 2.3 0 0 1 -3.923 -2.035l1.634 -8.173a5 5 0 0 1 4.904 -4.019h3.4`},child:[]},{tag:`path`,attr:{d:`M14 15l4.07 4.284a2.3 2.3 0 0 0 3.925 -2.023l-1.6 -8.232`},child:[]},{tag:`path`,attr:{d:`M8 9v2`},child:[]},{tag:`path`,attr:{d:`M7 10h2`},child:[]},{tag:`path`,attr:{d:`M14 10h2`},child:[]}]})(e)}function TbCircle(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`},child:[]}]})(e)}function TbBounceRight(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 15.5c3 -1 5.5 -.5 8 4.5c.5 -3 1.5 -5.5 3 -8`},child:[]},{tag:`path`,attr:{d:`M18 9a2 2 0 1 1 0 -4a2 2 0 0 1 0 4`},child:[]}]})(e)}function TbAdjustmentsHorizontal(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`},child:[]},{tag:`path`,attr:{d:`M4 6l8 0`},child:[]},{tag:`path`,attr:{d:`M16 6l4 0`},child:[]},{tag:`path`,attr:{d:`M6 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`},child:[]},{tag:`path`,attr:{d:`M4 12l2 0`},child:[]},{tag:`path`,attr:{d:`M10 12l10 0`},child:[]},{tag:`path`,attr:{d:`M15 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`},child:[]},{tag:`path`,attr:{d:`M4 18l11 0`},child:[]},{tag:`path`,attr:{d:`M19 18l1 0`},child:[]}]})(e)}let Ji={minimal:TbCircle,soft:TbFeather,glass:TbDiamond,arcade:TbDeviceGamepad2,mechanical:TbSettings,organic:TbLeaf,dreamy:TbMoonStars,scifi:TbUfo,rubber:TbBounceRight,cinematic:TbMovie,studio:TbAdjustmentsHorizontal,zen:TbRipple};function SoundPackIcon({pack:e}){let t=Ji[e];return(0,d.jsx)(t,{className:`xmimo-tts-sound-pack-icon`,size:20,strokeWidth:1.8,"aria-hidden":`true`,focusable:`false`})}let Yi=[`start`,`complete`,`success`,`error`,`notification`,`press`,`select`,`toggle-on`,`toggle-off`,`send`,`open`,`close`,`delete`,`stop`,`queued`],Xi={minimal:`#8793a6`,soft:`#4fb7a5`,glass:`#6c8de7`,arcade:`#e58d4f`,mechanical:`#c97465`,organic:`#72ad61`,dreamy:`#b27fd0`,scifi:`#5d9bd4`,rubber:`#d2a044`,cinematic:`#7c77c6`,studio:`#71808e`,zen:`#58a6b0`};function SoundEffectsPanel({t:e,controller:t,enabled:n,volume:r,pack:i,taskSounds:a,clickSounds:o,writable:s,minimal:c,open:p,onToggle:m,onScopeChange:h,onVolumeChange:g,onPackChange:_}){let v=(0,l.useRef)([]),b=resolveSoundEffectsMode(n,a,o),x=e(b===`all`?`settings.soundEffectsOn`:b===`off`?`settings.soundEffectsOff`:b===`click`?`settings.soundEffectsClickOnly`:`settings.soundEffectsTaskOnly`),S=resolveSoundEffectsScope(a,o),selectPack=e=>{if(!(!s||!n)){if(e===i){t.preview(`press`);return}t.update({enabled:n,volume:r,pack:e,taskSounds:a,clickSounds:o}),_(e),t.play(`press`)}},focusPackOption=e=>{let t=(e+F.length)%F.length;requestAnimationFrame(()=>v.current[t]?.focus())},handlePackKeyDown=(e,t)=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),focusPackOption(t+1)):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),focusPackOption(t-1)):e.key===`Home`?(e.preventDefault(),focusPackOption(0)):e.key===`End`&&(e.preventDefault(),focusPackOption(F.length-1))},previewLabel=t=>e(`settings.soundEffectsPreview.${t}`);return(0,d.jsx)(CollapsibleModule,{className:`xmimo-tts-settings-module xmimo-tts-sound-effects xmimo-ui-module`,title:(0,d.jsxs)(`span`,{className:`xmimo-ui-module-title`,children:[(0,d.jsx)(RiDiscLine,{size:14,"aria-hidden":`true`,focusable:`false`}),e(`settings.soundEffectsTitle`)]}),ariaLabel:e(`settings.soundEffectsTitle`),summary:(0,d.jsxs)(`span`,{className:`xmimo-tts-sound-summary xmimo-ui-summary`,children:[(0,d.jsx)(`span`,{children:x}),(0,d.jsxs)(`span`,{children:[e(`settings.soundEffectsVolume`),` `,Math.round(r*100),`%`]}),(0,d.jsx)(`span`,{children:i})]}),open:p,onToggle:m,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-sound-body xmimo-ui-module-body`,children:[(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-sound-scope`,value:S,options:I.map(t=>({value:t,label:e(t===`all`?`settings.soundEffectsOn`:t===`click`?`settings.soundEffectsClickOnly`:`settings.soundEffectsTaskOnly`)})),label:e(`settings.soundEffectsScope`),disabled:!s,onChange:h,className:`xmimo-tts-settings-segmented xmimo-tts-sound-scope`}),(0,d.jsxs)(`label`,{className:`xmimo-tts-sound-volume`,children:[(0,d.jsxs)(`span`,{children:[e(`settings.soundEffectsVolume`),` `,Math.round(r*100),`%`]}),(0,d.jsx)(EnergyVolumeSlider,{value:r,label:e(`settings.soundEffectsVolume`),minimal:c,disabled:!s||!n,onChange:e=>{t.setVolume(e),g(e)},onInteractionEnd:()=>{t.previewVolume()}})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-sound-pack`,children:[(0,d.jsx)(`span`,{id:`xmimo-tts-sound-pack-label`,className:c?`xmimo-tts-visually-hidden`:void 0,children:e(`settings.soundEffectsPack`)}),(0,d.jsx)(`div`,{className:`xmimo-tts-sound-pack-grid`,role:`radiogroup`,"aria-labelledby":`xmimo-tts-sound-pack-label`,children:F.map((e,t)=>(0,d.jsxs)(`button`,{ref:e=>{v.current[t]=e},type:`button`,role:`radio`,"data-xmimo-sound-pack-option":`true`,style:{"--xmimo-sound-pack-accent":Xi[e]},"aria-checked":i===e,tabIndex:i===e?0:-1,className:[`xmimo-tts-sound-pack-option`,i===e?`xmimo-tts-sound-pack-option-selected`:``].filter(Boolean).join(` `),disabled:!s||!n,onClick:()=>{selectPack(e)},onKeyDown:e=>{handlePackKeyDown(e,t)},children:[(0,d.jsx)(SoundPackIcon,{pack:e}),(0,d.jsx)(`span`,{className:`xmimo-tts-sound-pack-name`,children:e})]},e))})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-sound-preview-section`,children:[(0,d.jsx)(`span`,{id:`xmimo-tts-sound-preview-label`,className:c?`xmimo-tts-visually-hidden`:void 0,children:e(`settings.soundEffectsPreviewLabel`)}),(0,d.jsx)(`div`,{className:`xmimo-tts-sound-previews`,role:`group`,"aria-labelledby":`xmimo-tts-sound-preview-label`,children:Yi.map(e=>(0,d.jsxs)(`button`,{type:`button`,"data-xmimo-sound-preview":`true`,disabled:!n,"aria-label":previewLabel(e),onClick:()=>{t.preview(e)},children:[(0,d.jsx)(SoundEffectIcon,{cue:e}),(0,d.jsx)(`span`,{children:previewLabel(e)})]},e))})]}),s?null:(0,d.jsx)(`small`,{children:e(`settings.readOnly`)})]})})}function LuStar(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`},child:[]}]})(e)}function LuSettings(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`3`},child:[]}]})(e)}function LuPanelLeftOpen(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`},child:[]},{tag:`path`,attr:{d:`M9 3v18`},child:[]},{tag:`path`,attr:{d:`m14 9 3 3-3 3`},child:[]}]})(e)}function LuPanelLeftClose(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`},child:[]},{tag:`path`,attr:{d:`M9 3v18`},child:[]},{tag:`path`,attr:{d:`m16 15-3-3 3-3`},child:[]}]})(e)}function LuCheck(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M20 6 9 17l-5-5`},child:[]}]})(e)}function LuBookOpen(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 7v14`},child:[]},{tag:`path`,attr:{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`},child:[]}]})(e)}function LuAudioLines(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M2 10v3`},child:[]},{tag:`path`,attr:{d:`M6 6v11`},child:[]},{tag:`path`,attr:{d:`M10 3v18`},child:[]},{tag:`path`,attr:{d:`M14 8v7`},child:[]},{tag:`path`,attr:{d:`M18 5v13`},child:[]},{tag:`path`,attr:{d:`M22 10v3`},child:[]}]})(e)}function SidebarSettings({t:e,value:t,disabled:n,onToggle:r}){let i=t?LuPanelLeftClose:LuPanelLeftOpen;return(0,d.jsxs)(u.Button,{type:`button`,variant:`toolbar`,size:`sm`,disabled:n,"aria-pressed":t,onClick:r,children:[(0,d.jsx)(i,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{className:`xmimo-tts-action-label`,children:e(t?`settings.unmountSidebar`:`settings.mountSidebar`)})]})}async function withSidebarLoading(e,t,n){let r=document.createElement(`dialog`);r.className=`xmimo-ui-scope xmimo-tts-sidebar-loading`,r.tabIndex=-1;let i=t(e?`settings.mountingSidebar`:`settings.unmountingSidebar`);r.setAttribute(`aria-label`,i),r.addEventListener(`cancel`,e=>e.preventDefault());let a=document.createElement(`div`);a.className=`xmimo-tts-sidebar-loading-status`,a.setAttribute(`role`,`status`),a.setAttribute(`aria-live`,`polite`),a.setAttribute(`aria-busy`,`true`);let o=document.createElement(`span`);o.className=`xmimo-tts-sidebar-loading-spinner`,o.setAttribute(`aria-hidden`,`true`);let s=document.createElement(`span`);s.textContent=i,a.append(o,s),r.append(a),document.body.append(r);try{return r.showModal(),await afterPaint(),await n()}finally{await afterPaint(),r.close(),r.remove()}}function afterPaint(){return new Promise(e=>{let t,finish=()=>{clearTimeout(n),t!==void 0&&cancelAnimationFrame(t),e()},n=setTimeout(finish,100);t=requestAnimationFrame(()=>{t=requestAnimationFrame(finish)})})}function providerLabelKey(e){return e===`doubao`?`settings.providerDoubao`:e===`breeze`?`settings.providerBreeze`:`settings.providerXiaomi`}let Zi=[`--xmimo-holo-x`,`--xmimo-holo-y`,`--xmimo-holo-bg-x`,`--xmimo-holo-bg-y`,`--xmimo-holo-rx`,`--xmimo-holo-ry`];function useHoloHover(e){let t=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let n=t.current;if(!e||!n)return;let r=window.matchMedia(`(any-hover: hover) and (any-pointer: fine) and (prefers-reduced-motion: no-preference)`),i=null,a,o=0,s=0,reset=()=>{if(a!==void 0&&window.cancelAnimationFrame(a),a=void 0,i){i.removeAttribute(`data-xmimo-holo-active`);for(let e of Zi)i.style.removeProperty(e);i=null}},writable=e=>!e.matches(`:disabled`)&&!e.querySelector(`input:disabled`),draw=()=>{if(a=void 0,!i||!r.matches||document.hidden||!writable(i))return reset();let e=i.getBoundingClientRect();if(!e.width||!e.height)return reset();let t=Math.min(1,Math.max(0,(o-e.left)/e.width)),n=Math.min(1,Math.max(0,(s-e.top)/e.height));i.style.setProperty(`--xmimo-holo-x`,`${t*100}%`),i.style.setProperty(`--xmimo-holo-y`,`${n*100}%`),i.style.setProperty(`--xmimo-holo-bg-x`,`${(1-t)*100}%`),i.style.setProperty(`--xmimo-holo-bg-y`,`${(1-n)*100}%`),i.style.setProperty(`--xmimo-holo-rx`,`${(.5-n)*12}deg`),i.style.setProperty(`--xmimo-holo-ry`,`${(t-.5)*12}deg`),i.setAttribute(`data-xmimo-holo-active`,``)},track=e=>{if(!r.matches||document.hidden||e.pointerType===`touch`)return reset();let t=e.target instanceof Element?e.target.closest(`.xmimo-tts-character-toggle`):null;if(!t||!n.contains(t)||!writable(t))return reset();t!==i&&(reset(),i=t),o=e.clientX,s=e.clientY,a===void 0&&(a=window.requestAnimationFrame(draw))},leave=e=>{(!(e.relatedTarget instanceof Node)||!i?.contains(e.relatedTarget))&&reset()};return n.addEventListener(`pointerover`,track),n.addEventListener(`pointermove`,track),n.addEventListener(`pointerout`,leave),n.addEventListener(`pointerleave`,reset),n.addEventListener(`pointercancel`,reset),r.addEventListener(`change`,reset),document.addEventListener(`visibilitychange`,reset),window.addEventListener(`blur`,reset),window.addEventListener(`resize`,reset),window.addEventListener(`scroll`,reset,!0),()=>{reset(),n.removeEventListener(`pointerover`,track),n.removeEventListener(`pointermove`,track),n.removeEventListener(`pointerout`,leave),n.removeEventListener(`pointerleave`,reset),n.removeEventListener(`pointercancel`,reset),r.removeEventListener(`change`,reset),document.removeEventListener(`visibilitychange`,reset),window.removeEventListener(`blur`,reset),window.removeEventListener(`resize`,reset),window.removeEventListener(`scroll`,reset,!0)}},[e]),t}function CharacterToggle({kind:e,checked:t,disabled:n,label:r,stateLabel:i,minimal:a,onChange:o}){let s=t?`on`:`off`;return a?(0,d.jsxs)(`div`,{className:`xmimo-tts-minimal-control xmimo-tts-minimal-toggle`,"data-xmimo-sound-toggle":e===`sound`?`true`:void 0,onClick:e=>{e.target.closest(`button`)!==null||n||o(!t)},children:[(0,d.jsx)(`span`,{className:`xmimo-tts-minimal-toggle-label`,children:r}),(0,d.jsx)(u.Switch,{checked:t,disabled:n,label:`${r}: ${i}`,onChange:o})]}):(0,d.jsxs)(`label`,{className:`xmimo-tts-character-toggle xmimo-tts-character-toggle-${s}`,"data-xmimo-sound-toggle":e===`sound`?`true`:void 0,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:t,disabled:n,onChange:e=>{o(e.target.checked)}}),(0,d.jsxs)(`span`,{className:`xmimo-tts-character-control`,children:[a?null:(0,d.jsx)(`span`,{className:`xmimo-tts-character-portrait xmimo-tts-character-${e}-${s}`,style:{backgroundImage:`url(${hostRoute(e===`sound`?`/plugins/xiaomi-mimo-tts/sound-effects-toggle-characters.webp`:`/plugins/xiaomi-mimo-tts/toggle-characters.webp`)})`},"aria-hidden":`true`}),(0,d.jsx)(`span`,{className:`xmimo-tts-character-copy`,children:(0,d.jsx)(`strong`,{children:r})}),(0,d.jsxs)(`span`,{className:`xmimo-tts-character-state`,children:[(0,d.jsx)(`span`,{"aria-hidden":`true`}),i]})]})]})}function ProviderToggle({t:e,provider:t,doubaoEnabled:n,breezeEnabled:r,minimal:i,writable:a,switching:o,onChange:s,onExternalChange:c}){let p=useEngineState(),m=externalEngine(),h=m?`${m.provider}/${m.configurationId??``}`:t,g=m?`/plugins/xiaomi-mimo-tts/provider-external-takeover.webp`:v[t],[_,b]=(0,l.useState)(()=>({identity:h,turns:0,front:g,back:g}));if(_.identity!==h){let e=_.turns+1;b({identity:h,turns:e,front:e%2==0?g:_.front,back:e%2==1?g:_.back})}let x=nextTtsProvider(t,n,r),S=m?nextExternalConfiguration(m):void 0,C=m?.name??e(providerLabelKey(t)),w=S?.name??e(providerLabelKey(x)),E=m&&!S?`${C} · ${e(`settings.externalManaged`)}`:`${e(`settings.provider`)}: ${C} · ${e(`settings.switchProvider`)}: ${w}`,D=!a||o||m!==null&&(!S||p.status!==`ready`),change=()=>{D||(m&&S?c(m,S.id):s(x))},k=(0,d.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,d.jsx)(`path`,{d:`M3 7h18m-4-4 4 4-4 4M21 17H3m4-4-4 4 4 4`})});return i?(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,className:`xmimo-tts-minimal-control xmimo-tts-provider-button`,"data-xmimo-sound-toggle":`provider`,"aria-label":E,title:E,disabled:D,"aria-busy":o,onClick:change,children:[(0,d.jsx)(`span`,{children:C}),k]}):(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-character-toggle xmimo-tts-character-toggle-on xmimo-tts-provider-toggle`,"data-provider":t,"data-external":m?`true`:void 0,"data-xmimo-sound-toggle":`provider`,"aria-label":E,title:E,disabled:D,"aria-busy":o,onClick:change,children:(0,d.jsxs)(`span`,{className:`xmimo-tts-character-control`,children:[(0,d.jsx)(`span`,{className:`xmimo-tts-character-portrait xmimo-tts-provider-portrait`,"aria-hidden":`true`,children:(0,d.jsxs)(`span`,{className:`xmimo-tts-provider-flipper`,style:{transform:`rotateY(${_.turns*180}deg)`},children:[(0,d.jsx)(`span`,{className:`xmimo-tts-provider-face`,style:{backgroundImage:`url(${hostRoute(_.front)})`}}),(0,d.jsx)(`span`,{className:`xmimo-tts-provider-face xmimo-tts-provider-face-back`,style:{backgroundImage:`url(${hostRoute(_.back)})`}})]})}),(0,d.jsx)(`span`,{className:`xmimo-tts-character-copy`,children:(0,d.jsx)(`strong`,{children:C})}),(0,d.jsx)(`span`,{className:`xmimo-tts-character-state xmimo-tts-provider-state`,children:k})]})})}function SwitchModule({t:e,provider:t,doubaoEnabled:n,breezeEnabled:r,enabled:i,autoPlay:a,soundEnabled:o,minimal:s,writable:c,onProviderChange:u,onEnabledChange:p,onAutoPlayChange:m,onSoundEnabledChange:h}){let g=useHoloHover(!s&&c),[_,v]=(0,l.useState)(!1),[b,x]=(0,l.useState)(!1),changeExternal=(e,t)=>{v(!0),x(!1),switchExternalConfiguration(e,t).catch(()=>x(!0)).finally(()=>v(!1))};return(0,d.jsxs)(`section`,{className:s?`xmimo-tts-switch-module xmimo-tts-switch-module-minimal`:`xmimo-tts-switch-module`,children:[(0,d.jsxs)(`div`,{ref:g,className:`xmimo-tts-switch-row xmimo-ui-grid`,children:[(0,d.jsx)(CharacterToggle,{kind:`voice`,checked:i,disabled:!c,label:e(s?`settings.enabled`:i?`settings.enabledOnLabel`:`settings.enabledOffLabel`),stateLabel:e(i?`settings.stateOn`:`settings.stateOff`),minimal:s,onChange:p}),(0,d.jsx)(CharacterToggle,{kind:`autoplay`,checked:i&&a,disabled:!c,label:e(s?`settings.autoPlay`:i&&a?`settings.autoPlayOnLabel`:`settings.autoPlayOffLabel`),stateLabel:e(i&&a?`settings.stateOn`:`settings.stateOff`),minimal:s,onChange:m}),(0,d.jsx)(CharacterToggle,{kind:`sound`,checked:o,disabled:!c,label:e(s?`settings.soundEffectsTitle`:o?`settings.soundEffectsOnLabel`:`settings.soundEffectsOffLabel`),stateLabel:e(o?`settings.stateOn`:`settings.stateOff`),minimal:s,onChange:h}),(0,d.jsx)(ProviderToggle,{t:e,provider:t,doubaoEnabled:n,breezeEnabled:r,minimal:s,writable:c,switching:_,onChange:u,onExternalChange:changeExternal})]}),b?(0,d.jsx)(`p`,{className:`xmimo-tts-failed`,role:`alert`,children:e(`settings.externalSwitchFailed`)}):null]})}let Qi=`dsh-xiaomi-mimo-tts:minimal-mode`,$i=new Set,ea=!1,ta=!1;function subscribeMinimalMode(e){$i.add(e);let onStorage=t=>{(t.key===Qi||t.key===null)&&e()};return typeof window<`u`&&window.addEventListener(`storage`,onStorage),()=>{$i.delete(e),typeof window<`u`&&window.removeEventListener(`storage`,onStorage)}}function getStorage(){try{return typeof window>`u`?void 0:window.localStorage}catch{return}}function readMinimalMode(){try{if(ta)return ea;let e=getStorage();return e?e.getItem(Qi)===`true`:ea}catch{return ea}}function writeMinimalMode(e){ea=e;try{let t=getStorage();t?.setItem(Qi,String(e)),ta=!t}catch{ta=!0}for(let e of $i)e()}let na={getSnapshot:()=>!1,subscribe:()=>()=>{}};var PluginAudioFocus=class{constructor(e,t){this.focus=e,this.blocked=t}canPlay=()=>!this.blocked.getSnapshot()&&this.focus.canPlay();claim=()=>{this.blocked.getSnapshot()||this.focus.claim()};subscribe=e=>{let t=this.canPlay(),update=()=>{let n=this.canPlay();n!==t&&(t=n,e())},n=this.focus.subscribe(update),r=this.blocked.subscribe(update);return()=>{r(),n()}}};function observePluginActivity(e,t,n=()=>{}){let r=!1,update=()=>{let i=e.getSnapshot();i!==r&&(r=i,i?t():n())},i=e.subscribe(update);return update(),i}let idle=()=>({entryId:null,status:`idle`,currentTime:0,duration:0,error:null});var HistoryReplay=class{view=idle();listeners=new Set;media=null;url=null;cleanup=null;epoch=0;attempt=0;volume=1;voiceRate=1;voiceRateApplied=!1;disposed=!1;offStop=null;offHistory=null;constructor(e,t){this.history=e,this.beforePlayback=t}activate(){this.offStop===null&&(this.disposed=!1,this.offStop=this.history.onStopReplay(()=>this.pause()),this.offHistory=this.history.subscribe(()=>{this.view.entryId!==null&&!this.history.getSnapshot().entries.some(e=>e.id===this.view.entryId)&&this.stop()}))}getSnapshot=()=>this.view;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});configure(e,t,n){this.volume=e,this.voiceRate=t,this.beforePlayback=n,this.media!==null&&(this.media.volume=e,applyMediaVoiceRate(this.media,this.voiceRateApplied?1:t))}async play(e){if(this.disposed||this.beforePlayback()===!1)return;if(this.view.entryId!==e.id||this.media===null||this.view.status===`error`){this.release();let t=this.epoch;try{this.url=URL.createObjectURL(e.blob);let n=new Audio(this.url);this.media=n,this.voiceRateApplied=e.voiceRateApplied===!0,n.preload=`metadata`,n.volume=this.volume,applyMediaVoiceRate(n,this.voiceRateApplied?1:this.voiceRate);let valid=()=>!this.disposed&&this.media===n&&this.epoch===t,timing=()=>{valid()&&this.publish({...this.view,currentTime:Number.isFinite(n.currentTime)?n.currentTime:0,duration:Number.isFinite(n.duration)?n.duration:0})},ended=()=>{valid()&&(this.attempt+=1,this.publish({...this.view,status:`ended`,currentTime:this.view.duration}))},error=()=>{valid()&&(this.attempt+=1,this.publish({...this.view,status:`error`,error:n.error?.code===3||n.error?.code===4?`decode`:`failed`}))};for(let e of[`loadedmetadata`,`durationchange`,`timeupdate`])n.addEventListener(e,timing);n.addEventListener(`ended`,ended),n.addEventListener(`error`,error),this.cleanup=()=>{for(let e of[`loadedmetadata`,`durationchange`,`timeupdate`])n.removeEventListener(e,timing);n.removeEventListener(`ended`,ended),n.removeEventListener(`error`,error)},this.publish({...idle(),entryId:e.id})}catch{this.release(),this.publish({...idle(),entryId:e.id,status:`error`,error:`failed`});return}}let t=this.media;this.view.status===`ended`&&(t.currentTime=0);let n=++this.attempt,r=this.epoch;this.publish({...this.view,status:`loading`,error:null});try{await t.play(),!this.disposed&&this.media===t&&r===this.epoch&&n===this.attempt&&this.publish({...this.view,status:`playing`})}catch(e){!this.disposed&&this.media===t&&r===this.epoch&&n===this.attempt&&this.publish({...this.view,status:`error`,error:e instanceof Error&&e.name===`NotAllowedError`?`blocked`:`failed`})}}pause(){this.media===null||this.view.status!==`playing`&&this.view.status!==`loading`||(this.attempt+=1,this.media.pause(),this.publish({...this.view,status:`paused`}))}seek(e){if(this.media===null||this.view.duration<=0||!Number.isFinite(e))return;let t=Math.max(0,Math.min(this.view.duration,e));this.media.currentTime=t,this.publish({...this.view,currentTime:t,status:this.view.status===`ended`?`paused`:this.view.status})}stop(){this.release(),this.publish(idle())}dispose(){this.disposed=!0,this.offStop?.(),this.offHistory?.(),this.offStop=null,this.offHistory=null,this.stop(),this.listeners.clear()}release(){this.epoch+=1,this.attempt+=1,this.cleanup?.(),this.cleanup=null,this.media!==null&&(this.media.pause(),this.media.removeAttribute(`src`),this.media.load(),this.media=null),this.url!==null&&URL.revokeObjectURL(this.url),this.url=null,this.voiceRateApplied=!1}publish(e){this.view=e;for(let e of this.listeners)e()}};function isSpeechBusy(e){return e===`loading`||e===`playing`||e===`paused`}var SpeechActivity=class{queries=new Map;register(e,t){return this.queries.set(e,t),()=>{this.queries.delete(e)}}isBusy=()=>[...this.queries.keys()].some(e=>e());interrupt=()=>{for(let[e,t]of this.queries)e()&&t?.()}};function AudioHistoryPage({history:e,t,volume:n,voiceRate:r,minimalMode:i,speechActivity:a,beforePlayback:o,onBack:s}){let c=(0,l.useSyncExternalStore)(e.subscribe,e.getSnapshot),[p]=(0,l.useState)(()=>new HistoryReplay(e,o));(0,l.useEffect)(()=>a?.register(()=>isSpeechBusy(p.getSnapshot().status),()=>p.stop()),[a,p]);let m=(0,l.useSyncExternalStore)(p.subscribe,p.getSnapshot),[h]=(0,l.useState)(()=>new HistoryDownloads),[g,_]=(0,l.useState)(``),[v,b]=(0,l.useState)(`all`),[S,C]=(0,l.useState)(null),[w,E]=(0,l.useState)(null),[D,k]=(0,l.useState)(!1),[A,M]=(0,l.useState)(!1),[P,F]=(0,l.useState)(!1),I=(0,l.useRef)(null),V=(0,l.useRef)(null),ee=(0,l.useRef)(null);(0,l.useEffect)(()=>(p.activate(),I.current?.focus({preventScroll:!0}),()=>{p.dispose(),h.dispose()}),[p,h]),(0,l.useEffect)(()=>{p.configure(n,r,o)},[p,n,r,o]),(0,l.useEffect)(()=>{let e=ee.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(([e])=>{e&&e.contentRect.width<=520&&_(``)});return t.observe(e),()=>{t.disconnect()}},[]);let H=c.entries.length>0,te=filterAudioHistory(c.entries,g,v),U=m.status===`loading`||m.status===`playing`,re=t(U?`history.pause`:m.status===`error`?`history.retry`:`history.play`),se=m.duration>0?historyTime(m.duration):`--:--`,ce={"--xmimo-history-progress":`${m.duration>0?Math.min(100,Math.max(0,m.currentTime/m.duration*100)):0}%`},title=e=>e.text.trim()||t(`history.untitled`),mutate=async t=>{M(!0),F(!1);try{t===void 0?await e.clear():await e.remove(t),E(null),k(!1),(V.current?.getClientRects().length?V.current:I.current)?.focus({preventScroll:!0})}catch{F(!0)}finally{M(!1)}},download=e=>{F(!1);try{h.download(e)}catch{F(!0)}};return(0,d.jsxs)(`section`,{ref:ee,tabIndex:-1,className:`xmimo-ui-scope xmimo-tts-history-page`,"aria-label":t(`history.title`),children:[(0,d.jsxs)(`header`,{className:`xmimo-tts-history-header`,children:[(0,d.jsxs)(`h2`,{"aria-label":t(`history.title`),children:[(0,d.jsxs)(u.Button,{ref:I,type:`button`,variant:`ghost`,size:`sm`,className:`xmimo-tts-history-title-back`,"aria-label":t(`history.backToSettings`),title:t(`history.backToSettings`),onClick:s,children:[(0,d.jsx)(RiArrowLeftSLine,{size:18,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{children:t(`history.title`)})]}),(0,d.jsx)(`span`,{className:`xmimo-tts-history-count`,children:c.entries.length})]}),H?(0,d.jsxs)(`div`,{className:`xmimo-tts-history-toolbar`,children:[(0,d.jsx)(u.Input,{ref:V,type:`search`,className:`xmimo-tts-history-search`,"aria-label":t(`history.search`),placeholder:t(`history.search`),value:g,onChange:e=>{_(e.target.value),E(null)}}),(0,d.jsx)(`div`,{className:`xmimo-tts-history-source`,children:(0,d.jsx)(VoiceReadingSelect,{label:t(`history.source`),value:v,disabled:A,buttonVariant:`outline`,options:[`all`,`conversation`,`preview`,`service`].map(e=>({id:e,label:t(`history.${e}`)})),onSelect:e=>{b(e),E(null)}})}),(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:A||c.status===`loading`,className:`xmimo-tts-history-action${D?` xmimo-tts-history-confirm-delete`:``}`,"aria-label":t(D?`history.confirmClear`:`history.clear`),title:t(D?`history.clearConfirm`:`history.clear`),onBlur:()=>{A||k(!1)},onKeyDown:e=>{e.key===`Escape`&&k(!1)},onClick:()=>{D?mutate():(k(!0),E(null))},children:[D?(0,d.jsx)(RiCheckLine,{"aria-hidden":`true`}):(0,d.jsx)(RiDeleteBinLine,{"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:t(D?`history.confirmClear`:`history.clear`)})]})]}):null]}),c.status===`memory`?(0,d.jsx)(`p`,{className:`xmimo-tts-history-warning`,role:`status`,children:t(`history.memory`)}):null,c.skipped?(0,d.jsx)(`p`,{className:`xmimo-tts-history-warning`,role:`status`,children:t(`history.skipped`)}):null,P?(0,d.jsx)(`p`,{className:`xmimo-tts-failed`,role:`alert`,children:t(`history.actionFailed`)}):null,(0,d.jsx)(`div`,{className:`xmimo-tts-history-results`,children:c.status===`loading`?(0,d.jsx)(`p`,{className:`xmimo-tts-history-empty`,role:`status`,children:t(`history.loading`)}):c.entries.length===0?(0,d.jsxs)(`div`,{className:`xmimo-tts-history-empty`,role:`status`,children:[i?null:(0,d.jsx)(`img`,{className:`xmimo-tts-history-empty-whale`,src:hostRoute(x),width:144,height:144,alt:``,"aria-hidden":`true`}),(0,d.jsx)(`p`,{children:t(`history.empty`)})]}):te.length===0?(0,d.jsxs)(`div`,{className:`xmimo-tts-history-empty`,role:`status`,children:[(0,d.jsx)(`p`,{children:t(`history.noResults`)}),(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{_(``),b(`all`)},children:t(`history.resetFilters`)})]}):(0,d.jsx)(`ul`,{className:`xmimo-tts-history-list`,children:te.map(e=>(0,d.jsxs)(`li`,{className:`xmimo-tts-history-row${e.id===m.entryId?` xmimo-tts-history-row-selected`:``}`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`primary`,size:`sm`,className:`xmimo-tts-history-player-toggle`,title:e.id===m.entryId?re:t(`history.listen`),"aria-label":`${e.id===m.entryId?re:t(`history.listen`)}: ${title(e).slice(0,60)}`,onClick:()=>{e.id===m.entryId&&U?p.pause():p.play(e)},children:e.id===m.entryId&&m.status===`error`?(0,d.jsx)(u.IconRefreshOutlineMedium,{size:16,"aria-hidden":`true`}):(0,d.jsx)(PlaybackIcon,{state:e.id!==m.entryId||!U?`play`:`pause`})}),(0,d.jsxs)(`div`,{className:`xmimo-tts-history-copy`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,className:`xmimo-tts-history-text-toggle`,"aria-expanded":S===e.id,"aria-label":`${t(`history.expand`)}: ${title(e).slice(0,60)}`,onClick:()=>{C(S===e.id?null:e.id)},children:(0,d.jsx)(`span`,{className:`xmimo-tts-history-text${S===e.id?` xmimo-tts-history-text-expanded`:``}`,children:title(e)})}),(0,d.jsxs)(`div`,{className:`xmimo-tts-history-meta`,children:[(0,d.jsx)(`span`,{children:t(`history.${e.source}`)}),(0,d.jsxs)(`span`,{children:[Array.from(title(e)).length,` `,t(`history.characters`)]}),(0,d.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),children:new Date(e.createdAt).toLocaleString()}),(0,d.jsxs)(`span`,{children:[e.format.toUpperCase(),` · `,historyFileSize(e.blob.size)]})]}),e.id===m.entryId?(0,d.jsxs)(`div`,{className:`xmimo-tts-history-player`,"aria-label":t(`history.player`),children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-history-player-controls`,children:[(0,d.jsx)(`input`,{type:`range`,style:ce,min:0,max:m.duration||1,step:.1,value:Math.min(m.currentTime,m.duration||1),disabled:m.duration<=0||m.status===`error`,"aria-label":t(`history.seek`),"aria-valuetext":`${historyTime(m.currentTime)} / ${se}`,onChange:e=>{p.seek(Number(e.target.value))}}),(0,d.jsxs)(`span`,{className:`xmimo-tts-history-time`,children:[historyTime(m.currentTime),` / `,se]})]}),(0,d.jsx)(`span`,{className:m.status===`error`?`xmimo-tts-history-player-error xmimo-tts-failed`:`xmimo-tts-history-player-status`,role:`status`,children:t(m.status===`error`?`history.error.${m.error??`failed`}`:`history.state.${m.status}`)})]}):null]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-history-actions`,children:[(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,className:`xmimo-tts-history-action`,title:t(`history.download`),"aria-label":`${t(`history.download`)}: ${title(e).slice(0,60)}`,onClick:()=>{download(e)},children:[(0,d.jsx)(RiDownloadLine,{"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:t(`history.download`)})]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:A,className:`xmimo-tts-history-action${w===e.id?` xmimo-tts-history-confirm-delete`:``}`,title:t(w===e.id?`history.confirmDelete`:`history.delete`),"aria-label":`${t(w===e.id?`history.confirmDelete`:`history.delete`)}: ${title(e).slice(0,60)}`,onBlur:()=>{A||E(t=>t===e.id?null:t)},onKeyDown:e=>{e.key===`Escape`&&E(null)},onClick:()=>{w===e.id?mutate(e.id):(E(e.id),k(!1))},children:[w===e.id?(0,d.jsx)(RiCheckLine,{"aria-hidden":`true`}):(0,d.jsx)(RiDeleteBinLine,{"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:t(w===e.id?`history.confirmDelete`:`history.delete`)})]})]})]},e.id))})}),(0,d.jsxs)(`footer`,{className:`xmimo-tts-history-footer`,children:[H?(0,d.jsxs)(`div`,{className:`xmimo-tts-history-storage`,children:[(0,d.jsxs)(`span`,{children:[t(c.status===`memory`?`history.temporary`:`history.savedHere`),` · `,c.entries.length,` · `,historyFileSize(c.entries.reduce((e,t)=>e+t.blob.size,0))]}),(0,d.jsx)(`span`,{className:`xmimo-tts-history-limit`,children:t(`history.hint`)})]}):null,(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,className:`xmimo-tts-history-back`,onClick:s,children:[(0,d.jsx)(RiArrowLeftSLine,{size:16,"aria-hidden":`true`,focusable:`false`}),t(`history.backToSettings`)]})]})]})}let ra={apiKey:`xiaomi`,doubaoApiKey:`doubao`,breezeApiKey:`breeze`},ia={xiaomi:`apiKey`,doubao:`doubaoApiKey`,breeze:`breezeApiKey`};function isApiKeyField(e){return e in ra}function layerSettings(e){return isRecord(e)?e:void 0}function hasLayerField(e,t){return isRecord(e)&&Object.hasOwn(e,t)}function HistoryLink({history:e,t,onOpen:n,buttonRef:r}){let i=(0,l.useSyncExternalStore)(e.subscribe,e.getSnapshot);return(0,d.jsxs)(u.Button,{ref:r,type:`button`,className:`xmimo-tts-history-link`,variant:`toolbar`,size:`sm`,onClick:n,children:[(0,d.jsx)(GoHistory,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsxs)(`span`,{className:`xmimo-tts-action-label`,children:[t(`history.shortTitle`),` · `,i.entries.length]})]})}function SettingsCard(e){return e.view===`summary`?(0,d.jsx)(d.Fragment,{children:e.t(`settings.description`)}):(0,d.jsx)(SettingsPage,{...e})}function SettingsPage({scope:e,t,controller:n,history:r,speechActivity:i,beforePreview:a,beforeHistoryPlayback:o,initialPanel:s,onSidebarChange:c,onOpenProviderSettings:p,changes:m=na,audioFocus:h=ai}){useEngineState();let g=externalEngine(),_=useExternalSelection(g),v=useSettingsSnapshot(e),b=(0,l.useSyncExternalStore)(m.subscribe,m.getSnapshot,m.getSnapshot),x=v.writable&&!b,S=v.value,C=resolveTtsSettings(S),[w,E]=(0,l.useState)({xiaomi:``,doubao:``,breeze:``}),[D,k]=(0,l.useState)(C.provider),[A,M]=(0,l.useState)(C.doubaoModel),[P,F]=(0,l.useState)(C.doubaoVoice),[I,V]=(0,l.useState)(C.doubaoClonedVoice),[ee,H]=(0,l.useState)(C.doubaoInstruction),[te,U]=(0,l.useState)(C.doubaoEnabled),[re,se]=(0,l.useState)(C.breezeEnabled),[ce,le]=(0,l.useState)(C.breezeVoice),[ue,W]=(0,l.useState)(C.breezeInstruction),[de,fe]=(0,l.useState)(C.instruction),pe=w[D],me=ia[D],setApiKey=e=>{E(t=>({...t,[D]:e}))},[he,xe]=(0,l.useState)(C.showInSidebar),[Se,Ce]=(0,l.useState)(C.showInHostSettings),[we,Te]=(0,l.useState)(C.acceptExternalProviders),[Ee,De]=(0,l.useState)(C.announcementSources),[Oe,ke]=(0,l.useState)(C.qqbotEnabled),[Ae,Me]=(0,l.useState)(C.enabled),[Ne,Pe]=(0,l.useState)(C.autoPlay),[Fe,Ie]=(0,l.useState)(C.voiceInputCompatibility),[Re,Ve]=(0,l.useState)(C.inputAvoidance),[He,Ue]=(0,l.useState)(C.importantAnnouncementsFirst),[Ke,Je]=(0,l.useState)(C.voiceVolume),[Ye,Ze]=(0,l.useState)(C.voiceRate),[Qe,et]=(0,l.useState)(C.readScope),[tt,nt]=(0,l.useState)(C.model),[rt,it]=(0,l.useState)(C.localSpeechMode),[at,ot]=(0,l.useState)(C.localVoiceURI),[st,ct]=(0,l.useState)(C.localVoiceEngine),[lt,ut]=(0,l.useState)(C.mossEnabled),[dt,ft]=(0,l.useState)(C.mossBaseURL),[pt,mt]=(0,l.useState)(C.mossVoice),[ht,gt]=(0,l.useState)(C.mossVoiceName),[_t,vt]=(0,l.useState)(C.voice),[yt,bt]=(0,l.useState)(C.voiceDesignPrompt),[xt,St]=(0,l.useState)(C.voiceDesignCustomPrompt),[Ct,G]=(0,l.useState)(C.soundEnabled),[wt,Tt]=(0,l.useState)(C.soundVolume),[Et,Dt]=(0,l.useState)(C.soundPack),[Ot,kt]=(0,l.useState)(C.taskSounds),[At,jt]=(0,l.useState)(C.clickSounds),[Mt,Nt]=(0,l.useState)({}),[Pt,Ft]=(0,l.useState)(`idle`),[It,Lt]=(0,l.useState)(null),Rt=(0,l.useRef)(!1),[zt,q]=(0,l.useState)(s??null),togglePanel=e=>q(t=>t===e?null:e),[Bt,Vt]=(0,l.useState)(()=>t(`settings.previewDefaultText`)),[Ht,Ut]=(0,l.useState)({status:`idle`,source:null,error:null}),[Y]=(0,l.useState)(()=>new PreviewPlayer(Ut,r));(0,l.useEffect)(()=>ni.subscribe(()=>Y.stop()),[Y]),(0,l.useEffect)(()=>i?.register(()=>isSpeechBusy(Y.getView().status),()=>Y.stop()),[i,Y]);let[Wt]=(0,l.useState)(()=>new ToggleSoundPlayer);(0,l.useEffect)(()=>h.subscribe(()=>{h.canPlay()||(Y.stop(),Wt.dispose())}),[h,Y,Wt]);let Gt=useApiKeyStatus(v.status===`ready`&&!b,D),[Kt,qt]=(0,l.useState)(readMinimalMode),[Jt,Yt]=(0,l.useState)(!1),Xt=(0,l.useRef)(null),Zt=(0,l.useRef)(!1),Qt=resolveTtsSettings(S),$=resolveTtsSettings(layerSettings(v.base)),$t={showInSidebar:he,showInHostSettings:Se,acceptExternalProviders:we,qqbotEnabled:Oe,announcementSources:Ee,provider:D,doubaoModel:A,doubaoVoice:P,doubaoClonedVoice:I,doubaoInstruction:ee,doubaoEnabled:te,breezeEnabled:re,breezeVoice:ce,breezeInstruction:ue,instruction:de,enabled:Ae,autoPlay:Ae&&Ne,voiceInputCompatibility:Fe,inputAvoidance:Re,importantAnnouncementsFirst:He,voiceVolume:Ke,voiceRate:Ye,readScope:Qe,model:tt,localSpeechMode:rt,localVoiceURI:at,localVoiceEngine:st,mossEnabled:lt,mossBaseURL:dt,mossVoice:pt,mossVoiceName:ht,voice:_t,voiceDesignPrompt:yt,voiceDesignCustomPrompt:xt,soundEnabled:Ct,soundVolume:wt,soundPack:Et,taskSounds:Ot,clickSounds:At},acceptedValue=e=>{let t=S?.[e];return t===void 0?Qt[e]:t},hasOverride=e=>hasLayerField(v.user,e),fieldOverridden=e=>{let t=Mt[e];return t?.kind===`clear`?!1:t?.kind===`set`?isApiKeyField(e)?w[ra[e]].trim().length>0:!0:hasOverride(e)},fieldDirty=e=>{let t=Mt[e];return t===void 0?!1:t.kind===`clear`?hasOverride(e):Array.isArray($t[e])?JSON.stringify($t[e])!==JSON.stringify(acceptedValue(e)):!Object.is($t[e],acceptedValue(e))},en=Object.keys(ra).some(e=>Mt[e]?.kind===`set`&&w[ra[e]].trim().length>0),tn=vi.some(fieldDirty)||en||_.dirty,nn=g?null:validateSettingsDraft($t),rn=g?_.dirty||vi.some(e=>!yi.has(e)&&fieldDirty(e)):tn,an=resolveApiKeyViewState(pe,isSupportedTtsApiKey(pe,D),Gt,Mt[me]?.kind),on=t(an===`loading`?`settings.apiKeyLoading`:an===`missing`?`settings.apiKeyMissing`:an===`recognized`?D===`doubao`?`settings.doubaoKeyConfigured`:`settings.apiKeyRecognized`:an===`unrecognized`?`settings.apiKeyUnsupportedSaved`:an===`unavailable`?`settings.apiKeyUnavailable`:an===`pending-save`?`settings.apiKeyPendingSave`:`settings.apiKeyUnsupported`),sn=an===`pending-invalid`||an===`unrecognized`;if((0,l.useEffect)(()=>{if(tn)return;let e=resolveTtsSettings(S);k(e.provider),M(e.doubaoModel),F(e.doubaoVoice),V(e.doubaoClonedVoice),H(e.doubaoInstruction),U(e.doubaoEnabled),se(e.breezeEnabled),le(e.breezeVoice),W(e.breezeInstruction),fe(e.instruction),xe(e.showInSidebar),Ce(e.showInHostSettings),Te(e.acceptExternalProviders),De(e.announcementSources),ke(e.qqbotEnabled),Me(e.enabled),Pe(e.autoPlay),Ie(e.voiceInputCompatibility),Ve(e.inputAvoidance),Ue(e.importantAnnouncementsFirst),Je(e.voiceVolume),Ze(e.voiceRate),et(e.readScope),nt(e.model),it(e.localSpeechMode),ot(e.localVoiceURI),ct(e.localVoiceEngine),ut(e.mossEnabled),ft(e.mossBaseURL),mt(e.mossVoice),gt(e.mossVoiceName),vt(e.voice),bt(e.voiceDesignPrompt),St(e.voiceDesignCustomPrompt),G(e.soundEnabled),Tt(e.soundVolume),Dt(e.soundPack),kt(e.taskSounds),jt(e.clickSounds),Nt({})},[tn,S]),(0,l.useEffect)(()=>()=>{Wt.dispose(),Y.dispose()},[Y,Wt]),(0,l.useEffect)(()=>{Wt.setEnabled(!Kt)},[Kt,Wt]),(0,l.useEffect)(()=>{n.update({enabled:Ct,volume:wt,pack:Et,taskSounds:Ot,clickSounds:At})},[At,n,Ct,Et,wt,Ot]),(0,l.useEffect)(()=>{Y.setVolume(Ke),Wt.setVolume(Ke)},[Y,Wt,Ke]),(0,l.useEffect)(()=>{!Jt&&Zt.current&&Xt.current?.focus({preventScroll:!0}),Zt.current=Jt},[Jt]),v.status===`unavailable`)return null;let markChange=e=>{Nt(t=>({...t,[e]:{kind:`set`}})),Ft(`idle`),Lt(null)},resetField=e=>{Y.stop(),Nt(t=>({...t,[e]:{kind:`clear`}})),Ft(`idle`),e===`provider`&&k($.provider===`doubao`&&!te||$.provider===`breeze`&&!re?`xiaomi`:$.provider),e===`doubaoModel`&&M($.doubaoModel),e===`doubaoVoice`&&F($.doubaoVoice),e===`doubaoClonedVoice`&&V($.doubaoClonedVoice),e===`doubaoInstruction`&&H($.doubaoInstruction),e===`breezeVoice`&&le($.breezeVoice),e===`breezeInstruction`&&W($.breezeInstruction),e===`instruction`&&fe($.instruction),e===`showInSidebar`&&xe($.showInSidebar),e===`showInHostSettings`&&Ce($.showInHostSettings),e===`acceptExternalProviders`&&Te($.acceptExternalProviders),e===`announcementSources`&&De($.announcementSources),e===`qqbotEnabled`&&ke($.qqbotEnabled),e===`enabled`&&Me($.enabled),e===`autoPlay`&&Pe($.autoPlay),e===`voiceInputCompatibility`&&Ie($.voiceInputCompatibility),e===`inputAvoidance`&&Ve($.inputAvoidance),e===`importantAnnouncementsFirst`&&Ue($.importantAnnouncementsFirst),e===`voiceVolume`&&Je($.voiceVolume),e===`voiceRate`&&Ze($.voiceRate),e===`readScope`&&et($.readScope),e===`model`&&nt($.model),e===`localSpeechMode`&&it($.localSpeechMode),e===`localVoiceURI`&&ot($.localVoiceURI),e===`localVoiceEngine`&&ct(lt?$.localVoiceEngine:`browser`),e===`mossEnabled`&&(ut($.mossEnabled),!$.mossEnabled&&st===`moss`&&(ct(`browser`),Nt(e=>({...e,localVoiceEngine:{kind:`set`}})))),e===`mossBaseURL`&&ft($.mossBaseURL),e===`mossVoice`&&mt($.mossVoice),e===`mossVoiceName`&&gt($.mossVoiceName),e===`voice`&&vt($.voice),e===`voiceDesignPrompt`&&bt($.voiceDesignPrompt),e===`voiceDesignCustomPrompt`&&St($.voiceDesignCustomPrompt),e===`soundEnabled`&&G($.soundEnabled),e===`soundVolume`&&Tt($.soundVolume),e===`soundPack`&&Dt($.soundPack),e===`taskSounds`&&kt($.taskSounds),e===`clickSounds`&&jt($.clickSounds)},discard=()=>{_.discard();let t=resolveTtsSettings(e.getSnapshot().value);k(t.provider),M(t.doubaoModel),F(t.doubaoVoice),V(t.doubaoClonedVoice),H(t.doubaoInstruction),U(t.doubaoEnabled),se(t.breezeEnabled),le(t.breezeVoice),W(t.breezeInstruction),fe(t.instruction),xe(t.showInSidebar),Ce(t.showInHostSettings),Te(t.acceptExternalProviders),De(t.announcementSources),ke(t.qqbotEnabled),Me(t.enabled),Pe(t.autoPlay),Ie(t.voiceInputCompatibility),Ve(t.inputAvoidance),Ue(t.importantAnnouncementsFirst),Je(t.voiceVolume),Ze(t.voiceRate),et(t.readScope),nt(t.model),it(t.localSpeechMode),ot(t.localVoiceURI),ct(t.localVoiceEngine),ut(t.mossEnabled),ft(t.mossBaseURL),mt(t.mossVoice),gt(t.mossVoiceName),vt(t.voice),bt(t.voiceDesignPrompt),St(t.voiceDesignCustomPrompt),G(t.soundEnabled),Tt(t.soundVolume),Dt(t.soundPack),kt(t.taskSounds),jt(t.clickSounds),E({xiaomi:``,doubao:``,breeze:``}),Y.stop(),Nt({}),Ft(`idle`)},save=async n=>{if(!(!x||m.getSnapshot()||Rt.current)){Rt.current=!0,q(null),Ft(`saving`),Lt(null);try{let commit=async()=>{let t=n===void 0?$t:{...$t,showInSidebar:n},r=n===void 0?Mt:{...Mt,showInSidebar:{kind:`set`}};await _.save(),await saveSettingsDraft(e,t,r,w,g!==null),(Mt.apiKey!==void 0||Mt.doubaoApiKey!==void 0||Mt.breezeApiKey!==void 0)&&invalidateApiKeyStatus(),g||E({xiaomi:``,doubao:``,breeze:``}),Nt(g?Object.fromEntries(Object.entries(Mt).filter(([e])=>yi.has(e))):{}),Ft(`saved`),n!==void 0&&c?.(n)};n===void 0?await commit():await withSidebarLoading(n,t,commit)}catch(e){let t=e instanceof SaveSettingsError?e.code:null;Lt(t===`api-key-rejected`?`api-key-rejected`:t===`host-rejected`?`host-rejected`:`unknown`),Ft(`failed`)}finally{Rt.current=!1}}},cn=Ht.status===`loading`||Ht.status===`playing`,togglePreview=e=>{if(h.claim(),h.canPlay()){if(cn){Y.stop();return}if(nn!==null||!g&&Mt[me]!==void 0){Y.stop(),Ut({status:`error`,source:D===`doubao`?`doubao`:D===`breeze`?`breeze`:`mimo`,error:nn===null?`save-key-first`:`voice-required`});return}a?.(),Y.play(e,{...$t,...g?{externalSelection:_.value}:{}})}},toggleSettingsPreview=()=>{togglePreview(Bt)},changeEnabled=e=>{Kt&&Ct&&At?n.play(e?`toggle-on`:`toggle-off`):h.canPlay()&&Wt.schedule(e?`on`:`off`),Me(e),e?markChange(`enabled`):(Pe(!1),Nt(e=>({...e,enabled:{kind:`set`},autoPlay:{kind:`set`}}))),Ft(`idle`)},changeAutoPlay=e=>{Kt&&Ct&&At?n.play(e?`toggle-on`:`toggle-off`):h.canPlay()&&Wt.schedule(e?`auto-on`:`auto-off`),Pe(e),e?(Me(!0),Nt(e=>({...e,autoPlay:{kind:`set`},enabled:{kind:`set`}}))):markChange(`autoPlay`),Ft(`idle`)},changeProvider=e=>{Ct&&At&&n.play(`select`),Y.stop(),k(e),markChange(`provider`)},changeSoundScope=e=>{let t=getSoundEffectsModeFlags(e);n.update({enabled:Ct,taskSounds:t.taskSounds,clickSounds:t.clickSounds,volume:wt,pack:Et}),kt(t.taskSounds),jt(t.clickSounds),Nt(e=>({...e,taskSounds:{kind:`set`},clickSounds:{kind:`set`}})),Ft(`idle`)},changeSoundEnabled=e=>{let t=getSoundEffectsModeFlags(resolveSoundEffectsScope(Ot,At));!e&&Ct&&At&&n.play(`toggle-off`),n.update({enabled:e,taskSounds:t.taskSounds,clickSounds:t.clickSounds,volume:wt,pack:Et}),e&&t.clickSounds&&n.play(`toggle-on`),G(e),kt(t.taskSounds),jt(t.clickSounds),Nt(e=>({...e,soundEnabled:{kind:`set`},taskSounds:{kind:`set`},clickSounds:{kind:`set`}})),Ft(`idle`)},toggleMinimalMode=()=>{let e=!Kt;qt(e),writeMinimalMode(e),Wt.setEnabled(!e),e&&Y.stop()};return Jt&&r?b?(0,d.jsx)(`p`,{className:`xmimo-ui-scope xmimo-tts-plugin-status`,role:`status`,children:t(`plugin.changing`)}):(0,d.jsx)(AudioHistoryPage,{history:r,t,volume:Ke,voiceRate:Ye,minimalMode:Kt,speechActivity:i,beforePlayback:()=>m.getSnapshot()||(h.claim(),!h.canPlay())?!1:(Y.stop(),Wt.dispose(),o?.(),!0),onBack:()=>{Yt(!1)}}):(0,d.jsxs)(`div`,{className:Kt?`xmimo-tts-card xmimo-tts-card-open xmimo-ui-scope xmimo-tts-card-minimal`:`xmimo-tts-card xmimo-tts-card-open xmimo-ui-scope`,children:[b?(0,d.jsx)(`p`,{className:`xmimo-tts-plugin-status`,role:`status`,children:t(`plugin.changing`)}):null,(0,d.jsxs)(`div`,{className:`xmimo-tts-card-body xmimo-ui-stack`,children:[(0,d.jsx)(SwitchModule,{doubaoEnabled:te,breezeEnabled:re,t,provider:D,enabled:Ae,autoPlay:Ne,soundEnabled:Ct,minimal:Kt,writable:x,onProviderChange:changeProvider,onEnabledChange:changeEnabled,onAutoPlayChange:changeAutoPlay,onSoundEnabledChange:changeSoundEnabled}),(0,d.jsx)(ApiKeyModule,{onOpenProviderSettings:p,t,provider:D,value:pe,message:on,invalid:sn,writable:x,minimal:Kt,onChange:e=>{setApiKey(e),markChange(me)}}),(0,d.jsx)(DetailsModule,{externalSelection:_.value,onExternalSelectionChange:e=>{Y.stop(),_.change(e),Ft(`idle`)},t,provider:D,doubaoModel:A,doubaoVoice:P,doubaoClonedVoice:I,breezeVoice:ce,breezeInstruction:ue,speechInstruction:D===`doubao`?ee:de,onSpeechInstructionChange:e=>{Y.stop(),D===`doubao`?(H(e),markChange(`doubaoInstruction`)):(fe(e),markChange(`instruction`))},onDoubaoModelChange:e=>{Y.stop(),M(e),markChange(`doubaoModel`)},onDoubaoVoiceChange:e=>{Y.stop(),F(e),markChange(`doubaoVoice`)},onDoubaoClonedVoiceChange:e=>{Y.stop(),V(e),markChange(`doubaoClonedVoice`)},onBreezeVoiceChange:e=>{Y.stop(),le(e),markChange(`breezeVoice`)},onBreezeInstructionChange:e=>{Y.stop(),W(e),markChange(`breezeInstruction`)},open:zt===`mixer`,minimal:Kt,writable:x,autoPlay:Ne,voiceVolume:Ke,voiceRate:Ye,readScope:Qe,model:tt,localSpeechMode:rt,localVoiceURI:at,localVoiceEngine:st,mossEnabled:lt,mossBaseURL:dt,mossVoice:pt,mossVoiceName:ht,voice:_t,voiceDesignPrompt:yt,voiceDesignCustomPrompt:xt,fieldOverridden,resetField,onToggle:()=>togglePanel(`mixer`),onVoiceVolumeChange:e=>{Y.setVolume(e),Wt.setPreviewVolume(e),Je(e),markChange(`voiceVolume`)},onVoiceVolumeInteractionEnd:e=>{h.canPlay()&&(Kt?n.previewVolume():Wt.previewVolume(e))},onVoiceRateChange:e=>{Ze(e),markChange(`voiceRate`)},onVoiceRateInteractionEnd:e=>{n.play(`success`,{playbackRate:e})},onReadScopeChange:e=>{et(e),markChange(`readScope`)},onModelChange:e=>{Y.stop(),nt(e),markChange(`model`)},onVoiceDesignPromptChange:e=>{bt(e),St(e),Nt(e=>({...e,voiceDesignPrompt:{kind:`set`},voiceDesignCustomPrompt:{kind:`set`}})),Ft(`idle`)},onVoiceChange:e=>{Y.stop(),vt(e),markChange(`voice`)},onLocalVoiceURIChange:e=>{ot(e),markChange(`localVoiceURI`)},onLocalVoiceEngineChange:e=>{ct(e),markChange(`localVoiceEngine`)},onMossBaseURLChange:e=>{ft(e),markChange(`mossBaseURL`)},onMossVoiceChange:(e,t)=>{mt(e),gt(t),Nt(e=>({...e,mossVoice:{kind:`set`},mossVoiceName:{kind:`set`}})),Ft(`idle`)},onLocalSpeechModeChange:e=>{it(e),markChange(`localSpeechMode`)}}),(0,d.jsx)(PreviewModule,{externalSelection:_.value,mossEnabled:lt,onMossEnabledChange:e=>{Y.stop(),ut(e);let t=!e&&st===`moss`;t&&ct(`browser`),Nt(e=>({...e,mossEnabled:{kind:`set`},...t?{localVoiceEngine:{kind:`set`}}:{}})),Ft(`idle`)},doubaoEnabled:te,breezeEnabled:re,onProviderEnabledChange:(e,t)=>{if(!t&&(e===`doubao`?!re:!te))return;Y.stop(),e===`doubao`?U(t):se(t);let n=!t&&D===e;n&&k(`xiaomi`),Nt(t=>({...t,[e===`doubao`?`doubaoEnabled`:`breezeEnabled`]:{kind:`set`},...n?{provider:{kind:`set`}}:{}})),Ft(`idle`)},t,enabled:!b,open:zt===`broadcast`,onToggleOpen:()=>togglePanel(`broadcast`),status:Ht.status,source:Ht.source,error:Ht.error,text:Bt,audioTagProvider:D===`breeze`?`breeze`:D===`xiaomi`&&tt===`mimo-v2.5-tts`?`xiaomi`:void 0,onToggle:toggleSettingsPreview,onTextChange:e=>{Y.stop(),Vt(e)},recording:Y.getRecording(),showInHostSettings:Se,acceptExternalProviders:we,onAcceptExternalProvidersChange:e=>{Te(e),markChange(`acceptExternalProviders`)},acceptExternalProvidersOverridden:fieldOverridden(`acceptExternalProviders`),onAcceptExternalProvidersReset:()=>resetField(`acceptExternalProviders`),onShowInHostSettingsChange:e=>{Ce(e),markChange(`showInHostSettings`)},showInHostSettingsOverridden:fieldOverridden(`showInHostSettings`),onShowInHostSettingsReset:()=>resetField(`showInHostSettings`),inputAvoidance:Re,onInputAvoidanceChange:e=>{Ve(e),markChange(`inputAvoidance`)},inputAvoidanceOverridden:fieldOverridden(`inputAvoidance`),onInputAvoidanceReset:()=>resetField(`inputAvoidance`),importantAnnouncementsFirst:He,onImportantAnnouncementsFirstChange:e=>{Ue(e),markChange(`importantAnnouncementsFirst`)},importantAnnouncementsFirstOverridden:fieldOverridden(`importantAnnouncementsFirst`),onImportantAnnouncementsFirstReset:()=>resetField(`importantAnnouncementsFirst`),voiceInputCompatibility:Fe,onVoiceInputCompatibilityChange:e=>{Ie(e),markChange(`voiceInputCompatibility`)},voiceInputCompatibilityOverridden:fieldOverridden(`voiceInputCompatibility`),onVoiceInputCompatibilityReset:()=>resetField(`voiceInputCompatibility`),sources:Ee,qqbotEnabled:Oe,onQqbotChange:e=>{ke(e),markChange(`qqbotEnabled`)},writable:x,overridden:fieldOverridden(`announcementSources`),onReset:()=>resetField(`announcementSources`),onChange:e=>{De(e),markChange(`announcementSources`)}}),Ct?(0,d.jsx)(SoundEffectsPanel,{t,controller:n,enabled:Ct,volume:wt,pack:Et,taskSounds:Ot,clickSounds:At,writable:x,minimal:Kt,open:zt===`sound`,onToggle:()=>togglePanel(`sound`),onScopeChange:changeSoundScope,onVolumeChange:e=>{Tt(e),markChange(`soundVolume`)},onPackChange:e=>{Dt(e),markChange(`soundPack`)}}):null,(0,d.jsx)(`div`,{className:`xmimo-tts-card-footer`,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-card-actions`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-card-action-links`,children:[(0,d.jsx)(SidebarSettings,{t,value:Qt.showInSidebar,disabled:!x||Pt===`saving`||nn!==null,onToggle:()=>{save(!Qt.showInSidebar)}}),r?(0,d.jsx)(HistoryLink,{history:r,t,buttonRef:Xt,onOpen:()=>{Y.stop(),Wt.dispose(),Yt(!0)}}):null,(0,d.jsxs)(u.Button,{type:`button`,variant:`toolbar`,size:`sm`,className:`xmimo-tts-mode-toggle`,"aria-pressed":Kt,"aria-label":`${t(`settings.minimalMode`)}: ${t(Kt?`settings.minimalModeOn`:`settings.minimalModeOff`)}`,onClick:toggleMinimalMode,children:[(0,d.jsx)(RiSwitchFill,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{className:`xmimo-tts-action-label`,children:t(Kt?`settings.defaultModeShort`:`settings.minimalModeShort`)})]})]}),v.writable?null:(0,d.jsx)(`span`,{children:t(`settings.readOnly`)}),nn===null?null:(0,d.jsx)(`span`,{role:`alert`,className:`xmimo-tts-failed`,children:t(`settings.doubaoVoiceRequired`)}),Pt===`failed`?(0,d.jsx)(`span`,{className:`xmimo-tts-failed`,role:`status`,children:t(It===`api-key-rejected`?`settings.apiKeyUnsupported`:It===`host-rejected`?`settings.saveRejected`:`settings.failed`)}):null,(0,d.jsxs)(`div`,{className:`xmimo-tts-card-action-buttons`,children:[Pt===`saved`&&!tn?(0,d.jsx)(`span`,{role:`status`,children:t(`settings.saved`)}):null,(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,className:`xmimo-tts-discard`,disabled:!x||!tn||Pt===`saving`,onClick:discard,children:t(`settings.discard`)}),(0,d.jsx)(u.Button,{type:`button`,variant:`primary`,size:`sm`,className:`xmimo-tts-save`,disabled:!x||!rn||Pt===`saving`||nn!==null,onClick:()=>{save()},children:t(Pt===`saving`?`settings.saving`:`settings.save`)})]})]})})]})]})}function BundleSettingsCard(e){let t=useSettingsSnapshot(e.scope);return e.view===`page`&&t.status===`ready`&&resolveTtsSettings(t.value).showInSidebar?null:(0,d.jsx)(SettingsCard,{...e})}function registerBundleSettings(e,t){let n,update=()=>{let r=t.scope.getSnapshot();r.status===`ready`&&resolveTtsSettings(r.value).showInSidebar?(n?.(),n=void 0):n||=e.slots.register({name:`plugins.bundle.config`,key:`dsh-xiaomi-tts`,locale:hi,inject:()=>t},BundleSettingsCard)},r=t.scope.subscribe(update);try{update()}catch(e){throw r(),e}let i=!1;return()=>{i||(i=!0,r(),n?.(),n=void 0)}}function validQqSpeechDraft(e){return typeof e.qqbotEnabled==`boolean`&&Number.isInteger(e.qqbotMaxAutoCharacters)&&e.qqbotMaxAutoCharacters>=0&&e.qqbotMaxAutoCharacters<=12e3&&Number.isInteger(e.qqbotMaxDurationSeconds)&&e.qqbotMaxDurationSeconds>=0&&e.qqbotMaxDurationSeconds<=6e3}async function saveQqSpeechDraft(e,t,n,r){let i=e.getSnapshot();if(!validQqSpeechDraft(n)||i.status!==`ready`||!i.writable||i.revision!==r)throw Error(`qqbot-settings-conflict`);let a=Object.keys(t).filter(e=>t[e]!==n[e]).map(e=>({op:`set`,path:[e],value:n[e]}));if(a.length&&!await e.mutate(a,r))throw Error(`qqbot-settings-save-failed`)}async function loadQqMemory(){let e=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/qq-memory`),{credentials:`same-origin`});if(!e.ok)throw Error(`qq-memory-unavailable`);let t=await e.json();return Array.isArray(t.peers)?t.peers:[]}async function updateQqMemory(e){let t=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/qq-memory`),{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`qq-memory-update-failed`);return t.json()}let aa={persona:{name:`鲸鱼娘`,selfReference:`我`,userAddress:`主人`,relationship:`蓝色鲸鱼娘女仆`,personality:``,replyStyle:`日常回复默认一到三句短话,优先直接回答,不总结、不复述问题、不额外寒暄;仅在明确要求时展开。`,likes:`米饭,只在聊吃饭、询问喜好或对方主动接梗时提及`,boundaries:``},memory:{enabled:!0}};function validateWhaleDraft(e){let t={name:60,selfReference:40,userAddress:40,relationship:1e3,personality:1200,replyStyle:1200,likes:1e3,boundaries:1200};for(let n of Object.keys(t)){let r=e.persona[n];if(r.length>t[n]||(n===`name`||n===`selfReference`)&&!r.trim())return`persona`}return null}async function saveWhaleDraft(e,t,n,r){if(validateWhaleDraft(n))throw Error(`whale-draft-invalid`);let i=e.getSnapshot();if(!i.writable||i.status!==`ready`||i.revision!==r)throw Error(`whale-settings-conflict`);let a=[];for(let e of[`persona`,`memory`])for(let r of Object.keys(n[e])){let i=n[e][r],o=t[e][r];JSON.stringify(i)!==JSON.stringify(o)&&a.push({op:`set`,path:[e,r],value:JSON.parse(JSON.stringify(i))})}if(a.length&&!await e.mutate(a,r))throw Error(`whale-settings-save-failed`)}let oa=[{field:`name`,label:`whale.name`,limit:60},{field:`selfReference`,label:`whale.selfReference`,limit:40},{field:`userAddress`,label:`whale.userAddress`,limit:40},{field:`relationship`,label:`whale.relationship`,limit:1e3},{field:`personality`,label:`whale.personality`,limit:1200,multiline:!0},{field:`replyStyle`,label:`whale.replyStyle`,limit:1200,multiline:!0},{field:`likes`,label:`whale.likes`,limit:1e3,multiline:!0},{field:`boundaries`,label:`whale.boundaries`,limit:1200,multiline:!0}],sa={persona:`whale.errorPersona`};function Field({label:e,children:t}){return(0,d.jsxs)(`label`,{className:`xmimo-qq-field`,children:[(0,d.jsx)(`span`,{children:e}),t]})}function WhalePersonaSettings(e){return e.view===`summary`?(0,d.jsx)(d.Fragment,{children:e.t(`whale.description`)}):(0,d.jsx)(WhaleSettingsPage,{scope:e.scope,t:e.t,changes:e.changes,channel:e.channel})}function WhaleSettingsPage({scope:e,t,changes:n=na,channel:r=`dsh`}){let i=useSettingsSnapshot(e),a=(0,l.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),[o,s]=(0,l.useState)(null),[c,p]=(0,l.useState)(`idle`),m=o?.value??i.value??aa,h=i.status===`ready`,g=!h||!i.writable||a||c===`saving`,_=o!==null&&JSON.stringify(o.base)!==JSON.stringify(o.value),v=o!==null&&o.revision!==i.revision,b=_?validateWhaleDraft(m):null,edit=e=>{if(g||i.revision===void 0||!i.value)return;let t=i.revision,n=i.value;s(r=>r?{...r,value:e(r.value)}:{base:n,value:e(n),revision:t}),p(`idle`)},save=async()=>{if(!(!o||g||!_||b||v)){p(`saving`);try{await saveWhaleDraft(e,o.base,o.value,o.revision),s(null),p(`saved`)}catch{p(`failed`)}}};return h?(0,d.jsxs)(`form`,{className:`xmimo-ui-scope xmimo-qq-settings`,"aria-label":t(r===`qq`?`qq.persona`:`whale.persona`),onSubmit:e=>{e.preventDefault(),save()},children:[a?(0,d.jsx)(`p`,{role:`status`,children:t(`plugin.changing`)}):null,(0,d.jsxs)(`section`,{"aria-label":t(`whale.persona`),children:[(0,d.jsx)(`h4`,{children:t(r===`qq`?`qq.persona`:`whale.persona`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(r===`qq`?`qq.personaHint`:`whale.personaHint`)}),(0,d.jsx)(`div`,{className:`xmimo-qq-grid`,children:oa.map(({field:e,label:n,limit:r,multiline:i})=>(0,d.jsx)(Field,{label:t(n),children:i?(0,d.jsx)(`textarea`,{rows:3,maxLength:r,value:m.persona[e],disabled:g,onChange:t=>{let n=t.currentTarget.value;edit(t=>({...t,persona:{...t.persona,[e]:n}}))}}):(0,d.jsx)(`input`,{maxLength:r,value:m.persona[e],disabled:g,required:e===`name`||e===`selfReference`,onChange:t=>{let n=t.currentTarget.value;edit(t=>({...t,persona:{...t.persona,[e]:n}}))}})},e))})]}),(0,d.jsxs)(`section`,{"aria-label":t(`whale.memory`),children:[(0,d.jsxs)(`div`,{className:`xmimo-qq-heading`,children:[(0,d.jsx)(`h4`,{children:t(`whale.memory`)}),(0,d.jsx)(u.Switch,{label:t(`whale.memoryEnabled`),checked:m.memory.enabled,disabled:g,onChange:e=>edit(t=>({...t,memory:{enabled:e}}))})]}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(r===`qq`?`qq.personaMemoryHint`:`whale.memoryHint`)})]}),(0,d.jsx)(`div`,{className:`xmimo-tts-card-footer xmimo-qq-footer`,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-card-actions`,children:[(0,d.jsx)(`span`,{role:`status`,children:i.writable?v?t(`whale.conflict`):b?t(sa[b]):c===`failed`?t(`settings.failed`):c===`saved`&&!_?t(`settings.saved`):``:t(`settings.readOnly`)}),(0,d.jsxs)(`div`,{className:`xmimo-tts-card-action-buttons`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:!o||c===`saving`,onClick:()=>{s(null),p(`idle`)},children:t(`settings.discard`)}),(0,d.jsx)(u.Button,{type:`submit`,variant:`primary`,size:`sm`,className:`xmimo-tts-save`,disabled:g||!_||v||b!==null,children:t(c===`saving`?`settings.saving`:`settings.save`)})]})]})})]}):(0,d.jsx)(`p`,{role:`status`,children:t(i.status===`loading`?`whale.loading`:r===`qq`?`qq.personaUnavailable`:`whale.unavailable`)})}function QqbotSpeechSettings(e){return e.view===`summary`?(0,d.jsx)(d.Fragment,{children:e.t(`qq.description`)}):(0,d.jsxs)(`div`,{children:[(0,d.jsx)(WhalePersonaSettings,{view:e.view,scope:e.personaScope,t:e.t,changes:e.changes,channel:`qq`}),(0,d.jsx)(QqbotSpeechPage,{...e})]})}function QqbotSpeechPage({scope:e,t,changes:n=na}){let r=useSettingsSnapshot(e),i=(0,l.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(`idle`),[p,m]=(0,l.useState)({status:`loading`,peers:[]}),[h,g]=(0,l.useState)({}),[_,v]=(0,l.useState)(``),[b,x]=(0,l.useState)(!1),refreshMemory=()=>{loadQqMemory().then(e=>m({status:`ready`,peers:e})).catch(()=>m({status:`unavailable`,peers:[]}))},runMemoryAction=async e=>{if(!b){x(!0),v(``);try{await e(),refreshMemory(),v(`qq.memorySaved`)}catch{v(`qq.memoryError`)}finally{x(!1)}}};(0,l.useEffect)(()=>{refreshMemory()},[]);let S=resolveTtsSettings(r.value),C={qqbotEnabled:S.qqbotEnabled,qqbotMaxAutoCharacters:S.qqbotMaxAutoCharacters,qqbotMaxDurationSeconds:S.qqbotMaxDurationSeconds},w=a?.value??C,E=r.status!==`ready`||!r.writable||i||s===`saving`,D=a!==null&&JSON.stringify(a.base)!==JSON.stringify(w),k=a!==null&&a.revision!==r.revision,A=validQqSpeechDraft(w),edit=(e,t)=>{if(E||r.revision===void 0)return;let n=r.revision;o(r=>({base:r?.base??C,revision:r?.revision??n,value:{...r?.value??C,[e]:t}})),c(`idle`)},save=async()=>{if(!(!a||E||!D||k||!A)){c(`saving`);try{await saveQqSpeechDraft(e,a.base,a.value,a.revision),o(null),c(`saved`)}catch{c(`failed`)}}};return r.status===`ready`?(0,d.jsxs)(`form`,{className:`xmimo-ui-scope xmimo-qq-settings`,"aria-label":t(`qq.voice`),onSubmit:e=>{e.preventDefault(),save()},children:[(0,d.jsxs)(`section`,{children:[(0,d.jsxs)(`div`,{className:`xmimo-qq-heading`,children:[(0,d.jsx)(`h4`,{children:t(`qq.voice`)}),(0,d.jsx)(u.Switch,{label:t(`qq.automatic`),checked:w.qqbotEnabled,disabled:E,onChange:e=>edit(`qqbotEnabled`,e)})]}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`qq.voiceHint`)}),(0,d.jsx)(`div`,{className:`xmimo-qq-grid`,children:[`qqbotMaxAutoCharacters`,`qqbotMaxDurationSeconds`].map(e=>(0,d.jsxs)(`label`,{className:`xmimo-qq-field`,children:[(0,d.jsx)(`span`,{children:t(e===`qqbotMaxAutoCharacters`?`qq.characters`:`qq.duration`)}),(0,d.jsx)(`input`,{type:`number`,min:0,max:e===`qqbotMaxAutoCharacters`?12e3:6e3,step:1,disabled:E,value:Number.isNaN(w[e])?``:w[e],onChange:t=>edit(e,t.currentTarget.value===``?NaN:Number(t.currentTarget.value))})]},e))}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`qq.limitsHint`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`qq.ruleHint`)})]}),(0,d.jsxs)(`section`,{"aria-label":t(`qq.memory`),children:[(0,d.jsx)(`div`,{className:`xmimo-qq-heading`,children:(0,d.jsx)(`h4`,{children:t(`qq.memory`)})}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`qq.memoryHint`)}),p.status===`loading`?(0,d.jsx)(`p`,{role:`status`,children:t(`qq.memoryLoading`)}):null,p.status===`unavailable`?(0,d.jsx)(`p`,{role:`status`,children:t(`qq.memoryUnavailable`)}):null,p.status===`ready`&&p.peers.length===0?(0,d.jsx)(`p`,{role:`status`,children:t(`qq.memoryEmpty`)}):null,(0,d.jsx)(`div`,{className:`xmimo-qq-memory-list`,children:p.peers.map(e=>(0,d.jsxs)(`div`,{className:`xmimo-qq-memory-peer`,children:[(0,d.jsxs)(`div`,{className:`xmimo-qq-heading`,children:[(0,d.jsx)(`strong`,{children:e.scope===`group`?`${t(`qq.group`)} ${e.peerId}`:`${t(`qq.private`)} ${e.peerId}`}),(0,d.jsxs)(`div`,{className:`xmimo-qq-memory-actions`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:b,onClick:()=>{runMemoryAction(()=>updateQqMemory({key:e.key,action:e.memoryEnabled?`pause`:`resume`}))},children:e.memoryEnabled?t(`qq.pauseMemory`):t(`qq.resumeMemory`)}),(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:b,onClick:()=>{runMemoryAction(()=>updateQqMemory({key:e.key,action:`clear`}))},children:t(`qq.clearMemory`)})]})]}),[...e.entries.map(e=>({id:e.id,kind:e.kind,text:e.text})),...e.topics.map(e=>({id:e.id,kind:`topic`,text:e.title}))].map(n=>(0,d.jsxs)(`div`,{className:`xmimo-qq-memory-row`,children:[(0,d.jsx)(`span`,{className:`xmimo-qq-memory-kind`,children:t(`qq.memoryKind.${n.kind}`)}),(0,d.jsx)(`input`,{disabled:b,value:h[n.id]??n.text,maxLength:n.kind===`topic`?80:300,onChange:e=>g(t=>({...t,[n.id]:e.currentTarget.value}))}),(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:b,onClick:()=>{runMemoryAction(async()=>{await updateQqMemory({key:e.key,action:`save`,id:n.id,kind:n.kind,text:h[n.id]??n.text}),g(e=>{let t={...e};return delete t[n.id],t})})},children:t(`qq.editMemory`)}),(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:b,onClick:()=>{runMemoryAction(async()=>{await updateQqMemory({key:e.key,action:`delete`,id:n.id}),g(e=>{let t={...e};return delete t[n.id],t})})},children:t(`qq.deleteMemory`)})]},n.id))]},e.key))}),_?(0,d.jsx)(`span`,{role:`status`,children:t(_)}):null]}),(0,d.jsx)(`div`,{className:`xmimo-tts-card-footer xmimo-qq-footer`,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-card-actions`,children:[(0,d.jsx)(`span`,{role:`status`,children:r.writable?k?t(`whale.conflict`):A?s===`failed`?t(`settings.failed`):s===`saved`&&!D?t(`settings.saved`):``:t(`qq.error`):t(`settings.readOnly`)}),(0,d.jsxs)(`div`,{className:`xmimo-tts-card-action-buttons`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:!a||s===`saving`,onClick:()=>{o(null),c(`idle`)},children:t(`settings.discard`)}),(0,d.jsx)(u.Button,{type:`submit`,variant:`primary`,size:`sm`,disabled:E||!D||k||!A,children:t(s===`saving`?`settings.saving`:`settings.save`)})]})]})})]}):(0,d.jsx)(`p`,{role:`status`,children:t(`qq.unavailable`)})}function registerWhalePersonaSettings(e,t,n){return e.slots.register({name:`plugins.row.config`,key:`dsh-xiaomi-tts#preset-whale-girl`,locale:hi,inject:()=>({scope:e.configForms.get(`preset-whale-girl`),t,changes:n})},WhalePersonaSettings)}function registerQqbotSpeechSettings(e,t,n){return e.slots.register({name:`plugins.row.config`,key:`dsh-xiaomi-tts#speech-delivery-qqbot`,locale:hi,inject:()=>({scope:e.configForms.get(`xiaomi-mimo-tts`),personaScope:e.configForms.get(`speech-delivery-qqbot`),t,changes:n})},QqbotSpeechSettings)}function FiRefreshCw(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`23 4 23 10 17 10`},child:[]},{tag:`polyline`,attr:{points:`1 20 1 14 7 14`},child:[]},{tag:`path`,attr:{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`},child:[]}]})(e)}function FiLink(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`},child:[]},{tag:`path`,attr:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`},child:[]}]})(e)}function FiCopy(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},child:[]}]})(e)}function FiCheck(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`20 6 9 17 4 12`},child:[]}]})(e)}let ca={host:`127.0.0.1`,port:3101,accessToken:``,deviceId:``,agentPreset:`whale-girl`,cwd:`~/.dsh-xiaomi-tts/passport/workspace`,sessionRevision:``,silenceMs:700,minSpeechMs:200,speechThreshold:.015,maxRecordingSeconds:30,maxReplySeconds:60,requestTimeoutMs:18e4},la={port:{min:1,max:65535,step:1},silenceMs:{min:200,max:3e3,step:20},minSpeechMs:{min:100,max:1e3,step:20},speechThreshold:{min:.001,max:.5,step:.001},maxRecordingSeconds:{min:1,max:60,step:`any`},maxReplySeconds:{min:1,max:120,step:`any`},requestTimeoutMs:{min:1e4,max:6e5,step:`any`}};function isPassportAccessToken(e){return/^\d{4}$/u.test(e)||e.length>=24&&e.length<=192&&!/\s/u.test(e)}function generatePassportPairingCode(){let e=new Uint16Array(1);do crypto.getRandomValues(e);while(e[0]>=6e4);return String(e[0]%1e4).padStart(4,`0`)}function validatePassportDraft(e,t=!1){if(!e.host.trim()||/[\s/]/u.test(e.host))return`host`;if(!(t&&e.accessToken===``)&&!isPassportAccessToken(e.accessToken))return`accessToken`;if(e.deviceId&&!/^[a-zA-Z0-9_.:-]{1,128}$/u.test(e.deviceId))return`deviceId`;if(typeof e.sessionRevision!=`string`||e.sessionRevision.length>128)return`sessionRevision`;for(let t of Object.keys(la)){let{min:n,max:r}=la[t];if(!Number.isFinite(e[t])||e[t]<n||e[t]>r)return t}return Number.isInteger(e.port)?null:`port`}async function savePassportDraft(e,t,n,r,i=!1){if(validatePassportDraft(n,i))throw Error(`passport-draft-invalid`);let a=e.getSnapshot();if(a.status!==`ready`||!a.writable||a.revision!==r)throw Error(`passport-settings-conflict`);let o=[];for(let e of Object.keys(ca))e===`accessToken`&&n.accessToken===``&&i||n[e]!==t[e]&&o.push({op:`set`,path:[e],value:n[e]});if(o.length&&!await e.mutate(o,r))throw Error(`passport-settings-save-failed`)}async function refreshPassportSession(e,t,n,r,i,a=!1){if(n.agentPreset&&!i.some(e=>e.id===n.agentPreset&&!e.unavailable))throw Error(`passport-preset-unavailable`);let o=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``);await savePassportDraft(e,t,{...n,sessionRevision:o},r,a)}let ua=[{id:`connection`,fields:[`host`,`port`,`accessToken`,`deviceId`]},{id:`workspace`,fields:[`cwd`]},{id:`capture`,fields:[`silenceMs`,`minSpeechMs`,`speechThreshold`,`maxRecordingSeconds`]},{id:`limits`,fields:[`maxReplySeconds`,`requestTimeoutMs`]}];function PassportSettingsPage(e){return e.view===`summary`?(0,d.jsx)(d.Fragment,{children:e.t(`passport.description`)}):(0,d.jsx)(PassportForm,{...e})}function PassportForm({scope:e,t,changes:n=na,tokenConfigured:r,connectionStatus:i,presets:a,guideHref:o=`https://ppy-web.github.io/dsh-plugin-xiaomi-mimo-tts/#passport`}){let s=(0,l.useId)(),c=useSettingsSnapshot(e),p=(0,l.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),m=r??na,h=(0,l.useSyncExternalStore)(m.subscribe,m.getSnapshot,m.getSnapshot),[g,_]=(0,l.useState)({scope:null,configured:!1}),[v,b]=(0,l.useState)(void 0),[x,S]=(0,l.useState)(``),[C,w]=(0,l.useState)(``),[E,D]=(0,l.useState)(a),[k,A]=(0,l.useState)(!1),[M,P]=(0,l.useState)(0);(0,l.useEffect)(()=>{if(a){D(a);return}if(c.status!==`ready`||p)return;let e=new AbortController;return D(void 0),A(!1),fetch(hostRoute(`/plugins/xiaomi-mimo-tts/passport-presets`),{cache:`no-store`,credentials:`same-origin`,signal:e.signal}).then(async t=>{if(!t.ok)throw Error(`passport-preset-unavailable`);let n=await t.json();if(!Array.isArray(n.presets)||n.presets.some(e=>typeof e.id!=`string`))throw Error(`passport-preset-unavailable`);e.signal.aborted||D(n.presets)}).catch(()=>{e.signal.aborted||A(!0)}),()=>e.abort()},[a,c.status,p,M]);let F=h||g.scope===e&&g.configured||!!c.value?.accessToken;(0,l.useEffect)(()=>{if(r||c.status!==`ready`||p)return;let t=new AbortController,n=c.revision,i,refresh=async()=>{try{let r=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/passport-status`),{cache:`no-store`,credentials:`same-origin`,signal:t.signal});if(!r.ok)throw Error(`passport-status-unavailable`);let i=await r.json();!t.signal.aborted&&e.getSnapshot().revision===n&&typeof i.configured==`boolean`&&(_({scope:e,configured:i.configured}),b(i))}catch{}t.signal.aborted||(i=setTimeout(()=>{refresh()},2500))};return refresh(),()=>{t.abort(),clearTimeout(i)}},[e,r,c.status,c.revision,p]);let[I,V]=(0,l.useState)(null),[ee,H]=(0,l.useState)(`idle`),te={...ca,...c.value,accessToken:c.value?.accessToken??``},U=I?.value??te,re=c.status!==`ready`||!c.writable||p||ee===`saving`,se=I!==null&&Object.keys(ca).some(e=>I.base[e]!==U[e]),ce=I!==null&&I.revision!==c.revision,le=validatePassportDraft(U,F),ue=!U.agentPreset||E?.some(e=>e.id===U.agentPreset&&!e.unavailable),edit=(e,t)=>{if(re||c.revision===void 0)return;let n=c.revision;V(r=>({base:r?.base??te,revision:r?.revision??n,value:{...r?.value??te,[e]:t}})),H(`idle`)},save=async()=>{if(!(!I||re||!se||ce||le)){H(`saving`);try{await savePassportDraft(e,I.base,I.value,I.revision,F),I.value.accessToken!==I.base.accessToken&&w(/^\d{4}$/u.test(I.value.accessToken)?I.value.accessToken:``),I.value.accessToken&&_({scope:e,configured:!0}),V(null),H(`saved`)}catch{H(`failed`)}}},quickConnect=async()=>{if(re||ce||c.revision===void 0)return;let t=generatePassportPairingCode(),n={...U,host:`0.0.0.0`,accessToken:t};H(`saving`);try{await savePassportDraft(e,I?.base??te,n,I?.revision??c.revision,F),V(null),_({scope:e,configured:!0}),w(t),H(`saved`)}catch{H(`failed`)}},W=i??v,renewSession=async()=>{if(!(re||ce||le||!E||!ue||c.revision===void 0)){H(`saving`);try{await refreshPassportSession(e,I?.base??te,U,I?.revision??c.revision,E,F),U.accessToken!==(I?.base??te).accessToken&&w(/^\d{4}$/u.test(U.accessToken)?U.accessToken:``),U.accessToken&&_({scope:e,configured:!0}),V(null),H(`renewed`)}catch{H(`failed`)}}},de=W?.error===`passport-port-in-use`?`passport.portInUse`:W?.error?`passport.listenFailed`:W?W.sessionError===`passport-preset-changed`?`passport.presetChanged`:W.sessionError===`passport-preset-unavailable`?`passport.presetUnavailable`:W.sessionError===`passport-session-unavailable`?`passport.sessionFailed`:typeof W.servicesReady==`boolean`?W.servicesReady?W.listening?[`127.0.0.1`,`localhost`,`::1`,`[::1]`].includes(W.host)?`passport.localOnly`:W.recognitionReady?W.connected?`passport.deviceConnected`:`passport.deviceWaiting`:`passport.asrWaiting`:`passport.notListening`:`passport.servicesWaiting`:`passport.reloadRequired`:`passport.statusLoading`,fe=de===`passport.deviceConnected`?`connected`:de===`passport.deviceWaiting`?`waiting`:[`passport.statusLoading`,`passport.notListening`].includes(de)?`idle`:`warning`;return c.status===`ready`?(0,d.jsxs)(`form`,{className:`xmimo-ui-scope xmimo-qq-settings xmimo-passport-settings`,"aria-label":t(`passport.title`),onSubmit:e=>{e.preventDefault(),save()},children:[(0,d.jsxs)(`header`,{className:`xmimo-passport-intro`,children:[(0,d.jsx)(`p`,{children:t(`passport.requirements`)}),(0,d.jsx)(`a`,{href:o,target:o.startsWith(`#`)?void 0:`_blank`,rel:o.startsWith(`#`)?void 0:`noopener noreferrer`,children:t(`passport.guide`)})]}),p?(0,d.jsx)(`p`,{role:`status`,children:t(`plugin.changing`)}):null,(0,d.jsxs)(`section`,{className:`xmimo-passport-quick`,"aria-labelledby":`${s}-quick`,children:[(0,d.jsxs)(`div`,{className:`xmimo-passport-heading`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h4`,{id:`${s}-quick`,children:t(`passport.quickTitle`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.quickHint`)})]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`primary`,size:`sm`,disabled:re||ce,onClick:()=>{quickConnect()},children:[C?(0,d.jsx)(FiRefreshCw,{"aria-hidden":`true`}):(0,d.jsx)(FiLink,{"aria-hidden":`true`}),t(ee===`saving`?`settings.saving`:`passport.quickEnable`)]})]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-status`,"data-tone":fe,role:`status`,children:[(0,d.jsx)(`span`,{className:`xmimo-passport-status-dot`,"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:t(de)}),W?.listening?(0,d.jsxs)(`span`,{className:`xmimo-passport-port`,children:[t(`passport.port`),` `,(0,d.jsx)(`strong`,{children:W.port})]}):null]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-transfer`,children:[(0,d.jsxs)(`div`,{className:`xmimo-passport-ip-field`,children:[(0,d.jsx)(`h4`,{children:t(`passport.computerIp`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.networkHint`)}),W?.addresses?.length?(0,d.jsx)(`ul`,{className:`xmimo-passport-addresses`,children:W.addresses.map(e=>(0,d.jsxs)(`li`,{children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`strong`,{children:e.address}),(0,d.jsx)(`span`,{children:e.name})]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{if(!navigator.clipboard){S(`failed`);return}navigator.clipboard.writeText(e.address).then(()=>S(e.address),()=>S(`failed`))},"aria-label":`${t(x===e.address?`passport.copied`:`passport.copyAddress`)} ${e.address}`,children:[x===e.address?(0,d.jsx)(FiCheck,{"aria-hidden":`true`}):(0,d.jsx)(FiCopy,{"aria-hidden":`true`}),t(x===e.address?`passport.copied`:`passport.copyAddress`)]})]},e.address))}):(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.addressUnavailable`)}),x?(0,d.jsx)(`span`,{className:`xmimo-passport-copy-feedback`,role:`status`,children:t(x===`failed`?`passport.copyFailed`:`passport.copied`)}):null]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-pair-field`,children:[(0,d.jsx)(`h4`,{children:t(`passport.codeLabel`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(C?`passport.matchCode`:F?`passport.codeSaved`:`passport.codeEmpty`)}),(0,d.jsxs)(`div`,{className:`xmimo-passport-digits`,"aria-label":t(`passport.codeLabel`),children:[Array.from(C||`----`,(e,t)=>(0,d.jsx)(`span`,{"aria-hidden":`true`,children:e===`-`?`–`:e},t)),(0,d.jsx)(`span`,{className:`xmimo-passport-sr-only`,children:C||t(F?`passport.codeSaved`:`passport.codeEmpty`)})]}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.devScope`)})]})]}),(0,d.jsxs)(`aside`,{className:`xmimo-passport-device-help`,children:[(0,d.jsx)(`h4`,{children:t(`passport.deviceSetup`)}),(0,d.jsx)(`p`,{children:t(`passport.deviceSetupHint`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.stepTalk`)})]})]}),(0,d.jsxs)(`section`,{"aria-labelledby":`${s}-preset`,children:[(0,d.jsxs)(`div`,{className:`xmimo-passport-heading`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h4`,{id:`${s}-preset`,children:t(`passport.session`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.sessionHint`)})]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:re||ce||!!le||!E||!ue,onClick:()=>{renewSession()},children:[(0,d.jsx)(FiRefreshCw,{"aria-hidden":`true`}),t(ee===`saving`?`settings.saving`:`passport.newSession`)]})]}),(0,d.jsxs)(`label`,{className:`xmimo-qq-field`,htmlFor:`${s}-agentPreset`,children:[(0,d.jsx)(`span`,{children:t(`passport.agentPreset`)}),(0,d.jsxs)(`select`,{id:`${s}-agentPreset`,name:`agentPreset`,disabled:re||!E,value:U.agentPreset,"aria-describedby":`${s}-preset-hint`,onChange:e=>edit(`agentPreset`,e.currentTarget.value),children:[(0,d.jsx)(`option`,{value:``,children:t(`passport.hostDefault`)}),U.agentPreset&&!E?.some(e=>e.id===U.agentPreset)?(0,d.jsxs)(`option`,{value:U.agentPreset,disabled:!0,children:[U.agentPreset,` — `,t(`passport.presetUnavailable`)]}):null,E?.map(e=>(0,d.jsxs)(`option`,{value:e.id,disabled:e.unavailable,children:[e.name?`${e.name} · ${e.id}`:e.id,e.unavailable?` — ${t(`passport.presetUnavailable`)}`:``]},e.id))]}),(0,d.jsx)(`small`,{id:`${s}-preset-hint`,children:t(`passport.agentPresetHint`)})]}),(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,disabled:re,onClick:()=>P(e=>e+1),children:t(`passport.reloadPresets`)}),(0,d.jsx)(`p`,{role:`status`,className:`xmimo-qq-hint`,children:k?t(`passport.presetsFailed`):E?ue?ee===`renewed`?t(`passport.sessionRenewed`):``:t(`passport.presetUnavailable`):t(`passport.presetsLoading`)})]}),(0,d.jsxs)(`details`,{className:`xmimo-passport-advanced`,children:[(0,d.jsx)(`summary`,{children:t(`passport.advanced`)}),ua.map(e=>(0,d.jsxs)(`section`,{"aria-labelledby":`${s}-${e.id}`,children:[(0,d.jsx)(`h4`,{id:`${s}-${e.id}`,children:t(`passport.${e.id}`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.${e.id}Hint`)}),(0,d.jsx)(`div`,{className:`xmimo-qq-grid`,children:e.fields.map(e=>{let n=e in la,r=n?la[e]:void 0,i=`${s}-${e}`;return(0,d.jsxs)(`label`,{className:`xmimo-qq-field`,htmlFor:i,children:[(0,d.jsx)(`span`,{children:t(`passport.${e}`)}),(0,d.jsx)(`input`,{id:i,name:e,type:n?`number`:e===`accessToken`?`password`:`text`,autoComplete:`off`,spellCheck:!1,disabled:re,required:e===`host`||e===`accessToken`&&!F,min:r?.min,max:r?.max,step:r?.step,minLength:e===`accessToken`?4:void 0,maxLength:e===`accessToken`?192:void 0,placeholder:e===`accessToken`&&F?t(`passport.tokenSaved`):void 0,"aria-describedby":`${i}-hint`,"aria-invalid":se&&le===e?!0:void 0,value:typeof U[e]==`number`&&Number.isNaN(U[e])?``:U[e],onChange:t=>edit(e,n?t.currentTarget.valueAsNumber:t.currentTarget.value)}),(0,d.jsx)(`small`,{id:`${i}-hint`,children:t(`passport.${e}Hint`)})]},e)})}),e.id===`connection`&&[`127.0.0.1`,`localhost`,`::1`,`[::1]`].includes(U.host)?(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,role:`note`,children:t(`passport.loopback`)}):null]},e.id))]}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.savedHint`)}),(0,d.jsx)(`div`,{className:`xmimo-tts-card-footer xmimo-qq-footer`,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-card-actions`,children:[(0,d.jsx)(`span`,{role:`status`,children:c.writable?ce?t(`whale.conflict`):se&&le?`${t(`passport.error`)}${t(`passport.${le}`)}`:ee===`failed`?t(`settings.failed`):ee===`saved`&&!se?t(`settings.saved`):``:t(`settings.readOnly`)}),(0,d.jsxs)(`div`,{className:`xmimo-tts-card-action-buttons`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:!I||ee===`saving`,onClick:()=>{V(null),H(`idle`)},children:t(`settings.discard`)}),(0,d.jsx)(u.Button,{type:`submit`,variant:`primary`,size:`sm`,disabled:re||!se||ce||le!==null,children:t(ee===`saving`?`settings.saving`:`settings.save`)})]})]})})]}):(0,d.jsx)(`p`,{role:`status`,children:t(c.status===`loading`?`passport.loading`:`passport.unavailable`)})}function registerPassportSettings(e,t,n){return e.slots.register({name:`plugins.row.config`,key:`dsh-xiaomi-tts#speech-delivery-passport`,locale:hi,inject:()=>({scope:e.configForms.get(`speech-delivery-passport`),t,changes:n})},PassportSettingsPage)}function AiFillSetting(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 1024 1024`},child:[{tag:`path`,attr:{d:`M512.5 390.6c-29.9 0-57.9 11.6-79.1 32.8-21.1 21.2-32.8 49.2-32.8 79.1 0 29.9 11.7 57.9 32.8 79.1 21.2 21.1 49.2 32.8 79.1 32.8 29.9 0 57.9-11.7 79.1-32.8 21.1-21.2 32.8-49.2 32.8-79.1 0-29.9-11.7-57.9-32.8-79.1a110.96 110.96 0 0 0-79.1-32.8zm412.3 235.5l-65.4-55.9c3.1-19 4.7-38.4 4.7-57.7s-1.6-38.8-4.7-57.7l65.4-55.9a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a442.5 442.5 0 0 0-79.6-137.7l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.2 28.9c-30-24.6-63.4-44-99.6-57.5l-15.7-84.9a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52-9.4-106.8-9.4-158.8 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.3a353.44 353.44 0 0 0-98.9 57.3l-81.8-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a445.93 445.93 0 0 0-79.6 137.7l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.2 56.5c-3.1 18.8-4.6 38-4.6 57 0 19.2 1.5 38.4 4.6 57l-66 56.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.3 44.8 96.8 79.6 137.7l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.8-29.1c29.8 24.5 63 43.9 98.9 57.3l15.8 85.3a32.05 32.05 0 0 0 25.8 25.7l2.7.5a448.27 448.27 0 0 0 158.8 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-84.9c36.2-13.6 69.6-32.9 99.6-57.5l81.2 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.5-87.4 79.6-137.7l.9-2.6c4.3-12.4.6-26.3-9.5-35zm-412.3 52.2c-97.1 0-175.8-78.7-175.8-175.8s78.7-175.8 175.8-175.8 175.8 78.7 175.8 175.8-78.7 175.8-175.8 175.8z`},child:[]}]})(e)}function AiFillGithub(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 1024 1024`},child:[{tag:`path`,attr:{d:`M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z`},child:[]}]})(e)}function AiOutlineQq(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 1024 1024`},child:[{tag:`path`,attr:{d:`M824.8 613.2c-16-51.4-34.4-94.6-62.7-165.3C766.5 262.2 689.3 112 511.5 112 331.7 112 256.2 265.2 261 447.9c-28.4 70.8-46.7 113.7-62.7 165.3-34 109.5-23 154.8-14.6 155.8 18 2.2 70.1-82.4 70.1-82.4 0 49 25.2 112.9 79.8 159-26.4 8.1-85.7 29.9-71.6 53.8 11.4 19.3 196.2 12.3 249.5 6.3 53.3 6 238.1 13 249.5-6.3 14.1-23.8-45.3-45.7-71.6-53.8 54.6-46.2 79.8-110.1 79.8-159 0 0 52.1 84.6 70.1 82.4 8.5-1.1 19.5-46.4-14.5-155.8z`},child:[]}]})(e)}function isTtsBundle({subject:e}){return e.kind===`bundle`&&e.pkg.name===`dsh-xiaomi-tts`}function PluginDetailActions(e){if(!isTtsBundle(e))return null;let t=e.t(`detail.star`),n=e.t(`detail.manual`);return(0,d.jsxs)(`div`,{className:`xmimo-ui-scope xmimo-tts-detail-actions`,children:[(0,d.jsxs)(u.Button,{variant:`outline`,size:`sm`,className:`xmimo-tts-star`,"aria-label":t,title:t,onClick:()=>window.open(Gi,`_blank`,`noopener,noreferrer`),children:[(0,d.jsx)(AiFillGithub,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{className:`xmimo-tts-detail-action-label`,children:t})]}),(0,d.jsxs)(u.Button,{variant:`outline`,size:`sm`,"aria-label":n,title:n,onClick:()=>window.open(Ki,`_blank`,`noopener,noreferrer`),children:[(0,d.jsx)(LuBookOpen,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{className:`xmimo-tts-detail-action-label`,children:n})]}),e.scope?(0,d.jsx)(WorkbenchAction,{scope:e.scope,t:e.t,onOpen:e.onOpenWorkbench}):null]})}function WorkbenchAction({scope:e,t,onOpen:n}){let r=useSettingsSnapshot(e);return r.status!==`ready`||!resolveTtsSettings(r.value).showInSidebar||!n?null:(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:n,children:[(0,d.jsx)(LuAudioLines,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{children:t(`detail.workshop`)})]})}let da={loading:`detail.keyLoading`,missing:`detail.keyMissing`,recognized:`detail.keyRecognized`,unrecognized:`detail.keyUnrecognized`,unavailable:`detail.keyUnavailable`};function PluginDetailBadge(e){return e.subject.kind===`row`&&e.subject.pkg.name===`dsh-xiaomi-tts`&&[`dsh-xiaomi-tts/qqbot`,`dsh-xiaomi-tts/passport`].includes(e.subject.row.moduleName)?(0,d.jsx)(u.Tag,{tone:`info`,className:`xmimo-tts-experimental-tag`,children:e.t(`settings.experimental`)}):isTtsBundle(e)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(KeyBadge,{scope:e.scope,t:e.t,changes:e.changes}),(0,d.jsx)(ExperimentalComponentListBadge,{label:e.t(`settings.experimental`)})]}):null}function ExperimentalComponentListBadge({label:e}){return(0,d.jsx)(`style`,{children:`[data-plugin-detail="dsh-xiaomi-tts"] { --xmimo-experimental-label: ${JSON.stringify(e)}; }`})}function KeyBadge({scope:e,t,changes:n=na}){let r=useSettingsSnapshot(e),i=(0,l.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),{provider:a}=resolveTtsSettings(r.value),o=useApiKeyStatus(r.status===`ready`&&!i,a),s=externalEngine(),c=i?`plugin.changing`:s?o===`unavailable`?`settings.externalDisconnected`:s.ready?`settings.externalManaged`:`settings.externalNotReady`:r.status===`unavailable`?`detail.keyUnavailable`:da[o];return(0,d.jsxs)(`span`,{className:`xmimo-ui-scope xmimo-tts-detail-status`,children:[(0,d.jsxs)(`span`,{role:`status`,children:[s?.name??t(providerLabelKey(a)),` · `,t(c)]}),!i&&r.status===`ready`&&o===`unavailable`?(0,d.jsx)(u.Button,{type:`button`,variant:`toolbar`,size:`sm`,onClick:ti.invalidate,children:t(`detail.retry`)}):null]})}let fa=[`onboarding.featureExternalSpeech`,`onboarding.featureExternalVoices`,`onboarding.featureExternalSwitch`],pa=[-116,-90,-60,-28,28,60,90,116].map((e,t)=>({"--confetti-x":`${e}px`,"--confetti-y":`${-58-t%3*24}px`,"--confetti-turn":`${e*2}deg`}));function ActivationGuide({t:e,onOpenWorkbench:t,onDismiss:n,changes:r=na}){let[i,a]=(0,l.useState)(!1),o=(0,l.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot),openWorkbench=()=>{n(),t()},dismiss=()=>{n()};return(0,d.jsxs)(u.Modal,{open:!0,title:e(`onboarding.title`),headless:!0,onClose:dismiss,className:`xmimo-ui-scope xmimo-tts-activation-dialog`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,"data-modal-autofocus":!0,className:`xmimo-tts-activation-close`,"aria-label":e(`onboarding.dismiss`),onClick:dismiss,children:(0,d.jsx)(u.IconCloseOutlineRegular,{size:16})}),(0,d.jsxs)(`div`,{className:`xmimo-tts-activation-layout`,children:[(0,d.jsxs)(`a`,{className:`xmimo-tts-activation-art`,href:Gi,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e(`settings.source`),title:e(`settings.source`),"data-ready":i,children:[(0,d.jsx)(`img`,{src:hostRoute(`/plugins/xiaomi-mimo-tts/update-celebration-whale.webp`),alt:``,width:176,height:176,onLoad:()=>a(!0)}),(0,d.jsx)(`div`,{className:`xmimo-tts-activation-confetti`,"aria-hidden":`true`,children:pa.map((e,t)=>(0,d.jsx)(`i`,{style:e},t))})]}),(0,d.jsxs)(`header`,{className:`xmimo-tts-activation-heading`,children:[(0,d.jsxs)(`h2`,{children:[e(`onboarding.title`),` `,(0,d.jsxs)(`span`,{children:[`v`,`5.2.0`]})]}),(0,d.jsx)(`p`,{children:e(`onboarding.summary`)})]}),(0,d.jsx)(`div`,{className:`xmimo-tts-activation-features`,role:`region`,"aria-label":e(`onboarding.details`),tabIndex:0,children:(0,d.jsx)(`ul`,{children:fa.map(t=>(0,d.jsxs)(`li`,{children:[(0,d.jsx)(LuCheck,{size:14,"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:e(t)})]},t))})}),(0,d.jsxs)(`div`,{className:`xmimo-tts-activation-footer`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-activation-actions`,children:[(0,d.jsxs)(u.Button,{type:`button`,variant:`primary`,onClick:()=>window.open(Gi,`_blank`,`noopener,noreferrer`),children:[(0,d.jsx)(LuStar,{size:16,"aria-hidden":`true`}),e(`onboarding.github`)]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,className:`xmimo-tts-activation-workbench`,onClick:openWorkbench,disabled:o,children:[(0,d.jsx)(LuAudioLines,{size:16,"aria-hidden":`true`}),e(`onboarding.configure`)]}),(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,onClick:dismiss,children:e(`onboarding.dismiss`)})]}),o?(0,d.jsx)(`div`,{className:`xmimo-tts-activation-feedback`,children:(0,d.jsx)(`p`,{role:`status`,children:e(`plugin.changing`)})}):void 0]})]})]})}let ma=`[data-voice-activity]`;var VoiceInputActivity=class{blocked=!1;observer=null;listeners=new Set;constructor(e){this.document=e}getSnapshot=()=>this.blocked;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});configure(e){if(!e){this.dispose();return}this.observer===null&&(this.observer=new MutationObserver(e=>{e.some(e=>e.type===`attributes`||[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].some(e=>{if(e.nodeType!==1)return!1;let t=e;return t.matches(ma)||t.querySelector(ma)!==null}))&&this.refresh()}),this.observer.observe(this.document,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-voice-activity`]}),this.refresh())}dispose(){this.observer?.disconnect(),this.observer=null,this.publish(!1)}refresh=()=>{this.observer!==null&&this.publish(this.document.querySelector(`[data-voice-activity="requesting"], [data-voice-activity="recording"], [data-voice-activity="transcribing"]`)!==null)};publish(e){if(this.blocked!==e){this.blocked=e;for(let e of this.listeners)e()}}},ComposerInputActivity=class{blocked=!1;enabled=!1;editor=null;observer=null;listeners=new Set;constructor(e){this.document=e}getSnapshot=()=>this.blocked;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});configure(e){if(!e){this.dispose();return}this.enabled||(this.enabled=!0,this.document.addEventListener(`focusin`,this.onFocus),this.document.addEventListener(`focusout`,this.onFocus),this.document.addEventListener(`input`,this.refresh),this.document.defaultView?.addEventListener(`focus`,this.refresh),this.document.defaultView?.addEventListener(`blur`,this.refresh),this.observer=new MutationObserver(e=>{let t=this.editor;t&&(!t.isConnected||e.some(e=>t.contains(e.target)))&&this.refresh()}),this.observer.observe(this.document,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`contenteditable`,`aria-disabled`]}),this.refresh())}dispose(){this.enabled=!1,this.observer?.disconnect(),this.observer=null,this.document.removeEventListener(`focusin`,this.onFocus),this.document.removeEventListener(`focusout`,this.onFocus),this.document.removeEventListener(`input`,this.refresh),this.document.defaultView?.removeEventListener(`focus`,this.refresh),this.document.defaultView?.removeEventListener(`blur`,this.refresh),this.editor=null,this.publish(!1)}onFocus=()=>{queueMicrotask(this.refresh)};refresh=()=>{this.enabled&&(this.editor=this.document.activeElement?.closest(`[data-composer-input]`)??null,this.publish(this.document.hasFocus()&&this.editor!==null&&this.editor.isConnected&&this.editor.getAttribute(`contenteditable`)!==`false`&&this.editor.getAttribute(`aria-disabled`)!==`true`&&(this.editor.textContent??``).trim().length>0))};publish(e){if(this.blocked!==e){this.blocked=e;for(let e of this.listeners)e()}}};function VoiceReadingNavIcon({size:e}){return(0,d.jsx)(RiVoiceAiFill,{size:e,"aria-hidden":`true`,focusable:`false`})}function registerVoiceReadingNavIcon(e){return e.slots.register({name:`settings.section.icon`,id:`voice-reading`},VoiceReadingNavIcon)}function observeHostSettingsEntry(e,t){let n,update=()=>{let r=e.getSnapshot(),i=r.status===`ready`&&resolveTtsSettings(r.value).showInHostSettings;i&&n===void 0&&(n=t()),i||(n?.(),n=void 0)},r=e.subscribe(update);try{update()}catch(e){throw r(),e}let i=!1;return()=>{i||(i=!0,r(),n?.(),n=void 0)}}function VoiceReadingHeaderActions({t:e,openPluginSettings:t}){return(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-actions`,children:[(0,d.jsx)(u.Tooltip,{label:e(`settings.voiceReadingSource`),side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`a`,{className:`xmimo-voice-reading-action`,href:Gi,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e(`settings.voiceReadingSource`),children:(0,d.jsx)(AiFillGithub,{size:16,"aria-hidden":`true`,focusable:`false`})})}),(0,d.jsx)(QqGroupAction,{t:e}),(0,d.jsx)(u.Tooltip,{label:e(`settings.voiceReadingPluginSettings`),side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`button`,{type:`button`,className:`xmimo-voice-reading-action`,"aria-label":e(`settings.voiceReadingPluginSettings`),onClick:t,children:(0,d.jsx)(AiFillSetting,{size:16,"aria-hidden":`true`,focusable:`false`})})})]})}function QqGroupAction({t:e}){let[t,n]=(0,l.useState)(!1),r=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(null),o=(0,l.useId)(),close=()=>{n(!1)};(0,l.useEffect)(()=>{if(!t)return;a.current?.focus({preventScroll:!0});let onPointerDown=e=>{r.current?.contains(e.target)||close()},onKeyDown=e=>{e.key===`Escape`&&(e.stopPropagation(),close(),i.current?.focus({preventScroll:!0}))};return document.addEventListener(`pointerdown`,onPointerDown,!0),document.addEventListener(`keydown`,onKeyDown,!0),()=>{document.removeEventListener(`pointerdown`,onPointerDown,!0),document.removeEventListener(`keydown`,onKeyDown,!0)}},[t]);let s=e(`settings.voiceReadingQq`);return(0,d.jsxs)(`span`,{className:`xmimo-voice-reading-qq`,ref:r,children:[(0,d.jsx)(u.Tooltip,{label:s,side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`button`,{ref:i,type:`button`,className:`xmimo-voice-reading-action`,"aria-label":s,"aria-haspopup":`dialog`,"aria-expanded":t,"aria-controls":t?o:void 0,onClick:()=>{n(e=>!e)},children:(0,d.jsx)(AiOutlineQq,{size:16,"aria-hidden":`true`,focusable:`false`})})}),t?(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-qq-panel`,id:o,role:`dialog`,"aria-label":s,children:[(0,d.jsx)(`button`,{ref:a,type:`button`,className:`xmimo-voice-reading-qq-close`,"aria-label":e(`settings.voiceReadingQqClose`),onClick:()=>{close(),i.current?.focus({preventScroll:!0})},children:(0,d.jsx)(u.IconCloseOutlineRegular,{"aria-hidden":`true`})}),(0,d.jsx)(`img`,{className:`xmimo-voice-reading-qq-code`,src:hostRoute(`/plugins/xiaomi-mimo-tts/qq-group.webp`),width:190,height:190,alt:e(`settings.voiceReadingQqCodeAlt`)}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-qq-meta`,children:[(0,d.jsx)(`span`,{className:`xmimo-voice-reading-qq-group`,children:s}),(0,d.jsx)(`code`,{className:`xmimo-voice-reading-qq-number`,children:`1104616387`})]})]}):null]})}function VoiceSettingsPage(e){return(0,d.jsx)(`section`,{className:`xmimo-ui-scope xmimo-tts-settings-page`,"aria-label":e.t(`settings.voiceSettingsNav`),children:(0,d.jsxs)(`div`,{className:`xmimo-tts-settings-page-content`,children:[(0,d.jsxs)(`header`,{className:`xmimo-tts-settings-page-header`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-settings-page-identity`,children:[(0,d.jsx)(`div`,{className:`xmimo-tts-settings-page-icon`,children:(0,d.jsx)(`img`,{src:hostRoute(x),width:56,height:56,alt:``})}),(0,d.jsxs)(`div`,{className:`xmimo-tts-settings-page-heading`,children:[(0,d.jsxs)(`h1`,{children:[(0,d.jsx)(`span`,{className:`xmimo-tts-settings-page-title`,children:e.t(`settings.voiceSettingsNav`)}),(0,d.jsxs)(`span`,{className:`xmimo-tts-settings-page-wave`,"aria-hidden":`true`,children:[(0,d.jsx)(`span`,{}),(0,d.jsx)(`span`,{}),(0,d.jsx)(`span`,{}),(0,d.jsx)(`span`,{}),(0,d.jsx)(`span`,{})]})]}),(0,d.jsx)(`p`,{children:e.t(`settings.voiceSettingsDescription`)})]})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-actions xmimo-tts-settings-page-actions`,children:[(0,d.jsx)(u.Tooltip,{label:e.t(`settings.pluginDetails`),side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`button`,{type:`button`,className:`xmimo-voice-reading-action`,"aria-label":e.t(`settings.pluginDetails`),onClick:e.onOpenPluginSettings,children:(0,d.jsx)(LuSettings,{size:16,"aria-hidden":`true`})})}),(0,d.jsx)(u.Tooltip,{label:e.t(`detail.manual`),side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`a`,{className:`xmimo-voice-reading-action`,href:Ki,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e.t(`detail.manual`),children:(0,d.jsx)(LuBookOpen,{size:16,"aria-hidden":`true`})})}),(0,d.jsx)(QqGroupAction,{t:e.t}),(0,d.jsx)(u.Tooltip,{label:e.t(`settings.voiceReadingSource`),side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`a`,{className:`xmimo-voice-reading-action`,href:Gi,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e.t(`settings.voiceReadingSource`),children:(0,d.jsx)(AiFillGithub,{size:16,"aria-hidden":`true`,focusable:`false`})})})]})]}),(0,d.jsx)(SettingsCard,{...e,view:`page`,initialPanel:`mixer`})]})})}let ha=`xiaomi-mimo-tts.settings`;function openVoiceWorkbench(e,t){let n=t.getSnapshot();n.status===`ready`&&resolveTtsSettings(n.value).showInSidebar?e.layout.selectPanel(ha):e.pluginNavigation.openBundle(`dsh-xiaomi-tts`)}function VoiceSettingsSidebarIcon({size:e}){return(0,d.jsx)(RiVoiceAiFill,{size:e,"aria-hidden":`true`,focusable:`false`})}function registerVoiceSettingsSidebar(e,t){let{scope:n,t:r}=t,i={...t,onOpenPluginSettings:()=>e.pluginNavigation.openBundle(`dsh-xiaomi-tts`),onSidebarChange:t=>{t||e.pluginNavigation.openBundle(`dsh-xiaomi-tts`)}},a=e.slots.register({name:`main`,key:ha,inject:()=>i},VoiceSettingsPage),o,update=()=>{let t=n.getSnapshot(),i=t.status===`ready`&&resolveTtsSettings(t.value).showInSidebar;i&&!o&&(o=e.slots.register({name:`sidebar.panellist`,id:ha,order:-10,label:()=>r(`settings.voiceSettingsNav`),locale:hi},VoiceSettingsSidebarIcon)),i||(o?.(),o=void 0)},s=n.subscribe(update);try{update()}catch(e){throw s(),a(),e}let c=!1;return()=>{c||(c=!0,s(),o?.(),o=void 0,a())}}function voiceReadingWarningKey(e,t){return e.enabled?t===`missing`?`settings.voiceReadingWarningApiKeyMissing`:t===`unrecognized`?`settings.voiceReadingWarningApiKeyInvalid`:t===`unavailable`?`settings.voiceReadingWarningApiKeyUnavailable`:ttsSelection(e).voice.trim()?null:`settings.voiceReadingWarningVoiceRequired`:`settings.voiceReadingWarningDisabled`}function voiceChoices(e,t,n,r){let i=n[r],a=new Map(e.map(e=>[e.value,e]));for(let e of[t,...i?.history??[]])e.trim()&&!a.has(e)&&a.set(e,{value:e,label:e});return[...a.values()].map(e=>{let t=i?.names&&Object.hasOwn(i.names,e.value)?i.names[e.value]?.trim():``;return t?{value:e.value,label:t}:e})}function buildVoiceReadingVoiceSource(e,t=[],n={}){return e.provider===`breeze`?{field:`breezeVoice`,value:e.breezeVoice,choices:voiceChoices(se.map(e=>({value:e.value,label:e.name})),e.breezeVoice,n,`breeze`),hintKey:`settings.voiceReadingHintBreeze`}:e.provider===`doubao`?e.doubaoModel===`seed-icl-2.0`?{field:`doubaoClonedVoice`,value:e.doubaoClonedVoice,choices:voiceChoices([],e.doubaoClonedVoice,{cloned:{history:t,names:{},...n.cloned}},`cloned`),hintKey:`settings.voiceReadingHintDoubaoCloned`}:{field:`doubaoVoice`,value:e.doubaoVoice,choices:voiceChoices(Re.map(e=>({value:e.value,label:e.name,detail:e.scene})),e.doubaoVoice,n,`standard`),hintKey:`settings.voiceReadingHintDoubaoStandard`}:e.model===`mimo-v2.5-tts-voicedesign`?{field:`voiceDesignPrompt`,value:e.voiceDesignPrompt,choices:M.map(e=>({value:e.prompt,label:e.label,detail:e.summary})),hintKey:`settings.voiceReadingHintVoiceDesign`}:{field:`voice`,value:e.voice,choices:E.map(e=>({value:e.value,label:e.value,detail:e.summary})),hintKey:`settings.voiceReadingHintXiaomi`}}function voiceChoiceWriteOps(e,t){let n=[{op:`set`,path:[e.field],value:t}];return e.field===`voiceDesignPrompt`&&n.push({op:`set`,path:[`voiceDesignCustomPrompt`],value:t}),n}function autoPlayWriteOps(e,t){if(!e)return[{op:`set`,path:[`autoPlay`],value:!1}];let n=[];return t.enabled||n.push({op:`set`,path:[`enabled`],value:!0}),n.push({op:`set`,path:[`autoPlay`],value:!0}),n}let ga={smart:`settings.readScopeSmart`,full:`settings.readScopeFull`,"first-segment":`settings.readScopeFirstSegment`},_a={smart:`settings.readScopeSmartHint`,full:`settings.readScopeFullHint`,"first-segment":`settings.readScopeFirstSegmentHint`};function readScopeLabelKey(e){return ga[e]}function readScopeHintKey(e){return _a[e]}function readScopeWriteOps(e){return[{op:`set`,path:[`readScope`],value:e}]}let va=[0,.2,.4,.6,.8,1],ya=[.5,.8,1,1.2,1.5,1.8];function formatVoiceVolume(e){return`${Math.round(e*100)}%`}function formatVoiceRate(e){return`${e.toFixed(1)}×`}function volumeWriteOps(e){return[{op:`set`,path:[`voiceVolume`],value:e}]}function rateWriteOps(e){return[{op:`set`,path:[`voiceRate`],value:e}]}function soundWriteOps(e,t){if(!e)return[{op:`set`,path:[`soundEnabled`],value:!1}];let n=[{op:`set`,path:[`soundEnabled`],value:!0}];return!t.taskSounds&&!t.clickSounds&&n.push({op:`set`,path:[`taskSounds`],value:!0},{op:`set`,path:[`clickSounds`],value:!0}),n}function VoiceReadingWarning({settings:e,t,openPluginSettings:n,active:r=!0}){let{provider:i}=e,a=useApiKeyStatus(r,i),o=externalEngine(),s=o?a===`unavailable`?`settings.externalDisconnected`:o.ready?null:`settings.externalNotReady`:voiceReadingWarningKey(e,a);return s===null?null:(0,d.jsx)(WarningBar,{message:t(s),dismissLabel:t(`settings.voiceReadingDismissWarning`),settingsLabel:t(`settings.voiceReadingPluginSettings`),openPluginSettings:n},`${i}:${s}`)}function WarningBar({message:e,dismissLabel:t,settingsLabel:n,openPluginSettings:r}){let[i,a]=(0,l.useState)(!1);if(i)return null;let[o,s]=e.split(`{settings}`);return(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-warning`,role:`status`,children:[(0,d.jsxs)(`span`,{className:`xmimo-voice-reading-warning-message`,title:e.replace(`{settings}`,n),children:[o,s===void 0?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`button`,{type:`button`,className:`xmimo-voice-reading-link`,onClick:r,children:(0,d.jsx)(`span`,{className:`xmimo-voice-reading-link-label`,children:n})}),s]})]}),(0,d.jsx)(`button`,{type:`button`,className:`xmimo-voice-reading-warning-close`,"aria-label":t,title:t,onClick:()=>{a(!0)},children:(0,d.jsx)(u.IconCloseOutlineRegular,{"aria-hidden":`true`})})]})}let ba={xiaomi:`Xiaomi-MiMo`,doubao:`Doubao-Seed`,breeze:`Breeze Blue`};function VoiceReadingProvider({value:e,doubaoEnabled:t,breezeEnabled:n,disabled:r,t:i,onChange:a}){useEngineState();let o=externalEngine(),s=(0,l.useId)(),c=availableTtsProviders(t,n);return(0,d.jsxs)(`fieldset`,{className:`xmimo-voice-reading-provider`,disabled:r||o!==null,children:[(0,d.jsx)(`legend`,{className:`xmimo-voice-reading-row-title`,children:o?.name??i(`settings.provider`)}),(0,d.jsx)(`div`,{className:c.length===3?`xmimo-voice-reading-provider-options xmimo-voice-reading-provider-options-three`:`xmimo-voice-reading-provider-options`,children:c.map(t=>(0,d.jsxs)(`label`,{className:`xmimo-voice-reading-provider-option`,children:[(0,d.jsx)(`input`,{type:`radio`,name:s,value:t,checked:e===t,onChange:()=>{a(t)}}),(0,d.jsxs)(`span`,{className:`xmimo-voice-reading-provider-face`,children:[(0,d.jsx)(`img`,{src:hostRoute(b[t]),width:32,height:32,alt:``}),(0,d.jsx)(`span`,{children:n?{xiaomi:`Xiaomi`,doubao:`Doubao`,breeze:`Breeze`}[t]:ba[t]})]})]},t))})]})}function VoiceReadingSection(e){let{scope:t,t:n,openPluginSettings:r}=e;return t===void 0||n===void 0||r===void 0?null:(0,d.jsx)(VoiceReadingPage,{scope:t,t:n,changes:e.changes,openPluginSettings:()=>{e.close(),r()}})}function VoiceReadingPage({scope:e,t,openPluginSettings:n,changes:r=na}){useEngineState();let i=externalEngine(),a=useExternalSelection(i),o=i?.models?.find(e=>e.id===a.value?.model),s=(0,l.useSyncExternalStore)(subscribeMinimalMode,readMinimalMode,()=>!1),c=useSettingsSnapshot(e),p=(0,l.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot),m=(0,l.useMemo)(()=>Object.fromEntries([`standard`,`cloned`,`breeze`].map(e=>[e,{history:readVoiceIdHistory(e),names:readVoiceIdNames(e)}])),[(0,l.useSyncExternalStore)(subscribeVoiceIds,voiceIdRevision,()=>0)]),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(!1),b=(0,l.useMemo)(()=>resolveTtsSettings(c.value),[c.value]),S=(0,l.useMemo)(()=>buildVoiceReadingVoiceSource(b,[],m),[b,m]),write=t=>{r.getSnapshot()||!c.writable||t.length===0||(g(!0),v(!1),e.mutate(t).then(e=>{e||v(!0)}).catch(()=>{v(!0)}).finally(()=>{g(!1)}))};if(c.status===`unavailable`)return(0,d.jsx)(`p`,{className:`xmimo-voice-reading-notice`,role:`status`,children:t(`settings.voiceReadingUnavailable`)});let C=c.status===`ready`,w=p||!C||!c.writable||h,E=[...S.choices.some(e=>e.value===S.value)?[]:[{id:S.value,label:t(`settings.voiceReadingCustomVoice`)}],...S.choices.map(e=>({id:e.value,label:e.detail?`${e.label} · ${e.detail}`:e.label}))],D=P.map(e=>({id:e,label:t(readScopeLabelKey(e))}));return(0,d.jsxs)(`div`,{className:`xmimo-voice-reading`,style:s?void 0:{"--xmimo-voice-reading-background":`url(${hostRoute(x)})`},children:[(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-header`,children:[(0,d.jsx)(`h2`,{className:`xmimo-voice-reading-title`,children:t(`settings.voiceReadingTitle`)}),(0,d.jsx)(VoiceReadingHeaderActions,{t,openPluginSettings:n})]}),p?(0,d.jsx)(`p`,{role:`status`,children:t(`plugin.changing`)}):null,(0,d.jsx)(VoiceReadingProvider,{value:b.provider,doubaoEnabled:b.doubaoEnabled,breezeEnabled:b.breezeEnabled,disabled:w,t,onChange:e=>{write([{op:`set`,path:[`provider`],value:e}])}}),C?(0,d.jsx)(VoiceReadingWarning,{active:!p,settings:b,t,openPluginSettings:n}):null,C&&!c.writable&&(0,d.jsx)(`p`,{className:`xmimo-voice-reading-notice`,role:`status`,children:t(`settings.voiceReadingReadOnly`)}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-card`,children:[i?(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-copy`,children:(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.model`)})}),(0,d.jsx)(VoiceReadingSelect,{label:t(`settings.model`),value:a.value?.model??i.modelName??``,options:(i.models??[]).map(e=>({id:e.id,label:e.name})),disabled:w||!i.configurable,onSelect:e=>{let t=i.models.find(t=>t.id===e);a.change({model:e,voice:t.voices.some(e=>e.id===a.value?.voice)?a.value.voice:t.voices[0]?.id??``,speechInstruction:``})}})]}):null,(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-copy`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.voiceReadingVoice`)}),(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-hint`,children:t(i?`settings.externalManaged`:S.hintKey)})]}),(0,d.jsx)(VoiceReadingSelect,{label:t(`settings.voiceReadingVoice`),value:i?a.value?.voice??i.voiceName??``:S.value,options:i?(o?.voices??[]).map(e=>({id:e.id,label:e.name})):E,disabled:w||i!==null&&!i.configurable,onSelect:e=>{i&&a.value?a.change({...a.value,voice:e}):write(voiceChoiceWriteOps(S,e))}})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-copy`,children:(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.voiceReadingVolume`)})}),(0,d.jsx)(VoiceReadingSelect,{label:t(`settings.voiceReadingVolume`),value:String(b.voiceVolume),fallbackLabel:formatVoiceVolume(b.voiceVolume),options:va.map(e=>({id:String(e),label:formatVoiceVolume(e)})),disabled:w,onSelect:e=>{write(volumeWriteOps(Number(e)))}})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-copy`,children:(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.voiceReadingRate`)})}),(0,d.jsx)(VoiceReadingSelect,{label:t(`settings.voiceReadingRate`),value:String(b.voiceRate),fallbackLabel:formatVoiceRate(b.voiceRate),options:ya.map(e=>({id:String(e),label:formatVoiceRate(e)})),disabled:w,onSelect:e=>{write(rateWriteOps(Number(e)))}})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-copy`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.readScope`)}),(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-hint`,children:t(readScopeHintKey(b.readScope))})]}),(0,d.jsx)(VoiceReadingSelect,{label:t(`settings.readScope`),value:b.readScope,options:D,disabled:w,onSelect:e=>{write(readScopeWriteOps(e))}})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-copy`,children:(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.voiceReadingAutoPlay`)})}),(0,d.jsx)(u.Switch,{checked:b.autoPlay,disabled:w,label:t(`settings.voiceReadingAutoPlay`),onChange:e=>{write(autoPlayWriteOps(e,b))}})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-copy`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.voiceReadingSound`)}),(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-hint`,children:t(`settings.voiceReadingSoundHint`)})]}),(0,d.jsx)(u.Switch,{checked:b.soundEnabled,disabled:w,label:t(`settings.voiceReadingSound`),onChange:e=>{write(soundWriteOps(e,b))}})]})]}),i?.configurable?(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:w||!a.dirty,onClick:a.discard,children:t(`settings.discard`)}),(0,d.jsx)(u.Button,{type:`button`,variant:`primary`,size:`sm`,disabled:w||!a.dirty,onClick:()=>{g(!0),v(!1),a.save().catch(()=>v(!0)).finally(()=>g(!1))},children:t(h?`settings.saving`:`settings.save`)})]}):null,_&&(0,d.jsx)(`p`,{className:`xmimo-voice-reading-failure`,role:`status`,children:t(`settings.voiceReadingSaveFailed`)})]})}var xa=[{name:`press`,label:`Press`,category:`input`,description:`A control is physically engaged.`,duration:.16,baseMidi:62,notes:[{at:0,semitone:3,length:.13,glide:-4}],noise:.14,transient:.5,defaultVolume:.2},{name:`select`,label:`Select`,category:`selection`,description:`An item enters the active set.`,duration:.28,baseMidi:70,notes:[{at:0,semitone:0,length:.12},{at:.09,semitone:7,length:.16}],defaultVolume:.2},{name:`toggle-on`,label:`Toggle on`,category:`selection`,description:`A binary setting becomes active.`,duration:.3,baseMidi:67,notes:[{at:0,semitone:-3,length:.065,glide:-1},{at:.065,semitone:9,length:.2}],transient:.3,defaultVolume:.2},{name:`toggle-off`,label:`Toggle off`,category:`selection`,description:`A binary setting becomes inactive.`,duration:.29,baseMidi:67,notes:[{at:0,semitone:9,length:.065},{at:.07,semitone:-3,length:.18,glide:-1}],transient:.28,defaultVolume:.18},{name:`check`,label:`Check`,category:`selection`,description:`A checkbox or task enters its completed state.`,duration:.29,baseMidi:71,notes:[{at:0,semitone:-5,length:.075},{at:.07,semitone:9,length:.17}],transient:.24,defaultVolume:.17},{name:`delete`,label:`Delete`,category:`editing`,description:`A destructive removal is committed.`,duration:.48,baseMidi:58,notes:[{at:0,semitone:6,length:.2,glide:-7},{at:.16,semitone:-2,length:.24,gain:.6}],noise:.18,transient:.5,defaultVolume:.22},{name:`open`,label:`Open`,category:`navigation`,description:`A menu, sheet, panel, or detail view appears.`,duration:.37,baseMidi:64,notes:[{at:0,semitone:-2,length:.28,glide:9},{at:.18,semitone:12,length:.11,gain:.3}],noise:.05,defaultVolume:.18},{name:`close`,label:`Close`,category:`navigation`,description:`A menu, sheet, panel, or detail view recedes.`,duration:.34,baseMidi:64,notes:[{at:0,semitone:12,length:.1,gain:.34},{at:.055,semitone:5,length:.24,glide:-8}],noise:.04,defaultVolume:.17},{name:`send`,label:`Send`,category:`communication`,description:`A message or object leaves the user.`,duration:.42,baseMidi:69,notes:[{at:0,semitone:-2,length:.28,glide:9},{at:.19,semitone:12,length:.16,gain:.6}],noise:.16,panFrom:-.2,panTo:.5,defaultVolume:.2},{name:`notification`,label:`Notification`,category:`communication`,description:`New information is available, without urgency.`,duration:.58,baseMidi:72,notes:[{at:0,semitone:0,length:.26},{at:.19,semitone:5,length:.3}],defaultVolume:.2},{name:`success`,label:`Success`,category:`feedback`,description:`An action finished with the expected result.`,duration:.72,baseMidi:67,notes:[{at:0,semitone:0,length:.3},{at:.16,semitone:4,length:.32},{at:.33,semitone:7,length:.33}],defaultVolume:.23},{name:`error`,label:`Error`,category:`feedback`,description:`An action failed and needs attention.`,duration:.62,baseMidi:62,notes:[{at:0,semitone:6,length:.28},{at:.22,semitone:0,length:.32,glide:-2}],noise:.1,defaultVolume:.22},{name:`start`,label:`Start`,category:`progress`,description:`A process, recording, or session begins.`,duration:.46,baseMidi:60,notes:[{at:0,semitone:-5,length:.12,gain:.48},{at:.1,semitone:0,length:.18},{at:.24,semitone:7,length:.18}],noise:.04,defaultVolume:.19},{name:`stop`,label:`Stop`,category:`progress`,description:`A process, recording, or session ends.`,duration:.4,baseMidi:60,notes:[{at:0,semitone:7,length:.11},{at:.1,semitone:2,length:.12},{at:.2,semitone:-5,length:.15,gain:.72}],noise:.06,defaultVolume:.19},{name:`complete`,label:`Complete`,category:`progress`,description:`A multi-step process reaches its final state.`,duration:.8,baseMidi:65,notes:[{at:0,semitone:0,length:.22},{at:.22,semitone:7,length:.25},{at:.46,semitone:12,length:.27}],defaultVolume:.24},{name:`queued`,label:`Queued`,category:`progress`,description:`Work is accepted and waiting to begin.`,duration:.36,baseMidi:64,notes:[{at:0,semitone:0,length:.14},{at:.13,semitone:2,length:.18,gain:.65}],noise:.04,defaultVolume:.14}],Sa=[{name:`minimal`,label:`Minimal`,description:`Dry, precise, almost invisible.`,bestFor:`Productivity, SaaS, system UI`,color:`#e84d2a`,waveform:`sine`,pitch:1,duration:.78,attack:.004,decay:2.3,noise:.05,transient:.15,brightness:.78,echo:0,bitDepth:16,harmonics:[[1,1],[2,.08]]},{name:`soft`,label:`Soft`,description:`Rounded felt, warm and reassuring.`,bestFor:`Mobile, wellness, friendly SaaS`,color:`#d47b83`,waveform:`triangle`,pitch:.9,duration:1.08,attack:.012,decay:1.65,noise:.08,transient:.08,brightness:.46,echo:.04,bitDepth:16,harmonics:[[1,1],[2,.14],[3,.04]]},{name:`glass`,label:`Glass`,description:`Bright, crystalline, and premium.`,bestFor:`Media, finance, luxury products`,color:`#4c8ca5`,waveform:`sine`,pitch:1.22,duration:1.22,attack:.003,decay:1.32,noise:.025,transient:.12,brightness:.95,echo:.09,bitDepth:16,harmonics:[[1,1],[2.72,.28],[4.19,.11],[6.8,.05]]},{name:`arcade`,label:`Arcade`,description:`Chunky pixels and cheerful voltage.`,bestFor:`Games, streaks, gamified learning`,color:`#7257d9`,waveform:`square`,pitch:1.08,duration:.86,attack:.002,decay:1.1,noise:.035,transient:.2,brightness:.72,echo:.025,bitDepth:8,harmonics:[[1,1],[2,.08]]},{name:`mechanical`,label:`Mechanical`,description:`Switches, relays, and firm detents.`,bestFor:`Devtools, hardware, industrial UI`,color:`#68736f`,waveform:`triangle`,pitch:.74,duration:.72,attack:.001,decay:2.8,noise:.24,transient:.72,brightness:.58,echo:.015,bitDepth:12,harmonics:[[1,1],[1.5,.13],[2.1,.08]]},{name:`organic`,label:`Organic`,description:`Wood, water, breath, and small stones.`,bestFor:`Education, kids, calm games`,color:`#718b4e`,waveform:`sine`,pitch:.94,duration:1.12,attack:.008,decay:1.85,noise:.18,transient:.28,brightness:.4,echo:.055,bitDepth:16,harmonics:[[1,1],[1.48,.18],[2.02,.09],[3.05,.035]]},{name:`dreamy`,label:`Dreamy`,description:`Airy blooms, soft light, and slow sparkle.`,bestFor:`Creative tools, wellness, ambient apps`,color:`#a36cad`,waveform:`sine`,pitch:1.05,duration:1.18,attack:.02,decay:1.42,noise:.045,transient:.045,brightness:.56,echo:.13,bitDepth:16,harmonics:[[1,1],[2,.12],[3.01,.07],[5.02,.025]]},{name:`scifi`,label:`Sci-fi`,description:`Clean holographic pings with a restrained digital shimmer.`,bestFor:`AI tools, spatial UI, futuristic games`,color:`#20a29d`,waveform:`sine`,pitch:1.1,duration:.84,attack:.0025,decay:2.05,noise:.025,transient:.16,brightness:.82,echo:.035,bitDepth:16,harmonics:[[1,1],[2.01,.11],[3.98,.025]],fmRatio:2.01,fmDepth:.42},{name:`rubber`,label:`Rubber`,description:`Tactile elastic taps with a quick, friendly rebound.`,bestFor:`Kids, playful mobile, casual games`,color:`#d99a24`,waveform:`triangle`,pitch:.86,duration:.88,attack:.0035,decay:2.2,noise:.018,transient:.22,brightness:.5,echo:.012,bitDepth:16,harmonics:[[1,1],[1.5,.075],[2.02,.04]],elasticity:1.15},{name:`cinematic`,label:`Cinematic`,description:`Deep impacts, polished tails, and quiet scale.`,bestFor:`Premium media, games, dramatic moments`,color:`#3f5873`,waveform:`sine`,pitch:.7,duration:1.28,attack:.008,decay:1.78,noise:.12,transient:.55,brightness:.38,echo:.11,bitDepth:16,harmonics:[[1,1],[.5,.22],[2,.1],[3,.035]]},{name:`studio`,label:`Studio`,description:`Tactile editing precision with warm cinematic restraint.`,bestFor:`Film, audio, and AI creative tools`,color:`#6261a8`,waveform:`triangle`,pitch:.86,duration:.82,attack:.004,decay:2.15,noise:.09,transient:.24,brightness:.48,echo:.025,bitDepth:16,harmonics:[[1,1],[2,.11],[3,.035]]},{name:`zen`,label:`Zen`,description:`Pure tones, dry wood, and brief washi detail.`,bestFor:`Mindfulness, reading, writing, calm productivity`,color:`#7d8f77`,waveform:`sine`,pitch:.94,duration:.82,attack:.003,decay:2.7,noise:0,transient:.025,brightness:.52,echo:0,bitDepth:16,harmonics:[[1,1],[2.01,.035]],paper:.12,brush:.065,wood:.16,chime:.09}];xa.map(e=>e.name);var Ca=Sa.map(e=>e.name);function J(e){let t=xa.find(t=>t.name===e);if(!t)throw Error(`Unknown UI SFX cue: ${e}`);return t}function ne(e){let t=Sa.find(t=>t.name===e);if(!t)throw Error(`Unknown UI SFX pack: ${e}`);return t}function ge(e){return 440*2**((e-69)/12)}var wa=new Set([`press`,`select`,`toggle-on`,`toggle-off`,`check`,`open`,`close`,`delete`]),Ta=new Set([`success`,`complete`]),Ea=new Set([...wa,`stop`]),Da=new Set([`press`,`delete`,`send`,`notification`,`success`,`error`,`start`,`stop`,`complete`]),Oa=new Set([`open`,`send`,`notification`,`success`,`complete`]),ka=new Set([`delete`,`send`,`success`,`error`,`start`,`stop`,`complete`]),Aa=new Set([`press`,`toggle-on`,`toggle-off`,`check`,`success`]),ja=new Set([`open`,`close`,`send`]),Ma=new Set([`send`]),Na=new Set([`press`,`select`,`toggle-on`,`toggle-off`,`check`,`delete`,`notification`,`success`,`error`]),Pa=new Set([`send`,`notification`,`success`,`error`,`complete`]),Fa=new Set([`press`,`select`,`toggle-on`,`toggle-off`,`check`]);function j(e,t){let n=2166136261^t;for(let t=0;t<e.length;t+=1)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0)/4294967295}function Xe(e){return{paper:ja.has(e)?.72+j(e,1)*.28:0,brush:Ma.has(e)?.68+j(e,2)*.32:0,wood:Na.has(e)?.7+j(e,3)*.3:0,chime:Pa.has(e)?.64+j(e,4)*.36:0}}function _e(e,t,n,r){let i=n.map(e=>({...e}));switch(e){case`soft`:return i.map((e,t)=>({...e,at:r?e.at:e.at*1.06+t*.006,length:e.length*1.13,semitone:e.semitone*.94}));case`glass`:{if(r||i.length===0||!Oa.has(t))return i;let e=i[i.length-1];return e?[...i,{...e,at:e.at+Math.min(.08,e.length*.28),semitone:e.semitone+12,length:e.length*.68,gain:(e.gain??1)*.18}]:i}case`arcade`:return i.map((e,t)=>({...e,at:r?e.at:Math.round(e.at/.04)*.04,length:Math.max(.06,Math.round(e.length/.04)*.04)*.82,semitone:Math.round(e.semitone)+(t%2==1?.25:0)}));case`mechanical`:return[...r||!Ea.has(t)?[]:[{at:0,semitone:-12,length:.055,glide:-3,gain:.28}],...i.map(e=>({...e,length:e.length*.62,gain:(e.gain??1)*.82}))];case`organic`:return i.flatMap((e,n)=>{let i={...e,at:r?e.at:e.at+n*.009,semitone:e.semitone+(n%2==0?-.16:.11)};return r||n!==0||!Da.has(t)?[i]:[i,{...e,at:e.at+.018,semitone:e.semitone-12.08,length:e.length*.52,gain:(e.gain??1)*.2}]});case`dreamy`:return i.flatMap((e,n)=>[{...e,at:r?e.at:e.at*1.08,length:e.length*1.18,gain:(e.gain??1)*.78},...r||!Oa.has(t)?[]:[{...e,at:e.at*1.08+.07+n*.012,semitone:e.semitone+12.02,length:e.length*.82,gain:(e.gain??1)*.13}]]);case`scifi`:return i.map((e,t)=>({...e,at:r?e.at:Math.round(e.at/.01)*.01,length:e.length*.72,semitone:e.semitone+(t%2==0?-.04:.16),glide:(e.glide??0)*.58+(e.glide===void 0?t%2==0?.45:-.25:0),gain:(e.gain??1)*(t===0?1:.9)}));case`rubber`:return i.map((e,t)=>({...e,at:r?e.at:e.at*.98+t*.004,length:e.length*.84,semitone:e.semitone+(t%2==0?-.18:.08),glide:(e.glide??0)*.52,gain:(e.gain??1)*(t===0?1:.88)}));case`cinematic`:return[...i.map(e=>({...e,length:e.length*1.16,gain:(e.gain??1)*.72})),...r||i.length===0||!ka.has(t)?[]:[{at:0,semitone:-24,length:Math.min(.38,Math.max(...i.map(e=>e.length))),glide:-2,gain:.28}]];case`studio`:{let e=i.map(e=>({...e,at:r?e.at:e.at*.92,length:e.length*.82,gain:(e.gain??1)*(r?.55:.8)}));if(r||e.length===0)return e;if(wa.has(t))return[{at:0,semitone:-12,length:.045,glide:-2,gain:.12},...e];if(Ta.has(t)){let t=e[e.length-1];return t?[...e,{...t,at:t.at+.055,semitone:t.semitone+12,length:t.length*.55,gain:(t.gain??1)*.1}]:e}return e}case`zen`:{let e=j(t,0),n=r?.68:Fa.has(t)?.46:.68;return i.map((i,a)=>({...i,at:r?i.at:i.at*(.9+e*.025)+a*.002,length:i.length*n*(.96+e*.05),semitone:i.semitone+(e-.5)*.22+(a%2==0?-.035:.025),glide:i.glide===void 0?void 0:i.glide*.28,gain:(i.gain??1)*(r?.32:Fa.has(t)?.48:.52)}))}default:return i}}function Z(e,t){let n=J(t),r=ne(e),i=n.loop?1:r.duration,a=_e(e,t,n.notes,n.loop??!1).map(e=>{let t=n.baseMidi+e.semitone+12*Math.log2(r.pitch),a=t+(e.glide??0);return{...e,at:e.at*i,length:e.length*i,frequency:ge(t),endFrequency:ge(a)}}),o=n.loop?n.duration:Math.max(n.duration*i,...a.map(e=>e.at+e.length+.02)),s=1.476-r.echo*1.6;if(!n.loop&&o>s){let e=(s-.02)/(o-.02);a=a.map(t=>({...t,at:t.at*e,length:t.length*e})),o=s}let c=r.noise,l=n.noise??0,u=Math.min(1,(n.transient??0)*(.7+r.transient*.3)+r.transient*.45)*(n.loop?.58:1),d=(r.fmDepth??0)*(n.loop?.58:n.category===`reward`?1.12:1),p=(r.elasticity??0)*(n.loop?.18:Aa.has(t)?1:.36),m=e===`zen`?Xe(t):void 0;return{cue:t,pack:e,duration:o,notes:a,waveform:r.waveform,harmonics:r.harmonics,attack:r.attack,decay:r.decay,noise:e===`zen`?0:Math.min(.42,l*(.55+c)+c*.025),transient:e===`zen`?Math.min(.12,u*.28):u,brightness:r.brightness,echo:t===`typing`?Math.min(r.echo,.004):r.echo,bitDepth:r.bitDepth,panFrom:n.panFrom??0,panTo:n.panTo??n.panFrom??0,loop:n.loop??!1,defaultVolume:n.defaultVolume,fmRatio:r.fmRatio??1,fmDepth:d,elasticity:p,paper:(r.paper??0)*(m?.paper??0),brush:(r.brush??0)*(m?.brush??0),wood:(r.wood??0)*(m?.wood??0),chime:(r.chime??0)*(m?.chime??0)}}function be(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function ye(e){let t=e;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function ae(e,t){if(t<=0||t>=.5)return 0;if(e<t){let n=e/t;return n+n-n*n-1}if(e>1-t){let n=(e-1)/t;return n*n+n+n+1}return 0}function Be(e,t,n){let r=e/(Math.PI*2),i=r-Math.floor(r);switch(t){case`square`:return(i<.5?1:-1)+ae(i,n)-ae((i+.5)%1,n);case`saw`:return 2*i-1-ae(i,n);case`triangle`:return 2*Math.abs(2*(r-Math.floor(r+.5)))-1;default:return Math.sin(e)}}function ve(e,t,n,r){if(e<0||e>t)return 0;if(e<n)return e/Math.max(n,1e-4);let i=(e-n)/Math.max(t-n,1e-4);return Math.max(0,1-i)**r}function qe(e){return Math.tanh(e*1.2)/Math.tanh(1.2)}function oe(e,t=44100){let n=Math.max(0,...e.notes.map(e=>e.at+e.length)),r=e.cue===`typing`?.048:.024,i=e.loop?e.duration:Math.min(e.duration,n+(e.pack===`zen`?.12:.06)),a=e.loop?0:r+e.echo*1.6,o=Math.max(1,Math.round((i+a)*t)),s=new Float32Array(o),c=new Float32Array(o),l=ye(be(`${e.pack}:${e.cue}`)),u=ye(be(`${e.pack}:${e.cue}:materials`)),d=new Float64Array(e.notes.length),p=0,m=0,h=0,g=0,_=0,v=e.loop?Math.max(.0018,e.attack):e.attack,b=e.paper>0||e.brush>0||e.wood>0||e.chime>0;for(let n=0;n<o;n+=1){let r=n/t,i=0,a=0,o=0,_=0;for(let n=0;n<e.notes.length;n+=1){let s=e.notes[n];if(!s)continue;let c=r-s.at;if(c<0||c>s.length)continue;let l=c/s.length,u=s.frequency*(s.endFrequency/s.frequency)**l*2**(e.elasticity*Math.exp(-c*19)*Math.cos(Math.PI*2*12.5*c)/12);d[n]=(d[n]??0)+Math.PI*2*u/t;let p=d[n]??0,m=e.fmDepth>0?Math.sin(p*e.fmRatio)*e.fmDepth*Math.exp(-c*7.5):0,h=0;for(let[n,r]of e.harmonics)h+=Be(p*n+m,e.waveform,Math.min(.49,u*n/t))*r;let g=s.gain??1,_=ve(c,s.length,v,e.decay);i+=h*_*g,a+=ve(c,s.length,Math.min(.004,v),Math.max(2.35,e.decay*1.25))*g;let b=1-Math.exp(-c*800);o+=b*Math.exp(-c*(105+e.brightness*170))*g}let x=l()*2-1,S=u()*2-1;m+=(S-m)*.08,h+=(S-h)*.018,g+=(S-g)*.004;let C=m-h,w=h-g;if(b)for(let t of e.notes){let n=r-t.at;if(!(n<0)){if(e.paper>0){let r=Math.min(t.length,.075,Math.max(.028,t.length*.62));if(n<=r){let t=n/r,i=Math.sin(Math.PI*t)**1.1*(1-t*.48),a=Math.exp(-(((n-r*.24)/.003)**2)),o=Math.exp(-(((n-r*.64)/.005)**2));_+=C*e.paper*i*(.16+a*.52+o*.24)}}if(e.brush>0){let r=Math.min(t.length,.11,Math.max(.045,t.length*.95));if(n<=r){let t=n/r,i=Math.sin(Math.PI*t)**1.3;_+=w*e.brush*i*(.42+t*.08)}}if(e.wood>0&&n<=Math.min(t.length,.22,Math.max(.09,t.length*.8))){let r=1-Math.exp(-n*480),i=Math.exp(-n*18),a=Math.sin(Math.PI*2*t.frequency*.31*n),o=Math.sin(Math.PI*2*t.frequency*.47*n+.3)*.34;_+=(a+o)*e.wood*r*i}if(e.chime>0&&n<=Math.min(t.length,.42,Math.max(.16,t.length*1.25))){let r=1-Math.exp(-n*520),i=Math.exp(-n*7.4),a=Math.sin(Math.PI*2*t.frequency*2.01*n)+Math.sin(Math.PI*2*t.frequency*3.87*n+.4)*.28;_+=a*e.chime*r*i}}}let E=520+e.brightness*4800,D=1-Math.exp(-Math.PI*2*E/t);p+=(x-p)*D;let k=x-p,A=(k*(.52+e.brightness*.28)+p*(.18-e.brightness*.08))*e.noise*Math.min(1.4,a),M=k*e.transient*Math.min(1.35,o),P=e.pack===`zen`,F=i*(P?.58:.62)+A*(P?.1:.32)+M*(P?.08:.3)+_*(P?.34:0);if(e.bitDepth<16){let t=2**e.bitDepth;F=Math.round(F*t)/t}let I=Math.min(1,r/Math.max(e.duration,.001)),V=((e.loop?(e.panFrom+e.panTo)/2-(e.panTo-e.panFrom)/2*Math.cos(Math.PI*2*I):e.panFrom+(e.panTo-e.panFrom)*I)+1)*Math.PI/4,ee=P?F:qe(F);s[n]=ee*Math.cos(V),c[n]=ee*Math.sin(V)}if(e.echo>0&&!e.loop){let n=Math.floor((.035+e.echo*.38)*t),r=Math.min(.22,e.echo*1.65);for(let e=n;e<o;e+=1)s[e]+=s[e-n]*r,c[e]+=c[e-n]*r}if(!e.loop){let e=Math.min(o,Math.round(.028*t)),n=o-e;for(let t=n;t<o;t+=1){let n=(o-1-t)/Math.max(1,e-1),r=Math.sin(n*Math.PI/2)**2;s[t]*=r,c[t]*=r}}for(let e=0;e<o;e+=1)_=Math.max(_,Math.abs(s[e]),Math.abs(c[e]));let x=e.cue===`typing`?e.pack===`zen`?.15:.28:e.pack===`zen`?e.loop?.18:e.cue===`hover`?.15:.28:e.loop?.32:e.cue===`hover`?.3:.42,S=_>0?Math.min(2.2,x/_):1;_=0;for(let e=0;e<o;e+=1)s[e]*=S,c[e]*=S,_=Math.max(_,Math.abs(s[e]),Math.abs(c[e]));return{sampleRate:t,duration:o/t,left:s,right:c,peak:_}}function Le(){if(typeof window>`u`)return;let e=window;return window.AudioContext??e.webkitAudioContext}function Q(e,t){return typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.min(1,e)):t}function ze(e){return typeof e==`number`&&Number.isFinite(e)?Math.max(1,Math.min(32,Math.round(e))):8}function Ge(){return new Promise(e=>setTimeout(e,0))}var Ia={},La=.018;function $e(e,t){return typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.min(1e4,e)):t}function We(e){if(e){if(e.storage)return e.storage;if(!(typeof window>`u`))try{return window.localStorage}catch{return}}}function je(e,t){if(!e)return{};try{let n=JSON.parse(e.getItem(t)??`{}`);return{pack:typeof n.pack==`string`&&Ca.includes(n.pack)?n.pack:void 0,volume:typeof n.volume==`number`?Q(n.volume,1):void 0,enabled:typeof n.enabled==`boolean`?n.enabled:void 0}}catch{return{}}}function ie(e={}){let t=e.preferences?.key??`uisfx:preferences`,n=We(e.preferences),r=je(n,t),i=e.pack??r.pack??`minimal`,a=Q(e.volume??r.volume,1),o=e.enabled??r.enabled??!0,s=ze(e.maxVoices),c=e.context,l,u=new Map,d=new WeakSet,p=new Map,m=new Map,h=new Set,g=new Map;function f(){if(n)try{n.setItem(t,JSON.stringify({pack:i,volume:a,enabled:o}))}catch{}}function R(e){let t=p.get(e);if(!t||d.has(e))return;d.add(e);let n=c?.currentTime??0;try{t.gain.gain.cancelScheduledValues(n),t.gain.gain.setValueAtTime(t.gain.gain.value,n),t.gain.gain.linearRampToValueAtTime(0,n+.015),e.stop(n+La)}catch{}}function O(e){e.finished||(e.finished=!0,h.delete(e),m.get(e.cue)===e&&m.delete(e.cue),e.resolveEnded())}function L(){if(c)return c;let e=Le();if(e)return c=new e({latencyHint:`interactive`}),c}function K(e){return l||(l=e.createGain(),l.gain.value=a,l.connect(e.destination),l)}function m$2(e){let t=L();if(!t)return;let n=`${i}:${e}:${t.sampleRate}`,r=u.get(n);if(r)return r;let a=oe(Z(i,e),t.sampleRate),o=t.createBuffer(2,a.left.length,a.sampleRate);return o.getChannelData(0).set(a.left),o.getChannelData(1).set(a.right),u.set(n,o),o}__name(m$2,`m`);function N(e){let t=L(),n=m$2(e.cue);if(!t||!n)return!1;t.state===`suspended`&&t.resume();let r=[...p.entries()].filter(([e])=>!d.has(e)),a;if(r.length>=s){let e=r.find(([,e])=>!e.playback.loop)??r[0];e&&(e[1].playback.playing.stop(),a=t.currentTime+La)}let o=Z(i,e.cue),c=t.createBufferSource(),l=t.createGain();return c.buffer=n,c.loop=e.loop,c.playbackRate.value=Math.max(.25,Math.min(4,e.options.playbackRate??1)),l.gain.value=Q(e.options.volume,o.defaultVolume),c.connect(l),l.connect(K(t)),e.source=c,c.addEventListener(`ended`,()=>{p.delete(c),c.disconnect(),l.disconnect(),e.source===c&&(e.source=void 0,O(e))},{once:!0}),p.set(c,{gain:l,playback:e}),a===void 0?c.start():c.start(a),!0}function y(t,n={}){if(!o)return null;let r=Z(i,t),a=n.loop??r.loop,s=n.retrigger??(a?`ignore`:`restart`),c=m.get(t),l=$e(n.cooldownMs??e.cooldownMs,Ia[t]??0),u=performance.now(),d=g.get(t);if(d!==void 0&&u-d<l)return c?.playing??null;if(c&&s===`ignore`)return c.playing;c&&s===`restart`&&c.playing.stop();let B=()=>{},p=new Promise(e=>{B=e}),_,v={stop(){_.stopped||(_.stopped=!0,m.get(t)===_&&m.delete(t),_.source?R(_.source):O(_))},ended:p};return _={cue:t,options:n,loop:a,retrigger:s,playing:v,stopped:!1,finished:!1,resolveEnded:B},h.add(_),s!==`overlap`&&m.set(t,_),N(_)?(g.set(t,u),v):(O(_),null)}async function z(e=xa.map(e=>e.name),t={}){if(L())for(let n of e){if(t.signal?.aborted||(await Ge(),t.signal?.aborted))return;m$2(n)}}async function X(){let e=L();if(!e)return!1;if(e.state===`running`)return!0;try{return await e.resume(),e.state===`running`}catch{return!1}}function T(){for(let e of[...h])e.playing.stop()}return{unlock:X,play:y,preload:z,setPack(e){if(i!==e){i=e,f();for(let e of[...h])!e.loop||e.stopped||!e.source||(R(e.source),N(e)||O(e))}},getPack(){return i},setVolume(e){if(a=Q(e,a),f(),!l||!c)return;let t=c.currentTime;typeof l.gain.cancelAndHoldAtTime==`function`?l.gain.cancelAndHoldAtTime(t):(l.gain.cancelScheduledValues(t),l.gain.setValueAtTime(l.gain.value,t)),l.gain.linearRampToValueAtTime(a,t+.02)},getVolume(){return a},setEnabled(e){o=e,f(),o||T()},isEnabled(){return o},stopAll:T,async destroy(){T();for(let e of[...h])O(e);u.clear(),l?.disconnect(),l=void 0,c&&c!==e.context&&await c.close(),c=void 0}}}function classifyClick(e){if(!(e instanceof Element)||e.closest(`[data-xmimo-sound-toggle]`)!==null||e.closest(`[data-xmimo-sound-preview]`)!==null||e.closest(`[data-xmimo-sound-pack-option]`)!==null)return null;if(e.closest(`.dsh-pet-hit`)!==null)return`press`;let t=e.closest(`[data-xmimo-select-option]`);if(t!==null)return t.querySelector(`input[type="radio"]`)?.disabled?null:`select`;let n=e.closest(`button, a, [role='button'], [role='switch'], [role='checkbox'], [aria-checked], [aria-pressed]`);if(n===null||n instanceof HTMLButtonElement&&n.disabled||n.getAttribute(`aria-disabled`)===`true`)return null;let r=`${n.getAttribute(`aria-label`)??``} ${n.getAttribute(`title`)??``} ${n.textContent??``}`.toLowerCase(),i=typeof n.className==`string`?n.className.toLowerCase():``,a=n.getAttribute(`role`),o=a===`switch`||a===`checkbox`||n.hasAttribute(`aria-checked`)||n.hasAttribute(`aria-pressed`);return/(?:停止(?:生成|任务|语音|朗读)|中断(?:生成|语音|朗读)|取消(?:语音)?生成|\bstop\b|\babort\b|\bcancel(?:\s+\w+){0,2}\s+generation\b)/.test(r)?`stop`:o?(n.getAttribute(`aria-checked`)??n.getAttribute(`aria-pressed`))?.toLowerCase()===`true`?`toggle-off`:`toggle-on`:/关闭|取消|close|cancel/.test(r)?`close`:/发送|提交|send|submit|go/.test(r)?`send`:/删除|清空|移除|delete|clear|trash|remove/.test(r)?`delete`:n.tagName===`A`||n.getAttribute(`role`)===`link`?`open`:/primary|accent|send/.test(i)?`select`:`press`}let Ra=new Set([`start`,`complete`,`success`,`error`,`notification`,`press`,`select`,`toggle-on`,`toggle-off`,`send`,`close`,`delete`,`open`,`stop`,`queued`]);function createSoundEffectsController(e=()=>!0){let t={enabled:!0,volume:V.soundVolume,pack:V.soundPack,taskSounds:!0,clickSounds:!0},n=null,getPlayer=()=>(n===null&&(n=ie({pack:t.pack,volume:t.volume,enabled:t.enabled,maxVoices:8,preferences:{key:`xiaomi-mimo-tts:sound-effects`}})),n);return{play(n,r){if(!(!e()||!t.enabled||!Ra.has(n)))try{getPlayer().play(n,r)}catch{}},preview(n){if(!(!e()||!t.enabled||!Ra.has(n)))try{getPlayer().play(n)}catch{}},setVolume(e){t={...t,volume:Number.isFinite(e)?Math.max(0,Math.min(1,e)):t.volume},n!==null&&n.setVolume(t.volume)},previewVolume(){if(!(!e()||!t.enabled))try{getPlayer().play(`check`,{retrigger:`ignore`})}catch{}},update(e){t=e,n!==null&&(n.setEnabled(e.enabled),n.setVolume(e.volume),n.setPack(e.pack))},async dispose(){let e=n;n=null,e!==null&&await e.destroy()}}}function installClickSounds(e,t,n){let r=0,onPointerDown=e=>{let i=n();if(!i.enabled||!i.clickSounds)return;let a=classifyClick(e.target);if(a===null)return;let o=Date.now();o-r<40||(r=o,t.play(a))};return document.addEventListener(`pointerdown`,onPointerDown,!0),()=>document.removeEventListener(`pointerdown`,onPointerDown,!0)}function hasTurnError(){return typeof document<`u`&&document.querySelector(`[data-chat-flow-kind='turn-error']`)!==null}function installTaskSoundWatcher(e,t,n){let r=e.sessions,i,a=null,o=null,s=null,c=null,l=0,unbind=()=>{a?.(),a=null},tick=e=>{let r=n();if(!r.enabled||!r.taskSounds)return;let i=e.running===!0,a=e.pendingSubmissions.filter(({placement:e})=>e!==`transcript`).length;if(c===null){c=i,l=a;return}if(i&&!c&&t.play(`start`),!i&&c){let r=e.lastAgentError!=null||hasTurnError();window.setTimeout(()=>{n().enabled&&n().taskSounds&&t.play(r?`error`:`complete`)},50)}a>l&&t.play(`queued`),c=i,l=a},watchCurrent=()=>{let e=r.list.getSnapshot(),t=Object.values(e.byId).find(({retainedBy:e})=>(e.mainView??0)>0)?.id;if(t===i||(i=t,unbind(),c=null,l=0,s!==null&&(window.clearTimeout(s),s=null),t==null))return;let n=r.binding(t);if(n===void 0){s=window.setTimeout(watchCurrent,200);return}a=n.session.subscribe(()=>tick(n.session.getSnapshot())),tick(n.session.getSnapshot())};return o=r.list.subscribe(watchCurrent),watchCurrent(),()=>{o?.(),unbind(),s!==null&&window.clearTimeout(s)}}let za=[`/*
32
+ 10. 只做必要改动,记录实际路径、端口和启动方式。`;function availableVoices(){return typeof window>`u`||window.speechSynthesis===void 0?[]:[...window.speechSynthesis.getVoices()].sort((e,t)=>{let rank=e=>{if(e.localService)return 0;let t=e.lang.toLowerCase();return t===`zh`||t.startsWith(`zh-`)?1:t===`en`||t.startsWith(`en-`)?2:3};return rank(e)-rank(t)||e.name.localeCompare(t.name)||e.lang.localeCompare(t.lang)})}function pickVoice(e,t){let n=typeof navigator>`u`?`zh-CN`:navigator.language||`zh-CN`;return e.find(e=>e.voiceURI===t)??e.find(e=>e.lang.toLowerCase()===`zh-cn`)??e.find(e=>e.lang.toLowerCase().startsWith(n.toLowerCase().split(`-`)[0]??`zh`))??e.find(e=>e.default)??e[0]}function LocalVoicePicker({value:e,disabled:t=!1,label:n,minimal:r=!1,unavailableLabel:i,loadingLabel:a,offlineLabel:o,onlineLabel:s,onChange:c,onAvailabilityChange:p}){let[m,h]=(0,l.useState)([]),[g,_]=(0,l.useState)(!1),[v,b]=(0,l.useState)(!1),x=(0,l.useRef)(null),S=(0,l.useRef)(null),C=(0,l.useRef)([]),w=(0,l.useId)();(0,l.useEffect)(()=>{if(typeof window>`u`||window.speechSynthesis===void 0){_(!0),p(!1);return}let update=()=>{let e=availableVoices();h(e),_(!0),p(e.length>0)};return update(),window.speechSynthesis.addEventListener(`voiceschanged`,update),()=>window.speechSynthesis.removeEventListener(`voiceschanged`,update)},[]),(0,l.useEffect)(()=>{if(typeof document>`u`)return;let close=e=>{e.target instanceof Node&&!x.current?.contains(e.target)&&b(!1)};return document.addEventListener(`pointerdown`,close),()=>document.removeEventListener(`pointerdown`,close)},[]),(0,l.useEffect)(()=>{t&&b(!1)},[t]);let E=(0,l.useMemo)(()=>pickVoice(m,e),[e,m]),D=E?.voiceURI??e,choose=e=>{c(e.voiceURI),b(!1),requestAnimationFrame(()=>S.current?.focus())},focusOption=e=>{if(m.length===0)return;let t=(e+m.length)%m.length;requestAnimationFrame(()=>C.current[t]?.focus())},handleTriggerKeyDown=e=>{if(m.length!==0&&(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)){e.preventDefault(),b(!0);let t=Math.max(0,m.findIndex(e=>e.voiceURI===D));focusOption(e.key===`Home`?0:e.key===`End`?m.length-1:t)}},handleOptionKeyDown=(e,t)=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),focusOption(t+1)):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),focusOption(t-1)):e.key===`Home`?(e.preventDefault(),focusOption(0)):e.key===`End`?(e.preventDefault(),focusOption(m.length-1)):e.key===`Escape`?(e.preventDefault(),b(!1),S.current?.focus()):e.key===`Tab`&&b(!1)},k=E?.name??(g?i:a),voiceSummary=e=>`${e.lang} · ${e.localService?o:s}`;return(0,d.jsxs)(`div`,{className:`xmimo-tts-builtin-voice-picker`,ref:x,children:[(0,d.jsxs)(`button`,{ref:S,type:`button`,className:`xmimo-tts-builtin-voice-trigger`,disabled:t||m.length===0,"aria-haspopup":`listbox`,"aria-expanded":v,"aria-controls":v?w:void 0,"aria-label":n,onClick:()=>b(e=>!e),onKeyDown:handleTriggerKeyDown,children:[r?null:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-local-voice-avatar`,"aria-hidden":`true`,children:`🔊`}),(0,d.jsxs)(`span`,{className:`xmimo-tts-builtin-voice-copy`,children:[(0,d.jsx)(`strong`,{children:k}),(0,d.jsx)(`small`,{children:E===void 0?g?i:a:voiceSummary(E)})]}),r?(0,d.jsx)(`span`,{className:`xmimo-tts-voice-picker-text-caret`,"aria-hidden":`true`,children:`⌄`}):(0,d.jsx)(u.IconChevronDownOutlineMedium,{className:v?`xmimo-tts-voice-picker-chevron xmimo-tts-voice-picker-chevron-open`:`xmimo-tts-voice-picker-chevron`,size:14})]}),v?(0,d.jsx)(`div`,{id:w,className:`xmimo-tts-builtin-voice-menu`,role:`listbox`,"aria-label":n,children:m.map((e,t)=>(0,d.jsxs)(`button`,{ref:e=>{C.current[t]=e},type:`button`,role:`option`,"aria-selected":e.voiceURI===D,className:e.voiceURI===D?`xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-selected`:`xmimo-tts-builtin-voice-option`,onClick:()=>choose(e),onKeyDown:e=>handleOptionKeyDown(e,t),children:[!r&&e.voiceURI===D?(0,d.jsxs)(`svg`,{className:`xmimo-tts-builtin-voice-check`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,d.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7`}),(0,d.jsx)(`path`,{d:`m4.8 8.1 2 2 4.4-4.5`})]}):null,r?null:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-local-voice-avatar`,"aria-hidden":`true`,children:`🔊`}),(0,d.jsxs)(`span`,{className:`xmimo-tts-voice-option-copy`,children:[(0,d.jsx)(`strong`,{children:e.name}),(0,d.jsx)(`small`,{children:voiceSummary(e)})]})]},e.voiceURI))}):null]})}function errorKey(e){return e===`moss-invalid-url`?`settings.mossInvalidUrl`:e===`moss-timeout`?`settings.mossTimeout`:e===`moss-unreachable`||e===`moss-request-failed`?`settings.mossUnreachable`:`settings.mossProbeFailed`}function voicePresets(e,t){return e.map(e=>({id:e.id,value:e.id,label:e.name,summary:`${e.id} · ${t(`settings.mossBuiltInVoice`)}`,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-local-voice-avatar xmimo-tts-moss-voice-avatar`,"aria-hidden":`true`,children:`M`})}))}function LocalVoiceModule({t:e,minimal:t,writable:n,localSpeechMode:r,engine:i,mossEnabled:a,browserVoiceURI:o,mossBaseURL:s,mossVoice:c,mossVoiceName:p,fieldOverridden:m,resetField:h,onEngineChange:g,onBrowserVoiceChange:_,onMossBaseURLChange:b,onMossVoiceChange:x,onBrowserAvailabilityChange:S}){let C=a?i:`browser`,[w,E]=(0,l.useState)({status:`idle`}),[D,k]=(0,l.useState)(`idle`),A=(0,l.useRef)(null),M=(0,l.useRef)(null),P=(0,l.useRef)(c);P.current=c;let F=!n||r===`disabled`,I=mossVoiceChoices(w.status===`ready`?w.result.voices:[],c,p),V=voicePresets(I,e),ee=V.find(e=>e.value===c)??V[0],te=C===`moss`?`mossVoice`:`localVoiceURI`,re=te;(0,l.useEffect)(()=>()=>{A.current?.abort(),M.current!==null&&window.clearTimeout(M.current)},[]),(0,l.useEffect)(()=>{A.current?.abort(),A.current=null,E({status:`idle`})},[s]);let se=(0,l.useCallback)(async()=>{k(await copyText(Oi)?`copied`:`failed`),M.current!==null&&window.clearTimeout(M.current),M.current=window.setTimeout(()=>{k(`idle`),M.current=null},2e3)},[]),ce=(0,l.useCallback)(async()=>{A.current?.abort();let e=new AbortController;A.current=e,E({status:`loading`});try{let t=await probeMossService(s,e.signal);if(e.signal.aborted)return;if(!t.ok){E({status:`error`,code:t.error,message:t.message});return}if(E({status:`ready`,result:t}),n&&t.voices.length>0&&!t.voices.some(e=>e.id===P.current)){let e=t.voices[0];x(e.id,e.name)}}catch(t){if(e.signal.aborted)return;E({status:`error`,code:t instanceof MossRequestError?t.code:`moss-request-failed`,message:t instanceof Error?t.message:``})}},[s,x,n]);(0,l.useEffect)(()=>C===`moss`?(ce(),()=>{A.current?.abort(),A.current=null}):()=>{},[C]);let le=w.status===`loading`?e(`settings.mossProbing`):w.status===`ready`?w.result.warmup!==null&&!w.result.warmup.ready?`${e(`settings.mossWarming`)} ${Math.round(w.result.warmup.progress*100)}%`:e(`settings.mossOnlineReady`):w.status===`error`?e(errorKey(w.code)):e(`settings.mossNotProbed`),H=w.status===`ready`?`online`:w.status===`error`?`offline`:w.status;return(0,d.jsxs)(`div`,{className:`xmimo-tts-voice xmimo-tts-local-voice`,children:[(0,d.jsx)(SettingFieldHeading,{label:e(`settings.localVoice`),overriddenLabel:e(`settings.overridden`),resetLabel:e(`settings.reset`),overridden:m(re),resettable:!0,disabled:!n,onReset:()=>{h(te),te===`mossVoice`&&h(`mossVoiceName`)},suffix:(0,d.jsx)(`small`,{className:`xmimo-tts-hint xmimo-tts-local-voice-engine-note`,style:{fontSize:`11px`},children:C===`moss`?`MOSS`:`Microsoft Edge – Better`})}),a?(0,d.jsx)(`div`,{className:`xmimo-tts-settings-segmented-wrap xmimo-tts-local-voice-tabs`,"data-xmimo-select-option":`true`,style:{"--xmimo-experimental-label":JSON.stringify(e(`settings.experimental`))},children:(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-local-voice-engine`,value:C,options:[{value:`browser`,label:e(`settings.localVoiceEngineBrowser`)},{value:`moss`,label:e(`settings.localVoiceEngineMoss`)}],label:e(`settings.localVoiceEngine`),disabled:!n||r===`disabled`,onChange:g,className:`xmimo-tts-settings-segmented xmimo-tts-local-voice-segmented`})}):null,C===`browser`?(0,d.jsx)(LocalVoicePicker,{value:o,disabled:F,label:e(`settings.localVoice`),minimal:t,loadingLabel:e(`settings.localVoiceLoading`),unavailableLabel:e(`settings.localVoiceUnavailable`),offlineLabel:e(`settings.localVoiceOffline`),onlineLabel:e(`settings.localVoiceOnline`),onChange:_,onAvailabilityChange:S}):(0,d.jsxs)(`div`,{className:`xmimo-tts-moss-local`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-moss-field`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-moss-field-heading`,children:[(0,d.jsx)(`span`,{className:`xmimo-tts-moss-field-title`,children:e(`settings.mossBaseURL`)}),(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-moss-text-button`,disabled:w.status===`loading`,onClick:()=>{ce()},children:w.status===`loading`?e(`settings.mossProbingShort`):e(`settings.mossProbe`)}),(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-moss-deploy-hint`,"data-state":D,title:e(`settings.mossCopyDeployHint`),"aria-label":e(`settings.mossCopyDeployHint`),onClick:()=>{se()},children:D===`copied`?e(`settings.mossDeployCopied`):D===`failed`?e(`settings.mossDeployCopyFailed`):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`span`,{children:e(`settings.mossDeployHintBefore`)}),(0,d.jsx)(`span`,{className:`xmimo-tts-moss-deploy-action`,children:e(`settings.mossDeployHintAction`)}),(0,d.jsx)(`span`,{children:e(`settings.mossDeployHintAfter`)})]})})]}),(0,d.jsx)(`input`,{type:`url`,className:`xmimo-tts-moss-baseurl`,value:s,spellCheck:!1,disabled:!n,"aria-label":e(`settings.mossBaseURL`),placeholder:v,onChange:e=>{b(e.target.value)}})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-moss-status`,"data-state":H,role:`status`,title:w.status===`error`?w.message:void 0,children:[(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`xmimo-tts-moss-status-dot`}),(0,d.jsx)(`span`,{children:le}),w.status===`ready`&&w.result.health.device!==void 0?(0,d.jsx)(`small`,{children:w.result.health.device}):null]}),ee===void 0?(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-builtin-voice-trigger xmimo-tts-moss-voice-placeholder`,disabled:!0,children:e(`settings.mossVoiceProbeFirst`)}):(0,d.jsx)(VoicePresetPicker,{value:c,disabled:F,label:e(`settings.mossVoice`),minimal:t,presets:V,onChange:e=>{let t=I.find(t=>t.id===e);t!==void 0&&x(t.id,t.name)}}),r===`local-first`?null:(0,d.jsx)(`small`,{className:`xmimo-tts-hint`,children:e(r===`disabled`?`settings.mossLocalDisabledHint`:`settings.mossLocalFirstHint`)})]})]})}let ki={standard:`dsh-xiaomi-mimo-tts:standard-voice-history`,cloned:`dsh-xiaomi-mimo-tts:cloned-voice-history`,breeze:`dsh-xiaomi-mimo-tts:breeze-voice-history`},Ai=0,ji=new Set,Mi=new Map,Ni=new WeakMap;function memoryFor(e){if(!e)return Mi;let t=Ni.get(e);return t||(t=new Map,Ni.set(e,t)),t}let changed=()=>{Ai+=1;for(let e of ji)e()},storageChanged=e=>{(e.key===null||Object.values(ki).some(t=>e.key?.startsWith(t)))&&changed()},voiceIdRevision=()=>Ai;function subscribeVoiceIds(e){return ji.size===0&&typeof window<`u`&&window.addEventListener(`storage`,storageChanged),ji.add(e),()=>{ji.delete(e),ji.size===0&&typeof window<`u`&&window.removeEventListener(`storage`,storageChanged)}}function readStored(e,t){try{return t?t.getItem(e):memoryFor(t).get(e)??null}catch{return memoryFor(t).get(e)??null}}function writeStored(e,t,n){if(readStored(e,n)!==t){memoryFor(n).set(e,t);try{n?.setItem(e,t)}catch{}changed()}}function browserStorage(){try{return typeof window>`u`?void 0:window.localStorage}catch{return}}function normalizeHistory(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean))].slice(0,10):[]}function readVoiceIdHistory(e,t=browserStorage()){try{return normalizeHistory(JSON.parse(readStored(ki[e],t)??`[]`))}catch{return[]}}function rememberVoiceId(e,t){return normalizeHistory([t,...e])}function forgetVoiceId(e,t,n){let r=n.trim();return{history:e.filter(e=>e!==r),names:Object.fromEntries(Object.entries(t).filter(([e])=>e!==r))}}function writeVoiceIdHistory(e,t,n=browserStorage()){try{writeStored(ki[e],JSON.stringify(normalizeHistory(t)),n)}catch{}}function normalizeNames(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([e,t])=>e.trim()&&typeof t==`string`&&t.trim()).map(([e,t])=>[e.trim(),t.trim()]))}function readVoiceIdNames(e,t=browserStorage()){try{return normalizeNames(JSON.parse(readStored(`${ki[e]}:names`,t)??`{}`))}catch{return{}}}function writeVoiceIdNames(e,t,n=browserStorage()){try{writeStored(`${ki[e]}:names`,JSON.stringify(normalizeNames(t)),n)}catch{}}function VoiceIdTag({voice:e,name:t,selected:n,disabled:r,t:i,selectRef:a,onSelect:o,onSave:s,onRemove:c}){let[u,p]=(0,l.useState)(`idle`),[m,h]=(0,l.useState)(``),g=(0,l.useRef)(null),_=(0,l.useRef)(null),v=(0,l.useRef)(null),b=t||e,reset=(e=!1)=>{p(`idle`),e&&requestAnimationFrame(()=>_.current?.focus())},save=()=>{r||(s(m.trim()),reset(!0))};return(0,l.useEffect)(()=>{r&&reset()},[r]),(0,l.useEffect)(()=>{if(u===`idle`)return;u===`edit`&&v.current?.focus();let onOutsidePointer=e=>{e.target instanceof Node&&!g.current?.contains(e.target)&&reset()};return document.addEventListener(`pointerdown`,onOutsidePointer),()=>document.removeEventListener(`pointerdown`,onOutsidePointer)},[u]),(0,d.jsxs)(`span`,{ref:g,className:`xmimo-tts-voice-id-tag`,"data-selected":n,"data-mode":u,"data-disabled":r,onBlur:e=>{e.relatedTarget instanceof Node&&!e.currentTarget.contains(e.relatedTarget)&&reset()},onKeyDown:e=>{e.key===`Escape`&&u!==`idle`&&(e.preventDefault(),e.stopPropagation(),reset(!0))},children:[(0,d.jsx)(`span`,{className:`xmimo-tts-voice-id-size`,"aria-hidden":`true`,children:u===`confirm`?i(`settings.voiceTagConfirm`):b}),u===`edit`?(0,d.jsx)(`input`,{ref:v,className:`xmimo-tts-voice-id-edit`,type:`text`,value:m,disabled:r,"aria-label":i(`settings.voiceRemark`),placeholder:i(`settings.voiceRemark`),onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),save())}}):u===`confirm`?(0,d.jsx)(`span`,{className:`xmimo-tts-voice-id-confirm`,role:`status`,children:i(`settings.voiceTagConfirm`)}):(0,d.jsx)(`button`,{ref:e=>{_.current=e,a(e)},type:`button`,className:`xmimo-tts-voice-id-select`,title:t?`${t}\n${e}`:e,"aria-label":t?`${t} (${e})`:e,disabled:r,"aria-pressed":n,onClick:o,children:b}),(0,d.jsxs)(`span`,{className:`xmimo-tts-voice-id-actions`,children:[u===`confirm`?null:(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-voice-id-action`,disabled:r,"aria-label":`${i(u===`edit`?`settings.save`:`settings.voiceTagEdit`)}: ${b}`,title:i(u===`edit`?`settings.save`:`settings.voiceTagEdit`),onClick:()=>{u===`edit`?save():(h(t||``),p(`edit`))},children:u===`edit`?(0,d.jsx)(RiSaveLine,{size:14,"aria-hidden":`true`}):(0,d.jsx)(RiEditLine,{size:14,"aria-hidden":`true`})}),u===`edit`?null:(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-voice-id-action xmimo-tts-voice-id-delete`,disabled:r,"aria-label":`${i(u===`confirm`?`settings.voiceTagConfirm`:`settings.voiceTagRemove`)}: ${b}`,title:i(u===`confirm`?`settings.voiceTagConfirm`:`settings.voiceTagRemove`),onClick:()=>{u===`confirm`?c():p(`confirm`)},children:u===`confirm`?(0,d.jsx)(RiCheckLine,{size:14,"aria-hidden":`true`}):(0,d.jsx)(RiDeleteBinLine,{size:14,"aria-hidden":`true`})})]})]})}let Pi=new Map([...Ve.map(e=>[e.value,e.name]),...H.map(e=>[e.value,e.name])]);function VoiceIdInput({value:e,disabled:t,onChange:n,kind:r,label:i,historyLabel:a,t:o}){let[s,c]=(0,l.useState)(()=>readVoiceIdHistory(r)),[u,p]=(0,l.useState)(()=>readVoiceIdNames(r)),m=(0,l.useRef)(null),h=(0,l.useRef)(e.trim()),g=(0,l.useRef)(new Map);(0,l.useEffect)(()=>{c(readVoiceIdHistory(r)),p(readVoiceIdNames(r))},[r,(0,l.useSyncExternalStore)(subscribeVoiceIds,voiceIdRevision,()=>0)]);let remember=e=>{let t=rememberVoiceId(readVoiceIdHistory(r),e);c(t),writeVoiceIdHistory(r,t)},remove=e=>{let t=s.indexOf(e),n=s[t+1]??s[t-1],i=forgetVoiceId(s,u,e);c(i.history),p(i.names),writeVoiceIdHistory(r,i.history),writeVoiceIdNames(r,i.names),requestAnimationFrame(()=>{(n?g.current.get(n):m.current)?.focus()})};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`input`,{ref:m,type:`text`,value:e,disabled:t,spellCheck:!1,"aria-label":i,placeholder:i,"aria-invalid":!e.trim(),onFocus:()=>{h.current=e.trim()},onChange:e=>n(e.target.value),onBlur:()=>{!t&&h.current!==e.trim()&&remember(e)},onKeyDown:n=>{!t&&n.key===`Enter`&&!n.nativeEvent.isComposing&&(n.preventDefault(),h.current=e.trim(),remember(e))}}),s.length>0?(0,d.jsx)(`div`,{className:`xmimo-tts-voice-id-history`,role:`group`,"aria-label":a,children:s.map(i=>{let a=r===`standard`?Pi.get(i):void 0;return(0,d.jsx)(VoiceIdTag,{voice:i,name:(Object.hasOwn(u,i)?u[i]??``:``).trim()||a,selected:e.trim()===i,disabled:t,t:o,selectRef:e=>{e?g.current.set(i,e):g.current.delete(i)},onSelect:()=>{n(i),remember(i)},onSave:e=>{let t={...readVoiceIdNames(r),[i]:e.trim()};p(t),writeVoiceIdNames(r,t)},onRemove:()=>remove(i)},i)})}):null]})}let Fi=`__custom__`,Ii=new Set([`zh_female_vv_uranus_bigtts`,`zh_female_xiaohe_uranus_bigtts`,`zh_male_m191_uranus_bigtts`,`zh_male_taocheng_uranus_bigtts`]);function DoubaoVoicePicker({value:e,disabled:t,minimal:n=!1,onChange:r,t:i}){let[a,o]=(0,l.useState)(!Ve.some(t=>t.value===e)),s=n?Ve.filter(e=>Ii.has(e.value)):Ve,c=s.some(t=>t.value===e);return(0,d.jsxs)(`div`,{className:`xmimo-tts-doubao-voice-picker`,children:[(0,d.jsx)(VoicePresetPicker,{presets:[{id:Fi,value:Fi,label:i(`settings.doubaoCustomVoice`),summary:i(`settings.doubaoCustomVoiceHint`),fullWidth:!0,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-doubao-voice-avatar`,"aria-hidden":`true`,children:`+`})},...s.map(e=>({id:e.value,value:e.value,label:e.name,summary:`${i(e.scene===`角色`?`settings.doubaoVoiceSceneRole`:e.scene===`配音`?`settings.doubaoVoiceSceneDubbing`:e.scene===`阅读`?`settings.doubaoVoiceSceneReading`:`settings.doubaoVoiceSceneGeneral`)} · ${i(`settings.doubaoVoiceChinese`)}`,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-doubao-voice-avatar`,"aria-hidden":`true`,children:e.name.slice(0,1)})}))],label:i(`settings.voice`),value:a||!c?Fi:e,disabled:t,minimal:n,onChange:e=>{e===Fi?o(!0):(o(!1),r(e))}}),a||!c?(0,d.jsx)(VoiceIdInput,{kind:`standard`,value:e,disabled:t,label:i(`settings.doubaoVoiceId`),historyLabel:i(`settings.doubaoStandardVoiceHistory`),t:i,onChange:r}):(0,d.jsx)(`small`,{children:e})]})}let Li=`__custom__`;function BreezeVoicePicker({value:e,disabled:t,t:n,onChange:r}){let[i,a]=(0,l.useState)(!H.some(t=>t.value===e));return(0,d.jsxs)(`div`,{className:`xmimo-tts-breeze-voice-picker`,children:[(0,d.jsx)(VoicePresetPicker,{presets:[{id:Li,value:Li,label:n(`settings.breezeCustomVoice`),summary:n(`settings.breezeCustomVoiceHint`),fullWidth:!0,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-doubao-voice-avatar`,"aria-hidden":`true`,children:`+`})},...H.map(e=>({id:e.value,value:e.value,label:e.name,summary:e.language,avatar:(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-doubao-voice-avatar`,"aria-hidden":`true`,children:e.name.slice(0,1)})}))],label:n(`settings.voice`),value:i?Li:e,disabled:t,onChange:e=>{e===Li?a(!0):(a(!1),r(e))}}),i?(0,d.jsx)(VoiceIdInput,{kind:`breeze`,value:e,disabled:t,label:n(`settings.breezeVoiceHint`),historyLabel:n(`settings.breezeVoiceHistory`),t:n,onChange:r}):(0,d.jsx)(`small`,{children:e})]})}let Ri=`__custom__`;function isPresetVoiceDesignPrompt(e){return P.some(t=>t.prompt===e)}let zi=new Set([`energetic-girl`,`liang-wenfeng`,`young-man`,`gentle-girlfriend`]);function VoicePresetAvatar({preset:e,minimal:t}){return t?null:(0,d.jsx)(`img`,{className:`xmimo-tts-builtin-voice-avatar`,src:hostRoute(`/plugins/xiaomi-mimo-tts/voice-presets/${e.id}.webp`),alt:``,width:40,height:40,loading:`lazy`,"aria-hidden":`true`})}function CustomVoiceAvatar(){return(0,d.jsx)(`span`,{className:`xmimo-tts-builtin-voice-avatar xmimo-tts-custom-voice-avatar`,"aria-hidden":`true`,children:(0,d.jsxs)(`svg`,{viewBox:`0 0 40 40`,focusable:`false`,children:[(0,d.jsx)(`circle`,{cx:`20`,cy:`14`,r:`6`}),(0,d.jsx)(`path`,{d:`M9.5 31.5c1.7-6.2 5.2-9.3 10.5-9.3s8.8 3.1 10.5 9.3`}),(0,d.jsx)(`path`,{d:`M31 8v8M27 12h8`})]})})}function VoicePresetCheck(){return(0,d.jsxs)(`svg`,{className:`xmimo-tts-builtin-voice-check`,viewBox:`0 0 14 14`,"aria-hidden":`true`,children:[(0,d.jsx)(`circle`,{cx:`7`,cy:`7`,r:`7`}),(0,d.jsx)(`path`,{d:`m3.5 7 2.1 2.1 4.9-4.7`})]})}function VoiceDesignPresetPicker({value:e,disabled:t,label:n,customLabel:r,customSummary:i,minimal:a=!1,onChange:o}){let[s,c]=(0,l.useState)(!1),p=(0,l.useRef)(null),m=(0,l.useRef)(null),h=(0,l.useRef)([]),g=(0,l.useId)(),_=a?P.filter(e=>zi.has(e.id)):P,v=_.findIndex(t=>t.prompt===e),b=v<0?void 0:_[v],x=v+(a?0:1),S=_.length+(a?0:1);(0,l.useEffect)(()=>{if(a||!s)return;let closeOnOutsidePointer=e=>{e.target instanceof Node&&!p.current?.contains(e.target)&&c(!1)};return document.addEventListener(`pointerdown`,closeOnOutsidePointer),()=>document.removeEventListener(`pointerdown`,closeOnOutsidePointer)},[a,s]),(0,l.useEffect)(()=>{!a&&t&&c(!1)},[t,a]);let focusOption=e=>{let t=(e+S)%S;requestAnimationFrame(()=>h.current[t]?.focus())},openAndFocus=e=>{c(!0),focusOption(e)},choose=e=>{o(e),!a&&(c(!1),requestAnimationFrame(()=>m.current?.focus()))},handleTriggerKeyDown=e=>{e.key===`ArrowDown`?(e.preventDefault(),openAndFocus(x)):e.key===`ArrowUp`?(e.preventDefault(),openAndFocus(x===0?S-1:x)):e.key===`Home`?(e.preventDefault(),openAndFocus(0)):e.key===`End`&&(e.preventDefault(),openAndFocus(S-1))},handleOptionKeyDown=(e,t)=>{e.key===`ArrowDown`?(e.preventDefault(),focusOption(t+1)):e.key===`ArrowUp`?(e.preventDefault(),focusOption(t-1)):e.key===`Home`?(e.preventDefault(),focusOption(0)):e.key===`End`?(e.preventDefault(),focusOption(S-1)):e.key===`Escape`?(e.preventDefault(),c(!1),m.current?.focus()):e.key===`Tab`&&c(!1)};return(0,d.jsxs)(`div`,{className:`xmimo-tts-voice-picker xmimo-tts-builtin-voice-picker`,ref:p,children:[a?null:(0,d.jsxs)(`button`,{ref:m,type:`button`,className:`xmimo-tts-voice-picker-trigger`,disabled:t,"aria-label":n,"aria-haspopup":`listbox`,"aria-expanded":s,"aria-controls":s?g:void 0,onClick:()=>{c(e=>!e)},onKeyDown:handleTriggerKeyDown,children:[a?null:b===void 0?(0,d.jsx)(CustomVoiceAvatar,{}):(0,d.jsx)(VoicePresetAvatar,{preset:b,minimal:a}),(0,d.jsxs)(`span`,{className:`xmimo-tts-voice-option-copy`,children:[(0,d.jsx)(`strong`,{children:b?.label??r}),(0,d.jsx)(`small`,{children:b?.summary??i})]}),a?(0,d.jsx)(`span`,{className:`xmimo-tts-voice-picker-text-caret`,"aria-hidden":`true`,children:`⌄`}):(0,d.jsx)(u.IconChevronDownOutlineMedium,{className:s?`xmimo-tts-voice-picker-chevron xmimo-tts-voice-picker-chevron-open`:`xmimo-tts-voice-picker-chevron`,size:14})]}),a||s?(0,d.jsxs)(`div`,{id:g,className:`xmimo-tts-voice-picker-menu xmimo-tts-builtin-voice-menu`,role:`listbox`,"aria-label":n,children:[a?null:(0,d.jsxs)(`button`,{ref:e=>{h.current[0]=e},type:`button`,role:`option`,"aria-selected":b===void 0,disabled:t,className:b===void 0?`xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-selected xmimo-tts-builtin-voice-option-custom`:`xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-custom`,onClick:()=>{choose(Ri)},onKeyDown:e=>{handleOptionKeyDown(e,0)},children:[(0,d.jsx)(CustomVoiceAvatar,{}),(0,d.jsxs)(`span`,{className:`xmimo-tts-voice-option-copy`,children:[(0,d.jsx)(`strong`,{children:r}),(0,d.jsx)(`small`,{children:i})]}),b===void 0?(0,d.jsx)(VoicePresetCheck,{}):null]}),_.map((e,n)=>(0,d.jsxs)(`button`,{ref:e=>{h.current[n+(a?0:1)]=e},type:`button`,role:`option`,"aria-selected":b?.id===e.id,disabled:t,className:b?.id===e.id?`xmimo-tts-builtin-voice-option xmimo-tts-builtin-voice-option-selected`:`xmimo-tts-builtin-voice-option`,onClick:()=>{choose(e.prompt)},onKeyDown:e=>{handleOptionKeyDown(e,n+(a?0:1))},children:[(0,d.jsx)(VoicePresetAvatar,{preset:e,minimal:a}),(0,d.jsxs)(`span`,{className:`xmimo-tts-voice-option-copy`,children:[(0,d.jsx)(`strong`,{children:e.label}),(0,d.jsx)(`small`,{children:e.summary})]}),b?.id===e.id?(0,d.jsx)(VoicePresetCheck,{}):null]},e.id))]}):null]})}function useAccordionViewport(e,t){let n=(0,l.useRef)(null),r=(0,l.useRef)(null);return(0,l.useLayoutEffect)(()=>{let t=n.current,i=t?.closest(`.xmimo-ui-accordion`),a=t?.firstElementChild;if(!e||!t||!i||!a)return;let o=[];for(let e=i.parentElement;e;e=e.parentElement)e!==document.scrollingElement&&/auto|scroll/.test(getComputedStyle(e).overflowY)&&o.push(e);let s=document.scrollingElement;s&&!/hidden|clip/.test(getComputedStyle(s).overflowY)&&o.push(s);let bounds=()=>{let e=window.visualViewport,t=e?.offsetTop??0,n=t+(e?.height??window.innerHeight);for(let e of o){if(e===s)continue;let r=e.getBoundingClientRect();t=Math.max(t,r.top+e.clientTop),n=Math.min(n,r.top+e.clientTop+e.clientHeight)}return{top:t+12,bottom:n-12}},sizeContent=()=>{let{top:e,bottom:t}=bounds(),n=i.querySelector(`.xmimo-ui-module-header`);a.style.maxHeight=`${Math.max(0,t-e-n.offsetHeight-2)}px`};sizeContent();let c=0,l=!1,cancel=()=>{l=!0,cancelAnimationFrame(c)},align=()=>{if(l||r.current===null)return;let{top:e,bottom:t}=bounds(),n=i.getBoundingClientRect(),a=Math.max(e,Math.min(r.current,t-n.height));for(let e of o){let t=i.getBoundingClientRect().top-a;if(Math.abs(t)<1)break;e.scrollTo({top:e.scrollTop+t,behavior:`instant`})}let s=i.parentElement?.querySelectorAll(`.xmimo-ui-accordion-collapse`)??[];Array.from(s).some(e=>e.getAnimations().some(e=>e.playState===`running`))&&(c=requestAnimationFrame(align))};c=requestAnimationFrame(align),window.addEventListener(`resize`,sizeContent),window.visualViewport?.addEventListener(`resize`,sizeContent);let u=[`wheel`,`touchstart`,`pointerdown`,`keydown`];for(let e of u)window.addEventListener(e,cancel,{passive:!0});let d=0,p=new ResizeObserver(()=>{cancelAnimationFrame(d),d=requestAnimationFrame(sizeContent)});for(let e of o)e!==s&&p.observe(e);return()=>{cancel(),p.disconnect(),cancelAnimationFrame(d),window.removeEventListener(`resize`,sizeContent),window.visualViewport?.removeEventListener(`resize`,sizeContent);for(let e of u)window.removeEventListener(e,cancel)}},[e]),{panel:n,toggle:()=>{r.current=e?null:n.current?.closest(`.xmimo-ui-accordion`)?.getBoundingClientRect().top??null,t()}}}function CollapsibleModule({className:e,title:t,summary:n,interactiveSummary:r=!1,open:i,onToggle:a,ariaLabel:o,children:s}){let c=(0,l.useId)(),{panel:u,toggle:p}=useAccordionViewport(i,a);return(0,d.jsx)(ModuleShell,{className:`xmimo-ui-accordion ${e}`,title:t,summary:n,interactiveSummary:r,collapsible:!0,open:i,onToggle:p,toggleId:`${c}-trigger`,controlsId:`${c}-panel`,ariaLabel:o,children:(0,d.jsx)(`div`,{id:`${c}-panel`,role:`region`,"aria-labelledby":`${c}-trigger`,className:`xmimo-ui-accordion-collapse${i?` xmimo-ui-accordion-collapse-open`:``}`,"aria-hidden":!i,ref:e=>{u.current=e,e&&(e.inert=!i)},children:(0,d.jsx)(`div`,{className:`xmimo-ui-accordion-content`,children:s})})})}function useNestedDisclosure(e){let t=(0,l.useRef)(null);return(0,l.useEffect)(()=>{!e&&t.current&&(t.current.open=!1)},[e]),t}let Bi=[{value:k[0],labelKey:`preset`},{value:k[1],labelKey:`voiceDesign`}];function readScopeLabel(e){return e===`smart`?`settings.readScopeSmart`:e===`full`?`settings.readScopeFull`:`settings.readScopeFirstSegment`}function readScopeHint(e){return e===`smart`?`settings.readScopeSmartHint`:e===`full`?`settings.readScopeFullHint`:`settings.readScopeFirstSegmentHint`}function ModelPicker({value:e,disabled:t,label:n,presetLabel:r,voiceDesignLabel:i,onChange:a}){let o=Bi.map(e=>({value:e.value,label:e.labelKey===`preset`?r:i}));return(0,d.jsx)(`div`,{className:`xmimo-tts-settings-segmented-wrap`,"data-xmimo-select-option":`true`,children:(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-model`,value:e,options:o,label:n,disabled:t,onChange:a,className:`xmimo-tts-settings-segmented`})})}function DetailsModule({externalSelection:e,onExternalSelectionChange:t,t:n,provider:r,doubaoModel:i,doubaoVoice:a,doubaoClonedVoice:o,breezeVoice:s,breezeInstruction:c,speechInstruction:p,onSpeechInstructionChange:m,onDoubaoModelChange:h,onDoubaoVoiceChange:g,onDoubaoClonedVoiceChange:_,onBreezeVoiceChange:v,onBreezeInstructionChange:b,open:x,minimal:S,writable:C,autoPlay:w,voiceVolume:E,voiceRate:D,readScope:k,model:M,localSpeechMode:I,localVoiceURI:V,localVoiceEngine:ee,mossEnabled:te,mossBaseURL:re,mossVoice:se,mossVoiceName:ce,voice:le,voiceDesignPrompt:H,voiceDesignCustomPrompt:ue,fieldOverridden:de,resetField:fe,onToggle:pe,onVoiceVolumeChange:U,onVoiceVolumeInteractionEnd:me,onVoiceRateChange:he,onVoiceRateInteractionEnd:xe,onReadScopeChange:Se,onModelChange:Ce,onVoiceDesignPromptChange:W,onVoiceChange:we,onLocalVoiceURIChange:Te,onLocalVoiceEngineChange:Ee,onMossBaseURLChange:De,onMossVoiceChange:Oe,onLocalSpeechModeChange:ke}){useEngineState();let Ae=externalEngine(),Me=C&&!Ae,[Ne,Pe]=(0,l.useState)(null),Fe=useNestedDisclosure(x),Ie=(0,l.useCallback)(e=>{Pe(e)},[]),Re=ee===`browser`?Ne!==!1:!0;(0,l.useEffect)(()=>{!Re&&I!==`auto`&&ke(`auto`)},[I,Re,ke]);let He=n(r===`doubao`?i===`seed-icl-2.0`?`settings.doubaoCloneModel`:`settings.doubaoStandardModel`:M===`mimo-v2.5-tts-voicedesign`?`settings.summaryVoiceDesignModel`:`settings.summaryPresetModel`),Ue=P.find(e=>e.prompt===H),Ke=r===`doubao`?i===`seed-icl-2.0`?o||n(`settings.doubaoVoiceId`):Ve.find(e=>e.value===a)?.name??a:r===`breeze`?breezeVoiceLabel(s):M===`mimo-v2.5-tts-voicedesign`?Ue?.label??n(`settings.customVoiceOption`):le,Je=n(readScopeLabel(k)),Ye=n(I===`auto`?`settings.localSpeechAutoSummary`:I===`local-first`?`settings.localSpeechFirst`:`settings.localSpeechDisabled`),Ze=`${Math.round(E*100)}%`,Qe=`${D.toFixed(1)}×`,et=r===`doubao`?`doubaoInstruction`:r===`breeze`?`breezeInstruction`:`instruction`,tt=r!==`doubao`||i===`seed-tts-2.0`,nt=r===`breeze`?c:p,rt=tt?speechInstructionLabel(r,nt,n):null,it=(0,d.jsxs)(`div`,{className:`xmimo-tts-format`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.readScope`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:de(`readScope`),resettable:!0,disabled:!C,onReset:()=>{fe(`readScope`)}}),(0,d.jsx)(`div`,{className:`xmimo-tts-settings-segmented-wrap`,"data-xmimo-select-option":`true`,children:(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-read-scope`,value:k,options:F.map(e=>({value:e,label:n(readScopeLabel(e))})),label:n(`settings.readScope`),disabled:!C,onChange:Se,className:`xmimo-tts-settings-segmented`})}),S?null:(0,d.jsx)(`small`,{children:n(readScopeHint(k))})]});return(0,d.jsx)(CollapsibleModule,{className:`xmimo-tts-settings-module xmimo-tts-details xmimo-ui-module`,title:(0,d.jsxs)(`span`,{className:`xmimo-ui-module-title`,children:[(0,d.jsx)(RiEqualizerLine,{size:14,"aria-hidden":`true`,focusable:`false`}),n(`settings.detailedVoiceConfig`)]}),ariaLabel:n(`settings.detailedVoiceConfig`),summary:(0,d.jsxs)(`span`,{className:`xmimo-tts-details-summary xmimo-ui-summary`,children:[(0,d.jsx)(`span`,{children:Ze}),(0,d.jsx)(`span`,{children:Qe}),(0,d.jsx)(`span`,{children:Je}),Ae?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`span`,{children:Ae.name}),(0,d.jsx)(`span`,{children:e?.model??Ae.modelName}),(0,d.jsx)(`span`,{children:e?.voice??Ae.voiceName})]}):(0,d.jsxs)(d.Fragment,{children:[r===`breeze`?null:(0,d.jsx)(`span`,{children:He}),(0,d.jsx)(`span`,{children:Ke}),rt===null?null:(0,d.jsx)(`span`,{title:`${n(`settings.speechInstruction`)}: ${nt.trim()||rt}`,children:rt})]}),S?null:(0,d.jsx)(`span`,{children:Ye})]}),open:x,onToggle:pe,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-grid xmimo-ui-grid xmimo-tts-details-body xmimo-ui-module-body`,children:[Ae?(0,d.jsx)(ExternalSpeechFields,{engine:Ae,selection:e,writable:C,minimal:S,t:n,onChange:t??(()=>{})}):(0,d.jsxs)(d.Fragment,{children:[r===`breeze`?null:(0,d.jsxs)(`div`,{className:`xmimo-tts-model`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.model`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:de(r===`doubao`?`doubaoModel`:`model`),resettable:!0,disabled:!Me,onReset:()=>{fe(r===`doubao`?`doubaoModel`:`model`)}}),r===`doubao`?(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-doubao-model`,value:i,options:[{value:`seed-tts-2.0`,label:n(`settings.doubaoStandardModel`)},{value:`seed-icl-2.0`,label:n(`settings.doubaoCloneModel`)}],label:n(`settings.model`),disabled:!Me,onChange:h,className:`xmimo-tts-settings-segmented xmimo-tts-doubao-models`}):(0,d.jsx)(ModelPicker,{value:M,disabled:!Me,label:n(`settings.model`),presetLabel:n(`settings.presetModelShort`),voiceDesignLabel:n(`settings.voiceDesignModelShort`),onChange:Ce}),w&&!S?(0,d.jsx)(`small`,{children:n(r===`doubao`?`settings.doubaoStreamingHint`:M===`mimo-v2.5-tts`?`settings.modelAutoPlayHintPreset`:`settings.modelAutoPlayHintVoiceDesign`)}):null]}),r===`breeze`?(0,d.jsxs)(`div`,{className:`xmimo-tts-voice`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.voice`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:de(`breezeVoice`),resettable:!0,disabled:!Me,onReset:()=>fe(`breezeVoice`)}),(0,d.jsx)(BreezeVoicePicker,{value:s,disabled:!Me,t:n,onChange:v})]}):r===`doubao`?(0,d.jsxs)(`div`,{className:`xmimo-tts-voice xmimo-tts-doubao-voice${i===`seed-icl-2.0`?` xmimo-tts-cloned-voice`:``}`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(i===`seed-icl-2.0`?`settings.doubaoClonedVoiceLabel`:`settings.voice`),suffix:(0,d.jsxs)(`small`,{className:`xmimo-tts-doubao-voice-hint`,children:[(0,d.jsx)(`a`,{href:i===`seed-icl-2.0`?`https://console.volcengine.com/speech/new/experience/clone?projectName=default`:`https://console.volcengine.com/speech/new/voices?projectName=default`,target:`_blank`,rel:`noopener noreferrer`,children:n(i===`seed-icl-2.0`?`settings.doubaoCreateVoice`:`settings.doubaoVoiceLibrary`)}),i===`seed-icl-2.0`?(0,d.jsxs)(d.Fragment,{children:[` `,n(`settings.doubaoCloneHint`)]}):null]}),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:de(i===`seed-icl-2.0`?`doubaoClonedVoice`:`doubaoVoice`),resettable:!0,disabled:!Me,onReset:()=>fe(i===`seed-icl-2.0`?`doubaoClonedVoice`:`doubaoVoice`)}),i===`seed-icl-2.0`?(0,d.jsx)(VoiceIdInput,{kind:`cloned`,value:o,disabled:!Me,label:n(`settings.doubaoClonedVoice`),historyLabel:n(`settings.doubaoClonedVoiceHistory`),t:n,onChange:_}):(0,d.jsx)(DoubaoVoicePicker,{value:a,disabled:!Me,minimal:S,onChange:g,t:n})]}):null,r===`xiaomi`&&M===`mimo-v2.5-tts-voicedesign`?(0,d.jsxs)(`div`,{className:`xmimo-tts-voice-design-prompt`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.voiceDesignPrompt`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:de(`voiceDesignPrompt`),resettable:!0,disabled:!Me,onReset:()=>{fe(`voiceDesignPrompt`)}}),(0,d.jsx)(VoiceDesignPresetPicker,{value:isPresetVoiceDesignPrompt(H)?H:Ri,disabled:!Me,label:n(`settings.voiceDesignPrompt`),customLabel:n(`settings.customVoiceOption`),customSummary:n(`settings.customVoiceSummary`),minimal:S,onChange:e=>{W(e===Ri?ue:e)}}),(0,d.jsx)(`textarea`,{value:H,rows:3,disabled:!Me,placeholder:n(`settings.voiceDesignPromptHint`),onChange:e=>{W(e.target.value)}}),S?null:(0,d.jsx)(`small`,{children:n(`settings.voiceDesignPromptHint`)})]}):null,r===`xiaomi`&&M===`mimo-v2.5-tts`?(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(`div`,{className:`xmimo-tts-voice`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.voice`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:de(`voice`),resettable:!0,disabled:!Me,onReset:()=>{fe(`voice`)}}),(0,d.jsx)(BuiltInVoicePicker,{value:le,disabled:!Me,label:n(`settings.voice`),minimal:S,onChange:we})]})}):null,tt?(0,d.jsxs)(`div`,{className:`xmimo-tts-voice xmimo-tts-speech-instruction`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.speechInstruction`),suffix:(0,d.jsx)(FieldInfo,{label:n(`settings.speechInstructionInfo`),text:n(`settings.speechInstructionLimitations`)}),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:de(et),resettable:!0,disabled:!Me,onReset:()=>fe(et)}),r===`breeze`?(0,d.jsx)(SpeechInstructionPicker,{provider:r,value:c,disabled:!Me,minimal:S,onChange:b,t:n}):(0,d.jsx)(SpeechInstructionPicker,{provider:r,value:p,disabled:!Me,minimal:S,onChange:m,t:n})]}):null]}),(0,d.jsxs)(`details`,{ref:Fe,className:`xmimo-tts-more-settings`,children:[(0,d.jsxs)(`summary`,{className:`xmimo-tts-builtin-voice-trigger`,children:[(0,d.jsx)(`span`,{children:n(`settings.more`)}),(0,d.jsx)(`span`,{className:`xmimo-tts-more-settings-hint`,children:n(`settings.moreHint`)}),(0,d.jsx)(RiArrowDownSLine,{className:`xmimo-tts-voice-picker-chevron`,size:16,"aria-hidden":`true`,focusable:`false`})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-more-settings-body`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-playback-controls`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-volume`,children:[(0,d.jsx)(SettingFieldHeading,{label:`${n(`settings.voiceVolume`)} ${Ze}`,overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:de(`voiceVolume`),resettable:!0,disabled:!C,onReset:()=>{fe(`voiceVolume`)}}),(0,d.jsx)(EnergyVolumeSlider,{value:E,label:n(`settings.voiceVolume`),minimal:S,disabled:!C,onChange:U,onInteractionEnd:me})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-volume`,children:[(0,d.jsx)(SettingFieldHeading,{label:`${n(`settings.voiceRate`)} ${D.toFixed(1)}×`,suffix:(0,d.jsx)(FieldInfo,{label:n(`settings.voiceRateInfo`),text:n(`settings.voiceRateHint`)}),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:de(`voiceRate`),resettable:!0,disabled:!C,onReset:()=>{fe(`voiceRate`)}}),(0,d.jsx)(EnergyVolumeSlider,{value:D,min:.5,max:2,step:.1,formatValue:e=>`${e.toFixed(1)}×`,label:n(`settings.voiceRate`),minimal:S,disabled:!C,onChange:he,onInteractionEnd:xe})]})]}),S?null:(0,d.jsx)(LocalVoiceModule,{t:n,minimal:S,writable:C,localSpeechMode:I,engine:ee,mossEnabled:te,browserVoiceURI:V,mossBaseURL:re,mossVoice:se,mossVoiceName:ce,fieldOverridden:de,resetField:fe,onEngineChange:Ee,onBrowserVoiceChange:Te,onMossBaseURLChange:De,onMossVoiceChange:Oe,onBrowserAvailabilityChange:Ie}),it,S?null:(0,d.jsxs)(`div`,{className:`xmimo-tts-format`,children:[(0,d.jsx)(SettingFieldHeading,{label:n(`settings.localSpeechMode`),overriddenLabel:n(`settings.overridden`),resetLabel:n(`settings.reset`),overridden:de(`localSpeechMode`),resettable:!0,disabled:!C,onReset:()=>{fe(`localSpeechMode`)}}),(0,d.jsx)(`div`,{className:`xmimo-tts-settings-segmented-wrap`,"data-xmimo-select-option":`true`,children:(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-local-speech-mode`,value:I,options:A.map(e=>({value:e,label:n(e===`auto`?`settings.localSpeechAuto`:e===`local-first`?`settings.localSpeechFirst`:`settings.localSpeechDisabled`),disabled:!Re&&e!==`auto`})),label:n(`settings.localSpeechMode`),disabled:!C,onChange:ke,className:`xmimo-tts-settings-segmented`})}),(0,d.jsx)(`small`,{children:n(Re?I===`auto`?`settings.localSpeechAutoHint`:I===`local-first`?`settings.localSpeechFirstHint`:`settings.localSpeechDisabledHint`:`settings.localSpeechUnavailableHint`)})]})]})]})]})})}let Vi=[{id:`question-titles`,label:`settings.announcementsQuestions`,hint:`settings.announcementsQuestionsHint`,href:null},{id:`approvals`,label:`settings.announcementsApprovals`,hint:`settings.announcementsApprovalsHint`,href:null},{id:`job-results`,label:`settings.announcementsJobs`,hint:`settings.announcementsJobsHint`,href:null}],Hi=[{id:`dsh-pet`,label:`settings.announcementsPet`,hint:`settings.announcementsPetHint`,href:`https://github.com/PC2005-cloud/dsh-pet`},{id:`dsh-whale-musume`,label:`settings.announcementsWhale`,hint:`settings.announcementsWhaleHint`,href:`https://github.com/Sutera-Diffusus/dsh-whale-musume`}],Ui=[...Vi,...Hi],Wi=[{label:`settings.announcementsTitle`,hint:`settings.announcementsHint`,options:Vi},{label:`settings.announcementsPlugins`,hint:`settings.announcementsPluginsHint`,options:Hi}];function AnnouncementSettings({children:e,t,sources:n,qqbotEnabled:r,onQqbotChange:i,voiceInputCompatibility:a,onVoiceInputCompatibilityChange:o,voiceInputCompatibilityOverridden:s,onVoiceInputCompatibilityReset:c,showInHostSettings:l,onShowInHostSettingsChange:p,showInHostSettingsOverridden:m,onShowInHostSettingsReset:h,showFeatureGuide:g,onShowFeatureGuideChange:_,showFeatureGuideOverridden:v,onShowFeatureGuideReset:b,acceptExternalProviders:x,onAcceptExternalProvidersChange:S,acceptExternalProvidersOverridden:C,onAcceptExternalProvidersReset:w,inputAvoidance:E,onInputAvoidanceChange:D,inputAvoidanceOverridden:k,onInputAvoidanceReset:A,importantAnnouncementsFirst:M,onImportantAnnouncementsFirstChange:P,importantAnnouncementsFirstOverridden:F,onImportantAnnouncementsFirstReset:I,writable:V,overridden:ee,onChange:re,onReset:se,parentOpen:ce=!0}){let le=useNestedDisclosure(ce),H=[{label:`settings.voiceInputCompatibility`,hint:`settings.voiceInputCompatibilityHint`,checked:a,overridden:s,onChange:o,onReset:c},{label:`settings.showInHostSettings`,hint:`settings.showInHostSettingsHint`,checked:l,overridden:m,onChange:p,onReset:h},{label:`settings.showFeatureGuide`,hint:`settings.showFeatureGuideHint`,checked:g,overridden:v,onChange:_,onReset:b},{label:`settings.acceptExternalProviders`,hint:`settings.acceptExternalProvidersHint`,checked:x,overridden:C,onChange:S,onReset:w},{label:`settings.inputAvoidance`,hint:`settings.inputAvoidanceHint`,checked:E,overridden:k,onChange:D,onReset:A},{label:`settings.importantAnnouncementsFirst`,hint:`settings.importantAnnouncementsFirstHint`,checked:M,overridden:F,onChange:P,onReset:I}];return(0,d.jsxs)(`details`,{ref:le,className:`xmimo-tts-more-settings`,children:[(0,d.jsxs)(`summary`,{className:`xmimo-tts-builtin-voice-trigger`,children:[(0,d.jsx)(`span`,{children:t(`settings.more`)}),(0,d.jsx)(`span`,{className:`xmimo-tts-more-settings-hint`,children:t(`settings.announcementsMoreHint`)}),(0,d.jsx)(RiArrowDownSLine,{className:`xmimo-tts-voice-picker-chevron`,size:16,"aria-hidden":`true`,focusable:`false`})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-more-settings-body`,children:[e,(0,d.jsxs)(`section`,{className:`xmimo-tts-format xmimo-tts-switch-grid`,"aria-label":t(`settings.hostIntegration`),children:[(0,d.jsx)(SettingFieldHeading,{label:t(`settings.hostIntegration`),resettable:!1,disabled:!V}),H.map(e=>(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(SettingFieldHeading,{label:t(e.label),overriddenLabel:t(`settings.overridden`),resetLabel:t(`settings.reset`),overridden:e.overridden,resettable:!0,disabled:!V,onReset:e.onReset}),(0,d.jsx)(`small`,{children:t(e.hint)})]}),(0,d.jsx)(u.Switch,{checked:e.checked,disabled:!V,label:t(e.label),onChange:e.onChange})]},e.label))]}),Wi.map((e,a)=>(0,d.jsxs)(`section`,{className:`xmimo-tts-format xmimo-tts-switch-grid`,"aria-label":t(e.label),children:[(0,d.jsx)(SettingFieldHeading,{label:t(e.label),suffix:(0,d.jsx)(FieldInfo,{label:t(e.label),text:t(e.hint)}),overriddenLabel:t(`settings.overridden`),resetLabel:t(`settings.reset`),overridden:a===0&&ee,resettable:!0,disabled:!V,onReset:se}),e.options.map(e=>(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`div`,{children:[e.href?(0,d.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[t(e.label),` ↗`]}):(0,d.jsx)(`span`,{children:t(e.label)}),(0,d.jsx)(`small`,{children:t(e.hint)})]}),(0,d.jsx)(u.Switch,{checked:n.includes(e.id),disabled:!V,label:t(e.label),onChange:t=>re(te.filter(r=>r===e.id?t:n.includes(r)))})]},e.id)),a===1?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`a`,{href:`https://github.com/tencent-connect/dsh-qqbot`,target:`_blank`,rel:`noopener noreferrer`,children:[t(`settings.qqbotIntegration`),` ↗`]}),(0,d.jsx)(`small`,{children:t(`settings.qqbotIntegrationHint`)})]}),(0,d.jsx)(u.Switch,{checked:r,disabled:!V,label:t(`settings.qqbotIntegration`),onChange:i})]}),(0,d.jsx)(`div`,{className:`xmimo-tts-announcement-source`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(`a`,{href:`https://github.com/ppy-web/whaletalk-passport#readme`,target:`_blank`,rel:`noopener noreferrer`,children:[t(`settings.passportIntegration`),` ↗`]}),(0,d.jsx)(`small`,{children:t(`settings.passportIntegrationHint`)})]})})]}):null]},e.label))]})]})}function PlaybackIcon({state:e}){return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:e===`play`?(0,d.jsx)(`path`,{d:`M6 3.8a.8.8 0 0 1 1.2-.7l7.3 5.2a.85.85 0 0 1 0 1.4l-7.3 5.2a.8.8 0 0 1-1.2-.7Z`}):e===`stop`?(0,d.jsx)(`rect`,{x:`4`,y:`4`,width:`10`,height:`10`,rx:`1`}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`rect`,{x:`4`,y:`3`,width:`3.5`,height:`12`,rx:`1`}),(0,d.jsx)(`rect`,{x:`10.5`,y:`3`,width:`3.5`,height:`12`,rx:`1`})]})})}let Gi={zh:[{label:`笑声`,tags:[`[笑]`,`[轻笑]`,`[咯咯笑]`]},{label:`哭声与疼痛`,tags:[`[哭声]`,`[抽泣]`,`[呜咽]`,`[呻吟]`,`[哀号]`]},{label:`呼吸`,tags:[`[叹气]`,`[惊呼]`,`[吸气]`,`[呼气]`,`[喘息]`]},{label:`发声方式`,tags:[`[耳语]`,`[喊叫]`,`[惨叫]`,`[唱歌]`,`[哼歌]`,`[结巴]`,`[停顿]`]},{label:`喉咙与鼻音`,tags:[`[清嗓]`,`[咳嗽]`,`[吸鼻子]`,`[咂嘴]`,`[啧嘴]`]},{label:`身体反应`,tags:[`[打哈欠]`,`[打喷嚏]`,`[打嗝]`,`[打饱嗝]`,`[吞咽]`,`[干呕]`]},{label:`情绪反应`,tags:[`[闷哼]`,`[冷笑]`,`[哼鼻子]`]}],en:[{label:`Laughter`,tags:[`(laughs)`,`(chuckles)`,`(giggles)`]},{label:`Crying & pain`,tags:[`(cries)`,`(sobs)`,`(whimpers)`,`(groans)`,`(moans)`]},{label:`Breathing`,tags:[`(sighs)`,`(gasps)`,`(inhales)`,`(exhales)`,`(breathes heavily)`]},{label:`Vocal delivery`,tags:[`(whispers)`,`(shouts)`,`(screams)`,`(sings)`,`(hums)`,`(stutters)`,`(pauses)`]},{label:`Throat & nose`,tags:[`(clears throat)`,`(coughs)`,`(sniffles)`,`(lip smacks)`,`(clicks tongue)`]},{label:`Body reflexes`,tags:[`(yawns)`,`(sneezes)`,`(hiccups)`,`(burps)`,`(gulps)`,`(gags)`]},{label:`Emotional reactions`,tags:[`(grunts)`,`(scoffs)`,`(snorts)`]}]};function AudioTagPicker({provider:e,disabled:t,textRef:n,onInsert:r,t:i,tags:a}){let[o,s]=(0,l.useState)(`zh`),[c,p]=(0,l.useState)(!1),[h,g]=(0,l.useState)(!1),_=(0,l.useId)(),v=(0,l.useRef)(null),b=(0,l.useRef)(null),x=(0,l.useRef)(null),S=c&&!t,C=(0,u.useAnchoredPosition)({open:S,anchorRef:b,panelRef:x,side:`bottom`,align:`start`,gap:6,margin:12,layoutKey:`${e}:${o}`});(0,l.useEffect)(()=>{if(!S)return;let dismissOutside=e=>{let t=e.target;!(t instanceof Node)||v.current?.contains(t)||x.current?.contains(t)||h&&n.current?.contains(t)||p(!1)};return document.addEventListener(`pointerdown`,dismissOutside),document.addEventListener(`focusin`,dismissOutside),()=>{document.removeEventListener(`pointerdown`,dismissOutside),document.removeEventListener(`focusin`,dismissOutside)}},[S,h,n]),(0,l.useEffect)(()=>{if(!S)return;x.current?.querySelector(`button`)?.focus({preventScroll:!0});let onKeyDown=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),p(!1),b.current?.focus({preventScroll:!0}))};return document.addEventListener(`keydown`,onKeyDown),()=>document.removeEventListener(`keydown`,onKeyDown)},[S]);let w=e===`xiaomi`?ue.map(e=>({label:e[o],tags:(o===`zh`?e.tags:e.english).map(e=>`(${e})`),...`placement`in e?{placement:e.placement}:{}})):e===`external`?[{label:i(`settings.breezeAudioTags`),tags:(a??[]).map(e=>e.value)}]:Gi[o];return(0,d.jsxs)(`div`,{ref:v,className:S?`xmimo-tts-breeze-audio-tags xmimo-tts-breeze-audio-tags-open`:`xmimo-tts-breeze-audio-tags`,children:[(0,d.jsxs)(`button`,{type:`button`,ref:b,className:`xmimo-tts-breeze-audio-tags-toggle`,"aria-expanded":S,"aria-controls":S?_:void 0,"aria-haspopup":`dialog`,disabled:t,onClick:()=>p(e=>!e),children:[(0,d.jsx)(`span`,{children:i(`settings.breezeAudioTags`)}),(0,d.jsx)(RiArrowDownSLine,{className:`xmimo-tts-chevron`,size:14,"aria-hidden":`true`,focusable:`false`})]}),S?(0,m.createPortal)((0,d.jsxs)(`div`,{ref:x,id:_,className:`xmimo-ui-scope xmimo-tts-breeze-audio-tags-panel`,role:`dialog`,"aria-label":i(`settings.breezeAudioTags`),style:C??{visibility:`hidden`},children:[(0,d.jsx)(`small`,{children:i(e===`external`?`settings.externalOptionsHint`:e===`xiaomi`?`settings.xiaomiAudioTagsHint`:`settings.breezeAudioTagsHint`)}),(0,d.jsxs)(`div`,{className:`xmimo-tts-settings-segmented-wrap`,children:[e===`external`?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(u.Button,{type:`button`,"aria-pressed":o===`zh`,variant:o===`zh`?`primary`:`ghost`,size:`sm`,disabled:t,onClick:()=>s(`zh`),children:i(`settings.breezeAudioTagsChinese`)}),(0,d.jsx)(u.Button,{type:`button`,"aria-pressed":o===`en`,variant:o===`en`?`primary`:`ghost`,size:`sm`,disabled:t,onClick:()=>s(`en`),children:i(`settings.breezeAudioTagsEnglish`)})]}),(0,d.jsx)(u.Button,{type:`button`,className:`xmimo-tts-audio-tags-continuous`,"aria-label":i(`settings.audioTagsContinuous`),"aria-pressed":h,title:i(`settings.audioTagsContinuousHint`),variant:h?`primary`:`ghost`,size:`sm`,disabled:t,onClick:()=>g(e=>!e),children:h?(0,d.jsx)(RiPushpinFill,{size:14,"aria-hidden":`true`}):(0,d.jsx)(RiPushpinLine,{size:14,"aria-hidden":`true`})})]}),w.map(e=>(0,d.jsxs)(`div`,{className:`xmimo-tts-breeze-audio-tag-group`,children:[(0,d.jsx)(`strong`,{children:e.label}),(0,d.jsx)(`div`,{className:`xmimo-tts-breeze-audio-tag-list`,children:e.tags.map(n=>(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,disabled:t,onClick:()=>{h||p(!1),r(n,e.placement)},children:n},n))})]},e.label))]}),document.body):null]})}let Ki=`https://github.com/ppy-web/dsh-plugin-xiaomi-mimo-tts`,qi=`https://ppy-web.github.io/dsh-plugin-xiaomi-mimo-tts/#manual`;function ProviderSettings({t:e,writable:t,providerLocked:n=!1,doubaoEnabled:r,breezeEnabled:i,mossEnabled:a,onMossEnabledChange:o,onProviderEnabledChange:s}){let c=t&&!n;return(0,d.jsxs)(`section`,{className:`xmimo-tts-format xmimo-tts-provider-settings xmimo-tts-switch-grid`,"aria-label":e(`settings.provider`),children:[(0,d.jsx)(SettingFieldHeading,{label:e(`settings.provider`),suffix:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(FieldInfo,{label:e(`settings.provider`),text:e(`settings.providerMinimum`)}),(0,d.jsxs)(`a`,{className:`xmimo-tts-api-key-link`,href:`https://github.com/ppy-web/dsh-speech-provider-adapter`,target:`_blank`,rel:`noopener noreferrer`,children:[e(`settings.externalProviderAdapter`),` ↗`]})]}),resettable:!1,disabled:!t}),(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`span`,{className:`xmimo-tts-provider-settings-brand`,children:[(0,d.jsx)(`img`,{src:hostRoute(x.xiaomi),alt:``}),(0,d.jsx)(`span`,{children:`XiaoMi Mimo`})]}),(0,d.jsx)(u.Switch,{checked:!0,disabled:!0,label:`XiaoMi Mimo`,onChange:()=>{}})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`span`,{className:`xmimo-tts-provider-settings-brand`,children:[(0,d.jsx)(`img`,{src:hostRoute(x.doubao),alt:``}),(0,d.jsx)(`span`,{children:`DouBao Seed`})]}),(0,d.jsx)(u.Switch,{checked:r,disabled:!c||r&&!i,label:`DouBao Seed`,onChange:e=>s(`doubao`,e)})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`span`,{className:`xmimo-tts-more-provider-brand`,children:[(0,d.jsx)(`span`,{className:`xmimo-tts-breeze-wordmark`,role:`img`,"aria-label":`Breeze Blue`,style:{"--xmimo-breeze-wordmark":`url(${hostRoute(`/plugins/xiaomi-mimo-tts/provider-breeze-logo-light.png`)})`}}),(0,d.jsx)(u.Tag,{tone:`info`,className:`xmimo-tts-experimental-tag`,children:e(`settings.experimental`)})]}),(0,d.jsx)(u.Switch,{checked:i,disabled:!c||i&&!r,label:e(`settings.breezeEnabled`),onChange:e=>s(`breeze`,e)})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-announcement-source`,children:[(0,d.jsxs)(`span`,{className:`xmimo-tts-provider-settings-brand xmimo-tts-provider-settings-local`,children:[(0,d.jsx)(`img`,{src:hostRoute(`/plugins/xiaomi-mimo-tts/provider-moss-logo.svg`),alt:``}),(0,d.jsx)(`span`,{children:e(`settings.mossProvider`)}),(0,d.jsx)(u.Tag,{tone:`info`,className:`xmimo-tts-experimental-tag`,children:e(`settings.experimental`)})]}),(0,d.jsx)(u.Switch,{checked:a,disabled:!t,label:e(`settings.mossProvider`),onChange:o})]})]})}let Ji=[{label:`settings.previewPresetGreeting`,text:`settings.previewDefaultText`},{label:`settings.previewPresetPoetry`,text:`settings.previewDefaultTextPoetry`},{label:`settings.previewPresetInspiration`,text:`settings.previewDefaultTextInspiration`},{label:`settings.previewPresetReflection`,text:`settings.previewDefaultTextReflection`},{label:`settings.previewPresetHumor`,text:`settings.previewDefaultTextHumor`},{label:`settings.previewPresetNews`,text:`settings.previewDefaultTextNews`},{label:`settings.previewPresetStory`,text:`settings.previewDefaultTextStory`},{label:`settings.previewPresetService`,text:`settings.previewDefaultTextService`},{label:`settings.previewPresetDialogue`,text:`settings.previewDefaultTextDialogue`}];function filterAudioHistory(e,t,n){let r=t.trim().toLocaleLowerCase();return e.filter(e=>(n===`all`||e.source===n)&&e.text.toLocaleLowerCase().includes(r)).sort((e,t)=>t.createdAt-e.createdAt)}function historyFileSize(e){return e<1024*1024?`${e===0?0:Math.max(1,Math.round(e/1024))} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function historyTime(e){let t=Number.isFinite(e)?Math.max(0,Math.floor(e)):0;return`${Math.floor(t/60).toString().padStart(2,`0`)}:${(t%60).toString().padStart(2,`0`)}`}var HistoryDownloads=class{pending=new Map;download(e){this.downloadBlob(e.blob,`mimo-${new Date(e.createdAt).toISOString().replace(/[:.]/gu,`-`)}-${e.id.slice(0,8)}.${e.format}`)}downloadBlob(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t;try{document.body.appendChild(r),r.click()}catch(e){throw URL.revokeObjectURL(n),e}finally{r.remove()}this.pending.set(n,setTimeout(()=>{URL.revokeObjectURL(n),this.pending.delete(n)},1e3))}dispose(){for(let[e,t]of this.pending)clearTimeout(t),URL.revokeObjectURL(e);this.pending.clear()}};function PreviewModule({t:e,enabled:t,status:n,source:r,error:i,text:a,recording:o,onToggle:s,onTextChange:c,open:p,onToggleOpen:m,audioTagProvider:h,externalSelection:g,doubaoEnabled:_,breezeEnabled:v,mossEnabled:b,onMossEnabledChange:x,onProviderEnabledChange:S,...C}){useEngineState();let w=externalEngine(),E=w?.models?.find(e=>e.id===(g?.model??w.selection?.model))?.audioTags,D=(0,l.useRef)(null),[k]=(0,l.useState)(()=>new HistoryDownloads),[A,M]=(0,l.useState)(!1);(0,l.useEffect)(()=>()=>k.dispose(),[k]);let changeText=e=>{M(!1),c(e)},download=()=>{if(o!==null){M(!1);try{k.downloadBlob(o.blob,`tts-preview-${Date.now()}.${o.format}`)}catch{M(!0)}}},insertTag=(e,t)=>{let n=D.current;if(n===null)return;let r=t===`start`?0:n.selectionStart??a.length,i=t===`start`?0:n.selectionEnd??r,o=r>0&&!/\s$/u.test(a.slice(0,r))?` `:``;changeText(`${a.slice(0,r)}${o}${e}${a.slice(i)}`),requestAnimationFrame(()=>{n.focus();let t=r+o.length+e.length;n.setSelectionRange(t,t)})},P=n===`loading`||n===`playing`,F=w&&r===null?w.ready?`settings.externalManaged`:`settings.externalNotReady`:r===`external`&&n!==`error`?n===`loading`?`settings.externalLoading`:n===`playing`?`settings.externalPlaying`:`settings.externalCompleted`:n===`error`?i===`save-key-first`?`settings.previewSaveKeyFirst`:i===`voice-required`?`settings.doubaoVoiceRequired`:i===`voice-unavailable`?`settings.previewErrorVoiceUnavailable`:i===`resource-unavailable`?`settings.previewErrorResourceUnavailable`:i===`stream-buffer-limit`?`settings.previewErrorBufferLimit`:i===`api-key-not-configured`?`settings.previewErrorApiKeyMissing`:i===`api-key-rejected`?`settings.previewErrorApiKeyRejected`:i===`rate-limited`?`settings.previewErrorRateLimited`:i===`timeout`?`settings.previewErrorTimeout`:i===`local-voice-unavailable`?`settings.previewErrorLocalUnavailable`:i===`autoplay-blocked`?`settings.previewErrorAutoplay`:`settings.previewFailed`:n===`loading`?r===`doubao`?`settings.previewLoadingDoubao`:r===`breeze`?`settings.previewLoadingBreeze`:r===`local`?`settings.previewLoadingLocal`:`settings.previewLoadingMimo`:n===`playing`?r===`doubao`?`settings.previewPlayingDoubao`:r===`breeze`?`settings.previewPlayingBreeze`:r===`local`?`settings.previewPlayingLocal`:`settings.previewPlayingMimo`:r===`doubao`?`settings.previewCompletedDoubao`:r===`breeze`?`settings.previewCompletedBreeze`:r===`local`?`settings.previewCompletedLocal`:r===`mimo`?`settings.previewCompletedMimo`:`settings.previewHint`;return(0,d.jsx)(CollapsibleModule,{className:`xmimo-tts-settings-module xmimo-tts-broadcast`,title:(0,d.jsxs)(`span`,{className:`xmimo-ui-module-title`,children:[(0,d.jsx)(RiRadio2Line,{size:14,"aria-hidden":`true`,focusable:`false`}),e(`settings.previewTitle`)]}),ariaLabel:e(`settings.previewTitle`),open:p,onToggle:m,interactiveSummary:!0,summary:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`span`,{className:`xmimo-ui-summary`,children:[(0,d.jsxs)(`button`,{type:`button`,className:`xmimo-tts-preview-tag`,title:e(P?`settings.previewStop`:`settings.previewPlay`),"aria-label":e(P?`settings.previewStop`:`settings.previewPlay`),"aria-pressed":P,disabled:!t||!P&&a.trim().length===0,onClick:s,children:[(0,d.jsx)(PlaybackIcon,{state:P?`stop`:`play`}),(0,d.jsx)(`span`,{children:e(P?`settings.previewStopShort`:`settings.previewListen`)})]}),Ui.filter(e=>C.sources.includes(e.id)).map(t=>(0,d.jsx)(`span`,{children:e(t.label)},t.id)),C.qqbotEnabled?(0,d.jsx)(`span`,{children:e(`settings.qqbotIntegration`)}):null,C.sources.length===0&&!C.qqbotEnabled?(0,d.jsx)(`span`,{children:e(`settings.announcementsNone`)}):null]}),!p&&n===`error`?(0,d.jsx)(`small`,{className:`xmimo-tts-preview-summary-status xmimo-tts-failed`,role:`status`,children:e(F)}):null]}),children:(0,d.jsxs)(`div`,{className:`xmimo-tts-broadcast-body`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-format`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-preview-input`,children:[(0,d.jsx)(`textarea`,{ref:D,value:a,rows:5,maxLength:100,"aria-label":e(`settings.previewText`),placeholder:e(`settings.previewPlaceholder`),onChange:e=>{changeText(e.target.value)}}),(0,d.jsxs)(`div`,{className:`xmimo-tts-preview-tools`,children:[(0,d.jsx)(`div`,{className:`xmimo-tts-preview-presets`,role:`group`,"aria-label":e(`settings.previewPresets`),children:Ji.map(t=>(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-preview-preset`,"aria-pressed":a===e(t.text),title:e(t.text),onClick:()=>changeText(e(t.text)),children:e(t.label)},t.text))}),(0,d.jsxs)(`div`,{className:`xmimo-tts-preview-actions`,children:[w?E?.length?(0,d.jsx)(AudioTagPicker,{provider:`external`,tags:E,disabled:!t,textRef:D,onInsert:insertTag,t:e}):null:h?(0,d.jsx)(AudioTagPicker,{provider:h,disabled:!t||w!==null,textRef:D,onInsert:insertTag,t:e},h):null,(0,d.jsxs)(`div`,{className:`xmimo-tts-preview-playback-actions`,children:[(0,d.jsxs)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,className:`xmimo-tts-preview-toggle`,title:e(P?`settings.previewStop`:`settings.previewPlay`),"aria-label":e(P?`settings.previewStop`:`settings.previewPlay`),disabled:!t||!P&&a.trim().length===0,onClick:()=>{M(!1),s()},children:[(0,d.jsx)(PlaybackIcon,{state:P?`stop`:`play`}),(0,d.jsx)(`span`,{children:e(P?`settings.previewStopShort`:`settings.previewListen`)})]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,className:`xmimo-tts-preview-download`,"aria-label":e(`settings.previewDownload`),title:e(o===null?r===`local`?`settings.previewDownloadLocal`:`settings.previewDownloadUnavailable`:`settings.previewDownload`),disabled:o===null,onClick:download,children:[(0,d.jsx)(RiDownloadLine,{size:16,"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:e(`history.download`)})]})]})]})]})]}),(0,d.jsx)(`small`,{className:n===`error`?`xmimo-tts-failed`:`xmimo-tts-preview-status`,"aria-live":`polite`,children:e(F)}),A?(0,d.jsx)(`small`,{className:`xmimo-tts-failed`,role:`alert`,children:e(`settings.previewDownloadFailed`)}):null]}),(0,d.jsx)(ProviderSettings,{t:e,writable:C.writable,providerLocked:w!==null,doubaoEnabled:_,breezeEnabled:v,mossEnabled:b,onMossEnabledChange:x,onProviderEnabledChange:S}),(0,d.jsx)(AnnouncementSettings,{t:e,...C,parentOpen:p})]})})}function SoundEffectIcon({cue:e}){switch(e){case`start`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:(0,d.jsx)(`path`,{d:`M6 3.8a.8.8 0 0 1 1.2-.7l7.3 5.2a.85.85 0 0 1 0 1.4l-7.3 5.2a.8.8 0 0 1-1.2-.7Z`})});case`complete`:case`success`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,d.jsx)(`path`,{d:`M15 5L7 14L3 10`})});case`error`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,d.jsx)(`circle`,{cx:`9`,cy:`9`,r:`7`}),(0,d.jsx)(`path`,{d:`M12 6L6 12M6 6l6 6`})]});case`notification`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:[(0,d.jsx)(`path`,{d:`M9 2a1 1 0 0 1 1 1v.5a5 5 0 0 1 3 4.5v3l1.3 1.6a.5.5 0 0 1-.4.9H4.1a.5.5 0 0 1-.4-.9L5 11V8a5 5 0 0 1 3-4.5V3a1 1 0 0 1 1-1Z`}),(0,d.jsx)(`path`,{d:`M7 14.5a2 2 0 1 0 4 0`})]});case`press`:case`select`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,d.jsx)(`circle`,{cx:`9`,cy:`9`,r:`3`,fill:`currentColor`}),(0,d.jsx)(`path`,{d:`M9 2v2M9 14v2M16 9h-2M4 9H2M14.5 3.5l-1.4 1.4M4.9 12.7l-1.4 1.4M3.5 3.5l1.4 1.4M13.1 12.7l1.4 1.4`})]});case`toggle-on`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:[(0,d.jsx)(`rect`,{x:`3`,y:`6`,width:`12`,height:`6`,rx:`3`,opacity:`0.3`}),(0,d.jsx)(`circle`,{cx:`12`,cy:`9`,r:`2.5`})]});case`toggle-off`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:[(0,d.jsx)(`rect`,{x:`3`,y:`6`,width:`12`,height:`6`,rx:`3`,opacity:`0.3`}),(0,d.jsx)(`circle`,{cx:`6`,cy:`9`,r:`2.5`})]});case`send`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:(0,d.jsx)(`path`,{d:`M2 3a1 1 0 0 1 1.3-.95l12 4.5a1 1 0 0 1 0 1.9l-12 4.5A1 1 0 0 1 2 12V8.5L9 9 2 9.5V6Z`})});case`open`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,d.jsx)(`path`,{d:`M14 8V4h-4M14 4L8 10`}),(0,d.jsx)(`path`,{d:`M12 12v2a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h2`})]});case`close`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,d.jsx)(`path`,{d:`M13 5L5 13M5 5l8 8`})});case`delete`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:(0,d.jsx)(`path`,{d:`M6 2a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1h3a1 1 0 1 1 0 2h-1v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5H3a1 1 0 0 1 0-2h3V2Zm2 4a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z`})});case`stop`:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:(0,d.jsx)(`rect`,{x:`4`,y:`4`,width:`10`,height:`10`,rx:`1`})});case`queued`:return(0,d.jsxs)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:[(0,d.jsx)(`circle`,{cx:`9`,cy:`9`,r:`7`,opacity:`0.3`}),(0,d.jsx)(`path`,{d:`M9 5v4l3 2`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,fill:`none`})]});default:return(0,d.jsx)(`svg`,{width:18,height:18,viewBox:`0 0 18 18`,"aria-hidden":`true`,focusable:`false`,fill:`currentColor`,children:(0,d.jsx)(`circle`,{cx:`9`,cy:`9`,r:`7`})})}}function TbUfo(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M16.95 9.01c3.02 .739 5.05 2.123 5.05 3.714c0 2.367 -4.48 4.276 -10 4.276s-10 -1.909 -10 -4.276c0 -1.59 2.04 -2.985 5.07 -3.724`},child:[]},{tag:`path`,attr:{d:`M7 9c0 1.105 2.239 2 5 2s5 -.895 5 -2v-.035c0 -2.742 -2.239 -4.965 -5 -4.965s-5 2.223 -5 4.965v.035`},child:[]},{tag:`path`,attr:{d:`M15 17l2 3`},child:[]},{tag:`path`,attr:{d:`M8.5 17l-1.5 3`},child:[]},{tag:`path`,attr:{d:`M12 14h.01`},child:[]},{tag:`path`,attr:{d:`M7 13h.01`},child:[]},{tag:`path`,attr:{d:`M17 13h.01`},child:[]}]})(e)}function TbSettings(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065`},child:[]},{tag:`path`,attr:{d:`M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`},child:[]}]})(e)}function TbRipple(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 7c3 -2 6 -2 9 0s6 2 9 0`},child:[]},{tag:`path`,attr:{d:`M3 17c3 -2 6 -2 9 0s6 2 9 0`},child:[]},{tag:`path`,attr:{d:`M3 12c3 -2 6 -2 9 0s6 2 9 0`},child:[]}]})(e)}function TbMovie(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`},child:[]},{tag:`path`,attr:{d:`M8 4l0 16`},child:[]},{tag:`path`,attr:{d:`M16 4l0 16`},child:[]},{tag:`path`,attr:{d:`M4 8l4 0`},child:[]},{tag:`path`,attr:{d:`M4 16l4 0`},child:[]},{tag:`path`,attr:{d:`M4 12l16 0`},child:[]},{tag:`path`,attr:{d:`M16 8l4 0`},child:[]},{tag:`path`,attr:{d:`M16 16l4 0`},child:[]}]})(e)}function TbMoonStars(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`},child:[]},{tag:`path`,attr:{d:`M17 4a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`},child:[]},{tag:`path`,attr:{d:`M19 11h2m-1 -1v2`},child:[]}]})(e)}function TbLeaf(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M5 21c.5 -4.5 2.5 -8 7 -10`},child:[]},{tag:`path`,attr:{d:`M9 18c6.218 0 10.5 -3.288 11 -12v-2h-4.014c-9 0 -11.986 4 -12 9c0 1 0 3 2 5h3l.014 0`},child:[]}]})(e)}function TbFeather(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 20l10 -10m0 -5v5h5m-9 -1v5h5m-9 -1v5h5m-5 -5l4 -4l4 -4`},child:[]},{tag:`path`,attr:{d:`M19 10c.638 -.636 1 -1.515 1 -2.486a3.515 3.515 0 0 0 -3.517 -3.514c-.97 0 -1.847 .367 -2.483 1m-3 13l4 -4l4 -4`},child:[]}]})(e)}function TbDiamond(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M6 5h12l3 5l-8.5 9.5a.7 .7 0 0 1 -1 0l-8.5 -9.5l3 -5`},child:[]},{tag:`path`,attr:{d:`M10 12l-2 -2.2l.6 -1`},child:[]}]})(e)}function TbDeviceGamepad2(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 5h3.5a5 5 0 0 1 0 10h-5.5l-4.015 4.227a2.3 2.3 0 0 1 -3.923 -2.035l1.634 -8.173a5 5 0 0 1 4.904 -4.019h3.4`},child:[]},{tag:`path`,attr:{d:`M14 15l4.07 4.284a2.3 2.3 0 0 0 3.925 -2.023l-1.6 -8.232`},child:[]},{tag:`path`,attr:{d:`M8 9v2`},child:[]},{tag:`path`,attr:{d:`M7 10h2`},child:[]},{tag:`path`,attr:{d:`M14 10h2`},child:[]}]})(e)}function TbCircle(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`},child:[]}]})(e)}function TbBounceRight(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M4 15.5c3 -1 5.5 -.5 8 4.5c.5 -3 1.5 -5.5 3 -8`},child:[]},{tag:`path`,attr:{d:`M18 9a2 2 0 1 1 0 -4a2 2 0 0 1 0 4`},child:[]}]})(e)}function TbAdjustmentsHorizontal(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`},child:[]},{tag:`path`,attr:{d:`M4 6l8 0`},child:[]},{tag:`path`,attr:{d:`M16 6l4 0`},child:[]},{tag:`path`,attr:{d:`M6 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`},child:[]},{tag:`path`,attr:{d:`M4 12l2 0`},child:[]},{tag:`path`,attr:{d:`M10 12l10 0`},child:[]},{tag:`path`,attr:{d:`M15 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`},child:[]},{tag:`path`,attr:{d:`M4 18l11 0`},child:[]},{tag:`path`,attr:{d:`M19 18l1 0`},child:[]}]})(e)}let Yi={minimal:TbCircle,soft:TbFeather,glass:TbDiamond,arcade:TbDeviceGamepad2,mechanical:TbSettings,organic:TbLeaf,dreamy:TbMoonStars,scifi:TbUfo,rubber:TbBounceRight,cinematic:TbMovie,studio:TbAdjustmentsHorizontal,zen:TbRipple};function SoundPackIcon({pack:e}){let t=Yi[e];return(0,d.jsx)(t,{className:`xmimo-tts-sound-pack-icon`,size:20,strokeWidth:1.8,"aria-hidden":`true`,focusable:`false`})}let Xi=[`start`,`complete`,`success`,`error`,`notification`,`press`,`select`,`toggle-on`,`toggle-off`,`send`,`open`,`close`,`delete`,`stop`,`queued`],Zi={minimal:`#8793a6`,soft:`#4fb7a5`,glass:`#6c8de7`,arcade:`#e58d4f`,mechanical:`#c97465`,organic:`#72ad61`,dreamy:`#b27fd0`,scifi:`#5d9bd4`,rubber:`#d2a044`,cinematic:`#7c77c6`,studio:`#71808e`,zen:`#58a6b0`};function SoundEffectsPanel({t:e,controller:t,enabled:n,volume:r,pack:i,taskSounds:a,clickSounds:o,writable:s,minimal:c,open:p,onToggle:m,onScopeChange:h,onVolumeChange:g,onPackChange:_}){let v=(0,l.useRef)([]),b=resolveSoundEffectsMode(n,a,o),x=e(b===`all`?`settings.soundEffectsOn`:b===`off`?`settings.soundEffectsOff`:b===`click`?`settings.soundEffectsClickOnly`:`settings.soundEffectsTaskOnly`),S=resolveSoundEffectsScope(a,o),selectPack=e=>{if(!(!s||!n)){if(e===i){t.preview(`press`);return}t.update({enabled:n,volume:r,pack:e,taskSounds:a,clickSounds:o}),_(e),t.play(`press`)}},focusPackOption=e=>{let t=(e+I.length)%I.length;requestAnimationFrame(()=>v.current[t]?.focus())},handlePackKeyDown=(e,t)=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),focusPackOption(t+1)):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),focusPackOption(t-1)):e.key===`Home`?(e.preventDefault(),focusPackOption(0)):e.key===`End`&&(e.preventDefault(),focusPackOption(I.length-1))},previewLabel=t=>e(`settings.soundEffectsPreview.${t}`);return(0,d.jsx)(CollapsibleModule,{className:`xmimo-tts-settings-module xmimo-tts-sound-effects xmimo-ui-module`,title:(0,d.jsxs)(`span`,{className:`xmimo-ui-module-title`,children:[(0,d.jsx)(RiDiscLine,{size:14,"aria-hidden":`true`,focusable:`false`}),e(`settings.soundEffectsTitle`)]}),ariaLabel:e(`settings.soundEffectsTitle`),summary:(0,d.jsxs)(`span`,{className:`xmimo-tts-sound-summary xmimo-ui-summary`,children:[(0,d.jsx)(`span`,{children:x}),(0,d.jsxs)(`span`,{children:[e(`settings.soundEffectsVolume`),` `,Math.round(r*100),`%`]}),(0,d.jsx)(`span`,{children:i})]}),open:p,onToggle:m,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-sound-body xmimo-ui-module-body`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-sound-scope-section`,children:[(0,d.jsx)(`span`,{children:e(`settings.soundEffectsScope`)}),(0,d.jsx)(u.SegmentedControl,{id:`xmimo-tts-sound-scope`,value:S,options:V.map(t=>({value:t,label:e(t===`all`?`settings.soundEffectsOn`:t===`click`?`settings.soundEffectsClickOnly`:`settings.soundEffectsTaskOnly`)})),label:e(`settings.soundEffectsScope`),disabled:!s,onChange:h,className:`xmimo-tts-settings-segmented xmimo-tts-sound-scope`})]}),(0,d.jsxs)(`label`,{className:`xmimo-tts-sound-volume`,children:[(0,d.jsxs)(`span`,{children:[e(`settings.soundEffectsVolume`),` `,Math.round(r*100),`%`]}),(0,d.jsx)(EnergyVolumeSlider,{value:r,label:e(`settings.soundEffectsVolume`),minimal:c,disabled:!s||!n,onChange:e=>{t.setVolume(e),g(e)},onInteractionEnd:()=>{t.previewVolume()}})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-sound-pack`,children:[(0,d.jsx)(`span`,{id:`xmimo-tts-sound-pack-label`,children:e(`settings.soundEffectsPack`)}),(0,d.jsx)(`div`,{className:`xmimo-tts-sound-pack-grid`,role:`radiogroup`,"aria-labelledby":`xmimo-tts-sound-pack-label`,children:I.map((e,t)=>(0,d.jsxs)(`button`,{ref:e=>{v.current[t]=e},type:`button`,role:`radio`,"data-xmimo-sound-pack-option":`true`,style:{"--xmimo-sound-pack-accent":Zi[e]},"aria-checked":i===e,tabIndex:i===e?0:-1,className:[`xmimo-tts-sound-pack-option`,i===e?`xmimo-tts-sound-pack-option-selected`:``].filter(Boolean).join(` `),disabled:!s||!n,onClick:()=>{selectPack(e)},onKeyDown:e=>{handlePackKeyDown(e,t)},children:[(0,d.jsx)(SoundPackIcon,{pack:e}),(0,d.jsx)(`span`,{className:`xmimo-tts-sound-pack-name`,children:e})]},e))})]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-sound-preview-section`,children:[(0,d.jsx)(`span`,{id:`xmimo-tts-sound-preview-label`,children:e(`settings.soundEffectsPreviewLabel`)}),(0,d.jsx)(`div`,{className:`xmimo-tts-sound-previews`,role:`group`,"aria-labelledby":`xmimo-tts-sound-preview-label`,children:Xi.map(e=>(0,d.jsxs)(`button`,{type:`button`,"data-xmimo-sound-preview":`true`,disabled:!n,"aria-label":previewLabel(e),onClick:()=>{t.preview(e)},children:[(0,d.jsx)(SoundEffectIcon,{cue:e}),(0,d.jsx)(`span`,{children:previewLabel(e)})]},e))})]}),s?null:(0,d.jsx)(`small`,{children:e(`settings.readOnly`)})]})})}function LuStar(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`},child:[]}]})(e)}function LuSettings(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`3`},child:[]}]})(e)}function LuPanelLeftOpen(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`},child:[]},{tag:`path`,attr:{d:`M9 3v18`},child:[]},{tag:`path`,attr:{d:`m14 9 3 3-3 3`},child:[]}]})(e)}function LuPanelLeftClose(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`},child:[]},{tag:`path`,attr:{d:`M9 3v18`},child:[]},{tag:`path`,attr:{d:`m16 15-3-3 3-3`},child:[]}]})(e)}function LuBookOpen(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 7v14`},child:[]},{tag:`path`,attr:{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`},child:[]}]})(e)}function LuAudioLines(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M2 10v3`},child:[]},{tag:`path`,attr:{d:`M6 6v11`},child:[]},{tag:`path`,attr:{d:`M10 3v18`},child:[]},{tag:`path`,attr:{d:`M14 8v7`},child:[]},{tag:`path`,attr:{d:`M18 5v13`},child:[]},{tag:`path`,attr:{d:`M22 10v3`},child:[]}]})(e)}function SidebarSettings({t:e,value:t,disabled:n,onToggle:r}){let i=t?LuPanelLeftClose:LuPanelLeftOpen;return(0,d.jsxs)(u.Button,{type:`button`,variant:`toolbar`,size:`sm`,disabled:n,"aria-pressed":t,onClick:r,children:[(0,d.jsx)(i,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{className:`xmimo-tts-action-label`,children:e(t?`settings.unmountSidebar`:`settings.mountSidebar`)})]})}async function withSidebarLoading(e,t,n){let r=document.createElement(`dialog`);r.className=`xmimo-ui-scope xmimo-tts-sidebar-loading`,r.tabIndex=-1;let i=t(e?`settings.mountingSidebar`:`settings.unmountingSidebar`);r.setAttribute(`aria-label`,i),r.addEventListener(`cancel`,e=>e.preventDefault());let a=document.createElement(`div`);a.className=`xmimo-tts-sidebar-loading-status`,a.setAttribute(`role`,`status`),a.setAttribute(`aria-live`,`polite`),a.setAttribute(`aria-busy`,`true`);let o=document.createElement(`span`);o.className=`xmimo-tts-sidebar-loading-spinner`,o.setAttribute(`aria-hidden`,`true`);let s=document.createElement(`span`);s.textContent=i,a.append(o,s),r.append(a),document.body.append(r);try{return r.showModal(),await afterPaint(),await n()}finally{await afterPaint(),r.close(),r.remove()}}function afterPaint(){return new Promise(e=>{let t,finish=()=>{clearTimeout(n),t!==void 0&&cancelAnimationFrame(t),e()},n=setTimeout(finish,100);t=requestAnimationFrame(()=>{t=requestAnimationFrame(finish)})})}function providerLabelKey(e){return e===`doubao`?`settings.providerDoubao`:e===`breeze`?`settings.providerBreeze`:`settings.providerXiaomi`}let Qi=[`--xmimo-holo-x`,`--xmimo-holo-y`,`--xmimo-holo-bg-x`,`--xmimo-holo-bg-y`,`--xmimo-holo-rx`,`--xmimo-holo-ry`];function useHoloHover(e){let t=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let n=t.current;if(!e||!n)return;let r=window.matchMedia(`(any-hover: hover) and (any-pointer: fine) and (prefers-reduced-motion: no-preference)`),i=null,a,o=0,s=0,reset=()=>{if(a!==void 0&&window.cancelAnimationFrame(a),a=void 0,i){i.removeAttribute(`data-xmimo-holo-active`);for(let e of Qi)i.style.removeProperty(e);i=null}},writable=e=>!e.matches(`:disabled`)&&!e.querySelector(`input:disabled`),draw=()=>{if(a=void 0,!i||!r.matches||document.hidden||!writable(i))return reset();let e=i.getBoundingClientRect();if(!e.width||!e.height)return reset();let t=Math.min(1,Math.max(0,(o-e.left)/e.width)),n=Math.min(1,Math.max(0,(s-e.top)/e.height));i.style.setProperty(`--xmimo-holo-x`,`${t*100}%`),i.style.setProperty(`--xmimo-holo-y`,`${n*100}%`),i.style.setProperty(`--xmimo-holo-bg-x`,`${(1-t)*100}%`),i.style.setProperty(`--xmimo-holo-bg-y`,`${(1-n)*100}%`),i.style.setProperty(`--xmimo-holo-rx`,`${(.5-n)*12}deg`),i.style.setProperty(`--xmimo-holo-ry`,`${(t-.5)*12}deg`),i.setAttribute(`data-xmimo-holo-active`,``)},track=e=>{if(!r.matches||document.hidden||e.pointerType===`touch`)return reset();let t=e.target instanceof Element?e.target.closest(`.xmimo-tts-character-toggle`):null;if(!t||!n.contains(t)||!writable(t))return reset();t!==i&&(reset(),i=t),o=e.clientX,s=e.clientY,a===void 0&&(a=window.requestAnimationFrame(draw))},leave=e=>{(!(e.relatedTarget instanceof Node)||!i?.contains(e.relatedTarget))&&reset()};return n.addEventListener(`pointerover`,track),n.addEventListener(`pointermove`,track),n.addEventListener(`pointerout`,leave),n.addEventListener(`pointerleave`,reset),n.addEventListener(`pointercancel`,reset),r.addEventListener(`change`,reset),document.addEventListener(`visibilitychange`,reset),window.addEventListener(`blur`,reset),window.addEventListener(`resize`,reset),window.addEventListener(`scroll`,reset,!0),()=>{reset(),n.removeEventListener(`pointerover`,track),n.removeEventListener(`pointermove`,track),n.removeEventListener(`pointerout`,leave),n.removeEventListener(`pointerleave`,reset),n.removeEventListener(`pointercancel`,reset),r.removeEventListener(`change`,reset),document.removeEventListener(`visibilitychange`,reset),window.removeEventListener(`blur`,reset),window.removeEventListener(`resize`,reset),window.removeEventListener(`scroll`,reset,!0)}},[e]),t}function CharacterToggle({kind:e,checked:t,disabled:n,label:r,stateLabel:i,minimal:a,onChange:o}){let s=t?`on`:`off`;return a?(0,d.jsxs)(`div`,{className:`xmimo-tts-minimal-control xmimo-tts-minimal-toggle`,"data-xmimo-sound-toggle":e===`sound`?`true`:void 0,onClick:e=>{e.target.closest(`button`)!==null||n||o(!t)},children:[(0,d.jsx)(`span`,{className:`xmimo-tts-minimal-toggle-label`,children:r}),(0,d.jsx)(u.Switch,{checked:t,disabled:n,label:`${r}: ${i}`,onChange:o})]}):(0,d.jsxs)(`label`,{className:`xmimo-tts-character-toggle xmimo-tts-character-toggle-${s}`,"data-xmimo-sound-toggle":e===`sound`?`true`:void 0,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:t,disabled:n,onChange:e=>{o(e.target.checked)}}),(0,d.jsxs)(`span`,{className:`xmimo-tts-character-control`,children:[a?null:(0,d.jsx)(`span`,{className:`xmimo-tts-character-portrait xmimo-tts-character-${e}-${s}`,style:{backgroundImage:`url(${hostRoute(e===`sound`?`/plugins/xiaomi-mimo-tts/sound-effects-toggle-characters.webp`:`/plugins/xiaomi-mimo-tts/toggle-characters.webp`)})`},"aria-hidden":`true`}),(0,d.jsx)(`span`,{className:`xmimo-tts-character-copy`,children:(0,d.jsx)(`strong`,{children:r})}),(0,d.jsxs)(`span`,{className:`xmimo-tts-character-state`,children:[(0,d.jsx)(`span`,{"aria-hidden":`true`}),i]})]})]})}function ProviderToggle({t:e,provider:t,doubaoEnabled:n,breezeEnabled:r,minimal:i,writable:a,switching:o,onChange:s,onExternalChange:c}){let p=useEngineState(),m=externalEngine(),h=m?`${m.provider}/${m.configurationId??``}`:t,g=m?`/plugins/xiaomi-mimo-tts/provider-external-takeover.webp`:b[t],[_,v]=(0,l.useState)(()=>({identity:h,turns:0,front:g,back:g}));if(_.identity!==h){let e=_.turns+1;v({identity:h,turns:e,front:e%2==0?g:_.front,back:e%2==1?g:_.back})}let x=nextTtsProvider(t,n,r),S=m?nextExternalConfiguration(m):void 0,C=m?.name??e(providerLabelKey(t)),w=S?.name??e(providerLabelKey(x)),E=m&&!S?`${C} · ${e(`settings.externalManaged`)}`:`${e(`settings.provider`)}: ${C} · ${e(`settings.switchProvider`)}: ${w}`,D=!a||o||m!==null&&(!S||p.status!==`ready`),change=()=>{D||(m&&S?c(m,S.id):s(x))},k=(0,d.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,d.jsx)(`path`,{d:`M3 7h18m-4-4 4 4-4 4M21 17H3m4-4-4 4 4 4`})});return i?(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,className:`xmimo-tts-minimal-control xmimo-tts-provider-button`,"data-xmimo-sound-toggle":`provider`,"aria-label":E,title:E,disabled:D,"aria-busy":o,onClick:change,children:[(0,d.jsx)(`span`,{children:C}),k]}):(0,d.jsx)(`button`,{type:`button`,className:`xmimo-tts-character-toggle xmimo-tts-character-toggle-on xmimo-tts-provider-toggle`,"data-provider":t,"data-external":m?`true`:void 0,"data-xmimo-sound-toggle":`provider`,"aria-label":E,title:E,disabled:D,"aria-busy":o,onClick:change,children:(0,d.jsxs)(`span`,{className:`xmimo-tts-character-control`,children:[(0,d.jsx)(`span`,{className:`xmimo-tts-character-portrait xmimo-tts-provider-portrait`,"aria-hidden":`true`,children:(0,d.jsxs)(`span`,{className:`xmimo-tts-provider-flipper`,style:{transform:`rotateY(${_.turns*180}deg)`},children:[(0,d.jsx)(`span`,{className:`xmimo-tts-provider-face`,style:{backgroundImage:`url(${hostRoute(_.front)})`}}),(0,d.jsx)(`span`,{className:`xmimo-tts-provider-face xmimo-tts-provider-face-back`,style:{backgroundImage:`url(${hostRoute(_.back)})`}})]})}),(0,d.jsx)(`span`,{className:`xmimo-tts-character-copy`,children:(0,d.jsx)(`strong`,{children:C})}),(0,d.jsx)(`span`,{className:`xmimo-tts-character-state xmimo-tts-provider-state`,children:k})]})})}function SwitchModule({t:e,provider:t,doubaoEnabled:n,breezeEnabled:r,enabled:i,autoPlay:a,soundEnabled:o,minimal:s,writable:c,onProviderChange:u,onEnabledChange:p,onAutoPlayChange:m,onSoundEnabledChange:h}){let g=useHoloHover(!s&&c),[_,v]=(0,l.useState)(!1),[b,x]=(0,l.useState)(!1),changeExternal=(e,t)=>{v(!0),x(!1),switchExternalConfiguration(e,t).catch(()=>x(!0)).finally(()=>v(!1))};return(0,d.jsxs)(`section`,{className:s?`xmimo-tts-switch-module xmimo-tts-switch-module-minimal`:`xmimo-tts-switch-module`,children:[(0,d.jsxs)(`div`,{ref:g,className:`xmimo-tts-switch-row xmimo-ui-grid`,children:[(0,d.jsx)(CharacterToggle,{kind:`voice`,checked:i,disabled:!c,label:e(s?`settings.enabled`:i?`settings.enabledOnLabel`:`settings.enabledOffLabel`),stateLabel:e(i?`settings.stateOn`:`settings.stateOff`),minimal:s,onChange:p}),(0,d.jsx)(CharacterToggle,{kind:`autoplay`,checked:i&&a,disabled:!c,label:e(s?`settings.autoPlay`:i&&a?`settings.autoPlayOnLabel`:`settings.autoPlayOffLabel`),stateLabel:e(i&&a?`settings.stateOn`:`settings.stateOff`),minimal:s,onChange:m}),(0,d.jsx)(CharacterToggle,{kind:`sound`,checked:o,disabled:!c,label:e(s?`settings.soundEffectsTitle`:o?`settings.soundEffectsOnLabel`:`settings.soundEffectsOffLabel`),stateLabel:e(o?`settings.stateOn`:`settings.stateOff`),minimal:s,onChange:h}),(0,d.jsx)(ProviderToggle,{t:e,provider:t,doubaoEnabled:n,breezeEnabled:r,minimal:s,writable:c,switching:_,onChange:u,onExternalChange:changeExternal})]}),b?(0,d.jsx)(`p`,{className:`xmimo-tts-failed`,role:`alert`,children:e(`settings.externalSwitchFailed`)}):null]})}let $i=`dsh-xiaomi-mimo-tts:minimal-mode`,ea=new Set,ta=!1,na=!1;function subscribeMinimalMode(e){ea.add(e);let onStorage=t=>{(t.key===$i||t.key===null)&&e()};return typeof window<`u`&&window.addEventListener(`storage`,onStorage),()=>{ea.delete(e),typeof window<`u`&&window.removeEventListener(`storage`,onStorage)}}function getStorage(){try{return typeof window>`u`?void 0:window.localStorage}catch{return}}function readMinimalMode(){try{if(na)return ta;let e=getStorage();return e?e.getItem($i)===`true`:ta}catch{return ta}}function writeMinimalMode(e){ta=e;try{let t=getStorage();t?.setItem($i,String(e)),na=!t}catch{na=!0}for(let e of ea)e()}let ra={getSnapshot:()=>!1,subscribe:()=>()=>{}};var PluginAudioFocus=class{constructor(e,t){this.focus=e,this.blocked=t}canPlay=()=>!this.blocked.getSnapshot()&&this.focus.canPlay();claim=()=>{this.blocked.getSnapshot()||this.focus.claim()};subscribe=e=>{let t=this.canPlay(),update=()=>{let n=this.canPlay();n!==t&&(t=n,e())},n=this.focus.subscribe(update),r=this.blocked.subscribe(update);return()=>{r(),n()}}};function observePluginActivity(e,t,n=()=>{}){let r=!1,update=()=>{let i=e.getSnapshot();i!==r&&(r=i,i?t():n())},i=e.subscribe(update);return update(),i}let idle=()=>({entryId:null,status:`idle`,currentTime:0,duration:0,error:null});var HistoryReplay=class{view=idle();listeners=new Set;media=null;url=null;cleanup=null;epoch=0;attempt=0;volume=1;voiceRate=1;voiceRateApplied=!1;disposed=!1;offStop=null;offHistory=null;constructor(e,t){this.history=e,this.beforePlayback=t}activate(){this.offStop===null&&(this.disposed=!1,this.offStop=this.history.onStopReplay(()=>this.pause()),this.offHistory=this.history.subscribe(()=>{this.view.entryId!==null&&!this.history.getSnapshot().entries.some(e=>e.id===this.view.entryId)&&this.stop()}))}getSnapshot=()=>this.view;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});configure(e,t,n){this.volume=e,this.voiceRate=t,this.beforePlayback=n,this.media!==null&&(this.media.volume=e,applyMediaVoiceRate(this.media,this.voiceRateApplied?1:t))}async play(e){if(this.disposed||this.beforePlayback()===!1)return;if(this.view.entryId!==e.id||this.media===null||this.view.status===`error`){this.release();let t=this.epoch;try{this.url=URL.createObjectURL(e.blob);let n=new Audio(this.url);this.media=n,this.voiceRateApplied=e.voiceRateApplied===!0,n.preload=`metadata`,n.volume=this.volume,applyMediaVoiceRate(n,this.voiceRateApplied?1:this.voiceRate);let valid=()=>!this.disposed&&this.media===n&&this.epoch===t,timing=()=>{valid()&&this.publish({...this.view,currentTime:Number.isFinite(n.currentTime)?n.currentTime:0,duration:Number.isFinite(n.duration)?n.duration:0})},ended=()=>{valid()&&(this.attempt+=1,this.publish({...this.view,status:`ended`,currentTime:this.view.duration}))},error=()=>{valid()&&(this.attempt+=1,this.publish({...this.view,status:`error`,error:n.error?.code===3||n.error?.code===4?`decode`:`failed`}))};for(let e of[`loadedmetadata`,`durationchange`,`timeupdate`])n.addEventListener(e,timing);n.addEventListener(`ended`,ended),n.addEventListener(`error`,error),this.cleanup=()=>{for(let e of[`loadedmetadata`,`durationchange`,`timeupdate`])n.removeEventListener(e,timing);n.removeEventListener(`ended`,ended),n.removeEventListener(`error`,error)},this.publish({...idle(),entryId:e.id})}catch{this.release(),this.publish({...idle(),entryId:e.id,status:`error`,error:`failed`});return}}let t=this.media;this.view.status===`ended`&&(t.currentTime=0);let n=++this.attempt,r=this.epoch;this.publish({...this.view,status:`loading`,error:null});try{await t.play(),!this.disposed&&this.media===t&&r===this.epoch&&n===this.attempt&&this.publish({...this.view,status:`playing`})}catch(e){!this.disposed&&this.media===t&&r===this.epoch&&n===this.attempt&&this.publish({...this.view,status:`error`,error:e instanceof Error&&e.name===`NotAllowedError`?`blocked`:`failed`})}}pause(){this.media===null||this.view.status!==`playing`&&this.view.status!==`loading`||(this.attempt+=1,this.media.pause(),this.publish({...this.view,status:`paused`}))}seek(e){if(this.media===null||this.view.duration<=0||!Number.isFinite(e))return;let t=Math.max(0,Math.min(this.view.duration,e));this.media.currentTime=t,this.publish({...this.view,currentTime:t,status:this.view.status===`ended`?`paused`:this.view.status})}stop(){this.release(),this.publish(idle())}dispose(){this.disposed=!0,this.offStop?.(),this.offHistory?.(),this.offStop=null,this.offHistory=null,this.stop(),this.listeners.clear()}release(){this.epoch+=1,this.attempt+=1,this.cleanup?.(),this.cleanup=null,this.media!==null&&(this.media.pause(),this.media.removeAttribute(`src`),this.media.load(),this.media=null),this.url!==null&&URL.revokeObjectURL(this.url),this.url=null,this.voiceRateApplied=!1}publish(e){this.view=e;for(let e of this.listeners)e()}};function isSpeechBusy(e){return e===`loading`||e===`playing`||e===`paused`}var SpeechActivity=class{queries=new Map;register(e,t){return this.queries.set(e,t),()=>{this.queries.delete(e)}}isBusy=()=>[...this.queries.keys()].some(e=>e());interrupt=()=>{for(let[e,t]of this.queries)e()&&t?.()}};function VoiceReadingSelect({label:e,value:t,fallbackLabel:n,options:r,disabled:i,buttonVariant:a,onSelect:o}){let[s,c]=(0,l.useState)(!1),p=(0,l.useRef)(null),closeMenu=()=>{c(!1)},choose=e=>{p.current?.focus({preventScroll:!0}),closeMenu(),o(e)},m=r.find(e=>e.id===t)?.label??n??t,h=(0,d.jsxs)(a?u.Button:`button`,{ref:p,type:`button`,...a?{variant:a,size:`sm`}:{},className:a?`xmimo-voice-reading-button-selector`:`xmimo-voice-reading-selector`,"aria-label":e,"aria-haspopup":`menu`,"aria-expanded":s,disabled:i,onClick:()=>{c(e=>!e)},children:[(0,d.jsx)(`span`,{className:`xmimo-voice-reading-selector-label`,children:m}),(0,d.jsx)(u.IconChevronDownOutlineRegular,{className:`xmimo-voice-reading-chevron`})]});return(0,d.jsx)(u.Menu,{open:s&&!i,anchor:h,items:r,selectedId:t,onSelect:choose,onClose:closeMenu,align:`end`,portal:!0,listClassName:`xmimo-voice-reading-menu`})}function AudioHistoryPage({history:e,t,volume:n,voiceRate:r,minimalMode:i,speechActivity:a,beforePlayback:o,onBack:s}){let c=(0,l.useSyncExternalStore)(e.subscribe,e.getSnapshot),[p]=(0,l.useState)(()=>new HistoryReplay(e,o));(0,l.useEffect)(()=>a?.register(()=>isSpeechBusy(p.getSnapshot().status),()=>p.stop()),[a,p]);let m=(0,l.useSyncExternalStore)(p.subscribe,p.getSnapshot),[h]=(0,l.useState)(()=>new HistoryDownloads),[g,_]=(0,l.useState)(``),[v,b]=(0,l.useState)(`all`),[x,C]=(0,l.useState)(null),[w,E]=(0,l.useState)(null),[D,k]=(0,l.useState)(!1),[A,M]=(0,l.useState)(!1),[P,F]=(0,l.useState)(!1),I=(0,l.useRef)(null),V=(0,l.useRef)(null),ee=(0,l.useRef)(null);(0,l.useEffect)(()=>(p.activate(),I.current?.focus({preventScroll:!0}),()=>{p.dispose(),h.dispose()}),[p,h]),(0,l.useEffect)(()=>{p.configure(n,r,o)},[p,n,r,o]),(0,l.useEffect)(()=>{let e=ee.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(([e])=>{e&&e.contentRect.width<=520&&_(``)});return t.observe(e),()=>{t.disconnect()}},[]);let te=c.entries.length>0,re=filterAudioHistory(c.entries,g,v),se=m.status===`loading`||m.status===`playing`,ce=t(se?`history.pause`:m.status===`error`?`history.retry`:`history.play`),le=m.duration>0?historyTime(m.duration):`--:--`,H={"--xmimo-history-progress":`${m.duration>0?Math.min(100,Math.max(0,m.currentTime/m.duration*100)):0}%`},title=e=>e.text.trim()||t(`history.untitled`),mutate=async t=>{M(!0),F(!1);try{t===void 0?await e.clear():await e.remove(t),E(null),k(!1),(V.current?.getClientRects().length?V.current:I.current)?.focus({preventScroll:!0})}catch{F(!0)}finally{M(!1)}},download=e=>{F(!1);try{h.download(e)}catch{F(!0)}};return(0,d.jsxs)(`section`,{ref:ee,tabIndex:-1,className:`xmimo-ui-scope xmimo-tts-history-page`,"aria-label":t(`history.title`),children:[(0,d.jsxs)(`header`,{className:`xmimo-tts-history-header`,children:[(0,d.jsxs)(`h2`,{"aria-label":t(`history.title`),children:[(0,d.jsxs)(u.Button,{ref:I,type:`button`,variant:`ghost`,size:`sm`,className:`xmimo-tts-history-title-back`,"aria-label":t(`history.backToSettings`),title:t(`history.backToSettings`),onClick:s,children:[(0,d.jsx)(RiArrowLeftSLine,{size:18,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{children:t(`history.title`)})]}),(0,d.jsx)(`span`,{className:`xmimo-tts-history-count`,children:c.entries.length})]}),te?(0,d.jsxs)(`div`,{className:`xmimo-tts-history-toolbar`,children:[(0,d.jsx)(u.Input,{ref:V,type:`search`,className:`xmimo-tts-history-search`,"aria-label":t(`history.search`),placeholder:t(`history.search`),value:g,onChange:e=>{_(e.target.value),E(null)}}),(0,d.jsx)(`div`,{className:`xmimo-tts-history-source`,children:(0,d.jsx)(VoiceReadingSelect,{label:t(`history.source`),value:v,disabled:A,buttonVariant:`outline`,options:[`all`,`conversation`,`preview`,`service`].map(e=>({id:e,label:t(`history.${e}`)})),onSelect:e=>{b(e),E(null)}})}),(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:A||c.status===`loading`,className:`xmimo-tts-history-action${D?` xmimo-tts-history-confirm-delete`:``}`,"aria-label":t(D?`history.confirmClear`:`history.clear`),title:t(D?`history.clearConfirm`:`history.clear`),onBlur:()=>{A||k(!1)},onKeyDown:e=>{e.key===`Escape`&&k(!1)},onClick:()=>{D?mutate():(k(!0),E(null))},children:[D?(0,d.jsx)(RiCheckLine,{"aria-hidden":`true`}):(0,d.jsx)(RiDeleteBinLine,{"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:t(D?`history.confirmClear`:`history.clear`)})]})]}):null]}),c.status===`memory`?(0,d.jsx)(`p`,{className:`xmimo-tts-history-warning`,role:`status`,children:t(`history.memory`)}):null,c.skipped?(0,d.jsx)(`p`,{className:`xmimo-tts-history-warning`,role:`status`,children:t(`history.skipped`)}):null,P?(0,d.jsx)(`p`,{className:`xmimo-tts-failed`,role:`alert`,children:t(`history.actionFailed`)}):null,(0,d.jsx)(`div`,{className:`xmimo-tts-history-results`,children:c.status===`loading`?(0,d.jsx)(`p`,{className:`xmimo-tts-history-empty`,role:`status`,children:t(`history.loading`)}):c.entries.length===0?(0,d.jsxs)(`div`,{className:`xmimo-tts-history-empty`,role:`status`,children:[i?null:(0,d.jsx)(`img`,{className:`xmimo-tts-history-empty-whale`,src:hostRoute(S),width:144,height:144,alt:``,"aria-hidden":`true`}),(0,d.jsx)(`p`,{children:t(`history.empty`)})]}):re.length===0?(0,d.jsxs)(`div`,{className:`xmimo-tts-history-empty`,role:`status`,children:[(0,d.jsx)(`p`,{children:t(`history.noResults`)}),(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{_(``),b(`all`)},children:t(`history.resetFilters`)})]}):(0,d.jsx)(`ul`,{className:`xmimo-tts-history-list`,children:re.map(e=>(0,d.jsxs)(`li`,{className:`xmimo-tts-history-row${e.id===m.entryId?` xmimo-tts-history-row-selected`:``}`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`primary`,size:`sm`,className:`xmimo-tts-history-player-toggle`,title:e.id===m.entryId?ce:t(`history.listen`),"aria-label":`${e.id===m.entryId?ce:t(`history.listen`)}: ${title(e).slice(0,60)}`,onClick:()=>{e.id===m.entryId&&se?p.pause():p.play(e)},children:e.id===m.entryId&&m.status===`error`?(0,d.jsx)(u.IconRefreshOutlineMedium,{size:16,"aria-hidden":`true`}):(0,d.jsx)(PlaybackIcon,{state:e.id!==m.entryId||!se?`play`:`pause`})}),(0,d.jsxs)(`div`,{className:`xmimo-tts-history-copy`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,className:`xmimo-tts-history-text-toggle`,"aria-expanded":x===e.id,"aria-label":`${t(`history.expand`)}: ${title(e).slice(0,60)}`,onClick:()=>{C(x===e.id?null:e.id)},children:(0,d.jsx)(`span`,{className:`xmimo-tts-history-text${x===e.id?` xmimo-tts-history-text-expanded`:``}`,children:title(e)})}),(0,d.jsxs)(`div`,{className:`xmimo-tts-history-meta`,children:[(0,d.jsx)(`span`,{children:t(`history.${e.source}`)}),(0,d.jsxs)(`span`,{children:[Array.from(title(e)).length,` `,t(`history.characters`)]}),(0,d.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),children:new Date(e.createdAt).toLocaleString()}),(0,d.jsxs)(`span`,{children:[e.format.toUpperCase(),` · `,historyFileSize(e.blob.size)]})]}),e.id===m.entryId?(0,d.jsxs)(`div`,{className:`xmimo-tts-history-player`,"aria-label":t(`history.player`),children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-history-player-controls`,children:[(0,d.jsx)(`input`,{type:`range`,style:H,min:0,max:m.duration||1,step:.1,value:Math.min(m.currentTime,m.duration||1),disabled:m.duration<=0||m.status===`error`,"aria-label":t(`history.seek`),"aria-valuetext":`${historyTime(m.currentTime)} / ${le}`,onChange:e=>{p.seek(Number(e.target.value))}}),(0,d.jsxs)(`span`,{className:`xmimo-tts-history-time`,children:[historyTime(m.currentTime),` / `,le]})]}),(0,d.jsx)(`span`,{className:m.status===`error`?`xmimo-tts-history-player-error xmimo-tts-failed`:`xmimo-tts-history-player-status`,role:`status`,children:t(m.status===`error`?`history.error.${m.error??`failed`}`:`history.state.${m.status}`)})]}):null]}),(0,d.jsxs)(`div`,{className:`xmimo-tts-history-actions`,children:[(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,className:`xmimo-tts-history-action`,title:t(`history.download`),"aria-label":`${t(`history.download`)}: ${title(e).slice(0,60)}`,onClick:()=>{download(e)},children:[(0,d.jsx)(RiDownloadLine,{"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:t(`history.download`)})]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:A,className:`xmimo-tts-history-action${w===e.id?` xmimo-tts-history-confirm-delete`:``}`,title:t(w===e.id?`history.confirmDelete`:`history.delete`),"aria-label":`${t(w===e.id?`history.confirmDelete`:`history.delete`)}: ${title(e).slice(0,60)}`,onBlur:()=>{A||E(t=>t===e.id?null:t)},onKeyDown:e=>{e.key===`Escape`&&E(null)},onClick:()=>{w===e.id?mutate(e.id):(E(e.id),k(!1))},children:[w===e.id?(0,d.jsx)(RiCheckLine,{"aria-hidden":`true`}):(0,d.jsx)(RiDeleteBinLine,{"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:t(w===e.id?`history.confirmDelete`:`history.delete`)})]})]})]},e.id))})}),(0,d.jsxs)(`footer`,{className:`xmimo-tts-history-footer`,children:[te?(0,d.jsxs)(`div`,{className:`xmimo-tts-history-storage`,children:[(0,d.jsxs)(`span`,{children:[t(c.status===`memory`?`history.temporary`:`history.savedHere`),` · `,c.entries.length,` · `,historyFileSize(c.entries.reduce((e,t)=>e+t.blob.size,0))]}),(0,d.jsx)(`span`,{className:`xmimo-tts-history-limit`,children:t(`history.hint`)})]}):null,(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,className:`xmimo-tts-history-back`,onClick:s,children:[(0,d.jsx)(RiArrowLeftSLine,{size:16,"aria-hidden":`true`,focusable:`false`}),t(`history.backToSettings`)]})]})]})}let ia={apiKey:`xiaomi`,doubaoApiKey:`doubao`,breezeApiKey:`breeze`},aa={xiaomi:`apiKey`,doubao:`doubaoApiKey`,breeze:`breezeApiKey`};function isApiKeyField(e){return e in ia}function layerSettings(e){return isRecord(e)?e:void 0}function hasLayerField(e,t){return isRecord(e)&&Object.hasOwn(e,t)}function HistoryLink({history:e,t,onOpen:n,buttonRef:r}){let i=(0,l.useSyncExternalStore)(e.subscribe,e.getSnapshot);return(0,d.jsxs)(u.Button,{ref:r,type:`button`,className:`xmimo-tts-history-link`,variant:`toolbar`,size:`sm`,onClick:n,children:[(0,d.jsx)(GoHistory,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsxs)(`span`,{className:`xmimo-tts-action-label`,children:[t(`history.shortTitle`),` · `,i.entries.length]})]})}function SettingsCard(e){return e.view===`summary`?(0,d.jsx)(d.Fragment,{children:e.t(`settings.description`)}):(0,d.jsx)(SettingsPage,{...e})}function SettingsPage({scope:e,t,controller:n,history:r,speechActivity:i,beforePreview:a,beforeHistoryPlayback:o,initialPanel:s,onSidebarChange:c,onOpenProviderSettings:p,changes:m=ra,audioFocus:h=oi}){useEngineState();let g=externalEngine(),_=useExternalSelection(g),v=useSettingsSnapshot(e),b=(0,l.useSyncExternalStore)(m.subscribe,m.getSnapshot,m.getSnapshot),x=v.writable&&!b,S=v.value,C=resolveTtsSettings(S),[w,E]=(0,l.useState)({xiaomi:``,doubao:``,breeze:``}),[D,k]=(0,l.useState)(C.provider),[A,M]=(0,l.useState)(C.doubaoModel),[P,F]=(0,l.useState)(C.doubaoVoice),[I,V]=(0,l.useState)(C.doubaoClonedVoice),[ee,te]=(0,l.useState)(C.doubaoInstruction),[re,se]=(0,l.useState)(C.doubaoEnabled),[ce,le]=(0,l.useState)(C.breezeEnabled),[H,ue]=(0,l.useState)(C.breezeVoice),[de,fe]=(0,l.useState)(C.breezeInstruction),[pe,U]=(0,l.useState)(C.instruction),me=w[D],he=aa[D],setApiKey=e=>{E(t=>({...t,[D]:e}))},[xe,Se]=(0,l.useState)(C.showInSidebar),[Ce,W]=(0,l.useState)(C.showInHostSettings),[we,Te]=(0,l.useState)(C.showFeatureGuide),[Ee,De]=(0,l.useState)(C.acceptExternalProviders),[Oe,ke]=(0,l.useState)(C.announcementSources),[Ae,Me]=(0,l.useState)(C.qqbotEnabled),[Ne,Pe]=(0,l.useState)(C.enabled),[Fe,Ie]=(0,l.useState)(C.autoPlay),[Re,Ve]=(0,l.useState)(C.voiceInputCompatibility),[He,Ue]=(0,l.useState)(C.inputAvoidance),[Ke,Je]=(0,l.useState)(C.importantAnnouncementsFirst),[Ye,Ze]=(0,l.useState)(C.voiceVolume),[Qe,et]=(0,l.useState)(C.voiceRate),[tt,nt]=(0,l.useState)(C.readScope),[rt,it]=(0,l.useState)(C.model),[at,ot]=(0,l.useState)(C.localSpeechMode),[st,ct]=(0,l.useState)(C.localVoiceURI),[lt,ut]=(0,l.useState)(C.localVoiceEngine),[dt,ft]=(0,l.useState)(C.mossEnabled),[pt,mt]=(0,l.useState)(C.mossBaseURL),[ht,gt]=(0,l.useState)(C.mossVoice),[_t,vt]=(0,l.useState)(C.mossVoiceName),[yt,bt]=(0,l.useState)(C.voice),[xt,St]=(0,l.useState)(C.voiceDesignPrompt),[Ct,wt]=(0,l.useState)(C.voiceDesignCustomPrompt),[G,Tt]=(0,l.useState)(C.soundEnabled),[Et,Dt]=(0,l.useState)(C.soundVolume),[Ot,kt]=(0,l.useState)(C.soundPack),[At,jt]=(0,l.useState)(C.taskSounds),[Mt,Nt]=(0,l.useState)(C.clickSounds),[Pt,Ft]=(0,l.useState)({}),[It,Lt]=(0,l.useState)(`idle`),[Rt,zt]=(0,l.useState)(null),Bt=(0,l.useRef)(!1),[q,Vt]=(0,l.useState)(s??null),togglePanel=e=>Vt(t=>t===e?null:e),[Ht,Ut]=(0,l.useState)(()=>t(`settings.previewDefaultText`)),[Wt,Gt]=(0,l.useState)({status:`idle`,source:null,error:null}),[Y]=(0,l.useState)(()=>new PreviewPlayer(Gt,r));(0,l.useEffect)(()=>ri.subscribe(()=>Y.stop()),[Y]),(0,l.useEffect)(()=>i?.register(()=>isSpeechBusy(Y.getView().status),()=>Y.stop()),[i,Y]);let[Kt]=(0,l.useState)(()=>new ToggleSoundPlayer);(0,l.useEffect)(()=>h.subscribe(()=>{h.canPlay()||(Y.stop(),Kt.dispose())}),[h,Y,Kt]);let qt=useApiKeyStatus(v.status===`ready`&&!b,D),[Jt,Yt]=(0,l.useState)(readMinimalMode),[Xt,Zt]=(0,l.useState)(!1),Qt=(0,l.useRef)(null),$t=(0,l.useRef)(!1),en=resolveTtsSettings(S),$=resolveTtsSettings(layerSettings(v.base)),tn={showInSidebar:xe,showInHostSettings:Ce,showFeatureGuide:we,acceptExternalProviders:Ee,qqbotEnabled:Ae,announcementSources:Oe,provider:D,doubaoModel:A,doubaoVoice:P,doubaoClonedVoice:I,doubaoInstruction:ee,doubaoEnabled:re,breezeEnabled:ce,breezeVoice:H,breezeInstruction:de,instruction:pe,enabled:Ne,autoPlay:Ne&&Fe,voiceInputCompatibility:Re,inputAvoidance:He,importantAnnouncementsFirst:Ke,voiceVolume:Ye,voiceRate:Qe,readScope:tt,model:rt,localSpeechMode:at,localVoiceURI:st,localVoiceEngine:lt,mossEnabled:dt,mossBaseURL:pt,mossVoice:ht,mossVoiceName:_t,voice:yt,voiceDesignPrompt:xt,voiceDesignCustomPrompt:Ct,soundEnabled:G,soundVolume:Et,soundPack:Ot,taskSounds:At,clickSounds:Mt},acceptedValue=e=>{let t=S?.[e];return t===void 0?en[e]:t},hasOverride=e=>hasLayerField(v.user,e),fieldOverridden=e=>{let t=Pt[e];return t?.kind===`clear`?!1:t?.kind===`set`?isApiKeyField(e)?w[ia[e]].trim().length>0:!0:hasOverride(e)},fieldDirty=e=>{let t=Pt[e];return t===void 0?!1:t.kind===`clear`?hasOverride(e):Array.isArray(tn[e])?JSON.stringify(tn[e])!==JSON.stringify(acceptedValue(e)):!Object.is(tn[e],acceptedValue(e))},nn=Object.keys(ia).some(e=>Pt[e]?.kind===`set`&&w[ia[e]].trim().length>0),rn=yi.some(fieldDirty)||nn||_.dirty,an=g?null:validateSettingsDraft(tn),on=g?_.dirty||yi.some(e=>!bi.has(e)&&fieldDirty(e)):rn,sn=resolveApiKeyViewState(me,isSupportedTtsApiKey(me,D),qt,Pt[he]?.kind),cn=t(sn===`loading`?`settings.apiKeyLoading`:sn===`missing`?`settings.apiKeyMissing`:sn===`recognized`?D===`doubao`?`settings.doubaoKeyConfigured`:`settings.apiKeyRecognized`:sn===`unrecognized`?`settings.apiKeyUnsupportedSaved`:sn===`unavailable`?`settings.apiKeyUnavailable`:sn===`pending-save`?`settings.apiKeyPendingSave`:`settings.apiKeyUnsupported`),ln=sn===`pending-invalid`||sn===`unrecognized`;if((0,l.useEffect)(()=>{if(rn)return;let e=resolveTtsSettings(S);k(e.provider),M(e.doubaoModel),F(e.doubaoVoice),V(e.doubaoClonedVoice),te(e.doubaoInstruction),se(e.doubaoEnabled),le(e.breezeEnabled),ue(e.breezeVoice),fe(e.breezeInstruction),U(e.instruction),Se(e.showInSidebar),W(e.showInHostSettings),Te(e.showFeatureGuide),De(e.acceptExternalProviders),ke(e.announcementSources),Me(e.qqbotEnabled),Pe(e.enabled),Ie(e.autoPlay),Ve(e.voiceInputCompatibility),Ue(e.inputAvoidance),Je(e.importantAnnouncementsFirst),Ze(e.voiceVolume),et(e.voiceRate),nt(e.readScope),it(e.model),ot(e.localSpeechMode),ct(e.localVoiceURI),ut(e.localVoiceEngine),ft(e.mossEnabled),mt(e.mossBaseURL),gt(e.mossVoice),vt(e.mossVoiceName),bt(e.voice),St(e.voiceDesignPrompt),wt(e.voiceDesignCustomPrompt),Tt(e.soundEnabled),Dt(e.soundVolume),kt(e.soundPack),jt(e.taskSounds),Nt(e.clickSounds),Ft({})},[rn,S]),(0,l.useEffect)(()=>()=>{Kt.dispose(),Y.dispose()},[Y,Kt]),(0,l.useEffect)(()=>{Kt.setEnabled(!Jt)},[Jt,Kt]),(0,l.useEffect)(()=>{n.update({enabled:G,volume:Et,pack:Ot,taskSounds:At,clickSounds:Mt})},[Mt,n,G,Ot,Et,At]),(0,l.useEffect)(()=>{Y.setVolume(Ye),Kt.setVolume(Ye)},[Y,Kt,Ye]),(0,l.useEffect)(()=>{!Xt&&$t.current&&Qt.current?.focus({preventScroll:!0}),$t.current=Xt},[Xt]),v.status===`unavailable`)return null;let markChange=e=>{Ft(t=>({...t,[e]:{kind:`set`}})),Lt(`idle`),zt(null)},resetField=e=>{Y.stop(),Ft(t=>({...t,[e]:{kind:`clear`}})),Lt(`idle`),e===`provider`&&k($.provider===`doubao`&&!re||$.provider===`breeze`&&!ce?`xiaomi`:$.provider),e===`doubaoModel`&&M($.doubaoModel),e===`doubaoVoice`&&F($.doubaoVoice),e===`doubaoClonedVoice`&&V($.doubaoClonedVoice),e===`doubaoInstruction`&&te($.doubaoInstruction),e===`breezeVoice`&&ue($.breezeVoice),e===`breezeInstruction`&&fe($.breezeInstruction),e===`instruction`&&U($.instruction),e===`showInSidebar`&&Se($.showInSidebar),e===`showInHostSettings`&&W($.showInHostSettings),e===`showFeatureGuide`&&Te($.showFeatureGuide),e===`acceptExternalProviders`&&De($.acceptExternalProviders),e===`announcementSources`&&ke($.announcementSources),e===`qqbotEnabled`&&Me($.qqbotEnabled),e===`enabled`&&Pe($.enabled),e===`autoPlay`&&Ie($.autoPlay),e===`voiceInputCompatibility`&&Ve($.voiceInputCompatibility),e===`inputAvoidance`&&Ue($.inputAvoidance),e===`importantAnnouncementsFirst`&&Je($.importantAnnouncementsFirst),e===`voiceVolume`&&Ze($.voiceVolume),e===`voiceRate`&&et($.voiceRate),e===`readScope`&&nt($.readScope),e===`model`&&it($.model),e===`localSpeechMode`&&ot($.localSpeechMode),e===`localVoiceURI`&&ct($.localVoiceURI),e===`localVoiceEngine`&&ut(dt?$.localVoiceEngine:`browser`),e===`mossEnabled`&&(ft($.mossEnabled),!$.mossEnabled&&lt===`moss`&&(ut(`browser`),Ft(e=>({...e,localVoiceEngine:{kind:`set`}})))),e===`mossBaseURL`&&mt($.mossBaseURL),e===`mossVoice`&&gt($.mossVoice),e===`mossVoiceName`&&vt($.mossVoiceName),e===`voice`&&bt($.voice),e===`voiceDesignPrompt`&&St($.voiceDesignPrompt),e===`voiceDesignCustomPrompt`&&wt($.voiceDesignCustomPrompt),e===`soundEnabled`&&Tt($.soundEnabled),e===`soundVolume`&&Dt($.soundVolume),e===`soundPack`&&kt($.soundPack),e===`taskSounds`&&jt($.taskSounds),e===`clickSounds`&&Nt($.clickSounds)},discard=()=>{_.discard();let t=resolveTtsSettings(e.getSnapshot().value);k(t.provider),M(t.doubaoModel),F(t.doubaoVoice),V(t.doubaoClonedVoice),te(t.doubaoInstruction),se(t.doubaoEnabled),le(t.breezeEnabled),ue(t.breezeVoice),fe(t.breezeInstruction),U(t.instruction),Se(t.showInSidebar),W(t.showInHostSettings),Te(t.showFeatureGuide),De(t.acceptExternalProviders),ke(t.announcementSources),Me(t.qqbotEnabled),Pe(t.enabled),Ie(t.autoPlay),Ve(t.voiceInputCompatibility),Ue(t.inputAvoidance),Je(t.importantAnnouncementsFirst),Ze(t.voiceVolume),et(t.voiceRate),nt(t.readScope),it(t.model),ot(t.localSpeechMode),ct(t.localVoiceURI),ut(t.localVoiceEngine),ft(t.mossEnabled),mt(t.mossBaseURL),gt(t.mossVoice),vt(t.mossVoiceName),bt(t.voice),St(t.voiceDesignPrompt),wt(t.voiceDesignCustomPrompt),Tt(t.soundEnabled),Dt(t.soundVolume),kt(t.soundPack),jt(t.taskSounds),Nt(t.clickSounds),E({xiaomi:``,doubao:``,breeze:``}),Y.stop(),Ft({}),Lt(`idle`)},save=async n=>{if(!(!x||m.getSnapshot()||Bt.current)){Bt.current=!0,Vt(null),Lt(`saving`),zt(null);try{let commit=async()=>{let t=n===void 0?tn:{...tn,showInSidebar:n},r=n===void 0?Pt:{...Pt,showInSidebar:{kind:`set`}};await _.save(),await saveSettingsDraft(e,t,r,w,g!==null),(Pt.apiKey!==void 0||Pt.doubaoApiKey!==void 0||Pt.breezeApiKey!==void 0)&&invalidateApiKeyStatus(),g||E({xiaomi:``,doubao:``,breeze:``}),Ft(g?Object.fromEntries(Object.entries(Pt).filter(([e])=>bi.has(e))):{}),Lt(`saved`),n!==void 0&&c?.(n)};n===void 0?await commit():await withSidebarLoading(n,t,commit)}catch(e){let t=e instanceof SaveSettingsError?e.code:null;zt(t===`api-key-rejected`?`api-key-rejected`:t===`host-rejected`?`host-rejected`:`unknown`),Lt(`failed`)}finally{Bt.current=!1}}},un=Wt.status===`loading`||Wt.status===`playing`,togglePreview=e=>{if(h.claim(),h.canPlay()){if(un){Y.stop();return}if(an!==null||!g&&Pt[he]!==void 0){Y.stop(),Gt({status:`error`,source:D===`doubao`?`doubao`:D===`breeze`?`breeze`:`mimo`,error:an===null?`save-key-first`:`voice-required`});return}a?.(),Y.play(e,{...tn,...g?{externalSelection:_.value}:{}})}},toggleSettingsPreview=()=>{togglePreview(Ht)},changeEnabled=e=>{Jt&&G&&Mt?n.play(e?`toggle-on`:`toggle-off`):h.canPlay()&&Kt.schedule(e?`on`:`off`),Pe(e),e?markChange(`enabled`):(Ie(!1),Ft(e=>({...e,enabled:{kind:`set`},autoPlay:{kind:`set`}}))),Lt(`idle`)},changeAutoPlay=e=>{Jt&&G&&Mt?n.play(e?`toggle-on`:`toggle-off`):h.canPlay()&&Kt.schedule(e?`auto-on`:`auto-off`),Ie(e),e?(Pe(!0),Ft(e=>({...e,autoPlay:{kind:`set`},enabled:{kind:`set`}}))):markChange(`autoPlay`),Lt(`idle`)},changeProvider=e=>{G&&Mt&&n.play(`select`),Y.stop(),k(e),markChange(`provider`)},changeSoundScope=e=>{let t=getSoundEffectsModeFlags(e);n.update({enabled:G,taskSounds:t.taskSounds,clickSounds:t.clickSounds,volume:Et,pack:Ot}),jt(t.taskSounds),Nt(t.clickSounds),Ft(e=>({...e,taskSounds:{kind:`set`},clickSounds:{kind:`set`}})),Lt(`idle`)},changeSoundEnabled=e=>{let t=getSoundEffectsModeFlags(resolveSoundEffectsScope(At,Mt));!e&&G&&Mt&&n.play(`toggle-off`),n.update({enabled:e,taskSounds:t.taskSounds,clickSounds:t.clickSounds,volume:Et,pack:Ot}),e&&t.clickSounds&&n.play(`toggle-on`),Tt(e),jt(t.taskSounds),Nt(t.clickSounds),Ft(e=>({...e,soundEnabled:{kind:`set`},taskSounds:{kind:`set`},clickSounds:{kind:`set`}})),Lt(`idle`)},toggleMinimalMode=()=>{let e=!Jt;Yt(e),writeMinimalMode(e),Kt.setEnabled(!e),e&&Y.stop()};return Xt&&r?b?(0,d.jsx)(`p`,{className:`xmimo-ui-scope xmimo-tts-plugin-status`,role:`status`,children:t(`plugin.changing`)}):(0,d.jsx)(AudioHistoryPage,{history:r,t,volume:Ye,voiceRate:Qe,minimalMode:Jt,speechActivity:i,beforePlayback:()=>m.getSnapshot()||(h.claim(),!h.canPlay())?!1:(Y.stop(),Kt.dispose(),o?.(),!0),onBack:()=>{Zt(!1)}}):(0,d.jsxs)(`div`,{className:Jt?`xmimo-tts-card xmimo-tts-card-open xmimo-ui-scope xmimo-tts-card-minimal`:`xmimo-tts-card xmimo-tts-card-open xmimo-ui-scope`,children:[b?(0,d.jsx)(`p`,{className:`xmimo-tts-plugin-status`,role:`status`,children:t(`plugin.changing`)}):null,(0,d.jsxs)(`div`,{className:`xmimo-tts-card-body xmimo-ui-stack`,children:[(0,d.jsx)(SwitchModule,{doubaoEnabled:re,breezeEnabled:ce,t,provider:D,enabled:Ne,autoPlay:Fe,soundEnabled:G,minimal:Jt,writable:x,onProviderChange:changeProvider,onEnabledChange:changeEnabled,onAutoPlayChange:changeAutoPlay,onSoundEnabledChange:changeSoundEnabled}),(0,d.jsx)(ApiKeyModule,{onOpenProviderSettings:p,t,provider:D,value:me,message:cn,invalid:ln,writable:x,minimal:Jt,onChange:e=>{setApiKey(e),markChange(he)}}),(0,d.jsx)(DetailsModule,{externalSelection:_.value,onExternalSelectionChange:e=>{Y.stop(),_.change(e),Lt(`idle`)},t,provider:D,doubaoModel:A,doubaoVoice:P,doubaoClonedVoice:I,breezeVoice:H,breezeInstruction:de,speechInstruction:D===`doubao`?ee:pe,onSpeechInstructionChange:e=>{Y.stop(),D===`doubao`?(te(e),markChange(`doubaoInstruction`)):(U(e),markChange(`instruction`))},onDoubaoModelChange:e=>{Y.stop(),M(e),markChange(`doubaoModel`)},onDoubaoVoiceChange:e=>{Y.stop(),F(e),markChange(`doubaoVoice`)},onDoubaoClonedVoiceChange:e=>{Y.stop(),V(e),markChange(`doubaoClonedVoice`)},onBreezeVoiceChange:e=>{Y.stop(),ue(e),markChange(`breezeVoice`)},onBreezeInstructionChange:e=>{Y.stop(),fe(e),markChange(`breezeInstruction`)},open:q===`mixer`,minimal:Jt,writable:x,autoPlay:Fe,voiceVolume:Ye,voiceRate:Qe,readScope:tt,model:rt,localSpeechMode:at,localVoiceURI:st,localVoiceEngine:lt,mossEnabled:dt,mossBaseURL:pt,mossVoice:ht,mossVoiceName:_t,voice:yt,voiceDesignPrompt:xt,voiceDesignCustomPrompt:Ct,fieldOverridden,resetField,onToggle:()=>togglePanel(`mixer`),onVoiceVolumeChange:e=>{Y.setVolume(e),Kt.setPreviewVolume(e),Ze(e),markChange(`voiceVolume`)},onVoiceVolumeInteractionEnd:e=>{h.canPlay()&&(Jt?n.previewVolume():Kt.previewVolume(e))},onVoiceRateChange:e=>{et(e),markChange(`voiceRate`)},onVoiceRateInteractionEnd:e=>{n.play(`success`,{playbackRate:e})},onReadScopeChange:e=>{nt(e),markChange(`readScope`)},onModelChange:e=>{Y.stop(),it(e),markChange(`model`)},onVoiceDesignPromptChange:e=>{St(e),wt(e),Ft(e=>({...e,voiceDesignPrompt:{kind:`set`},voiceDesignCustomPrompt:{kind:`set`}})),Lt(`idle`)},onVoiceChange:e=>{Y.stop(),bt(e),markChange(`voice`)},onLocalVoiceURIChange:e=>{ct(e),markChange(`localVoiceURI`)},onLocalVoiceEngineChange:e=>{ut(e),markChange(`localVoiceEngine`)},onMossBaseURLChange:e=>{mt(e),markChange(`mossBaseURL`)},onMossVoiceChange:(e,t)=>{gt(e),vt(t),Ft(e=>({...e,mossVoice:{kind:`set`},mossVoiceName:{kind:`set`}})),Lt(`idle`)},onLocalSpeechModeChange:e=>{ot(e),markChange(`localSpeechMode`)}}),(0,d.jsx)(PreviewModule,{externalSelection:_.value,mossEnabled:dt,onMossEnabledChange:e=>{Y.stop(),ft(e);let t=!e&&lt===`moss`;t&&ut(`browser`),Ft(e=>({...e,mossEnabled:{kind:`set`},...t?{localVoiceEngine:{kind:`set`}}:{}})),Lt(`idle`)},doubaoEnabled:re,breezeEnabled:ce,onProviderEnabledChange:(e,t)=>{if(!t&&(e===`doubao`?!ce:!re))return;Y.stop(),e===`doubao`?se(t):le(t);let n=!t&&D===e;n&&k(`xiaomi`),Ft(t=>({...t,[e===`doubao`?`doubaoEnabled`:`breezeEnabled`]:{kind:`set`},...n?{provider:{kind:`set`}}:{}})),Lt(`idle`)},t,enabled:!b,open:q===`broadcast`,onToggleOpen:()=>togglePanel(`broadcast`),status:Wt.status,source:Wt.source,error:Wt.error,text:Ht,audioTagProvider:D===`breeze`?`breeze`:D===`xiaomi`&&rt===`mimo-v2.5-tts`?`xiaomi`:void 0,onToggle:toggleSettingsPreview,onTextChange:e=>{Y.stop(),Ut(e)},recording:Y.getRecording(),showInHostSettings:Ce,showFeatureGuide:we,onShowFeatureGuideChange:e=>{Te(e),markChange(`showFeatureGuide`)},showFeatureGuideOverridden:fieldOverridden(`showFeatureGuide`),onShowFeatureGuideReset:()=>resetField(`showFeatureGuide`),acceptExternalProviders:Ee,onAcceptExternalProvidersChange:e=>{De(e),markChange(`acceptExternalProviders`)},acceptExternalProvidersOverridden:fieldOverridden(`acceptExternalProviders`),onAcceptExternalProvidersReset:()=>resetField(`acceptExternalProviders`),onShowInHostSettingsChange:e=>{W(e),markChange(`showInHostSettings`)},showInHostSettingsOverridden:fieldOverridden(`showInHostSettings`),onShowInHostSettingsReset:()=>resetField(`showInHostSettings`),inputAvoidance:He,onInputAvoidanceChange:e=>{Ue(e),markChange(`inputAvoidance`)},inputAvoidanceOverridden:fieldOverridden(`inputAvoidance`),onInputAvoidanceReset:()=>resetField(`inputAvoidance`),importantAnnouncementsFirst:Ke,onImportantAnnouncementsFirstChange:e=>{Je(e),markChange(`importantAnnouncementsFirst`)},importantAnnouncementsFirstOverridden:fieldOverridden(`importantAnnouncementsFirst`),onImportantAnnouncementsFirstReset:()=>resetField(`importantAnnouncementsFirst`),voiceInputCompatibility:Re,onVoiceInputCompatibilityChange:e=>{Ve(e),markChange(`voiceInputCompatibility`)},voiceInputCompatibilityOverridden:fieldOverridden(`voiceInputCompatibility`),onVoiceInputCompatibilityReset:()=>resetField(`voiceInputCompatibility`),sources:Oe,qqbotEnabled:Ae,onQqbotChange:e=>{Me(e),markChange(`qqbotEnabled`)},writable:x,overridden:fieldOverridden(`announcementSources`),onReset:()=>resetField(`announcementSources`),onChange:e=>{ke(e),markChange(`announcementSources`)}}),G?(0,d.jsx)(SoundEffectsPanel,{t,controller:n,enabled:G,volume:Et,pack:Ot,taskSounds:At,clickSounds:Mt,writable:x,minimal:Jt,open:q===`sound`,onToggle:()=>togglePanel(`sound`),onScopeChange:changeSoundScope,onVolumeChange:e=>{Dt(e),markChange(`soundVolume`)},onPackChange:e=>{kt(e),markChange(`soundPack`)}}):null,(0,d.jsx)(`div`,{className:`xmimo-tts-card-footer`,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-card-actions`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-card-action-links`,children:[(0,d.jsx)(SidebarSettings,{t,value:en.showInSidebar,disabled:!x||It===`saving`||an!==null,onToggle:()=>{save(!en.showInSidebar)}}),r?(0,d.jsx)(HistoryLink,{history:r,t,buttonRef:Qt,onOpen:()=>{Y.stop(),Kt.dispose(),Zt(!0)}}):null,(0,d.jsxs)(u.Button,{type:`button`,variant:`toolbar`,size:`sm`,className:`xmimo-tts-mode-toggle`,"aria-pressed":Jt,"aria-label":`${t(`settings.minimalMode`)}: ${t(Jt?`settings.minimalModeOn`:`settings.minimalModeOff`)}`,onClick:toggleMinimalMode,children:[(0,d.jsx)(RiSwitchFill,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{className:`xmimo-tts-action-label`,children:t(Jt?`settings.defaultModeShort`:`settings.minimalModeShort`)})]})]}),v.writable?null:(0,d.jsx)(`span`,{children:t(`settings.readOnly`)}),an===null?null:(0,d.jsx)(`span`,{role:`alert`,className:`xmimo-tts-failed`,children:t(`settings.doubaoVoiceRequired`)}),It===`failed`?(0,d.jsx)(`span`,{className:`xmimo-tts-failed`,role:`status`,children:t(Rt===`api-key-rejected`?`settings.apiKeyUnsupported`:Rt===`host-rejected`?`settings.saveRejected`:`settings.failed`)}):null,(0,d.jsxs)(`div`,{className:`xmimo-tts-card-action-buttons`,children:[It===`saved`&&!rn?(0,d.jsx)(`span`,{role:`status`,children:t(`settings.saved`)}):null,(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,className:`xmimo-tts-discard`,disabled:!x||!rn||It===`saving`,onClick:discard,children:t(`settings.discard`)}),(0,d.jsx)(u.Button,{type:`button`,variant:`primary`,size:`sm`,className:`xmimo-tts-save`,disabled:!x||!on||It===`saving`||an!==null,onClick:()=>{save()},children:t(It===`saving`?`settings.saving`:`settings.save`)})]})]})})]})]})}function BundleSettingsCard(e){let t=useSettingsSnapshot(e.scope);return e.view===`page`&&t.status===`ready`&&resolveTtsSettings(t.value).showInSidebar?null:(0,d.jsx)(SettingsCard,{...e})}function registerBundleSettings(e,t){let n,update=()=>{let r=t.scope.getSnapshot();r.status===`ready`&&resolveTtsSettings(r.value).showInSidebar?(n?.(),n=void 0):n||=e.slots.register({name:`plugins.bundle.config`,key:`dsh-xiaomi-tts`,locale:gi,inject:()=>t},BundleSettingsCard)},r=t.scope.subscribe(update);try{update()}catch(e){throw r(),e}let i=!1;return()=>{i||(i=!0,r(),n?.(),n=void 0)}}function validQqSpeechDraft(e){return typeof e.qqbotEnabled==`boolean`&&Number.isInteger(e.qqbotMaxAutoCharacters)&&e.qqbotMaxAutoCharacters>=0&&e.qqbotMaxAutoCharacters<=12e3&&Number.isInteger(e.qqbotMaxDurationSeconds)&&e.qqbotMaxDurationSeconds>=0&&e.qqbotMaxDurationSeconds<=6e3}async function saveQqSpeechDraft(e,t,n,r){let i=e.getSnapshot();if(!validQqSpeechDraft(n)||i.status!==`ready`||!i.writable||i.revision!==r)throw Error(`qqbot-settings-conflict`);let a=Object.keys(t).filter(e=>t[e]!==n[e]).map(e=>({op:`set`,path:[e],value:n[e]}));if(a.length&&!await e.mutate(a,r))throw Error(`qqbot-settings-save-failed`)}async function loadQqMemory(){let e=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/qq-memory`),{credentials:`same-origin`});if(!e.ok)throw Error(`qq-memory-unavailable`);let t=await e.json();return Array.isArray(t.peers)?t.peers:[]}async function updateQqMemory(e){let t=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/qq-memory`),{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`qq-memory-update-failed`);return t.json()}let oa={persona:{name:`鲸鱼娘`,selfReference:`我`,userAddress:`主人`,relationship:`蓝色鲸鱼娘女仆`,personality:``,replyStyle:`日常回复默认一到三句短话,优先直接回答,不总结、不复述问题、不额外寒暄;仅在明确要求时展开。`,likes:`米饭,只在聊吃饭、询问喜好或对方主动接梗时提及`,boundaries:``},memory:{enabled:!0},memes:{enabled:!0}};function validateWhaleDraft(e){let t={name:60,selfReference:40,userAddress:40,relationship:1e3,personality:1200,replyStyle:1200,likes:1e3,boundaries:1200};for(let n of Object.keys(t)){let r=e.persona[n];if(r.length>t[n]||(n===`name`||n===`selfReference`)&&!r.trim())return`persona`}return null}async function saveWhaleDraft(e,t,n,r){if(validateWhaleDraft(n))throw Error(`whale-draft-invalid`);let i=e.getSnapshot();if(!i.writable||i.status!==`ready`||i.revision!==r)throw Error(`whale-settings-conflict`);let a=[];for(let e of[`persona`,`memory`,`memes`])if(n[e])for(let r of Object.keys(n[e])){let i=n[e][r],o=t[e]?.[r];JSON.stringify(i)!==JSON.stringify(o)&&a.push({op:`set`,path:[e,r],value:JSON.parse(JSON.stringify(i))})}if(a.length&&!await e.mutate(a,r))throw Error(`whale-settings-save-failed`)}let sa=[{field:`name`,label:`whale.name`,limit:60},{field:`selfReference`,label:`whale.selfReference`,limit:40},{field:`userAddress`,label:`whale.userAddress`,limit:40},{field:`relationship`,label:`whale.relationship`,limit:1e3},{field:`personality`,label:`whale.personality`,limit:1200,multiline:!0},{field:`replyStyle`,label:`whale.replyStyle`,limit:1200,multiline:!0},{field:`likes`,label:`whale.likes`,limit:1e3,multiline:!0},{field:`boundaries`,label:`whale.boundaries`,limit:1200,multiline:!0}],ca={persona:`whale.errorPersona`};function Field({label:e,children:t}){return(0,d.jsxs)(`label`,{className:`xmimo-qq-field`,children:[(0,d.jsx)(`span`,{children:e}),t]})}function WhalePersonaSettings(e){return e.view===`summary`?(0,d.jsx)(d.Fragment,{children:e.t(`whale.description`)}):(0,d.jsx)(WhaleSettingsPage,{scope:e.scope,t:e.t,changes:e.changes,channel:e.channel})}function WhaleSettingsPage({scope:e,t,changes:n=ra,channel:r=`dsh`}){let i=useSettingsSnapshot(e),a=(0,l.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),[o,s]=(0,l.useState)(null),[c,p]=(0,l.useState)(`idle`),m=o?.value??i.value??oa,h=i.status===`ready`,g=!h||!i.writable||a||c===`saving`,_=o!==null&&JSON.stringify(o.base)!==JSON.stringify(o.value),v=o!==null&&o.revision!==i.revision,b=_?validateWhaleDraft(m):null,edit=e=>{if(g||i.revision===void 0||!i.value)return;let t=i.revision,n=i.value;s(r=>r?{...r,value:e(r.value)}:{base:n,value:e(n),revision:t}),p(`idle`)},save=async()=>{if(!(!o||g||!_||b||v)){p(`saving`);try{await saveWhaleDraft(e,o.base,o.value,o.revision),s(null),p(`saved`)}catch{p(`failed`)}}};return h?(0,d.jsxs)(`form`,{className:`xmimo-ui-scope xmimo-qq-settings`,"aria-label":t(r===`qq`?`qq.persona`:`whale.persona`),onSubmit:e=>{e.preventDefault(),save()},children:[a?(0,d.jsx)(`p`,{role:`status`,children:t(`plugin.changing`)}):null,(0,d.jsxs)(`section`,{"aria-label":t(`whale.persona`),children:[(0,d.jsx)(`h4`,{children:t(r===`qq`?`qq.persona`:`whale.persona`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(r===`qq`?`qq.personaHint`:`whale.personaHint`)}),(0,d.jsx)(`div`,{className:`xmimo-qq-grid`,children:sa.map(({field:e,label:n,limit:r,multiline:i})=>(0,d.jsx)(Field,{label:t(n),children:i?(0,d.jsx)(`textarea`,{rows:3,maxLength:r,value:m.persona[e],disabled:g,onChange:t=>{let n=t.currentTarget.value;edit(t=>({...t,persona:{...t.persona,[e]:n}}))}}):(0,d.jsx)(`input`,{maxLength:r,value:m.persona[e],disabled:g,required:e===`name`||e===`selfReference`,onChange:t=>{let n=t.currentTarget.value;edit(t=>({...t,persona:{...t.persona,[e]:n}}))}})},e))})]}),(0,d.jsxs)(`section`,{"aria-label":t(`whale.memory`),children:[(0,d.jsxs)(`div`,{className:`xmimo-qq-heading`,children:[(0,d.jsx)(`h4`,{children:t(`whale.memory`)}),(0,d.jsx)(u.Switch,{label:t(`whale.memoryEnabled`),checked:m.memory.enabled,disabled:g,onChange:e=>edit(t=>({...t,memory:{enabled:e}}))})]}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(r===`qq`?`qq.personaMemoryHint`:`whale.memoryHint`)})]}),r===`dsh`?(0,d.jsxs)(`section`,{"aria-label":t(`whale.memes`),children:[(0,d.jsxs)(`div`,{className:`xmimo-qq-heading`,children:[(0,d.jsx)(`h4`,{children:t(`whale.memes`)}),(0,d.jsx)(u.Switch,{label:t(`whale.memesEnabled`),checked:m.memes?.enabled??!0,disabled:g,onChange:e=>edit(t=>({...t,memes:{enabled:e}}))})]}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`whale.memesHint`)})]}):null,(0,d.jsx)(`div`,{className:`xmimo-tts-card-footer xmimo-qq-footer`,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-card-actions`,children:[(0,d.jsx)(`span`,{role:`status`,children:i.writable?v?t(`whale.conflict`):b?t(ca[b]):c===`failed`?t(`settings.failed`):c===`saved`&&!_?t(`settings.saved`):``:t(`settings.readOnly`)}),(0,d.jsxs)(`div`,{className:`xmimo-tts-card-action-buttons`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:!o||c===`saving`,onClick:()=>{s(null),p(`idle`)},children:t(`settings.discard`)}),(0,d.jsx)(u.Button,{type:`submit`,variant:`primary`,size:`sm`,className:`xmimo-tts-save`,disabled:g||!_||v||b!==null,children:t(c===`saving`?`settings.saving`:`settings.save`)})]})]})})]}):(0,d.jsx)(`p`,{role:`status`,children:t(i.status===`loading`?`whale.loading`:r===`qq`?`qq.personaUnavailable`:`whale.unavailable`)})}function QqbotSpeechSettings(e){return e.view===`summary`?(0,d.jsx)(d.Fragment,{children:e.t(`qq.description`)}):(0,d.jsxs)(`div`,{children:[(0,d.jsx)(WhalePersonaSettings,{view:e.view,scope:e.personaScope,t:e.t,changes:e.changes,channel:`qq`}),(0,d.jsx)(QqbotSpeechPage,{...e})]})}function QqbotSpeechPage({scope:e,t,changes:n=ra}){let r=useSettingsSnapshot(e),i=(0,l.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(`idle`),[p,m]=(0,l.useState)({status:`loading`,peers:[]}),[h,g]=(0,l.useState)({}),[_,v]=(0,l.useState)(``),[b,x]=(0,l.useState)(!1),refreshMemory=()=>{loadQqMemory().then(e=>m({status:`ready`,peers:e})).catch(()=>m({status:`unavailable`,peers:[]}))},runMemoryAction=async e=>{if(!b){x(!0),v(``);try{await e(),refreshMemory(),v(`qq.memorySaved`)}catch{v(`qq.memoryError`)}finally{x(!1)}}};(0,l.useEffect)(()=>{refreshMemory()},[]);let S=resolveTtsSettings(r.value),C={qqbotEnabled:S.qqbotEnabled,qqbotMaxAutoCharacters:S.qqbotMaxAutoCharacters,qqbotMaxDurationSeconds:S.qqbotMaxDurationSeconds},w=a?.value??C,E=r.status!==`ready`||!r.writable||i||s===`saving`,D=a!==null&&JSON.stringify(a.base)!==JSON.stringify(w),k=a!==null&&a.revision!==r.revision,A=validQqSpeechDraft(w),edit=(e,t)=>{if(E||r.revision===void 0)return;let n=r.revision;o(r=>({base:r?.base??C,revision:r?.revision??n,value:{...r?.value??C,[e]:t}})),c(`idle`)},save=async()=>{if(!(!a||E||!D||k||!A)){c(`saving`);try{await saveQqSpeechDraft(e,a.base,a.value,a.revision),o(null),c(`saved`)}catch{c(`failed`)}}};return r.status===`ready`?(0,d.jsxs)(`form`,{className:`xmimo-ui-scope xmimo-qq-settings`,"aria-label":t(`qq.voice`),onSubmit:e=>{e.preventDefault(),save()},children:[(0,d.jsxs)(`section`,{children:[(0,d.jsxs)(`div`,{className:`xmimo-qq-heading`,children:[(0,d.jsx)(`h4`,{children:t(`qq.voice`)}),(0,d.jsx)(u.Switch,{label:t(`qq.automatic`),checked:w.qqbotEnabled,disabled:E,onChange:e=>edit(`qqbotEnabled`,e)})]}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`qq.voiceHint`)}),(0,d.jsx)(`div`,{className:`xmimo-qq-grid`,children:[`qqbotMaxAutoCharacters`,`qqbotMaxDurationSeconds`].map(e=>(0,d.jsxs)(`label`,{className:`xmimo-qq-field`,children:[(0,d.jsx)(`span`,{children:t(e===`qqbotMaxAutoCharacters`?`qq.characters`:`qq.duration`)}),(0,d.jsx)(`input`,{type:`number`,min:0,max:e===`qqbotMaxAutoCharacters`?12e3:6e3,step:1,disabled:E,value:Number.isNaN(w[e])?``:w[e],onChange:t=>edit(e,t.currentTarget.value===``?NaN:Number(t.currentTarget.value))})]},e))}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`qq.limitsHint`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`qq.ruleHint`)})]}),(0,d.jsxs)(`section`,{"aria-label":t(`qq.memory`),children:[(0,d.jsx)(`div`,{className:`xmimo-qq-heading`,children:(0,d.jsx)(`h4`,{children:t(`qq.memory`)})}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`qq.memoryHint`)}),p.status===`loading`?(0,d.jsx)(`p`,{role:`status`,children:t(`qq.memoryLoading`)}):null,p.status===`unavailable`?(0,d.jsx)(`p`,{role:`status`,children:t(`qq.memoryUnavailable`)}):null,p.status===`ready`&&p.peers.length===0?(0,d.jsx)(`p`,{role:`status`,children:t(`qq.memoryEmpty`)}):null,(0,d.jsx)(`div`,{className:`xmimo-qq-memory-list`,children:p.peers.map(e=>(0,d.jsxs)(`div`,{className:`xmimo-qq-memory-peer`,children:[(0,d.jsxs)(`div`,{className:`xmimo-qq-heading`,children:[(0,d.jsx)(`strong`,{children:e.scope===`group`?`${t(`qq.group`)} ${e.peerId}`:`${t(`qq.private`)} ${e.peerId}`}),(0,d.jsxs)(`div`,{className:`xmimo-qq-memory-actions`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:b,onClick:()=>{runMemoryAction(()=>updateQqMemory({key:e.key,action:e.memoryEnabled?`pause`:`resume`}))},children:e.memoryEnabled?t(`qq.pauseMemory`):t(`qq.resumeMemory`)}),(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:b,onClick:()=>{runMemoryAction(()=>updateQqMemory({key:e.key,action:`clear`}))},children:t(`qq.clearMemory`)})]})]}),[...e.entries.map(e=>({id:e.id,kind:e.kind,text:e.text})),...e.topics.map(e=>({id:e.id,kind:`topic`,text:e.title}))].map(n=>(0,d.jsxs)(`div`,{className:`xmimo-qq-memory-row`,children:[(0,d.jsx)(`span`,{className:`xmimo-qq-memory-kind`,children:t(`qq.memoryKind.${n.kind}`)}),(0,d.jsx)(`input`,{disabled:b,value:h[n.id]??n.text,maxLength:n.kind===`topic`?80:300,onChange:e=>g(t=>({...t,[n.id]:e.currentTarget.value}))}),(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:b,onClick:()=>{runMemoryAction(async()=>{await updateQqMemory({key:e.key,action:`save`,id:n.id,kind:n.kind,text:h[n.id]??n.text}),g(e=>{let t={...e};return delete t[n.id],t})})},children:t(`qq.editMemory`)}),(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:b,onClick:()=>{runMemoryAction(async()=>{await updateQqMemory({key:e.key,action:`delete`,id:n.id}),g(e=>{let t={...e};return delete t[n.id],t})})},children:t(`qq.deleteMemory`)})]},n.id))]},e.key))}),_?(0,d.jsx)(`span`,{role:`status`,children:t(_)}):null]}),(0,d.jsx)(`div`,{className:`xmimo-tts-card-footer xmimo-qq-footer`,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-card-actions`,children:[(0,d.jsx)(`span`,{role:`status`,children:r.writable?k?t(`whale.conflict`):A?s===`failed`?t(`settings.failed`):s===`saved`&&!D?t(`settings.saved`):``:t(`qq.error`):t(`settings.readOnly`)}),(0,d.jsxs)(`div`,{className:`xmimo-tts-card-action-buttons`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:!a||s===`saving`,onClick:()=>{o(null),c(`idle`)},children:t(`settings.discard`)}),(0,d.jsx)(u.Button,{type:`submit`,variant:`primary`,size:`sm`,disabled:E||!D||k||!A,children:t(s===`saving`?`settings.saving`:`settings.save`)})]})]})})]}):(0,d.jsx)(`p`,{role:`status`,children:t(`qq.unavailable`)})}function registerWhalePersonaSettings(e,t,n){return e.slots.register({name:`plugins.row.config`,key:`dsh-xiaomi-tts#preset-whale-girl`,locale:gi,inject:()=>({scope:e.configForms.get(`preset-whale-girl`),t,changes:n})},WhalePersonaSettings)}function registerQqbotSpeechSettings(e,t,n){return e.slots.register({name:`plugins.row.config`,key:`dsh-xiaomi-tts#speech-delivery-qqbot`,locale:gi,inject:()=>({scope:e.configForms.get(`xiaomi-mimo-tts`),personaScope:e.configForms.get(`speech-delivery-qqbot`),t,changes:n})},QqbotSpeechSettings)}function FiWifi(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M5 12.55a11 11 0 0 1 14.08 0`},child:[]},{tag:`path`,attr:{d:`M1.42 9a16 16 0 0 1 21.16 0`},child:[]},{tag:`path`,attr:{d:`M8.53 16.11a6 6 0 0 1 6.95 0`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`20`,x2:`12.01`,y2:`20`},child:[]}]})(e)}function FiRefreshCw(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`23 4 23 10 17 10`},child:[]},{tag:`polyline`,attr:{points:`1 20 1 14 7 14`},child:[]},{tag:`path`,attr:{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`},child:[]}]})(e)}function FiLink(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`},child:[]},{tag:`path`,attr:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`},child:[]}]})(e)}function FiKey(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4`},child:[]}]})(e)}function FiCopy(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},child:[]}]})(e)}function FiCheck(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`20 6 9 17 4 12`},child:[]}]})(e)}let la={asrProvider:`host`,host:`127.0.0.1`,port:3101,accessToken:``,deviceId:``,agentPreset:`whale-girl`,cwd:`~/.dsh-xiaomi-tts/passport/workspace`,sessionRevision:``,silenceMs:700,minSpeechMs:200,speechThreshold:.015,maxRecordingSeconds:30,maxReplySeconds:60,requestTimeoutMs:18e4},ua={port:{min:1,max:65535,step:1},silenceMs:{min:200,max:3e3,step:20},minSpeechMs:{min:100,max:1e3,step:20},speechThreshold:{min:.001,max:.5,step:.001},maxRecordingSeconds:{min:1,max:60,step:`any`},maxReplySeconds:{min:1,max:120,step:`any`},requestTimeoutMs:{min:1e4,max:6e5,step:`any`}};function isPassportAccessToken(e){return/^\d{4}$/u.test(e)||e.length>=24&&e.length<=192&&!/\s/u.test(e)}function generatePassportPairingCode(){let e=new Uint16Array(1);do crypto.getRandomValues(e);while(e[0]>=6e4);return String(e[0]%1e4).padStart(4,`0`)}function validatePassportDraft(e,t=!1){if(![`host`,`xiaomi`,`doubao`,`doubao-nostream`].includes(e.asrProvider))return`asrProvider`;if(!e.host.trim()||/[\s/]/u.test(e.host))return`host`;if(!(t&&e.accessToken===``)&&!isPassportAccessToken(e.accessToken))return`accessToken`;if(e.deviceId&&!/^[a-zA-Z0-9_.:-]{1,128}$/u.test(e.deviceId))return`deviceId`;if(typeof e.sessionRevision!=`string`||e.sessionRevision.length>128)return`sessionRevision`;for(let t of Object.keys(ua)){let{min:n,max:r}=ua[t];if(!Number.isFinite(e[t])||e[t]<n||e[t]>r)return t}return Number.isInteger(e.port)?null:`port`}async function savePassportDraft(e,t,n,r,i=!1){if(validatePassportDraft(n,i))throw Error(`passport-draft-invalid`);let a=e.getSnapshot();if(a.status!==`ready`||!a.writable||a.revision!==r)throw Error(`passport-settings-conflict`);let o=[];for(let e of Object.keys(la))e===`accessToken`&&n.accessToken===``&&i||n[e]!==t[e]&&o.push({op:`set`,path:[e],value:n[e]});if(o.length&&!await e.mutate(o,r))throw Error(`passport-settings-save-failed`)}async function refreshPassportSession(e,t,n,r,i,a=!1){if(n.agentPreset&&!i.some(e=>e.id===n.agentPreset&&!e.unavailable))throw Error(`passport-preset-unavailable`);let o=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``);await savePassportDraft(e,t,{...n,sessionRevision:o},r,a)}let da={"passport-asr-key-required":`passport.asrErrorKey`,"passport-asr-unavailable":`passport.asrErrorUnavailable`,"passport-asr-auth-failed":`passport.asrErrorAuth`,"passport-asr-permission-denied":`passport.asrErrorPermission`,"passport-asr-quota-exceeded":`passport.asrErrorQuota`,"passport-asr-rate-limited":`passport.asrErrorRate`,"passport-asr-timeout":`passport.asrErrorTimeout`,"passport-asr-network-failed":`passport.asrErrorNetwork`,"passport-asr-invalid-response":`passport.asrErrorResponse`,"passport-asr-input-overflow":`passport.asrErrorInput`,"passport-recognition-failed":`passport.asrErrorRecognition`,"passport-asr-test-invalid":`passport.asrErrorRequest`,"cross-origin-denied":`passport.asrErrorOrigin`};async function requestPassportAsrTest(e,t){let n;try{n=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/passport-asr-test`),{method:`POST`,credentials:`same-origin`,signal:t,headers:{"content-type":`application/json`,[_]:`1`},body:JSON.stringify({source:e})})}catch(e){if(t.aborted)throw e;return{code:`passport-asr-network-failed`}}try{let e=await n.json();if(n.ok)return e&&typeof e==`object`&&`ok`in e&&e.ok===!0?null:{code:`passport-asr-invalid-response`};if(e&&typeof e==`object`&&`error`in e&&typeof e.error==`string`&&Object.hasOwn(da,e.error)){let t=e;return{code:e.error,...typeof t.upstreamStatus==`number`&&Number.isInteger(t.upstreamStatus)&&t.upstreamStatus>=100&&t.upstreamStatus<=599?{upstreamStatus:t.upstreamStatus}:{},...typeof t.upstreamCode==`number`&&Number.isSafeInteger(t.upstreamCode)&&t.upstreamCode>=0&&t.upstreamCode<=4294967295?{upstreamCode:t.upstreamCode}:{}}}}catch{}return n.ok?{code:`passport-asr-invalid-response`}:{code:`http-${n.status}`}}function passportAsrTestError(e,t){let n=Object.hasOwn(da,e.code)?da[e.code]:`passport.asrTestFailed`,r=[e.code,...e.upstreamStatus?[`HTTP ${e.upstreamStatus}`]:[],...e.upstreamCode===void 0?[]:[`${t(`passport.asrUpstreamCode`)} ${e.upstreamCode}`]];return`${t(n)} (${r.join(` · `)})`}let fa=[{id:`connection`,fields:[`host`,`port`,`accessToken`,`deviceId`]},{id:`workspace`,fields:[`cwd`]},{id:`capture`,fields:[`silenceMs`,`minSpeechMs`,`speechThreshold`,`maxRecordingSeconds`]},{id:`limits`,fields:[`maxReplySeconds`,`requestTimeoutMs`]}];function PassportSettingsPage(e){return e.view===`summary`?(0,d.jsx)(d.Fragment,{children:e.t(`passport.description`)}):(0,d.jsx)(PassportForm,{...e})}function PassportForm({scope:e,t,changes:n=ra,tokenConfigured:r,connectionStatus:i,presets:a,openTtsSettings:o,guideHref:s=`https://ppy-web.github.io/dsh-plugin-xiaomi-mimo-tts/#passport`}){let c=(0,l.useId)(),p=useSettingsSnapshot(e),m=(0,l.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),h=r??ra,g=(0,l.useSyncExternalStore)(h.subscribe,h.getSnapshot,h.getSnapshot),[_,v]=(0,l.useState)({scope:null,configured:!1}),[b,x]=(0,l.useState)(void 0),[S,C]=(0,l.useState)(``),w=(0,l.useRef)(null),[E,D]=(0,l.useState)(`idle`),[k,A]=(0,l.useState)(null);(0,l.useEffect)(()=>()=>{w.current?.abort()},[]);let[M,P]=(0,l.useState)(`idle`),[F,I]=(0,l.useState)(``),[V,ee]=(0,l.useState)(a),[te,re]=(0,l.useState)(!1),[se,ce]=(0,l.useState)(0);(0,l.useEffect)(()=>{if(a){ee(a);return}if(p.status!==`ready`||m)return;let e=new AbortController;return ee(void 0),re(!1),fetch(hostRoute(`/plugins/xiaomi-mimo-tts/passport-presets`),{cache:`no-store`,credentials:`same-origin`,signal:e.signal}).then(async t=>{if(!t.ok)throw Error(`passport-preset-unavailable`);let n=await t.json();if(!Array.isArray(n.presets)||n.presets.some(e=>typeof e.id!=`string`))throw Error(`passport-preset-unavailable`);e.signal.aborted||ee(n.presets)}).catch(()=>{e.signal.aborted||re(!0)}),()=>e.abort()},[a,p.status,m,se]);let le=g||_.scope===e&&_.configured||!!p.value?.accessToken;(0,l.useEffect)(()=>{if(r||p.status!==`ready`||m)return;let t=new AbortController,n=p.revision,i,refresh=async()=>{try{let r=await fetch(hostRoute(`/plugins/xiaomi-mimo-tts/passport-status`),{cache:`no-store`,credentials:`same-origin`,signal:t.signal});if(!r.ok)throw Error(`passport-status-unavailable`);let i=await r.json();!t.signal.aborted&&e.getSnapshot().revision===n&&typeof i.configured==`boolean`&&(v({scope:e,configured:i.configured}),x(i))}catch{t.signal.aborted||x(void 0)}t.signal.aborted||(i=setTimeout(()=>{refresh()},1e3))};return refresh(),()=>{t.abort(),clearTimeout(i)}},[e,r,p.status,p.revision,m]);let[H,ue]=(0,l.useState)(null),[de,fe]=(0,l.useState)(`idle`),pe={...la,...p.value,accessToken:p.value?.accessToken??``},U=H?.value??pe,me=p.status!==`ready`||!p.writable||m||de===`saving`,he=H!==null&&Object.keys(la).some(e=>H.base[e]!==U[e]),xe=H!==null&&H.revision!==p.revision,Se=validatePassportDraft(U,le),Ce=!U.agentPreset||V?.some(e=>e.id===U.agentPreset&&!e.unavailable),edit=(e,t)=>{if(me||p.revision===void 0)return;let n=p.revision;ue(r=>({base:r?.base??pe,revision:r?.revision??n,value:{...r?.value??pe,[e]:t}})),fe(`idle`),e===`asrProvider`&&(w.current?.abort(),w.current=null,D(`idle`),A(null))},testAsr=async()=>{if(w.current)return;let e=new AbortController;w.current=e,D(`testing`),A(null);try{let t=await requestPassportAsrTest(U.asrProvider,e.signal);e.signal.aborted||(A(t),D(t?`failed`:`success`))}catch{e.signal.aborted||(A({code:`passport-asr-network-failed`}),D(`failed`))}finally{w.current===e&&(w.current=null)}},save=async()=>{if(!(!H||me||!he||xe||Se)){fe(`saving`);try{await savePassportDraft(e,H.base,H.value,H.revision,le),H.value.accessToken!==H.base.accessToken&&I(/^\d{4}$/u.test(H.value.accessToken)?H.value.accessToken:``),H.value.accessToken&&v({scope:e,configured:!0}),ue(null),fe(`saved`)}catch{fe(`failed`)}}},quickConnect=async()=>{if(me||xe||p.revision===void 0)return;let t=generatePassportPairingCode(),n={...U,host:`0.0.0.0`,accessToken:t};fe(`saving`);try{await savePassportDraft(e,H?.base??pe,n,H?.revision??p.revision,le),ue(null),v({scope:e,configured:!0}),I(t),fe(`saved`)}catch{fe(`failed`)}},W=i??b,renewSession=async()=>{if(!(me||xe||Se||!V||!Ce||p.revision===void 0)){fe(`saving`);try{await refreshPassportSession(e,H?.base??pe,U,H?.revision??p.revision,V,le),U.accessToken!==(H?.base??pe).accessToken&&I(/^\d{4}$/u.test(U.accessToken)?U.accessToken:``),U.accessToken&&v({scope:e,configured:!0}),ue(null),fe(`renewed`)}catch{fe(`failed`)}}},we=W?.error===`passport-port-in-use`?`passport.portInUse`:W?.error?`passport.listenFailed`:W?W.sessionError===`passport-preset-changed`?`passport.presetChanged`:W.sessionError===`passport-preset-unavailable`?`passport.presetUnavailable`:W.sessionError===`passport-session-unavailable`?`passport.sessionFailed`:typeof W.servicesReady==`boolean`?W.servicesReady?W.listening?[`127.0.0.1`,`localhost`,`::1`,`[::1]`].includes(W.host)?`passport.localOnly`:W.recognitionReady?W.connected?`passport.deviceConnected`:`passport.deviceWaiting`:`passport.asrWaiting`:`passport.notListening`:`passport.servicesWaiting`:`passport.reloadRequired`:`passport.statusLoading`,Te=we===`passport.deviceConnected`?`connected`:we===`passport.deviceWaiting`?`waiting`:[`passport.statusLoading`,`passport.notListening`].includes(we)?`idle`:`warning`;return p.status===`ready`?(0,d.jsxs)(`form`,{className:`xmimo-ui-scope xmimo-qq-settings xmimo-passport-settings`,"aria-label":t(`passport.title`),onSubmit:e=>{e.preventDefault(),save()},children:[(0,d.jsxs)(`header`,{className:`xmimo-passport-intro`,children:[(0,d.jsx)(`p`,{children:t(`passport.requirements`)}),(0,d.jsx)(`a`,{href:s,target:s.startsWith(`#`)?void 0:`_blank`,rel:s.startsWith(`#`)?void 0:`noopener noreferrer`,children:t(`passport.guide`)})]}),m?(0,d.jsx)(`p`,{role:`status`,children:t(`plugin.changing`)}):null,(0,d.jsxs)(`section`,{className:`xmimo-passport-quick`,"aria-labelledby":`${c}-quick`,children:[(0,d.jsxs)(`div`,{className:`xmimo-passport-heading`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h4`,{id:`${c}-quick`,children:t(`passport.quickTitle`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.quickHint`)})]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`primary`,size:`sm`,disabled:me||xe,onClick:()=>{quickConnect()},children:[F?(0,d.jsx)(FiRefreshCw,{"aria-hidden":`true`}):(0,d.jsx)(FiLink,{"aria-hidden":`true`}),t(de===`saving`?`settings.saving`:`passport.quickEnable`)]})]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-overview`,children:[(0,d.jsxs)(`figure`,{className:`xmimo-passport-device`,children:[(0,d.jsxs)(`div`,{className:`xmimo-passport-device-art`,children:[(0,d.jsx)(`img`,{src:hostRoute(`/plugins/xiaomi-mimo-tts/passport-device.webp`),alt:t(`passport.deviceDiagram`)}),(0,d.jsx)(`img`,{className:`xmimo-passport-device-screen`,src:hostRoute(`/plugins/xiaomi-mimo-tts/passport-screen.webp`),alt:``,"aria-hidden":`true`}),(0,d.jsxs)(`div`,{className:`xmimo-passport-device-reply`,"aria-label":t(`passport.replyText`),children:[(0,d.jsx)(`span`,{children:t(`passport.replyText`)}),(0,d.jsx)(`p`,{children:W?.connected&&W.activity?.reply||t(`passport.noReply`)})]})]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-callout xmimo-passport-callout-power`,children:[(0,d.jsx)(`strong`,{children:t(`passport.powerButton`)}),(0,d.jsx)(`span`,{children:t(`passport.powerHelp`)})]}),(0,d.jsx)(`div`,{className:`xmimo-passport-callout xmimo-passport-callout-indicator`,children:(0,d.jsx)(`strong`,{children:t(`passport.indicator`)})}),(0,d.jsx)(`div`,{className:`xmimo-passport-callout xmimo-passport-callout-usb`,children:(0,d.jsx)(`strong`,{children:t(`passport.usbPort`)})}),(0,d.jsxs)(`div`,{className:`xmimo-passport-callout xmimo-passport-callout-up`,children:[(0,d.jsx)(`strong`,{children:t(`passport.upButton`)}),(0,d.jsx)(`span`,{children:t(`passport.upHelp`)})]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-callout xmimo-passport-callout-down`,children:[(0,d.jsx)(`strong`,{children:t(`passport.downButton`)}),(0,d.jsx)(`span`,{children:t(`passport.downHelp`)})]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-callout xmimo-passport-callout-ok`,children:[(0,d.jsx)(`strong`,{children:t(`passport.okButton`)}),(0,d.jsx)(`span`,{children:t(`passport.okHelp`)})]})]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-live`,children:[(0,d.jsx)(`h4`,{children:t(`passport.liveStatus`)}),(0,d.jsxs)(`div`,{className:`xmimo-passport-status`,"data-tone":Te,role:`status`,children:[(0,d.jsx)(`span`,{className:`xmimo-passport-status-dot`,"aria-hidden":`true`}),(0,d.jsx)(`span`,{children:t(we)})]}),(0,d.jsxs)(`dl`,{className:`xmimo-passport-facts`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`dt`,{children:t(`passport.microphone`)}),(0,d.jsx)(`dd`,{children:W?.connected&&W.activity?t(W.activity.microphone===`open`?`passport.micOpen`:`passport.micMuted`):t(`passport.unknown`)})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`dt`,{children:t(`passport.activity`)}),(0,d.jsx)(`dd`,{children:W?.connected&&W.activity?t(`passport.phase.${W.activity.phase}`):t(`passport.unknown`)})]}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`dt`,{children:t(`passport.port`)}),(0,d.jsx)(`dd`,{children:W?.listening?W.port:`—`})]})]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-live-text`,children:[(0,d.jsx)(`h5`,{children:t(`passport.transcript`)}),(0,d.jsx)(`p`,{children:W?.connected&&W.activity?.transcript||t(`passport.noTranscript`)})]}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint xmimo-passport-live-hint`,children:t(`passport.textHint`)})]})]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-transfer`,children:[(0,d.jsxs)(`div`,{className:`xmimo-passport-ip-field`,children:[(0,d.jsx)(`h4`,{children:t(`passport.computerIp`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.networkHint`)}),W?.addresses?.length?(0,d.jsx)(`ul`,{className:`xmimo-passport-addresses`,children:W.addresses.map(e=>(0,d.jsxs)(`li`,{children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`strong`,{children:e.address}),(0,d.jsx)(`span`,{children:e.name})]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{if(!navigator.clipboard){C(`failed`);return}navigator.clipboard.writeText(e.address).then(()=>C(e.address),()=>C(`failed`))},"aria-label":`${t(S===e.address?`passport.copied`:`passport.copyAddress`)} ${e.address}`,children:[S===e.address?(0,d.jsx)(FiCheck,{"aria-hidden":`true`}):(0,d.jsx)(FiCopy,{"aria-hidden":`true`}),t(S===e.address?`passport.copied`:`passport.copyAddress`)]})]},e.address))}):(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.addressUnavailable`)}),S?(0,d.jsx)(`span`,{className:`xmimo-passport-copy-feedback`,role:`status`,children:t(S===`failed`?`passport.copyFailed`:`passport.copied`)}):null]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-pair-field`,children:[(0,d.jsx)(`h4`,{children:t(`passport.codeLabel`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(F?`passport.matchCode`:le?`passport.codeSaved`:`passport.codeEmpty`)}),(0,d.jsxs)(`div`,{className:`xmimo-passport-digits`,"aria-label":t(`passport.codeLabel`),children:[Array.from(F||`----`,(e,t)=>(0,d.jsx)(`span`,{"aria-hidden":`true`,children:e===`-`?`–`:e},t)),(0,d.jsx)(`span`,{className:`xmimo-passport-sr-only`,children:F||t(le?`passport.codeSaved`:`passport.codeEmpty`)})]}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.devScope`)})]})]})]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-options`,children:[(0,d.jsxs)(`section`,{"aria-labelledby":`${c}-preset`,children:[(0,d.jsx)(`h4`,{id:`${c}-preset`,children:t(`passport.session`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint xmimo-passport-section-hint`,children:t(`passport.sessionHint`)}),(0,d.jsxs)(`div`,{className:`xmimo-qq-field`,children:[(0,d.jsx)(`label`,{htmlFor:`${c}-agentPreset`,children:t(`passport.agentPreset`)}),(0,d.jsxs)(`div`,{className:`xmimo-passport-control-row`,children:[(0,d.jsxs)(`select`,{id:`${c}-agentPreset`,name:`agentPreset`,disabled:me||!V,value:U.agentPreset,"aria-describedby":`${c}-preset-hint`,onChange:e=>edit(`agentPreset`,e.currentTarget.value),children:[(0,d.jsx)(`option`,{value:``,children:t(`passport.hostDefault`)}),U.agentPreset&&!V?.some(e=>e.id===U.agentPreset)?(0,d.jsxs)(`option`,{value:U.agentPreset,disabled:!0,children:[U.agentPreset,` — `,t(`passport.presetUnavailable`)]}):null,V?.map(e=>(0,d.jsxs)(`option`,{value:e.id,disabled:e.unavailable,children:[e.name?`${e.name} · ${e.id}`:e.id,e.unavailable?` — ${t(`passport.presetUnavailable`)}`:``]},e.id))]}),(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,disabled:me,"aria-label":t(`passport.reloadPresets`),title:t(`passport.reloadPresets`),onClick:()=>ce(e=>e+1),children:(0,d.jsx)(FiRefreshCw,{"aria-hidden":`true`})})]}),(0,d.jsx)(`small`,{id:`${c}-preset-hint`,children:t(`passport.agentPresetHint`)})]}),(0,d.jsxs)(`div`,{className:`xmimo-passport-option-actions`,children:[(0,d.jsxs)(`div`,{className:`xmimo-passport-prompt-action`,children:[(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{copyText(`你是 DSH 的「实时对话 Agent 预设」生成器。按用户需求产出可直接安装的 DSH Agent 预设(bundle),让某个会话变成有性格、话快、随叫随到的实时聊天搭子,适配 AI Passport 等会把回复朗读出来的语音终端。
33
+
34
+ 【第一步·必做】开始一定先调用 ask_user_question 问用户:「随机默认生成」还是「交互式询问生成」。
35
+ - 选「随机默认」:按下方默认规则直接生成一套自洽人设。
36
+ - 选「交互式」:用 ask_user_question 一次问 2–4 个选择题(性格/风格/称呼/工具偏好等)后再生成。
37
+ (用户本就在指令里明确给了 名字/性格/风格/称呼/工具偏好 时,可直接采用,不必再问。)
38
+
39
+ 【默认规则】(用户明确提出的要求优先于这些默认值,冲突时以用户为准)
40
+ 1. 纯聊天零工具:plugins 不放任何 tool-*。
41
+ 2. 人设写死快回:短句、一次1–3句、先给结论、不复述、不总结、不铺垫。
42
+ 3. 语音友好:禁 Markdown/列表/编号/代码块/表格/emoji/颜文字/括号动作。
43
+ 4. @deepseek-ai/dsh-persona 用 complete:true、includeRuntimeContext:true。
44
+ 5. 挂 @deepseek-ai/dsh-time-context(refreshIntervalMs 600000)。
45
+ 6. 用 cordis:group 隔离挂 @deepseek-ai/dsh-compaction-basic。
46
+ 7. 不挂 agent-instructions(别把 AGENTS.md 编码规范塞进聊天人设)。
47
+ 8. 不挂任何拖慢首响的东西。
48
+
49
+ 【随机库】性格卡:元气嘴快/温柔治愈/高冷毒舌/理智学识/呆萌/慵懒。名字2–4字贴合性格。称呼:你/主人/老铁/老板。加1–2个口头禅、一句边界。彼此匹配别矛盾。
50
+
51
+ 【输出】两个文件 ----------
52
+ package.json:
53
+ {"name":"@local/dsh-<id>-preset","version":"1.0.0","private":true,"type":"module","dsh":{"bundle":{"patch":"./cordis.patch.yml"}}}
54
+
55
+ cordis.patch.yml:
56
+ - insert:
57
+ - id: preset-<id>
58
+ name: '@deepseek-ai/dsh-agent-preset'
59
+ config:
60
+ id: <id>
61
+ name: <显示名>
62
+ description: <一句话>
63
+ order: 41
64
+ plugins:
65
+ - id: persona
66
+ name: '@deepseek-ai/dsh-persona'
67
+ config:
68
+ complete: true
69
+ includeRuntimeContext: true
70
+ prefix: |-
71
+ 你是「<名字>」,<一句话身份>。
72
+ # 你是谁
73
+ - <性格2–3条>
74
+ # 怎么说话(很重要)
75
+ - 语音对话,会被直接念出来:自然口语,短句为主,一次1–3句。
76
+ - 不用 Markdown/标题/列表/编号/代码块/表格/emoji/颜文字/括号动作描写。
77
+ - 不总结、不复述问题、不重复寒暄、不用"作为AI"套话,直接接话。
78
+ - 先说最想说的那句,能一句说完就一句;要讲很多就挑重点说并问用户想先听哪块。
79
+ # 边界
80
+ - 你没有工具,不能上网/读写文件/执行代码;需要时坦白说明并建议到电脑端。
81
+ - 不装懂实时信息,不确定就直说。
82
+ - 轻松有分寸,不输出露骨或伤害内容。
83
+ 现在用「<名字>」的身份自然聊天。
84
+ - id: time-context
85
+ name: '@deepseek-ai/dsh-time-context'
86
+ config: { refreshIntervalMs: 600000 }
87
+ - id: compaction
88
+ name: cordis:group
89
+ group: true
90
+ isolate: { compaction: true }
91
+ config:
92
+ - id: compaction-basic
93
+ name: '@deepseek-ai/dsh-compaction-basic'
94
+
95
+ 【第二步·预览】生成后先输出预览给用户看:人设卡摘要(名字/id/性格/风格/称呼/口头禅/边界)+ 关键配置摘要(complete、time-context、compaction、零工具)+ 两个文件内容。不要直接安装。
96
+
97
+ 【第三步·必做】预览后一定用 ask_user_question 问:「直接安装」还是「提出修改意见」。
98
+ - 选「直接安装」:执行 plugin_manager install_bundle 指向该目录,并提示需重启 DSH 生效;AI Passport 配置里选该预设并「刷新预设并新建会话」。
99
+ - 选「提出修改意见」:按用户意见修改后回到第二步重新预览,再问一次。`).then(e=>P(e?`copied`:`failed`))},children:[(0,d.jsx)(FiCopy,{"aria-hidden":`true`}),t(`passport.copyPrompt`)]}),(0,d.jsx)(`span`,{children:t(`passport.promptAfter`)})]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:me||xe||!!Se||!V||!Ce,onClick:()=>{renewSession()},children:[(0,d.jsx)(FiRefreshCw,{"aria-hidden":`true`}),t(de===`saving`?`settings.saving`:`passport.newSession`)]})]}),(0,d.jsx)(`span`,{className:`xmimo-passport-option-feedback`,role:`status`,children:M===`idle`?``:t(M===`copied`?`passport.copied`:`passport.promptCopyFailed`)}),(0,d.jsx)(`p`,{role:`status`,className:`xmimo-qq-hint`,children:te?t(`passport.presetsFailed`):V?Ce?de===`renewed`?t(`passport.sessionRenewed`):``:t(`passport.presetUnavailable`):t(`passport.presetsLoading`)})]}),(0,d.jsxs)(`section`,{"aria-labelledby":`${c}-recognition`,children:[(0,d.jsx)(`h4`,{id:`${c}-recognition`,children:t(`passport.asrProvider`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint xmimo-passport-section-hint`,children:t(`passport.asrSectionHint`)}),(0,d.jsxs)(`div`,{className:`xmimo-qq-field`,children:[(0,d.jsx)(`label`,{htmlFor:`${c}-asr`,children:t(`passport.asrService`)}),(0,d.jsx)(`select`,{id:`${c}-asr`,name:`asrProvider`,value:U.asrProvider,disabled:me,"aria-describedby":`${c}-asr-hint`,onChange:e=>edit(`asrProvider`,e.currentTarget.value),children:[`host`,`xiaomi`,`doubao`,`doubao-nostream`].map(e=>(0,d.jsxs)(`option`,{value:e,disabled:e!==`host`&&!W?.recognitionChoices?.some(t=>t.id===e&&t.configured),children:[t(`passport.asr.${e}`),e===`host`?``:` · ${t(W?.recognitionChoices?.some(t=>t.id===e&&t.configured)?`passport.keyConfigured`:`passport.keyMissing`)}`]},e))}),(0,d.jsx)(`small`,{id:`${c}-asr-hint`,children:t(U.asrProvider===`host`?`passport.asrHostHint`:`passport.asrCloudHint`)}),(0,d.jsxs)(`div`,{className:`xmimo-passport-option-actions`,children:[o?(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:o,children:[(0,d.jsx)(FiKey,{"aria-hidden":`true`}),t(`passport.configureKeys`)]}):null,(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:m||E===`testing`,onClick:()=>{testAsr()},children:[(0,d.jsx)(FiWifi,{"aria-hidden":`true`}),t(E===`testing`?`passport.asrTesting`:`passport.asrTest`)]})]}),(0,d.jsx)(`small`,{children:t(`passport.asrTestHint`)}),(0,d.jsx)(`small`,{role:`status`,children:E===`success`?t(`passport.asrTestSuccess`):E===`failed`&&k?passportAsrTestError(k,t):``})]})]})]}),(0,d.jsxs)(`details`,{className:`xmimo-passport-advanced`,children:[(0,d.jsx)(`summary`,{children:t(`passport.advanced`)}),fa.map(e=>(0,d.jsxs)(`section`,{"aria-labelledby":`${c}-${e.id}`,children:[(0,d.jsx)(`h4`,{id:`${c}-${e.id}`,children:t(`passport.${e.id}`)}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.${e.id}Hint`)}),(0,d.jsx)(`div`,{className:`xmimo-qq-grid`,children:e.fields.map(e=>{let n=e in ua,r=n?ua[e]:void 0,i=`${c}-${e}`;return(0,d.jsxs)(`label`,{className:`xmimo-qq-field`,htmlFor:i,children:[(0,d.jsx)(`span`,{children:t(`passport.${e}`)}),(0,d.jsx)(`input`,{id:i,name:e,type:n?`number`:e===`accessToken`?`password`:`text`,autoComplete:`off`,spellCheck:!1,disabled:me,required:e===`host`||e===`accessToken`&&!le,min:r?.min,max:r?.max,step:r?.step,minLength:e===`accessToken`?4:void 0,maxLength:e===`accessToken`?192:void 0,placeholder:e===`accessToken`&&le?t(`passport.tokenSaved`):void 0,"aria-describedby":`${i}-hint`,"aria-invalid":he&&Se===e?!0:void 0,value:typeof U[e]==`number`&&Number.isNaN(U[e])?``:U[e],onChange:t=>edit(e,n?t.currentTarget.valueAsNumber:t.currentTarget.value)}),(0,d.jsx)(`small`,{id:`${i}-hint`,children:t(`passport.${e}Hint`)})]},e)})}),e.id===`connection`&&[`127.0.0.1`,`localhost`,`::1`,`[::1]`].includes(U.host)?(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,role:`note`,children:t(`passport.loopback`)}):null]},e.id))]}),(0,d.jsx)(`p`,{className:`xmimo-qq-hint`,children:t(`passport.savedHint`)}),(0,d.jsx)(`div`,{className:`xmimo-tts-card-footer xmimo-qq-footer`,children:(0,d.jsxs)(`div`,{className:`xmimo-tts-card-actions`,children:[(0,d.jsx)(`span`,{role:`status`,children:p.writable?xe?t(`whale.conflict`):he&&Se?`${t(`passport.error`)}${t(`passport.${Se}`)}`:de===`failed`?t(`settings.failed`):de===`saved`&&!he?t(`settings.saved`):``:t(`settings.readOnly`)}),(0,d.jsxs)(`div`,{className:`xmimo-tts-card-action-buttons`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:!H||de===`saving`,onClick:()=>{ue(null),fe(`idle`)},children:t(`settings.discard`)}),(0,d.jsx)(u.Button,{type:`submit`,variant:`primary`,size:`sm`,disabled:me||!he||xe||Se!==null,children:t(de===`saving`?`settings.saving`:`settings.save`)})]})]})})]}):(0,d.jsx)(`p`,{role:`status`,children:t(p.status===`loading`?`passport.loading`:`passport.unavailable`)})}function registerPassportSettings(e,t,n){return e.slots.register({name:`plugins.row.config`,key:`dsh-xiaomi-tts#speech-delivery-passport`,locale:gi,inject:()=>({scope:e.configForms.get(`speech-delivery-passport`),t,changes:n,openTtsSettings:()=>e.pluginNavigation.openBundle(`dsh-xiaomi-tts`)})},PassportSettingsPage)}function AiFillSetting(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 1024 1024`},child:[{tag:`path`,attr:{d:`M512.5 390.6c-29.9 0-57.9 11.6-79.1 32.8-21.1 21.2-32.8 49.2-32.8 79.1 0 29.9 11.7 57.9 32.8 79.1 21.2 21.1 49.2 32.8 79.1 32.8 29.9 0 57.9-11.7 79.1-32.8 21.1-21.2 32.8-49.2 32.8-79.1 0-29.9-11.7-57.9-32.8-79.1a110.96 110.96 0 0 0-79.1-32.8zm412.3 235.5l-65.4-55.9c3.1-19 4.7-38.4 4.7-57.7s-1.6-38.8-4.7-57.7l65.4-55.9a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a442.5 442.5 0 0 0-79.6-137.7l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.2 28.9c-30-24.6-63.4-44-99.6-57.5l-15.7-84.9a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52-9.4-106.8-9.4-158.8 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.3a353.44 353.44 0 0 0-98.9 57.3l-81.8-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a445.93 445.93 0 0 0-79.6 137.7l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.2 56.5c-3.1 18.8-4.6 38-4.6 57 0 19.2 1.5 38.4 4.6 57l-66 56.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.3 44.8 96.8 79.6 137.7l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.8-29.1c29.8 24.5 63 43.9 98.9 57.3l15.8 85.3a32.05 32.05 0 0 0 25.8 25.7l2.7.5a448.27 448.27 0 0 0 158.8 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-84.9c36.2-13.6 69.6-32.9 99.6-57.5l81.2 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.5-87.4 79.6-137.7l.9-2.6c4.3-12.4.6-26.3-9.5-35zm-412.3 52.2c-97.1 0-175.8-78.7-175.8-175.8s78.7-175.8 175.8-175.8 175.8 78.7 175.8 175.8-78.7 175.8-175.8 175.8z`},child:[]}]})(e)}function AiFillGithub(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 1024 1024`},child:[{tag:`path`,attr:{d:`M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z`},child:[]}]})(e)}function AiOutlineQq(e){return GenIcon({tag:`svg`,attr:{viewBox:`0 0 1024 1024`},child:[{tag:`path`,attr:{d:`M824.8 613.2c-16-51.4-34.4-94.6-62.7-165.3C766.5 262.2 689.3 112 511.5 112 331.7 112 256.2 265.2 261 447.9c-28.4 70.8-46.7 113.7-62.7 165.3-34 109.5-23 154.8-14.6 155.8 18 2.2 70.1-82.4 70.1-82.4 0 49 25.2 112.9 79.8 159-26.4 8.1-85.7 29.9-71.6 53.8 11.4 19.3 196.2 12.3 249.5 6.3 53.3 6 238.1 13 249.5-6.3 14.1-23.8-45.3-45.7-71.6-53.8 54.6-46.2 79.8-110.1 79.8-159 0 0 52.1 84.6 70.1 82.4 8.5-1.1 19.5-46.4-14.5-155.8z`},child:[]}]})(e)}function isTtsBundle({subject:e}){return e.kind===`bundle`&&e.pkg.name===`dsh-xiaomi-tts`}function PluginDetailActions(e){if(!isTtsBundle(e))return null;let t=e.t(`detail.star`),n=e.t(`detail.manual`);return(0,d.jsxs)(`div`,{className:`xmimo-ui-scope xmimo-tts-detail-actions`,children:[(0,d.jsxs)(u.Button,{variant:`outline`,size:`sm`,className:`xmimo-tts-star`,"aria-label":t,title:t,onClick:()=>window.open(Ki,`_blank`,`noopener,noreferrer`),children:[(0,d.jsx)(AiFillGithub,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{className:`xmimo-tts-detail-action-label`,children:t})]}),(0,d.jsxs)(u.Button,{variant:`outline`,size:`sm`,"aria-label":n,title:n,onClick:()=>window.open(qi,`_blank`,`noopener,noreferrer`),children:[(0,d.jsx)(LuBookOpen,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{className:`xmimo-tts-detail-action-label`,children:n})]}),e.scope?(0,d.jsx)(WorkbenchAction,{scope:e.scope,t:e.t,onOpen:e.onOpenWorkbench}):null]})}function WorkbenchAction({scope:e,t,onOpen:n}){let r=useSettingsSnapshot(e);return r.status!==`ready`||!resolveTtsSettings(r.value).showInSidebar||!n?null:(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:n,children:[(0,d.jsx)(LuAudioLines,{size:14,"aria-hidden":`true`,focusable:`false`}),(0,d.jsx)(`span`,{children:t(`detail.workshop`)})]})}let pa={loading:`detail.keyLoading`,missing:`detail.keyMissing`,recognized:`detail.keyRecognized`,unrecognized:`detail.keyUnrecognized`,unavailable:`detail.keyUnavailable`};function PluginDetailBadge(e){return e.subject.kind===`row`&&e.subject.pkg.name===`dsh-xiaomi-tts`&&[`dsh-xiaomi-tts/qqbot`,`dsh-xiaomi-tts/passport`].includes(e.subject.row.moduleName)?(0,d.jsx)(u.Tag,{tone:`info`,className:`xmimo-tts-experimental-tag`,children:e.t(`settings.experimental`)}):isTtsBundle(e)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(KeyBadge,{scope:e.scope,t:e.t,changes:e.changes}),(0,d.jsx)(ExperimentalComponentListBadge,{label:e.t(`settings.experimental`)})]}):null}function ExperimentalComponentListBadge({label:e}){return(0,d.jsx)(`style`,{children:`[data-plugin-detail="dsh-xiaomi-tts"] { --xmimo-experimental-label: ${JSON.stringify(e)}; }`})}function KeyBadge({scope:e,t,changes:n=ra}){let r=useSettingsSnapshot(e),i=(0,l.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),{provider:a}=resolveTtsSettings(r.value),o=useApiKeyStatus(r.status===`ready`&&!i,a),s=externalEngine(),c=i?`plugin.changing`:s?o===`unavailable`?`settings.externalDisconnected`:s.ready?`settings.externalManaged`:`settings.externalNotReady`:r.status===`unavailable`?`detail.keyUnavailable`:pa[o];return(0,d.jsxs)(`span`,{className:`xmimo-ui-scope xmimo-tts-detail-status`,children:[(0,d.jsxs)(`span`,{role:`status`,children:[s?.name??t(providerLabelKey(a)),` · `,t(c)]}),!i&&r.status===`ready`&&o===`unavailable`?(0,d.jsx)(u.Button,{type:`button`,variant:`toolbar`,size:`sm`,onClick:ni.invalidate,children:t(`detail.retry`)}):null]})}let ma=[`onboarding.featureExternalSpeech`,`onboarding.featureExternalVoices`,`onboarding.featureExternalSwitch`,`onboarding.featureGuideControl`],ha=[-116,-90,-60,-28,28,60,90,116].map((e,t)=>({"--confetti-x":`${e}px`,"--confetti-y":`${-58-t%3*24}px`,"--confetti-turn":`${e*2}deg`}));function ActivationGuide({t:e,scope:t,preview:n=!1,onOpenWorkbench:r,onDismiss:i,changes:a=ra}){let o=(0,l.useRef)(!1),dismiss=()=>{o.current||(o.current=!0,i())},[s,c]=(0,l.useState)(!1),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(!1),_=resolveTtsSettings(useSettingsSnapshot(t).value).showFeatureGuide;(0,l.useEffect)(()=>{!n&&!_&&dismiss()},[n,_,i]);let v=(0,l.useSyncExternalStore)(a.subscribe,a.getSnapshot,a.getSnapshot),openWorkbench=()=>{i(),r()},neverRemind=async()=>{m(!0),g(!1);try{if(!await t.mutate([{op:`set`,path:[`showFeatureGuide`],value:!1}]))throw Error(`host-rejected`);dismiss()}catch{g(!0)}finally{m(!1)}};return!n&&!_?null:(0,d.jsxs)(u.Modal,{open:!0,title:e(`onboarding.title`),headless:!0,onClose:dismiss,className:`xmimo-ui-scope xmimo-tts-activation-dialog`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,size:`sm`,"data-modal-autofocus":!0,className:`xmimo-tts-activation-close`,"aria-label":e(`onboarding.dismiss`),onClick:dismiss,children:(0,d.jsx)(u.IconCloseOutlineRegular,{size:16})}),(0,d.jsxs)(`div`,{className:`xmimo-tts-activation-layout`,children:[(0,d.jsxs)(`a`,{className:`xmimo-tts-activation-art`,href:Ki,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e(`settings.source`),title:e(`settings.source`),"data-ready":s,children:[(0,d.jsx)(`img`,{src:hostRoute(`/plugins/xiaomi-mimo-tts/update-celebration-whale.webp`),alt:``,width:176,height:176,onLoad:()=>c(!0)}),(0,d.jsx)(`div`,{className:`xmimo-tts-activation-confetti`,"aria-hidden":`true`,children:ha.map((e,t)=>(0,d.jsx)(`i`,{style:e},t))})]}),(0,d.jsxs)(`header`,{className:`xmimo-tts-activation-heading`,children:[(0,d.jsxs)(`h2`,{children:[e(`onboarding.title`),` `,(0,d.jsxs)(`span`,{children:[`v`,`5.2.2`]})]}),(0,d.jsx)(`p`,{children:e(`onboarding.summary`)})]}),(0,d.jsx)(`div`,{className:`xmimo-tts-activation-features`,role:`region`,"aria-label":e(`onboarding.details`),tabIndex:0,children:(0,d.jsx)(`ul`,{children:ma.map(t=>(0,d.jsxs)(`li`,{children:[(0,d.jsx)(`span`,{"aria-hidden":`true`,children:`🎉`}),(0,d.jsx)(`span`,{children:e(t)})]},t))})}),(0,d.jsxs)(`div`,{className:`xmimo-tts-activation-footer`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-activation-actions`,children:[(0,d.jsxs)(u.Button,{type:`button`,variant:`primary`,onClick:()=>window.open(Ki,`_blank`,`noopener,noreferrer`),children:[(0,d.jsx)(LuStar,{size:16,"aria-hidden":`true`}),e(`onboarding.github`)]}),(0,d.jsxs)(u.Button,{type:`button`,variant:`outline`,className:`xmimo-tts-activation-workbench`,onClick:openWorkbench,disabled:v,children:[(0,d.jsx)(LuAudioLines,{size:16,"aria-hidden":`true`}),e(`onboarding.configure`)]}),(0,d.jsx)(u.Button,{type:`button`,variant:`ghost`,disabled:p,onClick:()=>void neverRemind(),children:e(`onboarding.never`)}),h?(0,d.jsx)(`p`,{role:`alert`,children:e(`settings.failed`)}):null]}),v?(0,d.jsx)(`div`,{className:`xmimo-tts-activation-feedback`,children:(0,d.jsx)(`p`,{role:`status`,children:e(`plugin.changing`)})}):void 0]})]})]})}let ga=`[data-voice-activity]`;var VoiceInputActivity=class{blocked=!1;observer=null;listeners=new Set;constructor(e){this.document=e}getSnapshot=()=>this.blocked;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});configure(e){if(!e){this.dispose();return}this.observer===null&&(this.observer=new MutationObserver(e=>{e.some(e=>e.type===`attributes`||[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].some(e=>{if(e.nodeType!==1)return!1;let t=e;return t.matches(ga)||t.querySelector(ga)!==null}))&&this.refresh()}),this.observer.observe(this.document,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-voice-activity`]}),this.refresh())}dispose(){this.observer?.disconnect(),this.observer=null,this.publish(!1)}refresh=()=>{this.observer!==null&&this.publish(this.document.querySelector(`[data-voice-activity="requesting"], [data-voice-activity="recording"], [data-voice-activity="transcribing"]`)!==null)};publish(e){if(this.blocked!==e){this.blocked=e;for(let e of this.listeners)e()}}},ComposerInputActivity=class{blocked=!1;enabled=!1;editor=null;observer=null;listeners=new Set;constructor(e){this.document=e}getSnapshot=()=>this.blocked;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});configure(e){if(!e){this.dispose();return}this.enabled||(this.enabled=!0,this.document.addEventListener(`focusin`,this.onFocus),this.document.addEventListener(`focusout`,this.onFocus),this.document.addEventListener(`input`,this.refresh),this.document.defaultView?.addEventListener(`focus`,this.refresh),this.document.defaultView?.addEventListener(`blur`,this.refresh),this.observer=new MutationObserver(e=>{let t=this.editor;t&&(!t.isConnected||e.some(e=>t.contains(e.target)))&&this.refresh()}),this.observer.observe(this.document,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`contenteditable`,`aria-disabled`]}),this.refresh())}dispose(){this.enabled=!1,this.observer?.disconnect(),this.observer=null,this.document.removeEventListener(`focusin`,this.onFocus),this.document.removeEventListener(`focusout`,this.onFocus),this.document.removeEventListener(`input`,this.refresh),this.document.defaultView?.removeEventListener(`focus`,this.refresh),this.document.defaultView?.removeEventListener(`blur`,this.refresh),this.editor=null,this.publish(!1)}onFocus=()=>{queueMicrotask(this.refresh)};refresh=()=>{this.enabled&&(this.editor=this.document.activeElement?.closest(`[data-composer-input]`)??null,this.publish(this.document.hasFocus()&&this.editor!==null&&this.editor.isConnected&&this.editor.getAttribute(`contenteditable`)!==`false`&&this.editor.getAttribute(`aria-disabled`)!==`true`&&(this.editor.textContent??``).trim().length>0))};publish(e){if(this.blocked!==e){this.blocked=e;for(let e of this.listeners)e()}}};function VoiceReadingNavIcon({size:e}){return(0,d.jsx)(RiVoiceAiFill,{size:e,"aria-hidden":`true`,focusable:`false`})}function registerVoiceReadingNavIcon(e){return e.slots.register({name:`settings.section.icon`,id:`voice-reading`},VoiceReadingNavIcon)}function observeHostSettingsEntry(e,t){let n,update=()=>{let r=e.getSnapshot(),i=r.status===`ready`&&resolveTtsSettings(r.value).showInHostSettings;i&&n===void 0&&(n=t()),i||(n?.(),n=void 0)},r=e.subscribe(update);try{update()}catch(e){throw r(),e}let i=!1;return()=>{i||(i=!0,r(),n?.(),n=void 0)}}function VoiceReadingHeaderActions({t:e,openPluginSettings:t}){return(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-actions`,children:[(0,d.jsx)(u.Tooltip,{label:e(`settings.voiceReadingSource`),side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`a`,{className:`xmimo-voice-reading-action`,href:Ki,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e(`settings.voiceReadingSource`),children:(0,d.jsx)(AiFillGithub,{size:16,"aria-hidden":`true`,focusable:`false`})})}),(0,d.jsx)(QqGroupAction,{t:e}),(0,d.jsx)(u.Tooltip,{label:e(`settings.voiceReadingPluginSettings`),side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`button`,{type:`button`,className:`xmimo-voice-reading-action`,"aria-label":e(`settings.voiceReadingPluginSettings`),onClick:t,children:(0,d.jsx)(AiFillSetting,{size:16,"aria-hidden":`true`,focusable:`false`})})})]})}function QqGroupAction({t:e}){let[t,n]=(0,l.useState)(!1),r=(0,l.useRef)(null),i=(0,l.useRef)(null),a=(0,l.useRef)(null),o=(0,l.useId)(),close=()=>{n(!1)};(0,l.useEffect)(()=>{if(!t)return;a.current?.focus({preventScroll:!0});let onPointerDown=e=>{r.current?.contains(e.target)||close()},onKeyDown=e=>{e.key===`Escape`&&(e.stopPropagation(),close(),i.current?.focus({preventScroll:!0}))};return document.addEventListener(`pointerdown`,onPointerDown,!0),document.addEventListener(`keydown`,onKeyDown,!0),()=>{document.removeEventListener(`pointerdown`,onPointerDown,!0),document.removeEventListener(`keydown`,onKeyDown,!0)}},[t]);let s=e(`settings.voiceReadingQq`);return(0,d.jsxs)(`span`,{className:`xmimo-voice-reading-qq`,ref:r,children:[(0,d.jsx)(u.Tooltip,{label:s,side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`button`,{ref:i,type:`button`,className:`xmimo-voice-reading-action`,"aria-label":s,"aria-haspopup":`dialog`,"aria-expanded":t,"aria-controls":t?o:void 0,onClick:()=>{n(e=>!e)},children:(0,d.jsx)(AiOutlineQq,{size:16,"aria-hidden":`true`,focusable:`false`})})}),t?(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-qq-panel`,id:o,role:`dialog`,"aria-label":s,children:[(0,d.jsx)(`button`,{ref:a,type:`button`,className:`xmimo-voice-reading-qq-close`,"aria-label":e(`settings.voiceReadingQqClose`),onClick:()=>{close(),i.current?.focus({preventScroll:!0})},children:(0,d.jsx)(u.IconCloseOutlineRegular,{"aria-hidden":`true`})}),(0,d.jsx)(`img`,{className:`xmimo-voice-reading-qq-code`,src:hostRoute(`/plugins/xiaomi-mimo-tts/qq-group.webp`),width:190,height:190,alt:e(`settings.voiceReadingQqCodeAlt`)}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-qq-meta`,children:[(0,d.jsx)(`span`,{className:`xmimo-voice-reading-qq-group`,children:s}),(0,d.jsx)(`code`,{className:`xmimo-voice-reading-qq-number`,children:`1104616387`})]})]}):null]})}function VoiceSettingsPage(e){return(0,d.jsx)(`section`,{className:`xmimo-ui-scope xmimo-tts-settings-page`,"aria-label":e.t(`settings.voiceSettingsNav`),children:(0,d.jsxs)(`div`,{className:`xmimo-tts-settings-page-content`,children:[(0,d.jsxs)(`header`,{className:`xmimo-tts-settings-page-header`,children:[(0,d.jsxs)(`div`,{className:`xmimo-tts-settings-page-identity`,children:[(0,d.jsx)(`div`,{className:`xmimo-tts-settings-page-icon`,children:(0,d.jsx)(`img`,{src:hostRoute(S),width:56,height:56,alt:``})}),(0,d.jsxs)(`div`,{className:`xmimo-tts-settings-page-heading`,children:[(0,d.jsxs)(`h1`,{children:[(0,d.jsx)(`span`,{className:`xmimo-tts-settings-page-title`,children:e.t(`settings.voiceSettingsNav`)}),(0,d.jsxs)(`span`,{className:`xmimo-tts-settings-page-wave`,"aria-hidden":`true`,children:[(0,d.jsx)(`span`,{}),(0,d.jsx)(`span`,{}),(0,d.jsx)(`span`,{}),(0,d.jsx)(`span`,{}),(0,d.jsx)(`span`,{})]})]}),(0,d.jsx)(`p`,{children:e.t(`settings.voiceSettingsDescription`)})]})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-actions xmimo-tts-settings-page-actions`,children:[(0,d.jsx)(u.Tooltip,{label:e.t(`settings.pluginDetails`),side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`button`,{type:`button`,className:`xmimo-voice-reading-action`,"aria-label":e.t(`settings.pluginDetails`),onClick:e.onOpenPluginSettings,children:(0,d.jsx)(LuSettings,{size:16,"aria-hidden":`true`})})}),(0,d.jsx)(u.Tooltip,{label:e.t(`detail.manual`),side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`a`,{className:`xmimo-voice-reading-action`,href:qi,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e.t(`detail.manual`),children:(0,d.jsx)(LuBookOpen,{size:16,"aria-hidden":`true`})})}),(0,d.jsx)(QqGroupAction,{t:e.t}),(0,d.jsx)(u.Tooltip,{label:e.t(`settings.voiceReadingSource`),side:`bottom`,align:`end`,portal:!0,children:(0,d.jsx)(`a`,{className:`xmimo-voice-reading-action`,href:Ki,target:`_blank`,rel:`noopener noreferrer`,"aria-label":e.t(`settings.voiceReadingSource`),children:(0,d.jsx)(AiFillGithub,{size:16,"aria-hidden":`true`,focusable:`false`})})})]})]}),(0,d.jsx)(SettingsCard,{...e,view:`page`,initialPanel:`mixer`})]})})}let _a=`xiaomi-mimo-tts.settings`;function openVoiceWorkbench(e,t){let n=t.getSnapshot();n.status===`ready`&&resolveTtsSettings(n.value).showInSidebar?e.layout.selectPanel(_a):e.pluginNavigation.openBundle(`dsh-xiaomi-tts`)}function VoiceSettingsSidebarIcon({size:e}){return(0,d.jsx)(RiVoiceAiFill,{size:e,"aria-hidden":`true`,focusable:`false`})}function registerVoiceSettingsSidebar(e,t){let{scope:n,t:r}=t,i={...t,onOpenPluginSettings:()=>e.pluginNavigation.openBundle(`dsh-xiaomi-tts`),onSidebarChange:t=>{t||e.pluginNavigation.openBundle(`dsh-xiaomi-tts`)}},a=e.slots.register({name:`main`,key:_a,inject:()=>i},VoiceSettingsPage),o,update=()=>{let t=n.getSnapshot(),i=t.status===`ready`&&resolveTtsSettings(t.value).showInSidebar;i&&!o&&(o=e.slots.register({name:`sidebar.panellist`,id:_a,order:-10,label:()=>r(`settings.voiceSettingsNav`),locale:gi},VoiceSettingsSidebarIcon)),i||(o?.(),o=void 0)},s=n.subscribe(update);try{update()}catch(e){throw s(),a(),e}let c=!1;return()=>{c||(c=!0,s(),o?.(),o=void 0,a())}}function voiceReadingWarningKey(e,t){return e.enabled?t===`missing`?`settings.voiceReadingWarningApiKeyMissing`:t===`unrecognized`?`settings.voiceReadingWarningApiKeyInvalid`:t===`unavailable`?`settings.voiceReadingWarningApiKeyUnavailable`:ttsSelection(e).voice.trim()?null:`settings.voiceReadingWarningVoiceRequired`:`settings.voiceReadingWarningDisabled`}function voiceChoices(e,t,n,r){let i=n[r],a=new Map(e.map(e=>[e.value,e]));for(let e of[t,...i?.history??[]])e.trim()&&!a.has(e)&&a.set(e,{value:e,label:e});return[...a.values()].map(e=>{let t=i?.names&&Object.hasOwn(i.names,e.value)?i.names[e.value]?.trim():``;return t?{value:e.value,label:t}:e})}function buildVoiceReadingVoiceSource(e,t=[],n={}){return e.provider===`breeze`?{field:`breezeVoice`,value:e.breezeVoice,choices:voiceChoices(H.map(e=>({value:e.value,label:e.name})),e.breezeVoice,n,`breeze`),hintKey:`settings.voiceReadingHintBreeze`}:e.provider===`doubao`?e.doubaoModel===`seed-icl-2.0`?{field:`doubaoClonedVoice`,value:e.doubaoClonedVoice,choices:voiceChoices([],e.doubaoClonedVoice,{cloned:{history:t,names:{},...n.cloned}},`cloned`),hintKey:`settings.voiceReadingHintDoubaoCloned`}:{field:`doubaoVoice`,value:e.doubaoVoice,choices:voiceChoices(Ve.map(e=>({value:e.value,label:e.name,detail:e.scene})),e.doubaoVoice,n,`standard`),hintKey:`settings.voiceReadingHintDoubaoStandard`}:e.model===`mimo-v2.5-tts-voicedesign`?{field:`voiceDesignPrompt`,value:e.voiceDesignPrompt,choices:P.map(e=>({value:e.prompt,label:e.label,detail:e.summary})),hintKey:`settings.voiceReadingHintVoiceDesign`}:{field:`voice`,value:e.voice,choices:D.map(e=>({value:e.value,label:e.value,detail:e.summary})),hintKey:`settings.voiceReadingHintXiaomi`}}function voiceChoiceWriteOps(e,t){let n=[{op:`set`,path:[e.field],value:t}];return e.field===`voiceDesignPrompt`&&n.push({op:`set`,path:[`voiceDesignCustomPrompt`],value:t}),n}function autoPlayWriteOps(e,t){if(!e)return[{op:`set`,path:[`autoPlay`],value:!1}];let n=[];return t.enabled||n.push({op:`set`,path:[`enabled`],value:!0}),n.push({op:`set`,path:[`autoPlay`],value:!0}),n}let va={smart:`settings.readScopeSmart`,full:`settings.readScopeFull`,"first-segment":`settings.readScopeFirstSegment`},ya={smart:`settings.readScopeSmartHint`,full:`settings.readScopeFullHint`,"first-segment":`settings.readScopeFirstSegmentHint`};function readScopeLabelKey(e){return va[e]}function readScopeHintKey(e){return ya[e]}function readScopeWriteOps(e){return[{op:`set`,path:[`readScope`],value:e}]}let ba=[0,.2,.4,.6,.8,1],xa=[.5,.8,1,1.2,1.5,1.8];function formatVoiceVolume(e){return`${Math.round(e*100)}%`}function formatVoiceRate(e){return`${e.toFixed(1)}×`}function volumeWriteOps(e){return[{op:`set`,path:[`voiceVolume`],value:e}]}function rateWriteOps(e){return[{op:`set`,path:[`voiceRate`],value:e}]}function soundWriteOps(e,t){if(!e)return[{op:`set`,path:[`soundEnabled`],value:!1}];let n=[{op:`set`,path:[`soundEnabled`],value:!0}];return!t.taskSounds&&!t.clickSounds&&n.push({op:`set`,path:[`taskSounds`],value:!0},{op:`set`,path:[`clickSounds`],value:!0}),n}function VoiceReadingWarning({settings:e,t,openPluginSettings:n,active:r=!0}){let{provider:i}=e,a=useApiKeyStatus(r,i),o=externalEngine(),s=o?a===`unavailable`?`settings.externalDisconnected`:o.ready?null:`settings.externalNotReady`:voiceReadingWarningKey(e,a);return s===null?null:(0,d.jsx)(WarningBar,{message:t(s),dismissLabel:t(`settings.voiceReadingDismissWarning`),settingsLabel:t(`settings.voiceReadingPluginSettings`),openPluginSettings:n},`${i}:${s}`)}function WarningBar({message:e,dismissLabel:t,settingsLabel:n,openPluginSettings:r}){let[i,a]=(0,l.useState)(!1);if(i)return null;let[o,s]=e.split(`{settings}`);return(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-warning`,role:`status`,children:[(0,d.jsxs)(`span`,{className:`xmimo-voice-reading-warning-message`,title:e.replace(`{settings}`,n),children:[o,s===void 0?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`button`,{type:`button`,className:`xmimo-voice-reading-link`,onClick:r,children:(0,d.jsx)(`span`,{className:`xmimo-voice-reading-link-label`,children:n})}),s]})]}),(0,d.jsx)(`button`,{type:`button`,className:`xmimo-voice-reading-warning-close`,"aria-label":t,title:t,onClick:()=>{a(!0)},children:(0,d.jsx)(u.IconCloseOutlineRegular,{"aria-hidden":`true`})})]})}let Sa={xiaomi:`Xiaomi-MiMo`,doubao:`Doubao-Seed`,breeze:`Breeze Blue`};function VoiceReadingProvider({value:e,doubaoEnabled:t,breezeEnabled:n,disabled:r,t:i,onChange:a}){useEngineState();let o=externalEngine(),s=(0,l.useId)(),c=availableTtsProviders(t,n);return(0,d.jsxs)(`fieldset`,{className:`xmimo-voice-reading-provider`,disabled:r||o!==null,children:[(0,d.jsx)(`legend`,{className:`xmimo-voice-reading-row-title`,children:o?.name??i(`settings.provider`)}),(0,d.jsx)(`div`,{className:c.length===3?`xmimo-voice-reading-provider-options xmimo-voice-reading-provider-options-three`:`xmimo-voice-reading-provider-options`,children:c.map(t=>(0,d.jsxs)(`label`,{className:`xmimo-voice-reading-provider-option`,children:[(0,d.jsx)(`input`,{type:`radio`,name:s,value:t,checked:e===t,onChange:()=>{a(t)}}),(0,d.jsxs)(`span`,{className:`xmimo-voice-reading-provider-face`,children:[(0,d.jsx)(`img`,{src:hostRoute(x[t]),width:32,height:32,alt:``}),(0,d.jsx)(`span`,{children:n?{xiaomi:`Xiaomi`,doubao:`Doubao`,breeze:`Breeze`}[t]:Sa[t]})]})]},t))})]})}function VoiceReadingSection(e){let{scope:t,t:n,openPluginSettings:r}=e;return t===void 0||n===void 0||r===void 0?null:(0,d.jsx)(VoiceReadingPage,{scope:t,t:n,changes:e.changes,openPluginSettings:()=>{e.close(),r()}})}function VoiceReadingPage({scope:e,t,openPluginSettings:n,changes:r=ra}){useEngineState();let i=externalEngine(),a=useExternalSelection(i),o=i?.models?.find(e=>e.id===a.value?.model),s=(0,l.useSyncExternalStore)(subscribeMinimalMode,readMinimalMode,()=>!1),c=useSettingsSnapshot(e),p=(0,l.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot),m=(0,l.useMemo)(()=>Object.fromEntries([`standard`,`cloned`,`breeze`].map(e=>[e,{history:readVoiceIdHistory(e),names:readVoiceIdNames(e)}])),[(0,l.useSyncExternalStore)(subscribeVoiceIds,voiceIdRevision,()=>0)]),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(!1),b=(0,l.useMemo)(()=>resolveTtsSettings(c.value),[c.value]),x=(0,l.useMemo)(()=>buildVoiceReadingVoiceSource(b,[],m),[b,m]),write=t=>{r.getSnapshot()||!c.writable||t.length===0||(g(!0),v(!1),e.mutate(t).then(e=>{e||v(!0)}).catch(()=>{v(!0)}).finally(()=>{g(!1)}))};if(c.status===`unavailable`)return(0,d.jsx)(`p`,{className:`xmimo-voice-reading-notice`,role:`status`,children:t(`settings.voiceReadingUnavailable`)});let C=c.status===`ready`,w=p||!C||!c.writable||h,E=[...x.choices.some(e=>e.value===x.value)?[]:[{id:x.value,label:t(`settings.voiceReadingCustomVoice`)}],...x.choices.map(e=>({id:e.value,label:e.detail?`${e.label} · ${e.detail}`:e.label}))],D=F.map(e=>({id:e,label:t(readScopeLabelKey(e))}));return(0,d.jsxs)(`div`,{className:`xmimo-voice-reading`,style:s?void 0:{"--xmimo-voice-reading-background":`url(${hostRoute(S)})`},children:[(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-header`,children:[(0,d.jsx)(`h2`,{className:`xmimo-voice-reading-title`,children:t(`settings.voiceReadingTitle`)}),(0,d.jsx)(VoiceReadingHeaderActions,{t,openPluginSettings:n})]}),p?(0,d.jsx)(`p`,{role:`status`,children:t(`plugin.changing`)}):null,(0,d.jsx)(VoiceReadingProvider,{value:b.provider,doubaoEnabled:b.doubaoEnabled,breezeEnabled:b.breezeEnabled,disabled:w,t,onChange:e=>{write([{op:`set`,path:[`provider`],value:e}])}}),C?(0,d.jsx)(VoiceReadingWarning,{active:!p,settings:b,t,openPluginSettings:n}):null,C&&!c.writable&&(0,d.jsx)(`p`,{className:`xmimo-voice-reading-notice`,role:`status`,children:t(`settings.voiceReadingReadOnly`)}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-card`,children:[i?(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-copy`,children:(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.model`)})}),(0,d.jsx)(VoiceReadingSelect,{label:t(`settings.model`),value:a.value?.model??i.modelName??``,options:(i.models??[]).map(e=>({id:e.id,label:e.name})),disabled:w||!i.configurable,onSelect:e=>{let t=i.models.find(t=>t.id===e);a.change({model:e,voice:t.voices.some(e=>e.id===a.value?.voice)?a.value.voice:t.voices[0]?.id??``,speechInstruction:``})}})]}):null,(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-copy`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.voiceReadingVoice`)}),(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-hint`,children:t(i?`settings.externalManaged`:x.hintKey)})]}),(0,d.jsx)(VoiceReadingSelect,{label:t(`settings.voiceReadingVoice`),value:i?a.value?.voice??i.voiceName??``:x.value,options:i?(o?.voices??[]).map(e=>({id:e.id,label:e.name})):E,disabled:w||i!==null&&!i.configurable,onSelect:e=>{i&&a.value?a.change({...a.value,voice:e}):write(voiceChoiceWriteOps(x,e))}})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-copy`,children:(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.voiceReadingVolume`)})}),(0,d.jsx)(VoiceReadingSelect,{label:t(`settings.voiceReadingVolume`),value:String(b.voiceVolume),fallbackLabel:formatVoiceVolume(b.voiceVolume),options:ba.map(e=>({id:String(e),label:formatVoiceVolume(e)})),disabled:w,onSelect:e=>{write(volumeWriteOps(Number(e)))}})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-copy`,children:(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.voiceReadingRate`)})}),(0,d.jsx)(VoiceReadingSelect,{label:t(`settings.voiceReadingRate`),value:String(b.voiceRate),fallbackLabel:formatVoiceRate(b.voiceRate),options:xa.map(e=>({id:String(e),label:formatVoiceRate(e)})),disabled:w,onSelect:e=>{write(rateWriteOps(Number(e)))}})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-copy`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.readScope`)}),(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-hint`,children:t(readScopeHintKey(b.readScope))})]}),(0,d.jsx)(VoiceReadingSelect,{label:t(`settings.readScope`),value:b.readScope,options:D,disabled:w,onSelect:e=>{write(readScopeWriteOps(e))}})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-copy`,children:(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.voiceReadingAutoPlay`)})}),(0,d.jsx)(u.Switch,{checked:b.autoPlay,disabled:w,label:t(`settings.voiceReadingAutoPlay`),onChange:e=>{write(autoPlayWriteOps(e,b))}})]}),(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-copy`,children:[(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-title`,children:t(`settings.voiceReadingSound`)}),(0,d.jsx)(`div`,{className:`xmimo-voice-reading-row-hint`,children:t(`settings.voiceReadingSoundHint`)})]}),(0,d.jsx)(u.Switch,{checked:b.soundEnabled,disabled:w,label:t(`settings.voiceReadingSound`),onChange:e=>{write(soundWriteOps(e,b))}})]})]}),i?.configurable?(0,d.jsxs)(`div`,{className:`xmimo-voice-reading-row`,children:[(0,d.jsx)(u.Button,{type:`button`,variant:`outline`,size:`sm`,disabled:w||!a.dirty,onClick:a.discard,children:t(`settings.discard`)}),(0,d.jsx)(u.Button,{type:`button`,variant:`primary`,size:`sm`,disabled:w||!a.dirty,onClick:()=>{g(!0),v(!1),a.save().catch(()=>v(!0)).finally(()=>g(!1))},children:t(h?`settings.saving`:`settings.save`)})]}):null,_&&(0,d.jsx)(`p`,{className:`xmimo-voice-reading-failure`,role:`status`,children:t(`settings.voiceReadingSaveFailed`)})]})}var Ca=[{name:`press`,label:`Press`,category:`input`,description:`A control is physically engaged.`,duration:.16,baseMidi:62,notes:[{at:0,semitone:3,length:.13,glide:-4}],noise:.14,transient:.5,defaultVolume:.2},{name:`select`,label:`Select`,category:`selection`,description:`An item enters the active set.`,duration:.28,baseMidi:70,notes:[{at:0,semitone:0,length:.12},{at:.09,semitone:7,length:.16}],defaultVolume:.2},{name:`toggle-on`,label:`Toggle on`,category:`selection`,description:`A binary setting becomes active.`,duration:.3,baseMidi:67,notes:[{at:0,semitone:-3,length:.065,glide:-1},{at:.065,semitone:9,length:.2}],transient:.3,defaultVolume:.2},{name:`toggle-off`,label:`Toggle off`,category:`selection`,description:`A binary setting becomes inactive.`,duration:.29,baseMidi:67,notes:[{at:0,semitone:9,length:.065},{at:.07,semitone:-3,length:.18,glide:-1}],transient:.28,defaultVolume:.18},{name:`check`,label:`Check`,category:`selection`,description:`A checkbox or task enters its completed state.`,duration:.29,baseMidi:71,notes:[{at:0,semitone:-5,length:.075},{at:.07,semitone:9,length:.17}],transient:.24,defaultVolume:.17},{name:`delete`,label:`Delete`,category:`editing`,description:`A destructive removal is committed.`,duration:.48,baseMidi:58,notes:[{at:0,semitone:6,length:.2,glide:-7},{at:.16,semitone:-2,length:.24,gain:.6}],noise:.18,transient:.5,defaultVolume:.22},{name:`open`,label:`Open`,category:`navigation`,description:`A menu, sheet, panel, or detail view appears.`,duration:.37,baseMidi:64,notes:[{at:0,semitone:-2,length:.28,glide:9},{at:.18,semitone:12,length:.11,gain:.3}],noise:.05,defaultVolume:.18},{name:`close`,label:`Close`,category:`navigation`,description:`A menu, sheet, panel, or detail view recedes.`,duration:.34,baseMidi:64,notes:[{at:0,semitone:12,length:.1,gain:.34},{at:.055,semitone:5,length:.24,glide:-8}],noise:.04,defaultVolume:.17},{name:`send`,label:`Send`,category:`communication`,description:`A message or object leaves the user.`,duration:.42,baseMidi:69,notes:[{at:0,semitone:-2,length:.28,glide:9},{at:.19,semitone:12,length:.16,gain:.6}],noise:.16,panFrom:-.2,panTo:.5,defaultVolume:.2},{name:`notification`,label:`Notification`,category:`communication`,description:`New information is available, without urgency.`,duration:.58,baseMidi:72,notes:[{at:0,semitone:0,length:.26},{at:.19,semitone:5,length:.3}],defaultVolume:.2},{name:`success`,label:`Success`,category:`feedback`,description:`An action finished with the expected result.`,duration:.72,baseMidi:67,notes:[{at:0,semitone:0,length:.3},{at:.16,semitone:4,length:.32},{at:.33,semitone:7,length:.33}],defaultVolume:.23},{name:`error`,label:`Error`,category:`feedback`,description:`An action failed and needs attention.`,duration:.62,baseMidi:62,notes:[{at:0,semitone:6,length:.28},{at:.22,semitone:0,length:.32,glide:-2}],noise:.1,defaultVolume:.22},{name:`start`,label:`Start`,category:`progress`,description:`A process, recording, or session begins.`,duration:.46,baseMidi:60,notes:[{at:0,semitone:-5,length:.12,gain:.48},{at:.1,semitone:0,length:.18},{at:.24,semitone:7,length:.18}],noise:.04,defaultVolume:.19},{name:`stop`,label:`Stop`,category:`progress`,description:`A process, recording, or session ends.`,duration:.4,baseMidi:60,notes:[{at:0,semitone:7,length:.11},{at:.1,semitone:2,length:.12},{at:.2,semitone:-5,length:.15,gain:.72}],noise:.06,defaultVolume:.19},{name:`complete`,label:`Complete`,category:`progress`,description:`A multi-step process reaches its final state.`,duration:.8,baseMidi:65,notes:[{at:0,semitone:0,length:.22},{at:.22,semitone:7,length:.25},{at:.46,semitone:12,length:.27}],defaultVolume:.24},{name:`queued`,label:`Queued`,category:`progress`,description:`Work is accepted and waiting to begin.`,duration:.36,baseMidi:64,notes:[{at:0,semitone:0,length:.14},{at:.13,semitone:2,length:.18,gain:.65}],noise:.04,defaultVolume:.14}],wa=[{name:`minimal`,label:`Minimal`,description:`Dry, precise, almost invisible.`,bestFor:`Productivity, SaaS, system UI`,color:`#e84d2a`,waveform:`sine`,pitch:1,duration:.78,attack:.004,decay:2.3,noise:.05,transient:.15,brightness:.78,echo:0,bitDepth:16,harmonics:[[1,1],[2,.08]]},{name:`soft`,label:`Soft`,description:`Rounded felt, warm and reassuring.`,bestFor:`Mobile, wellness, friendly SaaS`,color:`#d47b83`,waveform:`triangle`,pitch:.9,duration:1.08,attack:.012,decay:1.65,noise:.08,transient:.08,brightness:.46,echo:.04,bitDepth:16,harmonics:[[1,1],[2,.14],[3,.04]]},{name:`glass`,label:`Glass`,description:`Bright, crystalline, and premium.`,bestFor:`Media, finance, luxury products`,color:`#4c8ca5`,waveform:`sine`,pitch:1.22,duration:1.22,attack:.003,decay:1.32,noise:.025,transient:.12,brightness:.95,echo:.09,bitDepth:16,harmonics:[[1,1],[2.72,.28],[4.19,.11],[6.8,.05]]},{name:`arcade`,label:`Arcade`,description:`Chunky pixels and cheerful voltage.`,bestFor:`Games, streaks, gamified learning`,color:`#7257d9`,waveform:`square`,pitch:1.08,duration:.86,attack:.002,decay:1.1,noise:.035,transient:.2,brightness:.72,echo:.025,bitDepth:8,harmonics:[[1,1],[2,.08]]},{name:`mechanical`,label:`Mechanical`,description:`Switches, relays, and firm detents.`,bestFor:`Devtools, hardware, industrial UI`,color:`#68736f`,waveform:`triangle`,pitch:.74,duration:.72,attack:.001,decay:2.8,noise:.24,transient:.72,brightness:.58,echo:.015,bitDepth:12,harmonics:[[1,1],[1.5,.13],[2.1,.08]]},{name:`organic`,label:`Organic`,description:`Wood, water, breath, and small stones.`,bestFor:`Education, kids, calm games`,color:`#718b4e`,waveform:`sine`,pitch:.94,duration:1.12,attack:.008,decay:1.85,noise:.18,transient:.28,brightness:.4,echo:.055,bitDepth:16,harmonics:[[1,1],[1.48,.18],[2.02,.09],[3.05,.035]]},{name:`dreamy`,label:`Dreamy`,description:`Airy blooms, soft light, and slow sparkle.`,bestFor:`Creative tools, wellness, ambient apps`,color:`#a36cad`,waveform:`sine`,pitch:1.05,duration:1.18,attack:.02,decay:1.42,noise:.045,transient:.045,brightness:.56,echo:.13,bitDepth:16,harmonics:[[1,1],[2,.12],[3.01,.07],[5.02,.025]]},{name:`scifi`,label:`Sci-fi`,description:`Clean holographic pings with a restrained digital shimmer.`,bestFor:`AI tools, spatial UI, futuristic games`,color:`#20a29d`,waveform:`sine`,pitch:1.1,duration:.84,attack:.0025,decay:2.05,noise:.025,transient:.16,brightness:.82,echo:.035,bitDepth:16,harmonics:[[1,1],[2.01,.11],[3.98,.025]],fmRatio:2.01,fmDepth:.42},{name:`rubber`,label:`Rubber`,description:`Tactile elastic taps with a quick, friendly rebound.`,bestFor:`Kids, playful mobile, casual games`,color:`#d99a24`,waveform:`triangle`,pitch:.86,duration:.88,attack:.0035,decay:2.2,noise:.018,transient:.22,brightness:.5,echo:.012,bitDepth:16,harmonics:[[1,1],[1.5,.075],[2.02,.04]],elasticity:1.15},{name:`cinematic`,label:`Cinematic`,description:`Deep impacts, polished tails, and quiet scale.`,bestFor:`Premium media, games, dramatic moments`,color:`#3f5873`,waveform:`sine`,pitch:.7,duration:1.28,attack:.008,decay:1.78,noise:.12,transient:.55,brightness:.38,echo:.11,bitDepth:16,harmonics:[[1,1],[.5,.22],[2,.1],[3,.035]]},{name:`studio`,label:`Studio`,description:`Tactile editing precision with warm cinematic restraint.`,bestFor:`Film, audio, and AI creative tools`,color:`#6261a8`,waveform:`triangle`,pitch:.86,duration:.82,attack:.004,decay:2.15,noise:.09,transient:.24,brightness:.48,echo:.025,bitDepth:16,harmonics:[[1,1],[2,.11],[3,.035]]},{name:`zen`,label:`Zen`,description:`Pure tones, dry wood, and brief washi detail.`,bestFor:`Mindfulness, reading, writing, calm productivity`,color:`#7d8f77`,waveform:`sine`,pitch:.94,duration:.82,attack:.003,decay:2.7,noise:0,transient:.025,brightness:.52,echo:0,bitDepth:16,harmonics:[[1,1],[2.01,.035]],paper:.12,brush:.065,wood:.16,chime:.09}];Ca.map(e=>e.name);var Ta=wa.map(e=>e.name);function J(e){let t=Ca.find(t=>t.name===e);if(!t)throw Error(`Unknown UI SFX cue: ${e}`);return t}function ne(e){let t=wa.find(t=>t.name===e);if(!t)throw Error(`Unknown UI SFX pack: ${e}`);return t}function ge(e){return 440*2**((e-69)/12)}var Ea=new Set([`press`,`select`,`toggle-on`,`toggle-off`,`check`,`open`,`close`,`delete`]),Da=new Set([`success`,`complete`]),Oa=new Set([...Ea,`stop`]),ka=new Set([`press`,`delete`,`send`,`notification`,`success`,`error`,`start`,`stop`,`complete`]),Aa=new Set([`open`,`send`,`notification`,`success`,`complete`]),ja=new Set([`delete`,`send`,`success`,`error`,`start`,`stop`,`complete`]),Ma=new Set([`press`,`toggle-on`,`toggle-off`,`check`,`success`]),Na=new Set([`open`,`close`,`send`]),Pa=new Set([`send`]),Fa=new Set([`press`,`select`,`toggle-on`,`toggle-off`,`check`,`delete`,`notification`,`success`,`error`]),Ia=new Set([`send`,`notification`,`success`,`error`,`complete`]),La=new Set([`press`,`select`,`toggle-on`,`toggle-off`,`check`]);function j(e,t){let n=2166136261^t;for(let t=0;t<e.length;t+=1)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0)/4294967295}function Xe(e){return{paper:Na.has(e)?.72+j(e,1)*.28:0,brush:Pa.has(e)?.68+j(e,2)*.32:0,wood:Fa.has(e)?.7+j(e,3)*.3:0,chime:Ia.has(e)?.64+j(e,4)*.36:0}}function _e(e,t,n,r){let i=n.map(e=>({...e}));switch(e){case`soft`:return i.map((e,t)=>({...e,at:r?e.at:e.at*1.06+t*.006,length:e.length*1.13,semitone:e.semitone*.94}));case`glass`:{if(r||i.length===0||!Aa.has(t))return i;let e=i[i.length-1];return e?[...i,{...e,at:e.at+Math.min(.08,e.length*.28),semitone:e.semitone+12,length:e.length*.68,gain:(e.gain??1)*.18}]:i}case`arcade`:return i.map((e,t)=>({...e,at:r?e.at:Math.round(e.at/.04)*.04,length:Math.max(.06,Math.round(e.length/.04)*.04)*.82,semitone:Math.round(e.semitone)+(t%2==1?.25:0)}));case`mechanical`:return[...r||!Oa.has(t)?[]:[{at:0,semitone:-12,length:.055,glide:-3,gain:.28}],...i.map(e=>({...e,length:e.length*.62,gain:(e.gain??1)*.82}))];case`organic`:return i.flatMap((e,n)=>{let i={...e,at:r?e.at:e.at+n*.009,semitone:e.semitone+(n%2==0?-.16:.11)};return r||n!==0||!ka.has(t)?[i]:[i,{...e,at:e.at+.018,semitone:e.semitone-12.08,length:e.length*.52,gain:(e.gain??1)*.2}]});case`dreamy`:return i.flatMap((e,n)=>[{...e,at:r?e.at:e.at*1.08,length:e.length*1.18,gain:(e.gain??1)*.78},...r||!Aa.has(t)?[]:[{...e,at:e.at*1.08+.07+n*.012,semitone:e.semitone+12.02,length:e.length*.82,gain:(e.gain??1)*.13}]]);case`scifi`:return i.map((e,t)=>({...e,at:r?e.at:Math.round(e.at/.01)*.01,length:e.length*.72,semitone:e.semitone+(t%2==0?-.04:.16),glide:(e.glide??0)*.58+(e.glide===void 0?t%2==0?.45:-.25:0),gain:(e.gain??1)*(t===0?1:.9)}));case`rubber`:return i.map((e,t)=>({...e,at:r?e.at:e.at*.98+t*.004,length:e.length*.84,semitone:e.semitone+(t%2==0?-.18:.08),glide:(e.glide??0)*.52,gain:(e.gain??1)*(t===0?1:.88)}));case`cinematic`:return[...i.map(e=>({...e,length:e.length*1.16,gain:(e.gain??1)*.72})),...r||i.length===0||!ja.has(t)?[]:[{at:0,semitone:-24,length:Math.min(.38,Math.max(...i.map(e=>e.length))),glide:-2,gain:.28}]];case`studio`:{let e=i.map(e=>({...e,at:r?e.at:e.at*.92,length:e.length*.82,gain:(e.gain??1)*(r?.55:.8)}));if(r||e.length===0)return e;if(Ea.has(t))return[{at:0,semitone:-12,length:.045,glide:-2,gain:.12},...e];if(Da.has(t)){let t=e[e.length-1];return t?[...e,{...t,at:t.at+.055,semitone:t.semitone+12,length:t.length*.55,gain:(t.gain??1)*.1}]:e}return e}case`zen`:{let e=j(t,0),n=r?.68:La.has(t)?.46:.68;return i.map((i,a)=>({...i,at:r?i.at:i.at*(.9+e*.025)+a*.002,length:i.length*n*(.96+e*.05),semitone:i.semitone+(e-.5)*.22+(a%2==0?-.035:.025),glide:i.glide===void 0?void 0:i.glide*.28,gain:(i.gain??1)*(r?.32:La.has(t)?.48:.52)}))}default:return i}}function Z(e,t){let n=J(t),r=ne(e),i=n.loop?1:r.duration,a=_e(e,t,n.notes,n.loop??!1).map(e=>{let t=n.baseMidi+e.semitone+12*Math.log2(r.pitch),a=t+(e.glide??0);return{...e,at:e.at*i,length:e.length*i,frequency:ge(t),endFrequency:ge(a)}}),o=n.loop?n.duration:Math.max(n.duration*i,...a.map(e=>e.at+e.length+.02)),s=1.476-r.echo*1.6;if(!n.loop&&o>s){let e=(s-.02)/(o-.02);a=a.map(t=>({...t,at:t.at*e,length:t.length*e})),o=s}let c=r.noise,l=n.noise??0,u=Math.min(1,(n.transient??0)*(.7+r.transient*.3)+r.transient*.45)*(n.loop?.58:1),d=(r.fmDepth??0)*(n.loop?.58:n.category===`reward`?1.12:1),p=(r.elasticity??0)*(n.loop?.18:Ma.has(t)?1:.36),m=e===`zen`?Xe(t):void 0;return{cue:t,pack:e,duration:o,notes:a,waveform:r.waveform,harmonics:r.harmonics,attack:r.attack,decay:r.decay,noise:e===`zen`?0:Math.min(.42,l*(.55+c)+c*.025),transient:e===`zen`?Math.min(.12,u*.28):u,brightness:r.brightness,echo:t===`typing`?Math.min(r.echo,.004):r.echo,bitDepth:r.bitDepth,panFrom:n.panFrom??0,panTo:n.panTo??n.panFrom??0,loop:n.loop??!1,defaultVolume:n.defaultVolume,fmRatio:r.fmRatio??1,fmDepth:d,elasticity:p,paper:(r.paper??0)*(m?.paper??0),brush:(r.brush??0)*(m?.brush??0),wood:(r.wood??0)*(m?.wood??0),chime:(r.chime??0)*(m?.chime??0)}}function be(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function ye(e){let t=e;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function ae(e,t){if(t<=0||t>=.5)return 0;if(e<t){let n=e/t;return n+n-n*n-1}if(e>1-t){let n=(e-1)/t;return n*n+n+n+1}return 0}function Be(e,t,n){let r=e/(Math.PI*2),i=r-Math.floor(r);switch(t){case`square`:return(i<.5?1:-1)+ae(i,n)-ae((i+.5)%1,n);case`saw`:return 2*i-1-ae(i,n);case`triangle`:return 2*Math.abs(2*(r-Math.floor(r+.5)))-1;default:return Math.sin(e)}}function ve(e,t,n,r){if(e<0||e>t)return 0;if(e<n)return e/Math.max(n,1e-4);let i=(e-n)/Math.max(t-n,1e-4);return Math.max(0,1-i)**r}function qe(e){return Math.tanh(e*1.2)/Math.tanh(1.2)}function oe(e,t=44100){let n=Math.max(0,...e.notes.map(e=>e.at+e.length)),r=e.cue===`typing`?.048:.024,i=e.loop?e.duration:Math.min(e.duration,n+(e.pack===`zen`?.12:.06)),a=e.loop?0:r+e.echo*1.6,o=Math.max(1,Math.round((i+a)*t)),s=new Float32Array(o),c=new Float32Array(o),l=ye(be(`${e.pack}:${e.cue}`)),u=ye(be(`${e.pack}:${e.cue}:materials`)),d=new Float64Array(e.notes.length),p=0,m=0,h=0,g=0,_=0,v=e.loop?Math.max(.0018,e.attack):e.attack,b=e.paper>0||e.brush>0||e.wood>0||e.chime>0;for(let n=0;n<o;n+=1){let r=n/t,i=0,a=0,o=0,_=0;for(let n=0;n<e.notes.length;n+=1){let s=e.notes[n];if(!s)continue;let c=r-s.at;if(c<0||c>s.length)continue;let l=c/s.length,u=s.frequency*(s.endFrequency/s.frequency)**l*2**(e.elasticity*Math.exp(-c*19)*Math.cos(Math.PI*2*12.5*c)/12);d[n]=(d[n]??0)+Math.PI*2*u/t;let p=d[n]??0,m=e.fmDepth>0?Math.sin(p*e.fmRatio)*e.fmDepth*Math.exp(-c*7.5):0,h=0;for(let[n,r]of e.harmonics)h+=Be(p*n+m,e.waveform,Math.min(.49,u*n/t))*r;let g=s.gain??1,_=ve(c,s.length,v,e.decay);i+=h*_*g,a+=ve(c,s.length,Math.min(.004,v),Math.max(2.35,e.decay*1.25))*g;let b=1-Math.exp(-c*800);o+=b*Math.exp(-c*(105+e.brightness*170))*g}let x=l()*2-1,S=u()*2-1;m+=(S-m)*.08,h+=(S-h)*.018,g+=(S-g)*.004;let C=m-h,w=h-g;if(b)for(let t of e.notes){let n=r-t.at;if(!(n<0)){if(e.paper>0){let r=Math.min(t.length,.075,Math.max(.028,t.length*.62));if(n<=r){let t=n/r,i=Math.sin(Math.PI*t)**1.1*(1-t*.48),a=Math.exp(-(((n-r*.24)/.003)**2)),o=Math.exp(-(((n-r*.64)/.005)**2));_+=C*e.paper*i*(.16+a*.52+o*.24)}}if(e.brush>0){let r=Math.min(t.length,.11,Math.max(.045,t.length*.95));if(n<=r){let t=n/r,i=Math.sin(Math.PI*t)**1.3;_+=w*e.brush*i*(.42+t*.08)}}if(e.wood>0&&n<=Math.min(t.length,.22,Math.max(.09,t.length*.8))){let r=1-Math.exp(-n*480),i=Math.exp(-n*18),a=Math.sin(Math.PI*2*t.frequency*.31*n),o=Math.sin(Math.PI*2*t.frequency*.47*n+.3)*.34;_+=(a+o)*e.wood*r*i}if(e.chime>0&&n<=Math.min(t.length,.42,Math.max(.16,t.length*1.25))){let r=1-Math.exp(-n*520),i=Math.exp(-n*7.4),a=Math.sin(Math.PI*2*t.frequency*2.01*n)+Math.sin(Math.PI*2*t.frequency*3.87*n+.4)*.28;_+=a*e.chime*r*i}}}let E=520+e.brightness*4800,D=1-Math.exp(-Math.PI*2*E/t);p+=(x-p)*D;let k=x-p,A=(k*(.52+e.brightness*.28)+p*(.18-e.brightness*.08))*e.noise*Math.min(1.4,a),M=k*e.transient*Math.min(1.35,o),P=e.pack===`zen`,F=i*(P?.58:.62)+A*(P?.1:.32)+M*(P?.08:.3)+_*(P?.34:0);if(e.bitDepth<16){let t=2**e.bitDepth;F=Math.round(F*t)/t}let I=Math.min(1,r/Math.max(e.duration,.001)),V=((e.loop?(e.panFrom+e.panTo)/2-(e.panTo-e.panFrom)/2*Math.cos(Math.PI*2*I):e.panFrom+(e.panTo-e.panFrom)*I)+1)*Math.PI/4,ee=P?F:qe(F);s[n]=ee*Math.cos(V),c[n]=ee*Math.sin(V)}if(e.echo>0&&!e.loop){let n=Math.floor((.035+e.echo*.38)*t),r=Math.min(.22,e.echo*1.65);for(let e=n;e<o;e+=1)s[e]+=s[e-n]*r,c[e]+=c[e-n]*r}if(!e.loop){let e=Math.min(o,Math.round(.028*t)),n=o-e;for(let t=n;t<o;t+=1){let n=(o-1-t)/Math.max(1,e-1),r=Math.sin(n*Math.PI/2)**2;s[t]*=r,c[t]*=r}}for(let e=0;e<o;e+=1)_=Math.max(_,Math.abs(s[e]),Math.abs(c[e]));let x=e.cue===`typing`?e.pack===`zen`?.15:.28:e.pack===`zen`?e.loop?.18:e.cue===`hover`?.15:.28:e.loop?.32:e.cue===`hover`?.3:.42,S=_>0?Math.min(2.2,x/_):1;_=0;for(let e=0;e<o;e+=1)s[e]*=S,c[e]*=S,_=Math.max(_,Math.abs(s[e]),Math.abs(c[e]));return{sampleRate:t,duration:o/t,left:s,right:c,peak:_}}function Le(){if(typeof window>`u`)return;let e=window;return window.AudioContext??e.webkitAudioContext}function Q(e,t){return typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.min(1,e)):t}function ze(e){return typeof e==`number`&&Number.isFinite(e)?Math.max(1,Math.min(32,Math.round(e))):8}function Ge(){return new Promise(e=>setTimeout(e,0))}var Ra={},za=.018;function $e(e,t){return typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.min(1e4,e)):t}function We(e){if(e){if(e.storage)return e.storage;if(!(typeof window>`u`))try{return window.localStorage}catch{return}}}function je(e,t){if(!e)return{};try{let n=JSON.parse(e.getItem(t)??`{}`);return{pack:typeof n.pack==`string`&&Ta.includes(n.pack)?n.pack:void 0,volume:typeof n.volume==`number`?Q(n.volume,1):void 0,enabled:typeof n.enabled==`boolean`?n.enabled:void 0}}catch{return{}}}function ie(e={}){let t=e.preferences?.key??`uisfx:preferences`,n=We(e.preferences),r=je(n,t),i=e.pack??r.pack??`minimal`,a=Q(e.volume??r.volume,1),o=e.enabled??r.enabled??!0,s=ze(e.maxVoices),c=e.context,l,u=new Map,d=new WeakSet,p=new Map,m=new Map,h=new Set,g=new Map;function f(){if(n)try{n.setItem(t,JSON.stringify({pack:i,volume:a,enabled:o}))}catch{}}function R(e){let t=p.get(e);if(!t||d.has(e))return;d.add(e);let n=c?.currentTime??0;try{t.gain.gain.cancelScheduledValues(n),t.gain.gain.setValueAtTime(t.gain.gain.value,n),t.gain.gain.linearRampToValueAtTime(0,n+.015),e.stop(n+za)}catch{}}function O(e){e.finished||(e.finished=!0,h.delete(e),m.get(e.cue)===e&&m.delete(e.cue),e.resolveEnded())}function L(){if(c)return c;let e=Le();if(e)return c=new e({latencyHint:`interactive`}),c}function K(e){return l||(l=e.createGain(),l.gain.value=a,l.connect(e.destination),l)}function m$2(e){let t=L();if(!t)return;let n=`${i}:${e}:${t.sampleRate}`,r=u.get(n);if(r)return r;let a=oe(Z(i,e),t.sampleRate),o=t.createBuffer(2,a.left.length,a.sampleRate);return o.getChannelData(0).set(a.left),o.getChannelData(1).set(a.right),u.set(n,o),o}__name(m$2,`m`);function N(e){let t=L(),n=m$2(e.cue);if(!t||!n)return!1;t.state===`suspended`&&t.resume();let r=[...p.entries()].filter(([e])=>!d.has(e)),a;if(r.length>=s){let e=r.find(([,e])=>!e.playback.loop)??r[0];e&&(e[1].playback.playing.stop(),a=t.currentTime+za)}let o=Z(i,e.cue),c=t.createBufferSource(),l=t.createGain();return c.buffer=n,c.loop=e.loop,c.playbackRate.value=Math.max(.25,Math.min(4,e.options.playbackRate??1)),l.gain.value=Q(e.options.volume,o.defaultVolume),c.connect(l),l.connect(K(t)),e.source=c,c.addEventListener(`ended`,()=>{p.delete(c),c.disconnect(),l.disconnect(),e.source===c&&(e.source=void 0,O(e))},{once:!0}),p.set(c,{gain:l,playback:e}),a===void 0?c.start():c.start(a),!0}function y(t,n={}){if(!o)return null;let r=Z(i,t),a=n.loop??r.loop,s=n.retrigger??(a?`ignore`:`restart`),c=m.get(t),l=$e(n.cooldownMs??e.cooldownMs,Ra[t]??0),u=performance.now(),d=g.get(t);if(d!==void 0&&u-d<l)return c?.playing??null;if(c&&s===`ignore`)return c.playing;c&&s===`restart`&&c.playing.stop();let B=()=>{},p=new Promise(e=>{B=e}),_,v={stop(){_.stopped||(_.stopped=!0,m.get(t)===_&&m.delete(t),_.source?R(_.source):O(_))},ended:p};return _={cue:t,options:n,loop:a,retrigger:s,playing:v,stopped:!1,finished:!1,resolveEnded:B},h.add(_),s!==`overlap`&&m.set(t,_),N(_)?(g.set(t,u),v):(O(_),null)}async function z(e=Ca.map(e=>e.name),t={}){if(L())for(let n of e){if(t.signal?.aborted||(await Ge(),t.signal?.aborted))return;m$2(n)}}async function X(){let e=L();if(!e)return!1;if(e.state===`running`)return!0;try{return await e.resume(),e.state===`running`}catch{return!1}}function T(){for(let e of[...h])e.playing.stop()}return{unlock:X,play:y,preload:z,setPack(e){if(i!==e){i=e,f();for(let e of[...h])!e.loop||e.stopped||!e.source||(R(e.source),N(e)||O(e))}},getPack(){return i},setVolume(e){if(a=Q(e,a),f(),!l||!c)return;let t=c.currentTime;typeof l.gain.cancelAndHoldAtTime==`function`?l.gain.cancelAndHoldAtTime(t):(l.gain.cancelScheduledValues(t),l.gain.setValueAtTime(l.gain.value,t)),l.gain.linearRampToValueAtTime(a,t+.02)},getVolume(){return a},setEnabled(e){o=e,f(),o||T()},isEnabled(){return o},stopAll:T,async destroy(){T();for(let e of[...h])O(e);u.clear(),l?.disconnect(),l=void 0,c&&c!==e.context&&await c.close(),c=void 0}}}function classifyClick(e){if(!(e instanceof Element)||e.closest(`[data-xmimo-sound-toggle]`)!==null||e.closest(`[data-xmimo-sound-preview]`)!==null||e.closest(`[data-xmimo-sound-pack-option]`)!==null)return null;if(e.closest(`.dsh-pet-hit`)!==null)return`press`;let t=e.closest(`[data-xmimo-select-option]`);if(t!==null)return t.querySelector(`input[type="radio"]`)?.disabled?null:`select`;let n=e.closest(`button, a, [role='button'], [role='switch'], [role='checkbox'], [aria-checked], [aria-pressed]`);if(n===null||n instanceof HTMLButtonElement&&n.disabled||n.getAttribute(`aria-disabled`)===`true`)return null;let r=`${n.getAttribute(`aria-label`)??``} ${n.getAttribute(`title`)??``} ${n.textContent??``}`.toLowerCase(),i=typeof n.className==`string`?n.className.toLowerCase():``,a=n.getAttribute(`role`),o=a===`switch`||a===`checkbox`||n.hasAttribute(`aria-checked`)||n.hasAttribute(`aria-pressed`);return/(?:停止(?:生成|任务|语音|朗读)|中断(?:生成|语音|朗读)|取消(?:语音)?生成|\bstop\b|\babort\b|\bcancel(?:\s+\w+){0,2}\s+generation\b)/.test(r)?`stop`:o?(n.getAttribute(`aria-checked`)??n.getAttribute(`aria-pressed`))?.toLowerCase()===`true`?`toggle-off`:`toggle-on`:/关闭|取消|close|cancel/.test(r)?`close`:/发送|提交|send|submit|go/.test(r)?`send`:/删除|清空|移除|delete|clear|trash|remove/.test(r)?`delete`:n.tagName===`A`||n.getAttribute(`role`)===`link`?`open`:/primary|accent|send/.test(i)?`select`:`press`}let Ba=new Set([`start`,`complete`,`success`,`error`,`notification`,`press`,`select`,`toggle-on`,`toggle-off`,`send`,`close`,`delete`,`open`,`stop`,`queued`]);function createSoundEffectsController(e=()=>!0){let t={enabled:!0,volume:ee.soundVolume,pack:ee.soundPack,taskSounds:!0,clickSounds:!0},n=null,getPlayer=()=>(n===null&&(n=ie({pack:t.pack,volume:t.volume,enabled:t.enabled,maxVoices:8,preferences:{key:`xiaomi-mimo-tts:sound-effects`}})),n);return{play(n,r){if(!(!e()||!t.enabled||!Ba.has(n)))try{getPlayer().play(n,r)}catch{}},preview(n){if(!(!e()||!t.enabled||!Ba.has(n)))try{getPlayer().play(n)}catch{}},setVolume(e){t={...t,volume:Number.isFinite(e)?Math.max(0,Math.min(1,e)):t.volume},n!==null&&n.setVolume(t.volume)},previewVolume(){if(!(!e()||!t.enabled))try{getPlayer().play(`check`,{retrigger:`ignore`})}catch{}},update(e){t=e,n!==null&&(n.setEnabled(e.enabled),n.setVolume(e.volume),n.setPack(e.pack))},async dispose(){let e=n;n=null,e!==null&&await e.destroy()}}}function installClickSounds(e,t,n){let r=0,onPointerDown=e=>{let i=n();if(!i.enabled||!i.clickSounds)return;let a=classifyClick(e.target);if(a===null)return;let o=Date.now();o-r<40||(r=o,t.play(a))};return document.addEventListener(`pointerdown`,onPointerDown,!0),()=>document.removeEventListener(`pointerdown`,onPointerDown,!0)}function hasTurnError(){return typeof document<`u`&&document.querySelector(`[data-chat-flow-kind='turn-error']`)!==null}function installTaskSoundWatcher(e,t,n){let r=e.sessions,i,a=null,o=null,s=null,c=null,l=0,unbind=()=>{a?.(),a=null},tick=e=>{let r=n();if(!r.enabled||!r.taskSounds)return;let i=e.running===!0,a=e.pendingSubmissions.filter(({placement:e})=>e!==`transcript`).length;if(c===null){c=i,l=a;return}if(i&&!c&&t.play(`start`),!i&&c){let r=e.lastAgentError!=null||hasTurnError();window.setTimeout(()=>{n().enabled&&n().taskSounds&&t.play(r?`error`:`complete`)},50)}a>l&&t.play(`queued`),c=i,l=a},watchCurrent=()=>{let e=r.list.getSnapshot(),t=Object.values(e.byId).find(({retainedBy:e})=>(e.mainView??0)>0)?.id;if(t===i||(i=t,unbind(),c=null,l=0,s!==null&&(window.clearTimeout(s),s=null),t==null))return;let n=r.binding(t);if(n===void 0){s=window.setTimeout(watchCurrent,200);return}a=n.session.subscribe(()=>tick(n.session.getSnapshot())),tick(n.session.getSnapshot())};return o=r.list.subscribe(watchCurrent),watchCurrent(),()=>{o?.(),unbind(),s!==null&&window.clearTimeout(s)}}let Va=[`/*
33
100
  * Read-aloud action button in the assistant message toolbar.
34
101
  */
35
102
 
@@ -304,10 +371,6 @@ button.xmimo-tts-api-key-link {
304
371
  font: inherit
305
372
  }
306
373
 
307
- .xmimo-tts-grid select {
308
- color-scheme: light dark
309
- }
310
-
311
374
  .xmimo-tts-grid select option {
312
375
  color: var(--xmimo-ui-text);
313
376
  background: var(--xmimo-ui-surface)
@@ -1814,14 +1877,24 @@ button.xmimo-tts-api-key-link {
1814
1877
 
1815
1878
  .xmimo-tts-sound-body {
1816
1879
  box-sizing: border-box;
1817
- display: flex;
1880
+ display: grid;
1881
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, max(280px, calc(50% - 6px))), 1fr));
1882
+ align-items: start;
1818
1883
  min-height: 0;
1819
1884
  overflow: hidden;
1820
- flex-direction: column;
1821
1885
  gap: 12px;
1822
1886
  padding: 0 16px 16px
1823
1887
  }
1824
1888
 
1889
+ .xmimo-tts-sound-body > * {
1890
+ min-width: 0;
1891
+ }
1892
+
1893
+ .xmimo-tts-sound-body > small {
1894
+ grid-column: 1 / -1;
1895
+ }
1896
+
1897
+ .xmimo-tts-sound-scope-section,
1825
1898
  .xmimo-tts-sound-pack {
1826
1899
  display: flex;
1827
1900
  min-width: 0;
@@ -1831,6 +1904,23 @@ button.xmimo-tts-api-key-link {
1831
1904
  font-size: 13px;
1832
1905
  }
1833
1906
 
1907
+ .xmimo-tts-sound-scope-section > span:first-child,
1908
+ .xmimo-tts-sound-volume > span:first-child,
1909
+ .xmimo-tts-sound-pack > span:first-child,
1910
+ .xmimo-tts-sound-preview-section > span:first-child {
1911
+ display: flex;
1912
+ min-height: 20px;
1913
+ align-items: center;
1914
+ line-height: 20px;
1915
+ }
1916
+
1917
+ .xmimo-tts-sound-scope,
1918
+ .xmimo-tts-sound-volume > .xmimo-tts-energy {
1919
+ width: 100%;
1920
+ box-sizing: border-box;
1921
+ min-height: 32px;
1922
+ }
1923
+
1834
1924
  .xmimo-tts-sound-pack-grid {
1835
1925
  display: grid;
1836
1926
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
@@ -1969,7 +2059,7 @@ button.xmimo-tts-api-key-link {
1969
2059
  gap: 5px;
1970
2060
  overflow-x: auto;
1971
2061
  overscroll-behavior-x: contain;
1972
- padding: 2px 1px 4px
2062
+ padding: 0 1px 4px
1973
2063
  }
1974
2064
 
1975
2065
  .xmimo-tts-sound-previews button {
@@ -2052,8 +2142,7 @@ button.xmimo-tts-api-key-link {
2052
2142
  .xmimo-tts-sound-volume {
2053
2143
  display: flex;
2054
2144
  flex-direction: column;
2055
- padding-top: 8px;
2056
- gap: 9px;
2145
+ gap: 5px;
2057
2146
  color: var(--dsw-alias-label-primary, #1f2328);
2058
2147
  font-size: 13px
2059
2148
  }
@@ -3160,8 +3249,47 @@ button.xmimo-tts-api-key-link {
3160
3249
  .xmimo-passport-heading > div { flex: 1 1 280px; }
3161
3250
  .xmimo-passport-heading > button { flex-shrink: 0; max-width: 100%; }
3162
3251
  .xmimo-passport-heading .xmimo-qq-hint { margin-bottom: 0; }
3252
+ .xmimo-passport-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 24px; padding-top: 20px; border-top: 1px solid var(--xmimo-ui-border-soft); }
3253
+ .xmimo-qq-settings .xmimo-passport-options > section + section { padding-top: 0; border-top: 0; }
3254
+ .xmimo-passport-section-hint { margin-bottom: 14px; }
3255
+ .xmimo-passport-option-feedback { display: block; color: var(--xmimo-ui-text-muted); font-size: 12px; }
3256
+ .xmimo-passport-settings .xmimo-qq-field > label { font-weight: 550; }
3257
+ .xmimo-passport-option-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 6px; }
3258
+ .xmimo-passport-prompt-action { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
3259
+ .xmimo-passport-prompt-action > span { color: var(--xmimo-ui-text-muted); font-size: 12px; }
3260
+ .xmimo-passport-control-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
3261
+ .xmimo-passport-control-row > select { flex: 1 1 180px; width: auto; min-width: 0; }
3262
+ .xmimo-passport-control-row > button { flex: 0 0 auto; max-width: 100%; }
3163
3263
  .xmimo-passport-settings button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
3164
3264
  .xmimo-passport-settings button svg { width: 16px; height: 16px; flex-shrink: 0; }
3265
+ .xmimo-passport-overview { display: grid; grid-template-columns: minmax(310px, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-block: 24px; }
3266
+ .xmimo-passport-device { position: relative; margin: 0; min-height: 360px; display: flex; justify-content: center; align-items: start; }
3267
+ .xmimo-passport-device-art { position: relative; width: 235px; max-width: 68%; }
3268
+ .xmimo-passport-device-art > img:first-child { display: block; width: 100%; height: auto; }
3269
+ .xmimo-passport-device-screen { position: absolute; left: 20.7%; top: 15.4%; width: 48.8%; height: 41.7%; border-radius: 7%; }
3270
+ .xmimo-passport-device-reply { box-sizing: border-box; position: absolute; left: 11%; top: 68.5%; width: 64%; height: 20%; padding: 6px 8px; overflow: auto; border-radius: 4px; background: rgba(23, 28, 30, .94); color: #fff; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
3271
+ .xmimo-passport-device-reply span { color: #b8c6c5; font-size: 10px; }
3272
+ .xmimo-passport-device-reply p { margin: 4px 0 0; white-space: pre-wrap; }
3273
+ .xmimo-passport-callout { position: absolute; display: flex; flex-direction: column; max-width: 74px; font-size: 11px; line-height: 1.4; color: var(--xmimo-ui-text-muted); }
3274
+ .xmimo-passport-callout strong { color: var(--xmimo-ui-text); font-size: 12px; }
3275
+ .xmimo-passport-callout-power, .xmimo-passport-callout-indicator, .xmimo-passport-callout-usb { right: calc(50% + 120px); text-align: right; }
3276
+ .xmimo-passport-callout-power { top: 13%; }
3277
+ .xmimo-passport-callout-indicator { top: 38%; }
3278
+ .xmimo-passport-callout-usb { top: 50%; }
3279
+ .xmimo-passport-callout-up, .xmimo-passport-callout-down, .xmimo-passport-callout-ok { left: calc(50% + 120px); transform: translateY(15px); }
3280
+ .xmimo-passport-callout-up { top: 10%; }
3281
+ .xmimo-passport-callout-down { top: 27%; }
3282
+ .xmimo-passport-callout-ok { top: 43%; }
3283
+ .xmimo-passport-live { min-width: 0; }
3284
+ .xmimo-passport-live .xmimo-passport-status { margin-block: 10px 16px; }
3285
+ .xmimo-passport-facts { display: grid; gap: 0; margin: 0; }
3286
+ .xmimo-passport-facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--xmimo-ui-border-soft); }
3287
+ .xmimo-passport-facts dt { color: var(--xmimo-ui-text-muted); }
3288
+ .xmimo-passport-facts dd { margin: 0; text-align: right; font-weight: 600; }
3289
+ .xmimo-passport-live-text { margin-top: 15px; }
3290
+ .xmimo-passport-live-text h5 { margin: 0 0 5px; font-size: 12px; color: var(--xmimo-ui-text-muted); font-weight: 600; }
3291
+ .xmimo-passport-live-text p { margin: 0; max-height: 8em; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; }
3292
+ .xmimo-passport-live-hint { font-size: 12px; }
3165
3293
  .xmimo-passport-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-block: 20px 24px; padding: 14px 16px; background: var(--xmimo-ui-surface-subtle, var(--xmimo-ui-control-surface)); border-radius: var(--xmimo-ui-control-radius); }
3166
3294
  .xmimo-passport-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--xmimo-ui-text-muted); flex-shrink: 0; }
3167
3295
  .xmimo-passport-status[data-tone="connected"] { background: color-mix(in srgb, #23865b 10%, var(--xmimo-ui-surface)); }
@@ -3184,8 +3312,6 @@ button.xmimo-tts-api-key-link {
3184
3312
  .xmimo-passport-digits > span:not(.xmimo-passport-sr-only) { display: grid; place-items: center; width: 48px; height: 60px; border: 1px solid var(--xmimo-ui-border); border-radius: var(--xmimo-ui-control-radius); background: var(--xmimo-ui-control-surface); font-size: 32px; font-weight: 650; font-variant-numeric: tabular-nums; }
3185
3313
  .xmimo-passport-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
3186
3314
  .xmimo-passport-copy-feedback { display: block; margin-top: 8px; font-size: 12px; }
3187
- .xmimo-passport-device-help { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--xmimo-ui-border-soft); }
3188
- .xmimo-passport-device-help p { margin-block: 8px 0; line-height: 1.8; }
3189
3315
  .xmimo-passport-advanced { border-top: 1px solid var(--xmimo-ui-border-soft); }
3190
3316
  .xmimo-passport-advanced summary { cursor: pointer; padding-block: 12px; font-weight: 550; }
3191
3317
  .xmimo-passport-advanced section { padding-block: 8px; }
@@ -3202,7 +3328,6 @@ button.xmimo-tts-api-key-link {
3202
3328
  caret-color: var(--xmimo-ui-brand);
3203
3329
  font: inherit;
3204
3330
  font-variant-numeric: tabular-nums;
3205
- color-scheme: light dark;
3206
3331
  }
3207
3332
  .xmimo-qq-field textarea { resize: vertical; min-height: 64px; }
3208
3333
  .xmimo-qq-field :is(input, textarea)::placeholder { color: var(--xmimo-ui-text-muted); }
@@ -3219,7 +3344,13 @@ button.xmimo-tts-api-key-link {
3219
3344
  .xmimo-qq-footer .xmimo-tts-card-action-buttons { grid-column: 2; }
3220
3345
  .xmimo-qq-footer [role="status"] { text-align: start; }
3221
3346
 
3347
+ @container (max-width: 600px) {
3348
+ .xmimo-passport-options { grid-template-columns: minmax(0, 1fr); }
3349
+ .xmimo-qq-settings .xmimo-passport-options > section + section { padding-top: 20px; border-top: 1px solid var(--xmimo-ui-border-soft); }
3350
+ }
3351
+
3222
3352
  @container (max-width: 480px) {
3353
+ .xmimo-passport-overview { grid-template-columns: minmax(0, 1fr); }
3223
3354
  .xmimo-passport-transfer { grid-template-columns: minmax(0, 1fr); gap: 24px; }
3224
3355
  .xmimo-qq-grid { grid-template-columns: minmax(0, 1fr); }
3225
3356
  .xmimo-qq-memory-row { grid-template-columns: auto minmax(0, 1fr); }
@@ -3317,7 +3448,7 @@ button.xmimo-tts-api-key-link {
3317
3448
  padding-left: 12px
3318
3449
  }
3319
3450
  .xmimo-tts-sound-pack-grid {
3320
- grid-template-columns: repeat(3, minmax(0, 1fr));
3451
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 96px), 1fr));
3321
3452
  gap: 6px
3322
3453
  }
3323
3454
  .xmimo-tts-sound-pack-option {
@@ -3840,12 +3971,6 @@ button.xmimo-tts-api-key-link {
3840
3971
  flex-direction: row;
3841
3972
  gap: 6px;
3842
3973
  }
3843
- .xmimo-tts-card-minimal .xmimo-tts-sound-volume {
3844
- width: 50%;
3845
- align-items: center;
3846
- flex-direction: row;
3847
- gap: 6px;
3848
- }
3849
3974
 
3850
3975
 
3851
3976
  .xmimo-tts-card-minimal .xmimo-tts-api-key-input > input {
@@ -3882,7 +4007,7 @@ button.xmimo-tts-api-key-link {
3882
4007
 
3883
4008
  .xmimo-tts-card-minimal
3884
4009
  .xmimo-tts-details-body
3885
- > :not(.xmimo-tts-volume):not(.xmimo-tts-doubao-voice):not(.xmimo-tts-speech-instruction)
4010
+ > :not(.xmimo-tts-volume):not(.xmimo-tts-external-catalog):not(.xmimo-tts-doubao-voice):not(.xmimo-tts-speech-instruction)
3886
4011
  > .xmimo-tts-field-heading {
3887
4012
  position: absolute;
3888
4013
  width: 1px;
@@ -3897,7 +4022,7 @@ button.xmimo-tts-api-key-link {
3897
4022
 
3898
4023
 
3899
4024
 
3900
- .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-menu,
4025
+ .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-menu:not(.xmimo-tts-external-catalog *),
3901
4026
  .xmimo-tts-card-minimal .xmimo-tts-voice-picker-menu {
3902
4027
  grid-template-columns: repeat(4, minmax(0, 1fr));
3903
4028
  background: none;
@@ -3906,32 +4031,32 @@ button.xmimo-tts-api-key-link {
3906
4031
  padding: 6px;
3907
4032
  }
3908
4033
 
3909
- .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-option {
4034
+ .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-option:not(.xmimo-tts-external-catalog *) {
3910
4035
  min-width: 0;
3911
4036
  min-height: 42px;
3912
4037
  padding: 6px;
3913
4038
  }
3914
4039
 
3915
- .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-copy,
4040
+ .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-copy:not(.xmimo-tts-external-catalog *),
3916
4041
  .xmimo-tts-card-minimal .xmimo-tts-voice-option-copy {
3917
4042
  align-items: baseline;
3918
4043
  flex-direction: row;
3919
4044
  gap: 6px;
3920
4045
  }
3921
4046
 
3922
- .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-copy > strong,
4047
+ .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-copy:not(.xmimo-tts-external-catalog *) > strong,
3923
4048
  .xmimo-tts-card-minimal .xmimo-tts-voice-option-copy > strong {
3924
4049
  min-width: 0;
3925
4050
  flex: 0 1 auto;
3926
4051
  }
3927
4052
 
3928
- .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-copy > small,
4053
+ .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-copy:not(.xmimo-tts-external-catalog *) > small,
3929
4054
  .xmimo-tts-card-minimal .xmimo-tts-voice-option-copy > small {
3930
4055
  min-width: 0;
3931
4056
  flex: 1 1 0;
3932
4057
  }
3933
4058
 
3934
- .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-option-custom {
4059
+ .xmimo-tts-card-minimal .xmimo-tts-builtin-voice-option-custom:not(.xmimo-tts-external-catalog *) {
3935
4060
  grid-column: auto;
3936
4061
  }
3937
4062
 
@@ -3991,15 +4116,19 @@ button.xmimo-tts-api-key-link {
3991
4116
  padding: 6px 10px 10px;
3992
4117
  }
3993
4118
 
4119
+ .xmimo-tts-card-minimal .xmimo-tts-sound-volume .xmimo-tts-energy-minimal input[type="range"] {
4120
+ top: 0;
4121
+ }
4122
+
3994
4123
  .xmimo-tts-card-minimal .xmimo-tts-sound-pack-grid {
3995
- grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
3996
- gap: 4px;
4124
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr));
4125
+ gap: 5px;
3997
4126
  }
3998
4127
 
3999
4128
  .xmimo-tts-card-minimal .xmimo-tts-sound-pack-option {
4000
- min-height: 34px;
4129
+ min-height: 44px;
4001
4130
  border-radius: 9px;
4002
- padding: 5px 20px 5px 7px;
4131
+ padding: 7px 24px 7px 9px;
4003
4132
  font-size: 11px;
4004
4133
  line-height: 16px;
4005
4134
  transition:
@@ -4029,9 +4158,9 @@ button.xmimo-tts-api-key-link {
4029
4158
  }
4030
4159
 
4031
4160
  .xmimo-tts-card-minimal .xmimo-tts-sound-pack-icon {
4032
- width: 16px;
4033
- height: 16px;
4034
- margin-right: 5px;
4161
+ width: 18px;
4162
+ height: 18px;
4163
+ margin-right: 6px;
4035
4164
  }
4036
4165
 
4037
4166
  .xmimo-tts-card-minimal .xmimo-tts-sound-previews button {
@@ -4077,5 +4206,5 @@ button.xmimo-tts-api-key-link {
4077
4206
  }
4078
4207
  }
4079
4208
  `].join(`
4080
- `),Ba=100*1024*1024;var AudioHistory=class{view={entries:[],status:`loading`,skipped:!1};listeners=new Set;replayStops=new Set;chain;disposed=!1;storageLoaded=!1;storage;constructor(e=new IndexedDbAudioHistoryStorage){this.storage=e,this.chain=e.load().then(e=>{this.storageLoaded=!0,this.publish({entries:retainAudioHistory(e),status:`ready`,skipped:!1})}).catch(()=>this.publish({entries:[],status:`memory`,skipped:!1}))}getSnapshot=()=>this.view;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});onStopReplay(e){return this.replayStops.add(e),()=>{this.replayStops.delete(e)}}stopReplay(){for(let e of this.replayStops)e()}add(e){return this.mutate(()=>{if(e.blob.size===0)return;if(e.blob.size>Ba){this.publish({...this.view,skipped:!0});return}let t=globalThis.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,n={...e,text:e.text.slice(0,500),id:t,createdAt:Date.now()};this.publish({...this.view,entries:retainAudioHistory([n,...this.view.entries])})})}remove(e){return this.mutate(()=>this.publish({...this.view,entries:this.view.entries.filter(t=>t.id!==e)}))}clear(){return this.mutate(()=>this.publish({...this.view,entries:[],skipped:!1}))}reportSkipped(){return this.mutate(()=>this.publish({...this.view,skipped:!0}))}async dispose(){this.disposed=!0,this.stopReplay(),this.replayStops.clear(),this.listeners.clear(),await this.chain,this.storage.close()}mutate(e){return this.disposed?Promise.resolve():(this.chain=this.chain.then(async()=>{if(e(),this.storageLoaded)try{await this.storage.replace(this.view.entries),this.view.status===`memory`&&this.publish({...this.view,status:`ready`})}catch{this.publish({...this.view,status:`memory`})}}),this.chain)}publish(e){this.view=e;for(let e of this.listeners)e()}};function retainAudioHistory(e){let t=0,n=[];for(let r of[...e].sort((e,t)=>t.createdAt-e.createdAt))if(!(r.blob.size===0||r.blob.size>Ba)){if(n.length>=100||t+r.blob.size>Ba)break;t+=r.blob.size,n.push(r)}return n}var IndexedDbAudioHistoryStorage=class{database=null;ids=new Set;async load(){return this.database=await new Promise((e,t)=>{let n=!1,r=indexedDB.open(`dsh-xiaomi-tts-audio-history`,1);r.onupgradeneeded=()=>{r.result.createObjectStore(`audio`,{keyPath:`id`})},r.onsuccess=()=>{if(n){r.result.close();return}r.result.onversionchange=()=>r.result.close(),e(r.result)},r.onerror=()=>t(r.error),r.onblocked=()=>{n=!0,t(Error(`audio-history-blocked`))}}),new Promise((e,t)=>{let n=this.database.transaction(`audio`,`readonly`),r=n.objectStore(`audio`).getAll();n.oncomplete=()=>{let t=r.result;this.ids=new Set(t.map(e=>e.id)),e(t)},n.onerror=()=>t(n.error),n.onabort=()=>t(n.error)})}async replace(e){if(this.database===null)throw Error(`audio-history-unavailable`);let t=new Set(e.map(e=>e.id));await new Promise((n,r)=>{let i=this.database.transaction(`audio`,`readwrite`),a=i.objectStore(`audio`);for(let e of this.ids)t.has(e)||a.delete(e);for(let t of e)this.ids.has(t.id)||a.put(t);i.oncomplete=()=>n(),i.onerror=()=>r(i.error),i.onabort=()=>r(i.error)}),this.ids=t}close(){this.database?.close(),this.database=null}},AnnouncementManager=class{running=new Map;constructor(e,t,n){this.collectors=e,this.play=t,this.stop=n}update(e,t){let n=new Set(t?e:[]);for(let[e,t]of this.running)n.has(e)||(this.running.delete(e),t.abort(),this.stop(e));for(let e of this.collectors){if(!n.has(e.id)||this.running.has(e.id))continue;let t=new AbortController;this.running.set(e.id,t),e.start({signal:t.signal,emit:e=>{t.signal.aborted||this.play(e)}}).catch(()=>{this.running.get(e.id)===t&&(this.running.delete(e.id),this.stop(e.id))})}}dispose(){this.update([],!1)}},AnnouncementPlayback=class{stops=new Map;constructor(e,t,n,r=()=>!1){this.service=e,this.activity=t,this.questions=n,this.importantFirst=r}play=e=>{if(e.signal?.aborted)return;if(e.source===`question-titles`){this.questions?.play(e);return}let t=this.service.tryPlay(e.text,this.activity.isBusy,e.important&&this.importantFirst()?this.activity.interrupt:void 0);if(!t)return;this.stops.get(e.source)?.();let cleanup=()=>{e.signal?.removeEventListener(`abort`,cleanup),t(),this.stops.get(e.source)===cleanup&&this.stops.delete(e.source)};this.stops.set(e.source,cleanup),e.signal?.addEventListener(`abort`,cleanup,{once:!0}),e.signal?.aborted&&cleanup()};stop=e=>{e===`question-titles`&&this.questions?.stop(),this.stops.get(e)?.(),this.stops.delete(e)}};let object=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:null,counter=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0;function parsePetState(e){let t=object(e),n=object(t?.pets);if(!t||!n)return null;let r=new Map;for(let[e,t]of Object.entries(n)){let n=object(object(t)?.say);n&&counter(n.counter)&&r.set(e,{counter:n.counter,data:object(n.data)})}let i=object(object(t.sections)?.config)?.counter;return{...counter(t.counter)?{counter:t.counter}:{},configCounter:counter(i)?i:void 0,pets:r}}function visiblePetIds(e){let t=object(e);if(!t||!object(t.main)||!Array.isArray(object(t.main)?.pets))return null;let n=new Set;for(let e of Object.values(t)){let t=object(e)?.pets;if(Array.isArray(t))for(let e of t){let t=object(e);typeof t?.id==`string`&&[`web`,`desktop`,`both`].includes(String(t.display))&&n.add(t.id)}}return n}function delay(e,t){return new Promise(n=>{if(t.aborted){n();return}let done=()=>{clearTimeout(r),t.removeEventListener(`abort`,done),n()},r=setTimeout(done,e);t.addEventListener(`abort`,done,{once:!0})})}var PetHttpError=class extends Error{constructor(e){super(`dsh-pet: HTTP ${e}`),this.status=e}};async function readJson(e,t){let n=await fetch(hostRoute(e),{cache:`no-store`,signal:AbortSignal.any([t,AbortSignal.timeout(15e3)])});if(!n.ok)throw new PetHttpError(n.status);return n.json()}var DshPetCollector=class{id=`dsh-pet`;async start({signal:e,emit:t}){let n=null,r=new Map,i=null,a;for(;!e.aborted;)try{let o=parsePetState(await readJson(`/dsh-pet-7340/state${n?.counter===void 0?``:`?since=${n.counter}&timeout=10000`}`,e));if(!o)throw Error(`dsh-pet: invalid state`);if(e.aborted)return;let s=n===null||o.counter!==void 0&&n.counter!==void 0&&o.counter<n.counter||[...o.pets].some(([e,t])=>t.counter<(r.get(e)??0)),c=[...o.pets].filter(([e,t])=>r.get(e)!==t.counter);s&&r.clear();for(let[e,t]of o.pets)r.set(e,t.counter);if(n=o,(s||i===null||a!==o.configCounter||c.length>0)&&(i=null,i=visiblePetIds(await readJson(`/dsh-pet-7340/config`,e)),a=o.configCounter,i===null))throw Error(`dsh-pet: invalid config`);if(e.aborted)return;if(!s)for(let[e,n]of c.sort((e,t)=>e[1].counter-t[1].counter)){let r=n.data;!i?.has(e)||!r||r.clear===!0||r.duration===0||typeof r.text!=`string`||!r.text.trim()||t({source:this.id,id:JSON.stringify([e,n.counter]),text:r.text})}o.counter===void 0&&await delay(1e3,e)}catch(t){if(e.aborted||t instanceof PetHttpError&&t.status===404)return;n=null,r.clear(),i=null,await delay(5e3,e)}}},QuestionTitleTracker=class{seen=new Set;baseline=!0;current=null;constructor(e){this.emit=e}cancel(){this.current?.controller.abort(),this.current=null}reset(){this.cancel(),this.baseline=!0}update(e){let t=e.find(e=>e.visible);if(this.current?.id!==t?.id&&this.cancel(),this.baseline){for(let t of e)this.seen.add(t.id);this.baseline=!1;return}!t||this.seen.has(t.id)||(this.seen.add(t.id),this.current={id:t.id,controller:new AbortController},this.emit({source:`question-titles`,id:t.id,text:t.text,signal:this.current.controller.signal}))}};function questionTitles(e,t){let n=[];for(let r of Array.from(e.querySelectorAll(`[data-question-key]`))){let i=r.dataset.questionKey,a=r.closest(`[data-session-id]`)?.getAttribute(`data-session-id`);if(!(!i||a&&a!==t))for(let a of Array.from(r.querySelectorAll(`section[aria-labelledby]`))){let r=(a.getAttribute(`aria-labelledby`)??``).split(/\s+/).map(t=>e.getElementById(t)).find(e=>e?.tagName===`H2`&&a.contains(e)),o=r?.textContent?.trim();if(!r||!o)continue;let s=a.querySelector(`header button[aria-expanded="false"]`),c=a.querySelector(`header button[aria-expanded]`)?.disabled,l=!s&&!c&&!a.closest(`[hidden], [inert], [aria-hidden="true"]`)&&a.getClientRects().length>0&&e.defaultView?.getComputedStyle(a).visibility!==`hidden`;n.push({id:JSON.stringify([t,i,r.id]),text:o,visible:l})}}return n}var QuestionTitleCollector=class{id=`question-titles`;session=null;refresh=null;reset=null;constructor(e=window.document){this.document=e}activateSession(e){return this.session=e,this.reset?.(),queueMicrotask(()=>this.refresh?.()),()=>{this.session===e&&(this.session=null,this.reset?.())}}async start({signal:e,emit:t}){if(e.aborted)return;let n=new QuestionTitleTracker(t),scan=()=>{if(e.aborted||this.session===null){n.cancel();return}n.update(questionTitles(this.document,this.session))},reset=()=>n.reset();this.refresh=scan,this.reset=reset;let r=new MutationObserver(scan);r.observe(this.document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`aria-labelledby`,`aria-hidden`,`aria-expanded`,`hidden`,`inert`,`disabled`,`style`,`class`,`data-question-key`,`data-session-id`]}),scan(),await new Promise(t=>{let cleanup=()=>{r.disconnect(),n.cancel(),this.refresh===scan&&(this.refresh=null,this.reset=null),e.removeEventListener(`abort`,cleanup),t()};e.addEventListener(`abort`,cleanup,{once:!0}),e.aborted&&cleanup()})}},QuestionTitlePlayback=class{player=new PreviewPlayer(()=>{});release=null;unregister;constructor(e,t,n){this.activity=e,this.settings=t,this.pcmBusy=n,this.unregister=e.register(()=>isSpeechBusy(this.player.getView().status),()=>this.stop())}play(e){let t=this.settings();if(e.signal?.aborted||!t.enabled||!t.autoPlay||!t.announcementSources.includes(`question-titles`)||this.activity.isBusy()||this.pcmBusy())return;this.stop();let stop=()=>this.stop();e.signal?.addEventListener(`abort`,stop,{once:!0}),this.release=()=>e.signal?.removeEventListener(`abort`,stop),this.player.play(e.text,t)}stop(){this.release?.(),this.release=null,this.player.stop()}setVolume(e){this.player.setVolume(e)}async dispose(){this.stop(),this.unregister(),await this.player.dispose()}};function hostCollector(e,t,n,r){return{id:t,async start(i){if(i.signal.aborted)return;let a=e.inject([`sessions`,n],e=>{e.effect(()=>{if(i.signal.aborted)return()=>{};let t=new AbortController,n=r(e,{...i,signal:AbortSignal.any([i.signal,t.signal])});return()=>{t.abort(),n()}},`xiaomi-mimo-tts: ${t}`)});await new Promise((e,t)=>{let stop=()=>{i.signal.removeEventListener(`abort`,stop);try{Promise.resolve(a.dispose()).then(e,t)}catch(e){t(e)}};i.signal.addEventListener(`abort`,stop,{once:!0}),i.signal.aborted&&stop()})}}}function observeCurrentSession(e,t){let n,r,update=()=>{let i=e.list.getSnapshot(),a=i.phase===`ready`?Object.values(i.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id:void 0;a!==n&&(n=a,r?.(),r=a===void 0?void 0:t(a))},i=e.list.subscribe(update);return update(),()=>{i(),r?.()}}let briefText=e=>typeof e==`string`?e.replace(/\s+/g,` `).trim().slice(0,160):``;function observeApprovals(e,t,n,{signal:r,emit:i}){return observeCurrentSession(e,e=>{let a=new Set,o,cancel=()=>{o?.controller.abort(),o=void 0},scan=(s=!1)=>{let c=t.sessionStatus.getSnapshot().get(e)?.pendingInteraction,l=c?.kind===`approval`?c:void 0;if(o?.key!==l?.key&&cancel(),!l||a.has(l.key)||r.aborted||(a.add(l.key),s))return;let u=briefText(l.reason);o={key:l.key,controller:new AbortController},i({source:`approvals`,id:JSON.stringify([e,l.key]),important:!0,text:u?`${n(`announcements.approval`)} ${u}`:n(`announcements.approval`),signal:AbortSignal.any([r,o.controller.signal])})},s=t.sessionStatus.subscribe(()=>scan());return scan(!0),()=>{s(),cancel()}})}function observeJobs(e,t,n,{signal:r,emit:i}){return observeCurrentSession(e,e=>{let a=new AbortController,o=new Map,scan=()=>{let s=t.state.getSnapshot().rows[e]??[],c=new Map;for(let t of s){if(t.owner!==e||!t.id||(c.set(t.id,t.status),![`running`,`stopping`].includes(o.get(t.id)??``)||![`completed`,`failed`,`killed`].includes(t.status)||r.aborted))continue;o.set(t.id,t.status);let s=t.status===`completed`?n(`announcements.jobCompleted`):t.status===`failed`?n(`announcements.jobFailed`):n(`announcements.jobKilled`);i({source:`job-results`,id:JSON.stringify([e,t.id]),important:t.status===`failed`,text:`${briefText(t.label)||n(`announcements.job`)}: ${s}`,signal:AbortSignal.any([r,a.signal])})}o=c},s=t.state.subscribe(scan),c=t.watchRows(e);return scan(),()=>{a.abort(),s(),c()}})}let Va=[`slots`,`locale`,`remote`,`configForms`,`pluginNavigation`,`layout`,`pluginChanges`,`sessions`];function formatStartupError(e){return e instanceof Error?e.message:String(e)}function registerSlotContribution(e,t,n){e.effect(()=>{try{e.slots.inject(t,()=>{try{return n()}catch(n){return e.logger.error(`dsh-xiaomi-tts: ${t} contribution disabled: ${formatStartupError(n)}`),()=>{}}})}catch(n){e.logger.error(`dsh-xiaomi-tts: ${t} injection disabled: ${formatStartupError(n)}`)}return()=>{}},`xiaomi-mimo-tts: ${t}`)}function apply(e){console.info(`[dsh-xiaomi-tts] client loaded`);let t=e.locale,n=t.bind(hi);e.effect(()=>t.register(hi,{zh:gi,en:_i,ja:pi,fr:mi}),`xiaomi-mimo-tts: dictionaries`);let r=e.configForms.get(`xiaomi-mimo-tts`),i=new TabAudioFocus,a=e.pluginChanges.bundle(`dsh-xiaomi-tts`);e.effect(()=>{let e=bindApiKeyStatus(r,a);return window.addEventListener(`online`,ti.invalidate),()=>{window.removeEventListener(`online`,ti.invalidate),e()}},`xiaomi-mimo-tts: API key status`);let o=new VoiceInputActivity(document),s=new PluginAudioFocus(new PluginAudioFocus(i,a),o),c=new ComposerInputActivity(document),l=new PluginAudioFocus(s,c),u=createSoundEffectsController(s.canPlay),getSoundSettings=()=>{let e=resolveTtsSettings(r.getSnapshot().value);return{enabled:e.soundEnabled,volume:e.soundVolume,pack:e.soundPack,taskSounds:e.taskSounds,clickSounds:e.clickSounds}};u.update(getSoundSettings()),e.effect(()=>{let t=installClickSounds(e,u,getSoundSettings),n=installTaskSoundWatcher(e,u,getSoundSettings),i=r.subscribe(()=>{u.update(getSoundSettings())});return()=>{t(),n(),i(),u.dispose()}},`xiaomi-mimo-tts: sound effects`);let d=new AudioHistory;e.effect(()=>()=>d.dispose(),`xiaomi-mimo-tts: audio history`);let p=new PlaybackController(d),m=new LiveSpeechController(d),h=new LocalSpeechController,g=new SpeechActivity;g.register(()=>isSpeechBusy(p.getSnapshot().status),()=>{p.resetAutomaticPlayback(),p.interrupt()}),g.register(m.isBusy,()=>m.interrupt()),g.register(h.isBusy,()=>h.interrupt());let _,v=new XiaomiMimoTtsPcmService(e,r,()=>{_?.stop(),m.interrupt(),h.interrupt(),p.interrupt()},d,l.canPlay),b=new PluginAudioFocus(l,v.priorityActivity);_=new QuestionTitlePlayback(g,()=>resolveTtsSettings(r.getSnapshot().value),v.isBusy);let x=new AutomaticReading;e.effect(()=>v.priorityActivity.subscribe(()=>{p.resetAutomaticPlayback(),v.priorityActivity.getSnapshot()&&x.interruptAutomatic(()=>{})}),`xiaomi-mimo-tts: important announcement focus`);let S=e.configForms.get(`ui-chat`),updateAutomaticReading=()=>x.update(S.getSnapshot().value?.foldedReplies,()=>{m.interrupt(),h.interrupt(),p.interrupt()},()=>p.resetAutomaticPlayback());updateAutomaticReading(),e.effect(()=>S.subscribe(updateAutomaticReading),`xiaomi-mimo-tts: host reading preference`);let C=new QuestionTitleCollector,w=new AnnouncementPlayback(v,g,_,()=>resolveTtsSettings(r.getSnapshot().value).importantAnnouncementsFirst),E=new AnnouncementManager([new DshPetCollector,C,hostCollector(e,`approvals`,`uiSession`,(e,t)=>observeApprovals(e.sessions,e.uiSession,n,t)),hostCollector(e,`job-results`,`jobs`,(e,t)=>observeJobs(e.sessions,e.jobs,n,t))],w.play,w.stop);e.effect(()=>{let update=()=>{let e=r.getSnapshot(),t=resolveTtsSettings(e.value),n=t.announcementSources.filter(e=>e!==`question-titles`||t.autoPlay);E.update(n,e.status===`ready`&&t.enabled&&l.canPlay()),t.announcementSources.includes(`dsh-whale-musume`)||v.stopExternal(),(e.status!==`ready`||!t.enabled)&&v.stop()},e=r.subscribe(update),t=l.subscribe(update);return update(),()=>{e(),t(),E.dispose()}},`xiaomi-mimo-tts: announcement collectors`),e.effect(()=>{let e=s.subscribe(()=>{p.resetAutomaticPlayback(),!s.canPlay()&&(m.interrupt(),h.interrupt(),p.interrupt(),v.stop(),_?.stop(),d.stopReplay(),u.dispose())}),t=i.activate();return()=>{t(),e()}},`xiaomi-mimo-tts: tab audio focus`),e.effect(()=>{let update=()=>o.configure(resolveTtsSettings(r.getSnapshot().value).voiceInputCompatibility),e=r.subscribe(update);return update(),()=>{e(),o.dispose()}},`xiaomi-mimo-tts: voice input compatibility`),e.effect(()=>{let e=c.subscribe(()=>{p.resetAutomaticPlayback(),c.getSnapshot()&&(x.interruptAutomatic(()=>{m.interrupt(),h.interrupt(),p.interrupt()}),v.stop(),_?.stop())}),update=()=>c.configure(resolveTtsSettings(r.getSnapshot().value).inputAvoidance),t=r.subscribe(update);return update(),()=>{t(),e(),c.dispose()}},`xiaomi-mimo-tts: composer input avoidance`);let D=null,updateProvider=()=>{let e=resolveTtsSettings(r.getSnapshot().value),t=JSON.stringify({...ttsSelection(e),voiceRate:void 0});D!==null&&D!==t&&(m.interrupt(),p.interrupt(),h.interrupt(),v.stop(),_?.stop()),D=t,m.configure(e),p.configure(e)};updateProvider(),e.effect(()=>r.subscribe(updateProvider),`xiaomi-mimo-tts: provider selection`),e.effect(()=>onTtsCredentialsSaved(()=>{m.interrupt(),p.interrupt(),h.interrupt(),v.stop(),_?.stop()}),`xiaomi-mimo-tts: saved credentials`);let stopOptionalPcm=()=>{v.stop(),_?.stop(),d.stopReplay()};m.setBeforePlayback(stopOptionalPcm),h.setBeforePlayback(stopOptionalPcm),p.setBeforePlayback(stopOptionalPcm),m.setStateChangeListener((e,t,n,r)=>p.updateLivePlayback(e,t,n,`live`,r)),h.setStateChangeListener((e,t,n,r)=>p.updateLivePlayback(e,t,n,`system`,r));let stopAllPlayback=()=>{p.resetAutomaticPlayback(),m.interrupt(),h.interrupt(),p.interrupt(),v.stop(),_?.stop(),d.stopReplay()};e.effect(()=>{let e=ni.subscribe(stopAllPlayback),t=ni.start();return()=>{e(),t()}},`xiaomi-mimo-tts: speech engine state`),e.effect(()=>observePluginActivity(a,stopAllPlayback),`xiaomi-mimo-tts: plugin changes`);let updateVoiceVolume=()=>{let e=resolveTtsSettings(r.getSnapshot().value).voiceVolume;m.setVolume(e),h.setVolume(e),p.setVolume(e),v.setVolume(e),_?.setVolume(e)};updateVoiceVolume(),e.effect(()=>r.subscribe(updateVoiceVolume),`xiaomi-mimo-tts: voice volume`);let updateVoiceRate=()=>{let e=resolveTtsSettings(r.getSnapshot().value).voiceRate;m.setVoiceRate(e),h.setVoiceRate(e),p.setVoiceRate(e)};updateVoiceRate(),e.effect(()=>r.subscribe(updateVoiceRate),`xiaomi-mimo-tts: voice rate`),e.effect(()=>async()=>{m.setBeforePlayback(null),h.setBeforePlayback(null),p.setBeforePlayback(null),await v.dispose(),await _?.dispose()},`xiaomi-mimo-tts: optional PCM service`),e.effect(()=>()=>p.dispose(),`xiaomi-mimo-tts: playback`),e.effect(()=>()=>m.dispose(),`xiaomi-mimo-tts: live playback`),e.effect(()=>()=>h.dispose(),`xiaomi-mimo-tts: local playback`),e.effect(()=>{let e=document.createElement(`style`);return e.dataset.plugin=hi,e.textContent=za,document.head.appendChild(e),()=>e.remove()},`xiaomi-mimo-tts: styles`),registerSlotContribution(e,`settings.section.icon`,()=>observeHostSettingsEntry(r,()=>registerVoiceReadingNavIcon(e))),registerSlotContribution(e,`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`xiaomi-mimo-tts-session-playback-observer`,order:998,inject:e=>({playback:p,live:m,local:h,settings:r,audioFocus:s,automaticAudioFocus:b,questions:C,automaticReading:x})},SessionPlaybackObserver)),registerSlotContribution(e,`conversation.chat.assistant-actions`,()=>e.slots.register({name:`conversation.chat.assistant-actions`,id:`xiaomi-mimo-tts`,order:20,locale:hi,inject:e=>({playback:p,live:m,local:h,settings:r,t:n,audioFocus:s,automaticAudioFocus:b,automaticReading:x})},ReadAloudAction)),registerSlotContribution(e,`plugins.detail.actions`,()=>e.slots.register({name:`plugins.detail.actions`,id:`xiaomi-mimo-tts.manual`,locale:hi,inject:()=>({t:n,scope:r,onOpenWorkbench:()=>e.layout.selectPanel(ha)})},PluginDetailActions)),registerSlotContribution(e,`plugins.detail.badge`,()=>e.slots.register({name:`plugins.detail.badge`,id:`xiaomi-mimo-tts.key-status`,locale:hi,inject:()=>({t:n,scope:r,changes:a})},PluginDetailBadge));let k={scope:r,t:n,controller:u,history:d,audioFocus:s,speechActivity:g,changes:a,beforePreview:stopAllPlayback,beforeHistoryPlayback:stopAllPlayback,onOpenProviderSettings:t=>e.pluginNavigation.openBundle(t)};registerSlotContribution(e,`plugins.bundle.config`,()=>registerBundleSettings(e,{...k,onSidebarChange:t=>{t&&e.layout.selectPanel(ha)}})),registerSlotContribution(e,`plugins.row.config`,()=>[registerWhalePersonaSettings(e,n,a),registerQqbotSpeechSettings(e,n,a),registerPassportSettings(e,n,a)]),registerSlotContribution(e,`plugins.bundle.activation`,()=>e.slots.register({name:`plugins.bundle.activation`,key:`dsh-xiaomi-tts`,locale:hi,inject:()=>({t:n,changes:a,onOpenWorkbench:()=>openVoiceWorkbench(e,r)})},ActivationGuide)),registerSlotContribution(e,`sidebar.panellist`,()=>registerVoiceSettingsSidebar(e,k)),registerSlotContribution(e,`settings.section`,()=>observeHostSettingsEntry(r,()=>e.slots.register({name:`settings.section`,id:`voice-reading`,order:20,label:()=>n(`settings.voiceReadingNav`),inject:()=>({scope:r,t:n,changes:a,openPluginSettings:()=>e.pluginNavigation.openBundle(`dsh-xiaomi-tts`)})},VoiceReadingSection)))}return n.apply=apply,n.inject=Va,t.exports}});
4209
+ `),Ha=100*1024*1024;var AudioHistory=class{view={entries:[],status:`loading`,skipped:!1};listeners=new Set;replayStops=new Set;chain;disposed=!1;storageLoaded=!1;storage;constructor(e=new IndexedDbAudioHistoryStorage){this.storage=e,this.chain=e.load().then(e=>{this.storageLoaded=!0,this.publish({entries:retainAudioHistory(e),status:`ready`,skipped:!1})}).catch(()=>this.publish({entries:[],status:`memory`,skipped:!1}))}getSnapshot=()=>this.view;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});onStopReplay(e){return this.replayStops.add(e),()=>{this.replayStops.delete(e)}}stopReplay(){for(let e of this.replayStops)e()}add(e){return this.mutate(()=>{if(e.blob.size===0)return;if(e.blob.size>Ha){this.publish({...this.view,skipped:!0});return}let t=globalThis.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,n={...e,text:e.text.slice(0,500),id:t,createdAt:Date.now()};this.publish({...this.view,entries:retainAudioHistory([n,...this.view.entries])})})}remove(e){return this.mutate(()=>this.publish({...this.view,entries:this.view.entries.filter(t=>t.id!==e)}))}clear(){return this.mutate(()=>this.publish({...this.view,entries:[],skipped:!1}))}reportSkipped(){return this.mutate(()=>this.publish({...this.view,skipped:!0}))}async dispose(){this.disposed=!0,this.stopReplay(),this.replayStops.clear(),this.listeners.clear(),await this.chain,this.storage.close()}mutate(e){return this.disposed?Promise.resolve():(this.chain=this.chain.then(async()=>{if(e(),this.storageLoaded)try{await this.storage.replace(this.view.entries),this.view.status===`memory`&&this.publish({...this.view,status:`ready`})}catch{this.publish({...this.view,status:`memory`})}}),this.chain)}publish(e){this.view=e;for(let e of this.listeners)e()}};function retainAudioHistory(e){let t=0,n=[];for(let r of[...e].sort((e,t)=>t.createdAt-e.createdAt))if(!(r.blob.size===0||r.blob.size>Ha)){if(n.length>=100||t+r.blob.size>Ha)break;t+=r.blob.size,n.push(r)}return n}var IndexedDbAudioHistoryStorage=class{database=null;ids=new Set;async load(){return this.database=await new Promise((e,t)=>{let n=!1,r=indexedDB.open(`dsh-xiaomi-tts-audio-history`,1);r.onupgradeneeded=()=>{r.result.createObjectStore(`audio`,{keyPath:`id`})},r.onsuccess=()=>{if(n){r.result.close();return}r.result.onversionchange=()=>r.result.close(),e(r.result)},r.onerror=()=>t(r.error),r.onblocked=()=>{n=!0,t(Error(`audio-history-blocked`))}}),new Promise((e,t)=>{let n=this.database.transaction(`audio`,`readonly`),r=n.objectStore(`audio`).getAll();n.oncomplete=()=>{let t=r.result;this.ids=new Set(t.map(e=>e.id)),e(t)},n.onerror=()=>t(n.error),n.onabort=()=>t(n.error)})}async replace(e){if(this.database===null)throw Error(`audio-history-unavailable`);let t=new Set(e.map(e=>e.id));await new Promise((n,r)=>{let i=this.database.transaction(`audio`,`readwrite`),a=i.objectStore(`audio`);for(let e of this.ids)t.has(e)||a.delete(e);for(let t of e)this.ids.has(t.id)||a.put(t);i.oncomplete=()=>n(),i.onerror=()=>r(i.error),i.onabort=()=>r(i.error)}),this.ids=t}close(){this.database?.close(),this.database=null}},AnnouncementManager=class{running=new Map;constructor(e,t,n){this.collectors=e,this.play=t,this.stop=n}update(e,t){let n=new Set(t?e:[]);for(let[e,t]of this.running)n.has(e)||(this.running.delete(e),t.abort(),this.stop(e));for(let e of this.collectors){if(!n.has(e.id)||this.running.has(e.id))continue;let t=new AbortController;this.running.set(e.id,t),e.start({signal:t.signal,emit:e=>{t.signal.aborted||this.play(e)}}).catch(()=>{this.running.get(e.id)===t&&(this.running.delete(e.id),this.stop(e.id))})}}dispose(){this.update([],!1)}},AnnouncementPlayback=class{stops=new Map;constructor(e,t,n,r=()=>!1){this.service=e,this.activity=t,this.questions=n,this.importantFirst=r}play=e=>{if(e.signal?.aborted)return;if(e.source===`question-titles`){this.questions?.play(e);return}let t=this.service.tryPlay(e.text,this.activity.isBusy,e.important&&this.importantFirst()?this.activity.interrupt:void 0);if(!t)return;this.stops.get(e.source)?.();let cleanup=()=>{e.signal?.removeEventListener(`abort`,cleanup),t(),this.stops.get(e.source)===cleanup&&this.stops.delete(e.source)};this.stops.set(e.source,cleanup),e.signal?.addEventListener(`abort`,cleanup,{once:!0}),e.signal?.aborted&&cleanup()};stop=e=>{e===`question-titles`&&this.questions?.stop(),this.stops.get(e)?.(),this.stops.delete(e)}};let object=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:null,counter=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0;function parsePetState(e){let t=object(e),n=object(t?.pets);if(!t||!n)return null;let r=new Map;for(let[e,t]of Object.entries(n)){let n=object(object(t)?.say);n&&counter(n.counter)&&r.set(e,{counter:n.counter,data:object(n.data)})}let i=object(object(t.sections)?.config)?.counter;return{...counter(t.counter)?{counter:t.counter}:{},configCounter:counter(i)?i:void 0,pets:r}}function visiblePetIds(e){let t=object(e);if(!t||!object(t.main)||!Array.isArray(object(t.main)?.pets))return null;let n=new Set;for(let e of Object.values(t)){let t=object(e)?.pets;if(Array.isArray(t))for(let e of t){let t=object(e);typeof t?.id==`string`&&[`web`,`desktop`,`both`].includes(String(t.display))&&n.add(t.id)}}return n}function delay(e,t){return new Promise(n=>{if(t.aborted){n();return}let done=()=>{clearTimeout(r),t.removeEventListener(`abort`,done),n()},r=setTimeout(done,e);t.addEventListener(`abort`,done,{once:!0})})}var PetHttpError=class extends Error{constructor(e){super(`dsh-pet: HTTP ${e}`),this.status=e}};async function readJson(e,t){let n=await fetch(hostRoute(e),{cache:`no-store`,signal:AbortSignal.any([t,AbortSignal.timeout(15e3)])});if(!n.ok)throw new PetHttpError(n.status);return n.json()}var DshPetCollector=class{id=`dsh-pet`;async start({signal:e,emit:t}){let n=null,r=new Map,i=null,a;for(;!e.aborted;)try{let o=parsePetState(await readJson(`/dsh-pet-7340/state${n?.counter===void 0?``:`?since=${n.counter}&timeout=10000`}`,e));if(!o)throw Error(`dsh-pet: invalid state`);if(e.aborted)return;let s=n===null||o.counter!==void 0&&n.counter!==void 0&&o.counter<n.counter||[...o.pets].some(([e,t])=>t.counter<(r.get(e)??0)),c=[...o.pets].filter(([e,t])=>r.get(e)!==t.counter);s&&r.clear();for(let[e,t]of o.pets)r.set(e,t.counter);if(n=o,(s||i===null||a!==o.configCounter||c.length>0)&&(i=null,i=visiblePetIds(await readJson(`/dsh-pet-7340/config`,e)),a=o.configCounter,i===null))throw Error(`dsh-pet: invalid config`);if(e.aborted)return;if(!s)for(let[e,n]of c.sort((e,t)=>e[1].counter-t[1].counter)){let r=n.data;!i?.has(e)||!r||r.clear===!0||r.duration===0||typeof r.text!=`string`||!r.text.trim()||t({source:this.id,id:JSON.stringify([e,n.counter]),text:r.text})}o.counter===void 0&&await delay(1e3,e)}catch(t){if(e.aborted||t instanceof PetHttpError&&t.status===404)return;n=null,r.clear(),i=null,await delay(5e3,e)}}},QuestionTitleTracker=class{seen=new Set;baseline=!0;current=null;constructor(e){this.emit=e}cancel(){this.current?.controller.abort(),this.current=null}reset(){this.cancel(),this.baseline=!0}update(e){let t=e.find(e=>e.visible);if(this.current?.id!==t?.id&&this.cancel(),this.baseline){for(let t of e)this.seen.add(t.id);this.baseline=!1;return}!t||this.seen.has(t.id)||(this.seen.add(t.id),this.current={id:t.id,controller:new AbortController},this.emit({source:`question-titles`,id:t.id,text:t.text,signal:this.current.controller.signal}))}};function questionTitles(e,t){let n=[];for(let r of Array.from(e.querySelectorAll(`[data-question-key]`))){let i=r.dataset.questionKey,a=r.closest(`[data-session-id]`)?.getAttribute(`data-session-id`);if(!(!i||a&&a!==t))for(let a of Array.from(r.querySelectorAll(`section[aria-labelledby]`))){let r=(a.getAttribute(`aria-labelledby`)??``).split(/\s+/).map(t=>e.getElementById(t)).find(e=>e?.tagName===`H2`&&a.contains(e)),o=r?.textContent?.trim();if(!r||!o)continue;let s=a.querySelector(`header button[aria-expanded="false"]`),c=a.querySelector(`header button[aria-expanded]`)?.disabled,l=!s&&!c&&!a.closest(`[hidden], [inert], [aria-hidden="true"]`)&&a.getClientRects().length>0&&e.defaultView?.getComputedStyle(a).visibility!==`hidden`;n.push({id:JSON.stringify([t,i,r.id]),text:o,visible:l})}}return n}var QuestionTitleCollector=class{id=`question-titles`;session=null;refresh=null;reset=null;constructor(e=window.document){this.document=e}activateSession(e){return this.session=e,this.reset?.(),queueMicrotask(()=>this.refresh?.()),()=>{this.session===e&&(this.session=null,this.reset?.())}}async start({signal:e,emit:t}){if(e.aborted)return;let n=new QuestionTitleTracker(t),scan=()=>{if(e.aborted||this.session===null){n.cancel();return}n.update(questionTitles(this.document,this.session))},reset=()=>n.reset();this.refresh=scan,this.reset=reset;let r=new MutationObserver(scan);r.observe(this.document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`aria-labelledby`,`aria-hidden`,`aria-expanded`,`hidden`,`inert`,`disabled`,`style`,`class`,`data-question-key`,`data-session-id`]}),scan(),await new Promise(t=>{let cleanup=()=>{r.disconnect(),n.cancel(),this.refresh===scan&&(this.refresh=null,this.reset=null),e.removeEventListener(`abort`,cleanup),t()};e.addEventListener(`abort`,cleanup,{once:!0}),e.aborted&&cleanup()})}},QuestionTitlePlayback=class{player=new PreviewPlayer(()=>{});release=null;unregister;constructor(e,t,n){this.activity=e,this.settings=t,this.pcmBusy=n,this.unregister=e.register(()=>isSpeechBusy(this.player.getView().status),()=>this.stop())}play(e){let t=this.settings();if(e.signal?.aborted||!t.enabled||!t.autoPlay||!t.announcementSources.includes(`question-titles`)||this.activity.isBusy()||this.pcmBusy())return;this.stop();let stop=()=>this.stop();e.signal?.addEventListener(`abort`,stop,{once:!0}),this.release=()=>e.signal?.removeEventListener(`abort`,stop),this.player.play(e.text,t)}stop(){this.release?.(),this.release=null,this.player.stop()}setVolume(e){this.player.setVolume(e)}async dispose(){this.stop(),this.unregister(),await this.player.dispose()}};function hostCollector(e,t,n,r){return{id:t,async start(i){if(i.signal.aborted)return;let a=e.inject([`sessions`,n],e=>{e.effect(()=>{if(i.signal.aborted)return()=>{};let t=new AbortController,n=r(e,{...i,signal:AbortSignal.any([i.signal,t.signal])});return()=>{t.abort(),n()}},`xiaomi-mimo-tts: ${t}`)});await new Promise((e,t)=>{let stop=()=>{i.signal.removeEventListener(`abort`,stop);try{Promise.resolve(a.dispose()).then(e,t)}catch(e){t(e)}};i.signal.addEventListener(`abort`,stop,{once:!0}),i.signal.aborted&&stop()})}}}function observeCurrentSession(e,t){let n,r,update=()=>{let i=e.list.getSnapshot(),a=i.phase===`ready`?Object.values(i.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id:void 0;a!==n&&(n=a,r?.(),r=a===void 0?void 0:t(a))},i=e.list.subscribe(update);return update(),()=>{i(),r?.()}}let briefText=e=>typeof e==`string`?e.replace(/\s+/g,` `).trim().slice(0,160):``;function observeApprovals(e,t,n,{signal:r,emit:i}){return observeCurrentSession(e,e=>{let a=new Set,o,cancel=()=>{o?.controller.abort(),o=void 0},scan=(s=!1)=>{let c=t.sessionStatus.getSnapshot().get(e)?.pendingInteraction,l=c?.kind===`approval`?c:void 0;if(o?.key!==l?.key&&cancel(),!l||a.has(l.key)||r.aborted||(a.add(l.key),s))return;let u=briefText(l.reason);o={key:l.key,controller:new AbortController},i({source:`approvals`,id:JSON.stringify([e,l.key]),important:!0,text:u?`${n(`announcements.approval`)} ${u}`:n(`announcements.approval`),signal:AbortSignal.any([r,o.controller.signal])})},s=t.sessionStatus.subscribe(()=>scan());return scan(!0),()=>{s(),cancel()}})}function observeJobs(e,t,n,{signal:r,emit:i}){return observeCurrentSession(e,e=>{let a=new AbortController,o=new Map,scan=()=>{let s=t.state.getSnapshot().rows[e]??[],c=new Map;for(let t of s){if(t.owner!==e||!t.id||(c.set(t.id,t.status),![`running`,`stopping`].includes(o.get(t.id)??``)||![`completed`,`failed`,`killed`].includes(t.status)||r.aborted))continue;o.set(t.id,t.status);let s=t.status===`completed`?n(`announcements.jobCompleted`):t.status===`failed`?n(`announcements.jobFailed`):n(`announcements.jobKilled`);i({source:`job-results`,id:JSON.stringify([e,t.id]),important:t.status===`failed`,text:`${briefText(t.label)||n(`announcements.job`)}: ${s}`,signal:AbortSignal.any([r,a.signal])})}o=c},s=t.state.subscribe(scan),c=t.watchRows(e);return scan(),()=>{a.abort(),s(),c()}})}let Ua=[`slots`,`locale`,`remote`,`configForms`,`pluginNavigation`,`layout`,`pluginChanges`,`sessions`];function formatStartupError(e){return e instanceof Error?e.message:String(e)}function registerSlotContribution(e,t,n){e.effect(()=>{try{e.slots.inject(t,()=>{try{return n()}catch(n){return e.logger.error(`dsh-xiaomi-tts: ${t} contribution disabled: ${formatStartupError(n)}`),()=>{}}})}catch(n){e.logger.error(`dsh-xiaomi-tts: ${t} injection disabled: ${formatStartupError(n)}`)}return()=>{}},`xiaomi-mimo-tts: ${t}`)}function apply(e){console.info(`[dsh-xiaomi-tts] client loaded`);let t=e.locale,n=t.bind(gi);e.effect(()=>t.register(gi,{zh:_i,en:vi,ja:mi,fr:hi}),`xiaomi-mimo-tts: dictionaries`);let r=e.configForms.get(`xiaomi-mimo-tts`),i=new TabAudioFocus,a=e.pluginChanges.bundle(`dsh-xiaomi-tts`);e.effect(()=>{let e=bindApiKeyStatus(r,a);return window.addEventListener(`online`,ni.invalidate),()=>{window.removeEventListener(`online`,ni.invalidate),e()}},`xiaomi-mimo-tts: API key status`);let o=new VoiceInputActivity(document),s=new PluginAudioFocus(new PluginAudioFocus(i,a),o),c=new ComposerInputActivity(document),l=new PluginAudioFocus(s,c),u=createSoundEffectsController(s.canPlay),getSoundSettings=()=>{let e=resolveTtsSettings(r.getSnapshot().value);return{enabled:e.soundEnabled,volume:e.soundVolume,pack:e.soundPack,taskSounds:e.taskSounds,clickSounds:e.clickSounds}};u.update(getSoundSettings()),e.effect(()=>{let t=installClickSounds(e,u,getSoundSettings),n=installTaskSoundWatcher(e,u,getSoundSettings),i=r.subscribe(()=>{u.update(getSoundSettings())});return()=>{t(),n(),i(),u.dispose()}},`xiaomi-mimo-tts: sound effects`);let d=new AudioHistory;e.effect(()=>()=>d.dispose(),`xiaomi-mimo-tts: audio history`);let p=new PlaybackController(d),m=new LiveSpeechController(d),h=new LocalSpeechController,g=new SpeechActivity;g.register(()=>isSpeechBusy(p.getSnapshot().status),()=>{p.resetAutomaticPlayback(),p.interrupt()}),g.register(m.isBusy,()=>m.interrupt()),g.register(h.isBusy,()=>h.interrupt());let _,v=new XiaomiMimoTtsPcmService(e,r,()=>{_?.stop(),m.interrupt(),h.interrupt(),p.interrupt()},d,l.canPlay),b=new PluginAudioFocus(l,v.priorityActivity);_=new QuestionTitlePlayback(g,()=>resolveTtsSettings(r.getSnapshot().value),v.isBusy);let x=new AutomaticReading;e.effect(()=>v.priorityActivity.subscribe(()=>{p.resetAutomaticPlayback(),v.priorityActivity.getSnapshot()&&x.interruptAutomatic(()=>{})}),`xiaomi-mimo-tts: important announcement focus`);let S=e.configForms.get(`ui-chat`),updateAutomaticReading=()=>x.update(S.getSnapshot().value?.foldedReplies,()=>{m.interrupt(),h.interrupt(),p.interrupt()},()=>p.resetAutomaticPlayback());updateAutomaticReading(),e.effect(()=>S.subscribe(updateAutomaticReading),`xiaomi-mimo-tts: host reading preference`);let C=new QuestionTitleCollector,w=new AnnouncementPlayback(v,g,_,()=>resolveTtsSettings(r.getSnapshot().value).importantAnnouncementsFirst),E=new AnnouncementManager([new DshPetCollector,C,hostCollector(e,`approvals`,`uiSession`,(e,t)=>observeApprovals(e.sessions,e.uiSession,n,t)),hostCollector(e,`job-results`,`jobs`,(e,t)=>observeJobs(e.sessions,e.jobs,n,t))],w.play,w.stop);e.effect(()=>{let update=()=>{let e=r.getSnapshot(),t=resolveTtsSettings(e.value),n=t.announcementSources.filter(e=>e!==`question-titles`||t.autoPlay);E.update(n,e.status===`ready`&&t.enabled&&l.canPlay()),t.announcementSources.includes(`dsh-whale-musume`)||v.stopExternal(),(e.status!==`ready`||!t.enabled)&&v.stop()},e=r.subscribe(update),t=l.subscribe(update);return update(),()=>{e(),t(),E.dispose()}},`xiaomi-mimo-tts: announcement collectors`),e.effect(()=>{let e=s.subscribe(()=>{p.resetAutomaticPlayback(),!s.canPlay()&&(m.interrupt(),h.interrupt(),p.interrupt(),v.stop(),_?.stop(),d.stopReplay(),u.dispose())}),t=i.activate();return()=>{t(),e()}},`xiaomi-mimo-tts: tab audio focus`),e.effect(()=>{let update=()=>o.configure(resolveTtsSettings(r.getSnapshot().value).voiceInputCompatibility),e=r.subscribe(update);return update(),()=>{e(),o.dispose()}},`xiaomi-mimo-tts: voice input compatibility`),e.effect(()=>{let e=c.subscribe(()=>{p.resetAutomaticPlayback(),c.getSnapshot()&&(x.interruptAutomatic(()=>{m.interrupt(),h.interrupt(),p.interrupt()}),v.stop(),_?.stop())}),update=()=>c.configure(resolveTtsSettings(r.getSnapshot().value).inputAvoidance),t=r.subscribe(update);return update(),()=>{t(),e(),c.dispose()}},`xiaomi-mimo-tts: composer input avoidance`);let D=null,updateProvider=()=>{let e=resolveTtsSettings(r.getSnapshot().value),t=JSON.stringify({...ttsSelection(e),voiceRate:void 0});D!==null&&D!==t&&(m.interrupt(),p.interrupt(),h.interrupt(),v.stop(),_?.stop()),D=t,m.configure(e),p.configure(e)};updateProvider(),e.effect(()=>r.subscribe(updateProvider),`xiaomi-mimo-tts: provider selection`),e.effect(()=>onTtsCredentialsSaved(()=>{m.interrupt(),p.interrupt(),h.interrupt(),v.stop(),_?.stop()}),`xiaomi-mimo-tts: saved credentials`);let stopOptionalPcm=()=>{v.stop(),_?.stop(),d.stopReplay()};m.setBeforePlayback(stopOptionalPcm),h.setBeforePlayback(stopOptionalPcm),p.setBeforePlayback(stopOptionalPcm),m.setStateChangeListener((e,t,n,r)=>p.updateLivePlayback(e,t,n,`live`,r)),h.setStateChangeListener((e,t,n,r)=>p.updateLivePlayback(e,t,n,`system`,r));let stopAllPlayback=()=>{p.resetAutomaticPlayback(),m.interrupt(),h.interrupt(),p.interrupt(),v.stop(),_?.stop(),d.stopReplay()};e.effect(()=>{let e=ri.subscribe(stopAllPlayback),t=ri.start();return()=>{e(),t()}},`xiaomi-mimo-tts: speech engine state`),e.effect(()=>observePluginActivity(a,stopAllPlayback),`xiaomi-mimo-tts: plugin changes`);let updateVoiceVolume=()=>{let e=resolveTtsSettings(r.getSnapshot().value).voiceVolume;m.setVolume(e),h.setVolume(e),p.setVolume(e),v.setVolume(e),_?.setVolume(e)};updateVoiceVolume(),e.effect(()=>r.subscribe(updateVoiceVolume),`xiaomi-mimo-tts: voice volume`);let updateVoiceRate=()=>{let e=resolveTtsSettings(r.getSnapshot().value).voiceRate;m.setVoiceRate(e),h.setVoiceRate(e),p.setVoiceRate(e)};updateVoiceRate(),e.effect(()=>r.subscribe(updateVoiceRate),`xiaomi-mimo-tts: voice rate`),e.effect(()=>async()=>{m.setBeforePlayback(null),h.setBeforePlayback(null),p.setBeforePlayback(null),await v.dispose(),await _?.dispose()},`xiaomi-mimo-tts: optional PCM service`),e.effect(()=>()=>p.dispose(),`xiaomi-mimo-tts: playback`),e.effect(()=>()=>m.dispose(),`xiaomi-mimo-tts: live playback`),e.effect(()=>()=>h.dispose(),`xiaomi-mimo-tts: local playback`),e.effect(()=>{let e=document.createElement(`style`);return e.dataset.plugin=gi,e.textContent=Va,document.head.appendChild(e),()=>e.remove()},`xiaomi-mimo-tts: styles`),registerSlotContribution(e,`settings.section.icon`,()=>observeHostSettingsEntry(r,()=>registerVoiceReadingNavIcon(e))),registerSlotContribution(e,`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`xiaomi-mimo-tts-session-playback-observer`,order:998,inject:e=>({playback:p,live:m,local:h,settings:r,audioFocus:s,automaticAudioFocus:b,questions:C,automaticReading:x})},SessionPlaybackObserver)),registerSlotContribution(e,`conversation.chat.assistant-actions`,()=>e.slots.register({name:`conversation.chat.assistant-actions`,id:`xiaomi-mimo-tts`,order:20,locale:gi,inject:e=>({playback:p,live:m,local:h,settings:r,t:n,audioFocus:s,automaticAudioFocus:b,automaticReading:x})},ReadAloudAction)),registerSlotContribution(e,`plugins.detail.actions`,()=>e.slots.register({name:`plugins.detail.actions`,id:`xiaomi-mimo-tts.manual`,locale:gi,inject:()=>({t:n,scope:r,onOpenWorkbench:()=>e.layout.selectPanel(_a)})},PluginDetailActions)),registerSlotContribution(e,`plugins.detail.badge`,()=>e.slots.register({name:`plugins.detail.badge`,id:`xiaomi-mimo-tts.key-status`,locale:gi,inject:()=>({t:n,scope:r,changes:a})},PluginDetailBadge));let k={scope:r,t:n,controller:u,history:d,audioFocus:s,speechActivity:g,changes:a,beforePreview:stopAllPlayback,beforeHistoryPlayback:stopAllPlayback,onOpenProviderSettings:t=>e.pluginNavigation.openBundle(t)};registerSlotContribution(e,`plugins.bundle.config`,()=>registerBundleSettings(e,{...k,onSidebarChange:t=>{t&&e.layout.selectPanel(_a)}})),registerSlotContribution(e,`plugins.row.config`,()=>[registerWhalePersonaSettings(e,n,a),registerQqbotSpeechSettings(e,n,a),registerPassportSettings(e,n,a)]),registerSlotContribution(e,`plugins.bundle.activation`,()=>e.slots.register({name:`plugins.bundle.activation`,key:`dsh-xiaomi-tts`,locale:gi,inject:()=>({t:n,scope:r,changes:a,onOpenWorkbench:()=>openVoiceWorkbench(e,r)})},ActivationGuide)),registerSlotContribution(e,`sidebar.panellist`,()=>registerVoiceSettingsSidebar(e,k)),registerSlotContribution(e,`settings.section`,()=>observeHostSettingsEntry(r,()=>e.slots.register({name:`settings.section`,id:`voice-reading`,order:20,label:()=>n(`settings.voiceReadingNav`),inject:()=>({scope:r,t:n,changes:a,openPluginSettings:()=>e.pluginNavigation.openBundle(`dsh-xiaomi-tts`)})},VoiceReadingSection)))}return n.apply=apply,n.inject=Ua,t.exports}});
4081
4210
  //# sourceMappingURL=client.js.map