import { e as escape_html } from './async-Mo2Ia14K.js';
import { c as bind_props, f as attr_class, a as attr, d as attr_style, g as stringify } from './index-D1Ptw7Az.js';
import { e as y, l as w, j as w$1, m as y$2 } from './2-B89dC7Mi.js';
import { k } from './BlockLabel-qrJKniS-.js';
import { u } from './DownloadLink-CHK0Lliu.js';
import { p } from './Empty-DPmCPCDI.js';
import { y as y$1 } from './ShareButton-BgNheG3R.js';
import { l } from './Download-CXUtRxuu.js';
import { t } from './Music-Cx9Jdb4f.js';
import { m as ml } from './MinimalAudioPlayer-DgOOOAbH.js';
import { p as p$1, u as u$1, c } from './VolumeLevels-BjhSlQIz.js';
import { n } from './Play-D2fLH3is.js';
import { r } from './Undo-TMAmuanl.js';
import './index5-BoOEKc6P.js';
import './dev-fallback-Bc5Ork7Y.js';
import 'path';
import 'url';
import 'fs';
import './spring-DE8vsW2o.js';

function kt(r){r.push('<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" fill="currentColor" stroke-width="1.5" viewBox="0 0 24 24" color="currentColor"><path stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M21.044 5.704a.6.6 0 0 1 .956.483v11.626a.6.6 0 0 1-.956.483l-7.889-5.813a.6.6 0 0 1 0-.966l7.89-5.813ZM10.044 5.704a.6.6 0 0 1 .956.483v11.626a.6.6 0 0 1-.956.483l-7.888-5.813a.6.6 0 0 1 0-.966l7.888-5.813Z"></path></svg>');}function xt(r){r.push('<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-closed-caption"><rect x="2" y="6" width="20" height="12" rx="2" ry="2"></rect><text x="12" y="15" font-family="sans-serif" font-size="8" font-weight="bold" fill="currentColor" stroke="none" text-anchor="middle">CC</text></svg>');}function Lt(r){r.push('<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" fill="currentColor" stroke-width="1.5" viewBox="0 0 24 24" color="currentColor"><path stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M2.956 5.704A.6.6 0 0 0 2 6.187v11.626a.6.6 0 0 0 .956.483l7.889-5.813a.6.6 0 0 0 0-.966l-7.89-5.813ZM13.956 5.704a.6.6 0 0 0-.956.483v11.626a.6.6 0 0 0 .956.483l7.889-5.813a.6.6 0 0 0 0-.966l-7.89-5.813Z"></path></svg>');}const q=(r,t)=>(t||(t=5),r/100*t||5);function St(r,t){r.component(e=>{let{currentVolume:i=void 0,show_volume_slider:s$1=void 0,waveform:n}=t;e.push(`<input id="volume" class="volume-slider svelte-c0ird4" type="range" min="0" max="1" step="0.01"${attr("value",i)}/>`),bind_props(t,{currentVolume:i,show_volume_slider:s$1});});}function Mt(r$1,t){r$1.component(e=>{let {waveform:i,audio_duration:s$1,i18n:n$1,playing:o,show_redo:h=false,interactive:a=false,handle_trim_audio:d,mode:u=void 0,container:f,handle_reset_value:y,waveform_options:m={},trim_region_settings:M={},show_volume_slider:C=void 0,editable:k=true,subtitles_toggle:D=void 0,show_subtitles:O=false,trimDuration:P=void 0}=t,g=[.5,1,1.5,2],L=g[1],c$1=1;let z=true,b;function w(l){l.push(`<div class="controls svelte-72dh9g" data-testid="waveform-controls"><div class="control-wrapper svelte-72dh9g"><button class="action icon volume svelte-72dh9g" aria-label="Adjust volume"${attr_style("",{color:C?"var(--color-accent)":"var(--neutral-400)"})}>`),p$1(l,{currentVolume:c$1}),l.push("<!----></button> "),C?(l.push("<!--[-->"),St(l,{waveform:i,get currentVolume(){return c$1},set currentVolume(T){c$1=T,z=false;},get show_volume_slider(){return C},set show_volume_slider(T){C=T,z=false;}})):l.push("<!--[!-->"),l.push(`<!--]--> <button${attr_class("playback icon svelte-72dh9g",void 0,{hidden:C})}${attr("aria-label",`Adjust playback speed to ${g[(g.indexOf(L)+1)%g.length]}x`)}><span>${escape_html(L)}x</span></button></div> <div class="play-pause-wrapper svelte-72dh9g"><button class="rewind icon svelte-72dh9g"${attr("aria-label",`Skip backwards by ${q(s$1,m.skip_length)} seconds`)}>`),kt(l),l.push(`<!----></button> <button class="play-pause-button icon svelte-72dh9g"${attr("aria-label",n$1(o?"audio.pause":"audio.play"))}>`),o?(l.push("<!--[-->"),u$1(l)):(l.push("<!--[!-->"),n(l)),l.push(`<!--]--></button> <button class="skip icon svelte-72dh9g"${attr("aria-label",`Skip forward by ${stringify(q(s$1,m.skip_length))} seconds`)}>`),Lt(l),l.push('<!----></button></div> <div class="settings-wrapper svelte-72dh9g">'),O?(l.push("<!--[-->"),l.push(`<button class="action icon cc-button svelte-72dh9g" data-testid="subtitles-toggle"${attr_style(`color: ${stringify(D?"var(--color-accent)":"var(--neutral-400)")}`)}>`),xt(l),l.push("<!----></button>")):l.push("<!--[!-->"),l.push("<!--]--> "),k&&a?(l.push("<!--[-->"),h&&!u?(l.push("<!--[-->"),l.push('<button class="action icon svelte-72dh9g" aria-label="Reset audio">'),r(l),l.push("<!----></button>")):l.push("<!--[!-->"),l.push("<!--]--> "),u?(l.push("<!--[!-->"),l.push('<button class="text-button svelte-72dh9g">Trim</button> <button class="text-button svelte-72dh9g">Cancel</button>')):(l.push("<!--[-->"),l.push('<button class="action icon svelte-72dh9g" aria-label="Trim audio to selection">'),c(l),l.push("<!----></button>")),l.push("<!--]-->")):l.push("<!--[!-->"),l.push("<!--]--></div></div>");}do z=true,b=e.copy(),w(b);while(!z);e.subsume(b),bind_props(t,{mode:u,show_volume_slider:C,subtitles_toggle:D,trimDuration:P});});}function Ot(r,t$1){r.component(e=>{let{value:i=null,subtitles:s$1=null,label:n,i18n:o,dispatch_blob:h=()=>Promise.resolve(),interactive:a=false,editable:d=true,trim_region_settings:u={},waveform_settings:f,waveform_options:y,mode:m=void 0,loop:M,handle_reset_value:C=()=>{},playback_position:k=void 0,onstop:D,onplay:O,onpause:P,onedit:g,onload:L}=t$1;i?.url;let x,c,E=false,b=0,w=0,l=false,T=true,X=y.show_recording_waveform&&!i?.is_stream;const tt=async(v,p)=>{m="";g?.();};let A=true,H;function nt(v){v.push(`<audio${attr_class("standard-player svelte-1ffmt2w",void 0,{hidden:X})} controls${attr("autoplay",f.autoplay,true)} preload="metadata"></audio> `),i===null?(v.push("<!--[-->"),p(v,{size:"small",children:p=>{t(p);},$$slots:{default:true}})):(v.push("<!--[!-->"),X?(v.push("<!--[-->"),v.push(`<div class="component-wrapper svelte-1ffmt2w"${attr("data-testid",n?"waveform-"+n:"unlabelled-audio")}><div class="waveform-container svelte-1ffmt2w"><div id="waveform" class="svelte-1ffmt2w"${attr_style("",{height:"58px"})}></div></div> <div class="timestamps svelte-1ffmt2w"><time id="time" class="svelte-1ffmt2w">0:00</time> <div>`),m==="edit"&&w>0?(v.push("<!--[-->"),v.push(`<time id="trim-duration" class="svelte-1ffmt2w">${escape_html(y$2(w))}</time>`)):v.push("<!--[!-->"),v.push('<!--]--> <time id="duration" class="svelte-1ffmt2w">0:00</time></div></div> <div class="subtitle-display svelte-1ffmt2w" data-testid="subtitle-display"></div> '),Mt(v,{container:x,waveform:c,playing:E,audio_duration:b,i18n:o,interactive:a,handle_trim_audio:tt,show_redo:a,handle_reset_value:C,waveform_options:y,trim_region_settings:u,editable:d,show_subtitles:s$1!==null,get mode(){return m},set mode(p){m=p,A=false;},get trimDuration(){return w},set trimDuration(p){w=p,A=false;},get show_volume_slider(){return l},set show_volume_slider(p){l=p,A=false;},get subtitles_toggle(){return T},set subtitles_toggle(p){T=p,A=false;}}),v.push("<!----></div>")):v.push("<!--[!-->"),v.push("<!--]-->")),v.push("<!--]-->");}do A=true,H=e.copy(),nt(H);while(!A);e.subsume(H),bind_props(t$1,{mode:m,playback_position:k});});}function Pt(r,t$1){r.component(e=>{let{value:i=null,subtitles:s$1=null,label:n,show_label:o=true,buttons:h=[],on_custom_button_click:a=null,i18n:d,waveform_settings:u$1={},waveform_options:f={show_recording_waveform:true},editable:y$2=true,loop:m,display_icon_button_wrapper_top_corner:M=false,minimal:C=false,playback_position:k$1=void 0,onchange:D,onplay:O,onpause:P,onstop:g,onshare:L,onerror:x}=t$1,c=true,E;function z(b){k(b,{show_label:o,Icon:t,float:false,label:n||d("audio.audio")}),b.push("<!----> "),i!==null?(b.push("<!--[-->"),C?(b.push("<!--[-->"),ml(b,{value:i,label:n||d("audio.audio"),loop:m})):(b.push("<!--[!-->"),y(b,{display_top_corner:M,buttons:h,on_custom_button_click:a,children:w$2=>{h.some(l=>typeof l=="string"&&l==="download")?(w$2.push("<!--[-->"),u(w$2,{href:i.is_stream?i.url?.replace("playlist.m3u8","playlist-file"):i.url,download:i.orig_name||i.path,children:l$1=>{w(l$1,{Icon:l,label:d("common.download")});},$$slots:{default:true}})):w$2.push("<!--[!-->"),w$2.push("<!--]--> "),h.some(l=>typeof l=="string"&&l==="share")?(w$2.push("<!--[-->"),y$1(w$2,{i18n:d,onerror:x,onshare:L,formatter:async l=>!l||!l.url?"":`<audio controls src="${await w$1(l.url)}"></audio>`,value:i})):w$2.push("<!--[!-->"),w$2.push("<!--]-->");}}),b.push("<!----> "),Ot(b,{value:i,subtitles:Array.isArray(s$1)?s$1:s$1?.url,label:n,i18n:d,waveform_settings:u$1,waveform_options:f,editable:y$2,loop:m,onpause:P,onplay:O,onstop:g,onload:()=>{},get playback_position(){return k$1},set playback_position(w){k$1=w,c=false;}}),b.push("<!---->")),b.push("<!--]-->")):(b.push("<!--[!-->"),p(b,{size:"small",children:w=>{t(w);},$$slots:{default:true}})),b.push("<!--]-->");}do c=true,E=e.copy(),z(E);while(!c);e.subsume(E),bind_props(t$1,{playback_position:k$1});});}const Qt=Object.freeze(Object.defineProperty({__proto__:null,default:Pt},Symbol.toStringTag,{value:"Module"}));

export { Ot as A, Pt as S, Qt as a };
//# sourceMappingURL=StaticAudio-C0Rh10dO.js.map
