1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[338],{47605:(e,t,r)=>{r.d(t,{AH:()=>c,c2:()=>s,oS:()=>l,oY:()=>i,rQ:()=>o});var a=r(91040),n=r(40317);async function l(e){return(0,n.A)({method:"POST",url:"/api/stem/mss/app/vocal-lyrics/upload-url",data:e})}async function o(e,t,r,n){await a.A.put(e,t,{headers:{"Content-Type":r},onUploadProgress:e=>{e.total&&n&&n(Math.round(100*e.loaded/e.total))}})}async function i(e){return(0,n.A)({method:"POST",url:"/api/stem/mss/app/vocal-lyrics/generate",data:e})}async function s(e){return(0,n.A)({method:"POST",url:"/api/stem/mss/app/vocal-lyrics/status",data:e})}async function c(e){return(await a.A.get(e,{responseType:"json"})).data}},55781:(e,t,r)=>{r.d(t,{Y:()=>a});function a(e){let t=[],r=[],a=0;return e.forEach((e,n)=>{(/\n/.test(e.text||"")?(e.text||"").split(/(\n+)/):[e.text||""]).forEach((l,o)=>{if(/^\n+$/.test(l)){r.length>0&&(t.push(r),r=[],a=0);return}if(!l)return;let i=0===o?e:{...e,text:l};if(!(0===r.length&&"word"!==i.type&&/^\s+$/.test(i.text||""))){var s;r.push({word:i,index:n}),a+=(i.text||"").replace(/\s+/g," ").length,s=a,(/\n/.test(i.text||"")||"word"===i.type&&(/[.!?\u3002\uff01\uff1f\u0964]$/.test((i.text||"").trim())||s>=48))&&(t.push(r),r=[],a=0)}})}),r.length>0&&t.push(r),t}},80338:(e,t,r)=>{r.r(t),r.d(t,{default:()=>tt});var a=r(37876),n=r(14232),l=r(89099),o=r(28556),i=r(72618),s=r(88756),c=r(74118),d=r(78460);function u(e){return .001>=Math.abs(e.playbackRate-1)?"ignored":(e.playbackRate=1,"reset-rate")}function m(e,t,r){let{isPlaying:a,lastHardSyncAtRef:n,forceHardSeek:l=!1,hardSeekThresholdSeconds:o=.35,hardSeekCooldownMs:i=1500}=r;if(!Number.isFinite(t))return u(e);let s=Math.abs(t-e.currentTime),c=Date.now(),d=c-n.current>=i;return l||!a&&(e.ended||s>o)&&d?(u(e),e.currentTime=Math.max(0,t),n.current=c,"hard-seeked"):u(e)}function p(e,t){let{toleranceSeconds:r=.05,timeoutMs:a=1200}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!Number.isFinite(t))return Promise.resolve(!1);let n=Math.max(0,t);return(u(e),Math.abs(e.currentTime-n)<=r)?Promise.resolve(!0):new Promise(t=>{let l=!1,o=["seeked","canplay","loadeddata","timeupdate"],i=r=>{l||(l=!0,window.clearTimeout(d),o.forEach(t=>e.removeEventListener(t,s)),e.removeEventListener("error",c),t(r))},s=()=>{Math.abs(e.currentTime-n)<=r&&i(!0)},c=()=>i(!1),d=window.setTimeout(()=>{i(Math.abs(e.currentTime-n)<=Math.max(r,.15))},a);o.forEach(t=>e.addEventListener(t,s)),e.addEventListener("error",c,{once:!0});try{e.currentTime=n}catch(e){i(!1);return}s()})}async function h(e){let{items:t,getTargetTime:r,shouldResume:a,onPlaybackError:n,toleranceSeconds:l=.03,timeoutMs:o=700}=e,i=t.filter(e=>e.media),s=r(),c=Number.isFinite(s)?Math.max(0,s):0;return i.forEach(e=>{let{media:t}=e;u(t),t.paused||t.pause()}),await Promise.all(i.map(e=>{let{media:t}=e;return p(t,c,{toleranceSeconds:l,timeoutMs:o})})),i.forEach(e=>{let{applyVolume:t}=e;null==t||t()}),("function"==typeof a?a():a)&&await Promise.all(i.map(async e=>{let{id:t,media:r,critical:a=!1}=e;try{await r.play()}catch(e){null==n||n(t,e,a)}})),c}var x=r(42298),f=r(41993);let g={vocal:["#FF4B72","#FF758C"],bass:["#00E5FF","#00B0FF"],drums:["#FF9F0A","#FFD60A"],guitar:["#30D158","#34C759"],piano:["#0A84FF","#64D2FF"],instrumental:["#34C759","#A6E22E"],other:["#BF5AF2","#E598FF"],others:["#BF5AF2","#E598FF"],ai_cover:["#9E00FF","#FF007A"]},b={vocal:["#F43F5E","#E11D48"],bass:["#06B6D4","#0284C7"],drums:["#F59E0B","#EAB308"],guitar:["#22C55E","#16A34A"],piano:["#0A84FF","#0284C7"],instrumental:["#22C55E","#65A30D"],other:["#C026D3","#A21CAF"],others:["#C026D3","#A21CAF"],ai_cover:["#9333EA","#E11D48"]},v=["#0A84FF","#64D2FF"],y="var(--tool-track-volume-remainder, ".concat("#3f3f46",")"),w="var(--track-volume-start)",k="var(--track-volume-end)",j="var(--tool-track-volume-muted, #94a3b8)",N={vocal:"/mss/vocal.svg",bass:"/mss/bass.svg",drums:"/mss/drums.svg",guitar:"/mss/guitar.svg",piano:"/mss/piano.svg",other:"/mss/others.svg",others:"/mss/others.svg"},E=(e,t)=>{let r=parseInt(e.replace("#",""),16);return"rgba(".concat(r>>16&255,", ").concat(r>>8&255,", ").concat(255&r,", ").concat(t,")")};function M(e){let{trackId:t,trackName:r,trackLabel:l,downloadUrl:o,cacheStatus:s="idle",cacheError:c="",downloadProgress:p=0,isActive:h,playbackReady:M,color:C,isPlaying:P,currentTime:T,syncRevision:L=0,duration:z,masterVolume:S=1,isLooping:A=!1,loopStart:F=0,isMuted:R=!1,isSoloed:D=!1,useWebAudioPlayback:B=!1,showWaveform:V=!0,showTrackControls:_=!0,loadWaveformOnMobile:O=!1,onLoadedMetadata:U,onTrackReady:I,onAudioElementReady:H,onTrackVolumeChange:W,getMasterTime:q,onPlaybackBlocked:K,onPlaybackFailed:$,onSeek:Y,onMute:Z,onSolo:G,labels:X={setVolumeToZero:"Set volume to 0%",setVolumeToFull:"Set volume to 100%",download:"Download",loading:"Loading...",preparing:"Preparing...",seek:"Click on waveform to seek",error:"Error"}}=e,J=(0,n.useRef)(null),Q=(0,n.useRef)(null),ee=(0,n.useRef)(null),[et,er]=(0,n.use
1State)(1),[ea,en]=(0,n.useState)(!0),[el,eo]=(0,n.useState)(""),[ei,es]=(0,n.useState)(""),[ec,ed]=(0,n.useState)(!1),[eu,em]=(0,n.useState)(!1),[ep,eh]=(0,n.useState)(!1),[,ex]=(0,n.useState)(0),[ef,eg]=(0,n.useState)(()=>O||window.matchMedia("(min-width: 768px)").matches),eb=(0,n.useRef)(!1),ev=(0,n.useRef)(""),ey=(0,n.useRef)(0),ew=(0,n.useRef)(!1),ek=(0,n.useRef)(Y),ej=(0,n.useRef)(T),eN=(0,n.useRef)(L),[eE,eM]=((e,t)=>{let r="".concat(e||""," ").concat(t||"").toLowerCase();return r.includes("ai")&&r.includes("cover")?g.ai_cover:r.includes("vocal")?g.vocal:r.includes("bass")?g.bass:r.includes("drum")?g.drums:r.includes("guitar")?g.guitar:r.includes("piano")?g.piano:r.includes("instrumental")?g.instrumental:r.includes("other")?g.other:g[e]||v})(t,r),[eC,eP]=((e,t)=>{let r="".concat(e||""," ").concat(t||"").toLowerCase();return r.includes("ai")&&r.includes("cover")?b.ai_cover:r.includes("vocal")?b.vocal:r.includes("bass")?b.bass:r.includes("drum")?b.drums:r.includes("guitar")?b.guitar:r.includes("piano")?b.piano:r.includes("instrumental")?b.instrumental:r.includes("other")?b.other:b[e]||v})(t,r),eT=E(eM,.58),eL=E(eM,.14),ez=E(eM,.24),eS=E(eP,.24),eA=((e,t)=>{let r="".concat(e||""," ").concat(t||"").toLowerCase();return r.includes("vocal")?N.vocal:r.includes("bass")?N.bass:r.includes("drum")?N.drums:r.includes("guitar")?N.guitar:r.includes("piano")?N.piano:r.includes("other")?N.other:N[e]||N.others})(t,r),eF=et<=0,eR=V&&ef,eD=O&&!_,eB={"--track-volume-dark-start":eE,"--track-volume-dark-end":eM,"--track-volume-dark-ring":ez,"--track-volume-light-start":eC,"--track-volume-light-end":eP,"--track-volume-light-ring":eS};(0,n.useEffect)(()=>{ek.current=Y},[Y]),(0,n.useEffect)(()=>{ej.current=T},[T]);let eV=(0,n.useCallback)(()=>{let e=null==q?void 0:q();return Number.isFinite(e)&&void 0!==e&&e>=0?e:Math.max(0,ej.current)},[q]);(0,n.useEffect)(()=>{let e=window.matchMedia("(min-width: 768px)"),t=()=>{eg(O||e.matches)};return(t(),e.addEventListener)?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))},[O]),(0,n.useEffect)(()=>{if(h){if(!o&&B&&"ready"===s){eo(""),en(!M),ed(!!M),em(!!M),eh(!1),ex(100);return}if(!o){eo(""),en(!0),ed(!1),em(!1),eh(!1),ex(0);return}ev.current!==o&&(ev.current=o,es(""),en(!0),ed(!1),em(!1),eh(!1),ex(0),eb.current=!1,eo(o))}},[s,o,h,M,r,B]),(0,n.useEffect)(()=>{if(!el||!ea||!eR)return;let e=window.setInterval(()=>{ex(e=>Math.min(e+2,95))},50);return()=>window.clearInterval(e)},[el,ea,eR]);let e_=(0,n.useCallback)(e=>{if(!(e instanceof DOMException)||"AbortError"!==e.name){if(console.error("".concat(r," - Play failed:"),e),e instanceof DOMException&&"NotAllowedError"===e.name){null==K||K();return}null==$||$(t,e)}},[K,$,t,r]),eO=(0,n.useCallback)(e=>{J.current=e,null==H||H(t,e)},[H,t]),eU=(0,n.useCallback)(()=>{var e;let t=Q.current,r=(null==t||null==(e=t.parentElement)?void 0:e.clientHeight)||(null==t?void 0:t.clientHeight)||0;return r>0?r:eD?144:100},[eD]);(0,n.useEffect)(()=>{if(!el||!eu||B&&!M)return;let e=!1;return(async()=>{let r=J.current;r&&(u(r),r.muted=B,r.volume=B||R?0:et*S,ey.current=Date.now()),I&&!eb.current&&(eb.current=!0,await I(t,eV())),e||ed(!0)})(),()=>{e=!0}},[el,eV,eu,R,S,I,M,t,B,et]),(0,n.useEffect)(()=>{B&&M&&h&&!eb.current&&(eb.current=!0,null==I||I(t,eV()))},[eV,h,I,M,t,B]),(0,n.useEffect)(()=>{el&&eu&&(!eR||ep)&&(ex(100),en(!1))},[el,eu,ep,eR]),(0,n.useEffect)(()=>{if(!el)return;let e=J.current;if(!e)return;let t=()=>{em(!0)},a=()=>{U&&e.duration&&U(e.duration),e.muted=B,B&&(e.volume=0),t()},n=()=>{ew.current=!1},l=()=>{if(u(e),!A)return;e.currentTime=F,ey.current=Date.now();let t=e.play();void 0!==t&&t.catch(e_)},o=e=>{console.error("".concat(r," - Audio element error:"),e);let t=e.target;t.error&&(es({1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"}[t.error.code]||"Unknown error"),en(!1))};return e.addEventListener("loadedmetadata",a),e.addEventListener("loadeddata",t),e.addEventListener("canplay",t),e.addEventListener("canplaythrough",t),e.addEventListener("seeked",n),e.addEventListener("ended",l),e.addEventListener("error",o),e.readyState>=HTMLMediaElement.HAVE_METADATA&&a(),()=>{e.removeEventListener("loadedmetadata",a),e.removeEventListener("loadeddata",t),e.removeEventListener("canplay",t),e.removeEventListener("canplaythrough",t),e.removeEventListener("seeked",n),e.removeEventListener("ended",l),e.removeEventListener("error",o),u(e)}},[el,r,U,A,F,e_,B]),(0,n.useEffect)(()=>
1{if(!eR){ee.current&&(ee.current.destroy(),ee.current=null),eh(!1);return}if(!el||!Q.current||!J.current||!h)return;ee.current&&ee.current.destroy();let e=eU(),t=d.default.create({container:Q.current,waveColor:eT,progressColor:eM,cursorColor:"#ef4444",cursorWidth:2,barWidth:2,barGap:1,barRadius:2,height:e,normalize:!0,interact:!0,media:J.current});ee.current=t,t.on("ready",()=>{eh(!0)}),t.on("interaction",e=>{var t;null==(t=ek.current)||t.call(ek,e)}),t.on("error",e=>{console.error("".concat(r," - WaveSurfer error:"),e)});let a=window.requestAnimationFrame(()=>{let e=eU();t.setOptions({height:e})}),n=null,l=Q.current.parentElement;return"undefined"!=typeof ResizeObserver&&l&&(n=new ResizeObserver(()=>{window.cancelAnimationFrame(a),a=window.requestAnimationFrame(()=>{let e=eU();t.setOptions({height:e})})})).observe(l),()=>{window.cancelAnimationFrame(a),null==n||n.disconnect(),ee.current&&(ee.current.destroy(),ee.current=null)}},[el,eU,h,r,eR,eM,eT]),(0,n.useEffect)(()=>{if(!ee.current||!ec||!z||P&&!B)return;let e=ee.current,t=z>0?T/z:0,r=B?.08:.3;Math.abs(e.getCurrentTime()-T)>r&&e.seekTo(t)},[T,z,ec,P,B]),(0,n.useEffect)(()=>{if(B)return;let e=J.current;if(e&&el&&ec){if(!h||P)return void u(e);"hard-seeked"===m(e,T,{isPlaying:P,lastHardSyncAtRef:ey})&&(ew.current=e.seeking)}},[T,h,el,ec,P,B]),(0,n.useEffect)(()=>{if(B)return;let e=J.current;e&&el&&ec&&h&&eN.current!==L&&(eN.current=L,u(e),e.currentTime=Math.max(0,ej.current),ey.current=Date.now())},[L,el,ec,h,B]),(0,n.useEffect)(()=>{if(B)return;let e=J.current;if(e&&h&&el&&ec)if(P){if(e.paused){let t=e.play();void 0!==t&&t.catch(e_)}}else u(e),e.paused||e.pause()},[P,h,el,ec,e_,B]);let eI="ready"===s&&(!!el||B),eH=eI&&(null!=M?M:ec),eW=B?eI:eH,eq=!eI||ea||eI&&!eH,eK=eI?100:Math.max(0,Math.min(100,Math.round(p))),e$=eI?X.preparing:X.loading,eY=!eI,eZ=e=>{if(!eW)return;let r=J.current;if(r)r.volume=B?0:e*S,r.muted=B;else if(!B)return;er(e),null==W||W(t,e)},eG=()=>{if(!eW)return;let e=et>0?0:1,r=J.current;if(r)r.volume=B||R?0:e*S,r.muted=B;else if(!B)return;er(e),null==W||W(t,e)};return((0,n.useEffect)(()=>{let e=J.current;e&&(e.muted=B,e.volume=B||R?0:et*S)},[S,et,R,B]),h)?(0,a.jsxs)(i.P.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"relative overflow-hidden transition-all h-full ".concat(eD?"min-h-[176px] md:min-h-[64px]":"min-h-[64px]"," ").concat(R?"opacity-50":"opacity-100"),children:[eq&&(0,a.jsxs)("div",{className:"pointer-events-none absolute inset-0 z-10 md:hidden",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-slate-950/82 backdrop-blur-[1px]"}),eY&&(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 bg-gradient-to-r from-[#6315ab]/18 to-[#1A5DFB]/24 transition-all duration-150 ease-linear",style:{width:"".concat(eK,"%")}}),(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,a.jsx)("div",{className:"rounded-full border border-blue-400/30 bg-slate-950/90 px-3 py-1 text-xs font-semibold text-blue-100 shadow-sm",children:"error"===s?X.error:"".concat(e$," ").concat(eK,"%")})})]}),(0,a.jsxs)("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-2 p-3 md:p-2 h-full ".concat(eD?"pt-7 md:pt-2":""),children:[_&&(0,a.jsxs)("div",{className:"flex items-center gap-2 w-full md:w-[224px] md:min-w-[224px] md:max-w-[224px]",children:[(0,a.jsx)("div",{className:"flex md:min-w-[3vw] flex-[0_0_58px] items-center gap-1.5 md:flex-initial md:order-2",children:(0,a.jsx)("h3",{className:"tool-audio-track-label truncate text-sm md:text-xs font-semibold text-slate-50 whitespace-nowrap",children:l})}),(0,a.jsx)(x.$,{type:"button",variant:"ghost",size:"icon",onClick:eG,disabled:!eW,className:"tool-track-icon-button tool-track-volume-button md:hidden flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-40",title:et>0?X.setVolumeToZero:X.setVolumeToFull,style:{...eB,opacity:eF?.5:1,filter:eF?"grayscale(1)":"none"},children:(0,a.jsx)("img",{src:eA,alt:"","aria-hidden":"true",className:"h-6 w-6 object-contain"})}
1),(0,a.jsx)(f.A,{min:0,max:1,step:.01,value:[et],onValueChange:e=>{let[t]=e;return eZ(t)},disabled:!eW,className:"track-volume-white-thumb track-volume-slider md:hidden min-w-0 flex-1",style:{...eB,background:"linear-gradient(to right, ".concat(w," 0%, ").concat(k," ").concat(100*et,"%, ").concat(y," ").concat(100*et,"%, ").concat(y," 100%)"),"--track-thumb-color":eF?j:k,"--track-thumb-ring":eF?"rgba(148, 163, 184, 0.22)":"var(--track-volume-ring)",opacity:eF?.68:1}}),(0,a.jsxs)("div",{className:"hidden md:flex items-center gap-1.5 md:order-3",children:[(0,a.jsx)(x.$,{type:"button",variant:"ghost",size:"icon",onClick:eG,disabled:!eW,className:"tool-track-icon-button tool-track-volume-button flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full text-white transition-colors disabled:cursor-not-allowed disabled:opacity-40",title:et>0?X.setVolumeToZero:X.setVolumeToFull,style:{...eB,opacity:eF?.5:1,filter:eF?"grayscale(1)":"none"},children:(0,a.jsx)("img",{src:eA,alt:"","aria-hidden":"true",className:"h-6 w-6 object-contain"})}),(0,a.jsx)(f.A,{min:0,max:1,step:.01,value:[et],onValueChange:e=>{let[t]=e;return eZ(t)},disabled:!eW,className:"track-volume-white-thumb track-volume-slider w-28",style:{...eB,color:k,background:"linear-gradient(to right, ".concat(w," 0%, ").concat(k," ").concat(100*et,"%, ").concat(y," ").concat(100*et,"%, ").concat(y," 100%)"),"--track-thumb-color":eF?j:k,"--track-thumb-ring":eF?"rgba(148, 163, 184, 0.22)":"var(--track-volume-ring)",opacity:eF?.68:1}})]})]}),V&&(0,a.jsxs)("div",{className:"".concat(O?"flex":"hidden md:flex"," flex-4 relative h-full ").concat(eD?"min-h-[140px] md:min-h-[44px]":"min-h-[44px]"," rounded overflow-hidden"),style:{backgroundColor:eL},children:[(0,a.jsx)("div",{ref:Q,className:"absolute inset-0 transition-opacity ".concat(ea?"opacity-30":""," ").concat(eH?"cursor-pointer":"cursor-default"," ").concat(R?"opacity-40":""),title:eH?X.seek:void 0}),eq&&(0,a.jsxs)("div",{className:"pointer-events-none absolute inset-0 bg-slate-950/50",children:[eY&&(0,a.jsx)("div",{className:"h-full rounded transition-all duration-150 ease-linear",style:{width:"".concat(eK,"%"),background:"linear-gradient(to right, ".concat(E(eE,.35),", ").concat(E(eM,.45),")")}}),(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center text-[11px] font-semibold text-blue-100",children:"error"===s?X.error:"".concat(e$," ").concat(eK,"%")})]}),ei&&(0,a.jsx)("div",{className:"absolute top-1 right-1 flex items-center gap-1",children:ei&&!ea&&(0,a.jsxs)("div",{className:"flex items-center gap-0.5 text-[10px] text-red-200 bg-red-500/15 rounded px-1.5 py-0.5",title:ei,children:[(0,a.jsx)("svg",{className:"h-2.5 w-2.5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),(0,a.jsx)("span",{children:X.error})]})})]})]}),el&&(0,a.jsx)("audio",{ref:eO,src:el,preload:"auto",muted:B})]}):null}var C=r(55781);let P={title:"Lyrics",close:"Close lyrics",loadingCache:"Loading lyrics...",preparingVocal:"Preparing music...",uploading:"Uploading music...",generating:"Generating lyrics...",downloading:"Downloading lyrics...",loginRequired:"Please log in to generate lyrics.",error:"Could not generate lyrics.",retry:"Retry",empty:"No lyrics were found.",playFrom:"Play from"};function T(e){let{status:t,words:r=[],currentTime:l,progress:o=0,errorMessage:s="",onWordClick:c,onRetry:d,onClose:u,labels:m=P,className:p=""}=e,h=(0,n.useRef)(null),x=(0,n.useRef)(null),f=(0,n.useMemo)(()=>r.findIndex(e=>"word"===e.type&&Number.isFinite(e.start)&&Number.isFinite(e.end)&&l>=e.start&&l<=e.end),[l,r]),g=(0,n.useMemo)(()=>(0,C.Y)(r),[r]);(0,n.useEffect)(()=>{"ready"===t&&!(f<0)&&x.current&&h.current&&x.current.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"})},[f,t]);let b=(0,n.useMemo)(()=>"loading-cache"===t?m.loadingCache:"preparing-vocal"===t?m.preparingVocal:"uploading"===t?o>0?"".concat(m.uploading," ").concat(Math.round(o),"%"):m.uploading:"generating"===t?o>0?"".concat(m.generating," ").concat(Math.round(o),"%"):m.generating:"downloading"===t?m.downloading:"login-required"===t?m.loginRequired:"error"===t?s||m.error:m.loadingCache,[s,m,o,t]);return(0,a.jsxs)(i.P.section,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.14,ease:"easeOut"},className:"tool-lyrics-panel relative flex min-h-0 flex-col overflow-hidden bg-black text-white shadow-[0_24px_80px_rgba(0,0,0,0.55)] ".concat(p),"aria-label":m.title,children:[(0,a.jsx)("button",{type:"button",onClick:u,className:"absolute right-4 top-4 z-20 flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full border border-white/15 bg-white/10 text-white transition hover:bg-white/16","aria-label":m.close,title:m.close,children:(0,a.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})}),(0,a.jsx)("div",{ref:h,className:"tool-lyrics-scroll min-h-0 flex-1 overflow-y-auto px-5 py-16 md:px-8 md:py-14",children:"ready"===t?r.length>0?(0,a.jsx)("div",{className:"flex max-w-5xl flex-col gap-4 pr-12 text-2xl font-semibold leading-snug text-slate-500 md:gap-5 md:text-3xl md:leading-snug",children:g.map((e,t)=>(0,a.jsx)("div",{className:"whitespace-pre-wrap",children:e.map((e,t)=>{let{word:r,index:n}=e,o="word"===r.type,i=o&&Number.isFinite(r.start)&&!!c,s=n===f,d=o&&Number.isFinite(r.start)&&l>=r.start?"tool-lyrics-word-active font-extrabold transition-[color,font-weight,text-shadow] duration-150 ease-out":"tool-lyrics-word transition-[color,font-weight,text-shadow] duration-150 ease-out";return i?(0,a.jsx)("button",{type:"button",ref:s?e=>{x.current=e}:void 0,onClick:()=>c(r.start,r),className:"".concat(d," cursor-pointer appearance-none rounded-sm border-0 bg-transparent p-0 text-left hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-white/70 focus-visible:ring-offset-2 focus-visible:ring-offset-black"),style:{font:"inherit",lineHeight:"inherit"},"aria-label":"".concat(m.playFrom||P.playFrom," ").concat(r.text),children:r.text},"".concat(r.text,"-").concat(n,"-").concat(t,"-").concat(r.start)):(0,a.jsx)("span",{ref:s?e=>{x.current=e}:void 0,className:o?d:void 0,children:r.text},"".concat(r.text,"-").concat(n,"-").concat(t,"-").concat(r.start))})},"lyrics-line-".concat(t)))}):(0,a.jsx)("div",{className:"flex h-full items-center justify-center px-6 text-center text-base font-semibold text-slate-400",children:m.empty}):(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-4 px-6 text-center",children:[(0,a.jsx)("p",{className:"text-base font-semibold text-slate-200 md:text-lg",children:b}),"error"===t&&d&&(0,a.jsx)("button",{type:"button",onClick:d,className:"rounded-md bg-white px-4 py-2 text-sm font-bold text-slate-950 transition hover:bg-slate-100",children:m.retry})]})})]})}var L=r(75961),z=r.n(L),S=r(35739),A=r(9359);let F=["loading-cache","preparing-vocal","uploading","generating","downloading"],R={vocal:["#FF4B72","#FF758C"],bass:["#00E5FF","#00B0FF"],drums:["#FF9F0A","#FFD60A"],guitar:["#30D158","#34C759"],piano:["#0A84FF","#64D2FF"],instrumental:["#34C759","#A6E22E"],other:["#BF5AF2","#E598FF"],others:["#BF5AF2","#E598FF"],ai_cover:["#9E00FF","#FF007A"]},D=["#0A84FF","#64D2FF"],B={vocal:"/mss/vocal.svg",bass:"/mss/bass.svg",drums:"/mss/drums.svg",guitar:"/mss/guitar.svg",piano:"/mss/piano.svg",other:"/mss/others.svg",others:"/mss/others.svg"};function V(e){let{videoFile:t,tracks:r,mutedTracks:l,soloedTrack:o,isPlaying:c,isLooping:d=!1,loopStart:g=0,loopEnd:b=0,currentTime:v,syncRevision:y=0,masterVolume:w,useWebAudioPlayback:k=!1,tempoRatio:j=1,audioOutputLatency:N=0,pitchTempoEngineState:E="disabled",showTrackControls:M=!0,onTrackVolumeChange:P,onLoadedMetadata:L,onTimeUpdate:V,onTrackReady:_,onPlaybackBlocked:O,onPlaybackFailed:U,isLyricsOpen:I=!1,lyricsStatus:H="idle",lyricsWords:W=[],lyricsProgress:q=0,lyricsError:K="",onLyricsWordClick:$,onCloseLyrics:Y,onRetryLyrics:Z,lyricsLabels:G,labels:X={trackVolumes:"Track Volumes",loading:"Loading",preparing:"Preparing",error:"Error"}}=e,J=(0,n.useRef)(null),Q=(0,n.useRef)({}),[ee,et]=(0,n.useState)({}
1),[er,ea]=(0,n.useState)(""),[en,el]=(0,n.useState)(0),[eo,ei]=(0,n.useState)(!0),es=(0,n.useRef)(j),ec=(0,n.useRef)(!1),ed=(0,n.useRef)(new Set),eu=(0,n.useRef)(new Set),em=(0,n.useRef)({}),ep=(0,n.useRef)({}),eh=(0,n.useRef)(new Set),ex=(0,n.useRef)(v),ef=(0,n.useRef)(c),eg=(0,n.useRef)(y),eb=(0,n.useRef)(0),ev=(0,n.useRef)(0),ey=r.map(e=>"".concat(e.id,":").concat(e.downloadUrl)).join("|"),ew=(0,n.useRef)(ey);ef.current=c,(0,n.useEffect)(()=>{ex.current=v},[v]);let ek=(0,n.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:es.current,r=Math.max(.75,Math.min(1.5,t));e.defaultPlaybackRate=r,e.playbackRate=r},[]);(0,n.useEffect)(()=>{es.current=j;let e=J.current;if(!e)return;let t=k&&"ready"===E&&c?Math.max(0,1e3*N):0,r=window.setTimeout(()=>ek(e,j),t);return()=>window.clearTimeout(r)},[ek,N,c,E,j,k]);let ej=e=>(em.current[e]||(em.current[e]={current:0}),em.current[e]),eN=(0,n.useCallback)(()=>{var e;let t=null==(e=J.current)?void 0:e.currentTime;return Number.isFinite(t)&&void 0!==t&&t>=0?t:Math.max(0,ex.current)},[]),eE=(0,n.useCallback)(e=>void 0!==ee[e]?ee[e]:1,[ee]),eM=(0,n.useCallback)(e=>{let t=l.has(e),r=null!==o&&o!==e;return t||r?0:eE(e)*w},[eE,w,l,o]),eC=(0,n.useRef)(eM);(0,n.useEffect)(()=>{eC.current=eM},[eM]);let eP=(0,n.useCallback)((e,t,r)=>{if(!(t instanceof DOMException)||"AbortError"!==t.name){if(console.error("".concat(e," play error:"),t),t instanceof DOMException&&"NotAllowedError"===t.name){null==O||O();return}r&&(null==U||U(e,t))}},[O,U]);(0,n.useEffect)(()=>{ew.current!==ey&&(ew.current=ey,em.current={})},[ey]),(0,n.useEffect)(()=>{et(e=>{let t={...e};return r.forEach(e=>{!e.active||e.id in t||(t[e.id]=1)}),t});let e=0,t=setInterval(()=>{let r=++e/48;r>=1?(el(1),ei(!1),clearInterval(t)):el(r)},16.666666666666668);return()=>clearInterval(t)},[]),(0,n.useEffect)(()=>{if(t){let e=URL.createObjectURL(t);return ea(e),()=>URL.revokeObjectURL(e)}},[t]);let eT=async()=>{if(!J.current||ec.current)return;ec.current=!0;let e=Math.max(0,g);try{if(J.current.currentTime=e,k||V(e),k||Object.values(Q.current).forEach(t=>{u(t),t.currentTime=e}),c){if(ek(J.current),await J.current.play().catch(e=>eP("video",e,!0)),k)return;await Promise.all(Object.entries(Q.current).map(async e=>{let[t,r]=e;try{(r.ended||r.paused)&&await r.play()}catch(e){eP(t,e,"vocal"===t)}}))}}finally{window.setTimeout(()=>{ec.current=!1},40)}};(0,n.useEffect)(()=>{let e=J.current,t=ev.current+1;if(ev.current=t,e){if(!c){ev.current=t,k?ek(e):u(e),k||Object.values(Q.current).forEach(e=>{u(e),e.pause()}),e.pause();return}if(k&&!e.paused&&!e.ended)return void ek(e);(async()=>{if(k&&Math.abs(e.currentTime-ex.current)>.04&&(e.currentTime=ex.current),ek(e),k&&"ready"===E&&N>0&&(await new Promise(e=>window.setTimeout(e,1e3*N)),ev.current!==t||!ef.current))return;try{await e.play()}catch(e){eP("video",e,!0);return}if(ev.current!==t||!ef.current||k)return;let r=eN();await Promise.all(Object.entries(Q.current).map(async e=>{let[a,n]=e;ev.current===t&&ef.current&&(u(n),Math.abs(n.currentTime-r)>.04&&await p(n,r,{toleranceSeconds:.03}),ev.current===t&&ef.current&&(n.volume=Math.max(0,Math.min(1,eC.current(a))),await n.play().catch(e=>eP(a,e,"vocal"===a))))}))})()}},[ek,N,eN,eP,c,E,k]),(0,n.useEffect)(()=>{let e=J.current;e&&(!k||!c)&&Math.abs(e.currentTime-v)>.35&&(k?ek(e):u(e),e.currentTime=v)},[ek,v,c,k]),(0,n.useEffect)(()=>{if(!k||!c)return;let e=window.setInterval(()=>{let e=J.current;if(!e||e.seeking||ec.current)return;let t=Math.max(0,ex.current);if(!Number.isFinite(t))return;let r=e.currentTime-t,a=Math.abs(r);if(a<.08)return void ek(e);let n=Date.now();if(n-eb.current<500)return;if(eb.current=n,a>=.18){ek(e),e.currentTime=t;return}let l=es.current;e.playbackRate=Math.max(.98*l,Math.min(1.02*l,l-.12*r))},250);return()=>window.clearInterval(e)},[ek,c,k]),(0,n.useEffect)(()=>{!k&&(c||Object.values(Q.current).forEach(e=>{u(e),e.pause()}))},[c,k]),(0,n.useEffect)(()=>{if(k)return;if(c)return void Object.values(Q.current).forEach(u);let e=eN();Object.entries(Q.current).forEach(t=>{let[r,a]=t;m(a,e,{isPlaying:c,lastHardSyncAtRef:ej(r)})})},[v,eN,c,k]),(0,n.useEffect)(()=>
1{if(eg.current===y)return;eg.current=y;let e=Math.max(0,ex.current),t=ev.current+1;if(ev.current=t,k){let r=J.current;if(r&&(r.pause(),ek(r),r.currentTime=e,ef.current)){let e="ready"===E?Math.max(0,1e3*N):0;window.setTimeout(()=>{ev.current===t&&ef.current&&r.play().catch(e=>eP("video",e,!0))},e)}return}h({items:[...J.current?[{id:"video",media:J.current,critical:!0}]:[],...Object.entries(Q.current).map(e=>{let[t,r]=e;return{id:t,media:r,critical:"vocal"===t,applyVolume:()=>{r.volume=Math.max(0,Math.min(1,eC.current(t))),ej(t).current=Date.now()}}})],getTargetTime:()=>e,shouldResume:()=>ev.current===t&&ef.current,toleranceSeconds:.03,timeoutMs:700,onPlaybackError:(e,t,r)=>{eP(e,t,r)}})},[ek,N,eP,E,y,k]);let eL=(e,t)=>{let a=r.find(t=>t.id===e);if((null==a?void 0:a.cacheStatus)==="ready"&&(et(r=>({...r,[e]:t})),P(e,t),!k&&Q.current[e])){let r=l.has(e),a=null!==o&&o!==e;if(r||a)Q.current[e].volume=0;else{let r=t*w;Q.current[e].volume=Math.max(0,Math.min(1,r))}}};(0,n.useEffect)(()=>{k||Object.keys(Q.current).forEach(e=>{Q.current[e]&&(Q.current[e].volume=Math.max(0,Math.min(1,eM(e))))})},[eM,k]);let ez=(0,n.useCallback)(async()=>h({items:[...J.current?[{id:"video",media:J.current,critical:!0}]:[],...Object.entries(Q.current).map(e=>{let[t,r]=e;return{id:t,media:r,critical:"vocal"===t,applyVolume:()=>{r.volume=Math.max(0,Math.min(1,eM(t))),ej(t).current=Date.now()}}})],getTargetTime:eN,shouldResume:()=>ef.current,toleranceSeconds:.03,timeoutMs:700,onPlaybackError:(e,t,r)=>{eP(e,t,r)}}),[eM,eN,eP]),eS=(e,t)=>{let a=Q.current[e];a&&a!==t&&(u(a),a.pause(),a.removeAttribute("src"),a.load());let n=r.find(t=>t.id===e),l=(null==n?void 0:n.downloadUrl)||t.currentSrc||t.src;if(ep.current[e]!==l&&(ep.current[e]=l,ed.current.delete(e),eu.current.delete(e),ej(e).current=0),Q.current[e]===t)return;Q.current[e]=t,t.volume=Math.max(0,Math.min(1,eM(e)));let o=async()=>{if(ed.current.has(e)||eu.current.has(e))return;eu.current.add(e);let r=await ez();if(Q.current[e]!==t)return void eu.current.delete(e);t.volume=Math.max(0,Math.min(1,eM(e))),u(t),ej(e).current=Date.now(),ed.current.add(e),eu.current.delete(e),_(e,r)};t.addEventListener("loadedmetadata",o,{once:!0}),t.addEventListener("canplay",o,{once:!0}),t.readyState>=HTMLMediaElement.HAVE_METADATA&&o()},eA=r.filter(e=>e.active),eF=eA.findIndex(e=>"idle"===e.cacheStatus),eR="var(--tool-track-volume-remainder, #1e293b)";(0,n.useEffect)(()=>{let e=new Map(eA.filter(e=>!!e.downloadUrl).map(e=>[e.id,e.downloadUrl]));Object.entries(Q.current).forEach(t=>{let[r,a]=t,n=e.get(r),l=ep.current[r];(!n||l&&l!==n)&&(u(a),a.pause(),delete Q.current[r],ed.current.delete(r),eu.current.delete(r),delete ep.current[r],delete em.current[r])})},[eA]),(0,n.useEffect)(()=>{let e=Q.current,t=ed.current,r=eu.current;return()=>{Object.values(e).forEach(e=>{u(e),e.pause()}),Q.current={},t.clear(),r.clear(),ep.current={},em.current={}}},[]);let eD=(0,n.useMemo)(()=>(0,C.Y)(W),[W]),eB=(0,n.useMemo)(()=>eD.find(e=>{let t=e.map(e=>{let{word:t}=e;return t}).filter(e=>"word"===e.type&&Number.isFinite(e.start));if(0===t.length)return!1;let r=t[0],a=t[t.length-1],n=r.start,l=Number.isFinite(a.end)?a.end:a.start;return v>=n&&v<=l})||null,[v,eD]),eV=!I&&F.includes(H),e_=!I&&"ready"===H&&!!eB;return(0,n.useEffect)(()=>{k&&eA.forEach(e=>{"ready"!==e.cacheStatus||!e.playbackReady||eh.current.has(e.id)||(eh.current.add(e.id),_(e.id,eN()))})},[eA,eN,_,k]),(0,a.jsxs)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" tool-video-display flex h-full flex-col lg:gap-3",children:[(0,a.jsxs)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" tool-video-display-content flex flex-1 min-h-0 flex-col gap-2 lg:h-full lg:flex-row lg:gap-4",children:[(0,a.jsx)(i.P.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},className:"tool-video-player-column min-w-0 ".concat(M?"flex-5":"mx-auto flex h-full min-h-0 w-full flex-none items-center justify-center md:h-auto md:w-full md:max-w-[calc((100dvh-18rem)*16/9)] lg:max-w-[calc((100dvh-20rem)*16/9)] xl
1:max-w-[calc((100dvh-21rem)*16/9)]"),children:(0,a.jsx)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" "+"overflow-hidden rounded-xl bg-black shadow-xl lg:rounded-2xl ".concat(M?"lg:h-full":"h-full max-h-[calc(100dvh-14rem)] md:h-auto md:max-h-none"),children:(0,a.jsxs)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" "+"tool-video-frame relative bg-black ".concat(M?"h-[clamp(140px,24dvh,180px)] md:aspect-video md:h-auto md:min-h-[220px] lg:h-full lg:min-h-0 lg:aspect-auto":"aspect-[9/16] h-full w-auto max-w-[calc(100vw-2.5rem)] md:aspect-[16/9] md:h-auto md:w-full md:min-w-0 md:max-w-none"),children:[(0,a.jsx)("video",{ref:J,src:er,onLoadedMetadata:()=>{J.current&&(J.current.muted=!0,L(J.current.duration))},onTimeUpdate:()=>{if(J.current){if(d&&b>g&&J.current.currentTime>=b-.04)return void eT();k||V(J.current.currentTime)}},onEnded:()=>{if(d)return void eT();k||V(0)},muted:!0,playsInline:!0,controls:!1,disablePictureInPicture:!0,controlsList:"nodownload nofullscreen noremoteplayback","webkit-playsinline":"true",className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" "+"h-full w-full ".concat(M?"object-cover":"object-contain")}),eV&&(0,a.jsx)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" pointer-events-none absolute bottom-3 left-1/2 z-[5] w-[calc(100%-2rem)] -translate-x-1/2 px-3 py-1.5 text-center text-xs font-semibold leading-snug text-white/80 md:bottom-5 md:w-[calc(100%-3rem)] md:px-4 md:py-2 md:text-sm",children:(null==G?void 0:G.generating)||"Generating lyrics..."}),e_&&eB&&(0,a.jsx)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" pointer-events-none absolute bottom-3 left-1/2 z-[5] w-[calc(100%-2rem)] -translate-x-1/2 px-3 py-1.5 text-center text-base font-semibold leading-snug text-white md:bottom-5 md:w-[calc(100%-3rem)] md:px-4 md:py-2 md:text-xl lg:text-2xl",children:(0,a.jsx)("span",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" whitespace-pre-wrap",children:eB.map((e,t)=>{let r,{word:n,index:l}=e,o="word"===n.type,i=o&&Number.isFinite(n.start)&&v>=n.start;return o&&(r=i?"tool-video-lyrics-subtitle-word-active transition-colors duration-150 ease-out":"tool-video-lyrics-subtitle-word transition-colors duration-150 ease-out"),(0,a.jsx)("span",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" "+(r||""),children:n.text},"video-subtitle-".concat(n.text,"-").concat(l,"-").concat(t,"-").concat(n.start))})})}),(0,a.jsx)(s.N,{children:I&&Y&&G&&(0,a.jsx)(T,{status:H,words:W,currentTime:v,progress:q,errorMessage:K,onWordClick:$,onRetry:Z,onClose:Y,labels:G,className:"!absolute inset-0 z-10 hidden h-full w-full rounded-none md:flex md:rounded-xl"},"video-lyrics-desktop")}),(0,a.jsx)(s.N,{children:I&&Y&&G&&(0,a.jsx)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" tool-lyrics-mobile-overlay fixed left-0 right-0 top-0 z-[80] bg-black md:hidden",children:(0,a.jsx)(T,{status:H,words:W,currentTime:v,progress:q,errorMessage:K,onWordClick:$,onRetry:Z,onClose:Y,labels:G,className:"h-full w-full rounded-none"},"video-lyrics-mobile")})})]})})}),M&&(0,a.jsxs)(i.P.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.3},className:"tool-video-volume-panel flex flex-2 h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-700/60 bg-slate-900/30 p-2.5 shadow-[0_18px_42px_rgba(2,6,23,0.32)] sm:p-3 lg:h-full lg:w-[clamp(280px,30vw,430px)] lg:flex-shrink-0 lg:overflow-hidden lg:rounded-2xl lg:p-3 xl:p-4",children:[(0,a.jsx)("h3",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" tool-video-volume-title mb-1.5 text-sm font-bold text-slate-50 sm:mb-3 sm:text-base lg:mb-3 xl:mb-4 xl:text-lg",children:X.trackVolumes}),(0,a.jsx)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" tool-video-volume-list flex min-h-[40vh] flex-1 flex-col justify-start gap-2 sm:gap-2 md:min-h-0 lg:gap-1 xl:gap-3",children:eA.map(e=>{var t;let r,n=Math.max(0,Math.min(100,Math.round(e.downloadProgress||0))),l="ready"===e.cacheStatus,o=l&&(null==(t=e.playbackReady)||t),s="downloading"===e.cacheStatus,c=l&&!o,m=!l&&!s&&"error"!==e.cacheStatus&&eA.findIndex(t=>t.id===e.id)===eF,p=c?X.preparing||"Preparing":s?"Downloading":m?"Queued":"Waiting",h=(r=e.id,eo?en:eE(r)),g=s?n:0,[b,v]=((e,t)=>{let r="".concat(e||""," ").concat(t||"").toLowerCase();return r.includes("ai")&&r.includes("cover")?R.ai_cover:r.includes("vocal")?R.vocal:r.includes("bass")?R.bass:r.includes("drum")?R.drums:r.includes("guitar")?R.guitar:r.includes("piano")?R.piano:r.includes("instrumental")?R.instrumental:r.includes("other")?R.other:R[e]||D})(e.id,e.name),y=((e,t)=>{let r=parseInt(e.replace("#",""),16);return"rgba(".concat(r>>16&255,", ").concat(r>>8&255,", ").concat(255&r,", ").concat(t,")")})(v,.24),w=((e,t)=>{let r="".concat(e||""," ").concat(t||"").toLowerCase();return r.includes("vocal")?B.vocal:r.includes("bass")?B.bass:r.includes("drum")?B.drums:r.includes("guitar")?B.guitar:r.includes("piano")?B.piano:r.includes("other")?B.other:B[e]||B.others})(e.id,e.name),j=h<=0;return(0,a.jsxs)(i.P.div,{initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},className:"min-h-0 space-y-0 px-0.5 py-0.5 sm:p-1 lg:py-0",children:[(0,a.jsxs)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" "+"flex min-h-0 items-center gap-1.5 sm:gap-2 ".concat(o?"":"text-slate-400"),children:[(0,a.jsx)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" "+"tool-video-track-name w-[4em] font-semibold text-xs sm:text-sm ".concat(o||s?"text-slate-50":"text-slate-500"),children:e.name}),(0,a.jsx)(x.$,{type:"button",variant:"ghost",size:"icon",className:"tool-track-icon-button mx-1 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full transition disabled:cursor-not-allowed disabled:opacity-40 sm:mx-2 lg:h-7 lg:w-7 xl:h-8 xl:w-8 ".concat(o?"cursor-pointer":"cursor-not-allowed"),disabled:!o,onClick:()=>{if(!o)return;let t=eE(e.id);eL(e.id,t>0?0:1)},style:{opacity:j?.5:1,filter:j?"grayscale(1)":"none"},children:o?(0,a.jsx)("img",{src:w,alt:"","aria-hidden":"true",className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" h-6 w-6 object-contain lg:h-5 lg:w-5 xl:h-6 xl:w-6"}):"error"===e.cacheStatus?(0,a.jsx)("span",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" text-[11px] font-semibold text-red-300",children:X.error||"Error"}):c?(0,a.jsx)(S.A,{className:"h-5 w-5 animate-spin flex-shrink-0 text-blue-400"}):s?(0,a.jsx)(A.A,{className:"w-7 h-7 flex-shrink-0 text-sky-600"}):(0,a.jsx)("img",{src:w,alt:"","aria-hidden":"true",className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" h-6 w-6 object-contain grayscale opacity-45 lg:h-5 lg:w-5 xl:h-6 xl:w-6"})}),o?(0,a.jsx)(f.A,{min:0,max:1,step:.01,value:[h],onValueChange:t=>{let[r]=t;return eL(e.id,r)},disabled:eo,className:"track-volume-slider flex-1",style:{"--track-slider-color":v,"--track-volume-start":b,"--track-volume-end":v,color:v,background:"linear-gradient(to right, ".concat(b," 0%, ").concat(v," ").concat(100*h,"%, ").concat(eR," ").concat(100*h,"%, ").concat(eR," 100%)"),"--track-thumb-color":j?"var(--tool-track-volume-muted, #94a3b8)":v,"--track-thumb-ring":j?"rgba(148, 163, 184, 0.22)":y,pointerEvents:eo?"none":"auto",opacity:j?.68:1}}):(0,a.jsxs)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" flex flex-1 flex-col gap-1",children:[(0,a.jsx)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" "+"flex h-4 items-center ".concat(s||c?"justify-start gap-1.5":"justify-end"),children:s||c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" text-sm font-medium text-slate-300",children:p}),(0,a.jsx)(S.A,{className:"h-4 w-4 animate-spin ".concat(c?"text-blue-400":"text-sky-500")})]}):(0,a.jsx)("span",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" text-sm font-medium text-slate-500",children:p})}),(0,a.jsxs)("div",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" relative h-3 overflow-hidden rounded-full bg-slate-800",children:[(0,a.jsx)("div",{style:{width:"".concat(g,"%"),background:"linear-gradient(to right, ".concat(b,", ").concat(v,")")},className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" absolute inset-y-0 left-0 rounded-full transition-[width] duration-200"}),s&&(0,a.jsxs)("span",{className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])+" absolute inset-0 flex items-center justify-center text-[10px] font-semibold leading-none text-white",children:[n,"%"]})]})]})]}),!k&&e.downloadUrl&&(0,a.jsx)("audio",{ref:t=>{t&&eS(e.id,t)},src:e.downloadUrl,preload:"auto",onEnded:()=>{let t=Q.current[e.id];t&&u(t),d&&eT()},style:{display:"none"},className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])},"".concat(e.id,":").concat(e.downloadUrl))]},e.id)})})]}),!M&&!k&&eA.map(e=>e.downloadUrl?(0,a.jsx)("audio",{ref:t=>{t&&eS(e.id,t)},src:e.downloadUrl,preload:"auto",onEnded:()=>{let t=Q.current[e.id];t&&u(t),d&&eT()},style:{display:"none"},className:z().dynamic([["88f140d0386c6d22",[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"]]])},"".concat(e.id,":").concat(e.downloadUrl)):null)]}),(0,a.jsx)(z(),{id:"88f140d0386c6d22",dynamic:[eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease",eo?"none":"all 0.1s ease"],children:".slider.__jsx-style-dynamic-selector{transition:".concat(eo?"
1none":"all 0.1s ease","}.slider.__jsx-style-dynamic-selector:disabled{opacity:1;cursor:default}.slider.__jsx-style-dynamic-selector::-webkit-slider-thumb{appearance:none;width:14px;height:14px;border-radius:50%;background:currentColor;cursor:pointer;box-shadow:0 2px 4px rgba(0,0,0,.2);transition:").concat(eo?"none":"all 0.1s ease","}.slider.__jsx-style-dynamic-selector:disabled::-webkit-slider-thumb{cursor:default}.slider.__jsx-style-dynamic-selector::-moz-range-thumb{width:14px;height:14px;border-radius:50%;background:currentColor;cursor:pointer;border:none;box-shadow:0 2px 4px rgba(0,0,0,.2);transition:").concat(eo?"none":"all 0.1s ease","}.slider.__jsx-style-dynamic-selector:disabled::-moz-range-thumb{cursor:default}video.__jsx-style-dynamic-selector::-webkit-media-controls{display:none!important}video.__jsx-style-dynamic-selector::-webkit-media-controls-enclosure{display:none!important}video.__jsx-style-dynamic-selector::-webkit-media-controls-panel{display:none!important}")})]})}var _=r(54587),O=r.n(_),U=r(82358),I=r(65734);function H(e){let{isOpen:t,isAuthenticated:r,tracks:n,selectedFormat:o,selectedChannels:s,mediaType:c="audio",showLongerVideoExportWarning:d=!1,showExportAll:u=!0,canDownload:m=!0,onClose:p,onFormatChange:h,onChannelToggle:f,onExportSelected:g,onExportAll:b,labels:v={title:"Export",fileFormat:"File Format",channels:"Channels",loginRequired:"Login Required",loginRequiredDescription:"Please log in to your account to download and export tracks.",goToLogin:"Go to Login",cancel:"Cancel",purchaseCredits:"Purchase Credits to Export",purchaseCreditsDescription:"You need to purchase a plan to download and export your separated tracks.",buyPlan:"Buy a Plan",downloadSelected:"Download Selected",exportAllChannels:"Export All Channels",tempoExportWarning:"Export may take longer."}}=e,y=(0,l.useRouter)(),w="video"===c?["mp4","mp3"]:[...U.be.EXPORT_FORMATS];return(0,a.jsx)(I.lG,{open:t,onOpenChange:e=>{e||p()},children:(0,a.jsx)(I.Cf,{overlayClassName:"!z-[120] !bg-black/45 !backdrop-blur-md",className:"!z-[121] max-h-[calc(100dvh-1rem)] w-[calc(100%-2rem)] max-w-md overflow-y-auto border-zinc-200 bg-white p-3 text-zinc-950 shadow-2xl dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-50 sm:p-4",children:(0,a.jsxs)(i.P.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"w-full",children:[(0,a.jsx)(I.c7,{className:"mb-2 text-left",children:(0,a.jsx)(I.L3,{className:"text-xl font-bold leading-tight sm:text-2xl",children:v.title})}),(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("h3",{className:"mb-1.5 text-xs font-semibold text-zinc-700 dark:text-zinc-200 sm:text-sm",children:v.fileFormat}),(0,a.jsx)("div",{className:"flex gap-2",children:w.map(e=>(0,a.jsx)(x.$,{type:"button",onClick:()=>h(e),variant:o===e?"default":"secondary",size:"sm",className:"rounded-lg border px-3 py-1.5 text-sm font-semibold transition-all ".concat(o===e?"!border-violet-700 !bg-violet-700 !text-white shadow-sm hover:!bg-violet-800 dark:!border-white dark:!bg-white dark:!text-zinc-950 dark:hover:!bg-zinc-200":"!border-zinc-200 !bg-zinc-100 !text-zinc-800 hover:!bg-zinc-200 dark:!border-zinc-700 dark:!bg-zinc-800 dark:!text-zinc-100 dark:hover:!bg-zinc-700"),children:e.toUpperCase()},e))}),d&&"mp4"===o&&(0,a.jsx)("p",{className:"mt-2 rounded-lg border border-amber-300/70 bg-amber-50 px-3 py-2 text-xs font-medium text-amber-900 dark:border-amber-700/70 dark:bg-amber-950/40 dark:text-amber-200",children:v.tempoExportWarning})]}),r&&m&&(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("h3",{className:"mb-1.5 text-xs font-semibold text-zinc-700 dark:text-zinc-200 sm:text-sm",children:v.channels}),(0,a.jsx)("div",{className:"space-y-1.5",children:n.filter(e=>e.active).map(e=>{let t=(e=>{let t={vocal:"/mss/vocal.svg",drums:"/mss/drums.svg",bass:"/mss/bass.svg",guitar:"/mss/guitar.svg",piano:"/mss/piano.svg",other:"/mss/others.svg",others:"/mss/others.svg"};return t[e]||t.others})(e.id),r=s.includes(e.id);return(0,a.jsxs)(x.$,{type:"button",variant:"outline",onClick:()=>f(e.id),className:"flex w-full items-center gap-2 rounded-lg border px-2.5 py-2.5 transition-all ".concat(r?"!border-white !bg-zinc-900 !text-white ring-2 ring-zinc-900/15 shadow-md hover:!bg-zinc-800 dark:!bg-zinc-800 dark:ring-white/20 dark:hover:!bg-zinc-700":"!border-zinc-300 !bg-white !text-zinc-900 hover:!border-zinc-500 hover:!bg-zinc-100 dark:!border-zinc-700 dark:!bg-zinc-800/70 dark:!text-zinc-100 dark:hover:!border-zinc-500 dark:hover:!bg-zinc-800"),children:[(0,a.jsx)(O(),{src:t,alt:"","aria-hidden":"true",width:24,height:24,className:"h-6 w-6 flex-shrink-0 object-contain"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-inherit",children:e.label})]},e.id)})})]}),r?m?(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)(i.P.button,{className:"w-full ".concat(s.length>0?"border border-violet-600 bg-violet-600 text-white shadow-md hover:bg-violet-700 dark:border-white dark:bg-white dark:text-zinc-950 dark:hover:bg-zinc-200":"cursor-not-allowed border border-zinc-300 bg-zinc-100 text-zinc-400 dark:border-zinc-700 dark:bg-zinc-800/70 dark:text-zinc-500"," flex items-center justify-center gap-2 rounded-lg py-2.5 font-semibold transition-all"),whileHover:s.length>0?{scale:1.02}:{},whileTap:s.length>0?{scale:.98}:{},onClick:g,disabled:0===s.length,children:[(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),v.downloadSelected]}),u&&"audio"===c&&(0,a.jsxs)(i.P.button,{className:"flex w-full items-center justify-center gap-2 rounded-lg border border-violet-300 bg-vi
1olet-50 py-2.5 font-semibold text-violet-800 shadow-sm transition-all hover:bg-violet-100 dark:border-zinc-600 dark:bg-zinc-800 dark:text-white dark:hover:bg-zinc-700",whileHover:{scale:1.02},whileTap:{scale:.98},onClick:b,children:[(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),v.exportAllChannels]}),(0,a.jsx)(x.$,{type:"button",variant:"secondary",onClick:p,className:"w-full rounded-lg border border-zinc-200 bg-zinc-100 py-2.5 font-medium text-zinc-800 transition-all hover:bg-zinc-200 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700",children:v.cancel})]}):(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"rounded-lg border border-violet-300 bg-violet-50 p-3 dark:border-violet-700 dark:bg-violet-950/50",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("svg",{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-purple-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"mb-0.5 text-sm font-semibold text-violet-950 dark:text-violet-100",children:v.purchaseCredits}),(0,a.jsx)("p",{className:"text-xs text-violet-800 dark:text-violet-200",children:v.purchaseCreditsDescription})]})]})}),(0,a.jsxs)(i.P.button,{className:"flex w-full items-center justify-center gap-2 rounded-lg bg-gradient-to-r from-purple-600 to-blue-600 py-2.5 font-semibold text-white transition-all hover:from-purple-700 hover:to-blue-700",whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>{y.push("/pricing")},children:[(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"})}),v.buyPlan]}),(0,a.jsx)(x.$,{type:"button",variant:"secondary",onClick:p,className:"w-full rounded-lg border border-zinc-200 bg-zinc-100 py-2.5 font-medium text-zinc-800 transition-all hover:bg-zinc-200 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700",children:v.cancel})]}):(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"rounded-lg border border-amber-300 bg-amber-50 p-3 dark:border-amber-700 dark:bg-amber-950/50",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("svg",{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-amber-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"mb-0.5 text-sm font-semibold text-amber-950 dark:text-amber-100",children:v.loginRequired}),(0,a.jsx)("p",{className:"text-xs text-amber-800 dark:text-amber-200",children:v.loginRequiredDescription})]})]})}),(0,a.jsxs)(i.P.button,{className:"flex w-full items-center justify-center gap-2 rounded-lg bg-gradient-to-r from-purple-600 to-blue-600 py-2.5 font-semibold text-white transition-all hover:from-purple-700 hover:to-blue-700",whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>{y.push("/login")},children:[(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"})}),v.goToLogin]}),(0,a.jsx)(x.$,{type:"button",variant:"secondary",onClick:p,className:"w-full rounded-lg border border-zinc-200 bg-zinc-100 py-2.5 font-medium text-zinc-800 transition-all hover:bg-zinc-200 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700",children:v.cancel})]})]})})})}var W=r(98477),q=r(16076),K=r(58725),$=r(26471),Y=r(56913),Z=r(67514),G=r(93732),X=r(98295),J=r(15565);function Q(e){let{className:t,size:r="default",...n}=e;return(0,a.jsx)(X.bL,{"data-slot":"switch","data-size":r,className:(0,J.cn)("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",t),...n,children:(0,a.jsx)(X.zi,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dar
1k:data-unchecked:bg-foreground"})})}var ee=r(22637);function et(){return(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",className:"tool-master-control-icon h-6 w-6",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M10.27 22.313c.1-3.295 1.388-6.341 3.63-8.584c1.83-1.828 4.203-3.032 6.827-3.461m17.006 17.036c-.434 2.613-1.635 4.977-3.457 6.799c-2.236 2.236-5.272 3.524-8.556 3.63M5.504 21.446c.207-4.316 1.934-8.292 4.879-11.237c2.53-2.531 5.834-4.172 9.479-4.709m22.637 22.671c-.541 3.634-2.18 6.927-4.704 9.451h0c-2.937 2.937-6.9 4.663-11.203 4.878m-15.409-4.096a1.42 1.42 0 0 0 2.009.008l.007-.008l5.668-5.668l.1.1c2.15.19 5.07 2.139 9.628-2.17l12.85-12.85a1.42 1.42 0 0 0 .006-2.008l-.007-.007l-1.712-1.712a1.42 1.42 0 0 0-2.009-.007l-.007.007L23.76 28.043l-3.8-3.8L33.917 10.29a1.42 1.42 0 0 0 .007-2.008l-.007-.007l-1.712-1.712a1.42 1.42 0 0 0-2.009-.007l-.007.007l-12.85 12.847c-4.31 4.558-2.36 7.478-2.17 9.626l.1.101l-5.667 5.67a1.42 1.42 0 0 0-.007 2.008l.007.007z"})})}function er(){return(0,a.jsxs)("svg",{viewBox:"0 0 24 24",className:"h-5 w-5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,a.jsx)("path",{d:"M7.2 18.5 10.1 5.8c.4-1.7 3.3-1.7 3.8 0l2.9 12.7"}),(0,a.jsx)("path",{d:"M5.2 18.5h13.6c.7 0 1.2.6 1 1.3A3 3 0 0 1 17 22H7a3 3 0 0 1-2.8-2.2c-.2-.7.3-1.3 1-1.3Z"}),(0,a.jsx)("path",{d:"m12.3 14.6 5.2-10.1"}),(0,a.jsx)("path",{d:"m16.8 4.1 2.1 1.1"})]})}function ea(e){let{value:t,min:r,max:l,step:o=1,ariaLabel:i,onChange:s}
1=e,c=(0,n.useRef)(null),[d,u]=(0,n.useState)(0),[m,p]=(0,n.useState)(!1),h=e=>Math.max(r,Math.min(l,e)),x=e=>{s(h(Math.round((t+e*o)/o)*o))};return(0,a.jsxs)("div",{className:"flex w-full items-center gap-3",children:[(0,a.jsx)("button",{type:"button",onClick:()=>x(-1),disabled:t<=r,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-xl font-light text-zinc-900 transition-colors hover:bg-black/5 disabled:opacity-30 dark:text-white dark:hover:bg-white/10","aria-label":"".concat(i,": decrease"),children:"â"}),(0,a.jsxs)("div",{role:"slider",tabIndex:0,"aria-label":i,"aria-valuemin":r,"aria-valuemax":l,"aria-valuenow":t,className:"relative h-14 min-w-0 flex-1 cursor-ew-resize touch-none select-none overflow-hidden rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-violet-500/80",onKeyDown:e=>{"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),x(-1)):"ArrowRight"===e.key||"ArrowUp"===e.key?(e.preventDefault(),x(1)):"Home"===e.key?(e.preventDefault(),s(r)):"End"===e.key&&(e.preventDefault(),s(l))},onPointerDown:e=>{c.current={x:e.clientX,value:t},u(0),p(!0),e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{let r=c.current;if(!r||!e.currentTarget.hasPointerCapture(e.pointerId))return;let a=e.clientX-r.x;u(Math.max(-72,Math.min(72,a)));let n=Math.round(a/12),l=h(Math.round((r.value-n*o)/o)*o);l!==t&&s(l)},onPointerUp:e=>{c.current=null,u(0),p(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:()=>{c.current=null,u(0),p(!1)},children:[(0,a.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center gap-[9px] ".concat(m?"":"transition-transform duration-200 ease-out"),style:{transform:"translateX(".concat(d,"px)")},children:Array.from({length:31},(e,t)=>(0,a.jsx)("span",{className:"w-px shrink-0 rounded-full ".concat(t%4==0?"h-8 bg-zinc-900/35 dark:bg-white/35":t%2==0?"h-6 bg-zinc-900/25 dark:bg-white/25":"h-4 bg-zinc-900/15 dark:bg-white/15")},t))}),(0,a.jsx)("span",{className:"pointer-events-none absolute bottom-2 left-1/2 top-2 w-0.5 -translate-x-1/2 rounded-full bg-violet-500 shadow-[0_0_12px_rgba(139,92,246,0.8)]"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>x(1),disabled:t>=l,className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-xl font-light text-zinc-900 transition-colors hover:bg-black/5 disabled:opacity-30 dark:text-white dark:hover:bg-white/10","aria-label":"".concat(i,": increase"),children:"+"})]})}function en(){return(0,a.jsxs)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.8,"aria-hidden":"true",children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 2l4 4-4 4"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 11V9a3 3 0 013-3h15"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 22l-4-4 4-4"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 13v2a3 3 0 01-3 3H3"})]})}let el=e=>{let t=Number.isFinite(e)?Math.max(0,e):0,r=Math.floor(t/60),a=t-60*r;return"".concat(r.toString().padStart(2,"0"),":").concat(a.toFixed(1).padStart(4,"0"))},eo=e=>{let t=e.trim().match(/^(\d+):([0-5]\d(?:\.\d)?)$/);if(!t)return null;let r=60*Number(t[1])+Number(t[2]);return Number.isFinite(r)?r:null};function ei(e){let{isLooping:t,currentTime:r,duration:l,loopStart:o,loopEnd:s,onToggleLoop:c,onPreview:d,onCommit:u,onOpen:m,labels:p}=e,[h,g]=(0,n.useState)(!1),[b,v]=(0,n.useState)(()=>el(o)),[y,w]=(0,n.useState)(()=>el(s)),[k,j]=(0,n.useState)(""),N=n.useId(),E=n.useId(),M=Math.max(0,l),C=Math.max(0,Math.min(o,M)),P=Math.max(C,Math.min(s,M)),T=M>0?Math.max(0,Math.min(100,r/M*100)):0;(0,n.useEffect)(()=>{v(el(C)),w(el(P))},[P,C]);let L=e=>{let t=eo("start"===e?b:y);if(null===t)return void j(p.invalidTime);let r=Math.max(0,Math.min(t,M)),a="start"===e?r:C,n="end"===e?r:P;if(n-a<.5)return void j(p.invalidRange);j(""),v(el(a)),w(el(n)),u(a,n)},z=(e,t)=>{let r=eo("start"===e?b:y),a=null!=r?r:"start"===e?C:P,n=C,l=P;"start"===e?n=Math.max(0,Math.min(a+t,Math.max(P-.5,0))):l=Math.max(Math.min(C+.5,M),Math.min(a+t,M)),j(""),v(el(n)),w(el(l)),u(n,l)};return(0,a.jsxs)(Y.AM,{open:h,onOpenChange:e=>{g(e),e&&(j(""),null==m||m(),t||c())},children:[(0,a.jsx)(Y.Wv,{asChild:!0,children:(0,a.jsx)(i.P.button,{type:"button",className:"hidden md:block tool-master-control-button flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg text-white transition-colors md:h-11 md:w-11 ".concat(t?"bg-white/[0.12] shadow-[0_0_18px_rgba(255,255,255,0.12)]":"hover:bg-white/10"),whileHover:{scale:1.05},whileTap:{scale:.95},title:t?p.loopEnabled:p.enableLoop,"aria-label":t?p.loopEnabled:p.enableLoop,"aria-pressed":t,children:(0,a.jsx)(en,{})})}),(0,a.jsxs)(Y.hl,{side:"top",align:"center",sideOffset:12,collisionPadding:8,role:"dialog","aria-label":p.title,className:"z-[110] w-[min(22rem,calc(100vw-1rem))] gap-4 border border-zinc-200 bg-white p-4 text-zinc-950 shadow-2xl dark:border-white/15 dark:bg-[#111113] dar
1k:text-white",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("div",{children:(0,a.jsx)("h3",{className:"text-sm font-bold",children:p.title})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(G.J,{htmlFor:"".concat(N,"-enabled"),className:"text-xs text-zinc-700 dark:text-zinc-200",children:p.enabled}),(0,a.jsx)(Q,{id:"".concat(N,"-enabled"),checked:t,onCheckedChange:e=>{e!==t&&c()},"aria-label":p.enabled,className:"data-checked:!bg-violet-600 data-unchecked:!bg-zinc-300 focus-visible:ring-violet-500/40 dark:data-checked:!bg-white dark:data-unchecked:!bg-zinc-700"})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"relative flex h-8 items-center",children:[(0,a.jsx)(f.A,{min:0,max:M||.5,step:.1,minStepsBetweenThumbs:5,value:[C,P],onValueChange:e=>{let[t,r]=e;void 0!==t&&void 0!==r&&(j(""),d(t,r))},onValueCommit:e=>{let[t,r]=e;void 0!==t&&void 0!==r&&u(t,r)},disabled:M<.5,"aria-label":p.title,className:"[&_[data-slot=slider-range]]:bg-violet-600 dark:[&_[data-slot=slider-range]]:bg-white [&_[data-slot=slider-thumb]]:size-4 [&_[data-slot=slider-thumb]]:border-violet-700 dark:[&_[data-slot=slider-thumb]]:border-white [&_[data-slot=slider-track]]:h-2 [&_[data-slot=slider-track]]:bg-zinc-200 dark:[&_[data-slot=slider-track]]:bg-zinc-700"}),(0,a.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-5 w-0.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-rose-500 shadow-[0_0_8px_rgba(244,63,94,0.65)]",style:{left:"".concat(T,"%")}})]}),(0,a.jsxs)("div",{className:"flex justify-between text-[11px] font-medium tabular-nums text-zinc-500 dark:text-zinc-400",children:[(0,a.jsx)("span",{children:el(0)}),(0,a.jsx)("span",{children:el(M)})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(G.J,{htmlFor:N,className:"text-xs",children:p.start}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(Z.p,{id:N,value:b,onChange:e=>{v(e.target.value),j("")},onBlur:()=>L("start"),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),L("start"))},inputMode:"decimal","aria-invalid":!!k,placeholder:"00:00.0",className:"pr-9 font-mono tabular-nums"}),(0,a.jsxs)("div",{className:"absolute bottom-1 right-1 top-1 flex w-7 flex-col overflow-hidden rounded-md border border-zinc-200 bg-zinc-50 dark:border-white/10 dark:bg-white/[0.06]",children:[(0,a.jsx)(x.$,{type:"button",variant:"ghost",size:"icon-xs",className:"h-1/2 w-full rounded-none border-b border-zinc-200 p-0 hover:bg-zinc-200 dark:border-white/10 dark:hover:bg-white/10",onPointerDown:e=>e.preventDefault(),onClick:()=>z("start",1),"aria-label":"".concat(p.increaseTime," ").concat(p.start),children:(0,a.jsx)(q.A,{className:"size-3"})}),(0,a.jsx)(x.$,{type:"button",variant:"ghost",size:"icon-xs",className:"h-1/2 w-full rounded-none p-0 hover:bg-zinc-200 dark:hover:bg-white/10",onPointerDown:e=>e.preventDefault(),onClick:()=>z("start",-1),"aria-label":"".concat(p.decreaseTime," ").concat(p.start),children:(0,a.jsx)(K.A,{className:"size-3"})})]})]})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(G.J,{htmlFor:E,className:"text-xs",children:p.end}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(Z.p,{id:E,value:y,onChange:e=>{w(e.target.value),j("")},onBlur:()=>L("end"),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),L("end"))},inputMode:"decimal","aria-invalid":!!k,placeholder:"00:00.0",className:"pr-9 font-mono tabular-nums"}),(0,a.jsxs)("div",{className:"absolute bottom-1 right-1 top-1 flex w-7 flex-col overflow-hidden rounded-md border border-zinc-200 bg-zinc-50 dark:border-white/10 dark:bg-white/[0.06]",children:[(0,a.jsx)(x.$,{type:"button",variant:"ghost",size:"icon-xs",className:"h-1/2 w-full rounded-none border-b border-zinc-200 p-0 hover:bg-zinc-200 dark:border-white/10 dark:hover:bg-white/10",onPointerDown:e=>e.preventDefault(),onClick:()=>z("end",1),"aria-label":"".concat(p.increaseTime," ").concat(p.end),children:(0,a.jsx)(q.A,{className:"size-3"})}),(0,a.jsx)(x.$,{type:"button",variant:"ghost",size:"icon-xs",className:"h-1/2 w-full rounded-none p-0 hover:bg-zinc-200 dark:hover:bg-white/10",onPointerDown:e=>e.preventDefault(),onClick:()=>z("end",-1),"aria-label":"".concat(p.decreaseTime," ").concat(p.end),children:(0,a.jsx)(K.A,{className:"size-3"})})]})]})]})]}
1),k&&(0,a.jsx)("p",{role:"alert",className:"text-xs font-medium text-red-600 dark:text-red-400",children:k})]})]})}function es(e){var t;let{isPlaying:r,isLooping:l,currentTime:o,duration:c,loopStart:d=0,loopEnd:u=0,masterVolume:m,showVolumeBooster:p=!1,volumeBoostPercent:h=100,onTogglePlay:g,onToggleLoop:b,onSeek:v,onVolumeChange:y,onVolumeBoostChange:w,onSkipBackward:k,onSkipForward:j,onLoopStartChange:N,onLoopEndChange:E,showLoopRangeEditor:M=!1,onLoopRangePreview:C,onLoopRangeCommit:P,showLyricsButton:T=!1,isLyricsOpen:L=!1,onToggleLyrics:z,pitchTempoEnabled:S=!1,pitchTempoEngineState:A="disabled",analysisState:F,pitchSemitones:R=0,tempoRatio:D=1,sourceBpm:B=null,sourceKey:V=null,onPitchChange:_,onTempoRatioChange:O,onSourceBpmChange:U,onRetryAnalysis:I,desktopTransformControlsTarget:H=null,formatTime:q,labels:K={volume:"Volume",rewind10:"Rewind 10s",forward10:"Forward 10s",loopEnabled:"Loop enabled",enableLoop:"Enable loop",loopEditorTitle:"Loop range",loopEditorEnabled:"Enable loop",loopStart:"Start",loopEnd:"End",increaseLoopTime:"Increase",decreaseLoopTime:"Decrease",invalidLoopTime:"Enter a valid time using MM:SS.d.",invalidLoopRange:"The loop must be at least 0.5 seconds long.",lyrics:"Lyrics",pitch:"Pitch",tempo:"Tempo",detectedKey:"Detected key",detectedBpm:"Detected BPM",resultingKey:"key",semitones:"Semitones",relativeTempo:"Relative tempo",resetPitch:"Reset pitch",resetTempo:"Reset tempo",analyzing:"Analyzing",preparing:"Preparing audio engine",unavailable:"Pitch and tempo unavailable",sourceBpm:"Source BPM",halfTime:"Half",doubleTime:"Double",preparingOriginal:"Preparing original audio",detectingKeyOriginal:"Detecting key from original audio",detectingBpmOriginal:"Detecting BPM from original audio",detectingKeyStems:"Detecting key from stems",detectingBpmDrums:"Detecting BPM from drums",detectingBpmStems:"Detecting BPM from stems",preliminaryVocalKey:"Preliminary vocal key",keyUnavailable:"Key unavailable",bpmUnavailable:"BPM unavailable â enter manually",retryAnalysis:"Retry analysis"}}
1=e,[Z,G]=(0,n.useState)(!1),[X,J]=(0,n.useState)(!1),[Q,el]=(0,n.useState)(!1),[eo,es]=(0,n.useState)(null),[ec,ed]=(0,n.useState)(""),eu=(0,ee.a)(),em=(0,n.useRef)(null),ep=(0,n.useRef)(null),eh=(0,n.useRef)(null),ex=(0,n.useRef)(null),ef=(0,n.useRef)(null),eg=c>0?Math.max(0,Math.min(100,d/c*100)):0,eb=c>0?Math.max(0,Math.min(100,u/c*100)):0,ev=Math.max(0,eb-eg),ey="var(--tool-master-range-played, #ffffff)",ew="var(--tool-master-range-remainder, #3f3f46)",ek=()=>{let e=Number(ec);Number.isFinite(e)&&e>=20&&e<=300&&(null==U||U(e),ed(""))};(0,n.useEffect)(()=>{let e=e=>{var t,r;let a=e.target;(null==(t=ep.current)?void 0:t.contains(a))||(null==(r=eh.current)?void 0:r.contains(a))||es(null)},t=e=>{"Escape"===e.key&&es(null)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[]),(0,n.useEffect)(()=>()=>{ef.current&&clearTimeout(ef.current)},[]);let ej="ready"===A;"".concat(R>0?"+":"").concat(R," st");let eN=B?Math.round(B*D):null,eE=eN?"".concat(eN," BPM"):"...",eM=eN?String(eN):"...",eC=B?Math.ceil(.75*B):75,eP=B?Math.floor(1.5*B):150,eT=B?eN:Math.round(100*D),eL=(0,$.x5)(V,R),ez=eL?(0,$.P)(eL):"...",eS=null!=(t=null==eL?void 0:eL.tonic)?t:"...",eA="preparing"===A?K.preparing:"unavailable"===A?K.unavailable:void 0,eF=(null==F?void 0:F.keyStatus)||"waiting",eR=(null==F?void 0:F.bpmStatus)||"waiting",eD="preparing"===eF?K.preparingOriginal:"analyzing"===eF?(null==F?void 0:F.keyActiveSource)==="original"?K.detectingKeyOriginal:K.detectingKeyStems:"preliminary"===eF?K.preliminaryVocalKey:"failed"===eF?K.keyUnavailable:null,eB="preparing"===eR?K.preparingOriginal:"analyzing"===eR?(null==F?void 0:F.bpmActiveSource)==="original"?K.detectingBpmOriginal:(null==F?void 0:F.bpmActiveSource)==="drums"?K.detectingBpmDrums:K.detectingBpmStems:"failed"===eR?K.bpmUnavailable:null,eV=!!(H&&!eu),e_=(e,t)=>(0,a.jsx)("div",{className:"fixed inset-x-0 bottom-0 z-[95] rounded-t-[28px] border-t border-zinc-200 bg-white/98 px-5 pb-[max(1.5rem,env(safe-area-inset-bottom))] pt-5 text-zinc-900 shadow-2xl backdrop-blur-xl dark:border-white/15 dark:bg-[#0b0b0b]/98 dark:text-white md:absolute md:inset-x-auto md:w-80 md:translate-x-0 md:rounded-2xl md:border md:p-4 ".concat(eV?"md:left-auto md:right-0 md:top-full md:bottom-auto md:mt-2 md:mb-0":"md:bottom-full md:left-1/2 md:right-auto md:mb-2 md:-translate-x-1/2"," ").concat(eo===e?"block":"hidden"),role:"dialog","aria-label":"pitch"===e?K.pitch:K.tempo,children:t}),eO=(e,t)=>{if(!ex.current||c<=0)return;let r=ex.current.getBoundingClientRect(),a=Math.max(0,Math.min(1,(e-r.left)/r.width))*c;if("start"===t){null==N||N(Math.min(a,Math.max(u-.5,0)));return}null==E||E(Math.max(a,d+.5))},eU=(e,t)=>{e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),eO(e.clientX,t)};
1return(0,a.jsxs)("div",{className:"tool-master-controls p-3 md:p-4",children:[(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-3xl flex-col items-center gap-3",children:[(0,a.jsxs)("div",{className:"flex w-full items-center gap-2 md:gap-3",children:[(0,a.jsx)("span",{className:"tool-master-time text-xs md:text-sm text-slate-300 font-medium tabular-nums",children:q(o)}),(0,a.jsxs)("div",{ref:ex,className:"relative flex flex-1 items-center",children:[l&&c>0&&ev>0&&(0,a.jsxs)("div",{className:"pointer-events-none absolute left-0 right-0 top-1/2 z-20 h-7 -translate-y-1/2 lg:hidden",children:[(0,a.jsx)("div",{className:"pointer-events-none absolute top-1/2 h-5 -translate-y-1/2 rounded border border-white/50 bg-white/[0.12]",style:{left:"".concat(eg,"%"),width:"".concat(ev,"%")}}),(0,a.jsx)("button",{type:"button",className:"pointer-events-auto absolute top-1/2 h-6 w-2 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize touch-none rounded-full bg-white shadow-sm ring-1 ring-black",style:{left:"".concat(eg,"%")},"aria-label":"Adjust loop start",onPointerDown:e=>eU(e,"start"),onPointerMove:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&eO(e.clientX,"start")}}),(0,a.jsx)("button",{type:"button",className:"pointer-events-auto absolute top-1/2 h-6 w-2 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize touch-none rounded-full bg-white shadow-sm ring-1 ring-black",style:{left:"".concat(eb,"%")},"aria-label":"Adjust loop end",onPointerDown:e=>eU(e,"end"),onPointerMove:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&eO(e.clientX,"end")}})]}),(0,a.jsx)("input",{type:"range",min:"0",max:c||0,value:o,onChange:v,className:"tool-master-range master-control-white-thumb relative z-10 w-full h-1.5 bg-zinc-700 rounded-lg appearance-none cursor-pointer",style:{color:ey,background:"linear-gradient(to right, ".concat(ey," 0%, ").concat(ey," ").concat(c>0?o/c*100:0,"%, ").concat(ew," ").concat(c>0?o/c*100:0,"%, ").concat(ew," 100%)")}})]}),(0,a.jsx)("span",{className:"tool-master-time text-xs md:text-sm text-slate-300 font-medium tabular-nums",children:q(c)})]}),(0,a.jsxs)("div",{className:"relative grid w-full grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center",children:[(0,a.jsx)("div",{className:"flex min-w-0 items-center justify-start gap-2 md:gap-3",children:(()=>{let e=(0,a.jsxs)(a.Fragment,{children:[S&&(0,a.jsxs)("div",{ref:ep,className:"relative flex h-10 items-center justify-center md:h-11",children:[(0,a.jsxs)("button",{type:"button",className:"tool-master-control-button flex h-10 min-w-10 flex-col items-center justify-center gap-0.5 rounded-lg px-2 text-xs font-bold leading-none text-white transition-colors hover:bg-white/10 disabled:cursor-not-allowed disabled:opacity-45 md:h-11 md:w-28 md:flex-none md:flex-row md:gap-1 md:text-sm ".concat("pitch"===eo?"bg-white/10":""),onClick:()=>{G(!1),es(e=>"pitch"===e?null:"pitch")},disabled:!ej,title:eA||K.pitch,"aria-expanded":"pitch"===eo,children:[(0,a.jsx)(et,{}),(0,a.jsx)("span",{className:"whitespace-nowrap text-[9px] font-semibold md:hidden",children:eS}),(0,a.jsx)("span",{className:"whitespace-nowrap hidden md:inline",children:ez})]}),e_("pitch",(0,a.jsxs)("div",{className:"space-y-5 py-1",children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h3",{className:"text-xs font-semibold text-zinc-600 dark:text-white/70",children:K.resultingKey}),(0,a.jsx)("div",{className:"mt-2 flex items-center justify-center gap-2",children:(0,a.jsx)("span",{className:"rounded-full !bg-zinc-900 px-3 py-1 text-sm font-bold !text-white shadow-sm dark:!bg-white dark:!text-zinc-900",children:ez})})]}),(0,a.jsx)(ea,{value:R,min:-6,max:6,ariaLabel:K.semitones||"Semitones",onChange:e=>null==_?void 0:_(e)}),(0,a.jsx)("button",{type:"button",onClick:()=>null==_?void 0:_(0),className:"mx-auto block rounded-full px-3 py-1 text-xs font-semibold text-zinc-500 transition-colors hover:bg-black/5 hover:text-zinc-900 dark:text-white/60 dark:hover:bg-white/10 dark:hover:text-white",children:K.resetPitch}),eD&&(0,a.jsx)("p",{className:"text-center text-xs text-slate-400",children:eD}),"failed"===eF&&I&&(0,a.jsx)("button",{type:"button",onClick:I,className:"w-full rounded-lg border border-zinc-300 px-3 py-2 text-xs font-semibold text-zinc-700 hover:bg-zinc-100 dark:border-white/15 dark:text-white dark:hover:bg-white/10",children:K.retryAnalysis})]}))]}),S&&(0,a.jsxs)("div",{ref:eh,className:"relative flex h-10 items-center justify-center md:h-11",children:[(0,a.jsxs)("button",{type:"button",className:"tool-master-control-button flex h-10 min-w-10 flex-col items-center justify-center gap-0.5 rounded-lg px-2 text-xs font-bold leading-none text-white transition-colors hover:bg-white/10 disabled:cursor-not-allowed disabled:opacity-45 md:h-11 md:w-28 md:flex-none md:flex-row md:gap-1 md:text-sm ".concat("tempo"===eo?"bg-white/10":""),onClick:()=>{G(!1),es(e=>"tempo"===e?null:"tempo")},disabled:!ej,title:eA||K.tempo,"aria-expanded":"tempo"===eo,children:[(0,a.jsx)(er,{}),(0,a.jsx)("span",{className:"whitespace-nowrap text-[9px] font-semibold md:hidden",children:eM}),(0,a.jsx)("span",{className:"hidden md:inline",children:eE})]}),e_("tempo",(0,a.jsxs)("div",{className:"space-y-5 py-1",children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h3",{className:"text-xs font-semibold text-zinc-600 dark:text-white/70",children:B?"BPM":K.relativeTempo}),(0,a.jsx)("div",{className:"mt-2 flex items-center justify-center gap-2",children:(0,a.jsx)("span",{className:"rounded-full !bg-zinc-900 px-3 py-1 text-sm font-bold tabular-nums !text-white shadow-sm dark:!bg-white dark:!text-zinc-900",children:B?eN:"".concat(Math.round(100*D),"%")})})]}),(0,a.jsx)(ea,{value:eT,min:eC,max:eP,ariaLabel:B?K.detectedBpm||"Detected BPM":K.relativeTempo||"Relative tempo",onChange:e=>null==O?void 0:O(B?e/B:e/100)}),!B&&(0,a.jsxs)("label",{className:"mx-auto block max-w-36 space-y-1 text-center text-xs text-zinc-500 dark:text-white/55",children:[(0,a.jsx)("span",{children:K.sourceBpm}),(0,a.jsx)("input",{type:"number",min:20,max:300,step:.1,value:ec,onChange:e=>ed(e.target.value),onBlur:ek,onKeyDown:e=>{"Enter"===e.key&&ek()},className:"w-full rounded-full border border-zinc-300 bg-zinc-100 px-3 py-1.5 text-center text-sm font-semibold text-zinc-900 outline-none placeholder:text-zinc-400 focus:border-violet-500 dark:border-white/15 dark:bg-white/[0.06] dark:text-white dark:placeholder:text-white/35",placeholder:"BPM"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>null==O?void 0:O(1),className:"mx-auto block rounded-full px-3 py-1 text-xs font-semibold text-zinc-500 transition-colors hover:bg-black/5 hover:text-zinc-900 dark:text-white/60 dark:hover:bg-white/10 dark:hover:text-white",children:K.resetTempo}),eB&&(0,a.jsx)("p",{className:"text-center text-xs text-slate-400",children:eB}
1),"failed"===eR&&I&&(0,a.jsx)("button",{type:"button",onClick:I,className:"w-full rounded-lg border border-zinc-300 px-3 py-2 text-xs font-semibold text-zinc-700 hover:bg-zinc-100 dark:border-white/15 dark:text-white dark:hover:bg-white/10",children:K.retryAnalysis})]}))]})]});return eV&&H?(0,W.createPortal)((0,a.jsx)("div",{className:"flex items-center gap-2",children:e}),H):e})()}),(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 md:gap-3",children:[(0,a.jsx)("div",{ref:em,className:"hidden md:block",children:(0,a.jsxs)(Y.AM,{open:Z,onOpenChange:e=>{G(e),e&&J(!1)},children:[(0,a.jsx)(Y.Wv,{asChild:!0,children:(0,a.jsx)(x.$,{type:"button",variant:"ghost",size:"icon-lg",className:"tool-master-control-button text-white ".concat(Z?"bg-white/10":"hover:bg-white/10"),title:K.volume,"aria-label":K.volume,children:(0,a.jsx)("svg",{className:"size-7",fill:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"})})})}),(0,a.jsx)(Y.hl,{side:"top",align:"center",sideOffset:8,className:"tool-master-volume-popover z-[110] w-12 items-center overflow-hidden border border-white/10 bg-[#0b0b0b]/95 p-3 shadow-xl ring-1 ring-white/10",children:(0,a.jsx)(f.A,{orientation:"vertical",min:0,max:1,step:.01,value:[m],onValueChange:e=>{let[t]=e;return y(t)},"aria-label":K.volume,className:"h-24! min-h-0! [&_[data-slot=slider-range]]:bg-white [&_[data-slot=slider-track]]:bg-zinc-700"})})]})}),(0,a.jsxs)(i.P.button,{className:"tool-master-control-button flex-shrink-0 hover:bg-white/10 rounded-lg transition-colors relative w-10 h-10 md:w-11 md:h-11 flex items-center justify-center",whileHover:{scale:1.05},whileTap:{scale:.95},onClick:k,title:K.rewind10,children:[(0,a.jsxs)("svg",{className:"tool-master-control-icon w-9 h-9 md:w-12 md:h-12 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 32 32",strokeWidth:2.2,children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 8 A8 8 0 1 1 8 16"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 8 l2 -2 m-2 2 l2 2"})]}),(0,a.jsx)("span",{className:"tool-master-control-inline-label absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-xs md:text-xs font-bold text-slate-100 pointer-events-none",children:"10"})]}),(0,a.jsx)(i.P.button,{className:"flex-shrink-0 w-14 h-14 md:w-14 md:h-14 rounded-full bg-[#ffffff] flex items-center justify-center text-[#020617] shadow-[0_12px_30px_rgba(0,0,0,0.35)]",whileHover:{scale:1.05},whileTap:{scale:.95},onClick:g,children:r?(0,a.jsx)("svg",{className:"w-7 h-7 md:w-6 md:h-6",fill:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M6 4h4v16H6V4zm8 0h4v16h-4V4z"})}):(0,a.jsx)("svg",{className:"w-7 h-7 md:w-6 md:h-6 ml-0.5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M8 5v14l11-7z"})})}),(0,a.jsxs)(i.P.button,{className:"tool-master-control-button flex-shrink-0 hover:bg-white/10 rounded-lg transition-colors relative w-10 h-10 md:w-11 md:h-11 flex items-center justify-center",whileHover:{scale:1.05},whileTap:{scale:.95},onClick:j,title:K.forward10,children:[(0,a.jsxs)("svg",{className:"tool-master-control-icon w-9 h-9 md:w-12 md:h-12 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 32 32",strokeWidth:2.2,children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 8 A8 8 0 1 0 24 16"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 8 l-2 -2 m2 2 l-2 2"})]}),(0,a.jsx)("span",{className:"tool-master-control-inline-label absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-xs md:text-xs font-bold text-slate-100 pointer-events-none",children:"10"})]}),M&&C&&P?(0,a.jsx)(ei,{isLooping:l,currentTime:o,duration:c,loopStart:d,loopEnd:u,onToggleLoop:b,onPreview:C,onCommit:P,onOpen:()=>{G(!1),es(null)},labels:{title:K.loopEditorTitle||"Loop range",enabled:K.loopEditorEnabled||K.enableLoop,start:K.loopStart||"Start",end:K.loopEnd||"End",increaseTime:K.increaseLoopTime||"Increase",decreaseTime:K.decreaseLoopTime||"Decrease",invalidTime:K.invalidLoopTime||"Enter a valid time using MM:SS.d.",invalidRange:K.invalidLoopRange||"The loop must be at least 0.5 seconds long.",enableLoop:K.enableLoop,loopEnabled:K.loopEnabled}}):(0,a.jsx)(i.P.button,{type:"button",className:"tool-master-control-button hidden h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg text-white transition-colors md:flex md:h-11 md:w-11 ".concat(l?"bg-white/[0.12] shadow-[0_0_18px_rgba(255,255,255,0.12)]":"hover:bg-white/10"),whileHover:{scale:1.05},whileTap:{scale:.95},onClick:b,title:l?K.loopEnabled:K.enableLoop,"aria-label":l?K.loopEnabled:K.enableLoop,"aria-pressed":l,children:(0,a.jsx)(en,{})})]}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center justify-end",children:[p&&w&&(0,a.jsxs)(Y.AM,{open:X,onOpenChange:e=>{J(e),e&&(G(!1),es(null))},children:[(0,a.jsx)(Y.Wv,{asChild:!0,children:(0,a.jsx)(x.$,{type:"button",variant:"ghost",size:"icon-lg",className:"tool-master-control-button relative text-white transition-all hover:bg-blue-500 ".concat(X||h>100?" bg-blue-500 ring-2 ring-blue-300/50":"border-blue-400/80 bg-blue-600 ring-1 ring-blue-300/30"),title:"Volume booster: ".concat(h,"%"),"aria-label":"Volume booster, ".concat(h,"%"),"aria-expanded":X,children:(0,a.jsxs)("svg",{className:"size-7",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.8,"aria-hidden":"true",children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 9v6h4l5 4V5L8 9H4Z"}),(0,a.jsx)("path",{strokeLinecap:"round",d:"M18 8v8M14 12h8"})]})})}),(0,a.jsx)(Y.hl,{side:"top",align:"end",sideOffset:8,className:"tool-master-volume-popover z-[110] w-12 items-center overflow-hidden border border-white/10 bg-[#0b0b0b]/95 p-3 shadow-xl ring-1 ring-white/10",children:(0,a.jsx)(f.A,{orientation:"vertical",min:100,max:300,step:5,value:[h],onValueChange:e=>{let[t]=e;null==w||w(t),!(t<=100)&&(el(!0),ef.current&&clearTimeout(ef.current),ef.current=setTimeout(()=>{el(!1),ef.current=null},3e3))},"aria-label":"Volume booster","aria-valuetext":"".concat(h,"%"),className:"h-24! min-h-0! [&_[data-slot=slider-range]]:bg-blue-400 [&_[data-slot=slider-track]]:bg-zinc-700"})})]}),T&&(0,a.jsx)(i.P.button,{type:"button",className:"tool-master-lyrics-button flex h-9 items-center justify-center rounded-md bg-white/80 px-4 text-sm font-bold text-[#020617] transition-colors hover:bg-slate-100 md:h-10 md:px-5 md:text-base ".concat(L?"bg-white/99 ring-2 ring-white/40":""),whileHover:{scale:1.03},whileTap:{scale:.97},onClick:z,"aria-pressed":L,title:K.lyrics||"Lyrics",children:K.lyrics||"Lyrics"})]})]})]}),"undefined"!=typeof document&&(0,W.createPortal)((0,a.jsx)(s.N,{children:Q&&(0,a.jsx)(i.P.div,{role:"status",initial:{opacity:0,x:96}
1,animate:{opacity:1,x:0},exit:{opacity:0,x:96},transition:{duration:.25,ease:"easeOut"},className:"fixed bottom-4 right-4 z-[200] max-w-[calc(100vw-2rem)] rounded-xl border border-amber-400/40 bg-[#111111]/95 px-4 py-3 text-sm font-medium text-amber-200 shadow-2xl backdrop-blur md:bottom-6 md:right-6 md:max-w-sm",children:"Peak protection is active to keep higher boost levels clear."},"volume-boost-warning")}),document.body)]})}var ec=r(55892),ed=r(61681),eu=r(87597),em=r(15308),ep=r(50368),eh=r(73385),ex=r(3273),ef=r(46395),eg=r(62879);let eb="music-analysis-v2";async function ev(e){let t=await (0,eg.ve)(e,eb);if(!t)return null;try{let r=JSON.parse(await t.blob.text());return(null==r?void 0:r.schemaVersion)===2&&r.requestId===e?r:null}catch(e){return null}}async function ey(e,t){let r=new Blob([JSON.stringify(t)],{type:"application/json"});await (0,eg.oC)(e,eb,r)}function ew(e){return e.map(e=>({sampleRate:e.sampleRate,mono:e.mono.slice()}))}async function ek(e,t){if(0===e.length||0===t.length)return[];let r=window.OfflineAudioContext||window.webkitOfflineAudioContext;if(!r)throw Error("offline-audio-context-unavailable");let a=new r(1,Math.max(1,Math.ceil(44100*Math.min(60,t.reduce((e,t)=>e+t.duration,0)))),44100),n=1/e.length,l=0;for(let r of t){for(let t of e){var o;let e=Math.max(0,t.buffer.duration-r.start),i=Math.min(r.duration,e);if(i<5)continue;let s=a.createBufferSource(),c=a.createGain();s.buffer=t.buffer,c.gain.value=null!=(o=t.gain)?o:n,s.connect(c),c.connect(a.destination),s.start(l,r.start,i)}l+=r.duration}let i=(await a.startRendering()).getChannelData(0),s=[],c=0;for(let e of t){let t=Math.min(i.length-c,Math.floor(44100*e.duration));t>=220500&&s.push({sampleRate:44100,mono:i.slice(c,c+t)}),c+=Math.floor(44100*e.duration)}return s}let ej={key:12e3,bpm:18e3},eN={key:6e3,bpm:9e3},eE={status:"idle",automatic:null,correctedBpm:null,correctedKey:null,keyStatus:"waiting",bpmStatus:"waiting"};function eM(e){let t=[e.keyStatus,e.bpmStatus];if(t.includes("preparing"))return"preparing";if(t.includes("analyzing"))return"analyzing";let r=t.filter(e=>"ready"===e).length;return 2===r?"ready":r>0||t.includes("preliminary")?"partial":t.every(e=>"failed"===e)?"failed":"idle"}function eC(e,t,r,a){let n="key"===t?{...e,keyStatus:r,keyErrorCode:a}:{...e,bpmStatus:r,bpmErrorCode:a};return{...n,status:eM(n)}}function eP(e,t){for(let r of t){let t=e.get(r);if(t)return[r,t]}for(let r of e)if(t.some(e=>r[0].toLowerCase().includes(e)))return r;return null}function eT(e){let t=[],r=new Set;for(let a of["others","other","instrumental","vocal","vocals","bass","guitar","piano"]){let n=eP(e,[a]);!n||r.has(n[0])||n[0].toLowerCase().includes("drum")||(t.push(n),r.add(n[0]))}return t}async function eL(e){let t=window.AudioContext||window.webkitAudioContext;if(!t)throw Error("audio-context-unavailable");let r=new t({sampleRate:44100}),a=0;try{let t=e.arrayBuffer().then(e=>r.decodeAudioData(e.slice(0))),n=new Promise((e,t)=>{a=window.setTimeout(()=>t(Error("original-decode-timeout")),12e3)});return await Promise.race([t,n])}finally{window.clearTimeout(a),await r.close().catch(()=>void 0)}}async function ez(e){let t=function(e){if(!Number.isFinite(e)||e<5)return[];if(e>=100)return[.2,.5,.8].map(t=>({start:Math.max(0,Math.min(e-20,e*t-10)),duration:20}));let t=e>=40?3:e>=20?2:1,r=e/t,a=Math.min(20,r);return Array.from({length:t},(e,t)=>({start:t*r+Math.max(0,(r-a)/2),duration:a}))}(Math.min(...e.map(e=>e.buffer.duration)));if(0===t.length)throw Error("analysis-source-too-short");let r=ek(e,t),a=0;try{return await Promise.race([r,new Promise((e,t)=>{a=window.setTimeout(()=>t(Error("analysis-preparation-timeout")),12e3)})])}finally{window.clearTimeout(a)}}var eS=r(46658),eA=r(68999),eF=r(18068),eR=r(97502),eD=r(18433),eB=r(5396);async function eV(e,t){let r,a;if(e.numberOfChannels<1||e.numberOfChannels>2)throw Error("Clean voice export supports mono or stereo preview audio only.");let n=window.OfflineAudioContext||window.webkitOfflineAudioContext;if(!n)throw Error("Accurate clean voice export is not available in this browser.");try{r=new n(e.numberOfChannels,e.length,e.sampleRate)}catch(e){throw Error("This recording is too large to render accurately. Close other tabs and retry.")}let l=r.createBufferSource();l.buffer=e;let o=(0,eB.Se)(r,r.destination,t,!0);l.connect(o.input),l.start(0);try{a=await r.startRendering()}catch(e){throw Error("The browser could not render this clean voice accurately. Close other tabs and retry.")}let i=Array.from({length:a.numberOfChannels},(e,t)=>a.getChannelData(t));return new Blob([(0,eR.RP)(i,a.sampleRate)],{type:"audio/wav"})}async function e_(e){var t,r,a;let{decodedCleanVoice:n,volumeBoostPercent:l,format:o,sourceVideo:i,onProgress:s,signal:c}=e;if(null==c?void 0:c.aborted)throw null!=(t=c.reason)?t:new DOMException("E
1xport cancelled.","AbortError");let d=44+n.length*n.numberOfChannels*3+("mp4"===o&&null!=(r=null==i?void 0:i.size)?r:0),u=(0,eD.f4)(d);if(u)throw new eD.I6("memory_limit",u,{recoverable:!1});null==s||s(5);let m=await eV(n,l);if(null==c?void 0:c.aborted)throw null!=(a=c.reason)?a:new DOMException("Export cancelled.","AbortError");if(null==s||s(25),"wav"===o)return null==s||s(100),m;if("mp4"===o&&!i)throw Error("The original video is unavailable. Choose an audio format or retry from the video result.");let p=m.size+("mp4"===o?i.size:0),h=(0,eD.f4)(p);if(h)throw new eD.I6("memory_limit",h,{recoverable:!1});return(0,eD.U2)({operation:"mp4"===o?"noise-remover-video-export":"noise-remover-audio-export",inputBytes:p,signal:c,onProgress:s?e=>s(Math.max(25,Math.round(25+75*e))):void 0},async e=>{let{ffmpeg:t,jobId:r,exec:a}=e,n=(0,eD.vw)(r,"clean-voice-preview-render","wav"),l=(0,eD.vw)(r,"source-video"),d=(0,eD.vw)(r,"output",o),u=[n,l,d];try{if(await t.writeFile(n,await (0,eF.t2)(m),{signal:c}),"mp4"===o){await t.writeFile(l,await (0,eF.t2)(i),{signal:c}),await a(["-i",l,"-i",n,"-map","0:v:0","-map","1:a:0","-c:v","copy","-c:a","aac","-b:a","192k","-shortest","-movflags","+faststart",d]);let e=await t.readFile(d,void 0,{signal:c});return null==s||s(100),new Blob([new Uint8Array(e)],{type:"video/mp4"})}let e="m4a"===o?{extension:"m4a",mimeType:"audio/mp4",arguments:["-c:a","aac","-b:a","192k","-movflags","+faststart"]}:{extension:"mp3",mimeType:"audio/mpeg",arguments:["-c:a","libmp3lame","-b:a","192k"]};await a(["-i",n,"-vn",...e.arguments,d]);let r=await t.readFile(d,void 0,{signal:c});return null==s||s(100),new Blob([new Uint8Array(r)],{type:e.mimeType})}finally{await (0,eD.rX)(t,u)}})}var eO=r(54161),eU=r(67565),eI=r(22411),eH=r(88654),eW=r(47605);let eq="vocal-lyrics-json";async function eK(e,t){let r=new Blob([JSON.stringify(t)],{type:"application/json"});await (0,eg.oC)(e,eq,r)}async function e$(e){let t=await (0,eg.ve)(e,eq);return t?JSON.parse(await t.blob.text()):null}var eY=r(27524),eZ=r.n(eY);async function eG(e){if(0===e.length)throw Error("No stems are available to add to the ZIP export.");let t=new(eZ());return e.forEach(e=>{let{fileName:r,blob:a}=e;return t.file(r,a)}),t.generateAsync({type:"blob",compression:"DEFLATE"})}var eX=r(1726),eJ=r(86106);function eQ(e){if(!Number.isFinite(e)||e<0)return"00:00";let t=Math.floor(e),r=Math.floor(t/60);return"".concat(r.toString().padStart(2,"0"),":").concat((t%60).toString().padStart(2,"0"))}let e0=["loading-cache","preparing-vocal","uploading","generating","downloading"],e1={freeUsersCanViewFullLyrics:!0,freeUsersCanAccessFullAudio:!0,freeUserLyricsPreviewRatio:.3,freeUserAudioAccessRatio:.3};function e2(e){return new Promise(t=>window.setTimeout(t,e))}function e4(e){return Array.isArray(null==e?void 0:e.words)?e.words:[]}function e3(e){return"word"===e.type}function e5(e){return(e||"").trim().toUpperCase()}function e6(e,t){return{requestId:(null==e?void 0:e.requestId)||t,status:e5(null==e?void 0:e.status)||"PENDING",progress:"number"==typeof(null==e?void 0:e.progress)?e.progress:0,lyricsDownloadUrl:(null==e?void 0:e.lyricsDownloadUrl)||null}}async function e8(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;for(let a=0;a<r;a+=1){let r=await (0,eg.ve)(e,"stem-".concat(t)).catch(()=>null);if(null==r?void 0:r.blob)return r.blob;await e2(150)}return null}function e7(){return(0,a.jsxs)("div",{className:"relative mb-4 h-28 w-36 md:mb-6 md:h-36 md:w-48","aria-label":"Processing audio",children:[(0,a.jsx)("div",{className:"absolute inset-x-0 top-0 h-24 md:h-28","aria-hidden":"true",children:[{value:"â©",left:"24%",delay:0,size:"text-2xl md:text-4xl",drift:-16},{value:"âª",left:"34%",delay:.8,size:"text-3xl md:text-5xl",drift:10},{value:"â«",left:"46%",delay:.48,size:"text-4xl md:text-6xl",drift:-8},{value:"â¬",left:"59%",delay:.64,size:"text-3xl md:text-5xl",drift:14},{value:"â",left:"68%",delay:.8,size:"text-2xl md:text-4xl",drift:-12},{value:"â®",left:"39%",delay:.96,size:"text-2xl md:text-4xl",drift:16},{value:"â¯",left:"54%",delay:1.12,size:"text-3xl md:text-5xl",drift:-14},{value:"â«",left:"66%",delay:1.24,size:"text-2xl md:text-4xl",drift:8}].map((e,t)=>(0,a.jsx)(i.P.span,{className:"absolute bottom-0 font-bold text-white-600/80 ".concat(e.size),style:{left:e.left},initial:{y:-10,opacity:0,scale:.75,rotate:-8},animate:{y:[-10,-90,-180],opacity:[0,1,0],scale:[.75,1,.75],rotate:[-8,6,-4]},transition:{duration:1.25,repeat:1/0,delay:e.delay,ease:"easeOut"},children:e.value},"".concat(e.value,"-").concat(t)))}),(0,a.jsx)(i.P.img,{src:"/images/pan.svg",alt:"","aria-hidden":"true",className:"absolute bottom-0 left-1/2 h-20 w-28 -translate-x-1/2 object-contain md:h-32 md:w-44",animate:{rotate:[-7,7,-7],x:[-2,2,-2]},transition:{duration:1.1,repeat:1/0,ease:"easeInOut"}})]})}function e9(e){var t,r;let{words:l,suffix:o}
1=e,[c,d]=(0,n.useState)(0),u=null!=(t=l[c])?t:l[0],m=null!=(r=null==u?void 0:u.durationMs)?r:1800;return(0,n.useEffect)(()=>{if(l.length<=1)return;let e=window.setTimeout(()=>{d(e=>(e+1)%l.length)},m);return()=>window.clearTimeout(e)},[m,c,l.length]),(0,a.jsx)("h2",{className:"mb-2 flex items-center justify-center gap-2 text-2xl font-bold text-gray-900 md:gap-3 md:text-3xl",children:(0,a.jsx)("span",{className:"relative inline-flex h-[1.25em] w-[7.9em] overflow-hidden align-bottom",children:(0,a.jsx)(s.N,{mode:"wait",initial:!1,children:(0,a.jsx)(i.P.span,{className:"absolute inset-0 inline-flex items-center justify-center",initial:{y:"100%",opacity:0},animate:{y:"0%",opacity:1},exit:{y:"-100%",opacity:0},transition:{duration:.42,ease:"easeInOut"},children:u.text},u.text)})})})}function te(e){let{file:t,copy:r,onTimeChange:l}=e,o=(0,n.useRef)(null),[s,c]=(0,n.useState)(""),[d,u]=(0,n.useState)(!1),[m,p]=(0,n.useState)(0),[h,g]=(0,n.useState)(0),[b,v]=(0,n.useState)(.5),[y,w]=(0,n.useState)(!1),k=(0,n.useRef)(l),j=t.type.startsWith("video/");(0,n.useEffect)(()=>{k.current=l},[l]),(0,n.useEffect)(()=>{var e;let r=URL.createObjectURL(t);return u(!1),p(0),g(0),null==(e=k.current)||e.call(k,0),c(r),()=>{let e=o.current;if(e&&Number.isFinite(e.currentTime)&&e.currentTime>0){var t;null==(t=k.current)||t.call(k,e.currentTime)}URL.revokeObjectURL(r)}},[t]),(0,n.useEffect)(()=>{let e=o.current;e&&(e.volume=b)},[b]),(0,n.useEffect)(()=>{let e=o.current;if(!e||!s)return;let t=!1,r=async()=>{try{await e.play(),t||u(!0)}catch(e){console.error("Could not autoplay original audio:",e),t||u(!1)}};return e.readyState>=HTMLMediaElement.HAVE_METADATA?r():e.addEventListener("loadedmetadata",r,{once:!0}),()=>{t=!0,e.removeEventListener("loadedmetadata",r)}},[s]);let N=()=>{var e;let t=o.current;if(!t)return;let r=Number.isFinite(t.currentTime)&&t.currentTime>0?t.currentTime:0;g(Number.isFinite(t.duration)&&t.duration>0?t.duration:0),p(r),null==(e=k.current)||e.call(k,r)},E=async()=>{let e=o.current;if(e)if(e.paused)try{await e.play(),u(!0)}catch(e){console.error("Could not play original audio:",e),u(!1)}else e.pause(),u(!1)},M=e=>{var t;let r=o.current;if(!r)return;let a=Math.max(0,Math.min(h||r.duration||0,r.currentTime+e));r.currentTime=a,p(a),null==(t=k.current)||t.call(k,a)},C=h>0?m/h*100:0,P=Math.round(100*b),T=j?(0,a.jsx)("video",{ref:e=>{o.current=e},src:s,preload:"metadata",className:"hidden",onLoadedMetadata:N,onTimeUpdate:N,onPause:()=>{u(!1),N()},onPlay:()=>u(!0),onEnded:()=>u(!1)}):(0,a.jsx)("audio",{ref:e=>{o.current=e},src:s,preload:"metadata",onLoadedMetadata:N,onTimeUpdate:N,onPause:()=>{u(!1),N()},onPlay:()=>u(!0),onEnded:()=>u(!1)});return(0,a.jsxs)("div",{className:"w-full max-w-3xl rounded-lg border border-gray-200 bg-white p-3 text-left shadow-sm md:p-4",children:[T,(0,a.jsxs)("div",{className:"mb-3 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 md:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]",children:[(0,a.jsxs)("div",{className:"col-span-2 min-w-0 md:col-span-1",children:[(0,a.jsx)("p",{className:"truncate text-sm font-semibold text-gray-900",children:r.title}),(0,a.jsx)("p",{className:"truncate text-xs text-gray-500 md:text-sm",children:t.name||r.subtitle})]}),(0,a.jsxs)("div",{className:"col-span-2 col-start-1 row-start-2 flex items-center justify-center gap-2 md:col-span-1 md:col-start-auto md:row-start-auto md:gap-3",children:[(0,a.jsxs)(i.P.button,{type:"button",className:"relative flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg transition-colors hover:bg-gray-100 md:h-11 md:w-11",whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>M(-10),title:r.rewind10,children:[(0,a.jsxs)("svg",{className:"h-9 w-9 text-gray-400 md:h-12 md:w-12",fill:"none",stroke:"currentColor",viewBox:"0 0 32 32",strokeWidth:2.2,"aria-hidden":"true",children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 8 A8 8 0 1 1 8 16"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 8 l2 -2 m-2 2 l2 2"})]}),(0,a.jsx)("span",{className:"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-xs font-bold text-gray-800",children:"10"})]}),(0,a.jsx)(i.P.button,{type:"button",onClick:E,className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-r from-purple-600 to-blue-600 text-white shadow-md",whileHover:{scale:1.05},whileTap:{scale:.95},"aria-label":d?r.pause:r.play,children:d?(0,a.jsx)("svg",{className:"h-6 w-6",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M6 4h4v16H6V4zm8 0h4v16h-4V4z"})}):(0,a.jsx)("svg",{className:"ml-0.5 h-6 w-6",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M8 5v14l11-7z"})})}),(0,a.jsxs)(i.P.button,{type:"button",className:"relative flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg transition-colors hover:bg-gray-100 md:h-11 md:w-11",whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>M(10),title:r.forward10,children:[(0,a.jsxs)("svg",{className:"h-9 w-9 text-gray-400 md:h-12 md:w-12",fill:"none",stroke:"currentColor",viewBox:"0 0 32 32",strokeWidth:2.2,"aria-hidden":"true",children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 8 A8 8 0 1 0 24 16"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 8 l-2 -2 m2 2 l-2 2"})]}),(0,a.jsx)("span",{className:"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-xs font-bold text-gray-800",children:"10"})]})]}),(0,a.jsx)("div",{className:"col-start-2 row-start-2 flex justify-end md:col-start-auto md:row-start-auto",children:(0,a.jsxs)(Y.AM,{open:y,onOpenChange:w,children:[(0,a.jsx)(Y.Wv,{asChild:!0,children:(0,a.jsx)(x.$,{type:"button",variant:"ghost",size:"icon-lg",className:"text-gray-600 ".concat(y?"bg-gray-200":"hover:bg-gray-100"),title:"".concat(r.volume,": ").concat(P,"%"),"aria-label":r.volume,children:(0,a.jsx)("svg",{className:"size-7",fill:y?"#8200DB":"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"})})})}),(0,a.jsx)(Y.hl,{side:"top",className:"h-32 w-12 items-center bg-white px-3 py-4",children:(0,a.jsx)(f.A,{orientation:"vertical",min:0,max:1,step:.
101,value:[b],onValueChange:e=>{let[t]=e;return v(t)},className:"h-24 min-h-24 [&_[data-slot=slider-range]]:bg-blue-500","aria-label":r.volume})})]})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 md:gap-3",children:[(0,a.jsx)("span",{className:"w-11 text-right text-xs font-medium text-gray-600 tabular-nums md:text-sm",children:eQ(m)}),(0,a.jsx)("input",{type:"range",min:0,max:h||0,step:.1,value:Math.min(m,h||0),onChange:e=>{var t;let r=o.current,a=Number(e.target.value);r&&(r.currentTime=a,p(a),null==(t=k.current)||t.call(k,a))},className:"h-1.5 min-w-0 flex-1 cursor-pointer appearance-none rounded-lg bg-gray-200",style:{color:"#8B5CF6",background:"linear-gradient(to right, #8B5CF6 0%, #8B5CF6 ".concat(C,"%, #e5e7eb ").concat(C,"%, #e5e7eb 100%)")},"aria-label":r.seek,disabled:!h}),(0,a.jsx)("span",{className:"w-11 text-xs font-medium text-gray-600 tabular-nums md:text-sm",children:eQ(h)})]})]})}function tt(){var e;let t=(0,l.useRouter)(),{setIsCollapsed:d}=(0,em.c)(),{user:u,isAuthenticated:m}=(0,ec.A)(),{visitorId:p}=(0,ed.u)(),{getJobStatus:h,startNewJob:x}=(0,eu.P)(),{requestId:f,type:g,mediaType:b}=t.query,v=t.pathname.startsWith("/fr/"),y=t.pathname.includes("audio-noise-remover-processing"),w=(0,n.useMemo)(()=>y?{words:[{text:"Processing",durationMs:4e3},{text:"Cleaning",durationMs:4e3},{text:"Reducing noise",durationMs:4e3},{text:"Isolating voice",durationMs:4e3},{text:"Preparing",durationMs:4e3},{text:"Finalizing",durationMs:4e3}],suffix:" Your Audio"}:v?{words:[{text:"T\xe9l\xe9versement",durationMs:4e3},{text:"File",durationMs:4e3},{text:"Analyse",durationMs:4e3},{text:"D\xe9tection",durationMs:4e3},{text:"S\xe9paration",durationMs:4e3},{text:"Isolation",durationMs:4e3},{text:"Extraction",durationMs:4e3},{text:"Voix",durationMs:4e3},{text:"Batterie",durationMs:4e3},{text:"Basse",durationMs:4e3},{text:"Instruments",durationMs:4e3},{text:"Pr\xe9paration",durationMs:4e3},{text:"Encodage",durationMs:4e3},{text:"Synchronisation",durationMs:4e3},{text:"Finalisation",durationMs:4e3}],suffix:" de votre audio"}:{words:[{text:"Uploading",durationMs:4e3},{text:"Queuing",durationMs:4e3},{text:"Analyzing",durationMs:4e3},{text:"Detecting",durationMs:4e3},{text:"Separating",durationMs:4e3},{text:"Isolating",durationMs:4e3},{text:"Extracting",durationMs:4e3},{text:"Vocals",durationMs:4e3},{text:"Drums",durationMs:4e3},{text:"Bass",durationMs:4e3},{text:"Instruments",durationMs:4e3},{text:"Preparing",durationMs:4e3},{text:"Encoding",durationMs:4e3},{text:"Syncing",durationMs:4e3},{text:"Finalizing",durationMs:4e3}],suffix:" Your Audio"},[v,y]),k=v?{seoTitle:"Traitement - S\xe9paration musicale",layoutTitle:"S\xe9paration musicale",layoutDescription:"S\xe9paration musicale propuls\xe9e par IA",preparingTitle:"Pr\xe9paration de votre audio",processingTitle:"Traitement de votre audio",preparingDescription:"Pr\xe9paration de vos pistes s\xe9par\xe9es...",processingDescription:"Veuillez patienter pendant la s\xe9paration de vos pistes...",originalPlayer:{title:"Audio original",subtitle:"Ecouter pendant le traitement",play:"Lire l audio original",pause:"Mettre en pause l audio original",seek:"Se deplacer dans l audio original",volume:"Volume de l audio original",rewind10:"Reculer de 10 s",forward10:"Avancer de 10 s"},complete:"termin\xe9",back:"Retour",export:"Exporter",previewBadge:"APER\xc7U",previewTitle:"Aper\xe7u de 30 secondes",previewDescription:e=>"Vous consultez un aper\xe7u des 30 premi\xe8res secondes de votre audio original de ".concat(e,"."),previewCta:" Le r\xe9sultat vous convient ? Cliquez sur le bouton ci-dessous pour traiter lâaudio complet.",processFullAudio:"Traiter lâaudio complet",loginToProcessFullAudio:"Connectez-vous pour traiter lâaudio complet",processingFullAudio:"Traitement de lâaudio complet",fullAudioProgress:e=>"T\xe9l\xe9versement et pr\xe9paration de votre audio de ".concat(e,"..."),mergingVideo:"Fusion de la vid\xe9o",mergingVideoDescription:"Fusion des pistes audio avec votre vid\xe9o...",downloadStarts:"Le t\xe9l\xe9chargement commencera automatiquement d\xe8s que le fichier sera pr\xeat",insufficientCredits:"Cr\xe9dits insuffisants",cancel:"Annuler",buyCredits:"Acheter des cr\xe9dits",processingFailed:"\xc9chec du traitement",tryAgain:"R\xe9essayer",refreshUrls:"Actualiser les URL",redownloadStems:"Ret\xe9l\xe9charger les stems",notEnoughCredits:(e,t,r)=>"Il vous reste ".concat(e," minute").concat(1!==e?"s":"",", mais cet audio de ").concat(t," n\xe9cessite ").concat(r," minute").concat(1!==r?"s":"","."),extractVideoError:"Impossible dâextraire lâaudio de la vid\xe9o. Veuillez r\xe9essayer.",tracksPreparingError:"Les pistes sont encore en pr\xe9paration. Ret\xe9l\xe9chargez les stems manquants puis r\xe9essayez.",noValidTracks:"Aucune piste valide s\xe9lectionn\xe9e",noTracksAvailable:"Aucune piste disponible",exportVideoError:"\xc9chec de lâexport vid\xe9o. Veuillez r\xe9essayer.",process
1FullError:"\xc9chec du traitement de lâaudio complet. Veuillez r\xe9essayer.",noVocalTrack:"Piste vocale indisponible",genericProcessingError:"Impossible de pr\xe9parer les pistes audio. Veuillez r\xe9essayer.",separationLabels:{MODE_0:"2 pistes",MODE_1:"4 pistes",MODE_2:"6 pistes",MODE_3:"Hi-Fi 2 pistes"},trackLabels:{vocal:"Voix",drums:"Batterie",bass:"Basse",guitar:"Guitare",piano:"Piano",others:"Autres"},playback:{volume:"Volume",rewind10:"Reculer de 10 s",forward10:"Avancer de 10 s",loopEnabled:"Boucle activ\xe9e",enableLoop:"Activer la boucle",loopEditorTitle:"Plage de boucle",loopEditorEnabled:"Activer la boucle",loopStart:"D\xe9but",loopEnd:"Fin",increaseLoopTime:"Augmenter",decreaseLoopTime:"Diminuer",invalidLoopTime:"Saisissez une dur\xe9e valide au format MM:SS.d.",invalidLoopRange:"La boucle doit durer au moins 0,5 seconde.",lyrics:"Paroles",pitch:"Hauteur",tempo:"Tempo",detectedKey:"Tonalit\xe9 d\xe9tect\xe9e",detectedBpm:"BPM d\xe9tect\xe9",resultingKey:"Tonalit\xe9 obtenue",semitones:"Demi-tons",relativeTempo:"Tempo relatif",resetPitch:"R\xe9initialiser la hauteur",resetTempo:"R\xe9initialiser le tempo",analyzing:"Analyse en cours",preparing:"Pr\xe9paration du moteur audio",unavailable:"Hauteur et tempo indisponibles",sourceBpm:"BPM source",halfTime:"Moiti\xe9",doubleTime:"Double",preparingOriginal:"Pr\xe9paration du fichier audio original",detectingKeyOriginal:"D\xe9tection de la tonalit\xe9 depuis le fichier original",detectingBpmOriginal:"D\xe9tection du BPM depuis le fichier original",detectingKeyStems:"D\xe9tection de la tonalit\xe9 depuis les pistes",detectingBpmDrums:"D\xe9tection du BPM depuis la batterie",detectingBpmStems:"D\xe9tection du BPM depuis les pistes",preliminaryVocalKey:"Tonalit\xe9 vocale provisoire",keyUnavailable:"Tonalit\xe9 indisponible",bpmUnavailable:"BPM indisponible â saisissez-le manuellement",retryAnalysis:"Relancer lâanalyse"},lyricsPanel:{title:"Paroles",close:"Fermer les paroles",loadingCache:"Chargement des paroles...",preparingVocal:"Preparation de la voix...",uploading:"Televersement de la voix...",generating:"Generation des paroles...",downloading:"Telechargement des paroles...",loginRequired:"Connectez-vous pour generer les paroles.",error:"Impossible de generer les paroles.",retry:"Reessayer",empty:"Aucune parole trouvee.",playFrom:"Lire depuis"},lyricsUpgradeModal:{title:"Debloquer les paroles completes",message:"Achetez une offre pour afficher et synchroniser les paroles completes.",viewPlans:"Voir les offres",notNow:"Pas maintenant"},trackDisplay:{setVolumeToZero:"Mettre le volume \xe0 0 %",setVolumeToFull:"Mettre le volume \xe0 100 %",download:"T\xe9l\xe9charger",loading:"Chargement...",preparing:"Pr\xe9paration...",seek:"Cliquez sur la forme dâonde pour vous d\xe9placer",error:"Erreur"},videoDisplay:{trackVolumes:"Volumes des pistes",loading:"Chargement",preparing:"Pr\xe9paration",error:"Erreur"},exportModal:{title:"Exporter",fileFormat:"Format du fichier",channels:"Pistes",loginRequired:"Connexion requise",loginRequiredDescription:"Connectez-vous \xe0 votre compte pour t\xe9l\xe9charger et exporter les pistes.",goToLogin:"Se connecter",cancel:"Annuler",purchaseCredits:"Acheter des cr\xe9dits pour exporter",purchaseCreditsDescription:"Vous devez acheter une offre pour t\xe9l\xe9charger et exporter vos pistes s\xe9par\xe9es.",buyPlan:"Acheter une offre",downloadSelected:"T\xe9l\xe9charger la s\xe9lection",exportAllChannels:"Exporter toutes les pistes",tempoExportWarning:"Lâexport peut prendre plus de temps."}}:{seoTitle:"Processing - Music Separation",layoutTitle:"Music Separation",layoutDescription:"AI-powered music separation",preparingTitle:"Preparing Your Audio",processingTitle:"Processing Your Audio",preparingDescription:"Preparing your separated tracks...",processingDescription:"Please wait while we separate your tracks...",originalPlayer:{title:"Original audio",subtitle:"Listen while processing continues",play:"Play original audio",pause:"Pause original audio",seek:"Seek original audio",volume:"Original audio volume",rewind10:"Rewind 10s",forward10:"Forward 10s"},complete:"Complete",back:"Back",export:"Export",previewBadge:"PREVIEW",previewTitle:"30-Second Preview",previewDescription:e=>"Youâre viewing a preview of the first 30 seconds from your original ".concat(e," audio."),previewCta:" Satisfied with the quality? Click the button below to process the full audio!",process
1FullAudio:"Process Full Audio",loginToProcessFullAudio:"Log In to Process Full Audio",processingFullAudio:"Processing Full Audio",fullAudioProgress:e=>"Uploading and preparing your ".concat(e," audio..."),mergingVideo:"Merging Video",mergingVideoDescription:"Merging audio tracks with your video...",downloadStarts:"Download will start automatically when ready",insufficientCredits:"Insufficient Credits",cancel:"Cancel",buyCredits:"Buy Credits",processingFailed:"Processing Failed",tryAgain:"Try Again",refreshUrls:"Refresh URLs",redownloadStems:"Re-download Stems",notEnoughCredits:(e,t,r)=>"You have ".concat(e," minute").concat(1!==e?"s":""," remaining, but this ").concat(t," audio requires ").concat(r," minute").concat(1!==r?"s":"","."),extractVideoError:"Failed to extract audio from video. Please try again.",tracksPreparingError:"Tracks are still preparing. Re-download the missing stems and try again.",noValidTracks:"No valid tracks selected",noTracksAvailable:"No tracks available",exportVideoError:"Failed to export video. Please try again.",processFullError:"Failed to process full audio. Please try again.",noVocalTrack:"Vocal track not available",genericProcessingError:"Could not prepare audio tracks. Please try again.",separationLabels:{MODE_0:"2 Tracks",MODE_1:"4 Tracks",MODE_2:"6 Tracks",MODE_3:"Hi-Fi 2 Tracks"},trackLabels:{},playback:{volume:"Volume",rewind10:"Rewind 10s",forward10:"Forward 10s",loopEnabled:"Loop enabled",enableLoop:"Enable loop",loopEditorTitle:"Loop range",loopEditorEnabled:"Enable loop",loopStart:"Start",loopEnd:"End",increaseLoopTime:"Increase",decreaseLoopTime:"Decrease",invalidLoopTime:"Enter a valid time using MM:SS.d.",invalidLoopRange:"The loop must be at least 0.5 seconds long.",lyrics:"Lyrics",pitch:"Pitch",tempo:"Tempo",detectedKey:"Detected key",detectedBpm:"Detected BPM",resultingKey:"Key",semitones:"Semitones",relativeTempo:"Relative tempo",resetPitch:"Reset pitch",resetTempo:"Reset tempo",analyzing:"Analyzing",preparing:"Preparing audio engine",unavailable:"Pitch and tempo unavailable",sourceBpm:"Source BPM",halfTime:"Half",doubleTime:"Double",preparingOriginal:"Preparing original audio",detectingKeyOriginal:"Detecting key from original audio",detectingBpmOriginal:"Detecting BPM from original audio",detectingKeyStems:"Detecting key from stems",detectingBpmDrums:"Detecting BPM from drums",detectingBpmStems:"Detecting BPM from stems",preliminaryVocalKey:"Preliminary vocal key",keyUnavailable:"Key unavailable",bpmUnavailable:"BPM unavailable â enter manually",retryAnalysis:"Retry analysis"},lyricsPanel:{title:"Lyrics",close:"Close lyrics",loadingCache:"Loading lyrics...",preparingVocal:"Preparing music...",uploading:"Uploading music...",generating:"Generating lyrics...",downloading:"Downloading lyrics...",loginRequired:"Please log in to generate lyrics.",error:"Could not generate lyrics.",retry:"Retry",empty:"No lyrics were found.",playFrom:"Play from"},lyricsUpgradeModal:{title:"Unlock full lyrics",message:"Upgrade your plan to view and sync the complete lyrics.",viewPlans:"View Plans",notNow:"Not now"},trackDisplay:{setVolumeToZero:"Set volume to 0%",setVolumeToFull:"Set volume to 100%",download:"Download",loading:"Loading...",preparing:"Preparing...",seek:"Click on waveform to seek",error:"Error"},videoDisplay:{trackVolumes:"Track Volumes",loading:"Loading",preparing:"Preparing",error:"Error"},exportModal:{title:"Export",fileFormat:"File Format",channels:"Channels",loginRequired:"Login Required",loginRequiredDescription:"Please log in to your account to download and export tracks.",goToLogin:"Go to Login",cancel:"Cancel",purchaseCredits:"Purchase Credits to Export",purchaseCreditsDescription:"You need to purchase a plan to download and export your separated tracks.",buyPlan:"Buy a Plan",downloadSelected:"Download Selected",exportAllChannels:"Export All Channels",tempoExportWarning:"Export may take longer."}},j=y?{...k,seoTitle:"Processing - Audio Noise Remover",layoutTitle:"Audio Noise Remover",layoutDescription:"AI-powered audio cleaning",preparingTitle:"Preparing Your Audio",processingTitle:"Cleaning Your Audio",preparingDescription:"Preparing your clean voice result...",processingDescription:"Please wait while we clean your audio...",originalPlayer:{...k.originalPlayer,title:"Original audio",subtitle:"Listen while cleaning continues"},export:"Download",mergingVideo:"Preparing Video",mergingVideoDescription:"Merging the clean voice with your video...",processingFailed:"Cleaning Failed",tryAgain:"Try Again",redownloadStems:"Re-download Clean Voice",tracksPreparingError:"The clean voice result is still preparing. Re-download it then try again.",noValidTracks:"No clean voice result selected",noTracksAvailable:"No clean voice result available",exportVideoError:"Failed to export video. Please try again.",genericProcessingError:"Could not prepare the clean voice result. Please try again.",separationLabels:{MODE_0:"Clean Voice",MODE_1:"Clean Voice",MODE_2:"Clean Voice",MODE_3:"Clean Voice"},trackLabels:{vocal:"Clean Voice"},trackDisplay:{...k.trackDisplay,download:"Download clean voice"},videoDisplay:{...k.videoDisplay,trackVolumes:"Clean Voice"},exportModal:{...k.exportModal,title:"Download Clean Voice",channels:"Result",downloadSelected:"Download Clean Voice",exp
1ortAllChannels:"Download Clean Voice",purchaseCredits:"Purchase Credits to Download",purchaseCreditsDescription:"You need to purchase a plan to download your clean voice result.",loginRequiredDescription:"Please log in to your account to download the clean voice result."}}:k,[N,E]=(0,n.useState)(!1),[P,L]=(0,n.useState)(null),[z,S]=(0,n.useState)(!1),[A,F]=(0,n.useState)(0),[R,D]=(0,n.useState)(!1),[B,_]=(0,n.useState)(0),[O,U]=(0,n.useState)(null),[I,W]=(0,n.useState)(!1),[q,K]=(0,n.useState)(!1),[Y,Z]=(0,n.useState)(""),[G,X]=(0,n.useState)(""),[J,Q]=(0,n.useState)(!1),[ee,et]=(0,n.useState)("idle"),[er,ea]=(0,n.useState)(0),[en,el]=(0,n.useState)(""),[eo,ei]=(0,n.useState)([]),[eg,eb]=(0,n.useState)(!1),[ek,eF]=(0,n.useState)(()=>window.matchMedia("(max-width: 767px)").matches),[eR,eD]=(0,n.useState)(()=>new Set),[eB,eV]=(0,n.useState)(()=>new Map),[eq,eY]=(0,n.useState)(0),[eZ,eQ]=(0,n.useState)(1),[tt,tr]=(0,n.useState)(eJ.YZ),[ta,tn]=(0,n.useState)("disabled"),[tl,to]=(0,n.useState)(0),ti=(0,n.useRef)(null),ts=(0,n.useRef)(null),tc=(0,n.useRef)(0),td=(0,n.useRef)(!1),tu=(0,n.useRef)(!1),tm=(0,n.useRef)(!1),tp=(0,n.useRef)(0),th=(0,n.useRef)(!1),tx=(0,n.useRef)(!1),tf=(0,n.useRef)(!1),tg=(0,n.useRef)(!1),tb=(0,n.useRef)(!1),tv=(null==u?void 0:u.id)||"",ty=u?"":p,tw="MODE_2"===g,tk=!y,tj=y&&"audio"===b,tN=!y&&(0,$.jc)(),tE=y?(0,eJ.LQ)(tt):1,tM=f?h(f):void 0,tC=(null==tM?void 0:tM.isPreview)||!1,tP=(null==tM?void 0:tM.originalDuration)||0,tT=(null==tM?void 0:tM.canProcessFull)||!1,tL=(null==tM?void 0:tM.status)==="completed",{phase:tz,error:tS,displayProgress:tA,isPreparingStreams:tF,tracks:tR,duration:tD,currentTime:tB,syncRevision:tV,isPlaying:t_,isLooping:tO,loopStart:tU,loopEnd:tI,masterVolume:tH,mutedTracks:tW,soloedTrack:tq,trackVolumes:tK,playbackReady:t$,initialPlaybackReady:tY,allTracksReady:tZ,backgroundDownloadsActive:tG,exportReady:tX,setDurationFromMedia:tJ,updateCurrentTimeFromClock:tQ,setCurrentTime:t0,playFromTime:t1,handleSeek:t2,togglePlay:t4,toggleLoop:t3,startPlay:t5,pause:t6,setLoopStart:t8,setLoopEnd:t7,setLoopRange:t9,setMasterVolume:re,setTrackVolume:rt,toggleMute:rr,toggleSolo:ra,refreshStemUrls:rn,retryStemDownload:rl,getStemBlob:ro,releaseStemObjectUrl:ri}=(0,ex.f)({requestId:"string"==typeof f?f:void 0,type:"string"==typeof g?g:void 0,mediaType:b||"audio",useExternalAudioClock:!0,userId:tv,visitorId:ty,enabled:N||tL,initiallyCompleted:tL});(0,n.useEffect)(()=>{eD(new Set),eV(new Map),eY(0),eQ(1),tn(tN?"preparing":"disabled"),to(0),W(!1)},[tN,f,g]),(0,n.useEffect)(()=>{tp.current+=1,tm.current=!1,th.current=!1,Q(!1),et("idle"),ea(0),el(""),ei([]),eb(!1),tx.current=!1},[f]);let rs=(0,n.useMemo)(()=>tR.filter(e=>!y||"vocal"===e.id).map(e=>{let t=j.trackLabels[e.id],r=eR.has(e.id),a={...e,playbackReady:r};return t?{...a,name:t,label:t}:a}),[j.trackLabels,eR,!0,y,tR]),rc=t$&&eR.has("vocal"),rd=(0,n.useMemo)(()=>tR.filter(e=>!y||"vocal"===e.id).map(e=>({id:e.id,active:e.active,blob:ro(e.id)})),[ro,y,tR]),ru=!m||(null==u?void 0:u.canDownload)===!1,rm=(0,n.useMemo)(()=>ru&&!e1.freeUsersCanViewFullLyrics?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.3,r=e.filter(e3).length;if(0===r)return[];let a=Math.max(1,Math.ceil(r*t)),n=[],l=0;for(let t of e){if(e3(t)){if(l>=a||(n.push(t),(l+=1)>=a))break;continue}l<a&&n.push(t)}return n}(eo,e1.freeUserLyricsPreviewRatio):eo,[ru,eo]),rp=(0,n.useMemo)(()=>(0,C.Y)(rm),[rm]),rh=(0,n.useMemo)(()=>rp.find(e=>{let t=e.map(e=>{let{word:t}=e;return t}).filter(e=>"word"===e.type&&Number.isFinite(e.start));if(0===t.length)return!1;let r=t[0],a=t[t.length-1],n=r.start,l=Number.isFinite(a.end)?a.end:a.start;return tB>=n&&tB<=l})||null,[rp,tB]),rx=!J&&e0.includes(ee),rf=!J&&"ready"===ee&&!!rh,rg=tk&&!J&&(rx||"ready"===ee),rb=(0,n.useMemo)(()=>!ru||e1.freeUsersCanAccessFullAudio||tD<=0?null:tD*Math.max(0,Math.min(1,e1.freeUserAudioAccessRatio)),[tD,ru]),rv=(0,n.useCallback)(async e=>{var t,r,a,n,l;let o=null!=(t=null==e?void 0:e.force)&&t,i="string"==typeof f?f:"";if(tm.current||!o&&"ready"===ee||!o&&th.current&&"idle"!==ee)return;if(!i){et("error"),el(j.lyricsPanel.error);return}if(!tv){et("login-required"),ea(0),el("");return}let s=tp.current+1;tp.current=s,tm.current=!0,th.current=!0,tx.current=!1,eb(!1),el(""),ea(0);let c=()=>tp.current===s;try{if(!o){et("loading-cache");let e=await e$(i).catch(()=>null);if(!c())return;if(e){ei(e4(e)),ea(100),et("ready");return}}let e=ro("vocal");if(!e){if(et("preparing-vocal"),await rl("vocal"),!c())return;e=ro("vocal")||await e8(i,"vocal")}if(!e)throw Error(j.noVocalTrack||"Vocal track not available");let{extension:t,contentType:s}=function(e){let t=e.type||"audio/mpeg";return t.includes("wav")?{extension:"wav",contentType:t}:t.includes("mp4")||t.includes("m4a")?{extension:"m4a",contentType:t}:t.includes("aac")?{extension:"aac",contentType:t}:t.includes("ogg")?{extension:"ogg",contentType:t}:{extension:"mp3",contentType:t||"audio/mpeg"}}(e);et("uploading");let d=await (0,eW.oS)({userId:tv,inputAudioFileExtension:t,platform:"WEB"});if("FAILED"===d.status||!(null==(r=d.data)?void 0:r.requestId)||!(null==(a=d.data)?void 0:a.inputAudioUploadUrl))throw Error(d.message||j.lyricsPanel.error);if(await (0,eW.rQ)(d.data.inputAudioUploadUrl,e,s,e=>{c()&&ea(e)}),!c())return;et("generating"),ea(0);let u={userId:tv,requestId:d.data.requestId},m=await (0,eW.oY)(u);if("FAILED"===m.status)throw Error(m.message||j.lyricsPanel.error);let p=e6(m.data,u.requestId),h=e5(p.status),x=!1;do{if(!c())return;ea(Math.max(0,Math.min(100,p.progress||0))),x&&await e2(1e3),p=e6((await (0,eW.c2)(u)).data,u.requestId),h=e5(p.status),x=!0}while(n=h,l=p.lyricsDownloadUrl,"FAILED"!==n&&("COMPLETED"!==n||!l));if(!c())return;if("COMPLETED"!==h||!p.lyricsDownloadUrl)throw Error(j.lyricsPanel.error);ea(100),et("downloading");let f=await (0,eW.AH)(p.lyricsDownloadUrl);if(!c())return;await eK(i,f).catch(e=>{console.error("Failed to cache lyrics:",e)}),ei(e4(f)),et("ready")}catch(e){if(!c())return;el((e instanceof Error?e.message:j.lyricsPanel.error)||j.lyricsPanel.error),et("error")}finally{c()&&(tm.current=!1)}},[j.lyricsPanel.error,j.noVocalTrack,ro,ee,f,rl,tv]),ry=(0,n.useCallback)(()=>
1{if(J)return void Q(!1);Q(!0),th.current||"idle"!==ee||rv()},[rv,J,ee]),rw=(0,n.useCallback)(()=>{th.current=!1,tx.current=!1,eb(!1),rv({force:!0})},[rv]),rk=(0,n.useCallback)(e=>{let t=tO&&tI>tU&&(e<tU||e>tI);t1(e,{disableLoop:t})},[tO,tI,tU,t1]);(0,n.useEffect)(()=>{J&&"ready"===ee&&ru&&null!==rb&&!tx.current&&!(tB<rb)&&(tx.current=!0,eb(!0))},[tB,rb,ru,J,ee]);let rj="ready"===tz?"completed":"loading-results"===tz?"loading-audio":tz,rN=Math.round(tA),rE="completed"===rj&&"video"===b&&!P,rM=y&&"video"===b,rC="processing"===rj||"loading-audio"===rj||rE,rP="completed"===rj&&!rE;(0,n.useEffect)(()=>{!y&&"video"===b&&rP&&P&&"idle"===ee&&!th.current&&rv()},[rv,y,ee,b,rP,P]),(0,n.useEffect)(()=>{y||"video"===b||!rP||"idle"!==ee||th.current||rv()},[rv,y,ee,b,rP]);let rT=tD>0?tU/tD*100:0,rL=tD>0?tI/tD*100:0,rz=function(){let[e,t]=(0,n.useState)(!1),[r,a]=(0,n.useState)("mp3"),[l,o]=(0,n.useState)([]),[i,s]=(0,n.useState)(!1),[c,d]=(0,n.useState)({current:0,total:0}),u=async(e,t,r,a,n,l,o)=>{let i=t.find(t=>t.id===e);if(!(null==i?void 0:i.downloadUrl))return null;let s=a?a.replace(/\.[^/.]+$/,""):"audio",c=i.name.toLowerCase(),d="".concat(s,"_").concat(c,".").concat(r),u=i.downloadUrl.startsWith("blob:")?null==n?void 0:n(i.id):await (0,ep.C)(i.downloadUrl);if(!u)throw Error("Cached audio blob is not available for ".concat(i.name));if("mp4"===r)throw Error("MP4 channel exports must use the video export pipeline.");let m=await (0,eh.ER)(u,r,l,o);return{trackId:i.id,fileName:d,blob:m}},m=async(e,t,r,a,n,l,o)=>{try{let i=await u(e,t,r,a,n,l,o);if(!i)return!1;let s=window.URL.createObjectURL(i.blob),c=document.createElement("a");return c.href=s,c.download=i.fileName,c.style.display="none",document.body.appendChild(c),c.click(),setTimeout(()=>{document.body.removeChild(c),window.URL.revokeObjectURL(s)},1e3),!0}catch(e){throw console.error("Export failed:",e),Error("Export failed: ".concat(e))}},p=async(e,r,a,n,l,o)=>{let i=e.filter(e=>e.active&&e.downloadUrl);s(!0),d({current:0,total:i.length});for(let t=0;t<i.length;t++){let s=i[t];try{d({current:t+1,total:i.length}),await m(s.id,e,r,a,n,l,o?e=>o((t+e)/i.length):void 0),t<i.length-1&&await new Promise(e=>setTimeout(e,300))}catch(e){console.error("Failed to export ".concat(s.name,":"),e)}}s(!1),d({current:0,total:0}),t(!1)};return{showExportModal:e,selectedFormat:r,selectedChannels:l,isExporting:i,exportProgress:c,setShowExportModal:t,setSelectedFormat:a,toggleChannelSelection:e=>{o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},handleExportChannel:m,prepareExportChannel:u,handleExportAllChannels:p}}(),[rS,rA]=(0,n.useState)(null),rF=y?rs:tR,rR=y?!!ro("vocal"):tX;(0,n.useEffect)(()=>{if(!rP)return;let e=e=>{let t="Space"===e.code||" "===e.key,r="ArrowLeft"===e.key||"ArrowRight"===e.key,a="ArrowUp"===e.key||"ArrowDown"===e.key;if(!t&&!r&&!a||t&&e.repeat)return;let n=e.target;if(n instanceof HTMLElement){let e=n.tagName.toLowerCase(),t=n instanceof HTMLInputElement&&"range"===n.type&&n.classList.contains("tool-master-range");if(n.isContentEditable||"button"===e||"input"===e&&!t||"select"===e||"textarea"===e||n.closest('[role="dialog"]'))return}return(e.preventDefault(),r)?void t0(Math.max(0,Math.min(tB+("ArrowLeft"===e.key?-10:10),tD))):a?void re(Math.max(0,Math.min(tH+("ArrowUp"===e.key?.05:-.05),1))):void t4()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[tB,tD,tH,t0,re,rP,t4]),(0,n.useEffect)(()=>{let e=window.matchMedia("(max-width: 767px)"),t=()=>{eF(e.matches)};return(t(),e.addEventListener)?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e.addListener(t),()=>e.removeListener(t))},[]);let rD=(0,n.useMemo)(()=>y?["vocal"]:"MODE_0"===g?["vocal","others"]:"MODE_1"===g?["vocal","drums","bass","others"]:"MODE_2"===g?["vocal","drums","bass","guitar","piano","others"]:["vocal","others"],[y,g]),rB=function(e){let{enabled:t,requestId:a,originalFile:l,originalFileChecked:o,decodedStemBuffers:i}
1=e,[s,c]=(0,n.useState)(eE),[d,u]=(0,n.useState)(!1),[m,p]=(0,n.useState)(0),[h,x]=(0,n.useState)(0),f=(0,n.useRef)(new Map),g=(0,n.useRef)(0),b=(0,n.useRef)(!1),v=(0,n.useRef)(!1),y=(0,n.useRef)(!1),w=(0,n.useRef)(!1),k=(0,n.useRef)(!1),j=(0,n.useRef)(!1),N=(0,n.useRef)(null),E=(0,n.useRef)(null),M=(0,n.useRef)(null),C=(0,n.useRef)(!1),P=(0,n.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"analysis-cancelled";f.current.forEach(t=>t.abort(e)),f.current.clear()},[]),T=(0,n.useCallback)(()=>{null!==M.current&&(window.clearTimeout(M.current),M.current=null)},[]),L=(0,n.useCallback)(()=>{let e=N.current;return e?k.current?{...e,key:null,keyStrength:null,keySource:null,keyAnalyzedSeconds:0}:e:null},[]),z=(0,n.useCallback)(e=>{if(!a)return;let t={schemaVersion:2,requestId:a,result:L(),correctedBpm:e,correctedKey:null};ey(a,t)},[L,a]);(0,n.useEffect)(()=>{if(g.current+=1,P(),T(),b.current=!1,v.current=!1,y.current=!1,w.current=!1,k.current=!1,j.current=!1,N.current=null,E.current=null,C.current=!1,c(eE),u(!1),!t||!a)return void u(!0);let e=!1;return ev(a).then(t=>{var r,a,n,l,o,i;if(e||!t)return;N.current=t.result,E.current=t.correctedBpm,y.current=!!(null==(r=t.result)?void 0:r.key),w.current=!!(null==(a=t.result)?void 0:a.bpm);let s={...eE,automatic:t.result,correctedBpm:t.correctedBpm,correctedKey:null,keyStatus:(null==(n=t.result)?void 0:n.key)?"ready":"waiting",bpmStatus:(null==(l=t.result)?void 0:l.bpm)?"ready":"waiting",keyActiveSource:(null==(o=t.result)?void 0:o.keySource)||void 0,bpmActiveSource:(null==(i=t.result)?void 0:i.bpmSource)||void 0};c({...s,status:eM(s)})}).finally(()=>{e||u(!0)}),()=>{e=!0}},[P,T,t,a,m]);let S=(0,n.useCallback)(()=>{null===M.current&&(M.current=window.setTimeout(()=>{C.current=!0,P("analysis-hard-timeout"),c(e=>{let t=e;return y.current||(t=eC(t,"key","failed","analysis-hard-timeout")),w.current||(t=eC(t,"bpm","failed","analysis-hard-timeout")),t})},6e4))},[P]);(0,n.useEffect)(()=>{t&&a&&d&&o&&(!y.current||!w.current)&&S()},[d,t,S,o,a,s.bpmStatus,s.keyStatus]);let A=(0,n.useCallback)((e,t,n,l,o,i)=>new Promise((s,c)=>{if(!a||C.current||l!==g.current)return void c(Error("analysis-cancelled"));let d=!1,u=null,m=e=>{if(d)return;d=!0;let t=f.current.get(i);t&&window.clearTimeout(t.timerId),f.current.delete(i),null==u||u.terminate(),e()};try{u=new Worker(r.tu(new URL(r.p+r.u(3931),r.b)))}catch(e){c(Error("analysis-worker-construction-failed"));return}let p=window.setTimeout(()=>m(()=>c(Error("".concat(e,"-analysis-timeout")))),o);f.current.set(i,{worker:u,timerId:p,abort:e=>m(()=>c(Error(e)))}),u.onmessage=t=>{let r=t.data;r.requestId===a&&r.runId===l&&r.metric===e&&m(()=>"error"===r.type?c(Error(r.errorCode)):s(r))},u.onerror=()=>m(()=>c(Error("analysis-worker-failed"))),u.onmessageerror=()=>m(()=>c(Error("analysis-worker-message-failed"))),u.postMessage({type:"analyze",requestId:a,runI
1d:l,metric:e,source:t,windows:n},n.map(e=>e.mono.buffer))}),[a]),F=(0,n.useCallback)((e,t,r,n)=>{if(!a)return;let l=N.current||{schemaVersion:2,requestId:a,bpm:null,bpmConfidence:null,bpmSource:null,bpmAnalyzedSeconds:0,key:null,keyStrength:null,keySource:null,keyAnalyzedSeconds:0,analyzedAt:Date.now()},o="key"===r.metric?{...l,key:r.key,keyStrength:r.confidence,keySource:t,keyAnalyzedSeconds:r.analyzedSeconds,analyzedAt:Date.now()}:{...l,bpm:r.bpm,bpmConfidence:r.confidence,bpmSource:t,bpmAnalyzedSeconds:r.analyzedSeconds,analyzedAt:Date.now()};N.current=o,"key"===e&&(k.current=n),c(t=>eC({...t,automatic:o},e,n?"preliminary":"ready")),n||z(E.current)},[z,a]),R=(0,n.useCallback)(async(e,t,r)=>{let a;c(r=>eC("key"===e?{...r,keyActiveSource:t.source}:{...r,bpmActiveSource:t.source},e,"analyzing"));try{a=await A(e,t.source,ew(t.windows),r,ej[e],"".concat(r,":").concat(e,":primary"))}catch(l){if(C.current||r!==g.current)throw l;let n=function(e){if(0===e.length)return[];let t=e[Math.floor(e.length/2)],r=Math.min(t.mono.length,Math.floor(12*t.sampleRate)),a=Math.max(0,Math.floor((t.mono.length-r)/2));return[{sampleRate:t.sampleRate,mono:t.mono.slice(a,a+r)}]}(t.windows);if(0===n.length)throw l;a=await A(e,t.source,n,r,eN[e],"".concat(r,":").concat(e,":retry"))}if("metric-result"!==a.type)throw Error("analysis-result-invalid");if(!("key"===a.metric?!!a.key:!!a.bpm))throw Error("".concat(e,"-not-detected"));F(e,t.source,a,!!t.preliminary),t.preliminary||("key"===e?y.current=!0:w.current=!0)},[F,A]),D=Array.from(i.keys()).sort().join("|");(0,n.useEffect)(()=>{if(!t||!a||!d||!o||b.current||C.current||y.current&&w.current)return;let e=eT(i),r=eP(i,["vocal","vocals"]),n=eP(i,["drums","drum"]),s=eP(i,["others","other","instrumental"]),u=e.length>=2||!!s,m=!!n||!!s||i.size>=2,p=!!l&&!v.current,h=!y.current&&(u||!!r&&!j.current)||!w.current&&m;if(!p&&!h)return;b.current=!0,S();let f=++g.current,k=!1;return(async()=>{let e=null,t=null;if(p){v.current=!0,c(e=>{let t=e;return y.current||(t=eC(t,"key","preparing")),w.current||(t=eC(t,"bpm","preparing")),t});try{let r=await eL(l),a=await ez([{buffer:r,gain:1}]);y.current||(e={source:"original",windows:a}),w.current||(t={source:"original",windows:ew(a)})}catch(r){e=null,t=null}}if(!e&&!y.current){let t=eT(i),r=eP(i,["others","other","instrumental"]),a=t.length>=2||r?t.map(e=>{let[,t]=e;return{buffer:t}}):[];if(a.length>0)e={source:"harmonic-stems",windows:await ez(a)};else{let t=eP(i,["vocal","vocals"]);t&&!j.current&&(j.current=!0,e={source:"vocal",windows:await ez([{buffer:t[1],gain:1}]),preliminary:!0})}}if(!t&&!w.current){let e=eP(i,["drums","drum"]),r=eP(i,["others","other","instrumental"]);e?t={source:"drums",windows:await ez([{buffer:e[1],gain:1}])}:r?t={source:"others",windows:await ez([{buffer:r[1],gain:1}])}:i.size>=2&&(t={source:"mixed-stems",windows:await ez(Array.from(i.values()).map(e=>({buffer:e})))})}if(k||f!==g.current||C.current)return;let r=[];e&&r.push(()=>R("key",e,f)),t&&r.push(()=>R("bpm",t,f));let a=(t,r)=>{if(k||f!==g.current)return;let a=r instanceof Error?r.message:"".concat(t,"-analysis-failed");"key"===t?y.current=!(null==e?void 0:e.preliminary):w.current=!0,c(e=>eC(e,t,"failed",a))};if(function(){let e=navigator,t=!window.matchMedia("(max-width: 767px), (pointer: coarse)").matches,r=void 0===e.deviceMemory||e.deviceMemory>=4;return t&&r&&(navigator.hardwareConcurrency||2)>=6}())(await Promise.allSettled(r.map(e=>e()))).forEach((t,r)=>{"rejected"===t.status&&a(0===r&&e?"key":"bpm",t.reason)});else for(let t=0;t<r.length;t+=1)try{await r[t]()}catch(r){a(0===t&&e?"key":"bpm",r)}})().catch(e=>{if(k||f!==g.current)return;let t=e instanceof Error?e.message:"analysis-preparation-failed";c(e=>{let r=e;return y.current||(r=eC(r,"key","failed",t)),w.current||(r=eC(r,"bpm","failed",t)),r})}).finally(()=>{f===g.current&&(b.current=!1,y.current&&w.current&&T(),x(e=>e+1))}),()=>{k=!0}},[d,T,D,i,t,S,l,o,h,a,R]);let B=(0,n.useCallback)(e=>{let t=e&&Number.isFinite(e)&&e>0?Math.round(10*e)/10:null;E.current=t,c(e=>(z(t),{...e,correctedBpm:t}))},[z]),V=(0,n.useCallback)(()=>{var e,t;P(),T(),C.current=!1,v.current=!1,j.current=k.current,y.current=!!(null==(e=N.current)?void 0:e.key)&&!k.current,w.current=!!(null==(t=N.current)?void 0:t.bpm),c(e=>
1{let t={...e,keyStatus:y.current?"ready":"waiting",bpmStatus:w.current?"ready":"waiting",keyErrorCode:void 0,bpmErrorCode:void 0};return{...t,status:eM(t)}}),p(e=>e+1)},[P,T]),_=(0,n.useCallback)(()=>{g.current+=1,P(),T(),b.current=!1},[P,T]);return(0,n.useEffect)(()=>()=>{_()},[_]),(0,n.useMemo)(()=>{var e,t,r,a,n;return{state:s,effectiveBpm:null!=(a=null!=(r=s.correctedBpm)?r:null==(e=s.automatic)?void 0:e.bpm)?a:null,effectiveKey:null!=(n=null==(t=s.automatic)?void 0:t.key)?n:null,setCorrectedBpm:B,retry:V,cancel:_}},[V,B,s,_])}({enabled:tN&&rP,requestId:"string"==typeof f?f:void 0,originalFile:O,originalFileChecked:I,decodedStemBuffers:eB,requiredTrackCount:rD.length}),rV=(0,n.useCallback)(e=>{"ready"===ta&&eY((0,$.zf)(e))},[ta]),r_=(0,n.useCallback)(e=>{"ready"===ta&&eQ((0,$.c6)(e))},[ta]),rO=(0,n.useCallback)(e=>{tn(e)},[]),rU=(0,n.useCallback)(e=>{console.error("Pitch/tempo engine unavailable:",e),eY(0),eQ(1),to(0)},[]),{handleTrackReady:rI}=function(e,t){let[r,a]=(0,n.useState)({});(0,n.useEffect)(()=>{a({})},[t]);let l=(0,n.useMemo)(()=>e.every(e=>r[e]),[r,e]);return{tracksReady:r,allTracksReady:l,handleTrackReady:e=>{a(t=>({...t,[e]:!0}))}}}(rD,"".concat("string"==typeof f?f:"",":").concat("string"==typeof g?g:"",":").concat("string"==typeof b?b:"")),rH=(0,n.useCallback)(()=>td.current&&tc.current>0?tc.current:tB,[tB]);(0,n.useEffect)(()=>{f&&g&&!N&&E(!0)},[f,g,N]),(0,n.useEffect)(()=>{d(!0)},[d]),(0,n.useEffect)(()=>{tu.current=!1,tc.current=0,td.current=!1,X(""),tr(eJ.YZ)},[f]),(0,n.useEffect)(()=>{t_&&X("")},[t_]),(0,n.useEffect)(()=>{"completed"===rj&&t_&&!rc&&t6()},[rj,t_,t6,rc]);let rW=(0,n.useCallback)(()=>{t6(),X(v?"Appuyez sur lecture pour demarrer.":"Press play to start playback.")},[v,t6]),rq=(0,n.useCallback)(e=>{let t=Number.isFinite(e)&&e>0?e:0;tc.current=t,td.current=t>0},[]),rK=(0,n.useCallback)((e,t)=>{t6(),console.error("Playback failed for ".concat(e,":"),t),X(v?"Impossible de lire cette piste. Reessayez avec le bouton lecture.":"This track could not start playback. Try pressing play again.")},[v,t6]),r$=(0,n.useCallback)((e,t)=>{console.error("Playback failed for ".concat(e,":"),t),("video"===e||"vocal"===e)&&(t6(),X(v?"Impossible de demarrer la lecture. Reessayez avec le bouton lecture.":"Playback could not start. Try pressing play again."))},[v,t6]),rY=(0,n.useCallback)((e,t)=>{eD(t=>{if(t.has(e))return t;let r=new Set(t);return r.add(e),r}),eV(r=>{if(r.get(e)===t)return r;let a=new Map(r);return a.set(e,t),a}),ek&&!tj&&ri(e)},[!0,ek,tj,ri]);(0,ef.B)({enabled:!0,tracks:rd,isPlaying:t_&&rc,currentTime:tB,duration:tD,isLooping:tO,loopStart:tU,loopEnd:tI,masterVolume:tH,outputGain:tE,outputPeakProtection:y,trackVolumes:tK,mutedTracks:tW,soloedTrack:tq,syncRevision:tV,pitchTempoEnabled:tN,pitchSemitones:eq,tempoRatio:eZ,preferCheaperStretch:ek,onTimeUpdate:tQ,onDurationChange:tJ,onEnded:t6,onPlaybackBlocked:rW,onPlaybackFailed:rK,decodeMode:ek?"sequential-idle":"eager",onTrackDecoded:rY,onEngineStateChange:rO,onOutputLatencyChange:to,onEngineUnavailable:rU});let rZ=(0,n.useCallback)(async(e,t)=>{rI(e)},[tB,!0,rI,b,t0]);(0,n.useEffect)(()=>{let e=e=>{let t=ti.current;if(!t||tD<=0)return;let r=Math.max(0,Math.min(tD,(e.clientX-t.rect.left)/t.rect.width*tD));if("start"===t.edge)return void t8(r);t7(r)},t=()=>{ti.current=null};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[tD,t7,t8]),(0,n.useEffect)(()=>{"completed"===rj&&tZ&&u&&!tC&&((0,eX.QA)(),(0,eX.z2)()&&sessionStorage.setItem("shouldShowReview","true"))},[rj,tZ,u,tC]),(0,n.useEffect)(()=>{if("completed"===rj&&tY&&rc&&!t_&&!tu.current){if(td.current&&tc.current>0){td.current=!1,t0(tc.current);return}tu.current=!0,t5()}},[rj,tY,t_,t0,t5,rc]),(0,n.useEffect)(()=>{"video"===b&&f&&"string"==typeof f&&(0,eS.a_)(f).then(e=>{e&&L(e)}).catch(e=>{console.error("Error loading video file:",e)})},[b,f]),(0,n.useEffect)(()=>{let e=!1;return(U(null),f&&"string"==typeof f)?(W(!1),(0,eU.kw)(f).then(t=>{!e&&t&&U(t.file)}).catch(e=>{console.error("Error loading original file:",e)}).finally(()=>{e||W(!0)}),()=>{e=!0}):(W(!0),()=>{e=!0})},[f]);let rG=async(e,t,r,a)=>{var n;let l=await e_({decodedCleanVoice:r,volumeBoostPercent:a,format:e,sourceVideo:"mp4"===e?P:null,onProgress:F}),o=t.replace(/\.[^/.]+$/,""),i=(null==(n=rF.find(e=>"vocal"===e.id))?void 0:n.name.toLowerCase())||"clean voice";(0,eA.WN)(l,"".concat(o,"_").concat(i,".").concat(e))},rX=()=>{let e="string"==typeof f?f:"";m&&e&&(0,eH.jr)(e)},rJ=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r="string"==typeof f?f:"";m&&r&&(rX(),"stem"===e?(0,eH.K6)(r,t):(0,eH.dB)("mixed"===e?"mixed-export-count":"zip-export-count",r))},rQ=async()=>
1{if(0===rz.selectedChannels.length||tf.current)return;tf.current=!0;let e={pitchSemitones:eq,tempoRatio:eZ},t=(null==tM?void 0:tM.fileName)||(null==P?void 0:P.name)||"audio";if(y){let e=eB.get("vocal"),r=(0,eJ.aH)(tt),a=rz.selectedFormat;if(!e){alert("The clean voice preview is not ready for export yet. Wait for playback to become available, then retry."),tf.current=!1;return}if("mp4"===a&&!P){alert("The original video is unavailable. Choose an audio format or retry from the video result."),tf.current=!1;return}rz.setShowExportModal(!1),S(!0),F(0);try{await rG(a,t,e,r),rJ("stem",["vocal"])}catch(e){console.error("Noise remover export failed:",e),alert(e instanceof Error?e.message:"The clean voice export failed. Please retry.")}finally{S(!1),F(0),tf.current=!1}return}if("video"===b&&P)try{if(rz.setShowExportModal(!1),"mp3"===rz.selectedFormat){let r=rz.selectedChannels.length,a=[];for(let n=0;n<rz.selectedChannels.length;n++){let l=rz.selectedChannels[n],o=n/r*100;F(o);try{await rz.handleExportChannel(l,rF,"mp3",t,ro,e,e=>F((n+e)/r*100))&&(a.push(l),1===a.length&&rX())}catch(e){console.error("Failed to export ".concat(l,":"),e)}n<rz.selectedChannels.length-1&&await new Promise(e=>setTimeout(e,500))}a.length>0&&rJ("stem",a),F(0),tf.current=!1;return}if(S(!0),F(0),!rR){alert(j.tracksPreparingError),S(!1),tf.current=!1;return}let r=rF.filter(e=>rz.selectedChannels.includes(e.id)&&e.active).map(e=>({blob:ro(e.id),volume:tK[e.id]||1,name:e.name})).filter(e=>!!e.blob);if(0===r.length){alert(j.noValidTracks),S(!1),tf.current=!1;return}let a=await (0,eA.wN)(P,r,e,e=>F(e)),n=t.replace(/\.[^/.]+$/,""),l=r.map(e=>e.name.toLowerCase()).join("+"),o="".concat(n,"_").concat(l,".mp4");(0,eA.WN)(a,o),rJ("mixed"),S(!1),F(0)}catch(e){console.error("Error exporting video:",e),alert(j.exportVideoError),S(!1),F(0)}finally{tf.current=!1}else{rz.setShowExportModal(!1),S(!0),F(0);try{let r=rz.selectedChannels.length,a=[];for(let n=0;n<rz.selectedChannels.length;n++){let l=rz.selectedChannels[n],o=n/r*100;F(o);try{await rz.handleExportChannel(l,rF,rz.selectedFormat,t,ro,e,e=>F((n+e)/r*100))&&(a.push(l),1===a.length&&rX())}catch(e){console.error("Failed to export ".concat(l,":"),e)}await new Promise(e=>setTimeout(e,500))}a.length>0&&rJ("stem",a)}finally{S(!1),F(0),tf.current=!1}}},r0=async()=>{if(tg.current)return;tg.current=!0;let e={pitchSemitones:eq,tempoRatio:eZ},t=(null==tM?void 0:tM.fileName)||(null==P?void 0:P.name)||"audio";if(y){let e=eB.get("vocal"),r=(0,eJ.aH)(tt),a=rz.selectedFormat;if(!e){alert("The clean voice preview is not ready for export yet. Wait for playback to become available, then retry."),tg.current=!1;return}rz.setShowExportModal(!1),S(!0),F(0);try{await rG(a,t,e,r),rJ("stem",["vocal"])}catch(e){console.error("Noise remover export failed:",e),alert(e instanceof Error?e.message:"The clean voice export failed. Please retry.")}finally{S(!1),F(0),tg.current=!1}return}if("video"===b&&P)try{if(S(!0),F(0),rz.setShowExportModal(!1),!rR){alert(j.tracksPreparingError),S(!1),tg.current=!1;return}let r=rF.filter(e=>e.active&&e.downloadUrl).map(e=>({blob:ro(e.id),volume:tK[e.id]||1,name:e.name})).filter(e=>!!e.blob);if(0===r.length){alert(j.noTracksAvailable),S(!1),tg.current=!1;return}let a=await (0,eA.wN)(P,r,e,e=>F(e)),n=t.replace(/\.[^/.]+$/,"");(0,eA.WN)(a,"".concat(n,"_full_mix.mp4")),rJ("mixed"),S(!1),F(0)}catch(e){console.error("Error exporting video:",e),alert(j.exportVideoError),S(!1),F(0)}finally{tg.current=!1}else{rz.setShowExportModal(!1),S(!0),F(0);try{let r=rF.filter(e=>e.active&&e.downloadUrl),a=r.length,n=[];for(let l=0;l<r.length;l++){let o=r[l],i=await rz.prepareExportChannel(o.id,rF,rz.selectedFormat,t,ro,e,e=>F((l+e)/a*100));if(!i)throw Error("Could not prepare ".concat(o.name," for ZIP export."));n.push({fileName:i.fileName,blob:i.blob})}let l=await eG(n);(0,eA.WN)(l,function(e){let t=(e||"audio").replace(/\.[^/.]+$/,"");return"".concat(t,"_stems.zip")}(t)),rJ("zip")}catch(e){console.error("Failed to export stem ZIP:",e),alert(e instanceof Error?e.message:j.exportVideoError)}finally{S(!1),F(0),tg.current=!1}}},r1=e=>{rr(e)},r2=e=>{ra(e)},r4=(e,t)=>{rt(e,t)},r3=async()=>
1{if(!O||!f)return void console.error("No original file or requestId available");if(!tb.current&&!R){if(u&&void 0!==u.availableSeconds&&u.availableSeconds<tP){let e=Math.floor(u.availableSeconds/60),t=Math.ceil(tP/60);Z(j.notEnoughCredits(e,(0,eO.a3)(tP),t)),K(!0);return}tb.current=!0;try{D(!0),_(0);let e=O,r=(null==tM?void 0:tM.mediaType)||"audio";if("video"===r)try{e=await (0,eO._J)(O,e=>{_(.3*e)})}catch(e){console.error("Error extracting audio:",e),alert(j.extractVideoError),D(!1),tb.current=!1;return}let a=await (0,eI.Mp)(e,tv,ty,tP,e=>{_(Math.min(30+.7*e,100))});if(await (0,eU.t9)(f),"video"===r)try{await (0,eS.dT)(a.requestId,O)}catch(e){console.error("Error storing video file:",e)}let n=j.separationLabels[g]||j.separationLabels.MODE_0;await x({id:a.requestId,fileName:O.name,fileSize:O.size,duration:tP,mediaType:r,toolType:y?"audio-noise-remover":"music-separation",separationType:g,separationLabel:n,isPreview:!1,originalDuration:void 0,canProcessFull:!1}),t.push({pathname:y?"/tools/audio-noise-remover":"/tools/music-separation"}),D(!1),_(0)}catch(e){console.error("Error processing full audio:",e),Z(j.processFullError),K(!0),D(!1),_(0)}finally{tb.current=!1}}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.bV,{title:j.seoTitle,noindex:!0}),(0,a.jsx)(c.A,{title:j.layoutTitle,description:j.layoutDescription,activeTool:y?"audio-noise-remover":"music-separation",children:(0,a.jsx)("div",{className:"mx-auto flex h-auto min-h-[calc(100dvh-5rem)] max-w-7xl flex-col overflow-visible p-2 lg:h-[calc(100dvh-80px)] lg:min-h-[calc(100dvh-80px)] lg:overflow-hidden lg:p-6",children:(0,a.jsxs)(s.N,{mode:"wait",children:[rC&&(0,a.jsxs)(i.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"flex min-h-[calc(100dvh-7rem)] flex-col items-center py-8 text-center lg:min-h-[calc(100dvh-9rem)] lg:py-12",children:[(0,a.jsxs)("div",{className:"flex w-full flex-1 flex-col items-center justify-center",children:[(0,a.jsx)(e7,{}),(0,a.jsx)(e9,{words:w.words,suffix:w.suffix}),(0,a.jsx)("p",{className:"text-sm md:text-base text-gray-600 mb-6 md:mb-8",children:tF||rE?j.preparingDescription:j.processingDescription}),(0,a.jsxs)("div",{className:"mx-auto w-full max-w-md",children:[(0,a.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-3 mb-2",children:(0,a.jsx)("div",{className:"bg-gradient-to-r from-purple-600 to-blue-600 h-3 rounded-full transition-all duration-300",style:{width:"".concat(rN,"%")}})}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:[rN,"% ",j.complete]})]})]}),O&&(0,a.jsx)("div",{className:"mt-8 flex w-full justify-center md:mt-10",children:(0,a.jsx)(te,{file:O,copy:j.originalPlayer,onTimeChange:rq})})]},"processing"),rP&&(0,a.jsxs)(i.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"tool-processing-completed flex min-h-[calc(100dvh-5rem)] flex-1 flex-col overflow-visible lg:mt-0 lg:h-auto lg:min-h-0 lg:overflow-hidden lg:pb-0 ".concat(rM?"-mt-12 pb-28 md:pb-0":"-mt-12 pb-36"),children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-2 lg:mb-4 flex-shrink-0",children:[(0,a.jsx)("div",{className:""}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{ref:rA,className:"hidden items-center gap-2 md:flex"}),"completed"===rj&&(0,a.jsxs)(i.P.button,{className:"tool-export-primary m-1 flex items-center gap-1 rounded-lg px-3 py-1.5 text-sm font-semibold transition-all disabled:cursor-not-allowed disabled:shadow-none lg:gap-2 lg:px-4 lg:py-2 lg:text-base",whileHover:{scale:1.02},whileTap:{scale:.98},disabled:!rR,onClick:()=>{if(!rR)return void alert(j.tracksPreparingError);rz.setSelectedFormat("video"===b?"mp4":"mp3"),y&&!rz.selectedChannels.includes("vocal")&&rz.toggleChannelSelection("vocal"),rz.setShowExportModal(!0)},children:[(0,a.jsx)("svg",{className:"w-4 h-4 md:w-5 md:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),j.export]})]})]}),tC&&"completed"===rj&&(0,a.jsx)(i.P.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"mb-4 p-4 bg-gradient-to-r from-blue-50 to-purple-50 border-2 border-blue-200 rounded-xl flex-shrink-0",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("svg",{className:"w-6 h-6 text-blue-600 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("h3",{className:"font-bold text-blue-900 text-base mb-2 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-600 text-white text-xs rounded-full",children:j.previewBadge}),j.previewTitle]}),(0,a.jsxs)("p",{className:"text-sm text-blue-800 mb-3",children:[j.previewDescription((0,eO.a3)(tP)),tT&&j.previewCta]})]})]})}),G&&"completed"===rj&&(0,a.jsx)(i.P.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},className:"mb-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800",children:G}),tC&&tT&&"completed"===rj&&!R&&(0,a.jsx)(i.P.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"mb-4 flex-shrink-0",children:(0,a.jsxs)(i.P.button,{className:"w-full bg-gradient-to-r from-purple-600 to-blue-600 text-white font-semibold py-3 px-6 rounded-xl hover:shadow-xl transition-all flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",whileHover:{scale:1.02,boxShadow:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"},whileTap:{scale:.98},onClick:r3,disabled:!O,children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"})}),j.processFullAudio," (",(0,eO.a3)(tP),")"]})}),!m&&tC&&(0,a.jsx)(i.P.div,{initial:{opacity:0,y:-10}
1,animate:{opacity:1,y:0},className:"mb-4 flex-shrink-0",children:(0,a.jsxs)(i.P.button,{className:"w-full bg-gradient-to-r from-purple-600 to-blue-600 text-white font-semibold py-3 px-6 rounded-xl hover:shadow-xl transition-all flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",whileHover:{scale:1.02,boxShadow:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"},whileTap:{scale:.98},onClick:()=>t.push("/login"),children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"})}),j.loginToProcessFullAudio," (",(0,eO.a3)(tP),")"]})}),R&&(0,a.jsxs)(i.P.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"mb-4 p-4 bg-white border-2 border-purple-200 rounded-xl flex-shrink-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,a.jsx)(i.P.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-8 h-8 border-4 border-purple-200 border-t-purple-600 rounded-full"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900",children:j.processingFullAudio}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:j.fullAudioProgress((0,eO.a3)(tP))})]})]}),(0,a.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,a.jsx)("div",{className:"bg-gradient-to-r from-purple-600 to-blue-600 h-2 rounded-full transition-all duration-300",style:{width:"".concat(Math.round(B),"%")}})}),(0,a.jsxs)("p",{className:"text-xs text-gray-500 mt-1 text-right",children:[Math.round(B),"%"]})]}),"video"===b&&P?(0,a.jsx)("div",{className:"tool-processing-display-area min-h-0 overflow-visible lg:mb-4 lg:flex-1 lg:overflow-hidden ".concat(rM?"mt-6 mb-3 flex flex-1 flex-col items-center justify-center md:mt-0 md:mb-2":"mb-2"),children:(0,a.jsx)(V,{videoFile:P,tracks:rs,mutedTracks:tW,soloedTrack:tq,isPlaying:t_&&rc,isLooping:tO,loopStart:tU,loopEnd:tI,currentTime:tB,syncRevision:tV,masterVolume:tH,useWebAudioPlayback:!0,tempoRatio:tN?eZ:1,audioOutputLatency:tN?tl:0,pitchTempoEngineState:ta,showTrackControls:!y,onTrackVolumeChange:r4,onLoadedMetadata:tJ,onTimeUpdate:tQ,onTrackReady:rZ,onPlaybackBlocked:rW,onPlaybackFailed:r$,isLyricsOpen:J,lyricsStatus:ee,lyricsWords:rm,lyricsProgress:er,lyricsError:en,onLyricsWordClick:rk,onCloseLyrics:()=>Q(!1),onRetryLyrics:rw,lyricsLabels:j.lyricsPanel,labels:j.videoDisplay})}):(0,a.jsxs)("div",{className:"tool-processing-display-area relative mb-2 min-h-0 overflow-visible lg:mb-4 lg:flex-1 lg:overflow-visible",children:[(0,a.jsxs)("div",{className:"flex h-auto min-h-0 flex-col gap-2 lg:h-full lg:gap-3",children:[(0,a.jsx)("div",{className:"flex min-h-0 flex-1 flex-col ".concat(tw?"space-y-1 lg:space-y-1.5":"space-y-2 lg:space-y-3"),children:rs.map(e=>{let t=tq?tq!==e.id:tW.has(e.id),r=tq===e.id;return e.active?(0,a.jsx)("div",{className:"min-h-0 lg:flex-1 ".concat(tw?"lg:max-h-[12vh]":""),children:(0,a.jsx)(M,{trackId:e.id,trackName:e.name,trackLabel:e.label,downloadUrl:e.downloadUrl,cacheStatus:e.cacheStatus,cacheError:e.cacheError,downloadProgress:e.downloadProgress,isActive:e.active,playbackReady:e.playbackReady,color:e.color,icon:e.icon,isPlaying:t_&&rc,currentTime:tB,syncRevision:tV,duration:tD,masterVolume:tH,isLooping:tO,loopStart:tU,isMuted:t,isSoloed:r,useWebAudioPlayback:!0,showTrackControls:!y,loadWaveformOnMobile:y,onLoadedMetadata:tJ,onTrackReady:rZ,onTrackVolumeChange:r4,getMasterTime:rH,onPlaybackBlocked:rW,onPlaybackFailed:rK,onSeek:t0,onMute:r1,onSolo:r2,labels:j.trackDisplay})},e.id):null})}),(0,a.jsxs)("div",{className:"tool-audio-lyrics-subtitle-row pointer-events-none flex h-14 min-h-14 max-h-14 flex-shrink-0 items-center justify-center overflow-hidden px-4 py-4 text-center text-xl font-semibold leading-snug transition-opacity duration-150 ease-out md:text-base lg:text-lg ".concat(rg?"opacity-100":"opacity-0"),children:[rx&&(0,a.jsx)("span",{className:"tool-audio-lyrics-subtitle-loading",children:j.lyricsPanel.generating}),rf&&rh&&(0,a.jsx)("span",{className:"whitespace-pre-wrap",children:rh.map((e,t)=>{let r,{word:n,index:l}=e,o="word"===n.type,i=o&&Number.isFinite(n.start)&&tB>=n.start;return o&&(r=i?"tool-audio-lyrics-subtitle-word-active transition-colors duration-150 ease-out":"tool-audio-lyrics-subtitle-word transition-colors duration-150 ease-out"),(0,a.jsx)("span",{className:r,children:n.text},"audio-subtitle-".concat(n.text,"-").concat(l,"-").concat(t,"-").concat(n.start))})})]})]}),(0,a.jsx)(s.N,{children:tk&&J&&!ek&&(0,a.jsx)(T,{status:ee,words:rm,currentTime:tB,progress:er,errorMessage:en,onWordClick:rk,onRetry:rw,onClose:()=>Q(!1),labels:j.lyricsPanel,className:"tool-lyrics-audio-waveform-overlay !absolute bottom-0 right-0 top-0 z-10 hidden rounded-none md:left-[240px] md:flex md:rounded-xl"},"desktop-lyrics")}),(0,a.jsx)(s.N,{children:tk&&J&&ek&&(0,a.jsx)("div",{className:"tool-lyrics-mobile-overlay fixed left-0 right-0 top-0 z-[80] bg-black md:hidden",children:(0,a.jsx)(T,{status:ee,words:rm,currentTime:tB,progress:er,errorMessage:en,onWordClick:rk,onRetry:rw,onClose:()=>Q(!1),labels:j.lyricsPanel,className:"h-full w-full rounded-none"},"mobile-lyrics")})}),tO&&tD>
10&&!J&&(0,a.jsx)("div",{ref:ts,className:"pointer-events-none absolute bottom-0 top-0 hidden lg:block",style:{left:"240px",right:"8px"},children:(0,a.jsxs)("div",{className:"absolute bottom-0 border border-purple-400/45 bg-gradient-to-r from-purple-600/16 to-blue-600/16",style:{top:"-30px",left:"".concat(rT,"%"),width:"".concat(Math.max(rL-rT,0),"%")},children:[(0,a.jsx)("button",{type:"button",className:"pointer-events-auto absolute left-0 h-8 w-8 cursor-ew-resize rounded-sm bg-[#1d2d68] text-white transition-colors hover:bg-[#24408f]",onMouseDown:e=>{e.preventDefault(),ts.current&&(ti.current={edge:"start",rect:ts.current.getBoundingClientRect()})},title:v?"Ajuster le d\xe9but de la boucle":"Adjust loop start",children:(0,a.jsx)("span",{className:"flex h-full w-full items-center justify-center",children:(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14m-5-5 5 5-5 5"})})})}),(0,a.jsx)("button",{type:"button",className:"pointer-events-auto absolute right-0 h-8 w-8 cursor-ew-resize rounded-sm bg-[#1d2d68] text-white transition-colors hover:bg-[#24408f]",onMouseDown:e=>{e.preventDefault(),ts.current&&(ti.current={edge:"end",rect:ts.current.getBoundingClientRect()})},title:v?"Ajuster la fin de la boucle":"Adjust loop end",children:(0,a.jsx)("span",{className:"flex h-full w-full items-center justify-center",children:(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 12H5m5-5-5 5 5 5"})})})})]})})]}),(0,a.jsx)("div",{className:"tool-processing-master-shell fixed inset-x-0 z-[70] flex-shrink-0 md:sticky md:bottom-0 md:mt-auto md:border-t-0 md:bg-transparent md:shadow-none ".concat(rM?"bottom-4 border-t-0 bg-transparent shadow-none":"bottom-0 border-t border-white/10 bg-black/95 shadow-[0_-18px_48px_rgba(0,0,0,0.42)]"),children:(0,a.jsx)(es,{isPlaying:t_&&rc,isLooping:tO,currentTime:tB,duration:tD,loopStart:tU,loopEnd:tI,masterVolume:tH,showVolumeBooster:y,volumeBoostPercent:tt,onVolumeBoostChange:e=>tr((0,eJ.aH)(e)),onTogglePlay:()=>{t4()},onToggleLoop:t3,onSeek:t2,onVolumeChange:re,onSkipBackward:()=>t0(Math.max(tB-10,0)),onSkipForward:()=>t0(Math.min(tB+10,tD)),onLoopStartChange:t8,onLoopEndChange:t7,showLoopRangeEditor:"video"===b,onLoopRangePreview:(e,t)=>t9(e,t),onLoopRangeCommit:(e,t)=>t9(e,t,{commitPlayback:!0}),showLyricsButton:tk,isLyricsOpen:J,onToggleLyrics:ry,pitchTempoEnabled:tN,pitchTempoEngineState:ta,analysisState:rB.state,pitchSemitones:eq,tempoRatio:eZ,sourceBpm:rB.effectiveBpm,sourceKey:rB.effectiveKey,onPitchChange:rV,onTempoRatioChange:r_,onSourceBpmChange:rB.setCorrectedBpm,onRetryAnalysis:rB.retry,desktopTransformControlsTarget:rS,formatTime:e=>{if(!Number.isFinite(e))return"00:00";let t=Math.floor(e/60),r=Math.floor(e%60);return"".concat(t.toString().padStart(2,"0"),":").concat(r.toString().padStart(2,"0"))},labels:j.playback})}),(0,a.jsx)(H,{isOpen:rz.showExportModal,isAuthenticated:m,tracks:rF,selectedFormat:rz.selectedFormat,selectedChannels:rz.selectedChannels,mediaType:b,showLongerVideoExportWarning:"video"===b&&Math.abs(eZ-1)>1e-6,showExportAll:!y,canDownload:null==(e=null==u?void 0:u.canDownload)||e,onClose:()=>rz.setShowExportModal(!1),onFormatChange:rz.setSelectedFormat,onChannelToggle:y?()=>void 0:rz.toggleChannelSelection,onExportSelected:rQ,onExportAll:r0,labels:j.exportModal}),eg&&(0,a.jsx)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:()=>eb(!1),children:(0,a.jsxs)(i.P.div,{initial:{opacity:0,scale:.92,y:12},animate:{opacity:1,scale:1,y:0},className:"tool-lyrics-upgrade-modal w-full max-w-md rounded-2xl bg-white p-6 text-slate-950 shadow-2xl md:p-8",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"mb-6 flex items-start gap-4",children:[(0,a.jsx)("div",{className:"tool-lyrics-upgrade-icon flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-purple-100",children:(0,a.jsx)("svg",{className:"tool-lyrics-upgrade-icon-svg h-6 w-6 text-purple-700",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8V7m0 9v1m9-5a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h3",{className:"tool-lyrics-upgrade-title mb-2 text-xl font-bold text-slate-950",children:j.lyricsUpgradeModal.title}),(0,a.jsx)("p",{className:"tool-lyrics-upgrade-message text-sm leading-6 text-slate-600",children:j.lyricsUpgradeModal.message})]})]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)(i.P.button,{type:"button",className:"flex-1 rounded-lg bg-slate-100 px-4 py-2.5 font-medium text-slate-700 transition-colors hover:bg-slate-200",whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>eb(!1),children:j.lyricsUpgradeModal.notNow}
1),(0,a.jsx)(i.P.button,{type:"button",className:"flex-1 rounded-lg bg-gradient-to-r from-purple-600 to-blue-600 px-4 py-2.5 font-medium text-white transition-all hover:shadow-lg",whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>{eb(!1),t.push("/pricing")},children:j.lyricsUpgradeModal.viewPlans})]})]})}),z&&"video"===b&&(0,a.jsx)("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50",children:(0,a.jsx)(i.P.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"bg-white rounded-2xl p-8 max-w-md w-full shadow-2xl mx-4",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(i.P.div,{className:"inline-flex items-center justify-center w-16 h-16 mb-4 bg-purple-100 rounded-full",animate:{rotate:360},transition:{duration:2,repeat:1/0,ease:"linear"},children:(0,a.jsx)("svg",{className:"w-8 h-8 text-purple-600",fill:"none",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:j.mergingVideo}),(0,a.jsx)("p",{className:"text-gray-600 mb-6",children:j.mergingVideoDescription}),(0,a.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-3 mb-2",children:(0,a.jsx)(i.P.div,{className:"bg-gradient-to-r from-purple-600 to-blue-600 h-3 rounded-full transition-all duration-300",initial:{width:0},animate:{width:"".concat(Math.round(A),"%")},style:{width:"".concat(Math.round(A),"%")}})}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:[Math.round(A),"% ",j.complete]}),(0,a.jsx)("p",{className:"text-xs text-gray-400 mt-2",children:j.downloadStarts})]})})}),q&&(0,a.jsx)("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>K(!1),children:(0,a.jsxs)(i.P.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"bg-white rounded-2xl p-6 md:p-8 max-w-md w-full shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-start gap-4 mb-6",children:[(0,a.jsx)("div",{className:"w-12 h-12 bg-red-100 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)("svg",{className:"w-6 h-6 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:j.insufficientCredits}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:Y})]})]}),(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)(i.P.button,{className:"flex-1 px-4 py-2.5 bg-gray-100 text-gray-700 rounded-lg font-medium hover:bg-gray-200 transition-colors",whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>K(!1),children:j.cancel}),(0,a.jsx)(i.P.button,{className:"flex-1 px-4 py-2.5 bg-gradient-to-r from-purple-600 to-blue-600 text-white rounded-lg font-medium hover:shadow-lg transition-all",whileHover:{scale:1.02},whileTap:{scale:.98},onClick:()=>{K(!1),t.push("/pricing")},children:j.buyCredits})]})]})})]},"completed"),"error"===rj&&(0,a.jsxs)(i.P.div,{initial:{opacity:0}
1,animate:{opacity:1},className:"text-center py-8 md:py-12",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 md:w-20 md:h-20 mb-3 md:mb-4 bg-red-100 rounded-full",children:(0,a.jsx)("svg",{className:"w-8 h-8 md:w-10 md:h-10 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)("h2",{className:"text-2xl md:text-3xl font-bold text-gray-900 mb-2",children:j.processingFailed}),(0,a.jsx)("p",{className:"text-sm md:text-base text-gray-600 mb-4 md:mb-6 px-4",children:v?j.genericProcessingError:tS}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[(0,a.jsx)(i.P.button,{className:"bg-gradient-to-r from-purple-600 to-blue-600 text-white font-semibold px-6 md:px-8 py-2.5 md:py-3 rounded-lg hover:shadow-lg transition-all text-sm md:text-base",whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>t.push(y?"/tools/audio-noise-remover":v?"/fr/tools/music-separation":"/tools/music-separation"),children:j.tryAgain}),(0,a.jsx)(i.P.button,{className:"border border-purple-200 bg-purple-50 text-purple-700 font-semibold px-6 md:px-8 py-2.5 md:py-3 rounded-lg transition-all text-sm md:text-base",whileHover:{scale:1.03},whileTap:{scale:.97},onClick:()=>void rn(),children:j.refreshUrls}),(0,a.jsx)(i.P.button,{className:"border border-blue-200 bg-blue-50 text-blue-700 font-semibold px-6 md:px-8 py-2.5 md:py-3 rounded-lg transition-all text-sm md:text-base",whileHover:{scale:1.03},whileTap:{scale:.97},onClick:()=>void rl(),children:j.redownloadStems})]})]},"error")]})})})]})}}}]);
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.