1import{P as b,Q as E,T as k}from"./workspace-D4nuKkeG.js";const A=5e3,w=new Set(["standard","wavenet","neural2","studio","polyglot","chirp-hd","chirp3-hd","gemini-tts"]),R=/-(Standard|Wavenet|Neural2|Studio|Polyglot|Chirp3-HD|Chirp-HD)-/i,u={ssml:"none",pauseMarkup:!1,stylePrompt:!1,maxBytes:A,streaming:!1},f={...u,ssml:"full"},T={standard:f,wavenet:f,neural2:f,polyglot:f,studio:{...u,ssml:"partial"},"chirp-hd":{...u,streaming:!0},"chirp3-hd":{...u,pauseMarkup:!0,streaming:!0},"gemini-tts":{...u,stylePrompt:!0},unknown:u},m={standard:0,wavenet:1};function V(e){const n=e.trim().toLowerCase().replace(/_/g,"-");return w.has(n)?n:"unknown"}function y(e){const n=e.match(R);return n?V(n[1]):/gemini/i.test(e)?"gemini-tts":"unknown"}function S(e){if(typeof e=="string")return y(e);if(e.tier){const n=V(e.tier);if(n!=="unknown")return n}return y(e.name??"")}function B(e){if(e===!0)return"full";if(e===!1)return"none";if(e==="none"||e==="partial"||e==="full")return e}function P(e){const n=T[S(e)];if(typeof e=="string"||!e.capabilities)return n;const t=e.capabilities,r=typeof t.max_bytes=="number"&&Number.isFinite(t.max_bytes)&&t.max_bytes>0?Math.floor(t.max_bytes):n.maxBytes;return{ssml:B(t.ssml)??n.ssml,pauseMarkup:typeof t.pause_markup=="boolean"?t.pause_markup:n.pauseMarkup,stylePrompt:typeof t.style_prompt=="boolean"?t.style_prompt:n.stylePrompt,maxBytes:r,streaming:typeof t.streaming=="boolean"?t.streaming:n.streaming}}function j(e){return P(e).ssml!=="none"}function I(e,n){var s;const t=e.filter(a=>L(a,n));if(t.length===0)return[];const r=(s=p[n])==null?void 0:s.split("-")[1],i=Object.keys(m).length,o=a=>{const c=m[S(a)]??i,g=r?(a.language_codes??[]).some(_=>_.split("-")[1]===r):!1;return c*2+(g?0:1)};return[...t].sort((a,c)=>o(a)-o(c))}const p={uk:"uk-UA",en:"en-US",de:"de-DE",pl:"pl-PL",fr:"fr-FR",es:"es-ES",it:"it-IT",ru:"ru-RU",ja:"ja-JP",ko:"ko-KR",pt:"pt-BR",zh:"cmn-CN",nl:"nl-NL",cs:"cs-CZ",sv:"sv-SE",da:"da-DK",fi:"fi-FI",no:"nb-NO",tr:"tr-TR",ar:"ar-XA",hi:"hi-IN",th:"th-TH",vi:"vi-VN",id:"id-ID"};function N(e){const n=e.toLowerCase();return n.includes("chirp")?!1:n.includes("-standard-")||n.includes("-wavenet-")}function C(e){return e.split("-")[0]}const D={nb:"no",nn:"no",cmn:"zh",iw:"he",in:"id"};function l(e){const n=C(e).toLowerCase();return D[n]??n}function d(e){return[...new Set((e.language_codes??[]).map(l))]}function L(e,n){const t=l(n);return(e.language_codes??[]).some(r=>l(r)===t)}function x(e,n){return I(e,n)[0]??null}function F(e,n){const t=l(n),r=e.language_codes??[];return r.find(i=>l(i)===t)??r[0]??null}function M(e,n,t){const r=t[e];if(r){const i=n.find(o=>o.name===r);if(i&&L(i,e))return i}return x(n,e)}function H(e,n,t){const r=h(e),i=M(r,n,t);return i?{voice:i,language:F(i,r)??O(e)}:null}function K(e){var t;const n=(t=e==null?void 0:e.lang)==null?void 0:t.trim();return n!=null&&n.includes("-")?n:p[h(e)]}function h(e){var t;const n=(t=e==null?void 0:e.lang)==null?void 0:t.trim();return n?l(n):"en"}function O(e){if(e!=null&&e.lang){const n=p[e.lang];if(n)return n;if(e.lang.includes("-"))return e.lang}return"en-US"}const z=b()(E((e,n)=>({myVoices:[],defaultVoiceByLang:{},speakingRate:1,warningDismissed:!1,aiAnnotationEnabled:!0,stylePreset:"natural",addVoice:t=>{n().myVoices.some(i=>i.name===t.name)||e(i=>{const o={...i.defaultVoiceByLang};for(const s of d(t))o[s]||(o[s]=t.name);return{myVoices:[...i.myVoices,t],defaultVoiceByLang:o}})},removeVoice:t=>{e(r=>{const i=r.myVoices.filter(s=>s.name!==t),o={};for(const[s,a]of Object.entries(r.defaultVoiceByLang)){if(a!==t){o[s]=a;continue}const c=i.find(g=>d(g).includes(s));c&&(o[s]=c.name)}return{myVoices:i,defaultVoiceByLang:o}})},setDefaultVoiceForLang:(t,r)=>e(i=>({defaultVoiceByLang:{...i.defaultVoiceByLang,[l(t)]:r}})),setSpeakingRate:t=>e({speakingRate:Math.max(.5,Math.min(2,t))}),dismissWarning:()=>e({warningDismissed:!0}),setAiAnnotationEnabled:t=>e({aiAnnotationEnabled:t}),setStylePreset:t=>e({stylePreset:t}),reset:()=>e({myVoices:[],defaultVoiceByLang:{},speakingRate:1,warningDismissed:!1,aiAnnotationEnabled:!0,stylePreset:"natural"})}),{name:"tts-preferences-storage",storage:k(()=>localStorage),version:1,migrate:(e,n)=>{if(n>=1)return e;const t=e??{},{defaultVoice:r,...i}=t,o=(Array.isArray(t.myVoices)?t.myVoices:[]).filter(a=>(a==null?void 0:a.name)&&N(a.name)),s={};if(r){const a=o.find(c=>(c==null?void 0:c.name)===r);if(a)for(const c of d(a))s[c]=a.name}return{...i,myVoices:o,defaultVoiceByLang:s}},partialize:e=>({myVoices:e.myVoices,defaultVoiceByLang:e.defaultVoiceByLang,speakingRate:e.speakingRate,warningDismissed:e.warningDismissed,aiAnnotationEnabled:e.aiAnnotationEnabled,stylePreset:e.stylePreset})})),W=Object.freeze(Object.defineProperty({__proto__:null,useTTSStore:z},Symbol.toStringTag,{value:"Module"}));
1export{O as a,d as b,K as c,L as d,h as g,l as n,x as p,H as r,j as s,W as t,z as u,F as v};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.