@acedatacloud/nexior 3.277.4 → 3.277.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ApiCodeButton-DXN7iB8l.js → ApiCodeButton-9rdgO0or.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-CPQb26DU.js → AskUserQuestionCard-BO9LbC9D.js} +1 -1
- package/dist/assets/{Auth-BkXFXHwC.js → Auth-C3zTAhvN.js} +1 -1
- package/dist/assets/{Bare-B5EPTD3k.js → Bare-3PA6dGCh.js} +1 -1
- package/dist/assets/{BotPlaceholder-R_nAAbft.js → BotPlaceholder-DhZ616uF.js} +1 -1
- package/dist/assets/{BottomFooter-jepzQURF.js → BottomFooter-DegHQFt2.js} +1 -1
- package/dist/assets/{Callback-DH3ldyqo.js → Callback-Csgmunrn.js} +1 -1
- package/dist/assets/{Console-rsr21rbN.js → Console-DTqwL9iH.js} +1 -1
- package/dist/assets/{Consumption-CjrpUNmV.js → Consumption-Dv4UTeE5.js} +1 -1
- package/dist/assets/{Conversation-PmXYPnF1.js → Conversation-CP5iZ9Gh.js} +1 -1
- package/dist/assets/{CopyToClipboard-DXA4nHxo.js → CopyToClipboard-CW-duTMh.js} +1 -1
- package/dist/assets/{Detail-BtKYzcA7.js → Detail-Z_2SqsPW.js} +2 -2
- package/dist/assets/{Extra-B9rCcwWj.js → Extra-BspM5QQI.js} +1 -1
- package/dist/assets/{FilePreview-Dqk4WVEr.js → FilePreview-BTDowqVT.js} +1 -1
- package/dist/assets/{Hailuo-D_ir2qwk.js → Hailuo-kmnQTeOS.js} +1 -1
- package/dist/assets/{History-g_mPJBRP.js → History-DJwnqCd7.js} +1 -1
- package/dist/assets/{ImagePreview-Bkw_taCt.js → ImagePreview-CjurFfIy.js} +1 -1
- package/dist/assets/{ImageWrapper-BPvtDIMf.js → ImageWrapper-DZXsT0GB.js} +1 -1
- package/dist/assets/Index-4F7k6tIW.js +1 -0
- package/dist/assets/{Index-C2jzr33l.js → Index-BTddZVrJ.js} +1 -1
- package/dist/assets/{Index-C8zclc3l.js → Index-BXuf-l6W.js} +1 -1
- package/dist/assets/{Index-ZXaIaAWW.js → Index-BXyyTYVj.js} +1 -1
- package/dist/assets/{Index-DQ6WJNd4.js → Index-B_2uV-WB.js} +1 -1
- package/dist/assets/{Index-BDGE5GsR.js → Index-B_V1107d.js} +1 -1
- package/dist/assets/{Index-CJ_B5PUw.js → Index-BnMrjX59.js} +1 -1
- package/dist/assets/{Index-BQWV4ACZ.js → Index-BrR-NCxC.js} +1 -1
- package/dist/assets/{Index-C9vdHrH1.js → Index-BsFA8G7I.js} +1 -1
- package/dist/assets/{Index-Dsbx7mYp.js → Index-Bueutmwo.js} +1 -1
- package/dist/assets/{Index-CGQPNGH6.js → Index-CHZJjObr.js} +1 -1
- package/dist/assets/{Index-CaYlG9QS.js → Index-CZT2jdAy.js} +1 -1
- package/dist/assets/{Index-CqgNerQP.js → Index-Ck7P_BAG.js} +1 -1
- package/dist/assets/{Index-JB4pTHsw.js → Index-CtQ2amxO.js} +1 -1
- package/dist/assets/{Index-BHzERvOB.js → Index-DIr7JBqu.js} +1 -1
- package/dist/assets/{Index-CycuKObu.js → Index-DSHxxiqN.js} +1 -1
- package/dist/assets/{Index-C3yZt6r4.js → Index-Dai9c3aE.js} +1 -1
- package/dist/assets/{Index-B6G7B2I0.js → Index-DcuCXN4S.js} +1 -1
- package/dist/assets/{Index-D9e-AGnZ.js → Index-DxNU9BrQ.js} +1 -1
- package/dist/assets/{Index-ComARfRw.js → Index-LMJdIXo8.js} +1 -1
- package/dist/assets/{Index-C2M1W6HA.js → Index-SRN-SciE.js} +1 -1
- package/dist/assets/{Index-ke_plb_v.js → Index-VVvUshW_.js} +1 -1
- package/dist/assets/{Index-CTuEMRMq.js → Index-Y1wgnIWr.js} +1 -1
- package/dist/assets/{Index-Wn4WhxSA.js → Index-_c1bADkv.js} +1 -1
- package/dist/assets/{Index-DSIgRXEN.js → Index-aVHAY8VD.js} +1 -1
- package/dist/assets/{Index-D3Do9QG2.js → Index-rxEQpPu3.js} +1 -1
- package/dist/assets/{Invitees-CtOjf0iy.js → Invitees-CtmT6N2P.js} +1 -1
- package/dist/assets/{List-DjAb-cmd.js → List-B1eQgXm4.js} +1 -1
- package/dist/assets/{List-HnIA1E2e.js → List-BQsxl9OO.js} +1 -1
- package/dist/assets/{List-CpB562Ry.js → List-Bqa5U4qI.js} +1 -1
- package/dist/assets/{Main-BI0k19m6.js → Main-BtSiwJEL.js} +1 -1
- package/dist/assets/{Model-wnwwcJwj.js → Model-CL7S3uKt.js} +1 -1
- package/dist/assets/{Navigator-BknUSx4Z.js → Navigator-C989uP0E.js} +1 -1
- package/dist/assets/{NoTasks-568fhAGt.js → NoTasks-HGgmWayY.js} +1 -1
- package/dist/assets/{NotFound-Co5GcLDE.js → NotFound-CPpraXlK.js} +1 -1
- package/dist/assets/{Pagination-C9VVozAy.js → Pagination-DkhsjZ3x.js} +1 -1
- package/dist/assets/{Pay-D0MlHd8L.js → Pay-BWm8WKVp.js} +1 -1
- package/dist/assets/{Player--ctmekZs.js → Player-Dg2tf_iI.js} +1 -1
- package/dist/assets/{Seedance-vljqSpVs.js → Seedance-Cszb_X1k.js} +1 -1
- package/dist/assets/{Status-CvH_CBCZ.js → Status-B7xq2zJE.js} +1 -1
- package/dist/assets/{Subscribe-DCU6AfQa.js → Subscribe-CBnMeeuP.js} +1 -1
- package/dist/assets/{TabSwitcher-CHZ_ECnY.js → TabSwitcher-g-agCufh.js} +1 -1
- package/dist/assets/{Tts-DGZwUosH.js → Tts-DOJJTFgz.js} +1 -1
- package/dist/assets/{VideoPlayer-BjsbkQZc.js → VideoPlayer-_FQCj0ZO.js} +1 -1
- package/dist/assets/{avatar-CHgySyav.js → avatar-BlmXvUoy.js} +1 -1
- package/dist/assets/{basic-CjTT_oRU.js → basic-CdSp10T2.js} +1 -1
- package/dist/assets/{chat-BOAbBwQI.js → chat-BDQkbDpx.js} +1 -1
- package/dist/assets/{codingBridge-B-gY1N1A.js → codingBridge-3WJhCzBo.js} +1 -1
- package/dist/assets/{codingBridge-DAK6VumY.js → codingBridge-3WOLNEpk.js} +1 -1
- package/dist/assets/{codingBridge-B6CatBrM.js → codingBridge-8n45uKpV.js} +1 -1
- package/dist/assets/{codingBridge-iRMNlW_S.js → codingBridge-BMEP_vTH.js} +1 -1
- package/dist/assets/{codingBridge-GHfcAtW8.js → codingBridge-BbR7lW-u.js} +1 -1
- package/dist/assets/{codingBridge-mfpuGC6b.js → codingBridge-Bh6rWHNu.js} +1 -1
- package/dist/assets/{codingBridge-D1WDrcmr.js → codingBridge-C4fHRmxn.js} +1 -1
- package/dist/assets/{codingBridge-CvB_AifV.js → codingBridge-CH5rv53f.js} +1 -1
- package/dist/assets/{codingBridge-DnLwm8Vn.js → codingBridge-CQbWRH-y.js} +1 -1
- package/dist/assets/{codingBridge-Bvgssc71.js → codingBridge-CZFOGzn8.js} +1 -1
- package/dist/assets/{codingBridge-CAhONS09.js → codingBridge-CouY2bMV.js} +1 -1
- package/dist/assets/{codingBridge-DMGrbAaR.js → codingBridge-CpCUFbIx.js} +1 -1
- package/dist/assets/{codingBridge-BPDUyHBH.js → codingBridge-Didt9l_F.js} +1 -1
- package/dist/assets/{codingBridge-DI54WF2v.js → codingBridge-K8s1qD2P.js} +1 -1
- package/dist/assets/{codingBridge-id8MUjk3.js → codingBridge-LvufX6dg.js} +1 -1
- package/dist/assets/{codingBridge--XigVvyR.js → codingBridge-X-xT4hgU.js} +1 -1
- package/dist/assets/{codingBridge-Dxupvrte.js → codingBridge-eHNUDtXs.js} +1 -1
- package/dist/assets/{codingBridge-CkaxOr4j.js → codingBridge-iKrg_YzA.js} +1 -1
- package/dist/assets/{codingBridge-Oiwx8S44.js → codingBridge-nx_Ad0y0.js} +1 -1
- package/dist/assets/{codingBridgeNotify-nSBbOsRW.js → codingBridgeNotify-CQnqejnD.js} +2 -2
- package/dist/assets/{collapse-B99-bYjk.js → collapse-DzxsO3Mt.js} +1 -1
- package/dist/assets/{constants-B6_fTlam.js → constants-EAH6CsV9.js} +1 -1
- package/dist/assets/{createTaskActions-CClbGT-n.js → createTaskActions-08HriN96.js} +1 -1
- package/dist/assets/{date-picker-BtukkZrG.js → date-picker-DFsSONyL.js} +1 -1
- package/dist/assets/{dropdown-BzFwppmF.js → dropdown-Dh3U4lax.js} +1 -1
- package/dist/assets/esm-BD9aVehm.js +1 -0
- package/dist/assets/{esm-l5ji9H4b.js → esm-Bn0vJPGM.js} +1 -1
- package/dist/assets/{esm-DFfWKlEX.js → esm-BnSUrs3x.js} +1 -1
- package/dist/assets/{esm-CWZTkeBt.js → esm-Bp9p27ec.js} +3 -3
- package/dist/assets/{esm-CyghH0i3.js → esm-CAB34Hv4.js} +2 -2
- package/dist/assets/{esm-kL8Pp6jZ.js → esm-ed2G2n0j.js} +2 -2
- package/dist/assets/{esm-BOBX4dhx.js → esm-tQgyvSEq.js} +1 -1
- package/dist/assets/{fish-BWtzHFqO.js → fish-FgOp1bSR.js} +1 -1
- package/dist/assets/{flux-C-FqnDs4.js → flux-CNKI3gnl.js} +1 -1
- package/dist/assets/{grokvideo-C9fmjCwH.js → grokvideo-CJ8EegtG.js} +1 -1
- package/dist/assets/{hailuo-BrfV-8h8.js → hailuo-g_CiU9UH.js} +1 -1
- package/dist/assets/{headshots-Mjvj0YDr.js → headshots-ba-P4q7n.js} +1 -1
- package/dist/assets/{image-tItcr5tZ.js → image-BhCAlGZE.js} +1 -1
- package/dist/assets/{index-DpREqzJQ.js → index-WLGDsbco.js} +4 -4
- package/dist/assets/{index.browser.esm-BVybW0ME.js → index.browser.esm-DWAeifl9.js} +1 -1
- package/dist/assets/{index.es-DkXuZNXE.js → index.es-DEMCbRdu.js} +1 -1
- package/dist/assets/{input-number-BZClQnf5.js → input-number-De_zhvd-.js} +1 -1
- package/dist/assets/{kling-DnnRrHSY.js → kling-6kHkdbKB.js} +1 -1
- package/dist/assets/{luma-BfJ45Nrp.js → luma-zvOlfp2v.js} +1 -1
- package/dist/assets/{midjourney-BhBFIcGa.js → midjourney-BkAINbX6.js} +1 -1
- package/dist/assets/{nanobanana-9yIPx-7N.js → nanobanana-CDdy7DXE.js} +1 -1
- package/dist/assets/{openaiimage-yBE3S9GR.js → openaiimage-MuckNyIT.js} +1 -1
- package/dist/assets/{pagination-BQOE0Lce.js → pagination-B3UvJKZu.js} +1 -1
- package/dist/assets/{pika-BwDH6RXc.js → pika-CgTKZBY7.js} +1 -1
- package/dist/assets/{pixverse-V1u83-NJ.js → pixverse-CpDZvu26.js} +1 -1
- package/dist/assets/{popover-BOyleW7G.js → popover-DaX9BEhA.js} +1 -1
- package/dist/assets/{producer-D5j29zwT.js → producer-BSdBVVx_.js} +1 -1
- package/dist/assets/{qrart-BOGIYlCy.js → qrart-DukU-wH0.js} +1 -1
- package/dist/assets/{row-D8loqAPL.js → row-DLJTcN3S.js} +1 -1
- package/dist/assets/{seedance-BFWs3OMD.js → seedance-DOMVfpfX.js} +1 -1
- package/dist/assets/{seedream-PMGj_GEr.js → seedream-qYoaVvs3.js} +1 -1
- package/dist/assets/{select-CYdISXBV.js → select-CyfjsVYT.js} +1 -1
- package/dist/assets/{serp-BXsV4ruQ.js → serp-D8F32UZn.js} +1 -1
- package/dist/assets/{slider-heMG04zo.js → slider-C8p-p_jG.js} +1 -1
- package/dist/assets/{solana-wallets-DpEYEH8X.js → solana-wallets-CxX-IPdE.js} +2 -2
- package/dist/assets/{solana-wallets-vue-DwDUK9GJ.js → solana-wallets-vue-IWygWoNX.js} +1 -1
- package/dist/assets/{sora-BPluLKCF.js → sora-BBCFCnxD.js} +1 -1
- package/dist/assets/{suno-B3FfSfsu.js → suno--sxHZfXr.js} +1 -1
- package/dist/assets/{switch-DT8swXGq.js → switch-DfeNNIjH.js} +1 -1
- package/dist/assets/{tabs-DbqhD0Ri.js → tabs-DDqt-7al.js} +1 -1
- package/dist/assets/{upload-CHAO8dYa.js → upload-CIsl9b3M.js} +1 -1
- package/dist/assets/{veo--ebyIQZO.js → veo-C0Hd8shD.js} +1 -1
- package/dist/assets/{wan-QNzJ6Wsl.js → wan-CfT1U6Bg.js} +1 -1
- package/dist/assets/{web-BhPhz6gK.js → web-8dTV3yka.js} +1 -1
- package/dist/assets/{web-Dslc1DMt.js → web-BLoe5UoX.js} +1 -1
- package/dist/assets/{web-B3c_92-W.js → web-C7_2fRfR.js} +1 -1
- package/dist/assets/{web-DaBpN21i.js → web-DH9f_v7D.js} +1 -1
- package/dist/assets/{web-CggzH-kj.js → web-jldUVJrz.js} +1 -1
- package/dist/assets/{webextrator-BVPmDKBS.js → webextrator-CiqM06HL.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/Index-CEMmW0Xt.js +0 -1
- package/dist/assets/esm-LoPWTfn9.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,M as i,N as a,O as o,P as s,Q as c,Ut as l,X as u,_ as d,et as f,k as p,lt as m,tt as h,ut as g,v as _,x as v,y}from"./vendor-chart-mdwpew_o.js";import{t as b}from"./button-DWzbdjZV.js";import{F as x,X as S,Y as C,tt as w,z as T}from"./use-deprecated-CPfQu7wa.js";import{r as E,t as D}from"./select-CYdISXBV.js";import{n as O,t as k}from"./tabs-DbqhD0Ri.js";import{n as A,t as j}from"./form-D0aSFxDK.js";import{t as M}from"./upload-CHAO8dYa.js";import{t as N}from"./tooltip-C3PYfh8V.js";import{t as P}from"./image-tItcr5tZ.js";import{t as F}from"./avatar-DJGt2zYX.js";import{t as I}from"./checkbox-hfJFSY6z.js";import{n as L,r as R,t as ee}from"./radio-IJQsW93X.js";import{n as te,t as ne}from"./collapse-B99-bYjk.js";import{t as z}from"./drawer-BvYPSxXh.js";import{n as B,r as re,t as V}from"./dropdown-BzFwppmF.js";import{t as H}from"./input-number-BZClQnf5.js";import{t as ie}from"./popover-BOyleW7G.js";import{t as ae}from"./progress-Djs_fbqu.js";import{n as oe,t as se}from"./skeleton-Cn4UY-T8.js";import{t as ce}from"./slider-heMG04zo.js";import{t as le}from"./switch-DT8swXGq.js";import{Fn as ue,hi as U}from"./constants-B6_fTlam.js";import{An as de,At as fe,E as W,Fn as pe,Ir as G,Mr as K,Nt as me,Or as q,Ot as he,Sr as ge,kr as J,kt as _e,rn as Y,yr as X}from"./index-DpREqzJQ.js";import{t as Z}from"./index.es-DkXuZNXE.js";import{n as ve}from"./taskDrawerMixin-Cr17Yxqk.js";import{i as Q,n as ye,r as be,t as xe}from"./pagination-BQOE0Lce.js";import{n as Se,t as Ce}from"./NoTasks-568fhAGt.js";import{t as we}from"./Consumption-CjrpUNmV.js";import{n as Te,r as $,t as Ee}from"./Player--ctmekZs.js";var De=s({name:`LayoutSuno`,components:{ElDrawer:z,ElButton:b,FontAwesomeIcon:Z},mixins:[ve],data(){return{preview:!1}},computed:{}}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`},je={class:`preview h-full w-[300px] flex flex-col`};function Me(t,n,i,o,s,c){let l=f(`font-awesome-icon`),h=f(`el-button`),_=f(`el-drawer`);return u(),p(`div`,Oe,[r(`div`,ke,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,Ae,[e(t.$slots,`result`,{},void 0,!0)]),r(`div`,je,[e(t.$slots,`preview`,{},void 0,!0)]),g(a(h,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[d,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:m(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ne=W(De,[[`render`,Me],[`__scopeId`,`data-v-169b0449`]]),Pe=s({name:`TypeSelector`,components:{ElSelect:E,ElOption:D,ElSwitch:le},data(){return{options:[{label:`v5.5`,value:`chirp-v5-5`,desc:this.$t(`suno.model.v55desc`)},{label:`v5`,value:`chirp-v5`,desc:this.$t(`suno.model.v5desc`)},{label:`v4.5+`,value:`chirp-v4-5-plus`,desc:this.$t(`suno.model.v45plusdesc`)},{label:`v4.5`,value:`chirp-v4-5`,desc:this.$t(`suno.model.v45desc`),dividerAfter:!0},{label:`v4`,value:`chirp-v4`,desc:this.$t(`suno.model.v4desc`)},{label:`v3.5`,value:`chirp-v3-5`,desc:this.$t(`suno.model.v35desc`)},{label:`v3`,value:`chirp-v3-0`,desc:this.$t(`suno.model.v3desc`)}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom||!1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,custom:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental||!1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,instrumental:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||=ue}}),Fe={class:`mb-3`},Ie={class:`flex items-center mb-1`},Le={class:`text-sm font-bold`},Re={class:`model-option`},ze={class:`model-option-left`},Be={class:`model-option-name`},Ve={class:`model-option-desc`},He={key:0,class:`flex items-center justify-between mb-3`},Ue={class:`text-sm font-bold`};function We(e,i,s,d,h,g){let _=f(`el-option`),y=f(`el-select`),b=f(`el-switch`);return u(),p(`div`,null,[r(`div`,Fe,[r(`div`,Ie,[r(`span`,Le,l(e.$t(`suno.name.model`)),1)]),a(y,{modelValue:e.model,"onUpdate:modelValue":i[0]||=t=>e.model=t,class:`w-full model-select`,size:`default`,placeholder:e.$t(`suno.placeholder.select`)},{default:m(()=>[(u(!0),p(v,null,c(e.options,e=>(u(),n(_,{key:e.value,label:e.label,value:e.value,class:t({"model-option-divider":e.dividerAfter})},{default:m(()=>[r(`div`,Re,[r(`div`,ze,[r(`span`,Be,l(e.label),1)]),r(`span`,Ve,l(e.desc),1)])]),_:2},1032,[`label`,`value`,`class`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),e.custom?(u(),p(`div`,He,[r(`span`,Ue,l(e.$t(`suno.name.instrumental`)),1),a(b,{modelValue:e.instrumental,"onUpdate:modelValue":i[1]||=t=>e.instrumental=t},null,8,[`modelValue`])])):o(``,!0)])}var Ge=W(Pe,[[`render`,We],[`__scopeId`,`data-v-16e4d6fc`]]),Ke=s({name:`UploadAudio`,components:{ElUpload:M,ElButton:b,ElDialog:K,ElTabs:O,ElTabPane:k,InfoIcon:Q,FontAwesomeIcon:Z,ElRadioGroup:R,ElRadioButton:L},mixins:[_e],emits:[`change`],data(){return{fileList:[],uploadUrl:ge()+`/api/v1/files/`,dialogVisible:!1,activeTab:`browse`,recording:!1,recordedBlob:null,recordedAudioUrl:null,audioPreviewUrl:null,recordTimer:null,recordSeconds:0,mediaRecorder:null,mediaStream:null,recordedChunks:[],uploadingRecord:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}},hasUploadedAudio(){let e=this.$store.state.suno?.config?.action;return e===`upload_extend`||e===`upload_cover`},uploadAction:{get(){return this.$store.state.suno?.config?.action||`upload_extend`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,action:e})}},formattedTime(){return`${Math.floor(this.recordSeconds/60).toString().padStart(2,`0`)}:${(this.recordSeconds%60).toString().padStart(2,`0`)}`}},watch:{urls:{handler(e){this.$emit(`change`,e)}}},beforeUnmount(){this.cleanupRecording()},methods:{onExceed(){J.warning(this.$t(`suno.message.uploadReferencesExceed`))},onError(){J.error(this.$t(`suno.message.uploadReferencesError`))},async onBrowseSuccess(){let e=this.urls?.[0];e&&(this.audioPreviewUrl=e,await this.onGenerateAudioId(e),this.dialogVisible=!1)},async onGenerateAudioId(e){let t={audio_url:e},n=this.credential?.token;if(!n){console.error(`no token specified`);return}J.info(this.$t(`suno.message.startingUploadAudio`));try{let e=await Y.upload(t,{token:n});console.debug(`get upload music success`,e.data);let r=e.data?.data.audio_id;this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,audio_id:r,action:`upload_extend`}),J.success(this.$t(`suno.message.startUploadAudioSuccess`))}catch(e){J.error(e?.response?.data?.error?.message||this.$t(`suno.message.startUploadAudioFailed`))}},async startRecording(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){J.error(this.$t(`suno.message.recordingUnsupported`));return}try{this.mediaStream=await navigator.mediaDevices.getUserMedia({audio:!0}),this.recordedChunks=[],this.mediaRecorder=new MediaRecorder(this.mediaStream),this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.recordedChunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.recordedChunks,{type:`audio/webm`});this.recordedBlob=e,this.recordedAudioUrl&&URL.revokeObjectURL(this.recordedAudioUrl),this.recordedAudioUrl=URL.createObjectURL(e),this.releaseStream()},this.mediaRecorder.start(),this.recording=!0,this.recordSeconds=0,this.recordTimer=window.setInterval(()=>{this.recordSeconds+=1,this.recordSeconds>=600&&this.stopRecording()},1e3)}catch(e){console.error(`record error`,e),J.error(this.$t(`suno.message.recordingPermissionDenied`))}},stopRecording(){this.recordTimer&&=(window.clearInterval(this.recordTimer),null),this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),this.recording=!1},resetRecording(){this.recordedAudioUrl&&URL.revokeObjectURL(this.recordedAudioUrl),this.recordedBlob=null,this.recordedAudioUrl=null,this.recordSeconds=0},async uploadRecording(){if(this.recordedBlob){this.uploadingRecord=!0;try{let e=new FormData,t=`recording-${Date.now()}.webm`;e.append(`file`,this.recordedBlob,t);let n=await fetch(this.uploadUrl,{method:`POST`,headers:{Authorization:`Bearer ${this.$store.state.token.access}`},body:e});if(!n.ok)throw Error(`upload failed: ${n.status}`);let r=await n.json(),i=r?.file_url||r?.data?.file_url;if(!i)throw Error(`no file_url in response`);this.audioPreviewUrl=i,await this.onGenerateAudioId(i),this.dialogVisible=!1,this.resetRecording()}catch(e){console.error(e),J.error(e?.message||this.$t(`suno.message.uploadReferencesError`))}finally{this.uploadingRecord=!1}}},releaseStream(){this.mediaStream&&=(this.mediaStream.getTracks().forEach(e=>e.stop()),null)},cleanupRecording(){this.recordTimer&&=(window.clearInterval(this.recordTimer),null),this.releaseStream(),this.recordedAudioUrl&&=(URL.revokeObjectURL(this.recordedAudioUrl),null)}}}),qe={class:`relative`},Je={class:`flex justify-between items-center mb-2`},Ye={class:`flex justify-start items-center`},Xe={class:`text-sm font-bold`},Ze={key:0,class:`mb-2`},Qe=[`src`],$e={key:1,class:`mt-2`},et={class:`py-4`},tt={class:`text-center py-6`},nt={class:`text-sm`},rt={class:`text-xs text-gray-400 mt-1`},it={class:`py-4 text-center`},at={class:`recorder-display mb-4`},ot={key:0,class:`text-red-500 flex items-center justify-center gap-2`},st={class:`text-2xl font-mono`},ct={key:1,class:`text-green-600`},lt={key:2,class:`text-gray-400 text-2xl font-mono`},ut={key:0,class:`mb-4`},dt=[`src`],ft={class:`flex justify-center gap-3`};function pt(e,t,s,c,d,h){let g=f(`info-icon`),_=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-radio-button`),x=f(`el-radio-group`),S=f(`el-upload`),C=f(`el-tab-pane`),w=f(`el-tabs`),T=f(`el-dialog`);return u(),p(`div`,qe,[r(`div`,Je,[r(`div`,Ye,[r(`span`,Xe,l(e.$t(`suno.name.referenceAudios`)),1),a(g,{content:e.$t(`suno.description.uploadAudios`)},null,8,[`content`])]),a(y,{round:``,type:`primary`,size:`small`,onClick:t[0]||=t=>e.dialogVisible=!0},{default:m(()=>[a(_,{icon:`fa-solid fa-plus`,class:`icon mr-1`}),i(` `+l(e.$t(`suno.button.addAudio`)),1)]),_:1})]),e.audioPreviewUrl?(u(),p(`div`,Ze,[r(`audio`,{src:e.audioPreviewUrl,controls:``,class:`w-full`},null,8,Qe)])):o(``,!0),e.hasUploadedAudio?(u(),p(`div`,$e,[a(x,{modelValue:e.uploadAction,"onUpdate:modelValue":t[1]||=t=>e.uploadAction=t,size:`small`},{default:m(()=>[a(b,{value:`upload_extend`},{default:m(()=>[i(l(e.$t(`suno.button.extend`)),1)]),_:1}),a(b,{value:`upload_cover`},{default:m(()=>[i(l(e.$t(`suno.button.upload_cover`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),a(T,{modelValue:e.dialogVisible,"onUpdate:modelValue":t[4]||=t=>e.dialogVisible=t,title:e.$t(`suno.name.addAudio`),width:`520px`,"close-on-click-modal":!1,"append-to-body":``},{default:m(()=>[a(w,{modelValue:e.activeTab,"onUpdate:modelValue":t[3]||=t=>e.activeTab=t,class:`add-audio-tabs`},{default:m(()=>[a(C,{name:`browse`,label:e.$t(`suno.tab.browse`)},{default:m(()=>[r(`div`,et,[a(S,{"file-list":e.fileList,"onUpdate:fileList":t[2]||=t=>e.fileList=t,name:`file`,limit:1,class:`upload-wrapper`,action:e.uploadUrl,accept:`.mp3,.wav,.m4a,audio/*`,"show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onBrowseSuccess,headers:e.headers,drag:``},{default:m(()=>[r(`div`,tt,[a(_,{icon:`fa-solid fa-upload`,class:`text-4xl text-gray-400 mb-3`}),r(`div`,nt,l(e.$t(`suno.description.dropAudioHere`)),1),r(`div`,rt,l(e.$t(`suno.description.audioFormats`)),1)])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])]),_:1},8,[`label`]),a(C,{name:`record`,label:e.$t(`suno.tab.record`)},{default:m(()=>[r(`div`,it,[r(`div`,at,[e.recording?(u(),p(`div`,ot,[t[5]||=r(`span`,{class:`recording-dot`},null,-1),r(`span`,st,l(e.formattedTime),1)])):e.recordedBlob?(u(),p(`div`,ct,[a(_,{icon:`fa-solid fa-check-circle`,class:`text-2xl mr-2`}),r(`span`,null,l(e.$t(`suno.message.recordingReady`))+` (`+l(e.formattedTime)+`)`,1)])):(u(),p(`div`,lt,`00:00`))]),e.recordedAudioUrl&&!e.recording?(u(),p(`div`,ut,[r(`audio`,{src:e.recordedAudioUrl,controls:``,class:`w-full`},null,8,dt)])):o(``,!0),r(`div`,ft,[!e.recording&&!e.recordedBlob?(u(),n(y,{key:0,type:`primary`,round:``,onClick:e.startRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-microphone`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.startRecord`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.recording?(u(),n(y,{key:1,type:`danger`,round:``,onClick:e.stopRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-stop`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.stopRecord`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.recordedBlob&&!e.recording?(u(),p(v,{key:2},[a(y,{round:``,onClick:e.resetRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.reRecord`)),1)]),_:1},8,[`onClick`]),a(y,{type:`primary`,round:``,loading:e.uploadingRecord,onClick:e.uploadRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-upload`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])],64)):o(``,!0)])])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`])])}var mt=W(Ke,[[`render`,pt],[`__scopeId`,`data-v-5f17a1f4`]]),ht=[{key:`lofi`,label:`🎧 Lo-fi Chill`,prompt:`a relaxing lo-fi hip hop beat for studying`},{key:`pop-love`,label:`💕 Pop Love Song`,prompt:`a catchy pop love song with sweet melodies`},{key:`rock-anthem`,label:`🎸 Rock Anthem`,prompt:`an energetic rock anthem with electric guitars`},{key:`jazz-night`,label:`🎷 Jazz Night`,prompt:`a smooth late-night jazz piece with saxophone`},{key:`edm-drop`,label:`⚡ EDM Drop`,prompt:`an intense EDM track with a massive drop`},{key:`folk-story`,label:`🪕 Folk Story`,prompt:`a warm folk song telling a story about traveling`},{key:`rnb-groove`,label:`🎤 R&B Groove`,prompt:`a smooth R&B groove with soulful vocals`},{key:`classical`,label:`🎻 Classical`,prompt:`an elegant classical piece for orchestra`},{key:`hip-hop`,label:`🎤 Hip Hop`,prompt:`a hard-hitting hip hop beat with bass`},{key:`country`,label:`🤠 Country`,prompt:`an upbeat country song with acoustic guitar and banjo`},{key:`reggae`,label:`🌴 Reggae`,prompt:`a laid-back reggae tune with island vibes`},{key:`latin`,label:`💃 Latin`,prompt:`a vibrant Latin dance track with percussion`},{key:`ambient`,label:`🌊 Ambient`,prompt:`a dreamy ambient soundscape for relaxation`},{key:`metal`,label:`🤘 Metal`,prompt:`a powerful metal song with heavy riffs and double bass drums`},{key:`soul`,label:`🎵 Soul`,prompt:`a heartfelt soul ballad with gospel harmonies`},{key:`synthwave`,label:`🌃 Synthwave`,prompt:`a retro synthwave track with 80s vibes`},{key:`kpop`,label:`🇰🇷 K-Pop`,prompt:`a catchy K-pop dance track with hook`},{key:`lullaby`,label:`🌙 Lullaby`,prompt:`a gentle lullaby for bedtime with soft piano`},{key:`cinematic`,label:`🎬 Cinematic`,prompt:`an epic cinematic orchestral score for a movie trailer`},{key:`blues`,label:`🎸 Blues`,prompt:`a soulful blues song with electric guitar bends`},{key:`disco`,label:`🕺 Disco`,prompt:`a funky disco track with groovy bassline`},{key:`punk`,label:`🔥 Punk Rock`,prompt:`a fast punk rock song with raw energy`},{key:`gospel`,label:`⛪ Gospel`,prompt:`an uplifting gospel choir song with piano`},{key:`trap`,label:`🔊 Trap`,prompt:`a dark trap beat with 808s and hi-hats`},{key:`bossa`,label:`☕ Bossa Nova`,prompt:`a gentle bossa nova with nylon guitar`},{key:`indie`,label:`🎶 Indie`,prompt:`a dreamy indie track with ethereal vocals`},{key:`cpop`,label:`🇨🇳 C-Pop`,prompt:`a beautiful Chinese pop ballad with emotional vocals`},{key:`jpop`,label:`🇯🇵 J-Pop`,prompt:`a cheerful J-pop song with anime vibes`},{key:`afrobeat`,label:`🥁 Afrobeat`,prompt:`a groovy Afrobeat track with layered percussion`},{key:`game`,label:`🎮 Game BGM`,prompt:`an adventurous video game background music`}],gt=8;function _t(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var vt=s({name:`PromptInput`,components:{FontAwesomeIcon:Z,PromptTextarea:Se},data(){return{shuffledTags:_t(ht)}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,prompt:e})}},visibleTags(){return this.shuffledTags.slice(0,gt)}},mounted(){this.prompt||=``},methods:{onTagClick(e){this.prompt=e.prompt},onRefreshTags(){this.shuffledTags=_t(ht)}}}),yt={class:`inspo-tags`},bt=[`onClick`];function xt(e,t,i,o,s,d){let h=f(`font-awesome-icon`),g=f(`prompt-textarea`);return u(),n(g,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`suno.name.songDescription`),info:e.$t(`suno.description.prompt`),placeholder:e.$t(`suno.placeholder.prompt`),"min-rows":5,"max-rows":14},{after:m(()=>[r(`div`,yt,[(u(!0),p(v,null,c(e.visibleTags,t=>(u(),p(`button`,{key:t.key,class:`inspo-tag`,onClick:n=>e.onTagClick(t)},l(t.label),9,bt))),128)),r(`button`,{class:`inspo-tag inspo-tag-refresh`,onClick:t[0]||=(...t)=>e.onRefreshTags&&e.onRefreshTags(...t)},[a(h,{icon:`fa-solid fa-arrows-rotate`})])])]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var St=W(vt,[[`render`,xt],[`__scopeId`,`data-v-58ffcd38`]]),Ct=s({name:`LyricInput`,components:{ElInput:G,ElButton:b,ElTooltip:N,ElDialog:K,FontAwesomeIcon:Z,InfoIcon:Q},data(){return{generatingLyrics:!1,enhancingLyrics:!1,enhancePrompt:``,lyricHistory:[],expanded:!1}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config},credential(){return this.$store.state.suno?.credential}},mounted(){this.lyric||=``},methods:{pushHistory(){this.lyric&&(this.lyricHistory.push(this.lyric),this.lyricHistory.length>20&&this.lyricHistory.shift())},onUndo(){let e=this.lyricHistory.pop();e!==void 0&&(this.lyric=e)},onClear(){this.pushHistory(),this.lyric=``},async onEnhanceLyrics(){let e=this.credential?.token;if(!(!e||!this.lyric||!this.enhancePrompt)){this.pushHistory(),this.enhancingLyrics=!0,J.info(this.$t(`suno.message.enhancingLyrics`));try{let t=`${this.enhancePrompt}\n\nOriginal lyrics:\n${this.lyric}`,n=(await Y.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,this.enhancePrompt=``,J.success(this.$t(`suno.message.enhanceLyricsSuccess`)))}catch{J.error(this.$t(`suno.message.enhanceLyricsFailed`))}finally{this.enhancingLyrics=!1}}},async onGenerateLyrics(){let e=this.credential?.token;if(!e)return;let t;try{t=((await q.prompt(this.$t(`suno.message.lyricsThemePromptMessage`),this.$t(`suno.message.lyricsThemePromptTitle`),{confirmButtonText:this.$t(`common.button.confirm`),cancelButtonText:this.$t(`common.button.cancel`),inputPlaceholder:this.$t(`suno.placeholder.lyricsTheme`),inputValue:this.config?.title||``,inputType:`textarea`,inputValidator:e=>typeof e==`string`&&e.trim().length>0||this.$t(`suno.message.lyricsThemeRequired`)})).value||``).trim()}catch{return}if(t){this.pushHistory(),this.generatingLyrics=!0,J.info(this.$t(`suno.message.generatingLyrics`));try{let n=(await Y.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,n?.title&&!this.config?.title&&this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric:n.text,title:n.title}),J.success(this.$t(`suno.message.generateLyricsSuccess`)))}catch{J.error(this.$t(`suno.message.generateLyricsFailed`))}finally{this.generatingLyrics=!1}}}}}),wt={class:`field`},Tt={class:`flex items-center justify-between mb-1`},Et={class:`flex items-center`},Dt={class:`text-sm font-bold`},Ot={class:`flex items-center gap-1`},kt={class:`relative`},At={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},jt={key:0,class:`enhance-bar`},Mt={key:0,class:`enhance-bar mt-3`},Nt={class:`flex items-center justify-between`},Pt={class:`flex items-center gap-1`};function Ft(e,t,s,c,d,h){let g=f(`info-icon`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-tooltip`),x=f(`el-input`),S=f(`el-dialog`);return u(),p(`div`,wt,[r(`div`,Tt,[r(`div`,Et,[r(`span`,Dt,l(e.$t(`suno.name.lyrics`)),1),a(g,{content:e.$t(`suno.description.lyrics`)},null,8,[`content`])]),r(`div`,Ot,[e.lyricHistory.length>0?(u(),n(b,{key:0,content:e.$t(`suno.button.undo`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:e.onUndo},{default:m(()=>[a(v,{icon:`fa-solid fa-rotate-left`})]),_:1},8,[`onClick`])]),_:1},8,[`content`])):o(``,!0),e.lyric?(u(),n(b,{key:1,content:e.$t(`suno.button.clear_lyrics`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:e.onClear},{default:m(()=>[a(v,{icon:`fa-solid fa-eraser`})]),_:1},8,[`onClick`])]),_:1},8,[`content`])):o(``,!0),a(b,{content:e.$t(`suno.button.expand_lyrics`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:t[0]||=t=>e.expanded=!0},{default:m(()=>[a(v,{icon:`fa-solid fa-expand`})]),_:1})]),_:1},8,[`content`]),e.config?.action===`extend`?o(``,!0):(u(),n(y,{key:2,size:`small`,loading:e.generatingLyrics,round:``,onClick:e.onGenerateLyrics},{default:m(()=>[e.generatingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))])]),r(`div`,kt,[e.config?.action===`extend`?(u(),n(x,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[2]||=t=>e.lyric=t,rows:5,type:`textarea`,class:`lyrics`,placeholder:e.$t(`suno.placeholder.extend.lyrics`)},null,8,[`modelValue`,`placeholder`])):(u(),n(x,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[1]||=t=>e.lyric=t,rows:5,type:`textarea`,class:`lyrics`,placeholder:e.$t(`suno.placeholder.lyrics`)},null,8,[`modelValue`,`placeholder`])),r(`div`,At,l(e.lyric?.length||0)+`/5000`,1)]),e.lyric&&e.config?.action!==`extend`?(u(),p(`div`,jt,[a(x,{modelValue:e.enhancePrompt,"onUpdate:modelValue":t[3]||=t=>e.enhancePrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.enhanceLyrics`),class:`enhance-input`,onKeyup:_(e.onEnhanceLyrics,[`enter`])},{append:m(()=>[a(y,{loading:e.enhancingLyrics,onClick:e.onEnhanceLyrics},{default:m(()=>[e.enhancingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.enhance_lyrics`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])])):o(``,!0),a(S,{modelValue:e.expanded,"onUpdate:modelValue":t[7]||=t=>e.expanded=t,title:e.$t(`suno.name.lyrics`),width:`720px`,top:`5vh`,"close-on-click-modal":!1,class:`lyrics-expand-dialog`},{footer:m(()=>[r(`div`,Nt,[r(`div`,Pt,[e.lyricHistory.length>0?(u(),n(y,{key:0,size:`small`,onClick:e.onUndo},{default:m(()=>[a(v,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.undo`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.lyric?(u(),n(y,{key:1,size:`small`,onClick:e.onClear},{default:m(()=>[a(v,{icon:`fa-solid fa-eraser`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.clear_lyrics`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.config?.action===`extend`?o(``,!0):(u(),n(y,{key:2,size:`small`,loading:e.generatingLyrics,onClick:e.onGenerateLyrics},{default:m(()=>[e.generatingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))]),a(y,{type:`primary`,onClick:t[6]||=t=>e.expanded=!1},{default:m(()=>[i(l(e.$t(`common.button.confirm`)),1)]),_:1})])]),default:m(()=>[a(x,{modelValue:e.lyric,"onUpdate:modelValue":t[4]||=t=>e.lyric=t,type:`textarea`,rows:20,class:`lyrics-expanded`,placeholder:e.$t(`suno.placeholder.lyrics`),autofocus:``},null,8,[`modelValue`,`placeholder`]),e.config?.action===`extend`?o(``,!0):(u(),p(`div`,Mt,[a(x,{modelValue:e.enhancePrompt,"onUpdate:modelValue":t[5]||=t=>e.enhancePrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.enhanceLyrics`),class:`enhance-input`,onKeyup:_(e.onEnhanceLyrics,[`enter`])},{append:m(()=>[a(y,{loading:e.enhancingLyrics,onClick:e.onEnhanceLyrics},{default:m(()=>[e.enhancingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.enhance_lyrics`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])]))]),_:1},8,[`modelValue`,`title`])])}var It=W(Ct,[[`render`,Ft],[`__scopeId`,`data-v-d7d2ec74`]]),Lt=`Pop.Rock.Jazz.R&B.Hip Hop.Lo-fi.Electronic.Classical.Country.Blues.Folk.Reggae.Metal.Punk.Soul.Funk.Ambient.Indie.Latin.Acoustic.Dance.Disco.Gospel.K-Pop.J-Pop.C-Pop.Bossa Nova.Trap.Drill.House.Techno.Dubstep.Synthwave.Chill.Dreamy.Upbeat.Melancholic.Romantic.Epic.Cinematic.Orchestral.Piano.Guitar.Saxophone.Violin.Tribal.World Music.Afrobeat.Ska.Grunge`.split(`.`),Rt=12;function zt(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var Bt=s({name:`StyleInput`,components:{ElInput:G,ElButton:b,FontAwesomeIcon:Z,InfoIcon:Q},data(){return{optimizing:!1,shuffledTags:zt(Lt)}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style:e})}},credential(){return this.$store.state.suno?.credential},visibleTags(){return this.shuffledTags.slice(0,Rt)}},methods:{onTagClick(e){let t=this.style||``;t.toLowerCase().includes(e.toLowerCase())||(this.style=t?`${t}, ${e}`:e)},onRefreshTags(){this.shuffledTags=zt(Lt)},async onOptimizeStyle(){let e=this.credential?.token;if(!(!e||!this.style)){this.optimizing=!0,J.info(this.$t(`suno.message.optimizingStyle`));try{let t=await Y.style({prompt:this.style},{token:e}),n=t.data?.text||t.data?.data?.text;n&&(this.style=n,J.success(this.$t(`suno.message.optimizeStyleSuccess`)))}catch{J.error(this.$t(`suno.message.optimizeStyleFailed`))}finally{this.optimizing=!1}}}}}),Vt={class:`field`},Ht={class:`flex items-center justify-between mb-1`},Ut={class:`flex items-center`},Wt={class:`text-sm font-bold`},Gt={class:`relative`},Kt={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},qt={class:`style-tags`},Jt=[`onClick`];function Yt(e,t,s,d,h,g){let _=f(`info-icon`),y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-input`);return u(),p(`div`,Vt,[r(`div`,Ht,[r(`div`,Ut,[r(`span`,Wt,l(e.$t(`suno.name.style`)),1),a(_,{content:e.$t(`suno.description.style`)},null,8,[`content`])]),a(b,{size:`small`,loading:e.optimizing,round:``,onClick:e.onOptimizeStyle},{default:m(()=>[e.optimizing?o(``,!0):(u(),n(y,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.optimize_style`)),1)]),_:1},8,[`loading`,`onClick`])]),r(`div`,Gt,[a(x,{modelValue:e.style,"onUpdate:modelValue":t[0]||=t=>e.style=t,rows:2,type:`textarea`,placeholder:e.$t(`suno.placeholder.style`)},null,8,[`modelValue`,`placeholder`]),r(`div`,Kt,l(e.style?.length||0)+`/1000`,1)]),r(`div`,qt,[(u(!0),p(v,null,c(e.visibleTags,t=>(u(),p(`button`,{key:t,class:`style-tag`,onClick:n=>e.onTagClick(t)},l(t),9,Jt))),128)),r(`button`,{class:`style-tag style-tag-refresh`,onClick:t[1]||=(...t)=>e.onRefreshTags&&e.onRefreshTags(...t)},[a(y,{icon:`fa-solid fa-arrows-rotate`})])])])}var Xt=W(Bt,[[`render`,Yt],[`__scopeId`,`data-v-ddebb076`]]),Zt=s({name:`TitleInput`,components:{ElInput:G,InfoIcon:Q},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,title:e})}}}}),Qt={class:`field`},$t={class:`flex items-center mb-1`},en={class:`text-sm font-bold`};function tn(e,t,n,i,o,s){let c=f(`info-icon`),d=f(`el-input`);return u(),p(`div`,Qt,[r(`div`,$t,[r(`span`,en,l(e.$t(`suno.name.title`)),1),a(c,{content:e.$t(`suno.description.title`)},null,8,[`content`])]),a(d,{modelValue:e.title,"onUpdate:modelValue":t[0]||=t=>e.title=t,placeholder:e.$t(`suno.placeholder.title`)},null,8,[`modelValue`,`placeholder`])])}var nn=W(Zt,[[`render`,tn]]),rn=s({name:`ExtendFromInput`,components:{ElImage:P,ElIcon:w,ElInputNumber:H,VideoPlay:S,VideoPause:C},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:$,onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),an={class:`field`},on={class:`box`},sn={class:`title font-bold`},cn={class:`input-wrapper`},ln={class:`task`},un={class:`left`},dn={key:2,class:`duration`},fn={class:`info`},pn={class:`title`},mn={class:`style`};function hn(e,t,n,i,s,c){let d=f(`el-input-number`),_=f(`el-image`),v=f(`video-pause`),y=f(`el-icon`),b=f(`video-play`),x=h(`loading`);return u(),p(`div`,an,[r(`div`,on,[r(`h2`,sn,l(e.$t(`suno.name.extend`)),1),r(`div`,cn,[a(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.extend.continue_at`),onChange:e.handleChange},null,8,[`modelValue`,`max`,`placeholder`,`onChange`])])]),r(`div`,ln,[e.audio?(u(),p(`div`,{key:0,class:`audio`,onClick:t[3]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,un,[a(_,{src:e.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:t[1]||=t=>e.onPause(e.audio)},[a(y,null,{default:m(()=>[a(v)]),_:1})])):o(``,!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:t[2]||=t=>e.onPlay(e.audio)},[a(y,null,{default:m(()=>[a(b)]),_:1})])):o(``,!0),e.audio?.duration?(u(),p(`div`,dn,l(e.useFormatDuring(e.audio?.duration)),1)):o(``,!0)])),[[x,!e.audio?.audio_url]]),r(`div`,fn,[r(`h2`,pn,l(e.audio?.title),1),r(`p`,mn,l(e.audio?.style),1)])])):o(``,!0)])])}var gn=W(rn,[[`render`,hn],[`__scopeId`,`data-v-bcce4821`]]),_n=s({name:`CoverFromInput`,components:{ElImage:P,ElIcon:w,VideoPlay:S,VideoPause:C},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:$,onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),vn={class:`field`},yn={class:`box`},bn={class:`title font-bold`},xn={class:`task`},Sn={class:`left`},Cn={key:2,class:`duration`},wn={class:`info`},Tn={class:`title`},En={class:`style`};function Dn(e,t,n,i,s,c){let d=f(`el-image`),_=f(`video-pause`),v=f(`el-icon`),y=f(`video-play`),b=h(`loading`);return u(),p(`div`,vn,[r(`div`,yn,[r(`h2`,bn,l(e.$t(`suno.name.cover`)),1)]),r(`div`,xn,[e.audio?(u(),p(`div`,{key:0,class:`audio`,onClick:t[2]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,Sn,[a(d,{src:e.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:t[0]||=t=>e.onPause(e.audio)},[a(v,null,{default:m(()=>[a(_)]),_:1})])):o(``,!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:t[1]||=t=>e.onPlay(e.audio)},[a(v,null,{default:m(()=>[a(y)]),_:1})])):o(``,!0),e.audio?.duration?(u(),p(`div`,Cn,l(e.useFormatDuring(e.audio?.duration)),1)):o(``,!0)])),[[b,!e.audio?.audio_url]]),r(`div`,wn,[r(`h2`,Tn,l(e.audio?.title),1),r(`p`,En,l(e.audio?.style),1)])])):o(``,!0)])])}var On=W(_n,[[`render`,Dn],[`__scopeId`,`data-v-06640216`]]),kn=s({name:`VocalGenderSelector`,components:{ElRadioGroup:R,ElRadioButton:L,InfoIcon:Q},computed:{vocalGender:{get(){return this.$store.state.suno?.config?.vocal_gender||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,vocal_gender:e||void 0})}}}}),An={class:`flex items-center mb-1`},jn={class:`text-sm font-bold`};function Mn(e,t,n,o,s,c){let d=f(`info-icon`),h=f(`el-radio-button`),g=f(`el-radio-group`);return u(),p(`div`,null,[r(`div`,An,[r(`span`,jn,l(e.$t(`suno.name.vocalGender`)),1),a(d,{content:e.$t(`suno.description.vocalGender`)},null,8,[`content`])]),a(g,{modelValue:e.vocalGender,"onUpdate:modelValue":t[0]||=t=>e.vocalGender=t,size:`small`},{default:m(()=>[a(h,{value:``},{default:m(()=>[i(l(e.$t(`suno.gender.auto`)),1)]),_:1}),a(h,{value:`f`},{default:m(()=>[i(l(e.$t(`suno.gender.female`)),1)]),_:1}),a(h,{value:`m`},{default:m(()=>[i(l(e.$t(`suno.gender.male`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var Nn=W(kn,[[`render`,Mn]]),Pn=s({name:`AdvancedParams`,components:{ElCollapse:ne,ElCollapseItem:te,ElInput:G,ElSlider:ce,ElRadioGroup:R,ElRadioButton:L},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.suno?.config},isV5OrAbove(){let e=this.config?.model||``;return[`chirp-v5`,`chirp-v5-5`].includes(e)},styleNegative:{get(){return this.$store.state.suno?.config?.style_negative||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style_negative:e||void 0})}},lyricPrompt:{get(){return this.$store.state.suno?.config?.lyric_prompt||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric_prompt:e||void 0})}},weirdness:{get(){return this.$store.state.suno?.config?.weirdness??0},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,weirdness:e||void 0})}},styleInfluence:{get(){return this.$store.state.suno?.config?.style_influence??.5},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style_influence:e})}},variationCategory:{get(){return this.$store.state.suno?.config?.variation_category||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,variation_category:e||void 0})}},audioWeight:{get(){return this.$store.state.suno?.config?.audio_weight??.5},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,audio_weight:e})}},lyricsMode:{get(){return this.$store.state.suno?.config?.lyrics_mode||`manual`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyrics_mode:e})}}},mounted(){let e=this.$store.state.suno?.config;if(!e)return;let t={};typeof e.weirdness==`number`&&e.weirdness>1&&(t.weirdness=e.weirdness/100),typeof e.style_influence==`number`&&e.style_influence>1&&(t.style_influence=e.style_influence/100),typeof e.audio_weight==`number`&&e.audio_weight>1&&(t.audio_weight=e.audio_weight/100),Object.keys(t).length>0&&this.$store.commit(`suno/setConfig`,{...e,...t})}}),Fn={key:0,class:`mb-3`},In={class:`flex items-center mb-1`},Ln={class:`text-xs font-bold`},Rn={key:1,class:`mb-3`},zn={class:`flex items-center mb-1`},Bn={class:`text-xs font-bold`},Vn={key:2,class:`mb-3`},Hn={class:`flex items-center justify-between mb-1`},Un={class:`text-xs font-bold`},Wn={class:`text-xs text-[var(--el-text-color-secondary)]`},Gn={key:3,class:`mb-3`},Kn={class:`flex items-center justify-between mb-1`},qn={class:`text-xs font-bold`},Jn={class:`text-xs text-[var(--el-text-color-secondary)]`},Yn={key:4,class:`mb-3`},Xn={class:`flex items-center mb-1`},Zn={class:`text-xs font-bold`},Qn={key:5,class:`mb-3`},$n={class:`flex items-center justify-between mb-1`},er={class:`text-xs font-bold`},tr={class:`text-xs text-[var(--el-text-color-secondary)]`},nr={key:6,class:`mb-3`},rr={class:`flex items-center mb-1`},ir={class:`text-xs font-bold`};function ar(e,t,s,c,d,h){let g=f(`el-input`),_=f(`el-slider`),v=f(`el-radio-button`),y=f(`el-radio-group`),b=f(`el-collapse-item`),x=f(`el-collapse`);return u(),n(x,{modelValue:e.activeNames,"onUpdate:modelValue":t[7]||=t=>e.activeNames=t,class:`advanced-collapse`},{default:m(()=>[a(b,{title:e.$t(`suno.name.advancedParams`),name:`advanced`},{default:m(()=>[e.config?.custom?(u(),p(`div`,Fn,[r(`div`,In,[r(`span`,Ln,l(e.$t(`suno.name.styleNegative`)),1)]),a(g,{modelValue:e.styleNegative,"onUpdate:modelValue":t[0]||=t=>e.styleNegative=t,size:`small`,placeholder:e.$t(`suno.placeholder.styleNegative`)},null,8,[`modelValue`,`placeholder`])])):o(``,!0),e.config?.custom&&!e.config?.instrumental?(u(),p(`div`,Rn,[r(`div`,zn,[r(`span`,Bn,l(e.$t(`suno.name.lyricPrompt`)),1)]),a(g,{modelValue:e.lyricPrompt,"onUpdate:modelValue":t[1]||=t=>e.lyricPrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.lyricPrompt`)},null,8,[`modelValue`,`placeholder`])])):o(``,!0),e.config?.custom?(u(),p(`div`,Vn,[r(`div`,Hn,[r(`span`,Un,l(e.$t(`suno.name.weirdness`)),1),r(`span`,Wn,l(e.weirdness??0),1)]),a(_,{modelValue:e.weirdness,"onUpdate:modelValue":t[2]||=t=>e.weirdness=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.config?.custom?(u(),p(`div`,Gn,[r(`div`,Kn,[r(`span`,qn,l(e.$t(`suno.name.styleInfluence`)),1),r(`span`,Jn,l(e.styleInfluence??.5),1)]),a(_,{modelValue:e.styleInfluence,"onUpdate:modelValue":t[3]||=t=>e.styleInfluence=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.isV5OrAbove?(u(),p(`div`,Yn,[r(`div`,Xn,[r(`span`,Zn,l(e.$t(`suno.name.variationCategory`)),1)]),a(y,{modelValue:e.variationCategory,"onUpdate:modelValue":t[4]||=t=>e.variationCategory=t,size:`small`},{default:m(()=>[a(v,{value:``},{default:m(()=>[i(l(e.$t(`suno.gender.auto`)),1)]),_:1}),a(v,{value:`high`},{default:m(()=>[i(l(e.$t(`suno.variation.high`)),1)]),_:1}),a(v,{value:`low`},{default:m(()=>[i(l(e.$t(`suno.variation.low`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),e.config?.action===`cover`?(u(),p(`div`,Qn,[r(`div`,$n,[r(`span`,er,l(e.$t(`suno.name.audioWeight`)),1),r(`span`,tr,l(e.audioWeight??.5),1)]),a(_,{modelValue:e.audioWeight,"onUpdate:modelValue":t[5]||=t=>e.audioWeight=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.config?.custom&&!e.config?.instrumental?(u(),p(`div`,nr,[r(`div`,rr,[r(`span`,ir,l(e.$t(`suno.name.lyricsMode`)),1)]),a(y,{modelValue:e.lyricsMode,"onUpdate:modelValue":t[6]||=t=>e.lyricsMode=t,size:`small`},{default:m(()=>[a(v,{value:`manual`},{default:m(()=>[i(l(e.$t(`suno.lyricsMode.manual`)),1)]),_:1}),a(v,{value:`auto`},{default:m(()=>[i(l(e.$t(`suno.lyricsMode.auto`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0)]),_:1},8,[`title`])]),_:1},8,[`modelValue`])}var or=W(Pn,[[`render`,ar],[`__scopeId`,`data-v-363599d3`]]),sr=s({name:`ReplaceSectionInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},replaceSectionStart:{get(){return this.$store.state.suno?.config?.replace_section_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,replace_section_start:e})}},replaceSectionEnd:{get(){return this.$store.state.suno?.config?.replace_section_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,replace_section_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),cr={class:`field`},lr={class:`flex items-center mb-2`},ur={class:`text-sm font-bold m-0`},dr={key:0,class:`task mb-2`},fr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},pr={class:`info flex-1 min-w-0`},mr={class:`text-sm font-bold m-0 truncate`},hr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},gr={class:`flex gap-2`};function _r(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,cr,[r(`div`,lr,[r(`h2`,ur,l(e.$t(`suno.name.replaceSection`)),1),a(d,{content:e.$t(`suno.description.replaceSection`)},null,8,[`content`])]),e.audio?(u(),p(`div`,dr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,fr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,pr,[r(`h2`,mr,l(e.audio?.title),1),r(`p`,hr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,gr,[a(_,{modelValue:e.replaceSectionStart,"onUpdate:modelValue":t[1]||=t=>e.replaceSectionStart=t,class:`flex-1`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.replaceSectionStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.replaceSectionEnd,"onUpdate:modelValue":t[2]||=t=>e.replaceSectionEnd=t,class:`flex-1`,min:e.replaceSectionStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.replaceSectionEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var vr=W(sr,[[`render`,_r]]),yr=s({name:`OverpaintingInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},overpaintingStart:{get(){return this.$store.state.suno?.config?.overpainting_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,overpainting_start:e})}},overpaintingEnd:{get(){return this.$store.state.suno?.config?.overpainting_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,overpainting_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),br={class:`field`},xr={class:`flex items-center mb-2`},Sr={class:`text-sm font-bold m-0`},Cr={key:0,class:`task mb-2`},wr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Tr={class:`info flex-1 min-w-0`},Er={class:`text-sm font-bold m-0 truncate`},Dr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Or={class:`flex gap-2`};function kr(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,br,[r(`div`,xr,[r(`h2`,Sr,l(e.$t(`suno.name.overpaintingRange`)),1),a(d,{content:e.$t(`suno.description.overpainting`)},null,8,[`content`])]),e.audio?(u(),p(`div`,Cr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,wr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,Tr,[r(`h2`,Er,l(e.audio?.title),1),r(`p`,Dr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,Or,[a(_,{modelValue:e.overpaintingStart,"onUpdate:modelValue":t[1]||=t=>e.overpaintingStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.overpaintingStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.overpaintingEnd,"onUpdate:modelValue":t[2]||=t=>e.overpaintingEnd=t,class:`flex-1`,size:`small`,min:e.overpaintingStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.overpaintingEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Ar=W(yr,[[`render`,kr]]),jr=s({name:`UnderpaintingInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},underpaintingStart:{get(){return this.$store.state.suno?.config?.underpainting_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,underpainting_start:e})}},underpaintingEnd:{get(){return this.$store.state.suno?.config?.underpainting_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,underpainting_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),Mr={class:`field`},Nr={class:`flex items-center mb-2`},Pr={class:`text-sm font-bold m-0`},Fr={key:0,class:`task mb-2`},Ir={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Lr={class:`info flex-1 min-w-0`},Rr={class:`text-sm font-bold m-0 truncate`},zr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Br={class:`flex gap-2`};function Vr(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,Mr,[r(`div`,Nr,[r(`h2`,Pr,l(e.$t(`suno.name.underpaintingRange`)),1),a(d,{content:e.$t(`suno.description.underpainting`)},null,8,[`content`])]),e.audio?(u(),p(`div`,Fr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,Ir,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,Lr,[r(`h2`,Rr,l(e.audio?.title),1),r(`p`,zr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,Br,[a(_,{modelValue:e.underpaintingStart,"onUpdate:modelValue":t[1]||=t=>e.underpaintingStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.underpaintingStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.underpaintingEnd,"onUpdate:modelValue":t[2]||=t=>e.underpaintingEnd=t,class:`flex-1`,size:`small`,min:e.underpaintingStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.underpaintingEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Hr=W(jr,[[`render`,Vr]]),Ur=s({name:`SamplesInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},samplesStart:{get(){return this.$store.state.suno?.config?.samples_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,samples_start:e})}},samplesEnd:{get(){return this.$store.state.suno?.config?.samples_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,samples_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),Wr={class:`field`},Gr={class:`flex items-center mb-2`},Kr={class:`text-sm font-bold m-0`},qr={key:0,class:`task mb-2`},Jr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Yr={class:`info flex-1 min-w-0`},Xr={class:`text-sm font-bold m-0 truncate`},Zr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Qr={class:`flex gap-2`};function $r(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,Wr,[r(`div`,Gr,[r(`h2`,Kr,l(e.$t(`suno.name.samplesRange`)),1),a(d,{content:e.$t(`suno.description.samples`)},null,8,[`content`])]),e.audio?(u(),p(`div`,qr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,Jr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,Yr,[r(`h2`,Xr,l(e.audio?.title),1),r(`p`,Zr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,Qr,[a(_,{modelValue:e.samplesStart,"onUpdate:modelValue":t[1]||=t=>e.samplesStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.samplesStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.samplesEnd,"onUpdate:modelValue":t[2]||=t=>e.samplesEnd=t,class:`flex-1`,size:`small`,min:e.samplesStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.samplesEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var ei=W(Ur,[[`render`,$r]]),ti=[.5,.75,1,1.25,1.5,2],ni=s({name:`AdjustSpeedInput`,components:{ElRadioGroup:R,ElRadioButton:L,ElImage:P,InfoIcon:Q},data(){return{options:ti}},computed:{audio(){return this.$store.state.suno?.config?.audio},speed:{get(){let e=this.$store.state.suno?.config?.speed;return typeof e==`number`?e:1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,speed:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),ri={class:`field`},ii={class:`flex items-center mb-2`},ai={class:`text-sm font-bold m-0`},oi={key:0,class:`task mb-2`},si={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},ci={class:`info flex-1 min-w-0`},li={class:`text-sm font-bold m-0 truncate`},ui={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`};function di(e,t,s,d,_,y){let b=f(`info-icon`),x=f(`el-image`),S=f(`el-radio-button`),C=f(`el-radio-group`),w=h(`loading`);return u(),p(`div`,ri,[r(`div`,ii,[r(`h2`,ai,l(e.$t(`suno.name.adjustSpeed`)),1),a(b,{content:e.$t(`suno.description.adjustSpeed`)},null,8,[`content`])]),e.audio?(u(),p(`div`,oi,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,si,[a(x,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[w,!e.audio?.audio_url]]),r(`div`,ci,[r(`h2`,li,l(e.audio?.title),1),r(`p`,ui,l(e.audio?.style),1)])])])):o(``,!0),a(C,{modelValue:e.speed,"onUpdate:modelValue":t[1]||=t=>e.speed=t,size:`small`,class:`speed-group`},{default:m(()=>[(u(!0),p(v,null,c(e.options,e=>(u(),n(S,{key:e,value:e},{default:m(()=>[i(l(e)+`x`,1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])])}var fi=W(ni,[[`render`,di],[`__scopeId`,`data-v-ba834628`]]),pi=s({name:`VoiceCreateDialog`,components:{ElDialog:K,ElForm:j,ElFormItem:A,ElInput:G,ElButton:b,ElRadioGroup:R,ElRadio:ee},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{sourceType:`song`,form:{name:``,description:``,audio_id:``,audio_url:``},loading:!1}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},token(){return this.$store.state.suno?.credential?.token},canSubmit(){return!(!this.form.name||this.sourceType===`song`&&!this.form.audio_id||this.sourceType===`upload`&&!this.form.audio_url)}},methods:{onClose(){this.visible=!1,this.resetForm()},resetForm(){this.form={name:``,description:``,audio_id:``,audio_url:``},this.sourceType=`song`},async onSubmit(){if(this.token){this.loading=!0;try{this.sourceType===`song`?await Y.persona({audio_id:this.form.audio_id,name:this.form.name,description:this.form.description},{token:this.token}):await Y.voices({audio_url:this.form.audio_url,name:this.form.name,description:this.form.description},{token:this.token}),J.success(this.$t(`suno.voice.createSuccess`)),this.$emit(`created`),this.onClose()}catch{J.error(this.$t(`suno.voice.createFailed`))}finally{this.loading=!1}}}}});function mi(e,t,r,s,c,d){let p=f(`el-input`),h=f(`el-form-item`),g=f(`el-radio`),_=f(`el-radio-group`),v=f(`el-form`),y=f(`el-button`),b=f(`el-dialog`);return u(),n(b,{modelValue:e.visible,"onUpdate:modelValue":t[5]||=t=>e.visible=t,title:e.$t(`suno.voice.createTitle`),width:`480px`,"close-on-click-modal":!1,onClose:e.onClose},{footer:m(()=>[a(y,{onClick:e.onClose},{default:m(()=>[i(l(e.$t(`common.button.cancel`)),1)]),_:1},8,[`onClick`]),a(y,{type:`primary`,loading:e.loading,disabled:!e.canSubmit,onClick:e.onSubmit},{default:m(()=>[i(l(e.$t(`suno.voice.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:m(()=>[a(v,{"label-position":`top`,class:`voice-create-form`},{default:m(()=>[a(h,{label:e.$t(`suno.voice.name`)},{default:m(()=>[a(p,{modelValue:e.form.name,"onUpdate:modelValue":t[0]||=t=>e.form.name=t,placeholder:e.$t(`suno.voice.namePlaceholder`),maxlength:`50`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a(h,{label:e.$t(`suno.voice.description`)},{default:m(()=>[a(p,{modelValue:e.form.description,"onUpdate:modelValue":t[1]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`suno.voice.descriptionPlaceholder`),maxlength:`200`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a(h,{label:e.$t(`suno.voice.sourceType`)},{default:m(()=>[a(_,{modelValue:e.sourceType,"onUpdate:modelValue":t[2]||=t=>e.sourceType=t,class:`w-full`},{default:m(()=>[a(g,{value:`song`},{default:m(()=>[i(l(e.$t(`suno.voice.fromSong`)),1)]),_:1}),a(g,{value:`upload`},{default:m(()=>[i(l(e.$t(`suno.voice.fromUpload`)),1)]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),e.sourceType===`song`?(u(),n(h,{key:0,label:e.$t(`suno.voice.audioId`)},{default:m(()=>[a(p,{modelValue:e.form.audio_id,"onUpdate:modelValue":t[3]||=t=>e.form.audio_id=t,placeholder:e.$t(`suno.voice.audioIdPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):o(``,!0),e.sourceType===`upload`?(u(),n(h,{key:1,label:e.$t(`suno.voice.audioUrl`)},{default:m(()=>[a(p,{modelValue:e.form.audio_url,"onUpdate:modelValue":t[4]||=t=>e.form.audio_url=t,placeholder:e.$t(`suno.voice.audioUrlPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):o(``,!0)]),_:1})]),_:1},8,[`modelValue`,`title`,`onClose`])}var hi=s({name:`VoiceManager`,components:{ElButton:b,ElIcon:w,ElTabs:O,ElTabPane:k,ElTooltip:N,Loading:x,FontAwesomeIcon:Z,VoiceCreateDialog:W(pi,[[`render`,mi]])},data(){return{showCreateDialog:!1,loading:!1,deletingId:null,activeTab:`all`}},computed:{personas(){return this.$store.state.suno?.personas||[]},favoriteIds(){return this.$store.state.suno?.favoritePersonaIds||[]},favoritePersonas(){return this.personas.filter(e=>e.persona_id&&this.favoriteIds.includes(e.persona_id))},visiblePersonas(){return this.activeTab===`favorites`?this.favoritePersonas:this.personas},selectedPersonaId(){return this.$store.state.suno?.config?.persona_id}},watch:{"$store.state.suno.credential":{handler(){this.loadPersonas()},immediate:!0}},methods:{isFavorite(e){return!!e&&this.favoriteIds.includes(e)},onToggleFavorite(e){e.persona_id&&this.$store.commit(`suno/togglePersonaFavorite`,e.persona_id)},async loadPersonas(){if(this.$store.state.suno?.credential?.token){this.loading=!0;try{await this.$store.dispatch(`suno/getPersonas`)}finally{this.loading=!1}}},selectPersona(e){let t={...this.$store.state.suno?.config};t.persona_id===e.persona_id?t.persona_id=void 0:t.persona_id=e.persona_id,this.$store.dispatch(`suno/setConfig`,t)},async onDelete(e){try{await q.confirm(this.$t(`suno.voice.confirmDelete`),this.$t(`suno.voice.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.confirm`),cancelButtonText:this.$t(`common.button.cancel`)})}catch{return}if(!e.persona_id)return;this.deletingId=e.persona_id;let t=await this.$store.dispatch(`suno/deletePersona`,e.persona_id);if(this.deletingId=null,t){if(J.success(this.$t(`suno.voice.deleteSuccess`)),this.selectedPersonaId===e.persona_id){let e={...this.$store.state.suno?.config,persona_id:void 0};this.$store.dispatch(`suno/setConfig`,e)}this.favoriteIds.includes(e.persona_id)&&this.$store.commit(`suno/togglePersonaFavorite`,e.persona_id)}else J.error(this.$t(`suno.voice.deleteFailed`))},async onCreated(){await this.loadPersonas()}}}),gi={class:`voice-manager`},_i={class:`flex items-center justify-between mb-3`},vi={class:`text-sm font-medium`},yi={key:0,class:`text-center py-6`},bi={key:1,class:`text-center py-6 text-gray-400 text-sm`},xi={key:2,class:`voice-list`},Si=[`onClick`],Ci={class:`flex-1 min-w-0`},wi={class:`voice-name`},Ti={key:0,class:`voice-desc`};function Ei(e,n,s,d,h,g){let _=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-tab-pane`),S=f(`el-tabs`),C=f(`loading`),w=f(`el-icon`),T=f(`el-tooltip`),E=f(`voice-create-dialog`);return u(),p(`div`,gi,[r(`div`,_i,[r(`span`,vi,l(e.$t(`suno.voice.title`)),1),a(b,{type:`primary`,size:`small`,onClick:n[0]||=t=>e.showCreateDialog=!0},{default:m(()=>[a(_,{icon:`fa-solid fa-plus`,class:`mr-1`}),i(` `+l(e.$t(`suno.voice.create`)),1)]),_:1})]),a(S,{modelValue:e.activeTab,"onUpdate:modelValue":n[1]||=t=>e.activeTab=t,class:`voice-tabs`,size:`small`},{default:m(()=>[a(x,{name:`all`,label:e.$t(`suno.voice.tabAll`)+` (`+(e.personas?.length||0)+`)`},null,8,[`label`]),a(x,{name:`favorites`,label:e.$t(`suno.voice.tabFavorites`)+` (`+e.favoritePersonas.length+`)`},null,8,[`label`])]),_:1},8,[`modelValue`]),e.loading?(u(),p(`div`,yi,[a(w,{class:`is-loading`},{default:m(()=>[a(C)]),_:1})])):e.visiblePersonas.length===0?(u(),p(`div`,bi,l(e.activeTab===`favorites`?e.$t(`suno.voice.emptyFavorites`):e.$t(`suno.voice.empty`)),1)):(u(),p(`div`,xi,[(u(!0),p(v,null,c(e.visiblePersonas,s=>(u(),p(`div`,{key:s.persona_id,class:t([`voice-item`,{active:e.selectedPersonaId===s.persona_id}]),onClick:t=>e.selectPersona(s)},[r(`div`,Ci,[r(`div`,wi,[a(_,{icon:s.source_type===`voice`?`fa-solid fa-microphone`:`fa-solid fa-music`,class:`mr-1.5 text-xs opacity-60`},null,8,[`icon`]),i(` `+l(s.name||s.persona_id),1)]),s.description?(u(),p(`div`,Ti,l(s.description),1)):o(``,!0)]),r(`div`,{class:`voice-actions`,onClick:n[2]||=y(()=>{},[`stop`])},[a(T,{content:e.isFavorite(s.persona_id)?e.$t(`suno.voice.unfavorite`):e.$t(`suno.voice.favorite`),placement:`top`},{default:m(()=>[a(b,{size:`small`,text:``,class:t({"voice-fav-active":e.isFavorite(s.persona_id)}),onClick:t=>e.onToggleFavorite(s)},{default:m(()=>[a(_,{icon:e.isFavorite(s.persona_id)?`fa-solid fa-star`:`fa-regular fa-star`},null,8,[`icon`])]),_:2},1032,[`class`,`onClick`])]),_:2},1032,[`content`]),a(b,{type:`danger`,size:`small`,text:``,loading:e.deletingId===s.persona_id,onClick:t=>e.onDelete(s)},{default:m(()=>[a(_,{icon:`fa-solid fa-trash`})]),_:1},8,[`loading`,`onClick`])])],10,Si))),128))])),a(E,{modelValue:e.showCreateDialog,"onUpdate:modelValue":n[3]||=t=>e.showCreateDialog=t,onCreated:e.onCreated},null,8,[`modelValue`,`onCreated`])])}var Di=s({name:`PersonaInput`,components:{ElSelect:E,ElOption:D,ElButton:b,ElDrawer:z,FontAwesomeIcon:Z,InfoIcon:Q,VoiceManager:W(hi,[[`render`,Ei],[`__scopeId`,`data-v-8b8e36d9`]])},data(){return{showManager:!1}},computed:{personaId:{get(){return this.$store.state.suno?.config?.persona_id||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,persona_id:e||void 0})}},personas(){return this.$store.state.suno?.personas||[]}}}),Oi={class:`field`},ki={class:`flex items-center justify-between mb-2`},Ai={class:`flex items-center`},ji={class:`text-sm font-bold`},Mi={class:`flex items-center justify-between w-full`},Ni={key:0,class:`text-xs text-gray-400 ml-2`};function Pi(e,t,s,d,h,g){let _=f(`info-icon`),y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-option`),S=f(`el-select`),C=f(`voice-manager`),w=f(`el-drawer`);return u(),p(`div`,Oi,[r(`div`,ki,[r(`div`,Ai,[r(`span`,ji,l(e.$t(`suno.name.persona`)),1),a(_,{content:e.$t(`suno.description.persona`)},null,8,[`content`])]),a(b,{size:`small`,round:``,onClick:t[0]||=t=>e.showManager=!0},{default:m(()=>[a(y,{icon:`fa-solid fa-microphone`,class:`mr-1`}),i(` `+l(e.$t(`suno.voice.manage`)),1)]),_:1})]),a(S,{modelValue:e.personaId,"onUpdate:modelValue":t[1]||=t=>e.personaId=t,placeholder:e.$t(`suno.placeholder.personaId`),clearable:``,filterable:``,class:`w-full`},{default:m(()=>[(u(!0),p(v,null,c(e.personas,e=>(u(),n(x,{key:e.persona_id||``,value:e.persona_id||``,label:e.name||e.persona_id||``},{default:m(()=>[r(`div`,Mi,[r(`span`,null,l(e.name||e.persona_id),1),e.source_type?(u(),p(`span`,Ni,l(e.source_type),1)):o(``,!0)])]),_:2},1032,[`value`,`label`]))),128))]),_:1},8,[`modelValue`,`placeholder`]),a(w,{modelValue:e.showManager,"onUpdate:modelValue":t[2]||=t=>e.showManager=t,title:e.$t(`suno.voice.title`),size:`380px`,direction:`rtl`},{default:m(()=>[a(C)]),_:1},8,[`modelValue`,`title`])])}var Fi=s({name:`PresetPanel`,components:{TypeSelector:Ge,PromptInput:St,LyricInput:It,StyleInput:Xt,TitleInput:nn,ExtendFromInput:gn,CoverFromInput:On,UploadAudio:mt,VocalGenderSelector:Nn,AdvancedParams:or,ReplaceSectionInput:vr,OverpaintingInput:Ar,UnderpaintingInput:Hr,SamplesInput:ei,AdjustSpeedInput:fi,PersonaInput:W(Di,[[`render`,Pi]]),FontAwesomeIcon:Z,ElButton:b,ElTabs:O,ElTabPane:k,Consumption:we},emits:[`generate`],computed:{config(){return this.$store.state.suno?.config},mode:{get(){return this.$store.state.suno?.config?.custom?`custom`:`simple`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,custom:e===`custom`})}},consumption(){return me(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service},supportsVocalGender(){let e=this.config?.model||``;return[`chirp-v4-5-plus`,`chirp-v5`,`chirp-v5-5`].includes(e)},supportsPersona(){let e=this.config?.action;return!e||e===`generate`||e===`artist_consistency`||e===`artist_consistency_vox`},generateButtonText(){let e=this.config?.action;return e===`extend`?this.$t(`suno.button.extend`):e===`cover`?this.$t(`suno.button.cover_music`):e===`remaster`?this.$t(`suno.button.remaster`):e===`replace_section`?this.$t(`suno.button.replace_section`):e===`mashup`?this.$t(`suno.button.mashup`):e===`stems`?this.$t(`suno.button.get_stems`):e===`concat`?this.$t(`suno.button.concat_music`):e===`upload_cover`?this.$t(`suno.button.upload_cover`):e===`artist_consistency`?this.$t(`suno.button.artist_consistency`):e===`artist_consistency_vox`?this.$t(`suno.button.artist_consistency_vox`):e===`overpainting`?this.$t(`suno.button.overpainting`):e===`underpainting`?this.$t(`suno.button.underpainting`):e===`samples`?this.$t(`suno.button.samples`):e===`adjust_speed`?this.$t(`suno.button.adjust_speed`):this.$t(`suno.button.generate`)}},methods:{onGenerate(){this.$emit(`generate`)},onClearAll(){this.$store.commit(`suno/setConfig`,{custom:!1,sounds:!1,instrumental:!1,lyric:``,style:``,title:``,lyrics_mode:`manual`,model:this.$store.state.suno?.config?.model})}}}),Ii={class:`flex flex-col h-full`},Li={class:`flex-1 overflow-y-auto p-5`},Ri={class:`pt-2 px-1`},zi={class:`pt-2 px-1`},Bi={class:`flex flex-col items-center justify-center px-5 pb-5 gap-2`},Vi={class:`flex gap-2 w-full`};function Hi(e,t,s,c,d,h){let g=f(`type-selector`),_=f(`upload-audio`),v=f(`prompt-input`),y=f(`extend-from-input`),b=f(`cover-from-input`),x=f(`replace-section-input`),S=f(`overpainting-input`),C=f(`underpainting-input`),w=f(`samples-input`),T=f(`adjust-speed-input`),E=f(`advanced-params`),D=f(`el-tab-pane`),O=f(`lyric-input`),k=f(`style-input`),A=f(`title-input`),j=f(`vocal-gender-selector`),M=f(`persona-input`),N=f(`el-tabs`),P=f(`consumption`),F=f(`font-awesome-icon`),I=f(`el-button`);return u(),p(`div`,Ii,[r(`div`,Li,[a(N,{modelValue:e.mode,"onUpdate:modelValue":t[0]||=t=>e.mode=t,class:`suno-mode-tabs`,stretch:``},{default:m(()=>[a(D,{label:e.$t(`suno.mode.simple`),name:`simple`},{default:m(()=>[r(`div`,Ri,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),e.config?.action===`extend`?(u(),n(y,{key:0,class:`mb-4`})):o(``,!0),e.config?.action===`cover`?(u(),n(b,{key:1,class:`mb-4`})):o(``,!0),e.config?.action===`replace_section`?(u(),n(x,{key:2,class:`mb-4`})):o(``,!0),e.config?.action===`overpainting`?(u(),n(S,{key:3,class:`mb-4`})):o(``,!0),e.config?.action===`underpainting`?(u(),n(C,{key:4,class:`mb-4`})):o(``,!0),e.config?.action===`samples`?(u(),n(w,{key:5,class:`mb-4`})):o(``,!0),e.config?.action===`adjust_speed`?(u(),n(T,{key:6,class:`mb-4`})):o(``,!0),a(E,{class:`mb-4`})])]),_:1},8,[`label`]),a(D,{label:e.$t(`suno.mode.custom`),name:`custom`},{default:m(()=>[r(`div`,zi,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),e.config?.instrumental?o(``,!0):(u(),n(O,{key:0,class:`mb-4`})),a(k,{class:`mb-4`}),a(A,{class:`mb-4`}),!e.config?.instrumental&&e.supportsVocalGender?(u(),n(j,{key:1,class:`mb-4`})):o(``,!0),e.supportsPersona?(u(),n(M,{key:2,class:`mb-4`})):o(``,!0),e.config?.action===`extend`?(u(),n(y,{key:3,class:`mb-4`})):o(``,!0),e.config?.action===`cover`?(u(),n(b,{key:4,class:`mb-4`})):o(``,!0),e.config?.action===`replace_section`?(u(),n(x,{key:5,class:`mb-4`})):o(``,!0),e.config?.action===`overpainting`?(u(),n(S,{key:6,class:`mb-4`})):o(``,!0),e.config?.action===`underpainting`?(u(),n(C,{key:7,class:`mb-4`})):o(``,!0),e.config?.action===`samples`?(u(),n(w,{key:8,class:`mb-4`})):o(``,!0),e.config?.action===`adjust_speed`?(u(),n(T,{key:9,class:`mb-4`})):o(``,!0),a(E,{class:`mb-4`})])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),r(`div`,Bi,[a(P,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),r(`div`,Vi,[a(I,{class:`flex-1`,onClick:e.onClearAll},{default:m(()=>[a(F,{icon:`fa-solid fa-broom`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.clear_all`)),1)]),_:1},8,[`onClick`]),a(I,{type:`primary`,class:`flex-1`,round:``,onClick:e.onGenerate},{default:m(()=>[a(F,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.generateButtonText),1)]),_:1},8,[`onClick`])])])])}var Ui=W(Fi,[[`render`,Hi],[`__scopeId`,`data-v-c62324e6`]]),Wi=Te(),Gi=U(`suno`),Ki=s({name:`TaskPreview`,components:{ElImage:P,ElIcon:w,ElTooltip:N,FontAwesomeIcon:Z,VideoPlay:S,VideoPause:C,ElDropdown:V,ElDropdownMenu:re,ElDropdownItem:B,ElInput:G,ElProgress:ae,ElCheckbox:I,Loading:x,ApiCodeDialog:be},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,isFetchingMidi:!1,editingAudioId:null,editingTitle:``,apiCodeVisible:!1,apiCodePath:`/suno/audios`,apiCodeBody:{}}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===X.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(e=>({...e,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active},isMashupMode(){return this.$store.state.suno?.config?.action===`mashup`},mashupAudioIds(){return this.$store.state.suno?.config?.mashup_audio_ids||[]}},methods:{useFormatDuring:$,onViewCode(){let e=this.modelValue?.request||{},t={};Object.entries(e).forEach(([e,n])=>{e===`application_id`||e===`callback_url`||n!=null&&(typeof n==`string`&&n===``||Array.isArray(n)&&n.length===0||(t[e]=n))}),this.apiCodeBody=t,this.apiCodePath=`/suno/audios`,this.apiCodeVisible=!0},onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e?.stopPropagation(),console.log(`on extend`),console.debug(`set config`,t),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:`extend`,audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e?.stopPropagation(),console.log(`on download`,t);let n=new URL(t).pathname,r=n.substring(n.lastIndexOf(`/`)+1);console.log(`on preview`,r),fetch(t).then(e=>e.blob()).then(e=>{(0,Wi.saveAs)(e,r)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;let t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(e){console.error(`get videoUrl failed:`,e),J.error(this.$t(`suno.message.getVideoUrlFailed`))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,n)=>{let r={audio_id:e},i=this.credential?.token;if(!i){console.error(`no token specified`),n(Error(`No token specified`));return}Y.mp4(r,{token:i}).then(e=>{let r=e.data?.data?.video_url;r?t(r):n(Error(`Video URL not found in response`))}).catch(e=>{n(e)})})},onPreview(e,t){e?.stopPropagation(),console.log(`on preview`,t),window.open(t,`_blank`)},async onGetStems(e){await this.onGenerateAudioUrl(`stems`,e)},onCover(e){console.log(`on cover`),console.debug(`set config`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`cover`,audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl(`concat`,e)},async onRemaster(e){await this.onGenerateAudioUrl(`remaster`,e)},async onGetAllStems(e){await this.onGenerateAudioUrl(`all_stems`,e)},onReplaceSection(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`replace_section`,audio:e,audio_id:e.id,replace_section_start:0,replace_section_end:Math.min(30,e.duration||30)})},onMashup(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`mashup`,audio:e,audio_id:e.id,mashup_audio_ids:[e.id]})},onOverpainting(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`overpainting`,audio:e,audio_id:e.id,overpainting_start:0,overpainting_end:Math.min(30,e.duration||30)})},onUnderpainting(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`underpainting`,audio:e,audio_id:e.id,underpainting_start:0,underpainting_end:Math.min(30,e.duration||30)})},onSamples(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`samples`,audio:e,audio_id:e.id,samples_start:0,samples_end:Math.min(30,e.duration||30)})},onArtistConsistency(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`artist_consistency`,audio:e,audio_id:e.id})},onAdjustSpeed(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`adjust_speed`,audio:e,audio_id:e.id,speed:1})},onReusePrompt(e){let t=this.modelValue?.request??{};if(!(t.prompt||t.lyric||t.style||t.title||t.lyric_prompt||t.style_negative||t.persona_id)){J.warning(this.$t(`suno.message.reusePromptEmpty`));return}this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:t.model??e.model,custom:t.custom??!1,instrumental:t.instrumental??!1,prompt:t.prompt??``,lyric:t.lyric??``,lyric_prompt:t.lyric_prompt??``,lyrics_mode:t.lyrics_mode??`manual`,title:t.title??``,style:t.style??``,style_negative:t.style_negative??``,vocal_gender:t.vocal_gender,weirdness:t.weirdness,style_influence:t.style_influence,variation_category:t.variation_category,audio_weight:t.audio_weight,persona_id:t.persona_id,action:void 0,audio:void 0,audio_id:void 0,mashup_audio_ids:void 0,continue_at:void 0,speed:void 0,replace_section_start:void 0,replace_section_end:void 0,overpainting_start:void 0,overpainting_end:void 0,underpainting_start:void 0,underpainting_end:void 0,samples_start:void 0,samples_end:void 0}),J.success(this.$t(`suno.message.reusePromptSuccess`))},async onExtractVocals(e){let t=this.credential?.token;t&&(J.info(this.$t(`suno.message.extractingVocals`)),Y.vox({audio_id:e,callback_url:Gi},{token:t}).then(()=>{J.success(this.$t(`suno.message.extractVocalsSuccess`))}).catch(e=>{J.error(e?.response?.data?.error?.message||this.$t(`suno.message.extractVocalsFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()}))},async onGetTiming(e){let t=this.credential?.token;t&&(J.info(this.$t(`suno.message.fetchingTiming`)),Y.timing({audio_id:e},{token:t}).then(e=>{J.success(this.$t(`suno.message.fetchTimingSuccess`)),console.debug(`timing data`,e.data)}).catch(e=>{J.error(e?.response?.data?.error?.message||this.$t(`suno.message.fetchTimingFailed`))}))},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;let t=this.credential?.token;if(t)try{this.isFetchingWav=!0,J.info(this.$t(`suno.message.fetchingWav`));let n=(await Y.wav({audio_id:e.id},{token:t})).data?.data?.[0]?.file_url;n?this.onDownload(null,n):J.error(this.$t(`suno.message.fetchWavFailed`))}catch(e){let t=e?.response?.data?.error?.message;J.error(t||this.$t(`suno.message.fetchWavFailed`))}finally{this.isFetchingWav=!1}},async handleMidiDownload(e){if(!e?.id||this.isFetchingMidi)return;let t=this.credential?.token;if(t)try{this.isFetchingMidi=!0,J.info(this.$t(`suno.message.fetchingMidi`));let n=(await Y.midi({audio_id:e.id},{token:t})).data?.data;if(!n?.length){J.error(this.$t(`suno.message.fetchMidiFailed`));return}let r=(e.title||e.id||`suno`).replace(/[^\w.-]+/g,`_`)+`.json`;(0,Wi.saveAs)(new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),r)}catch(e){let t=e?.response?.data?.error?.message;J.error(t||this.$t(`suno.message.fetchMidiFailed`))}finally{this.isFetchingMidi=!1}},async onGenerateAudioUrl(e,t){let n={action:e,audio_id:t,callback_url:Gi},r=this.credential?.token;if(!r){console.error(`no token specified`);return}J.info(this.$t(`suno.message.startingTask`)),Y.audio(n,{token:r}).then(()=>{J.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{J.error(e?.response?.data?.error?.message||this.$t(`suno.message.startTaskFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},isMashupSelected(e){return!!e.id&&this.mashupAudioIds.includes(e.id)},onToggleMashup(e){if(!e.id)return;let t=[...this.mashupAudioIds],n=t.indexOf(e.id);n===-1?t.push(e.id):t.splice(n,1),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,mashup_audio_ids:t})},async onScrollDown(){setTimeout(()=>{let e=document.querySelector(`.tasks`);e&&(e.scrollTop=e.scrollHeight)},1e3)},onStartTitleEdit(e){this.editingAudioId=e.id??null,this.editingTitle=e.title||``,this.$nextTick(()=>{this.$refs.titleInput?.focus?.()})},onSaveTitleEdit(e){if(this.editingAudioId!==e.id)return;let t=this.editingTitle.trim();if(t&&t!==e.title){let n=this.$store.state.suno?.tasks;if(n?.items)for(let r of n.items){let n=(r?.response?.data??[]).find(t=>t.id===e.id);if(n){n.title=t;break}}}this.editingAudioId=null,this.editingTitle=``},onCancelTitleEdit(){this.editingAudioId=null,this.editingTitle=``},async onDelete(e){try{await q.confirm(this.$t(`suno.message.confirmDelete`),{confirmButtonText:this.$t(`suno.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`})}catch{return}let t=this.$store.state.suno?.tasks;if(t?.items)for(let n of t.items){let r=n?.response?.data??[],i=r.findIndex(t=>t.id===e.id);if(i!==-1){if(r.splice(i,1),r.length===0){let e=t.items.indexOf(n);e!==-1&&t.items.splice(e,1)}break}}this.$store.state?.suno?.audio?.id===e.id&&this.$store.dispatch(`suno/setAudio`,null),J.success(this.$t(`suno.message.deleteSuccess`))},async onGetTasks(){if(this.loading){console.debug(`loading`);return}await this.$store.dispatch(`suno/getTasks`,{limit:30,offset:0})}}}),qi={class:`task`},Ji=[`onClick`],Yi=[`onClick`],Xi={class:`left`},Zi=[`onClick`],Qi=[`onClick`],$i={key:2,class:`duration`},ea={class:`info`},ta={key:1,class:`title-row`},na={class:`title`},ra={class:`style`},ia={key:2,class:`progress-row`},aa={class:`progress-text`},oa={class:`right`},sa={class:`el-dropdown-link`},ca={class:`flex items-center min-w-[120px]`},la={class:`flex items-center min-w-[120px]`},ua={class:`flex items-center min-w-[120px]`},da={class:`el-dropdown-link`};function fa(e,s,d,b,x,S){let C=f(`el-checkbox`),w=f(`el-image`),T=f(`video-pause`),E=f(`el-icon`),D=f(`video-play`),O=f(`el-input`),k=f(`font-awesome-icon`),A=f(`el-progress`),j=f(`el-tooltip`),M=f(`Loading`),N=f(`el-dropdown-item`),P=f(`el-dropdown-menu`),F=f(`el-dropdown`),I=f(`api-code-dialog`),L=h(`loading`);return u(),p(`div`,qi,[(u(!0),p(v,null,c(e.audios,c=>(u(),p(`div`,{key:c.id,class:t([`audio`,{"mashup-selected":e.isMashupSelected(c)}]),onClick:y(t=>e.onClick(c),[`stop`])},[e.isMashupMode&&c?.audio_url?(u(),p(`div`,{key:0,class:`mashup-check`,onClick:y(t=>e.onToggleMashup(c),[`stop`])},[a(C,{"model-value":e.isMashupSelected(c),onClick:s[0]||=y(()=>{},[`stop`])},null,8,[`model-value`])],8,Yi)):o(``,!0),g((u(),p(`div`,Xi,[a(w,{src:c?.image_url,class:`cover`,fit:`cover`,lazy:``},null,8,[`src`]),c?.audio_url&&e.$store.state?.suno?.audio?.id===c.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:y(t=>e.onPause(c),[`stop`])},[a(E,null,{default:m(()=>[a(T)]),_:1})],8,Zi)):o(``,!0),c?.audio_url&&(e.$store.state?.suno?.audio?.id!==c.id||e.$store.state?.suno?.audio?.id===c.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:y(t=>e.onPlay(c),[`stop`])},[a(E,null,{default:m(()=>[a(D)]),_:1})],8,Qi)):o(``,!0),c?.duration?(u(),p(`div`,$i,l(e.useFormatDuring(c?.duration)),1)):o(``,!0)])),[[L,!c?.audio_url]]),r(`div`,ea,[e.editingAudioId===c.id?(u(),p(`div`,{key:0,class:`title-edit`,onClick:s[2]||=y(()=>{},[`stop`])},[a(O,{ref_for:!0,ref:`titleInput`,modelValue:e.editingTitle,"onUpdate:modelValue":s[1]||=t=>e.editingTitle=t,size:`small`,onKeyup:[_(t=>e.onSaveTitleEdit(c),[`enter`]),_(e.onCancelTitleEdit,[`escape`])],onBlur:t=>e.onSaveTitleEdit(c)},null,8,[`modelValue`,`onKeyup`,`onBlur`])])):(u(),p(`div`,ta,[r(`h2`,na,l(c?.title),1),c?.audio_url?(u(),n(k,{key:0,icon:`fa-solid fa-pen`,class:`edit-icon`,onClick:y(t=>e.onStartTitleEdit(c),[`stop`])},null,8,[`onClick`])):o(``,!0)])),r(`p`,ra,l(c?.style),1),!c?.audio_url&&c?.progress!=null&&c?.progress<100?(u(),p(`div`,ia,[a(A,{percentage:Math.round(c.progress),"stroke-width":4,"show-text":!1,status:`warning`,class:`progress-bar`},null,8,[`percentage`]),r(`span`,aa,l(e.$t(`suno.name.generating`))+` `+l(Math.round(c.progress))+`%`,1)])):o(``,!0)]),r(`div`,oa,[a(F,null,{dropdown:m(()=>[a(P,null,{default:m(()=>[a(N,{disabled:e.isFetchingVideoUrl,onClick:t=>e.handleVideoDownload(c)},{default:m(()=>[r(`div`,ca,[e.isFetchingVideoUrl?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_video`)),1)])]),_:1},8,[`disabled`,`onClick`]),c?.audio_url?(u(),n(N,{key:0,onClick:y(t=>e.onDownload(t,c?.audio_url),[`stop`])},{default:m(()=>[i(l(e.$t(`suno.button.download_audio`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{disabled:e.isFetchingWav,onClick:t=>e.handleWavDownload(c)},{default:m(()=>[r(`div`,la,[e.isFetchingWav?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_wav`)),1)])]),_:1},8,[`disabled`,`onClick`]),a(N,{disabled:e.isFetchingMidi,onClick:t=>e.handleMidiDownload(c)},{default:m(()=>[r(`div`,ua,[e.isFetchingMidi?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_midi`)),1)])]),_:1},8,[`disabled`,`onClick`])]),_:2},1024)]),default:m(()=>[r(`span`,sa,[a(j,{effect:`dark`,content:e.$t(`suno.button.download`),placement:`top`},{default:m(()=>[c?.audio_url||c?.video_url?(u(),n(k,{key:0,icon:`fa-solid fa-download`,class:`icon icon-download`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024),a(F,null,{dropdown:m(()=>[a(P,{class:`suno-action-menu`},{default:m(()=>[c?.audio_url?(u(),n(N,{key:0,onClick:y(t=>e.onExtend(t,c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-forward`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.extend`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{onClick:y(t=>e.onCover(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-music`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.cover_music`)),1)]),_:1},8,[`onClick`]),c?.id?(u(),n(N,{key:1,onClick:y(t=>e.onMashup(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-shuffle`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.mashup`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id&&c?.action===`extend`?(u(),n(N,{key:2,onClick:y(t=>e.onConcatMusic(c?.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-link`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.concat_music`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[4]||=r(`div`,{class:`menu-divider`},null,-1),c?.id?(u(),n(N,{key:3,onClick:y(t=>e.onReplaceSection(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-scissors`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.replace_section`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:4,onClick:y(t=>e.onOverpainting(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-microphone`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.overpainting`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:5,onClick:y(t=>e.onUnderpainting(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-guitar`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.underpainting`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:6,onClick:y(t=>e.onSamples(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-drum`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.samples`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[5]||=r(`div`,{class:`menu-divider`},null,-1),c.id?(u(),n(N,{key:7,onClick:y(t=>e.onGetStems(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-layer-group`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.get_stems`)),1)]),_:1},8,[`onClick`])):o(``,!0),c.id?(u(),n(N,{key:8,onClick:y(t=>e.onGetAllStems(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-bars-staggered`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.all_stems`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:9,onClick:y(t=>e.onRemaster(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-wand-magic-sparkles`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.remaster`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:10,onClick:y(t=>e.onExtractVocals(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-headphones`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.extract_vocals`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:11,onClick:y(t=>e.onArtistConsistency(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-palette`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.artist_consistency`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:12,onClick:y(t=>e.onAdjustSpeed(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-gauge-high`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.adjust_speed`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[6]||=r(`div`,{class:`menu-divider`},null,-1),a(N,{onClick:y(t=>e.onReusePrompt(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-rotate-left`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.reuse_prompt`)),1)]),_:1},8,[`onClick`]),c?.id?(u(),n(N,{key:13,onClick:y(t=>e.onGetTiming(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-clock`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.get_timing`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{onClick:y(e.onViewCode,[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-code`,class:`menu-icon`}),i(` `+l(e.$t(`common.button.viewCode`)),1)]),_:1},8,[`onClick`]),s[7]||=r(`div`,{class:`menu-divider`},null,-1),c?.id?(u(),n(N,{key:14,class:`delete-item`,onClick:y(t=>e.onDelete(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-trash`,class:`menu-icon delete-icon`}),i(` `+l(e.$t(`suno.button.delete`)),1)]),_:1},8,[`onClick`])):o(``,!0)]),_:2},1024)]),default:m(()=>[r(`span`,da,[a(j,{effect:`dark`,content:e.$t(`suno.button.more`),placement:`top`},{default:m(()=>[c?.audio_url||c?.video_url?(u(),n(k,{key:0,icon:`fa-solid fa-ellipsis`,class:`icon icon-ellipsis`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024)])],10,Ji))),128)),a(I,{visible:e.apiCodeVisible,"onUpdate:visible":s[3]||=t=>e.apiCodeVisible=t,method:`POST`,path:e.apiCodePath,body:e.apiCodeBody,token:e.$store.state.suno?.credential?.token||``},null,8,[`visible`,`path`,`body`,`token`])])}var pa=s({name:`RecentPanel`,components:{ElSkeletonItem:oe,ElSkeleton:se,ElInput:G,ElButton:b,ElDropdown:V,ElDropdownMenu:re,ElDropdownItem:B,ElPopover:ie,ElRadioGroup:R,ElRadioButton:L,ElSelect:E,ElOption:D,FontAwesomeIcon:Z,TaskPreview:W(Ki,[[`render`,fa]]),Player:Ee,NoTasks:Ce,ScrollList:ye},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0,searchQuery:``,sortBy:`newest`,filterType:`all`,filterDuration:`all`,filterVideo:`all`,filterModel:`all`}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}},sortLabel(){return this.sortBy===`newest`?this.$t(`suno.sort.newest`):this.$t(`suno.sort.oldest`)},activeFilterCount(){let e=0;return this.filterType!==`all`&&e++,this.filterDuration!==`all`&&e++,this.filterVideo!==`all`&&e++,this.filterModel&&this.filterModel!==`all`&&e++,e},availableModels(){let e=this.tasks?.items||[],t=new Set;for(let n of e){let e=n?.response?.data??[];for(let n of e)n.model&&t.add(n.model)}return Array.from(t).sort()},filteredTasks(){let e=this.tasks?.items||[];if(this.searchQuery){let t=this.searchQuery.toLowerCase();e=e.filter(e=>(e?.response?.data??[]).some(e=>e.title?.toLowerCase().includes(t)||e.style?.toLowerCase().includes(t)||e.prompt?.toLowerCase().includes(t)))}return this.activeFilterCount>0&&(e=e.filter(e=>{let t=e?.request??{},n=e?.response?.data??[];return this.filterType===`vocal`&&t.instrumental===!0||this.filterType===`instrumental`&&t.instrumental!==!0?!1:this.filterDuration!==`all`||this.filterVideo!==`all`||this.filterModel&&this.filterModel!==`all`?n.some(e=>!(this.filterDuration===`short`&&!(typeof e.duration==`number`&&e.duration<60)||this.filterDuration===`medium`&&!(typeof e.duration==`number`&&e.duration>=60&&e.duration<=180)||this.filterDuration===`long`&&!(typeof e.duration==`number`&&e.duration>180)||this.filterVideo===`with`&&!e.video_url||this.filterVideo===`without`&&e.video_url||this.filterModel&&this.filterModel!==`all`&&e.model!==this.filterModel)):!0})),this.sortBy===`oldest`&&(e=[...e].reverse()),e}},methods:{onSortChange(e){this.sortBy=e},onResetFilters(){this.filterType=`all`,this.filterDuration=`all`,this.filterVideo=`all`,this.filterModel=`all`},getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),ma={key:0,class:`tasks`},ha={class:`left w-[70px] p-[10px] flex items-center`},ga={class:`main w-[calc(100%-70px)] flex-1 p-[10px]`},_a={key:0,class:`task-toolbar`},va={key:0,class:`filter-badge`},ya={class:`filter-popover`},ba={class:`filter-row`},xa={class:`filter-label`},Sa={class:`filter-row`},Ca={class:`filter-label`},wa={class:`filter-row`},Ta={class:`filter-label`},Ea={key:0,class:`filter-row`},Da={class:`filter-label`},Oa={class:`filter-actions`},ka={key:2,class:`w-full flex-1 flex items-center justify-center`},Aa={class:`text-sm text-gray-400`},ja={key:3,class:`w-full flex-1 flex flex-col items-center justify-center gap-2`},Ma={class:`text-sm text-gray-400`},Na={key:4,class:`w-full flex-1 flex items-center justify-center`},Pa={class:`h-20`};function Fa(e,s,h,_,y,b){let x=f(`el-skeleton-item`),S=f(`el-skeleton`),C=f(`font-awesome-icon`),w=f(`el-input`),T=f(`el-button`),E=f(`el-dropdown-item`),D=f(`el-dropdown-menu`),O=f(`el-dropdown`),k=f(`el-radio-button`),A=f(`el-radio-group`),j=f(`el-option`),M=f(`el-select`),N=f(`el-popover`),P=f(`task-preview`),F=f(`scroll-list`),I=f(`no-tasks`),L=f(`player`);return u(),p(v,null,[e.tasks?.items===void 0?(u(),p(`div`,ma,[(u(),p(v,null,c(3,e=>r(`div`,{key:e,class:`flex`},[r(`div`,ha,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`image`,class:`avatar w-[50px] h-[50px]`})]),_:1})]),r(`div`,ga,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`p`,class:`w-[200px] h-[15px] mb-[5px] mt-[10px]`}),a(x,{variant:`text`})]),_:1})])])),64))])):(u(),p(v,{key:1},[e.tasks?.items?.length?(u(),p(`div`,_a,[a(w,{modelValue:e.searchQuery,"onUpdate:modelValue":s[0]||=t=>e.searchQuery=t,size:`small`,placeholder:e.$t(`suno.placeholder.searchSongs`),clearable:``,class:`task-search`},{prefix:m(()=>[a(C,{icon:`fa-solid fa-magnifying-glass`,class:`text-xs`})]),_:1},8,[`modelValue`,`placeholder`]),a(O,{trigger:`click`,onCommand:e.onSortChange},{dropdown:m(()=>[a(D,null,{default:m(()=>[a(E,{command:`newest`,class:t({"is-active":e.sortBy===`newest`})},{default:m(()=>[i(l(e.$t(`suno.sort.newest`)),1)]),_:1},8,[`class`]),a(E,{command:`oldest`,class:t({"is-active":e.sortBy===`oldest`})},{default:m(()=>[i(l(e.$t(`suno.sort.oldest`)),1)]),_:1},8,[`class`])]),_:1})]),default:m(()=>[a(T,{size:`small`,class:`sort-btn`},{default:m(()=>[a(C,{icon:`fa-solid fa-arrow-down-wide-short`,class:`mr-1`}),i(` `+l(e.sortLabel),1)]),_:1})]),_:1},8,[`onCommand`]),a(N,{trigger:`click`,placement:`bottom-end`,width:260},{reference:m(()=>[a(T,{size:`small`,class:t([`filter-btn`,{"has-active-filter":e.activeFilterCount>0}])},{default:m(()=>[a(C,{icon:`fa-solid fa-filter`,class:`mr-1`}),i(` `+l(e.$t(`suno.filter.title`))+` `,1),e.activeFilterCount>0?(u(),p(`span`,va,l(e.activeFilterCount),1)):o(``,!0)]),_:1},8,[`class`])]),default:m(()=>[r(`div`,ya,[r(`div`,ba,[r(`div`,xa,l(e.$t(`suno.filter.type`)),1),a(A,{modelValue:e.filterType,"onUpdate:modelValue":s[1]||=t=>e.filterType=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.typeAll`)),1)]),_:1}),a(k,{value:`vocal`},{default:m(()=>[i(l(e.$t(`suno.filter.typeVocal`)),1)]),_:1}),a(k,{value:`instrumental`},{default:m(()=>[i(l(e.$t(`suno.filter.typeInstrumental`)),1)]),_:1})]),_:1},8,[`modelValue`])]),r(`div`,Sa,[r(`div`,Ca,l(e.$t(`suno.filter.duration`)),1),a(A,{modelValue:e.filterDuration,"onUpdate:modelValue":s[2]||=t=>e.filterDuration=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.durationAll`)),1)]),_:1}),a(k,{value:`short`},{default:m(()=>[i(l(e.$t(`suno.filter.durationShort`)),1)]),_:1}),a(k,{value:`medium`},{default:m(()=>[i(l(e.$t(`suno.filter.durationMedium`)),1)]),_:1}),a(k,{value:`long`},{default:m(()=>[i(l(e.$t(`suno.filter.durationLong`)),1)]),_:1})]),_:1},8,[`modelValue`])]),r(`div`,wa,[r(`div`,Ta,l(e.$t(`suno.filter.video`)),1),a(A,{modelValue:e.filterVideo,"onUpdate:modelValue":s[3]||=t=>e.filterVideo=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.videoAll`)),1)]),_:1}),a(k,{value:`with`},{default:m(()=>[i(l(e.$t(`suno.filter.videoWith`)),1)]),_:1}),a(k,{value:`without`},{default:m(()=>[i(l(e.$t(`suno.filter.videoWithout`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e.availableModels.length>0?(u(),p(`div`,Ea,[r(`div`,Da,l(e.$t(`suno.filter.model`)),1),a(M,{modelValue:e.filterModel,"onUpdate:modelValue":s[4]||=t=>e.filterModel=t,size:`small`,placeholder:e.$t(`suno.filter.modelAll`),clearable:``},{default:m(()=>[a(j,{label:e.$t(`suno.filter.modelAll`),value:`all`},null,8,[`label`]),(u(!0),p(v,null,c(e.availableModels,e=>(u(),n(j,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0),r(`div`,Oa,[a(T,{size:`small`,text:``,onClick:e.onResetFilters},{default:m(()=>[i(l(e.$t(`suno.filter.reset`)),1)]),_:1},8,[`onClick`])])])]),_:1})])):o(``,!0),e.filteredTasks?.length>0?(u(),n(F,{key:1,ref:`scrollList`,class:`flex-1 w-full overflow-y-auto tasks p-2`,loading:e.loading,onReachTop:s[5]||=t=>e.$emit(`reach-top`)},{default:m(()=>[(u(!0),p(v,null,c(e.filteredTasks,(e,t)=>(u(),n(P,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):e.searchQuery&&e.tasks?.items?.length>0?(u(),p(`div`,ka,[r(`p`,Aa,l(e.$t(`suno.message.noSearchResults`)),1)])):e.activeFilterCount>0&&e.tasks?.items?.length>0?(u(),p(`div`,ja,[r(`p`,Ma,l(e.$t(`suno.message.noFilterResults`)),1),a(T,{size:`small`,text:``,onClick:e.onResetFilters},{default:m(()=>[i(l(e.$t(`suno.filter.reset`)),1)]),_:1},8,[`onClick`])])):e.tasks?.items?.length===0?(u(),p(`div`,Na,[a(I)])):o(``,!0)],64)),g(r(`div`,Pa,[a(L,{namespace:`suno`})],512),[[d,!!e.$store?.state?.suno?.audio?.object]])],64)}var Ia=W(pa,[[`render`,Fa],[`__scopeId`,`data-v-6ce376c9`]]),La=s({name:`TaskPreview`,components:{IconPicture:T,ElImage:P,ElAvatar:F,ElIcon:w},computed:{audio(){return this.$store.state.suno?.audio}}}),Ra={key:0,class:`size-full overflow-hidden`},za={class:`relative h-[300px]`},Ba={class:`flex items-center justify-center size-full bg-[var(--el-bg-color)]`},Va={class:`absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent`},Ha={class:`p-4`},Ua={class:`flex items-center font-bold mb-2`},Wa={class:`text-[var(--el-text-color-regular)] mb-2`},Ga={class:`text-xs text-[var(--el-text-color-regular)]`},Ka={class:`mt-4 text-sm leading-[25px] whitespace-pre-wrap`},qa={key:1,class:`w-full h-full`};function Ja(e,t,n,i,o,s){let c=f(`icon-picture`),d=f(`el-icon`),h=f(`el-image`),g=f(`el-avatar`);return e.audio?.object?(u(),p(`div`,Ra,[r(`div`,za,[a(h,{src:e.audio.image_url,fit:`cover`,class:`size-full`},{error:m(()=>[r(`div`,Ba,[a(d,{class:`text-3xl`},{default:m(()=>[a(c)]),_:1})])]),_:1},8,[`src`]),r(`h2`,Va,l(e.audio?.title),1)]),r(`div`,Ha,[r(`div`,Ua,[a(g,{size:30,src:e.audio?.image_url,class:`mr-2`},null,8,[`src`]),r(`span`,null,l(e.audio?.title),1)]),r(`p`,Wa,l(e.audio?.style),1),r(`p`,Ga,l(e.$dayjs.format(e.audio?.created_at)),1),r(`div`,Ka,[r(`p`,null,l(e.audio?.lyric),1)])])])):(u(),p(`div`,qa))}var Ya=W(La,[[`render`,Ja]]),Xa=U(`suno`),Za=s({name:`SunoIndex`,components:{Layout:Ne,ConfigPanel:Ui,RecentPanel:Ia,PreviewPanel:Ya},mixins:[fe],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===X.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===X.Request||this.fetchingTasks},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===X.Request},needApply(){return this.$store.state.suno.status.getApplications===X.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await xe({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`suno/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplications`),await this.$store.dispatch(`suno/getApplications`),console.debug(`end onGetApplications`),await this.onGetTasks()},onApply(){de.create({application:this.application}).then(({data:e})=>{this.application=e,J.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&J.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`suno/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){if(!he(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;let e={...this.config,callback_url:Xa};if(!this.hasSunoInput(e)){J.error(this.$t(`suno.message.promptRequired`));return}this.hasText(e.prompt)&&(e.prompt=e.prompt.trim());let t=this.credential?.token;if(!t){console.error(`no token specified`);return}J.info(this.$t(`suno.message.startingTask`)),pe(`suno`,Y.audio(e,{token:t})).then(()=>{J.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{J.error(e?.response?.data?.error?.message||this.$t(`suno.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0},hasSunoInput(e){return[e.prompt,e.lyric,e.lyric_prompt,e.style,e.title].some(e=>this.hasText(e))||this.hasText(e.audio_id)||Array.isArray(e.mashup_audio_ids)&&e.mashup_audio_ids.length>0}}});function Qa(e,t,r,i,o,s){let c=f(`config-panel`),l=f(`recent-panel`),d=f(`preview-panel`),p=f(`layout`);return u(),n(p,null,{config:m(()=>[a(c,{onGenerate:e.onGenerateAudio},null,8,[`onGenerate`])]),result:m(()=>[a(l,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),preview:m(()=>[a(d)]),_:1})}var $a=W(Za,[[`render`,Qa],[`__scopeId`,`data-v-b9beee12`]]);export{$a as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{$ as e,Bt as t,D as n,E as r,M as i,N as a,O as o,P as s,Q as c,Ut as l,X as u,_ as d,et as f,k as p,lt as m,tt as h,ut as g,v as _,x as v,y}from"./vendor-chart-mdwpew_o.js";import{t as b}from"./button-DWzbdjZV.js";import{F as x,X as S,Y as C,tt as w,z as T}from"./use-deprecated-CPfQu7wa.js";import{r as E,t as D}from"./select-CyfjsVYT.js";import{n as O,t as k}from"./tabs-DDqt-7al.js";import{n as A,t as j}from"./form-D0aSFxDK.js";import{t as M}from"./upload-CIsl9b3M.js";import{t as N}from"./tooltip-C3PYfh8V.js";import{t as P}from"./image-BhCAlGZE.js";import{t as F}from"./avatar-DJGt2zYX.js";import{t as I}from"./checkbox-hfJFSY6z.js";import{n as L,r as R,t as ee}from"./radio-IJQsW93X.js";import{n as te,t as ne}from"./collapse-DzxsO3Mt.js";import{t as z}from"./drawer-BvYPSxXh.js";import{n as B,r as re,t as V}from"./dropdown-Dh3U4lax.js";import{t as H}from"./input-number-De_zhvd-.js";import{t as ie}from"./popover-DaX9BEhA.js";import{t as ae}from"./progress-Djs_fbqu.js";import{n as oe,t as se}from"./skeleton-Cn4UY-T8.js";import{t as ce}from"./slider-C8p-p_jG.js";import{t as le}from"./switch-DfeNNIjH.js";import{Fn as ue,hi as U}from"./constants-EAH6CsV9.js";import{An as de,At as fe,E as W,Fn as pe,Ir as G,Mr as K,Nt as me,Or as q,Ot as he,Sr as ge,kr as J,kt as _e,rn as Y,yr as X}from"./index-WLGDsbco.js";import{t as Z}from"./index.es-DEMCbRdu.js";import{n as ve}from"./taskDrawerMixin-Cr17Yxqk.js";import{i as Q,n as ye,r as be,t as xe}from"./pagination-B3UvJKZu.js";import{n as Se,t as Ce}from"./NoTasks-HGgmWayY.js";import{t as we}from"./Consumption-Dv4UTeE5.js";import{n as Te,r as $,t as Ee}from"./Player-Dg2tf_iI.js";var De=s({name:`LayoutSuno`,components:{ElDrawer:z,ElButton:b,FontAwesomeIcon:Z},mixins:[ve],data(){return{preview:!1}},computed:{}}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`},je={class:`preview h-full w-[300px] flex flex-col`};function Me(t,n,i,o,s,c){let l=f(`font-awesome-icon`),h=f(`el-button`),_=f(`el-drawer`);return u(),p(`div`,Oe,[r(`div`,ke,[e(t.$slots,`config`,{},void 0,!0)]),r(`div`,Ae,[e(t.$slots,`result`,{},void 0,!0)]),r(`div`,je,[e(t.$slots,`preview`,{},void 0,!0)]),g(a(h,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[d,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer`},{default:m(()=>[e(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ne=W(De,[[`render`,Me],[`__scopeId`,`data-v-169b0449`]]),Pe=s({name:`TypeSelector`,components:{ElSelect:E,ElOption:D,ElSwitch:le},data(){return{options:[{label:`v5.5`,value:`chirp-v5-5`,desc:this.$t(`suno.model.v55desc`)},{label:`v5`,value:`chirp-v5`,desc:this.$t(`suno.model.v5desc`)},{label:`v4.5+`,value:`chirp-v4-5-plus`,desc:this.$t(`suno.model.v45plusdesc`)},{label:`v4.5`,value:`chirp-v4-5`,desc:this.$t(`suno.model.v45desc`),dividerAfter:!0},{label:`v4`,value:`chirp-v4`,desc:this.$t(`suno.model.v4desc`)},{label:`v3.5`,value:`chirp-v3-5`,desc:this.$t(`suno.model.v35desc`)},{label:`v3`,value:`chirp-v3-0`,desc:this.$t(`suno.model.v3desc`)}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom||!1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,custom:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental||!1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,instrumental:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||=ue}}),Fe={class:`mb-3`},Ie={class:`flex items-center mb-1`},Le={class:`text-sm font-bold`},Re={class:`model-option`},ze={class:`model-option-left`},Be={class:`model-option-name`},Ve={class:`model-option-desc`},He={key:0,class:`flex items-center justify-between mb-3`},Ue={class:`text-sm font-bold`};function We(e,i,s,d,h,g){let _=f(`el-option`),y=f(`el-select`),b=f(`el-switch`);return u(),p(`div`,null,[r(`div`,Fe,[r(`div`,Ie,[r(`span`,Le,l(e.$t(`suno.name.model`)),1)]),a(y,{modelValue:e.model,"onUpdate:modelValue":i[0]||=t=>e.model=t,class:`w-full model-select`,size:`default`,placeholder:e.$t(`suno.placeholder.select`)},{default:m(()=>[(u(!0),p(v,null,c(e.options,e=>(u(),n(_,{key:e.value,label:e.label,value:e.value,class:t({"model-option-divider":e.dividerAfter})},{default:m(()=>[r(`div`,Re,[r(`div`,ze,[r(`span`,Be,l(e.label),1)]),r(`span`,Ve,l(e.desc),1)])]),_:2},1032,[`label`,`value`,`class`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),e.custom?(u(),p(`div`,He,[r(`span`,Ue,l(e.$t(`suno.name.instrumental`)),1),a(b,{modelValue:e.instrumental,"onUpdate:modelValue":i[1]||=t=>e.instrumental=t},null,8,[`modelValue`])])):o(``,!0)])}var Ge=W(Pe,[[`render`,We],[`__scopeId`,`data-v-16e4d6fc`]]),Ke=s({name:`UploadAudio`,components:{ElUpload:M,ElButton:b,ElDialog:K,ElTabs:O,ElTabPane:k,InfoIcon:Q,FontAwesomeIcon:Z,ElRadioGroup:R,ElRadioButton:L},mixins:[_e],emits:[`change`],data(){return{fileList:[],uploadUrl:ge()+`/api/v1/files/`,dialogVisible:!1,activeTab:`browse`,recording:!1,recordedBlob:null,recordedAudioUrl:null,audioPreviewUrl:null,recordTimer:null,recordSeconds:0,mediaRecorder:null,mediaStream:null,recordedChunks:[],uploadingRecord:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}},hasUploadedAudio(){let e=this.$store.state.suno?.config?.action;return e===`upload_extend`||e===`upload_cover`},uploadAction:{get(){return this.$store.state.suno?.config?.action||`upload_extend`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,action:e})}},formattedTime(){return`${Math.floor(this.recordSeconds/60).toString().padStart(2,`0`)}:${(this.recordSeconds%60).toString().padStart(2,`0`)}`}},watch:{urls:{handler(e){this.$emit(`change`,e)}}},beforeUnmount(){this.cleanupRecording()},methods:{onExceed(){J.warning(this.$t(`suno.message.uploadReferencesExceed`))},onError(){J.error(this.$t(`suno.message.uploadReferencesError`))},async onBrowseSuccess(){let e=this.urls?.[0];e&&(this.audioPreviewUrl=e,await this.onGenerateAudioId(e),this.dialogVisible=!1)},async onGenerateAudioId(e){let t={audio_url:e},n=this.credential?.token;if(!n){console.error(`no token specified`);return}J.info(this.$t(`suno.message.startingUploadAudio`));try{let e=await Y.upload(t,{token:n});console.debug(`get upload music success`,e.data);let r=e.data?.data.audio_id;this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,audio_id:r,action:`upload_extend`}),J.success(this.$t(`suno.message.startUploadAudioSuccess`))}catch(e){J.error(e?.response?.data?.error?.message||this.$t(`suno.message.startUploadAudioFailed`))}},async startRecording(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){J.error(this.$t(`suno.message.recordingUnsupported`));return}try{this.mediaStream=await navigator.mediaDevices.getUserMedia({audio:!0}),this.recordedChunks=[],this.mediaRecorder=new MediaRecorder(this.mediaStream),this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.recordedChunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.recordedChunks,{type:`audio/webm`});this.recordedBlob=e,this.recordedAudioUrl&&URL.revokeObjectURL(this.recordedAudioUrl),this.recordedAudioUrl=URL.createObjectURL(e),this.releaseStream()},this.mediaRecorder.start(),this.recording=!0,this.recordSeconds=0,this.recordTimer=window.setInterval(()=>{this.recordSeconds+=1,this.recordSeconds>=600&&this.stopRecording()},1e3)}catch(e){console.error(`record error`,e),J.error(this.$t(`suno.message.recordingPermissionDenied`))}},stopRecording(){this.recordTimer&&=(window.clearInterval(this.recordTimer),null),this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),this.recording=!1},resetRecording(){this.recordedAudioUrl&&URL.revokeObjectURL(this.recordedAudioUrl),this.recordedBlob=null,this.recordedAudioUrl=null,this.recordSeconds=0},async uploadRecording(){if(this.recordedBlob){this.uploadingRecord=!0;try{let e=new FormData,t=`recording-${Date.now()}.webm`;e.append(`file`,this.recordedBlob,t);let n=await fetch(this.uploadUrl,{method:`POST`,headers:{Authorization:`Bearer ${this.$store.state.token.access}`},body:e});if(!n.ok)throw Error(`upload failed: ${n.status}`);let r=await n.json(),i=r?.file_url||r?.data?.file_url;if(!i)throw Error(`no file_url in response`);this.audioPreviewUrl=i,await this.onGenerateAudioId(i),this.dialogVisible=!1,this.resetRecording()}catch(e){console.error(e),J.error(e?.message||this.$t(`suno.message.uploadReferencesError`))}finally{this.uploadingRecord=!1}}},releaseStream(){this.mediaStream&&=(this.mediaStream.getTracks().forEach(e=>e.stop()),null)},cleanupRecording(){this.recordTimer&&=(window.clearInterval(this.recordTimer),null),this.releaseStream(),this.recordedAudioUrl&&=(URL.revokeObjectURL(this.recordedAudioUrl),null)}}}),qe={class:`relative`},Je={class:`flex justify-between items-center mb-2`},Ye={class:`flex justify-start items-center`},Xe={class:`text-sm font-bold`},Ze={key:0,class:`mb-2`},Qe=[`src`],$e={key:1,class:`mt-2`},et={class:`py-4`},tt={class:`text-center py-6`},nt={class:`text-sm`},rt={class:`text-xs text-gray-400 mt-1`},it={class:`py-4 text-center`},at={class:`recorder-display mb-4`},ot={key:0,class:`text-red-500 flex items-center justify-center gap-2`},st={class:`text-2xl font-mono`},ct={key:1,class:`text-green-600`},lt={key:2,class:`text-gray-400 text-2xl font-mono`},ut={key:0,class:`mb-4`},dt=[`src`],ft={class:`flex justify-center gap-3`};function pt(e,t,s,c,d,h){let g=f(`info-icon`),_=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-radio-button`),x=f(`el-radio-group`),S=f(`el-upload`),C=f(`el-tab-pane`),w=f(`el-tabs`),T=f(`el-dialog`);return u(),p(`div`,qe,[r(`div`,Je,[r(`div`,Ye,[r(`span`,Xe,l(e.$t(`suno.name.referenceAudios`)),1),a(g,{content:e.$t(`suno.description.uploadAudios`)},null,8,[`content`])]),a(y,{round:``,type:`primary`,size:`small`,onClick:t[0]||=t=>e.dialogVisible=!0},{default:m(()=>[a(_,{icon:`fa-solid fa-plus`,class:`icon mr-1`}),i(` `+l(e.$t(`suno.button.addAudio`)),1)]),_:1})]),e.audioPreviewUrl?(u(),p(`div`,Ze,[r(`audio`,{src:e.audioPreviewUrl,controls:``,class:`w-full`},null,8,Qe)])):o(``,!0),e.hasUploadedAudio?(u(),p(`div`,$e,[a(x,{modelValue:e.uploadAction,"onUpdate:modelValue":t[1]||=t=>e.uploadAction=t,size:`small`},{default:m(()=>[a(b,{value:`upload_extend`},{default:m(()=>[i(l(e.$t(`suno.button.extend`)),1)]),_:1}),a(b,{value:`upload_cover`},{default:m(()=>[i(l(e.$t(`suno.button.upload_cover`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),a(T,{modelValue:e.dialogVisible,"onUpdate:modelValue":t[4]||=t=>e.dialogVisible=t,title:e.$t(`suno.name.addAudio`),width:`520px`,"close-on-click-modal":!1,"append-to-body":``},{default:m(()=>[a(w,{modelValue:e.activeTab,"onUpdate:modelValue":t[3]||=t=>e.activeTab=t,class:`add-audio-tabs`},{default:m(()=>[a(C,{name:`browse`,label:e.$t(`suno.tab.browse`)},{default:m(()=>[r(`div`,et,[a(S,{"file-list":e.fileList,"onUpdate:fileList":t[2]||=t=>e.fileList=t,name:`file`,limit:1,class:`upload-wrapper`,action:e.uploadUrl,accept:`.mp3,.wav,.m4a,audio/*`,"show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onBrowseSuccess,headers:e.headers,drag:``},{default:m(()=>[r(`div`,tt,[a(_,{icon:`fa-solid fa-upload`,class:`text-4xl text-gray-400 mb-3`}),r(`div`,nt,l(e.$t(`suno.description.dropAudioHere`)),1),r(`div`,rt,l(e.$t(`suno.description.audioFormats`)),1)])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])]),_:1},8,[`label`]),a(C,{name:`record`,label:e.$t(`suno.tab.record`)},{default:m(()=>[r(`div`,it,[r(`div`,at,[e.recording?(u(),p(`div`,ot,[t[5]||=r(`span`,{class:`recording-dot`},null,-1),r(`span`,st,l(e.formattedTime),1)])):e.recordedBlob?(u(),p(`div`,ct,[a(_,{icon:`fa-solid fa-check-circle`,class:`text-2xl mr-2`}),r(`span`,null,l(e.$t(`suno.message.recordingReady`))+` (`+l(e.formattedTime)+`)`,1)])):(u(),p(`div`,lt,`00:00`))]),e.recordedAudioUrl&&!e.recording?(u(),p(`div`,ut,[r(`audio`,{src:e.recordedAudioUrl,controls:``,class:`w-full`},null,8,dt)])):o(``,!0),r(`div`,ft,[!e.recording&&!e.recordedBlob?(u(),n(y,{key:0,type:`primary`,round:``,onClick:e.startRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-microphone`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.startRecord`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.recording?(u(),n(y,{key:1,type:`danger`,round:``,onClick:e.stopRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-stop`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.stopRecord`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.recordedBlob&&!e.recording?(u(),p(v,{key:2},[a(y,{round:``,onClick:e.resetRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.reRecord`)),1)]),_:1},8,[`onClick`]),a(y,{type:`primary`,round:``,loading:e.uploadingRecord,onClick:e.uploadRecording},{default:m(()=>[a(_,{icon:`fa-solid fa-upload`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])],64)):o(``,!0)])])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`])])}var mt=W(Ke,[[`render`,pt],[`__scopeId`,`data-v-5f17a1f4`]]),ht=[{key:`lofi`,label:`🎧 Lo-fi Chill`,prompt:`a relaxing lo-fi hip hop beat for studying`},{key:`pop-love`,label:`💕 Pop Love Song`,prompt:`a catchy pop love song with sweet melodies`},{key:`rock-anthem`,label:`🎸 Rock Anthem`,prompt:`an energetic rock anthem with electric guitars`},{key:`jazz-night`,label:`🎷 Jazz Night`,prompt:`a smooth late-night jazz piece with saxophone`},{key:`edm-drop`,label:`⚡ EDM Drop`,prompt:`an intense EDM track with a massive drop`},{key:`folk-story`,label:`🪕 Folk Story`,prompt:`a warm folk song telling a story about traveling`},{key:`rnb-groove`,label:`🎤 R&B Groove`,prompt:`a smooth R&B groove with soulful vocals`},{key:`classical`,label:`🎻 Classical`,prompt:`an elegant classical piece for orchestra`},{key:`hip-hop`,label:`🎤 Hip Hop`,prompt:`a hard-hitting hip hop beat with bass`},{key:`country`,label:`🤠 Country`,prompt:`an upbeat country song with acoustic guitar and banjo`},{key:`reggae`,label:`🌴 Reggae`,prompt:`a laid-back reggae tune with island vibes`},{key:`latin`,label:`💃 Latin`,prompt:`a vibrant Latin dance track with percussion`},{key:`ambient`,label:`🌊 Ambient`,prompt:`a dreamy ambient soundscape for relaxation`},{key:`metal`,label:`🤘 Metal`,prompt:`a powerful metal song with heavy riffs and double bass drums`},{key:`soul`,label:`🎵 Soul`,prompt:`a heartfelt soul ballad with gospel harmonies`},{key:`synthwave`,label:`🌃 Synthwave`,prompt:`a retro synthwave track with 80s vibes`},{key:`kpop`,label:`🇰🇷 K-Pop`,prompt:`a catchy K-pop dance track with hook`},{key:`lullaby`,label:`🌙 Lullaby`,prompt:`a gentle lullaby for bedtime with soft piano`},{key:`cinematic`,label:`🎬 Cinematic`,prompt:`an epic cinematic orchestral score for a movie trailer`},{key:`blues`,label:`🎸 Blues`,prompt:`a soulful blues song with electric guitar bends`},{key:`disco`,label:`🕺 Disco`,prompt:`a funky disco track with groovy bassline`},{key:`punk`,label:`🔥 Punk Rock`,prompt:`a fast punk rock song with raw energy`},{key:`gospel`,label:`⛪ Gospel`,prompt:`an uplifting gospel choir song with piano`},{key:`trap`,label:`🔊 Trap`,prompt:`a dark trap beat with 808s and hi-hats`},{key:`bossa`,label:`☕ Bossa Nova`,prompt:`a gentle bossa nova with nylon guitar`},{key:`indie`,label:`🎶 Indie`,prompt:`a dreamy indie track with ethereal vocals`},{key:`cpop`,label:`🇨🇳 C-Pop`,prompt:`a beautiful Chinese pop ballad with emotional vocals`},{key:`jpop`,label:`🇯🇵 J-Pop`,prompt:`a cheerful J-pop song with anime vibes`},{key:`afrobeat`,label:`🥁 Afrobeat`,prompt:`a groovy Afrobeat track with layered percussion`},{key:`game`,label:`🎮 Game BGM`,prompt:`an adventurous video game background music`}],gt=8;function _t(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var vt=s({name:`PromptInput`,components:{FontAwesomeIcon:Z,PromptTextarea:Se},data(){return{shuffledTags:_t(ht)}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,prompt:e})}},visibleTags(){return this.shuffledTags.slice(0,gt)}},mounted(){this.prompt||=``},methods:{onTagClick(e){this.prompt=e.prompt},onRefreshTags(){this.shuffledTags=_t(ht)}}}),yt={class:`inspo-tags`},bt=[`onClick`];function xt(e,t,i,o,s,d){let h=f(`font-awesome-icon`),g=f(`prompt-textarea`);return u(),n(g,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`suno.name.songDescription`),info:e.$t(`suno.description.prompt`),placeholder:e.$t(`suno.placeholder.prompt`),"min-rows":5,"max-rows":14},{after:m(()=>[r(`div`,yt,[(u(!0),p(v,null,c(e.visibleTags,t=>(u(),p(`button`,{key:t.key,class:`inspo-tag`,onClick:n=>e.onTagClick(t)},l(t.label),9,bt))),128)),r(`button`,{class:`inspo-tag inspo-tag-refresh`,onClick:t[0]||=(...t)=>e.onRefreshTags&&e.onRefreshTags(...t)},[a(h,{icon:`fa-solid fa-arrows-rotate`})])])]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var St=W(vt,[[`render`,xt],[`__scopeId`,`data-v-58ffcd38`]]),Ct=s({name:`LyricInput`,components:{ElInput:G,ElButton:b,ElTooltip:N,ElDialog:K,FontAwesomeIcon:Z,InfoIcon:Q},data(){return{generatingLyrics:!1,enhancingLyrics:!1,enhancePrompt:``,lyricHistory:[],expanded:!1}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config},credential(){return this.$store.state.suno?.credential}},mounted(){this.lyric||=``},methods:{pushHistory(){this.lyric&&(this.lyricHistory.push(this.lyric),this.lyricHistory.length>20&&this.lyricHistory.shift())},onUndo(){let e=this.lyricHistory.pop();e!==void 0&&(this.lyric=e)},onClear(){this.pushHistory(),this.lyric=``},async onEnhanceLyrics(){let e=this.credential?.token;if(!(!e||!this.lyric||!this.enhancePrompt)){this.pushHistory(),this.enhancingLyrics=!0,J.info(this.$t(`suno.message.enhancingLyrics`));try{let t=`${this.enhancePrompt}\n\nOriginal lyrics:\n${this.lyric}`,n=(await Y.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,this.enhancePrompt=``,J.success(this.$t(`suno.message.enhanceLyricsSuccess`)))}catch{J.error(this.$t(`suno.message.enhanceLyricsFailed`))}finally{this.enhancingLyrics=!1}}},async onGenerateLyrics(){let e=this.credential?.token;if(!e)return;let t;try{t=((await q.prompt(this.$t(`suno.message.lyricsThemePromptMessage`),this.$t(`suno.message.lyricsThemePromptTitle`),{confirmButtonText:this.$t(`common.button.confirm`),cancelButtonText:this.$t(`common.button.cancel`),inputPlaceholder:this.$t(`suno.placeholder.lyricsTheme`),inputValue:this.config?.title||``,inputType:`textarea`,inputValidator:e=>typeof e==`string`&&e.trim().length>0||this.$t(`suno.message.lyricsThemeRequired`)})).value||``).trim()}catch{return}if(t){this.pushHistory(),this.generatingLyrics=!0,J.info(this.$t(`suno.message.generatingLyrics`));try{let n=(await Y.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,n?.title&&!this.config?.title&&this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric:n.text,title:n.title}),J.success(this.$t(`suno.message.generateLyricsSuccess`)))}catch{J.error(this.$t(`suno.message.generateLyricsFailed`))}finally{this.generatingLyrics=!1}}}}}),wt={class:`field`},Tt={class:`flex items-center justify-between mb-1`},Et={class:`flex items-center`},Dt={class:`text-sm font-bold`},Ot={class:`flex items-center gap-1`},kt={class:`relative`},At={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},jt={key:0,class:`enhance-bar`},Mt={key:0,class:`enhance-bar mt-3`},Nt={class:`flex items-center justify-between`},Pt={class:`flex items-center gap-1`};function Ft(e,t,s,c,d,h){let g=f(`info-icon`),v=f(`font-awesome-icon`),y=f(`el-button`),b=f(`el-tooltip`),x=f(`el-input`),S=f(`el-dialog`);return u(),p(`div`,wt,[r(`div`,Tt,[r(`div`,Et,[r(`span`,Dt,l(e.$t(`suno.name.lyrics`)),1),a(g,{content:e.$t(`suno.description.lyrics`)},null,8,[`content`])]),r(`div`,Ot,[e.lyricHistory.length>0?(u(),n(b,{key:0,content:e.$t(`suno.button.undo`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:e.onUndo},{default:m(()=>[a(v,{icon:`fa-solid fa-rotate-left`})]),_:1},8,[`onClick`])]),_:1},8,[`content`])):o(``,!0),e.lyric?(u(),n(b,{key:1,content:e.$t(`suno.button.clear_lyrics`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:e.onClear},{default:m(()=>[a(v,{icon:`fa-solid fa-eraser`})]),_:1},8,[`onClick`])]),_:1},8,[`content`])):o(``,!0),a(b,{content:e.$t(`suno.button.expand_lyrics`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,onClick:t[0]||=t=>e.expanded=!0},{default:m(()=>[a(v,{icon:`fa-solid fa-expand`})]),_:1})]),_:1},8,[`content`]),e.config?.action===`extend`?o(``,!0):(u(),n(y,{key:2,size:`small`,loading:e.generatingLyrics,round:``,onClick:e.onGenerateLyrics},{default:m(()=>[e.generatingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))])]),r(`div`,kt,[e.config?.action===`extend`?(u(),n(x,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[2]||=t=>e.lyric=t,rows:5,type:`textarea`,class:`lyrics`,placeholder:e.$t(`suno.placeholder.extend.lyrics`)},null,8,[`modelValue`,`placeholder`])):(u(),n(x,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[1]||=t=>e.lyric=t,rows:5,type:`textarea`,class:`lyrics`,placeholder:e.$t(`suno.placeholder.lyrics`)},null,8,[`modelValue`,`placeholder`])),r(`div`,At,l(e.lyric?.length||0)+`/5000`,1)]),e.lyric&&e.config?.action!==`extend`?(u(),p(`div`,jt,[a(x,{modelValue:e.enhancePrompt,"onUpdate:modelValue":t[3]||=t=>e.enhancePrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.enhanceLyrics`),class:`enhance-input`,onKeyup:_(e.onEnhanceLyrics,[`enter`])},{append:m(()=>[a(y,{loading:e.enhancingLyrics,onClick:e.onEnhanceLyrics},{default:m(()=>[e.enhancingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.enhance_lyrics`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])])):o(``,!0),a(S,{modelValue:e.expanded,"onUpdate:modelValue":t[7]||=t=>e.expanded=t,title:e.$t(`suno.name.lyrics`),width:`720px`,top:`5vh`,"close-on-click-modal":!1,class:`lyrics-expand-dialog`},{footer:m(()=>[r(`div`,Nt,[r(`div`,Pt,[e.lyricHistory.length>0?(u(),n(y,{key:0,size:`small`,onClick:e.onUndo},{default:m(()=>[a(v,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.undo`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.lyric?(u(),n(y,{key:1,size:`small`,onClick:e.onClear},{default:m(()=>[a(v,{icon:`fa-solid fa-eraser`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.clear_lyrics`)),1)]),_:1},8,[`onClick`])):o(``,!0),e.config?.action===`extend`?o(``,!0):(u(),n(y,{key:2,size:`small`,loading:e.generatingLyrics,onClick:e.onGenerateLyrics},{default:m(()=>[e.generatingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))]),a(y,{type:`primary`,onClick:t[6]||=t=>e.expanded=!1},{default:m(()=>[i(l(e.$t(`common.button.confirm`)),1)]),_:1})])]),default:m(()=>[a(x,{modelValue:e.lyric,"onUpdate:modelValue":t[4]||=t=>e.lyric=t,type:`textarea`,rows:20,class:`lyrics-expanded`,placeholder:e.$t(`suno.placeholder.lyrics`),autofocus:``},null,8,[`modelValue`,`placeholder`]),e.config?.action===`extend`?o(``,!0):(u(),p(`div`,Mt,[a(x,{modelValue:e.enhancePrompt,"onUpdate:modelValue":t[5]||=t=>e.enhancePrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.enhanceLyrics`),class:`enhance-input`,onKeyup:_(e.onEnhanceLyrics,[`enter`])},{append:m(()=>[a(y,{loading:e.enhancingLyrics,onClick:e.onEnhanceLyrics},{default:m(()=>[e.enhancingLyrics?o(``,!0):(u(),n(v,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.enhance_lyrics`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])]))]),_:1},8,[`modelValue`,`title`])])}var It=W(Ct,[[`render`,Ft],[`__scopeId`,`data-v-d7d2ec74`]]),Lt=`Pop.Rock.Jazz.R&B.Hip Hop.Lo-fi.Electronic.Classical.Country.Blues.Folk.Reggae.Metal.Punk.Soul.Funk.Ambient.Indie.Latin.Acoustic.Dance.Disco.Gospel.K-Pop.J-Pop.C-Pop.Bossa Nova.Trap.Drill.House.Techno.Dubstep.Synthwave.Chill.Dreamy.Upbeat.Melancholic.Romantic.Epic.Cinematic.Orchestral.Piano.Guitar.Saxophone.Violin.Tribal.World Music.Afrobeat.Ska.Grunge`.split(`.`),Rt=12;function zt(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var Bt=s({name:`StyleInput`,components:{ElInput:G,ElButton:b,FontAwesomeIcon:Z,InfoIcon:Q},data(){return{optimizing:!1,shuffledTags:zt(Lt)}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style:e})}},credential(){return this.$store.state.suno?.credential},visibleTags(){return this.shuffledTags.slice(0,Rt)}},methods:{onTagClick(e){let t=this.style||``;t.toLowerCase().includes(e.toLowerCase())||(this.style=t?`${t}, ${e}`:e)},onRefreshTags(){this.shuffledTags=zt(Lt)},async onOptimizeStyle(){let e=this.credential?.token;if(!(!e||!this.style)){this.optimizing=!0,J.info(this.$t(`suno.message.optimizingStyle`));try{let t=await Y.style({prompt:this.style},{token:e}),n=t.data?.text||t.data?.data?.text;n&&(this.style=n,J.success(this.$t(`suno.message.optimizeStyleSuccess`)))}catch{J.error(this.$t(`suno.message.optimizeStyleFailed`))}finally{this.optimizing=!1}}}}}),Vt={class:`field`},Ht={class:`flex items-center justify-between mb-1`},Ut={class:`flex items-center`},Wt={class:`text-sm font-bold`},Gt={class:`relative`},Kt={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},qt={class:`style-tags`},Jt=[`onClick`];function Yt(e,t,s,d,h,g){let _=f(`info-icon`),y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-input`);return u(),p(`div`,Vt,[r(`div`,Ht,[r(`div`,Ut,[r(`span`,Wt,l(e.$t(`suno.name.style`)),1),a(_,{content:e.$t(`suno.description.style`)},null,8,[`content`])]),a(b,{size:`small`,loading:e.optimizing,round:``,onClick:e.onOptimizeStyle},{default:m(()=>[e.optimizing?o(``,!0):(u(),n(y,{key:0,icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`})),i(` `+l(e.$t(`suno.button.optimize_style`)),1)]),_:1},8,[`loading`,`onClick`])]),r(`div`,Gt,[a(x,{modelValue:e.style,"onUpdate:modelValue":t[0]||=t=>e.style=t,rows:2,type:`textarea`,placeholder:e.$t(`suno.placeholder.style`)},null,8,[`modelValue`,`placeholder`]),r(`div`,Kt,l(e.style?.length||0)+`/1000`,1)]),r(`div`,qt,[(u(!0),p(v,null,c(e.visibleTags,t=>(u(),p(`button`,{key:t,class:`style-tag`,onClick:n=>e.onTagClick(t)},l(t),9,Jt))),128)),r(`button`,{class:`style-tag style-tag-refresh`,onClick:t[1]||=(...t)=>e.onRefreshTags&&e.onRefreshTags(...t)},[a(y,{icon:`fa-solid fa-arrows-rotate`})])])])}var Xt=W(Bt,[[`render`,Yt],[`__scopeId`,`data-v-ddebb076`]]),Zt=s({name:`TitleInput`,components:{ElInput:G,InfoIcon:Q},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,title:e})}}}}),Qt={class:`field`},$t={class:`flex items-center mb-1`},en={class:`text-sm font-bold`};function tn(e,t,n,i,o,s){let c=f(`info-icon`),d=f(`el-input`);return u(),p(`div`,Qt,[r(`div`,$t,[r(`span`,en,l(e.$t(`suno.name.title`)),1),a(c,{content:e.$t(`suno.description.title`)},null,8,[`content`])]),a(d,{modelValue:e.title,"onUpdate:modelValue":t[0]||=t=>e.title=t,placeholder:e.$t(`suno.placeholder.title`)},null,8,[`modelValue`,`placeholder`])])}var nn=W(Zt,[[`render`,tn]]),rn=s({name:`ExtendFromInput`,components:{ElImage:P,ElIcon:w,ElInputNumber:H,VideoPlay:S,VideoPause:C},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:$,onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),an={class:`field`},on={class:`box`},sn={class:`title font-bold`},cn={class:`input-wrapper`},ln={class:`task`},un={class:`left`},dn={key:2,class:`duration`},fn={class:`info`},pn={class:`title`},mn={class:`style`};function hn(e,t,n,i,s,c){let d=f(`el-input-number`),_=f(`el-image`),v=f(`video-pause`),y=f(`el-icon`),b=f(`video-play`),x=h(`loading`);return u(),p(`div`,an,[r(`div`,on,[r(`h2`,sn,l(e.$t(`suno.name.extend`)),1),r(`div`,cn,[a(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||=t=>e.value=t,class:`value`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.extend.continue_at`),onChange:e.handleChange},null,8,[`modelValue`,`max`,`placeholder`,`onChange`])])]),r(`div`,ln,[e.audio?(u(),p(`div`,{key:0,class:`audio`,onClick:t[3]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,un,[a(_,{src:e.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:t[1]||=t=>e.onPause(e.audio)},[a(y,null,{default:m(()=>[a(v)]),_:1})])):o(``,!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:t[2]||=t=>e.onPlay(e.audio)},[a(y,null,{default:m(()=>[a(b)]),_:1})])):o(``,!0),e.audio?.duration?(u(),p(`div`,dn,l(e.useFormatDuring(e.audio?.duration)),1)):o(``,!0)])),[[x,!e.audio?.audio_url]]),r(`div`,fn,[r(`h2`,pn,l(e.audio?.title),1),r(`p`,mn,l(e.audio?.style),1)])])):o(``,!0)])])}var gn=W(rn,[[`render`,hn],[`__scopeId`,`data-v-bcce4821`]]),_n=s({name:`CoverFromInput`,components:{ElImage:P,ElIcon:w,VideoPlay:S,VideoPause:C},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:$,onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),vn={class:`field`},yn={class:`box`},bn={class:`title font-bold`},xn={class:`task`},Sn={class:`left`},Cn={key:2,class:`duration`},wn={class:`info`},Tn={class:`title`},En={class:`style`};function Dn(e,t,n,i,s,c){let d=f(`el-image`),_=f(`video-pause`),v=f(`el-icon`),y=f(`video-play`),b=h(`loading`);return u(),p(`div`,vn,[r(`div`,yn,[r(`h2`,bn,l(e.$t(`suno.name.cover`)),1)]),r(`div`,xn,[e.audio?(u(),p(`div`,{key:0,class:`audio`,onClick:t[2]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,Sn,[a(d,{src:e.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:t[0]||=t=>e.onPause(e.audio)},[a(v,null,{default:m(()=>[a(_)]),_:1})])):o(``,!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:t[1]||=t=>e.onPlay(e.audio)},[a(v,null,{default:m(()=>[a(y)]),_:1})])):o(``,!0),e.audio?.duration?(u(),p(`div`,Cn,l(e.useFormatDuring(e.audio?.duration)),1)):o(``,!0)])),[[b,!e.audio?.audio_url]]),r(`div`,wn,[r(`h2`,Tn,l(e.audio?.title),1),r(`p`,En,l(e.audio?.style),1)])])):o(``,!0)])])}var On=W(_n,[[`render`,Dn],[`__scopeId`,`data-v-06640216`]]),kn=s({name:`VocalGenderSelector`,components:{ElRadioGroup:R,ElRadioButton:L,InfoIcon:Q},computed:{vocalGender:{get(){return this.$store.state.suno?.config?.vocal_gender||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,vocal_gender:e||void 0})}}}}),An={class:`flex items-center mb-1`},jn={class:`text-sm font-bold`};function Mn(e,t,n,o,s,c){let d=f(`info-icon`),h=f(`el-radio-button`),g=f(`el-radio-group`);return u(),p(`div`,null,[r(`div`,An,[r(`span`,jn,l(e.$t(`suno.name.vocalGender`)),1),a(d,{content:e.$t(`suno.description.vocalGender`)},null,8,[`content`])]),a(g,{modelValue:e.vocalGender,"onUpdate:modelValue":t[0]||=t=>e.vocalGender=t,size:`small`},{default:m(()=>[a(h,{value:``},{default:m(()=>[i(l(e.$t(`suno.gender.auto`)),1)]),_:1}),a(h,{value:`f`},{default:m(()=>[i(l(e.$t(`suno.gender.female`)),1)]),_:1}),a(h,{value:`m`},{default:m(()=>[i(l(e.$t(`suno.gender.male`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var Nn=W(kn,[[`render`,Mn]]),Pn=s({name:`AdvancedParams`,components:{ElCollapse:ne,ElCollapseItem:te,ElInput:G,ElSlider:ce,ElRadioGroup:R,ElRadioButton:L},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.suno?.config},isV5OrAbove(){let e=this.config?.model||``;return[`chirp-v5`,`chirp-v5-5`].includes(e)},styleNegative:{get(){return this.$store.state.suno?.config?.style_negative||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style_negative:e||void 0})}},lyricPrompt:{get(){return this.$store.state.suno?.config?.lyric_prompt||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric_prompt:e||void 0})}},weirdness:{get(){return this.$store.state.suno?.config?.weirdness??0},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,weirdness:e||void 0})}},styleInfluence:{get(){return this.$store.state.suno?.config?.style_influence??.5},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style_influence:e})}},variationCategory:{get(){return this.$store.state.suno?.config?.variation_category||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,variation_category:e||void 0})}},audioWeight:{get(){return this.$store.state.suno?.config?.audio_weight??.5},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,audio_weight:e})}},lyricsMode:{get(){return this.$store.state.suno?.config?.lyrics_mode||`manual`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyrics_mode:e})}}},mounted(){let e=this.$store.state.suno?.config;if(!e)return;let t={};typeof e.weirdness==`number`&&e.weirdness>1&&(t.weirdness=e.weirdness/100),typeof e.style_influence==`number`&&e.style_influence>1&&(t.style_influence=e.style_influence/100),typeof e.audio_weight==`number`&&e.audio_weight>1&&(t.audio_weight=e.audio_weight/100),Object.keys(t).length>0&&this.$store.commit(`suno/setConfig`,{...e,...t})}}),Fn={key:0,class:`mb-3`},In={class:`flex items-center mb-1`},Ln={class:`text-xs font-bold`},Rn={key:1,class:`mb-3`},zn={class:`flex items-center mb-1`},Bn={class:`text-xs font-bold`},Vn={key:2,class:`mb-3`},Hn={class:`flex items-center justify-between mb-1`},Un={class:`text-xs font-bold`},Wn={class:`text-xs text-[var(--el-text-color-secondary)]`},Gn={key:3,class:`mb-3`},Kn={class:`flex items-center justify-between mb-1`},qn={class:`text-xs font-bold`},Jn={class:`text-xs text-[var(--el-text-color-secondary)]`},Yn={key:4,class:`mb-3`},Xn={class:`flex items-center mb-1`},Zn={class:`text-xs font-bold`},Qn={key:5,class:`mb-3`},$n={class:`flex items-center justify-between mb-1`},er={class:`text-xs font-bold`},tr={class:`text-xs text-[var(--el-text-color-secondary)]`},nr={key:6,class:`mb-3`},rr={class:`flex items-center mb-1`},ir={class:`text-xs font-bold`};function ar(e,t,s,c,d,h){let g=f(`el-input`),_=f(`el-slider`),v=f(`el-radio-button`),y=f(`el-radio-group`),b=f(`el-collapse-item`),x=f(`el-collapse`);return u(),n(x,{modelValue:e.activeNames,"onUpdate:modelValue":t[7]||=t=>e.activeNames=t,class:`advanced-collapse`},{default:m(()=>[a(b,{title:e.$t(`suno.name.advancedParams`),name:`advanced`},{default:m(()=>[e.config?.custom?(u(),p(`div`,Fn,[r(`div`,In,[r(`span`,Ln,l(e.$t(`suno.name.styleNegative`)),1)]),a(g,{modelValue:e.styleNegative,"onUpdate:modelValue":t[0]||=t=>e.styleNegative=t,size:`small`,placeholder:e.$t(`suno.placeholder.styleNegative`)},null,8,[`modelValue`,`placeholder`])])):o(``,!0),e.config?.custom&&!e.config?.instrumental?(u(),p(`div`,Rn,[r(`div`,zn,[r(`span`,Bn,l(e.$t(`suno.name.lyricPrompt`)),1)]),a(g,{modelValue:e.lyricPrompt,"onUpdate:modelValue":t[1]||=t=>e.lyricPrompt=t,size:`small`,placeholder:e.$t(`suno.placeholder.lyricPrompt`)},null,8,[`modelValue`,`placeholder`])])):o(``,!0),e.config?.custom?(u(),p(`div`,Vn,[r(`div`,Hn,[r(`span`,Un,l(e.$t(`suno.name.weirdness`)),1),r(`span`,Wn,l(e.weirdness??0),1)]),a(_,{modelValue:e.weirdness,"onUpdate:modelValue":t[2]||=t=>e.weirdness=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.config?.custom?(u(),p(`div`,Gn,[r(`div`,Kn,[r(`span`,qn,l(e.$t(`suno.name.styleInfluence`)),1),r(`span`,Jn,l(e.styleInfluence??.5),1)]),a(_,{modelValue:e.styleInfluence,"onUpdate:modelValue":t[3]||=t=>e.styleInfluence=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.isV5OrAbove?(u(),p(`div`,Yn,[r(`div`,Xn,[r(`span`,Zn,l(e.$t(`suno.name.variationCategory`)),1)]),a(y,{modelValue:e.variationCategory,"onUpdate:modelValue":t[4]||=t=>e.variationCategory=t,size:`small`},{default:m(()=>[a(v,{value:``},{default:m(()=>[i(l(e.$t(`suno.gender.auto`)),1)]),_:1}),a(v,{value:`high`},{default:m(()=>[i(l(e.$t(`suno.variation.high`)),1)]),_:1}),a(v,{value:`low`},{default:m(()=>[i(l(e.$t(`suno.variation.low`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),e.config?.action===`cover`?(u(),p(`div`,Qn,[r(`div`,$n,[r(`span`,er,l(e.$t(`suno.name.audioWeight`)),1),r(`span`,tr,l(e.audioWeight??.5),1)]),a(_,{modelValue:e.audioWeight,"onUpdate:modelValue":t[5]||=t=>e.audioWeight=t,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),e.config?.custom&&!e.config?.instrumental?(u(),p(`div`,nr,[r(`div`,rr,[r(`span`,ir,l(e.$t(`suno.name.lyricsMode`)),1)]),a(y,{modelValue:e.lyricsMode,"onUpdate:modelValue":t[6]||=t=>e.lyricsMode=t,size:`small`},{default:m(()=>[a(v,{value:`manual`},{default:m(()=>[i(l(e.$t(`suno.lyricsMode.manual`)),1)]),_:1}),a(v,{value:`auto`},{default:m(()=>[i(l(e.$t(`suno.lyricsMode.auto`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0)]),_:1},8,[`title`])]),_:1},8,[`modelValue`])}var or=W(Pn,[[`render`,ar],[`__scopeId`,`data-v-363599d3`]]),sr=s({name:`ReplaceSectionInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},replaceSectionStart:{get(){return this.$store.state.suno?.config?.replace_section_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,replace_section_start:e})}},replaceSectionEnd:{get(){return this.$store.state.suno?.config?.replace_section_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,replace_section_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),cr={class:`field`},lr={class:`flex items-center mb-2`},ur={class:`text-sm font-bold m-0`},dr={key:0,class:`task mb-2`},fr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},pr={class:`info flex-1 min-w-0`},mr={class:`text-sm font-bold m-0 truncate`},hr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},gr={class:`flex gap-2`};function _r(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,cr,[r(`div`,lr,[r(`h2`,ur,l(e.$t(`suno.name.replaceSection`)),1),a(d,{content:e.$t(`suno.description.replaceSection`)},null,8,[`content`])]),e.audio?(u(),p(`div`,dr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,fr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,pr,[r(`h2`,mr,l(e.audio?.title),1),r(`p`,hr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,gr,[a(_,{modelValue:e.replaceSectionStart,"onUpdate:modelValue":t[1]||=t=>e.replaceSectionStart=t,class:`flex-1`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.replaceSectionStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.replaceSectionEnd,"onUpdate:modelValue":t[2]||=t=>e.replaceSectionEnd=t,class:`flex-1`,min:e.replaceSectionStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.replaceSectionEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var vr=W(sr,[[`render`,_r]]),yr=s({name:`OverpaintingInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},overpaintingStart:{get(){return this.$store.state.suno?.config?.overpainting_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,overpainting_start:e})}},overpaintingEnd:{get(){return this.$store.state.suno?.config?.overpainting_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,overpainting_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),br={class:`field`},xr={class:`flex items-center mb-2`},Sr={class:`text-sm font-bold m-0`},Cr={key:0,class:`task mb-2`},wr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Tr={class:`info flex-1 min-w-0`},Er={class:`text-sm font-bold m-0 truncate`},Dr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Or={class:`flex gap-2`};function kr(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,br,[r(`div`,xr,[r(`h2`,Sr,l(e.$t(`suno.name.overpaintingRange`)),1),a(d,{content:e.$t(`suno.description.overpainting`)},null,8,[`content`])]),e.audio?(u(),p(`div`,Cr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,wr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,Tr,[r(`h2`,Er,l(e.audio?.title),1),r(`p`,Dr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,Or,[a(_,{modelValue:e.overpaintingStart,"onUpdate:modelValue":t[1]||=t=>e.overpaintingStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.overpaintingStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.overpaintingEnd,"onUpdate:modelValue":t[2]||=t=>e.overpaintingEnd=t,class:`flex-1`,size:`small`,min:e.overpaintingStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.overpaintingEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Ar=W(yr,[[`render`,kr]]),jr=s({name:`UnderpaintingInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},underpaintingStart:{get(){return this.$store.state.suno?.config?.underpainting_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,underpainting_start:e})}},underpaintingEnd:{get(){return this.$store.state.suno?.config?.underpainting_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,underpainting_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),Mr={class:`field`},Nr={class:`flex items-center mb-2`},Pr={class:`text-sm font-bold m-0`},Fr={key:0,class:`task mb-2`},Ir={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Lr={class:`info flex-1 min-w-0`},Rr={class:`text-sm font-bold m-0 truncate`},zr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Br={class:`flex gap-2`};function Vr(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,Mr,[r(`div`,Nr,[r(`h2`,Pr,l(e.$t(`suno.name.underpaintingRange`)),1),a(d,{content:e.$t(`suno.description.underpainting`)},null,8,[`content`])]),e.audio?(u(),p(`div`,Fr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,Ir,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,Lr,[r(`h2`,Rr,l(e.audio?.title),1),r(`p`,zr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,Br,[a(_,{modelValue:e.underpaintingStart,"onUpdate:modelValue":t[1]||=t=>e.underpaintingStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.underpaintingStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.underpaintingEnd,"onUpdate:modelValue":t[2]||=t=>e.underpaintingEnd=t,class:`flex-1`,size:`small`,min:e.underpaintingStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.underpaintingEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Hr=W(jr,[[`render`,Vr]]),Ur=s({name:`SamplesInput`,components:{ElInputNumber:H,ElImage:P,InfoIcon:Q},computed:{audio(){return this.$store.state.suno?.config?.audio},samplesStart:{get(){return this.$store.state.suno?.config?.samples_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,samples_start:e})}},samplesEnd:{get(){return this.$store.state.suno?.config?.samples_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,samples_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),Wr={class:`field`},Gr={class:`flex items-center mb-2`},Kr={class:`text-sm font-bold m-0`},qr={key:0,class:`task mb-2`},Jr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Yr={class:`info flex-1 min-w-0`},Xr={class:`text-sm font-bold m-0 truncate`},Zr={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Qr={class:`flex gap-2`};function $r(e,t,n,i,s,c){let d=f(`info-icon`),m=f(`el-image`),_=f(`el-input-number`),v=h(`loading`);return u(),p(`div`,Wr,[r(`div`,Gr,[r(`h2`,Kr,l(e.$t(`suno.name.samplesRange`)),1),a(d,{content:e.$t(`suno.description.samples`)},null,8,[`content`])]),e.audio?(u(),p(`div`,qr,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,Jr,[a(m,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!e.audio?.audio_url]]),r(`div`,Yr,[r(`h2`,Xr,l(e.audio?.title),1),r(`p`,Zr,l(e.audio?.style),1)])])])):o(``,!0),r(`div`,Qr,[a(_,{modelValue:e.samplesStart,"onUpdate:modelValue":t[1]||=t=>e.samplesStart=t,class:`flex-1`,size:`small`,min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.samplesStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(_,{modelValue:e.samplesEnd,"onUpdate:modelValue":t[2]||=t=>e.samplesEnd=t,class:`flex-1`,size:`small`,min:e.samplesStart||0,max:e.audio?.duration,controls:!1,placeholder:e.$t(`suno.placeholder.samplesEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var ei=W(Ur,[[`render`,$r]]),ti=[.5,.75,1,1.25,1.5,2],ni=s({name:`AdjustSpeedInput`,components:{ElRadioGroup:R,ElRadioButton:L,ElImage:P,InfoIcon:Q},data(){return{options:ti}},computed:{audio(){return this.$store.state.suno?.config?.audio},speed:{get(){let e=this.$store.state.suno?.config?.speed;return typeof e==`number`?e:1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,speed:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),ri={class:`field`},ii={class:`flex items-center mb-2`},ai={class:`text-sm font-bold m-0`},oi={key:0,class:`task mb-2`},si={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},ci={class:`info flex-1 min-w-0`},li={class:`text-sm font-bold m-0 truncate`},ui={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`};function di(e,t,s,d,_,y){let b=f(`info-icon`),x=f(`el-image`),S=f(`el-radio-button`),C=f(`el-radio-group`),w=h(`loading`);return u(),p(`div`,ri,[r(`div`,ii,[r(`h2`,ai,l(e.$t(`suno.name.adjustSpeed`)),1),a(b,{content:e.$t(`suno.description.adjustSpeed`)},null,8,[`content`])]),e.audio?(u(),p(`div`,oi,[r(`div`,{class:`audio flex items-center`,onClick:t[0]||=t=>e.onClick(e.audio)},[g((u(),p(`div`,si,[a(x,{src:e.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[w,!e.audio?.audio_url]]),r(`div`,ci,[r(`h2`,li,l(e.audio?.title),1),r(`p`,ui,l(e.audio?.style),1)])])])):o(``,!0),a(C,{modelValue:e.speed,"onUpdate:modelValue":t[1]||=t=>e.speed=t,size:`small`,class:`speed-group`},{default:m(()=>[(u(!0),p(v,null,c(e.options,e=>(u(),n(S,{key:e,value:e},{default:m(()=>[i(l(e)+`x`,1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])])}var fi=W(ni,[[`render`,di],[`__scopeId`,`data-v-ba834628`]]),pi=s({name:`VoiceCreateDialog`,components:{ElDialog:K,ElForm:j,ElFormItem:A,ElInput:G,ElButton:b,ElRadioGroup:R,ElRadio:ee},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{sourceType:`song`,form:{name:``,description:``,audio_id:``,audio_url:``},loading:!1}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},token(){return this.$store.state.suno?.credential?.token},canSubmit(){return!(!this.form.name||this.sourceType===`song`&&!this.form.audio_id||this.sourceType===`upload`&&!this.form.audio_url)}},methods:{onClose(){this.visible=!1,this.resetForm()},resetForm(){this.form={name:``,description:``,audio_id:``,audio_url:``},this.sourceType=`song`},async onSubmit(){if(this.token){this.loading=!0;try{this.sourceType===`song`?await Y.persona({audio_id:this.form.audio_id,name:this.form.name,description:this.form.description},{token:this.token}):await Y.voices({audio_url:this.form.audio_url,name:this.form.name,description:this.form.description},{token:this.token}),J.success(this.$t(`suno.voice.createSuccess`)),this.$emit(`created`),this.onClose()}catch{J.error(this.$t(`suno.voice.createFailed`))}finally{this.loading=!1}}}}});function mi(e,t,r,s,c,d){let p=f(`el-input`),h=f(`el-form-item`),g=f(`el-radio`),_=f(`el-radio-group`),v=f(`el-form`),y=f(`el-button`),b=f(`el-dialog`);return u(),n(b,{modelValue:e.visible,"onUpdate:modelValue":t[5]||=t=>e.visible=t,title:e.$t(`suno.voice.createTitle`),width:`480px`,"close-on-click-modal":!1,onClose:e.onClose},{footer:m(()=>[a(y,{onClick:e.onClose},{default:m(()=>[i(l(e.$t(`common.button.cancel`)),1)]),_:1},8,[`onClick`]),a(y,{type:`primary`,loading:e.loading,disabled:!e.canSubmit,onClick:e.onSubmit},{default:m(()=>[i(l(e.$t(`suno.voice.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:m(()=>[a(v,{"label-position":`top`,class:`voice-create-form`},{default:m(()=>[a(h,{label:e.$t(`suno.voice.name`)},{default:m(()=>[a(p,{modelValue:e.form.name,"onUpdate:modelValue":t[0]||=t=>e.form.name=t,placeholder:e.$t(`suno.voice.namePlaceholder`),maxlength:`50`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a(h,{label:e.$t(`suno.voice.description`)},{default:m(()=>[a(p,{modelValue:e.form.description,"onUpdate:modelValue":t[1]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`suno.voice.descriptionPlaceholder`),maxlength:`200`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a(h,{label:e.$t(`suno.voice.sourceType`)},{default:m(()=>[a(_,{modelValue:e.sourceType,"onUpdate:modelValue":t[2]||=t=>e.sourceType=t,class:`w-full`},{default:m(()=>[a(g,{value:`song`},{default:m(()=>[i(l(e.$t(`suno.voice.fromSong`)),1)]),_:1}),a(g,{value:`upload`},{default:m(()=>[i(l(e.$t(`suno.voice.fromUpload`)),1)]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),e.sourceType===`song`?(u(),n(h,{key:0,label:e.$t(`suno.voice.audioId`)},{default:m(()=>[a(p,{modelValue:e.form.audio_id,"onUpdate:modelValue":t[3]||=t=>e.form.audio_id=t,placeholder:e.$t(`suno.voice.audioIdPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):o(``,!0),e.sourceType===`upload`?(u(),n(h,{key:1,label:e.$t(`suno.voice.audioUrl`)},{default:m(()=>[a(p,{modelValue:e.form.audio_url,"onUpdate:modelValue":t[4]||=t=>e.form.audio_url=t,placeholder:e.$t(`suno.voice.audioUrlPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):o(``,!0)]),_:1})]),_:1},8,[`modelValue`,`title`,`onClose`])}var hi=s({name:`VoiceManager`,components:{ElButton:b,ElIcon:w,ElTabs:O,ElTabPane:k,ElTooltip:N,Loading:x,FontAwesomeIcon:Z,VoiceCreateDialog:W(pi,[[`render`,mi]])},data(){return{showCreateDialog:!1,loading:!1,deletingId:null,activeTab:`all`}},computed:{personas(){return this.$store.state.suno?.personas||[]},favoriteIds(){return this.$store.state.suno?.favoritePersonaIds||[]},favoritePersonas(){return this.personas.filter(e=>e.persona_id&&this.favoriteIds.includes(e.persona_id))},visiblePersonas(){return this.activeTab===`favorites`?this.favoritePersonas:this.personas},selectedPersonaId(){return this.$store.state.suno?.config?.persona_id}},watch:{"$store.state.suno.credential":{handler(){this.loadPersonas()},immediate:!0}},methods:{isFavorite(e){return!!e&&this.favoriteIds.includes(e)},onToggleFavorite(e){e.persona_id&&this.$store.commit(`suno/togglePersonaFavorite`,e.persona_id)},async loadPersonas(){if(this.$store.state.suno?.credential?.token){this.loading=!0;try{await this.$store.dispatch(`suno/getPersonas`)}finally{this.loading=!1}}},selectPersona(e){let t={...this.$store.state.suno?.config};t.persona_id===e.persona_id?t.persona_id=void 0:t.persona_id=e.persona_id,this.$store.dispatch(`suno/setConfig`,t)},async onDelete(e){try{await q.confirm(this.$t(`suno.voice.confirmDelete`),this.$t(`suno.voice.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.confirm`),cancelButtonText:this.$t(`common.button.cancel`)})}catch{return}if(!e.persona_id)return;this.deletingId=e.persona_id;let t=await this.$store.dispatch(`suno/deletePersona`,e.persona_id);if(this.deletingId=null,t){if(J.success(this.$t(`suno.voice.deleteSuccess`)),this.selectedPersonaId===e.persona_id){let e={...this.$store.state.suno?.config,persona_id:void 0};this.$store.dispatch(`suno/setConfig`,e)}this.favoriteIds.includes(e.persona_id)&&this.$store.commit(`suno/togglePersonaFavorite`,e.persona_id)}else J.error(this.$t(`suno.voice.deleteFailed`))},async onCreated(){await this.loadPersonas()}}}),gi={class:`voice-manager`},_i={class:`flex items-center justify-between mb-3`},vi={class:`text-sm font-medium`},yi={key:0,class:`text-center py-6`},bi={key:1,class:`text-center py-6 text-gray-400 text-sm`},xi={key:2,class:`voice-list`},Si=[`onClick`],Ci={class:`flex-1 min-w-0`},wi={class:`voice-name`},Ti={key:0,class:`voice-desc`};function Ei(e,n,s,d,h,g){let _=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-tab-pane`),S=f(`el-tabs`),C=f(`loading`),w=f(`el-icon`),T=f(`el-tooltip`),E=f(`voice-create-dialog`);return u(),p(`div`,gi,[r(`div`,_i,[r(`span`,vi,l(e.$t(`suno.voice.title`)),1),a(b,{type:`primary`,size:`small`,onClick:n[0]||=t=>e.showCreateDialog=!0},{default:m(()=>[a(_,{icon:`fa-solid fa-plus`,class:`mr-1`}),i(` `+l(e.$t(`suno.voice.create`)),1)]),_:1})]),a(S,{modelValue:e.activeTab,"onUpdate:modelValue":n[1]||=t=>e.activeTab=t,class:`voice-tabs`,size:`small`},{default:m(()=>[a(x,{name:`all`,label:e.$t(`suno.voice.tabAll`)+` (`+(e.personas?.length||0)+`)`},null,8,[`label`]),a(x,{name:`favorites`,label:e.$t(`suno.voice.tabFavorites`)+` (`+e.favoritePersonas.length+`)`},null,8,[`label`])]),_:1},8,[`modelValue`]),e.loading?(u(),p(`div`,yi,[a(w,{class:`is-loading`},{default:m(()=>[a(C)]),_:1})])):e.visiblePersonas.length===0?(u(),p(`div`,bi,l(e.activeTab===`favorites`?e.$t(`suno.voice.emptyFavorites`):e.$t(`suno.voice.empty`)),1)):(u(),p(`div`,xi,[(u(!0),p(v,null,c(e.visiblePersonas,s=>(u(),p(`div`,{key:s.persona_id,class:t([`voice-item`,{active:e.selectedPersonaId===s.persona_id}]),onClick:t=>e.selectPersona(s)},[r(`div`,Ci,[r(`div`,wi,[a(_,{icon:s.source_type===`voice`?`fa-solid fa-microphone`:`fa-solid fa-music`,class:`mr-1.5 text-xs opacity-60`},null,8,[`icon`]),i(` `+l(s.name||s.persona_id),1)]),s.description?(u(),p(`div`,Ti,l(s.description),1)):o(``,!0)]),r(`div`,{class:`voice-actions`,onClick:n[2]||=y(()=>{},[`stop`])},[a(T,{content:e.isFavorite(s.persona_id)?e.$t(`suno.voice.unfavorite`):e.$t(`suno.voice.favorite`),placement:`top`},{default:m(()=>[a(b,{size:`small`,text:``,class:t({"voice-fav-active":e.isFavorite(s.persona_id)}),onClick:t=>e.onToggleFavorite(s)},{default:m(()=>[a(_,{icon:e.isFavorite(s.persona_id)?`fa-solid fa-star`:`fa-regular fa-star`},null,8,[`icon`])]),_:2},1032,[`class`,`onClick`])]),_:2},1032,[`content`]),a(b,{type:`danger`,size:`small`,text:``,loading:e.deletingId===s.persona_id,onClick:t=>e.onDelete(s)},{default:m(()=>[a(_,{icon:`fa-solid fa-trash`})]),_:1},8,[`loading`,`onClick`])])],10,Si))),128))])),a(E,{modelValue:e.showCreateDialog,"onUpdate:modelValue":n[3]||=t=>e.showCreateDialog=t,onCreated:e.onCreated},null,8,[`modelValue`,`onCreated`])])}var Di=s({name:`PersonaInput`,components:{ElSelect:E,ElOption:D,ElButton:b,ElDrawer:z,FontAwesomeIcon:Z,InfoIcon:Q,VoiceManager:W(hi,[[`render`,Ei],[`__scopeId`,`data-v-8b8e36d9`]])},data(){return{showManager:!1}},computed:{personaId:{get(){return this.$store.state.suno?.config?.persona_id||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,persona_id:e||void 0})}},personas(){return this.$store.state.suno?.personas||[]}}}),Oi={class:`field`},ki={class:`flex items-center justify-between mb-2`},Ai={class:`flex items-center`},ji={class:`text-sm font-bold`},Mi={class:`flex items-center justify-between w-full`},Ni={key:0,class:`text-xs text-gray-400 ml-2`};function Pi(e,t,s,d,h,g){let _=f(`info-icon`),y=f(`font-awesome-icon`),b=f(`el-button`),x=f(`el-option`),S=f(`el-select`),C=f(`voice-manager`),w=f(`el-drawer`);return u(),p(`div`,Oi,[r(`div`,ki,[r(`div`,Ai,[r(`span`,ji,l(e.$t(`suno.name.persona`)),1),a(_,{content:e.$t(`suno.description.persona`)},null,8,[`content`])]),a(b,{size:`small`,round:``,onClick:t[0]||=t=>e.showManager=!0},{default:m(()=>[a(y,{icon:`fa-solid fa-microphone`,class:`mr-1`}),i(` `+l(e.$t(`suno.voice.manage`)),1)]),_:1})]),a(S,{modelValue:e.personaId,"onUpdate:modelValue":t[1]||=t=>e.personaId=t,placeholder:e.$t(`suno.placeholder.personaId`),clearable:``,filterable:``,class:`w-full`},{default:m(()=>[(u(!0),p(v,null,c(e.personas,e=>(u(),n(x,{key:e.persona_id||``,value:e.persona_id||``,label:e.name||e.persona_id||``},{default:m(()=>[r(`div`,Mi,[r(`span`,null,l(e.name||e.persona_id),1),e.source_type?(u(),p(`span`,Ni,l(e.source_type),1)):o(``,!0)])]),_:2},1032,[`value`,`label`]))),128))]),_:1},8,[`modelValue`,`placeholder`]),a(w,{modelValue:e.showManager,"onUpdate:modelValue":t[2]||=t=>e.showManager=t,title:e.$t(`suno.voice.title`),size:`380px`,direction:`rtl`},{default:m(()=>[a(C)]),_:1},8,[`modelValue`,`title`])])}var Fi=s({name:`PresetPanel`,components:{TypeSelector:Ge,PromptInput:St,LyricInput:It,StyleInput:Xt,TitleInput:nn,ExtendFromInput:gn,CoverFromInput:On,UploadAudio:mt,VocalGenderSelector:Nn,AdvancedParams:or,ReplaceSectionInput:vr,OverpaintingInput:Ar,UnderpaintingInput:Hr,SamplesInput:ei,AdjustSpeedInput:fi,PersonaInput:W(Di,[[`render`,Pi]]),FontAwesomeIcon:Z,ElButton:b,ElTabs:O,ElTabPane:k,Consumption:we},emits:[`generate`],computed:{config(){return this.$store.state.suno?.config},mode:{get(){return this.$store.state.suno?.config?.custom?`custom`:`simple`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,custom:e===`custom`})}},consumption(){return me(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service},supportsVocalGender(){let e=this.config?.model||``;return[`chirp-v4-5-plus`,`chirp-v5`,`chirp-v5-5`].includes(e)},supportsPersona(){let e=this.config?.action;return!e||e===`generate`||e===`artist_consistency`||e===`artist_consistency_vox`},generateButtonText(){let e=this.config?.action;return e===`extend`?this.$t(`suno.button.extend`):e===`cover`?this.$t(`suno.button.cover_music`):e===`remaster`?this.$t(`suno.button.remaster`):e===`replace_section`?this.$t(`suno.button.replace_section`):e===`mashup`?this.$t(`suno.button.mashup`):e===`stems`?this.$t(`suno.button.get_stems`):e===`concat`?this.$t(`suno.button.concat_music`):e===`upload_cover`?this.$t(`suno.button.upload_cover`):e===`artist_consistency`?this.$t(`suno.button.artist_consistency`):e===`artist_consistency_vox`?this.$t(`suno.button.artist_consistency_vox`):e===`overpainting`?this.$t(`suno.button.overpainting`):e===`underpainting`?this.$t(`suno.button.underpainting`):e===`samples`?this.$t(`suno.button.samples`):e===`adjust_speed`?this.$t(`suno.button.adjust_speed`):this.$t(`suno.button.generate`)}},methods:{onGenerate(){this.$emit(`generate`)},onClearAll(){this.$store.commit(`suno/setConfig`,{custom:!1,sounds:!1,instrumental:!1,lyric:``,style:``,title:``,lyrics_mode:`manual`,model:this.$store.state.suno?.config?.model})}}}),Ii={class:`flex flex-col h-full`},Li={class:`flex-1 overflow-y-auto p-5`},Ri={class:`pt-2 px-1`},zi={class:`pt-2 px-1`},Bi={class:`flex flex-col items-center justify-center px-5 pb-5 gap-2`},Vi={class:`flex gap-2 w-full`};function Hi(e,t,s,c,d,h){let g=f(`type-selector`),_=f(`upload-audio`),v=f(`prompt-input`),y=f(`extend-from-input`),b=f(`cover-from-input`),x=f(`replace-section-input`),S=f(`overpainting-input`),C=f(`underpainting-input`),w=f(`samples-input`),T=f(`adjust-speed-input`),E=f(`advanced-params`),D=f(`el-tab-pane`),O=f(`lyric-input`),k=f(`style-input`),A=f(`title-input`),j=f(`vocal-gender-selector`),M=f(`persona-input`),N=f(`el-tabs`),P=f(`consumption`),F=f(`font-awesome-icon`),I=f(`el-button`);return u(),p(`div`,Ii,[r(`div`,Li,[a(N,{modelValue:e.mode,"onUpdate:modelValue":t[0]||=t=>e.mode=t,class:`suno-mode-tabs`,stretch:``},{default:m(()=>[a(D,{label:e.$t(`suno.mode.simple`),name:`simple`},{default:m(()=>[r(`div`,Ri,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),e.config?.action===`extend`?(u(),n(y,{key:0,class:`mb-4`})):o(``,!0),e.config?.action===`cover`?(u(),n(b,{key:1,class:`mb-4`})):o(``,!0),e.config?.action===`replace_section`?(u(),n(x,{key:2,class:`mb-4`})):o(``,!0),e.config?.action===`overpainting`?(u(),n(S,{key:3,class:`mb-4`})):o(``,!0),e.config?.action===`underpainting`?(u(),n(C,{key:4,class:`mb-4`})):o(``,!0),e.config?.action===`samples`?(u(),n(w,{key:5,class:`mb-4`})):o(``,!0),e.config?.action===`adjust_speed`?(u(),n(T,{key:6,class:`mb-4`})):o(``,!0),a(E,{class:`mb-4`})])]),_:1},8,[`label`]),a(D,{label:e.$t(`suno.mode.custom`),name:`custom`},{default:m(()=>[r(`div`,zi,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),e.config?.instrumental?o(``,!0):(u(),n(O,{key:0,class:`mb-4`})),a(k,{class:`mb-4`}),a(A,{class:`mb-4`}),!e.config?.instrumental&&e.supportsVocalGender?(u(),n(j,{key:1,class:`mb-4`})):o(``,!0),e.supportsPersona?(u(),n(M,{key:2,class:`mb-4`})):o(``,!0),e.config?.action===`extend`?(u(),n(y,{key:3,class:`mb-4`})):o(``,!0),e.config?.action===`cover`?(u(),n(b,{key:4,class:`mb-4`})):o(``,!0),e.config?.action===`replace_section`?(u(),n(x,{key:5,class:`mb-4`})):o(``,!0),e.config?.action===`overpainting`?(u(),n(S,{key:6,class:`mb-4`})):o(``,!0),e.config?.action===`underpainting`?(u(),n(C,{key:7,class:`mb-4`})):o(``,!0),e.config?.action===`samples`?(u(),n(w,{key:8,class:`mb-4`})):o(``,!0),e.config?.action===`adjust_speed`?(u(),n(T,{key:9,class:`mb-4`})):o(``,!0),a(E,{class:`mb-4`})])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),r(`div`,Bi,[a(P,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),r(`div`,Vi,[a(I,{class:`flex-1`,onClick:e.onClearAll},{default:m(()=>[a(F,{icon:`fa-solid fa-broom`,class:`mr-1`}),i(` `+l(e.$t(`suno.button.clear_all`)),1)]),_:1},8,[`onClick`]),a(I,{type:`primary`,class:`flex-1`,round:``,onClick:e.onGenerate},{default:m(()=>[a(F,{icon:`fa-solid fa-magic`,class:`mr-2`}),i(` `+l(e.generateButtonText),1)]),_:1},8,[`onClick`])])])])}var Ui=W(Fi,[[`render`,Hi],[`__scopeId`,`data-v-c62324e6`]]),Wi=Te(),Gi=U(`suno`),Ki=s({name:`TaskPreview`,components:{ElImage:P,ElIcon:w,ElTooltip:N,FontAwesomeIcon:Z,VideoPlay:S,VideoPause:C,ElDropdown:V,ElDropdownMenu:re,ElDropdownItem:B,ElInput:G,ElProgress:ae,ElCheckbox:I,Loading:x,ApiCodeDialog:be},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,isFetchingMidi:!1,editingAudioId:null,editingTitle:``,apiCodeVisible:!1,apiCodePath:`/suno/audios`,apiCodeBody:{}}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===X.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(e=>({...e,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active},isMashupMode(){return this.$store.state.suno?.config?.action===`mashup`},mashupAudioIds(){return this.$store.state.suno?.config?.mashup_audio_ids||[]}},methods:{useFormatDuring:$,onViewCode(){let e=this.modelValue?.request||{},t={};Object.entries(e).forEach(([e,n])=>{e===`application_id`||e===`callback_url`||n!=null&&(typeof n==`string`&&n===``||Array.isArray(n)&&n.length===0||(t[e]=n))}),this.apiCodeBody=t,this.apiCodePath=`/suno/audios`,this.apiCodeVisible=!0},onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e?.stopPropagation(),console.log(`on extend`),console.debug(`set config`,t),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:`extend`,audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e?.stopPropagation(),console.log(`on download`,t);let n=new URL(t).pathname,r=n.substring(n.lastIndexOf(`/`)+1);console.log(`on preview`,r),fetch(t).then(e=>e.blob()).then(e=>{(0,Wi.saveAs)(e,r)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;let t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(e){console.error(`get videoUrl failed:`,e),J.error(this.$t(`suno.message.getVideoUrlFailed`))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,n)=>{let r={audio_id:e},i=this.credential?.token;if(!i){console.error(`no token specified`),n(Error(`No token specified`));return}Y.mp4(r,{token:i}).then(e=>{let r=e.data?.data?.video_url;r?t(r):n(Error(`Video URL not found in response`))}).catch(e=>{n(e)})})},onPreview(e,t){e?.stopPropagation(),console.log(`on preview`,t),window.open(t,`_blank`)},async onGetStems(e){await this.onGenerateAudioUrl(`stems`,e)},onCover(e){console.log(`on cover`),console.debug(`set config`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`cover`,audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl(`concat`,e)},async onRemaster(e){await this.onGenerateAudioUrl(`remaster`,e)},async onGetAllStems(e){await this.onGenerateAudioUrl(`all_stems`,e)},onReplaceSection(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`replace_section`,audio:e,audio_id:e.id,replace_section_start:0,replace_section_end:Math.min(30,e.duration||30)})},onMashup(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`mashup`,audio:e,audio_id:e.id,mashup_audio_ids:[e.id]})},onOverpainting(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`overpainting`,audio:e,audio_id:e.id,overpainting_start:0,overpainting_end:Math.min(30,e.duration||30)})},onUnderpainting(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`underpainting`,audio:e,audio_id:e.id,underpainting_start:0,underpainting_end:Math.min(30,e.duration||30)})},onSamples(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`samples`,audio:e,audio_id:e.id,samples_start:0,samples_end:Math.min(30,e.duration||30)})},onArtistConsistency(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`artist_consistency`,audio:e,audio_id:e.id})},onAdjustSpeed(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`adjust_speed`,audio:e,audio_id:e.id,speed:1})},onReusePrompt(e){let t=this.modelValue?.request??{};if(!(t.prompt||t.lyric||t.style||t.title||t.lyric_prompt||t.style_negative||t.persona_id)){J.warning(this.$t(`suno.message.reusePromptEmpty`));return}this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:t.model??e.model,custom:t.custom??!1,instrumental:t.instrumental??!1,prompt:t.prompt??``,lyric:t.lyric??``,lyric_prompt:t.lyric_prompt??``,lyrics_mode:t.lyrics_mode??`manual`,title:t.title??``,style:t.style??``,style_negative:t.style_negative??``,vocal_gender:t.vocal_gender,weirdness:t.weirdness,style_influence:t.style_influence,variation_category:t.variation_category,audio_weight:t.audio_weight,persona_id:t.persona_id,action:void 0,audio:void 0,audio_id:void 0,mashup_audio_ids:void 0,continue_at:void 0,speed:void 0,replace_section_start:void 0,replace_section_end:void 0,overpainting_start:void 0,overpainting_end:void 0,underpainting_start:void 0,underpainting_end:void 0,samples_start:void 0,samples_end:void 0}),J.success(this.$t(`suno.message.reusePromptSuccess`))},async onExtractVocals(e){let t=this.credential?.token;t&&(J.info(this.$t(`suno.message.extractingVocals`)),Y.vox({audio_id:e,callback_url:Gi},{token:t}).then(()=>{J.success(this.$t(`suno.message.extractVocalsSuccess`))}).catch(e=>{J.error(e?.response?.data?.error?.message||this.$t(`suno.message.extractVocalsFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()}))},async onGetTiming(e){let t=this.credential?.token;t&&(J.info(this.$t(`suno.message.fetchingTiming`)),Y.timing({audio_id:e},{token:t}).then(e=>{J.success(this.$t(`suno.message.fetchTimingSuccess`)),console.debug(`timing data`,e.data)}).catch(e=>{J.error(e?.response?.data?.error?.message||this.$t(`suno.message.fetchTimingFailed`))}))},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;let t=this.credential?.token;if(t)try{this.isFetchingWav=!0,J.info(this.$t(`suno.message.fetchingWav`));let n=(await Y.wav({audio_id:e.id},{token:t})).data?.data?.[0]?.file_url;n?this.onDownload(null,n):J.error(this.$t(`suno.message.fetchWavFailed`))}catch(e){let t=e?.response?.data?.error?.message;J.error(t||this.$t(`suno.message.fetchWavFailed`))}finally{this.isFetchingWav=!1}},async handleMidiDownload(e){if(!e?.id||this.isFetchingMidi)return;let t=this.credential?.token;if(t)try{this.isFetchingMidi=!0,J.info(this.$t(`suno.message.fetchingMidi`));let n=(await Y.midi({audio_id:e.id},{token:t})).data?.data;if(!n?.length){J.error(this.$t(`suno.message.fetchMidiFailed`));return}let r=(e.title||e.id||`suno`).replace(/[^\w.-]+/g,`_`)+`.json`;(0,Wi.saveAs)(new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),r)}catch(e){let t=e?.response?.data?.error?.message;J.error(t||this.$t(`suno.message.fetchMidiFailed`))}finally{this.isFetchingMidi=!1}},async onGenerateAudioUrl(e,t){let n={action:e,audio_id:t,callback_url:Gi},r=this.credential?.token;if(!r){console.error(`no token specified`);return}J.info(this.$t(`suno.message.startingTask`)),Y.audio(n,{token:r}).then(()=>{J.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{J.error(e?.response?.data?.error?.message||this.$t(`suno.message.startTaskFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},isMashupSelected(e){return!!e.id&&this.mashupAudioIds.includes(e.id)},onToggleMashup(e){if(!e.id)return;let t=[...this.mashupAudioIds],n=t.indexOf(e.id);n===-1?t.push(e.id):t.splice(n,1),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,mashup_audio_ids:t})},async onScrollDown(){setTimeout(()=>{let e=document.querySelector(`.tasks`);e&&(e.scrollTop=e.scrollHeight)},1e3)},onStartTitleEdit(e){this.editingAudioId=e.id??null,this.editingTitle=e.title||``,this.$nextTick(()=>{this.$refs.titleInput?.focus?.()})},onSaveTitleEdit(e){if(this.editingAudioId!==e.id)return;let t=this.editingTitle.trim();if(t&&t!==e.title){let n=this.$store.state.suno?.tasks;if(n?.items)for(let r of n.items){let n=(r?.response?.data??[]).find(t=>t.id===e.id);if(n){n.title=t;break}}}this.editingAudioId=null,this.editingTitle=``},onCancelTitleEdit(){this.editingAudioId=null,this.editingTitle=``},async onDelete(e){try{await q.confirm(this.$t(`suno.message.confirmDelete`),{confirmButtonText:this.$t(`suno.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`})}catch{return}let t=this.$store.state.suno?.tasks;if(t?.items)for(let n of t.items){let r=n?.response?.data??[],i=r.findIndex(t=>t.id===e.id);if(i!==-1){if(r.splice(i,1),r.length===0){let e=t.items.indexOf(n);e!==-1&&t.items.splice(e,1)}break}}this.$store.state?.suno?.audio?.id===e.id&&this.$store.dispatch(`suno/setAudio`,null),J.success(this.$t(`suno.message.deleteSuccess`))},async onGetTasks(){if(this.loading){console.debug(`loading`);return}await this.$store.dispatch(`suno/getTasks`,{limit:30,offset:0})}}}),qi={class:`task`},Ji=[`onClick`],Yi=[`onClick`],Xi={class:`left`},Zi=[`onClick`],Qi=[`onClick`],$i={key:2,class:`duration`},ea={class:`info`},ta={key:1,class:`title-row`},na={class:`title`},ra={class:`style`},ia={key:2,class:`progress-row`},aa={class:`progress-text`},oa={class:`right`},sa={class:`el-dropdown-link`},ca={class:`flex items-center min-w-[120px]`},la={class:`flex items-center min-w-[120px]`},ua={class:`flex items-center min-w-[120px]`},da={class:`el-dropdown-link`};function fa(e,s,d,b,x,S){let C=f(`el-checkbox`),w=f(`el-image`),T=f(`video-pause`),E=f(`el-icon`),D=f(`video-play`),O=f(`el-input`),k=f(`font-awesome-icon`),A=f(`el-progress`),j=f(`el-tooltip`),M=f(`Loading`),N=f(`el-dropdown-item`),P=f(`el-dropdown-menu`),F=f(`el-dropdown`),I=f(`api-code-dialog`),L=h(`loading`);return u(),p(`div`,qi,[(u(!0),p(v,null,c(e.audios,c=>(u(),p(`div`,{key:c.id,class:t([`audio`,{"mashup-selected":e.isMashupSelected(c)}]),onClick:y(t=>e.onClick(c),[`stop`])},[e.isMashupMode&&c?.audio_url?(u(),p(`div`,{key:0,class:`mashup-check`,onClick:y(t=>e.onToggleMashup(c),[`stop`])},[a(C,{"model-value":e.isMashupSelected(c),onClick:s[0]||=y(()=>{},[`stop`])},null,8,[`model-value`])],8,Yi)):o(``,!0),g((u(),p(`div`,Xi,[a(w,{src:c?.image_url,class:`cover`,fit:`cover`,lazy:``},null,8,[`src`]),c?.audio_url&&e.$store.state?.suno?.audio?.id===c.id&&e.$store.state?.suno?.audio?.state===`playing`?(u(),p(`div`,{key:0,class:`overlay`,onClick:y(t=>e.onPause(c),[`stop`])},[a(E,null,{default:m(()=>[a(T)]),_:1})],8,Zi)):o(``,!0),c?.audio_url&&(e.$store.state?.suno?.audio?.id!==c.id||e.$store.state?.suno?.audio?.id===c.id&&e.$store.state?.suno?.audio?.state===`paused`)?(u(),p(`div`,{key:1,class:`overlay`,onClick:y(t=>e.onPlay(c),[`stop`])},[a(E,null,{default:m(()=>[a(D)]),_:1})],8,Qi)):o(``,!0),c?.duration?(u(),p(`div`,$i,l(e.useFormatDuring(c?.duration)),1)):o(``,!0)])),[[L,!c?.audio_url]]),r(`div`,ea,[e.editingAudioId===c.id?(u(),p(`div`,{key:0,class:`title-edit`,onClick:s[2]||=y(()=>{},[`stop`])},[a(O,{ref_for:!0,ref:`titleInput`,modelValue:e.editingTitle,"onUpdate:modelValue":s[1]||=t=>e.editingTitle=t,size:`small`,onKeyup:[_(t=>e.onSaveTitleEdit(c),[`enter`]),_(e.onCancelTitleEdit,[`escape`])],onBlur:t=>e.onSaveTitleEdit(c)},null,8,[`modelValue`,`onKeyup`,`onBlur`])])):(u(),p(`div`,ta,[r(`h2`,na,l(c?.title),1),c?.audio_url?(u(),n(k,{key:0,icon:`fa-solid fa-pen`,class:`edit-icon`,onClick:y(t=>e.onStartTitleEdit(c),[`stop`])},null,8,[`onClick`])):o(``,!0)])),r(`p`,ra,l(c?.style),1),!c?.audio_url&&c?.progress!=null&&c?.progress<100?(u(),p(`div`,ia,[a(A,{percentage:Math.round(c.progress),"stroke-width":4,"show-text":!1,status:`warning`,class:`progress-bar`},null,8,[`percentage`]),r(`span`,aa,l(e.$t(`suno.name.generating`))+` `+l(Math.round(c.progress))+`%`,1)])):o(``,!0)]),r(`div`,oa,[a(F,null,{dropdown:m(()=>[a(P,null,{default:m(()=>[a(N,{disabled:e.isFetchingVideoUrl,onClick:t=>e.handleVideoDownload(c)},{default:m(()=>[r(`div`,ca,[e.isFetchingVideoUrl?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_video`)),1)])]),_:1},8,[`disabled`,`onClick`]),c?.audio_url?(u(),n(N,{key:0,onClick:y(t=>e.onDownload(t,c?.audio_url),[`stop`])},{default:m(()=>[i(l(e.$t(`suno.button.download_audio`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{disabled:e.isFetchingWav,onClick:t=>e.handleWavDownload(c)},{default:m(()=>[r(`div`,la,[e.isFetchingWav?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_wav`)),1)])]),_:1},8,[`disabled`,`onClick`]),a(N,{disabled:e.isFetchingMidi,onClick:t=>e.handleMidiDownload(c)},{default:m(()=>[r(`div`,ua,[e.isFetchingMidi?(u(),n(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(M)]),_:1})):o(``,!0),r(`span`,null,l(e.$t(`suno.button.download_midi`)),1)])]),_:1},8,[`disabled`,`onClick`])]),_:2},1024)]),default:m(()=>[r(`span`,sa,[a(j,{effect:`dark`,content:e.$t(`suno.button.download`),placement:`top`},{default:m(()=>[c?.audio_url||c?.video_url?(u(),n(k,{key:0,icon:`fa-solid fa-download`,class:`icon icon-download`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024),a(F,null,{dropdown:m(()=>[a(P,{class:`suno-action-menu`},{default:m(()=>[c?.audio_url?(u(),n(N,{key:0,onClick:y(t=>e.onExtend(t,c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-forward`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.extend`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{onClick:y(t=>e.onCover(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-music`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.cover_music`)),1)]),_:1},8,[`onClick`]),c?.id?(u(),n(N,{key:1,onClick:y(t=>e.onMashup(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-shuffle`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.mashup`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id&&c?.action===`extend`?(u(),n(N,{key:2,onClick:y(t=>e.onConcatMusic(c?.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-link`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.concat_music`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[4]||=r(`div`,{class:`menu-divider`},null,-1),c?.id?(u(),n(N,{key:3,onClick:y(t=>e.onReplaceSection(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-scissors`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.replace_section`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:4,onClick:y(t=>e.onOverpainting(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-microphone`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.overpainting`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:5,onClick:y(t=>e.onUnderpainting(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-guitar`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.underpainting`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:6,onClick:y(t=>e.onSamples(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-drum`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.samples`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[5]||=r(`div`,{class:`menu-divider`},null,-1),c.id?(u(),n(N,{key:7,onClick:y(t=>e.onGetStems(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-layer-group`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.get_stems`)),1)]),_:1},8,[`onClick`])):o(``,!0),c.id?(u(),n(N,{key:8,onClick:y(t=>e.onGetAllStems(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-bars-staggered`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.all_stems`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:9,onClick:y(t=>e.onRemaster(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-wand-magic-sparkles`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.remaster`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:10,onClick:y(t=>e.onExtractVocals(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-headphones`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.extract_vocals`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:11,onClick:y(t=>e.onArtistConsistency(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-palette`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.artist_consistency`)),1)]),_:1},8,[`onClick`])):o(``,!0),c?.id?(u(),n(N,{key:12,onClick:y(t=>e.onAdjustSpeed(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-gauge-high`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.adjust_speed`)),1)]),_:1},8,[`onClick`])):o(``,!0),s[6]||=r(`div`,{class:`menu-divider`},null,-1),a(N,{onClick:y(t=>e.onReusePrompt(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-rotate-left`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.reuse_prompt`)),1)]),_:1},8,[`onClick`]),c?.id?(u(),n(N,{key:13,onClick:y(t=>e.onGetTiming(c.id),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-clock`,class:`menu-icon`}),i(` `+l(e.$t(`suno.button.get_timing`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(N,{onClick:y(e.onViewCode,[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-code`,class:`menu-icon`}),i(` `+l(e.$t(`common.button.viewCode`)),1)]),_:1},8,[`onClick`]),s[7]||=r(`div`,{class:`menu-divider`},null,-1),c?.id?(u(),n(N,{key:14,class:`delete-item`,onClick:y(t=>e.onDelete(c),[`stop`])},{default:m(()=>[a(k,{icon:`fa-solid fa-trash`,class:`menu-icon delete-icon`}),i(` `+l(e.$t(`suno.button.delete`)),1)]),_:1},8,[`onClick`])):o(``,!0)]),_:2},1024)]),default:m(()=>[r(`span`,da,[a(j,{effect:`dark`,content:e.$t(`suno.button.more`),placement:`top`},{default:m(()=>[c?.audio_url||c?.video_url?(u(),n(k,{key:0,icon:`fa-solid fa-ellipsis`,class:`icon icon-ellipsis`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024)])],10,Ji))),128)),a(I,{visible:e.apiCodeVisible,"onUpdate:visible":s[3]||=t=>e.apiCodeVisible=t,method:`POST`,path:e.apiCodePath,body:e.apiCodeBody,token:e.$store.state.suno?.credential?.token||``},null,8,[`visible`,`path`,`body`,`token`])])}var pa=s({name:`RecentPanel`,components:{ElSkeletonItem:oe,ElSkeleton:se,ElInput:G,ElButton:b,ElDropdown:V,ElDropdownMenu:re,ElDropdownItem:B,ElPopover:ie,ElRadioGroup:R,ElRadioButton:L,ElSelect:E,ElOption:D,FontAwesomeIcon:Z,TaskPreview:W(Ki,[[`render`,fa]]),Player:Ee,NoTasks:Ce,ScrollList:ye},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0,searchQuery:``,sortBy:`newest`,filterType:`all`,filterDuration:`all`,filterVideo:`all`,filterModel:`all`}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}},sortLabel(){return this.sortBy===`newest`?this.$t(`suno.sort.newest`):this.$t(`suno.sort.oldest`)},activeFilterCount(){let e=0;return this.filterType!==`all`&&e++,this.filterDuration!==`all`&&e++,this.filterVideo!==`all`&&e++,this.filterModel&&this.filterModel!==`all`&&e++,e},availableModels(){let e=this.tasks?.items||[],t=new Set;for(let n of e){let e=n?.response?.data??[];for(let n of e)n.model&&t.add(n.model)}return Array.from(t).sort()},filteredTasks(){let e=this.tasks?.items||[];if(this.searchQuery){let t=this.searchQuery.toLowerCase();e=e.filter(e=>(e?.response?.data??[]).some(e=>e.title?.toLowerCase().includes(t)||e.style?.toLowerCase().includes(t)||e.prompt?.toLowerCase().includes(t)))}return this.activeFilterCount>0&&(e=e.filter(e=>{let t=e?.request??{},n=e?.response?.data??[];return this.filterType===`vocal`&&t.instrumental===!0||this.filterType===`instrumental`&&t.instrumental!==!0?!1:this.filterDuration!==`all`||this.filterVideo!==`all`||this.filterModel&&this.filterModel!==`all`?n.some(e=>!(this.filterDuration===`short`&&!(typeof e.duration==`number`&&e.duration<60)||this.filterDuration===`medium`&&!(typeof e.duration==`number`&&e.duration>=60&&e.duration<=180)||this.filterDuration===`long`&&!(typeof e.duration==`number`&&e.duration>180)||this.filterVideo===`with`&&!e.video_url||this.filterVideo===`without`&&e.video_url||this.filterModel&&this.filterModel!==`all`&&e.model!==this.filterModel)):!0})),this.sortBy===`oldest`&&(e=[...e].reverse()),e}},methods:{onSortChange(e){this.sortBy=e},onResetFilters(){this.filterType=`all`,this.filterDuration=`all`,this.filterVideo=`all`,this.filterModel=`all`},getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),ma={key:0,class:`tasks`},ha={class:`left w-[70px] p-[10px] flex items-center`},ga={class:`main w-[calc(100%-70px)] flex-1 p-[10px]`},_a={key:0,class:`task-toolbar`},va={key:0,class:`filter-badge`},ya={class:`filter-popover`},ba={class:`filter-row`},xa={class:`filter-label`},Sa={class:`filter-row`},Ca={class:`filter-label`},wa={class:`filter-row`},Ta={class:`filter-label`},Ea={key:0,class:`filter-row`},Da={class:`filter-label`},Oa={class:`filter-actions`},ka={key:2,class:`w-full flex-1 flex items-center justify-center`},Aa={class:`text-sm text-gray-400`},ja={key:3,class:`w-full flex-1 flex flex-col items-center justify-center gap-2`},Ma={class:`text-sm text-gray-400`},Na={key:4,class:`w-full flex-1 flex items-center justify-center`},Pa={class:`h-20`};function Fa(e,s,h,_,y,b){let x=f(`el-skeleton-item`),S=f(`el-skeleton`),C=f(`font-awesome-icon`),w=f(`el-input`),T=f(`el-button`),E=f(`el-dropdown-item`),D=f(`el-dropdown-menu`),O=f(`el-dropdown`),k=f(`el-radio-button`),A=f(`el-radio-group`),j=f(`el-option`),M=f(`el-select`),N=f(`el-popover`),P=f(`task-preview`),F=f(`scroll-list`),I=f(`no-tasks`),L=f(`player`);return u(),p(v,null,[e.tasks?.items===void 0?(u(),p(`div`,ma,[(u(),p(v,null,c(3,e=>r(`div`,{key:e,class:`flex`},[r(`div`,ha,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`image`,class:`avatar w-[50px] h-[50px]`})]),_:1})]),r(`div`,ga,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`p`,class:`w-[200px] h-[15px] mb-[5px] mt-[10px]`}),a(x,{variant:`text`})]),_:1})])])),64))])):(u(),p(v,{key:1},[e.tasks?.items?.length?(u(),p(`div`,_a,[a(w,{modelValue:e.searchQuery,"onUpdate:modelValue":s[0]||=t=>e.searchQuery=t,size:`small`,placeholder:e.$t(`suno.placeholder.searchSongs`),clearable:``,class:`task-search`},{prefix:m(()=>[a(C,{icon:`fa-solid fa-magnifying-glass`,class:`text-xs`})]),_:1},8,[`modelValue`,`placeholder`]),a(O,{trigger:`click`,onCommand:e.onSortChange},{dropdown:m(()=>[a(D,null,{default:m(()=>[a(E,{command:`newest`,class:t({"is-active":e.sortBy===`newest`})},{default:m(()=>[i(l(e.$t(`suno.sort.newest`)),1)]),_:1},8,[`class`]),a(E,{command:`oldest`,class:t({"is-active":e.sortBy===`oldest`})},{default:m(()=>[i(l(e.$t(`suno.sort.oldest`)),1)]),_:1},8,[`class`])]),_:1})]),default:m(()=>[a(T,{size:`small`,class:`sort-btn`},{default:m(()=>[a(C,{icon:`fa-solid fa-arrow-down-wide-short`,class:`mr-1`}),i(` `+l(e.sortLabel),1)]),_:1})]),_:1},8,[`onCommand`]),a(N,{trigger:`click`,placement:`bottom-end`,width:260},{reference:m(()=>[a(T,{size:`small`,class:t([`filter-btn`,{"has-active-filter":e.activeFilterCount>0}])},{default:m(()=>[a(C,{icon:`fa-solid fa-filter`,class:`mr-1`}),i(` `+l(e.$t(`suno.filter.title`))+` `,1),e.activeFilterCount>0?(u(),p(`span`,va,l(e.activeFilterCount),1)):o(``,!0)]),_:1},8,[`class`])]),default:m(()=>[r(`div`,ya,[r(`div`,ba,[r(`div`,xa,l(e.$t(`suno.filter.type`)),1),a(A,{modelValue:e.filterType,"onUpdate:modelValue":s[1]||=t=>e.filterType=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.typeAll`)),1)]),_:1}),a(k,{value:`vocal`},{default:m(()=>[i(l(e.$t(`suno.filter.typeVocal`)),1)]),_:1}),a(k,{value:`instrumental`},{default:m(()=>[i(l(e.$t(`suno.filter.typeInstrumental`)),1)]),_:1})]),_:1},8,[`modelValue`])]),r(`div`,Sa,[r(`div`,Ca,l(e.$t(`suno.filter.duration`)),1),a(A,{modelValue:e.filterDuration,"onUpdate:modelValue":s[2]||=t=>e.filterDuration=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.durationAll`)),1)]),_:1}),a(k,{value:`short`},{default:m(()=>[i(l(e.$t(`suno.filter.durationShort`)),1)]),_:1}),a(k,{value:`medium`},{default:m(()=>[i(l(e.$t(`suno.filter.durationMedium`)),1)]),_:1}),a(k,{value:`long`},{default:m(()=>[i(l(e.$t(`suno.filter.durationLong`)),1)]),_:1})]),_:1},8,[`modelValue`])]),r(`div`,wa,[r(`div`,Ta,l(e.$t(`suno.filter.video`)),1),a(A,{modelValue:e.filterVideo,"onUpdate:modelValue":s[3]||=t=>e.filterVideo=t,size:`small`},{default:m(()=>[a(k,{value:`all`},{default:m(()=>[i(l(e.$t(`suno.filter.videoAll`)),1)]),_:1}),a(k,{value:`with`},{default:m(()=>[i(l(e.$t(`suno.filter.videoWith`)),1)]),_:1}),a(k,{value:`without`},{default:m(()=>[i(l(e.$t(`suno.filter.videoWithout`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e.availableModels.length>0?(u(),p(`div`,Ea,[r(`div`,Da,l(e.$t(`suno.filter.model`)),1),a(M,{modelValue:e.filterModel,"onUpdate:modelValue":s[4]||=t=>e.filterModel=t,size:`small`,placeholder:e.$t(`suno.filter.modelAll`),clearable:``},{default:m(()=>[a(j,{label:e.$t(`suno.filter.modelAll`),value:`all`},null,8,[`label`]),(u(!0),p(v,null,c(e.availableModels,e=>(u(),n(j,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0),r(`div`,Oa,[a(T,{size:`small`,text:``,onClick:e.onResetFilters},{default:m(()=>[i(l(e.$t(`suno.filter.reset`)),1)]),_:1},8,[`onClick`])])])]),_:1})])):o(``,!0),e.filteredTasks?.length>0?(u(),n(F,{key:1,ref:`scrollList`,class:`flex-1 w-full overflow-y-auto tasks p-2`,loading:e.loading,onReachTop:s[5]||=t=>e.$emit(`reach-top`)},{default:m(()=>[(u(!0),p(v,null,c(e.filteredTasks,(e,t)=>(u(),n(P,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):e.searchQuery&&e.tasks?.items?.length>0?(u(),p(`div`,ka,[r(`p`,Aa,l(e.$t(`suno.message.noSearchResults`)),1)])):e.activeFilterCount>0&&e.tasks?.items?.length>0?(u(),p(`div`,ja,[r(`p`,Ma,l(e.$t(`suno.message.noFilterResults`)),1),a(T,{size:`small`,text:``,onClick:e.onResetFilters},{default:m(()=>[i(l(e.$t(`suno.filter.reset`)),1)]),_:1},8,[`onClick`])])):e.tasks?.items?.length===0?(u(),p(`div`,Na,[a(I)])):o(``,!0)],64)),g(r(`div`,Pa,[a(L,{namespace:`suno`})],512),[[d,!!e.$store?.state?.suno?.audio?.object]])],64)}var Ia=W(pa,[[`render`,Fa],[`__scopeId`,`data-v-6ce376c9`]]),La=s({name:`TaskPreview`,components:{IconPicture:T,ElImage:P,ElAvatar:F,ElIcon:w},computed:{audio(){return this.$store.state.suno?.audio}}}),Ra={key:0,class:`size-full overflow-hidden`},za={class:`relative h-[300px]`},Ba={class:`flex items-center justify-center size-full bg-[var(--el-bg-color)]`},Va={class:`absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent`},Ha={class:`p-4`},Ua={class:`flex items-center font-bold mb-2`},Wa={class:`text-[var(--el-text-color-regular)] mb-2`},Ga={class:`text-xs text-[var(--el-text-color-regular)]`},Ka={class:`mt-4 text-sm leading-[25px] whitespace-pre-wrap`},qa={key:1,class:`w-full h-full`};function Ja(e,t,n,i,o,s){let c=f(`icon-picture`),d=f(`el-icon`),h=f(`el-image`),g=f(`el-avatar`);return e.audio?.object?(u(),p(`div`,Ra,[r(`div`,za,[a(h,{src:e.audio.image_url,fit:`cover`,class:`size-full`},{error:m(()=>[r(`div`,Ba,[a(d,{class:`text-3xl`},{default:m(()=>[a(c)]),_:1})])]),_:1},8,[`src`]),r(`h2`,Va,l(e.audio?.title),1)]),r(`div`,Ha,[r(`div`,Ua,[a(g,{size:30,src:e.audio?.image_url,class:`mr-2`},null,8,[`src`]),r(`span`,null,l(e.audio?.title),1)]),r(`p`,Wa,l(e.audio?.style),1),r(`p`,Ga,l(e.$dayjs.format(e.audio?.created_at)),1),r(`div`,Ka,[r(`p`,null,l(e.audio?.lyric),1)])])])):(u(),p(`div`,qa))}var Ya=W(La,[[`render`,Ja]]),Xa=U(`suno`),Za=s({name:`SunoIndex`,components:{Layout:Ne,ConfigPanel:Ui,RecentPanel:Ia,PreviewPanel:Ya},mixins:[fe],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===X.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===X.Request||this.fetchingTasks},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===X.Request},needApply(){return this.$store.state.suno.status.getApplications===X.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await xe({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`suno/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplications`),await this.$store.dispatch(`suno/getApplications`),console.debug(`end onGetApplications`),await this.onGetTasks()},onApply(){de.create({application:this.application}).then(({data:e})=>{this.application=e,J.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&J.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`suno/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){if(!he(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;let e={...this.config,callback_url:Xa};if(!this.hasSunoInput(e)){J.error(this.$t(`suno.message.promptRequired`));return}this.hasText(e.prompt)&&(e.prompt=e.prompt.trim());let t=this.credential?.token;if(!t){console.error(`no token specified`);return}J.info(this.$t(`suno.message.startingTask`)),pe(`suno`,Y.audio(e,{token:t})).then(()=>{J.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{J.error(e?.response?.data?.error?.message||this.$t(`suno.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0},hasSunoInput(e){return[e.prompt,e.lyric,e.lyric_prompt,e.style,e.title].some(e=>this.hasText(e))||this.hasText(e.audio_id)||Array.isArray(e.mashup_audio_ids)&&e.mashup_audio_ids.length>0}}});function Qa(e,t,r,i,o,s){let c=f(`config-panel`),l=f(`recent-panel`),d=f(`preview-panel`),p=f(`layout`);return u(),n(p,null,{config:m(()=>[a(c,{onGenerate:e.onGenerateAudio},null,8,[`onGenerate`])]),result:m(()=>[a(l,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),preview:m(()=>[a(d)]),_:1})}var $a=W(Za,[[`render`,Qa],[`__scopeId`,`data-v-b9beee12`]]);export{$a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{Bt as e,D as t,E as n,M as r,N as i,O as a,P as o,Q as s,Ut as c,X as l,et as u,k as d,lt as f,x as p,y as m}from"./vendor-chart-mdwpew_o.js";import{t as h}from"./button-DWzbdjZV.js";import{r as g,t as _}from"./select-CYdISXBV.js";import{t as v}from"./upload-CHAO8dYa.js";import{t as y}from"./tooltip-C3PYfh8V.js";import{t as b}from"./image-tItcr5tZ.js";import{t as x}from"./alert-BJj7gY4q.js";import{hi as S,zn as C}from"./constants-B6_fTlam.js";import{At as w,E as T,Fn as E,Nt as D,Ot as ee,Sr as te,cn as O,jt as k,kr as A,kt as j,yr as M}from"./index-DpREqzJQ.js";import{t as N}from"./index.es-DkXuZNXE.js";import{t as P}from"./CopyToClipboard-DXA4nHxo.js";import{t as F}from"./ImagePreview-Bkw_taCt.js";import{t as I}from"./Hailuo-D_ir2qwk.js";import{t as L}from"./BotPlaceholder-R_nAAbft.js";import{i as R,n as z,t as B}from"./pagination-BQOE0Lce.js";import{n as V,t as H}from"./NoTasks-568fhAGt.js";import{t as U}from"./Consumption-CjrpUNmV.js";import{t as W}from"./ApiCodeButton-DXN7iB8l.js";import{t as G}from"./VideoPlayer-BjsbkQZc.js";var K=o({name:`ModelSelector`,components:{ElSelect:g,ElOption:_},data(){return{}},computed:{options(){return[{value:`minimax-t2v`,label:this.$t(`hailuo.button.model1`)},{value:`minimax-i2v`,label:this.$t(`hailuo.button.model2`)},{value:`minimax-i2v-director`,label:this.$t(`hailuo.button.model3`)}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||=C}}),q={class:`field`},J={class:`title font-bold`},Y={class:`float-left`};function X(e,r,a,o,m,h){let g=u(`el-option`),_=u(`el-select`);return l(),d(`div`,q,[n(`h2`,J,c(e.$t(`hailuo.name.model`)),1),i(_,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`hailuo.placeholder.select`),clearable:``},{default:f(()=>[(l(!0),d(p,null,s(e.options,e=>(l(),t(g,{key:e.value,label:e.label,value:e.value},{default:f(()=>[n(`span`,Y,c(e.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Z=T(K,[[`render`,X],[`__scopeId`,`data-v-a768fbd9`]]),Q=o({name:`StartImageUrlInput`,components:{ElUpload:v,ElButton:h,InfoIcon:R,ImagePreview:F},mixins:[k,j],data(){return{fileList:[],uploadUrl:te()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){A.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){A.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){A.error(this.$t(`hailuo.message.uploadStartImageError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ne={class:`relative`},re={class:`flex justify-between`},ie={class:`flex justify-start items-center`},ae={class:`text-sm font-bold`};function oe(e,o,s,p,m,h){let g=u(`info-icon`),_=u(`image-preview`),v=u(`el-button`),y=u(`el-upload`);return l(),d(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`span`,ae,c(e.$t(`hailuo.name.startImageUrl`)),1),i(g,{content:e.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),i(y,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":o[0]||=t=>e.fileList=t,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:f(({file:n})=>[n.url&&n.percentage!==void 0?(l(),t(_,{key:0,url:n.url,name:n.name,percentage:n.percentage,onRemove:t=>e.fileList.splice(e.fileList.indexOf(n),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:f(()=>[r(c(e.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var se=T(Q,[[`render`,oe],[`__scopeId`,`data-v-fbf49b06`]]),ce=o({name:`PromptInput`,components:{PromptTextarea:V},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function le(e,n,r,i,a,o){let s=u(`prompt-textarea`);return l(),t(s,{modelValue:e.prompt,"onUpdate:modelValue":n[0]||=t=>e.prompt=t,title:e.$t(`hailuo.name.prompt`),info:e.$t(`hailuo.description.prompt`),placeholder:e.$t(`hailuo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ue=o({name:`PresetPanel`,components:{ElButton:h,FontAwesomeIcon:N,PromptInput:T(ce,[[`render`,le]]),StartImageUrlInput:se,ModelSelector:Z,Consumption:U},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return D(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),de={class:`flex flex-col h-full`},fe={class:`flex-1 overflow-y-auto p-5`},pe={class:`flex flex-col items-center justify-center px-5 pb-5`};function me(e,o,s,p,m,h){let g=u(`prompt-input`),_=u(`model-selector`),v=u(`start-image-url-input`),y=u(`consumption`),b=u(`font-awesome-icon`),x=u(`el-button`);return l(),d(`div`,de,[n(`div`,fe,[i(g,{class:`mb-4`}),i(_,{class:`mb-4`}),e.config?.model===`minimax-i2v`?(l(),t(v,{key:0,class:`mb-2`})):a(``,!0)]),n(`div`,pe,[i(y,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(l(),t(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:f(()=>[i(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+c(e.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(l(),t(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:f(()=>[i(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+c(e.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var he=T(ue,[[`render`,me]]),ge=o({name:`TaskPreview`,components:{ElImage:b,CopyToClipboard:P,FontAwesomeIcon:N,ElAlert:x,VideoPlayer:G,ElTooltip:y,ElButton:h,ApiCodeButton:W},props:{modelValue:{type:Object,required:!0}},computed:{application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{onDownload(e){console.debug(`on download hailuo video`,e),window.open(e,`_blank`)}}}),_e={class:`preview`},ve={class:`left`},ye={class:`main`},be={class:`bot`},xe={class:`datetime`},Se={class:`info`},Ce={key:0,class:`prompt mt-2`},we={key:0},Te={key:1},Ee={key:0,class:e({content:!0,failed:!0})},De={key:0,class:`mb-4`},Oe={key:1,class:e({operations:!0,"mt-2":!0})},ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ae={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},je={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Me={key:1,class:e({content:!0})},Ne={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pe={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Fe={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ie={key:2,class:e({content:!0})},Le={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Re(e,o,s,p,h,g){let _=u(`el-image`),v=u(`video-player`),y=u(`el-button`),b=u(`el-tooltip`),x=u(`api-code-button`),S=u(`font-awesome-icon`),C=u(`copy-to-clipboard`),w=u(`el-alert`);return l(),d(`div`,_e,[n(`div`,ve,[i(_,{src:`https://cdn.acedata.cloud/0qg4gp.png`,class:`avatar`})]),n(`div`,ye,[n(`div`,be,[r(c(e.$t(`hailuo.name.hailuoBot`))+` `,1),n(`span`,xe,c(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,Se,[e.modelValue?.request?.prompt?(l(),d(`p`,Ce,[r(c(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?a(``,!0):(l(),d(`span`,we,` - (`+c(e.$t(`hailuo.status.pending`))+`) `,1)),e.video?.state===`processing`||e.video?.state===`pending`||e.video?.state===`running`?(l(),d(`span`,Te,` - (`+c(e.$t(`hailuo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),e.modelValue?.response?.success===!0?(l(),d(`div`,Ee,[e.video?.video_url?(l(),d(`div`,De,[i(v,{src:e.video?.video_url},null,8,[`src`])])):a(``,!0),e.video?(l(),d(`div`,Oe,[i(b,{class:`box-item`,effect:`dark`,content:e.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:f(()=>[e.video?.video_url?(l(),t(y,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:o[0]||=m(t=>e.onDownload(e.video?.video_url),[`stop`])},{default:f(()=>[r(c(e.$t(`hailuo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(x,{path:`/hailuo/videos`,body:e.modelValue?.request},null,8,[`body`])])):a(``,!0),i(w,{closable:!1,class:`mt-2 success`},{default:f(()=>[e.modelValue?.request?.model?(l(),d(`p`,ke,[i(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.model`))+`: `+c(e.modelValue?.request?.model)+` `,1),i(C,{content:e.modelValue?.id},null,8,[`content`])])):a(``,!0),n(`p`,Ae,[i(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.taskId`))+`: `+c(e.modelValue?.id)+` `,1),i(C,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(l(),d(`p`,je,[i(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.elapsed`))+`: `+c(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),e.modelValue?.response?.success===!1?(l(),d(`div`,Me,[i(w,{closable:!1,class:`failure`},{template:f(()=>[i(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.failure`)),1)]),default:f(()=>[n(`p`,Ne,[i(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.taskId`))+`: `+c(e.modelValue?.id)+` `,1),i(C,{content:e.modelValue?.id},null,8,[`content`])]),n(`p`,Pe,[i(S,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.failureReason`))+`: `+c(e.modelValue?.response?.error?.message)+` `,1),i(C,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(l(),d(`p`,$,[i(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.elapsed`))+`: `+c(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),n(`p`,Fe,[i(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.traceId`))+`: `+c(e.modelValue?.response?.trace_id)+` `,1),i(C,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):a(``,!0),e.modelValue?.response?.success===void 0?(l(),d(`div`,Ie,[i(w,{closable:!1,class:`info`},{template:f(()=>[i(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.failure`)),1)]),default:f(()=>[n(`p`,Le,[i(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.taskId`))+`: `+c(e.modelValue?.id)+` `,1),i(C,{content:e.modelValue?.id},null,8,[`content`])])]),_:1})])):a(``,!0)])])}var ze=o({name:`RecentPanel`,components:{TaskPreview:T(ge,[[`render`,Re],[`__scopeId`,`data-v-53d13da4`]]),BotPlaceholder:L,NoTasks:H,ScrollList:z},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Be={key:0},Ve={key:2,class:`w-full h-full flex items-center justify-center`};function He(e,n,r,o,c,m){let h=u(`bot-placeholder`),g=u(`task-preview`),_=u(`scroll-list`),v=u(`no-tasks`);return l(),d(p,null,[e.tasks?.items===void 0?(l(),d(`div`,Be,[i(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),t(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:n[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(l(!0),d(p,null,s(e.tasks?.items,e=>(l(),t(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(l(),d(`div`,Ve,[i(v)])):a(``,!0)],64)}var Ue=T(ze,[[`render`,He]]),We=S(`hailuo`),Ge=o({name:`HailuoIndex`,components:{ConfigPanel:he,Layout:I,RecentPanel:Ue},mixins:[w],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.hailuo?.status?.getApplications===M.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===M.Request||this.fetchingTasks},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await B({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`hailuo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`hailuo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`hailuo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ee(this.uploadTracker,e=>this.$t(e),e=>A.warning(e)))return;let e={...this.config,callback_url:We},t=this.credential?.token;if(!t){console.error(`no token specified`);return}A.info(this.$t(`hailuo.message.startingTask`)),E(`hailuo`,O.generate(e,{token:t})).then(()=>{A.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?A.error(this.$t(`hailuo.message.usedUp`)):A.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ke(e,n,r,a,o,s){let c=u(`config-panel`),d=u(`recent-panel`),p=u(`layout`);return l(),t(p,null,{config:f(()=>[i(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(d,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var qe=T(Ge,[[`render`,Ke]]);export{qe as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{Bt as e,D as t,E as n,M as r,N as i,O as a,P as o,Q as s,Ut as c,X as l,et as u,k as d,lt as f,x as p,y as m}from"./vendor-chart-mdwpew_o.js";import{t as h}from"./button-DWzbdjZV.js";import{r as g,t as _}from"./select-CyfjsVYT.js";import{t as v}from"./upload-CIsl9b3M.js";import{t as y}from"./tooltip-C3PYfh8V.js";import{t as b}from"./image-BhCAlGZE.js";import{t as x}from"./alert-BJj7gY4q.js";import{hi as S,zn as C}from"./constants-EAH6CsV9.js";import{At as w,E as T,Fn as E,Nt as D,Ot as ee,Sr as te,cn as O,jt as k,kr as A,kt as j,yr as M}from"./index-WLGDsbco.js";import{t as N}from"./index.es-DEMCbRdu.js";import{t as P}from"./CopyToClipboard-CW-duTMh.js";import{t as F}from"./ImagePreview-CjurFfIy.js";import{t as I}from"./Hailuo-kmnQTeOS.js";import{t as L}from"./BotPlaceholder-DhZ616uF.js";import{i as R,n as z,t as B}from"./pagination-B3UvJKZu.js";import{n as V,t as H}from"./NoTasks-HGgmWayY.js";import{t as U}from"./Consumption-Dv4UTeE5.js";import{t as W}from"./ApiCodeButton-9rdgO0or.js";import{t as G}from"./VideoPlayer-_FQCj0ZO.js";var K=o({name:`ModelSelector`,components:{ElSelect:g,ElOption:_},data(){return{}},computed:{options(){return[{value:`minimax-t2v`,label:this.$t(`hailuo.button.model1`)},{value:`minimax-i2v`,label:this.$t(`hailuo.button.model2`)},{value:`minimax-i2v-director`,label:this.$t(`hailuo.button.model3`)}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||=C}}),q={class:`field`},J={class:`title font-bold`},Y={class:`float-left`};function X(e,r,a,o,m,h){let g=u(`el-option`),_=u(`el-select`);return l(),d(`div`,q,[n(`h2`,J,c(e.$t(`hailuo.name.model`)),1),i(_,{modelValue:e.value,"onUpdate:modelValue":r[0]||=t=>e.value=t,class:`value`,placeholder:e.$t(`hailuo.placeholder.select`),clearable:``},{default:f(()=>[(l(!0),d(p,null,s(e.options,e=>(l(),t(g,{key:e.value,label:e.label,value:e.value},{default:f(()=>[n(`span`,Y,c(e.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Z=T(K,[[`render`,X],[`__scopeId`,`data-v-a768fbd9`]]),Q=o({name:`StartImageUrlInput`,components:{ElUpload:v,ElButton:h,InfoIcon:R,ImagePreview:F},mixins:[k,j],data(){return{fileList:[],uploadUrl:te()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){A.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){A.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){A.error(this.$t(`hailuo.message.uploadStartImageError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ne={class:`relative`},re={class:`flex justify-between`},ie={class:`flex justify-start items-center`},ae={class:`text-sm font-bold`};function oe(e,o,s,p,m,h){let g=u(`info-icon`),_=u(`image-preview`),v=u(`el-button`),y=u(`el-upload`);return l(),d(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`span`,ae,c(e.$t(`hailuo.name.startImageUrl`)),1),i(g,{content:e.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),i(y,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":o[0]||=t=>e.fileList=t,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:f(({file:n})=>[n.url&&n.percentage!==void 0?(l(),t(_,{key:0,url:n.url,name:n.name,percentage:n.percentage,onRemove:t=>e.fileList.splice(e.fileList.indexOf(n),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:f(()=>[r(c(e.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var se=T(Q,[[`render`,oe],[`__scopeId`,`data-v-fbf49b06`]]),ce=o({name:`PromptInput`,components:{PromptTextarea:V},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function le(e,n,r,i,a,o){let s=u(`prompt-textarea`);return l(),t(s,{modelValue:e.prompt,"onUpdate:modelValue":n[0]||=t=>e.prompt=t,title:e.$t(`hailuo.name.prompt`),info:e.$t(`hailuo.description.prompt`),placeholder:e.$t(`hailuo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ue=o({name:`PresetPanel`,components:{ElButton:h,FontAwesomeIcon:N,PromptInput:T(ce,[[`render`,le]]),StartImageUrlInput:se,ModelSelector:Z,Consumption:U},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return D(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),de={class:`flex flex-col h-full`},fe={class:`flex-1 overflow-y-auto p-5`},pe={class:`flex flex-col items-center justify-center px-5 pb-5`};function me(e,o,s,p,m,h){let g=u(`prompt-input`),_=u(`model-selector`),v=u(`start-image-url-input`),y=u(`consumption`),b=u(`font-awesome-icon`),x=u(`el-button`);return l(),d(`div`,de,[n(`div`,fe,[i(g,{class:`mb-4`}),i(_,{class:`mb-4`}),e.config?.model===`minimax-i2v`?(l(),t(v,{key:0,class:`mb-2`})):a(``,!0)]),n(`div`,pe,[i(y,{value:e.consumption,service:e.service},null,8,[`value`,`service`]),e.config?.video_url!==void 0||e.config?.custom?(l(),t(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:f(()=>[i(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+c(e.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(l(),t(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:e.onGenerate},{default:f(()=>[i(b,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+c(e.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var he=T(ue,[[`render`,me]]),ge=o({name:`TaskPreview`,components:{ElImage:b,CopyToClipboard:P,FontAwesomeIcon:N,ElAlert:x,VideoPlayer:G,ElTooltip:y,ElButton:h,ApiCodeButton:W},props:{modelValue:{type:Object,required:!0}},computed:{application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{onDownload(e){console.debug(`on download hailuo video`,e),window.open(e,`_blank`)}}}),_e={class:`preview`},ve={class:`left`},ye={class:`main`},be={class:`bot`},xe={class:`datetime`},Se={class:`info`},Ce={key:0,class:`prompt mt-2`},we={key:0},Te={key:1},Ee={key:0,class:e({content:!0,failed:!0})},De={key:0,class:`mb-4`},Oe={key:1,class:e({operations:!0,"mt-2":!0})},ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ae={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},je={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Me={key:1,class:e({content:!0})},Ne={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pe={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Fe={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ie={key:2,class:e({content:!0})},Le={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Re(e,o,s,p,h,g){let _=u(`el-image`),v=u(`video-player`),y=u(`el-button`),b=u(`el-tooltip`),x=u(`api-code-button`),S=u(`font-awesome-icon`),C=u(`copy-to-clipboard`),w=u(`el-alert`);return l(),d(`div`,_e,[n(`div`,ve,[i(_,{src:`https://cdn.acedata.cloud/0qg4gp.png`,class:`avatar`})]),n(`div`,ye,[n(`div`,be,[r(c(e.$t(`hailuo.name.hailuoBot`))+` `,1),n(`span`,xe,c(e.$dayjs.format(``+new Date(parseFloat((e.modelValue?.created_at||``).toString())*1e3))),1)]),n(`div`,Se,[e.modelValue?.request?.prompt?(l(),d(`p`,Ce,[r(c(e.modelValue?.request?.prompt)+` `,1),e.modelValue?.response?a(``,!0):(l(),d(`span`,we,` - (`+c(e.$t(`hailuo.status.pending`))+`) `,1)),e.video?.state===`processing`||e.video?.state===`pending`||e.video?.state===`running`?(l(),d(`span`,Te,` - (`+c(e.$t(`hailuo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),e.modelValue?.response?.success===!0?(l(),d(`div`,Ee,[e.video?.video_url?(l(),d(`div`,De,[i(v,{src:e.video?.video_url},null,8,[`src`])])):a(``,!0),e.video?(l(),d(`div`,Oe,[i(b,{class:`box-item`,effect:`dark`,content:e.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:f(()=>[e.video?.video_url?(l(),t(y,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:o[0]||=m(t=>e.onDownload(e.video?.video_url),[`stop`])},{default:f(()=>[r(c(e.$t(`hailuo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(x,{path:`/hailuo/videos`,body:e.modelValue?.request},null,8,[`body`])])):a(``,!0),i(w,{closable:!1,class:`mt-2 success`},{default:f(()=>[e.modelValue?.request?.model?(l(),d(`p`,ke,[i(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.model`))+`: `+c(e.modelValue?.request?.model)+` `,1),i(C,{content:e.modelValue?.id},null,8,[`content`])])):a(``,!0),n(`p`,Ae,[i(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.taskId`))+`: `+c(e.modelValue?.id)+` `,1),i(C,{content:e.modelValue?.id},null,8,[`content`])]),e.modelValue?.elapsed?(l(),d(`p`,je,[i(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.elapsed`))+`: `+c(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),e.modelValue?.response?.success===!1?(l(),d(`div`,Me,[i(w,{closable:!1,class:`failure`},{template:f(()=>[i(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.failure`)),1)]),default:f(()=>[n(`p`,Ne,[i(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.taskId`))+`: `+c(e.modelValue?.id)+` `,1),i(C,{content:e.modelValue?.id},null,8,[`content`])]),n(`p`,Pe,[i(S,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.failureReason`))+`: `+c(e.modelValue?.response?.error?.message)+` `,1),i(C,{content:e.modelValue?.response?.error?.message},null,8,[`content`])]),e.modelValue?.elapsed?(l(),d(`p`,$,[i(S,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.elapsed`))+`: `+c(e.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),n(`p`,Fe,[i(S,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.traceId`))+`: `+c(e.modelValue?.response?.trace_id)+` `,1),i(C,{content:e.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):a(``,!0),e.modelValue?.response?.success===void 0?(l(),d(`div`,Ie,[i(w,{closable:!1,class:`info`},{template:f(()=>[i(S,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.failure`)),1)]),default:f(()=>[n(`p`,Le,[i(S,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+c(e.$t(`hailuo.name.taskId`))+`: `+c(e.modelValue?.id)+` `,1),i(C,{content:e.modelValue?.id},null,8,[`content`])])]),_:1})])):a(``,!0)])])}var ze=o({name:`RecentPanel`,components:{TaskPreview:T(ge,[[`render`,Re],[`__scopeId`,`data-v-53d13da4`]]),BotPlaceholder:L,NoTasks:H,ScrollList:z},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Be={key:0},Ve={key:2,class:`w-full h-full flex items-center justify-center`};function He(e,n,r,o,c,m){let h=u(`bot-placeholder`),g=u(`task-preview`),_=u(`scroll-list`),v=u(`no-tasks`);return l(),d(p,null,[e.tasks?.items===void 0?(l(),d(`div`,Be,[i(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),t(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:n[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(l(!0),d(p,null,s(e.tasks?.items,e=>(l(),t(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(l(),d(`div`,Ve,[i(v)])):a(``,!0)],64)}var Ue=T(ze,[[`render`,He]]),We=S(`hailuo`),Ge=o({name:`HailuoIndex`,components:{ConfigPanel:he,Layout:I,RecentPanel:Ue},mixins:[w],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.hailuo?.status?.getApplications===M.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===M.Request||this.fetchingTasks},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await B({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`hailuo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`hailuo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`hailuo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ee(this.uploadTracker,e=>this.$t(e),e=>A.warning(e)))return;let e={...this.config,callback_url:We},t=this.credential?.token;if(!t){console.error(`no token specified`);return}A.info(this.$t(`hailuo.message.startingTask`)),E(`hailuo`,O.generate(e,{token:t})).then(()=>{A.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?A.error(this.$t(`hailuo.message.usedUp`)):A.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ke(e,n,r,a,o,s){let c=u(`config-panel`),d=u(`recent-panel`),p=u(`layout`);return l(),t(p,null,{config:f(()=>[i(c,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(d,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var qe=T(Ge,[[`render`,Ke]]);export{qe as default};
|