@acedatacloud/nexior 3.34.1 → 3.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/assets/{Auth-BR7AQdFb.js → Auth-BzXswjE4.js} +1 -1
  2. package/dist/assets/{BotPlaceholder-CcWrwFmL.js → BotPlaceholder-BV2w6Q4w.js} +1 -1
  3. package/dist/assets/Browse-BHDvC_mG.js +1 -0
  4. package/dist/assets/Browse-oFjzU0X9.css +1 -0
  5. package/dist/assets/{Callback-xXjmMOcU.js → Callback-CQ8ko7C9.js} +1 -1
  6. package/dist/assets/{Console-nj_hwu1u.js → Console-UbGToFD6.js} +1 -1
  7. package/dist/assets/{Consumption-DB4jsCIw.js → Consumption-DEB600BC.js} +1 -1
  8. package/dist/assets/Conversation-B30jTIbD.js +23 -0
  9. package/dist/assets/{Conversation-BhCBL3G3.css → Conversation-T2K_c37M.css} +1 -1
  10. package/dist/assets/{CopyToClipboard-DY-UF17o.js → CopyToClipboard-cTbsayFn.js} +1 -1
  11. package/dist/assets/{Detail-Ja14bXDU.js → Detail-BQ0XJdOr.js} +2 -2
  12. package/dist/assets/{EditArray-BFLjz-wW.js → EditArray-DzSfUZdI.js} +1 -1
  13. package/dist/assets/{Extra-Clq8boad.js → Extra-BGXzckZL.js} +1 -1
  14. package/dist/assets/{FilePreview-xVo0BsJp.js → FilePreview-B3Gtn-Tg.js} +1 -1
  15. package/dist/assets/{History-Do3SJVGQ.js → History-BeUw1IaF.js} +1 -1
  16. package/dist/assets/{ImagePreview-eVaabJZn.js → ImagePreview-B5F24-Vs.js} +1 -1
  17. package/dist/assets/{ImageWrapper-BPES620_.js → ImageWrapper-hN1Hdu08.js} +1 -1
  18. package/dist/assets/Index-1KNMLovE.js +1 -0
  19. package/dist/assets/{Index-Bv3aPtGw.js → Index-3ZiNs4kq.js} +1 -1
  20. package/dist/assets/{Index-DPCPO7cj.js → Index-BAn75ep1.js} +1 -1
  21. package/dist/assets/{Index-DyFEHsky.js → Index-BJdy1_Z6.js} +1 -1
  22. package/dist/assets/{Index-D27OMdID.js → Index-BRov3UHm.js} +1 -1
  23. package/dist/assets/{Index-C7lBym9k.js → Index-BUjIH0UD.js} +1 -1
  24. package/dist/assets/{Index-Dq4ojYPG.js → Index-BacfL0a5.js} +1 -1
  25. package/dist/assets/{Index-mq2BOvvk.js → Index-Bc2v2omV.js} +1 -1
  26. package/dist/assets/{Index-B_SMVoYZ.js → Index-BfnWocKp.js} +1 -1
  27. package/dist/assets/{Index-Be0Zf-VK.js → Index-BjX115MB.js} +1 -1
  28. package/dist/assets/{Index-BGwx8RuY.js → Index-Bnh_m2KM.js} +1 -1
  29. package/dist/assets/{Index-CwPif7U2.js → Index-C6QkxZY6.js} +1 -1
  30. package/dist/assets/{Index-BU9oZ6JY.js → Index-CBMnYQ1o.js} +1 -1
  31. package/dist/assets/Index-CBgAolPo.css +1 -0
  32. package/dist/assets/{Index-JUELlnZe.css → Index-CGa5D6En.css} +1 -1
  33. package/dist/assets/{Index-DqZLjJG6.js → Index-CLPm-Y4w.js} +1 -1
  34. package/dist/assets/{Index-DWgoBNcF.js → Index-CqyShhjI.js} +1 -1
  35. package/dist/assets/{Index-BipMjUVy.js → Index-CylCKIXE.js} +1 -1
  36. package/dist/assets/{Index-edVjS9Fq.js → Index-D7ez9jbr.js} +1 -1
  37. package/dist/assets/Index-DgEoij9q.js +1 -0
  38. package/dist/assets/{Index-DT-Iu1eV.js → Index-DlN6WUHV.js} +1 -1
  39. package/dist/assets/{Index-DpR3wEnE.js → Index-N-iGX0tk.js} +1 -1
  40. package/dist/assets/{Index-DS9xL4zc.js → Index-UoZMsXXk.js} +1 -1
  41. package/dist/assets/{Index-B6QAUsOF.js → Index-W2feDC-T.js} +1 -1
  42. package/dist/assets/Index-fbC-lfAY.js +1 -0
  43. package/dist/assets/{Index-BoI2jXTx.js → Index-j-TXpN-y.js} +1 -1
  44. package/dist/assets/{Index-BtuiXvN8.js → Index-q9gZ0XTy.js} +1 -1
  45. package/dist/assets/{Invitees-BFkwxUqa.js → Invitees-D4zwToOW.js} +1 -1
  46. package/dist/assets/{List-C-kCE03H.js → List-8Caks5m2.js} +1 -1
  47. package/dist/assets/{List-Br3Pd6pi.js → List-CnZ4wBge.js} +1 -1
  48. package/dist/assets/{List-BGUJQ1_j.js → List-Cogewp0B.js} +1 -1
  49. package/dist/assets/{Main-BYUMd6qO.js → Main-COqAQDqW.js} +1 -1
  50. package/dist/assets/McpManager-B62KLQ2Z.js +1 -0
  51. package/dist/assets/McpManager-Be2fvTdO.css +1 -0
  52. package/dist/assets/Navigator-semGmQ89.js +1 -0
  53. package/dist/assets/{NoTasks-Dk7Wt2AG.js → NoTasks-ZsLHgPuo.js} +1 -1
  54. package/dist/assets/{OAuthCallback-8_rUp3M5.js → OAuthCallback-CGTHAbtF.js} +1 -1
  55. package/dist/assets/OAuthCallback-CbG9_OQj.js +1 -0
  56. package/dist/assets/OAuthCallback-CeJPNVj3.css +1 -0
  57. package/dist/assets/{Pagination-CfUAmnFo.js → Pagination-BihGJLjm.js} +1 -1
  58. package/dist/assets/{ScrollList-ZiMJkMBw.js → ScrollList-OteSDitY.js} +1 -1
  59. package/dist/assets/Status-De0L9Wnu.js +1 -0
  60. package/dist/assets/Subscribe-DoFhvrGJ.js +1 -0
  61. package/dist/assets/{TransportWebHID-CdbyD8Nb.js → TransportWebHID-D9wUjmBD.js} +1 -1
  62. package/dist/assets/{VideoPlayer-DCxEj90A.js → VideoPlayer-DcumvLkR.js} +1 -1
  63. package/dist/assets/{avatar-DhwSCd0o.js → avatar-B2oLnm2w.js} +1 -1
  64. package/dist/assets/{bignumber-qGuqSDbJ.js → bignumber-geB-LwaY.js} +1 -1
  65. package/dist/assets/connector-DYad3Crz.js +1 -0
  66. package/dist/assets/connector-P8ccoph7.js +1 -0
  67. package/dist/assets/{distribution-ClKMo0TJ.js → distribution-Dmd3XvVp.js} +1 -1
  68. package/dist/assets/{index-BK4USX41.js → index-BKVUDuw-.js} +1 -1
  69. package/dist/assets/{index-0JZkSLcy.js → index-BmwlFP6v.js} +1 -1
  70. package/dist/assets/{index-DzuxpefT.js → index-CLJileDK.js} +1 -1
  71. package/dist/assets/{index-MSQW00oH.js → index-CXXU863B.js} +1 -1
  72. package/dist/assets/{index-ssOK1z8u.js → index-CZR89jLL.js} +1 -1
  73. package/dist/assets/{index-Bw6POElb.js → index-CbXbnDya.js} +1 -1
  74. package/dist/assets/{index-muIEJvsu.js → index-CtkD2JaX.js} +14 -14
  75. package/dist/assets/{index-D3HoJv4E.js → index-DrABKNoZ.js} +1 -1
  76. package/dist/assets/{index.es-Bqj83sQx.js → index.es-DMehEjXB.js} +1 -1
  77. package/dist/assets/{order-D4zdmHv8.js → order-Bw8DFW1R.js} +1 -1
  78. package/dist/assets/{price-Bva0CFLK.js → price-lQeFOa8Q.js} +1 -1
  79. package/dist/assets/{solana-wallets-nnfzRTGt.js → solana-wallets-CKHfeojs.js} +2 -2
  80. package/dist/assets/{solanaEmbed.esm-MqSs0vxC.js → solanaEmbed.esm-CbqLlFds.js} +1 -1
  81. package/dist/assets/{string_decoder-BUnST7cI.js → string_decoder-CEgnOzHn.js} +1 -1
  82. package/dist/assets/types-BnylCDhI.js +1 -0
  83. package/dist/assets/{vendor-element-plus-DN048TGi.js → vendor-element-plus-CmP9-3lX.js} +1 -1
  84. package/dist/assets/{vendor-web3-CIJ0oOq5.js → vendor-web3-C5RrfhAy.js} +4 -4
  85. package/dist/assets/{web-wXYMF4s3.js → web-Bokrd0eW.js} +1 -1
  86. package/dist/assets/{web-COanpFvz.js → web-CV8nB6ef.js} +1 -1
  87. package/dist/index.html +3 -3
  88. package/package.json +12 -1
  89. package/dist/assets/Conversation-CiAYoNDT.js +0 -23
  90. package/dist/assets/Index-BA5k_6bJ.js +0 -1
  91. package/dist/assets/Index-Bnsr9aoW.js +0 -1
  92. package/dist/assets/Navigator-qudQv6Ew.js +0 -1
  93. package/dist/assets/Status-KsOIucfx.js +0 -1
  94. package/dist/assets/Subscribe-De8de3Zo.js +0 -1
@@ -1 +1 @@
1
- import{F as D}from"./index.es-Bqj83sQx.js";import{m as N,Y as ue,k as ce,O as de,P as pe,F as X,G as Z,u as me,w as b,t as z,a6 as x,a7 as ee,_ as W,e as Y,j as L,$ as te,a8 as fe,a9 as he,l as _e,f as ge,g as $e,h as ve,q as ye,r as ke,L as be,a2 as we,aa as Ce,ab as Ve}from"./vendor-element-plus-DN048TGi.js";import{d as C,C as c,G as s,T as o,E as H,K as r,ai as i,D as n,O as d,R as a,S as M,ag as J,J as y,Q as w,L as F,aq as j,X as U,c as G,u as T,w as Se,U as Ae}from"./vendor-vue-BhXato7y.js";import{_ as A,cj as Ue,ck as I,au as Ee,aJ as R,cl as q,aC as Pe,aI as Ie}from"./index-muIEJvsu.js";import{I as P,S as Te}from"./ScrollList-ZiMJkMBw.js";import{u as O,F as Ge,O as Le,_ as se,P as Fe,a as je,V as De}from"./IconPark.vue_vue_type_script_setup_true_lang-C7eA9UI3.js";import{C as ze}from"./Consumption-DB4jsCIw.js";import{a as Re}from"./price-Bva0CFLK.js";import{N as Me}from"./NoTasks-Dk7Wt2AG.js";import{l as Oe}from"./pagination-DLJ2pbsx.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-CIJ0oOq5.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";const Ne=C({name:"LayoutSuno",components:{ElDrawer:ue,ElButton:N,FontAwesomeIcon:D},data(){return{drawer:!1,preview:!1}},computed:{}}),We={class:"main flex flex-row flex-1"},qe={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},Be={class:"result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"},Ke={class:"preview h-full w-[300px] flex flex-col"};function He(e,t,u,l,$,h){const p=i("font-awesome-icon"),_=i("el-button"),m=i("el-drawer");return n(),c("div",We,[s("div",qe,[H(e.$slots,"config",{},void 0,!0)]),s("div",Be,[H(e.$slots,"result",{},void 0,!0)]),s("div",Ke,[H(e.$slots,"preview",{},void 0,!0)]),o(_,{circle:"",class:"menu",onClick:t[0]||(t[0]=g=>e.drawer=!0)},{default:r(()=>[o(p,{icon:"fa-solid fa-magic"})]),_:1}),o(m,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:r(()=>[H(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const Je=A(Ne,[["render",He],["__scopeId","data-v-c6c85757"]]),Ye=C({name:"TypeSelector",components:{ElSelect:pe,ElOption:de,ElSwitch:ce},data(){return{options:[{label:"Suno v5.5",value:"chirp-v5-5",info:"8 min"},{label:"Suno v5",value:"chirp-v5",info:"8 min"},{label:"Suno v4.5+",value:"chirp-v4-5-plus",info:"8 min"},{label:"Suno v4.5",value:"chirp-v4-5",info:"4 min"},{label:"Suno v4",value:"chirp-v4",info:"2.5 min"},{label:"Suno v3.5",value:"chirp-v3-5",info:"2 min"},{label:"Suno v3",value:"chirp-v3-0",info:"2 min"}]}},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||(this.model=Ue)}}),Qe={class:"flex items-center justify-between mb-3"},Xe={class:"text-sm font-bold"},Ze={class:"mb-3"},xe={class:"flex items-center mb-1"},et={class:"text-sm font-bold"},tt={class:"flex items-center justify-between w-full"},st={class:"text-xs text-[var(--el-text-color-placeholder)]"},ot={key:0,class:"flex items-center justify-between mb-3"},nt={class:"text-sm font-bold"};function it(e,t,u,l,$,h){const p=i("el-switch"),_=i("el-option"),m=i("el-select");return n(),c("div",null,[s("div",Qe,[s("span",Xe,a(e.$t("suno.name.type")),1),o(p,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=g=>e.custom=g)},null,8,["modelValue"])]),s("div",Ze,[s("div",xe,[s("span",et,a(e.$t("suno.name.model")),1)]),o(m,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=g=>e.model=g),class:"w-full",size:"default",placeholder:e.$t("suno.placeholder.select")},{default:r(()=>[(n(!0),c(M,null,J(e.options,g=>(n(),y(_,{key:g.value,label:g.label,value:g.value},{default:r(()=>[s("div",tt,[s("span",null,a(g.label),1),s("span",st,a(g.info),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),e.custom?(n(),c("div",ot,[s("span",nt,a(e.$t("suno.name.instrumental")),1),o(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[2]||(t[2]=g=>e.instrumental=g)},null,8,["modelValue"])])):d("",!0)])}const at=A(Ye,[["render",it]]),lt=C({name:"UploadAudio",components:{ElUpload:me,ElButton:N,InfoIcon:P,FontAwesomeIcon:D,ElRadioGroup:Z,ElRadioButton:X},emits:["change"],data(){return{fileList:[],uploadUrl:Ee()+"/api/v1/files/"}},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(){const 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})}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){b.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){b.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},u=this.credential?.token;if(!u){console.error("no token specified");return}b.info(this.$t("suno.message.startingUploadAudio")),I.upload(t,{token:u}).then(l=>{console.debug("get upload music success",l.data);const $=l.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:$,action:"upload_extend"}),b.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(l=>{b.error(l?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),rt={class:"relative"},ut={class:"flex justify-between"},ct={class:"flex justify-start items-center"},dt={class:"text-sm font-bold"},pt={key:0,class:"mt-2"};function mt(e,t,u,l,$,h){const p=i("info-icon"),_=i("font-awesome-icon"),m=i("el-button"),g=i("el-upload"),v=i("el-radio-button"),E=i("el-radio-group");return n(),c("div",rt,[s("div",ut,[s("div",ct,[s("span",dt,a(e.$t("suno.name.referenceAudios")),1),o(p,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),o(g,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=k=>e.fileList=k),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:r(()=>[o(m,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:r(()=>[o(_,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+a(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"]),e.hasUploadedAudio?(n(),c("div",pt,[o(E,{modelValue:e.uploadAction,"onUpdate:modelValue":t[1]||(t[1]=k=>e.uploadAction=k),size:"small"},{default:r(()=>[o(v,{value:"upload_extend"},{default:r(()=>[w(a(e.$t("suno.button.extend")),1)]),_:1}),o(v,{value:"upload_cover"},{default:r(()=>[w(a(e.$t("suno.button.upload_cover")),1)]),_:1})]),_:1},8,["modelValue"])])):d("",!0)])}const ft=A(lt,[["render",mt],["__scopeId","data-v-b5153405"]]),ht="",_t=C({name:"PromptInput",components:{ElInput:z,InfoIcon:P},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),gt={class:"field"},$t={class:"flex items-center mb-1"},vt={class:"text-sm font-bold"};function yt(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-input");return n(),c("div",gt,[s("div",$t,[s("span",vt,a(e.$t("suno.name.songDescription")),1),o(p,{content:e.$t("suno.description.prompt")},null,8,["content"])]),o(_,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=m=>e.prompt=m),rows:4,type:"textarea",placeholder:e.$t("suno.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const kt=A(_t,[["render",yt]]),bt="",wt=C({name:"LyricInput",components:{ElInput:z,ElButton:N,FontAwesomeIcon:D,InfoIcon:P},data(){return{generatingLyrics:!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||(this.lyric=bt)},methods:{async onGenerateLyrics(){const e=this.credential?.token;if(!e)return;const t=this.config?.style||this.config?.title||"a beautiful song";this.generatingLyrics=!0,b.info(this.$t("suno.message.generatingLyrics"));try{const l=(await I.lyric({prompt:t},{token:e})).data?.data;l?.text&&(this.lyric=l.text,l?.title&&!this.config?.title&&this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:l.text,title:l.title}),b.success(this.$t("suno.message.generateLyricsSuccess")))}catch{b.error(this.$t("suno.message.generateLyricsFailed"))}finally{this.generatingLyrics=!1}}}}),Ct={class:"field"},Vt={class:"flex items-center justify-between mb-1"},St={class:"flex items-center"},At={class:"text-sm font-bold"};function Ut(e,t,u,l,$,h){const p=i("info-icon"),_=i("font-awesome-icon"),m=i("el-button"),g=i("el-input");return n(),c("div",Ct,[s("div",Vt,[s("div",St,[s("span",At,a(e.$t("suno.name.lyrics")),1),o(p,{content:e.$t("suno.description.lyrics")},null,8,["content"])]),e.config?.action!=="extend"?(n(),y(m,{key:0,size:"small",loading:e.generatingLyrics,round:"",onClick:e.onGenerateLyrics},{default:r(()=>[e.generatingLyrics?d("",!0):(n(),y(_,{key:0,icon:"fa-solid fa-wand-magic-sparkles",class:"mr-1"})),w(" "+a(e.$t("suno.button.generate_lyrics")),1)]),_:1},8,["loading","onClick"])):d("",!0)]),e.config?.action!=="extend"?(n(),y(g,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=v=>e.lyric=v),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics")},null,8,["modelValue","placeholder"])):(n(),y(g,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=v=>e.lyric=v),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics")},null,8,["modelValue","placeholder"]))])}const Et=A(wt,[["render",Ut],["__scopeId","data-v-210d2670"]]),Pt=C({name:"StyleInput",components:{ElInput:z,ElButton:N,FontAwesomeIcon:D,InfoIcon:P},data(){return{optimizing:!1}},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}},methods:{async onOptimizeStyle(){const e=this.credential?.token;if(!(!e||!this.style)){this.optimizing=!0,b.info(this.$t("suno.message.optimizingStyle"));try{const t=await I.style({prompt:this.style},{token:e}),u=t.data?.text||t.data?.data?.text;u&&(this.style=u,b.success(this.$t("suno.message.optimizeStyleSuccess")))}catch{b.error(this.$t("suno.message.optimizeStyleFailed"))}finally{this.optimizing=!1}}}}}),It={class:"field"},Tt={class:"flex items-center justify-between mb-1"},Gt={class:"flex items-center"},Lt={class:"text-sm font-bold"};function Ft(e,t,u,l,$,h){const p=i("info-icon"),_=i("font-awesome-icon"),m=i("el-button"),g=i("el-input");return n(),c("div",It,[s("div",Tt,[s("div",Gt,[s("span",Lt,a(e.$t("suno.name.style")),1),o(p,{content:e.$t("suno.description.style")},null,8,["content"])]),o(m,{size:"small",loading:e.optimizing,round:"",onClick:e.onOptimizeStyle},{default:r(()=>[e.optimizing?d("",!0):(n(),y(_,{key:0,icon:"fa-solid fa-wand-magic-sparkles",class:"mr-1"})),w(" "+a(e.$t("suno.button.optimize_style")),1)]),_:1},8,["loading","onClick"])]),o(g,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=v=>e.style=v),rows:2,type:"textarea",placeholder:e.$t("suno.placeholder.style")},null,8,["modelValue","placeholder"])])}const jt=A(Pt,[["render",Ft]]),Dt=C({name:"TitleInput",components:{ElInput:z,InfoIcon:P},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}}}}),zt={class:"field"},Rt={class:"flex items-center mb-1"},Mt={class:"text-sm font-bold"};function Ot(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-input");return n(),c("div",zt,[s("div",Rt,[s("span",Mt,a(e.$t("suno.name.title")),1),o(p,{content:e.$t("suno.description.title")},null,8,["content"])]),o(_,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=m=>e.title=m),placeholder:e.$t("suno.placeholder.title")},null,8,["modelValue","placeholder"])])}const Nt=A(Dt,[["render",Ot]]),Wt=C({name:"ExtendFromInput",components:{ElImage:L,ElIcon:Y,ElInputNumber:W,VideoPlay:ee,VideoPause:x},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||(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:O,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})}}}),qt={class:"field"},Bt={class:"box"},Kt={class:"title font-bold"},Ht={class:"input-wrapper"},Jt={class:"task"},Yt={class:"left"},Qt={key:2,class:"duration"},Xt={class:"info"},Zt={class:"title"},xt={class:"style"};function es(e,t,u,l,$,h){const p=i("el-input-number"),_=i("el-image"),m=i("video-pause"),g=i("el-icon"),v=i("video-play"),E=j("loading");return n(),c("div",qt,[s("div",Bt,[s("h2",Kt,a(e.$t("suno.name.extend")),1),s("div",Ht,[o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=k=>e.value=k),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"])])]),s("div",Jt,[e.audio?(n(),c("div",{key:0,class:"audio",onClick:t[3]||(t[3]=k=>e.onClick(e.audio))},[F((n(),c("div",Yt,[o(_,{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"?(n(),c("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPause(e.audio))},[o(g,null,{default:r(()=>[o(m)]),_:1})])):d("",!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")?(n(),c("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=k=>e.onPlay(e.audio))},[o(g,null,{default:r(()=>[o(v)]),_:1})])):d("",!0),e.audio?.duration?(n(),c("div",Qt,a(e.useFormatDuring(e.audio?.duration)),1)):d("",!0)])),[[E,!e.audio?.audio_url]]),s("div",Xt,[s("h2",Zt,a(e.audio?.title),1),s("p",xt,a(e.audio?.style),1)])])):d("",!0)])])}const ts=A(Wt,[["render",es],["__scopeId","data-v-bcce4821"]]),ss=C({name:"CoverFromInput",components:{ElImage:L,ElIcon:Y,VideoPlay:ee,VideoPause:x},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||(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:O,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})}}}),os={class:"field"},ns={class:"box"},is={class:"title font-bold"},as={class:"task"},ls={class:"left"},rs={key:2,class:"duration"},us={class:"info"},cs={class:"title"},ds={class:"style"};function ps(e,t,u,l,$,h){const p=i("el-image"),_=i("video-pause"),m=i("el-icon"),g=i("video-play"),v=j("loading");return n(),c("div",os,[s("div",ns,[s("h2",is,a(e.$t("suno.name.cover")),1)]),s("div",as,[e.audio?(n(),c("div",{key:0,class:"audio",onClick:t[2]||(t[2]=E=>e.onClick(e.audio))},[F((n(),c("div",ls,[o(p,{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"?(n(),c("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=E=>e.onPause(e.audio))},[o(m,null,{default:r(()=>[o(_)]),_:1})])):d("",!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")?(n(),c("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=E=>e.onPlay(e.audio))},[o(m,null,{default:r(()=>[o(g)]),_:1})])):d("",!0),e.audio?.duration?(n(),c("div",rs,a(e.useFormatDuring(e.audio?.duration)),1)):d("",!0)])),[[v,!e.audio?.audio_url]]),s("div",us,[s("h2",cs,a(e.audio?.title),1),s("p",ds,a(e.audio?.style),1)])])):d("",!0)])])}const ms=A(ss,[["render",ps],["__scopeId","data-v-06640216"]]),fs=C({name:"VocalGenderSelector",components:{ElRadioGroup:Z,ElRadioButton:X,InfoIcon:P},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})}}}}),hs={class:"mb-2"},_s={class:"flex items-center mb-1"},gs={class:"text-sm font-bold"};function $s(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-radio-button"),m=i("el-radio-group");return n(),c("div",hs,[s("div",_s,[s("span",gs,a(e.$t("suno.name.vocalGender")),1),o(p,{content:e.$t("suno.description.vocalGender")},null,8,["content"])]),o(m,{modelValue:e.vocalGender,"onUpdate:modelValue":t[0]||(t[0]=g=>e.vocalGender=g)},{default:r(()=>[o(_,{value:""},{default:r(()=>[w(a(e.$t("suno.gender.auto")),1)]),_:1}),o(_,{value:"f"},{default:r(()=>[w(a(e.$t("suno.gender.female")),1)]),_:1}),o(_,{value:"m"},{default:r(()=>[w(a(e.$t("suno.gender.male")),1)]),_:1})]),_:1},8,["modelValue"])])}const vs=A(fs,[["render",$s]]),ys=C({name:"AdvancedParams",components:{ElCollapse:he,ElCollapseItem:fe,ElInput:z,ElSlider:te,ElRadioGroup:Z,ElRadioButton:X},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.suno?.config},isV5OrAbove(){const 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??50},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??50},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_weight:e})}}}}),ks={key:0,class:"mb-3"},bs={class:"flex items-center mb-1"},ws={class:"text-xs font-bold"},Cs={key:1,class:"mb-3"},Vs={class:"flex items-center mb-1"},Ss={class:"text-xs font-bold"},As={key:2,class:"mb-3"},Us={class:"flex items-center justify-between mb-1"},Es={class:"text-xs font-bold"},Ps={class:"text-xs text-[var(--el-text-color-secondary)]"},Is={key:3,class:"mb-3"},Ts={class:"flex items-center justify-between mb-1"},Gs={class:"text-xs font-bold"},Ls={class:"text-xs text-[var(--el-text-color-secondary)]"},Fs={key:4,class:"mb-3"},js={class:"flex items-center mb-1"},Ds={class:"text-xs font-bold"},zs={key:5,class:"mb-3"},Rs={class:"flex items-center justify-between mb-1"},Ms={class:"text-xs font-bold"},Os={class:"text-xs text-[var(--el-text-color-secondary)]"};function Ns(e,t,u,l,$,h){const p=i("el-input"),_=i("el-slider"),m=i("el-radio-button"),g=i("el-radio-group"),v=i("el-collapse-item"),E=i("el-collapse");return n(),y(E,{modelValue:e.activeNames,"onUpdate:modelValue":t[6]||(t[6]=k=>e.activeNames=k),class:"advanced-collapse"},{default:r(()=>[o(v,{title:e.$t("suno.name.advancedParams"),name:"advanced"},{default:r(()=>[e.config?.custom?(n(),c("div",ks,[s("div",bs,[s("span",ws,a(e.$t("suno.name.styleNegative")),1)]),o(p,{modelValue:e.styleNegative,"onUpdate:modelValue":t[0]||(t[0]=k=>e.styleNegative=k),placeholder:e.$t("suno.placeholder.styleNegative")},null,8,["modelValue","placeholder"])])):d("",!0),e.config?.custom&&!e.config?.instrumental?(n(),c("div",Cs,[s("div",Vs,[s("span",Ss,a(e.$t("suno.name.lyricPrompt")),1)]),o(p,{modelValue:e.lyricPrompt,"onUpdate:modelValue":t[1]||(t[1]=k=>e.lyricPrompt=k),placeholder:e.$t("suno.placeholder.lyricPrompt")},null,8,["modelValue","placeholder"])])):d("",!0),e.config?.custom?(n(),c("div",As,[s("div",Us,[s("span",Es,a(e.$t("suno.name.weirdness")),1),s("span",Ps,a(e.weirdness??0),1)]),o(_,{modelValue:e.weirdness,"onUpdate:modelValue":t[2]||(t[2]=k=>e.weirdness=k),min:0,max:100,step:1},null,8,["modelValue"])])):d("",!0),e.config?.custom?(n(),c("div",Is,[s("div",Ts,[s("span",Gs,a(e.$t("suno.name.styleInfluence")),1),s("span",Ls,a(e.styleInfluence??50),1)]),o(_,{modelValue:e.styleInfluence,"onUpdate:modelValue":t[3]||(t[3]=k=>e.styleInfluence=k),min:0,max:100,step:1},null,8,["modelValue"])])):d("",!0),e.isV5OrAbove?(n(),c("div",Fs,[s("div",js,[s("span",Ds,a(e.$t("suno.name.variationCategory")),1)]),o(g,{modelValue:e.variationCategory,"onUpdate:modelValue":t[4]||(t[4]=k=>e.variationCategory=k)},{default:r(()=>[o(m,{value:""},{default:r(()=>[w(a(e.$t("suno.gender.auto")),1)]),_:1}),o(m,{value:"high"},{default:r(()=>[w(a(e.$t("suno.variation.high")),1)]),_:1}),o(m,{value:"low"},{default:r(()=>[w(a(e.$t("suno.variation.low")),1)]),_:1})]),_:1},8,["modelValue"])])):d("",!0),e.config?.action==="cover"?(n(),c("div",zs,[s("div",Rs,[s("span",Ms,a(e.$t("suno.name.audioWeight")),1),s("span",Os,a(e.audioWeight??50),1)]),o(_,{modelValue:e.audioWeight,"onUpdate:modelValue":t[5]||(t[5]=k=>e.audioWeight=k),min:0,max:100,step:1},null,8,["modelValue"])])):d("",!0)]),_:1},8,["title"])]),_:1},8,["modelValue"])}const Ws=A(ys,[["render",Ns],["__scopeId","data-v-a6d82e2a"]]),qs=C({name:"ReplaceSectionInput",components:{ElInputNumber:W,ElImage:L,InfoIcon:P},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"})}}}),Bs={class:"field"},Ks={class:"flex items-center mb-2"},Hs={class:"text-sm font-bold m-0"},Js={key:0,class:"task mb-2"},Ys={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},Qs={class:"info flex-1 min-w-0"},Xs={class:"text-sm font-bold m-0 truncate"},Zs={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},xs={class:"flex gap-2"};function eo(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-image"),m=i("el-input-number"),g=j("loading");return n(),c("div",Bs,[s("div",Ks,[s("h2",Hs,a(e.$t("suno.name.replaceSection")),1),o(p,{content:e.$t("suno.description.replaceSection")},null,8,["content"])]),e.audio?(n(),c("div",Js,[s("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=v=>e.onClick(e.audio))},[F((n(),c("div",Ys,[o(_,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[g,!e.audio?.audio_url]]),s("div",Qs,[s("h2",Xs,a(e.audio?.title),1),s("p",Zs,a(e.audio?.style),1)])])])):d("",!0),s("div",xs,[o(m,{modelValue:e.replaceSectionStart,"onUpdate:modelValue":t[1]||(t[1]=v=>e.replaceSectionStart=v),class:"flex-1",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.replaceSectionStart")},null,8,["modelValue","max","placeholder"]),o(m,{modelValue:e.replaceSectionEnd,"onUpdate:modelValue":t[2]||(t[2]=v=>e.replaceSectionEnd=v),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"])])])}const to=A(qs,[["render",eo]]),so=C({name:"OverpaintingInput",components:{ElInputNumber:W,ElImage:L,InfoIcon:P},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"})}}}),oo={class:"field"},no={class:"flex items-center mb-2"},io={class:"text-sm font-bold m-0"},ao={key:0,class:"task mb-2"},lo={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},ro={class:"info flex-1 min-w-0"},uo={class:"text-sm font-bold m-0 truncate"},co={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},po={class:"flex gap-2"};function mo(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-image"),m=i("el-input-number"),g=j("loading");return n(),c("div",oo,[s("div",no,[s("h2",io,a(e.$t("suno.name.overpaintingRange")),1),o(p,{content:e.$t("suno.description.overpainting")},null,8,["content"])]),e.audio?(n(),c("div",ao,[s("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=v=>e.onClick(e.audio))},[F((n(),c("div",lo,[o(_,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[g,!e.audio?.audio_url]]),s("div",ro,[s("h2",uo,a(e.audio?.title),1),s("p",co,a(e.audio?.style),1)])])])):d("",!0),s("div",po,[o(m,{modelValue:e.overpaintingStart,"onUpdate:modelValue":t[1]||(t[1]=v=>e.overpaintingStart=v),class:"flex-1",size:"small",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.overpaintingStart")},null,8,["modelValue","max","placeholder"]),o(m,{modelValue:e.overpaintingEnd,"onUpdate:modelValue":t[2]||(t[2]=v=>e.overpaintingEnd=v),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"])])])}const fo=A(so,[["render",mo]]),ho=C({name:"UnderpaintingInput",components:{ElInputNumber:W,ElImage:L,InfoIcon:P},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"})}}}),_o={class:"field"},go={class:"flex items-center mb-2"},$o={class:"text-sm font-bold m-0"},vo={key:0,class:"task mb-2"},yo={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},ko={class:"info flex-1 min-w-0"},bo={class:"text-sm font-bold m-0 truncate"},wo={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},Co={class:"flex gap-2"};function Vo(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-image"),m=i("el-input-number"),g=j("loading");return n(),c("div",_o,[s("div",go,[s("h2",$o,a(e.$t("suno.name.underpaintingRange")),1),o(p,{content:e.$t("suno.description.underpainting")},null,8,["content"])]),e.audio?(n(),c("div",vo,[s("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=v=>e.onClick(e.audio))},[F((n(),c("div",yo,[o(_,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[g,!e.audio?.audio_url]]),s("div",ko,[s("h2",bo,a(e.audio?.title),1),s("p",wo,a(e.audio?.style),1)])])])):d("",!0),s("div",Co,[o(m,{modelValue:e.underpaintingStart,"onUpdate:modelValue":t[1]||(t[1]=v=>e.underpaintingStart=v),class:"flex-1",size:"small",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.underpaintingStart")},null,8,["modelValue","max","placeholder"]),o(m,{modelValue:e.underpaintingEnd,"onUpdate:modelValue":t[2]||(t[2]=v=>e.underpaintingEnd=v),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"])])])}const So=A(ho,[["render",Vo]]),Ao=C({name:"SamplesInput",components:{ElInputNumber:W,ElImage:L,InfoIcon:P},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"})}}}),Uo={class:"field"},Eo={class:"flex items-center mb-2"},Po={class:"text-sm font-bold m-0"},Io={key:0,class:"task mb-2"},To={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},Go={class:"info flex-1 min-w-0"},Lo={class:"text-sm font-bold m-0 truncate"},Fo={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},jo={class:"flex gap-2"};function Do(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-image"),m=i("el-input-number"),g=j("loading");return n(),c("div",Uo,[s("div",Eo,[s("h2",Po,a(e.$t("suno.name.samplesRange")),1),o(p,{content:e.$t("suno.description.samples")},null,8,["content"])]),e.audio?(n(),c("div",Io,[s("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=v=>e.onClick(e.audio))},[F((n(),c("div",To,[o(_,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[g,!e.audio?.audio_url]]),s("div",Go,[s("h2",Lo,a(e.audio?.title),1),s("p",Fo,a(e.audio?.style),1)])])])):d("",!0),s("div",jo,[o(m,{modelValue:e.samplesStart,"onUpdate:modelValue":t[1]||(t[1]=v=>e.samplesStart=v),class:"flex-1",size:"small",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.samplesStart")},null,8,["modelValue","max","placeholder"]),o(m,{modelValue:e.samplesEnd,"onUpdate:modelValue":t[2]||(t[2]=v=>e.samplesEnd=v),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"])])])}const zo=A(Ao,[["render",Do]]),Ro=C({name:"PersonaInput",components:{ElInput:z,InfoIcon:P},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})}}}}),Mo={class:"field"},Oo={class:"flex items-center mb-2"},No={class:"text-sm font-bold m-0"};function Wo(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-input");return n(),c("div",Mo,[s("div",Oo,[s("h2",No,a(e.$t("suno.name.persona")),1),o(p,{content:e.$t("suno.description.persona")},null,8,["content"])]),o(_,{modelValue:e.personaId,"onUpdate:modelValue":t[0]||(t[0]=m=>e.personaId=m),size:"small",placeholder:e.$t("suno.placeholder.personaId")},null,8,["modelValue","placeholder"])])}const qo=A(Ro,[["render",Wo]]),Bo=C({name:"PresetPanel",components:{TypeSelector:at,PromptInput:kt,LyricInput:Et,StyleInput:jt,TitleInput:Nt,ExtendFromInput:ts,CoverFromInput:ms,UploadAudio:ft,VocalGenderSelector:vs,AdvancedParams:Ws,ReplaceSectionInput:to,OverpaintingInput:fo,UnderpaintingInput:So,SamplesInput:zo,PersonaInput:qo,FontAwesomeIcon:D,ElButton:N,Consumption:ze},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Re(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service},supportsVocalGender(){const e=this.config?.model||"";return["chirp-v4-5-plus","chirp-v5","chirp-v5-5"].includes(e)},supportsPersona(){const e=this.config?.action;return!e||e==="generate"||e==="artist_consistency"||e==="artist_consistency_vox"},generateButtonText(){const 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"):this.$t("suno.button.generate")}},methods:{onGenerate(){this.$emit("generate")}}}),Ko={class:"flex flex-col h-full"},Ho={class:"flex-1 overflow-y-auto p-5"},Jo={class:"flex flex-col items-center justify-center px-5 pb-5"};function Yo(e,t,u,l,$,h){const p=i("type-selector"),_=i("upload-audio"),m=i("prompt-input"),g=i("lyric-input"),v=i("style-input"),E=i("title-input"),k=i("vocal-gender-selector"),S=i("persona-input"),B=i("extend-from-input"),K=i("cover-from-input"),Q=i("replace-section-input"),f=i("overpainting-input"),V=i("underpainting-input"),ne=i("samples-input"),ie=i("advanced-params"),ae=i("consumption"),le=i("font-awesome-icon"),re=i("el-button");return n(),c("div",Ko,[s("div",Ho,[o(p,{class:"mb-4"}),o(_,{class:"mb-4"}),e.config?.custom?d("",!0):(n(),y(m,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(n(),y(g,{key:1,class:"mb-4"})):d("",!0),e.config?.custom?(n(),y(v,{key:2,class:"mb-4"})):d("",!0),e.config?.custom?(n(),y(E,{key:3,class:"mb-4"})):d("",!0),e.config?.custom&&!e.config.instrumental&&e.supportsVocalGender?(n(),y(k,{key:4,class:"mb-4"})):d("",!0),e.config?.custom&&e.supportsPersona?(n(),y(S,{key:5,class:"mb-4"})):d("",!0),e.config?.action==="extend"?(n(),y(B,{key:6,class:"mb-4"})):d("",!0),e.config?.action==="cover"?(n(),y(K,{key:7,class:"mb-4"})):d("",!0),e.config?.action==="replace_section"?(n(),y(Q,{key:8,class:"mb-4"})):d("",!0),e.config?.action==="overpainting"?(n(),y(f,{key:9,class:"mb-4"})):d("",!0),e.config?.action==="underpainting"?(n(),y(V,{key:10,class:"mb-4"})):d("",!0),e.config?.action==="samples"?(n(),y(ne,{key:11,class:"mb-4"})):d("",!0),o(ie,{class:"mb-4"})]),s("div",Jo,[o(ae,{value:e.consumption,service:e.service},null,8,["value","service"]),o(re,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:r(()=>[o(le,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+a(e.generateButtonText),1)]),_:1},8,["onClick"])])])}const Qo=A(Bo,[["render",Yo],["__scopeId","data-v-a9d5cfc6"]]),oe="https://webhook.acedata.cloud/suno",Xo=C({name:"TaskPreview",components:{ElImage:L,ElIcon:Y,ElTooltip:ye,FontAwesomeIcon:D,VideoPlay:ee,VideoPause:x,ElDropdown:ve,ElDropdownMenu:$e,ElDropdownItem:ge,Loading:_e},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,isFetchingMidi:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===R.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(u=>({...u,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:O,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);const l=new URL(t).pathname,$=l.substring(l.lastIndexOf("/")+1);console.log("on preview",$),fetch(t).then(h=>h.blob()).then(h=>{Ge.saveAs(h,$)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),b.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,u)=>{const l={audio_id:e},$=this.credential?.token;if(!$){console.error("no token specified"),u(new Error("No token specified"));return}I.mp4(l,{token:$}).then(h=>{const p=h.data?.data?.video_url;p?t(p):u(new Error("Video URL not found in response"))}).catch(h=>{u(h)})})},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})},async onExtractVocals(e){const t=this.credential?.token;t&&(b.info(this.$t("suno.message.extractingVocals")),I.vox({audio_id:e,callback_url:oe},{token:t}).then(()=>{b.success(this.$t("suno.message.extractVocalsSuccess"))}).catch(u=>{b.error(u?.response?.data?.error?.message||this.$t("suno.message.extractVocalsFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()}))},async onGetTiming(e){const t=this.credential?.token;t&&(b.info(this.$t("suno.message.fetchingTiming")),I.timing({audio_id:e},{token:t}).then(u=>{b.success(this.$t("suno.message.fetchTimingSuccess")),console.debug("timing data",u.data)}).catch(u=>{b.error(u?.response?.data?.error?.message||this.$t("suno.message.fetchTimingFailed"))}))},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;const t=this.credential?.token;if(t)try{this.isFetchingWav=!0,b.info(this.$t("suno.message.fetchingWav"));const l=(await I.wav({audio_id:e.id},{token:t})).data?.data?.audio_url;l?this.onDownload(null,l):b.error(this.$t("suno.message.fetchWavFailed"))}catch{b.error(this.$t("suno.message.fetchWavFailed"))}finally{this.isFetchingWav=!1}},async handleMidiDownload(e){if(!e?.id||this.isFetchingMidi)return;const t=this.credential?.token;if(t)try{this.isFetchingMidi=!0,b.info(this.$t("suno.message.fetchingMidi"));const l=(await I.midi({audio_id:e.id},{token:t})).data?.data?.midi_url;l?this.onDownload(null,l):b.error(this.$t("suno.message.fetchMidiFailed"))}catch{b.error(this.$t("suno.message.fetchMidiFailed"))}finally{this.isFetchingMidi=!1}},async onGenerateAudioUrl(e,t){const u={action:e,audio_id:t,callback_url:oe},l=this.credential?.token;if(!l){console.error("no token specified");return}b.info(this.$t("suno.message.startingTask")),I.audio(u,{token:l}).then(()=>{b.success(this.$t("suno.message.startTaskSuccess"))}).catch($=>{b.error($?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Zo={class:"task"},xo=["onClick"],en={class:"left"},tn=["onClick"],sn=["onClick"],on={key:2,class:"duration"},nn={class:"info"},an={class:"title"},ln={class:"style"},rn={class:"right"},un={class:"el-dropdown-link"},cn={class:"flex items-center min-w-[120px]"},dn={class:"flex items-center min-w-[120px]"},pn={class:"flex items-center min-w-[120px]"},mn={class:"el-dropdown-link"};function fn(e,t,u,l,$,h){const p=i("el-image"),_=i("video-pause"),m=i("el-icon"),g=i("video-play"),v=i("font-awesome-icon"),E=i("el-tooltip"),k=i("Loading"),S=i("el-dropdown-item"),B=i("el-dropdown-menu"),K=i("el-dropdown"),Q=j("loading");return n(),c("div",Zo,[(n(!0),c(M,null,J(e.audios,f=>(n(),c("div",{key:f.id,class:"audio",onClick:U(V=>e.onClick(f),["stop"])},[F((n(),c("div",en,[o(p,{src:f?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),f?.audio_url&&e.$store.state?.suno?.audio?.id===f.id&&e.$store.state?.suno?.audio?.state==="playing"?(n(),c("div",{key:0,class:"overlay",onClick:U(V=>e.onPause(f),["stop"])},[o(m,null,{default:r(()=>[o(_)]),_:1})],8,tn)):d("",!0),f?.audio_url&&(e.$store.state?.suno?.audio?.id!==f.id||e.$store.state?.suno?.audio?.id===f.id&&e.$store.state?.suno?.audio?.state==="paused")?(n(),c("div",{key:1,class:"overlay",onClick:U(V=>e.onPlay(f),["stop"])},[o(m,null,{default:r(()=>[o(g)]),_:1})],8,sn)):d("",!0),f?.duration?(n(),c("div",on,a(e.useFormatDuring(f?.duration)),1)):d("",!0)])),[[Q,!f?.audio_url]]),s("div",nn,[s("h2",an,a(f?.title),1),s("p",ln,a(f?.style),1)]),s("div",rn,[o(K,null,{dropdown:r(()=>[o(B,null,{default:r(()=>[o(S,{disabled:e.isFetchingVideoUrl,onClick:V=>e.handleVideoDownload(f)},{default:r(()=>[s("div",cn,[e.isFetchingVideoUrl?(n(),y(m,{key:0,class:"is-loading mr-2"},{default:r(()=>[o(k)]),_:1})):d("",!0),s("span",null,a(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),f?.audio_url?(n(),y(S,{key:0,onClick:U(V=>e.onDownload(V,f?.audio_url),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):d("",!0),o(S,{disabled:e.isFetchingWav,onClick:V=>e.handleWavDownload(f)},{default:r(()=>[s("div",dn,[e.isFetchingWav?(n(),y(m,{key:0,class:"is-loading mr-2"},{default:r(()=>[o(k)]),_:1})):d("",!0),s("span",null,a(e.$t("suno.button.download_wav")),1)])]),_:2},1032,["disabled","onClick"]),o(S,{disabled:e.isFetchingMidi,onClick:V=>e.handleMidiDownload(f)},{default:r(()=>[s("div",pn,[e.isFetchingMidi?(n(),y(m,{key:0,class:"is-loading mr-2"},{default:r(()=>[o(k)]),_:1})):d("",!0),s("span",null,a(e.$t("suno.button.download_midi")),1)])]),_:2},1032,["disabled","onClick"])]),_:2},1024)]),default:r(()=>[s("span",un,[o(E,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:r(()=>[f?.audio_url||f?.video_url?(n(),y(v,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):d("",!0)]),_:2},1032,["content"])])]),_:2},1024),o(K,null,{dropdown:r(()=>[o(B,null,{default:r(()=>[f?.audio_url?(n(),y(S,{key:0,onClick:U(V=>e.onExtend(V,f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):d("",!0),f.id?(n(),y(S,{key:1,onClick:U(V=>e.onGetStems(f.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):d("",!0),f.id?(n(),y(S,{key:2,onClick:U(V=>e.onGetAllStems(f.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.all_stems")),1)]),_:2},1032,["onClick"])):d("",!0),o(S,{onClick:U(V=>e.onCover(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),f?.id?(n(),y(S,{key:3,onClick:U(V=>e.onRemaster(f.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.remaster")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:4,onClick:U(V=>e.onReplaceSection(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.replace_section")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:5,onClick:U(V=>e.onMashup(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.mashup")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id&&f?.action==="extend"?(n(),y(S,{key:6,onClick:U(V=>e.onConcatMusic(f?.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:7,onClick:U(V=>e.onOverpainting(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.overpainting")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:8,onClick:U(V=>e.onUnderpainting(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.underpainting")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:9,onClick:U(V=>e.onSamples(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.samples")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:10,onClick:U(V=>e.onArtistConsistency(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.artist_consistency")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:11,onClick:U(V=>e.onExtractVocals(f.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.extract_vocals")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:12,onClick:U(V=>e.onGetTiming(f.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.get_timing")),1)]),_:2},1032,["onClick"])):d("",!0)]),_:2},1024)]),default:r(()=>[s("span",mn,[o(E,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:r(()=>[f?.audio_url||f?.video_url?(n(),y(v,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):d("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,xo))),128))])}const hn=A(Xo,[["render",fn]]),_n={class:"player-slider"},gn=C({__name:"PlayerSlider",setup(e){const t=q(),u=G({get:()=>t.state.suno?.audio?.progress,set:p=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:p})}),l=G({get:()=>t.state.suno?.audio?.duration,set:p=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:p})}),$=()=>{},h=p=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:p});return(p,_)=>(n(),c("div",_n,[o(T(te),{modelValue:u.value,"onUpdate:modelValue":_[0]||(_[0]=m=>u.value=m),"show-tooltip":!1,min:0,max:l.value,onChange:h,onInput:$},null,8,["modelValue","max"])]))}}),$n={class:"flex player-song"},vn=["src"],yn={class:"ml-2 text-xs flex flex-col justify-between"},kn={class:"w-52 2xl:w-96 cursor-pointer truncate"},bn={class:"flex"},wn={class:"ml-2 text-dc"},Cn=C({__name:"PlayerSong",setup(e){const t=q(),u=G({get:()=>t.state.suno.audio,set:l=>t.commit("suno/setAudio",l)});return Se(u,(l,$)=>{if(l?.audio_url!==$?.audio_url){console.log("audio changed",l),l.object&&(console.log("111",l.object),l.object.pause(),delete l.object);const h=new Audio(l.audio_url);l.state==="playing"?h.play():h.pause(),h.addEventListener("loadedmetadata",()=>{h.currentTime=0,h.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:h.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:h})}else if(l?.progress!==$?.progress&&Math.abs(l.progress-l.object.currentTime)>2){console.log("progress changed",l.progress);const h=t.state.suno.audio;h.object&&(h.object.currentTime=h.progress)}else l?.state!==$?.state&&(console.log("state changed",l.state),l.object&&(l.state==="playing"?l.object.play():l.object.pause()));l?.volume!==$?.volume&&(console.log("volume changed",l.volume),l.object&&(l.object.volume=l.volume/100))}),(l,$)=>(n(),c("div",$n,[s("img",{alt:"",class:"w-11 h-11 rounded",src:u.value?.image_url||T(Le)},null,8,vn),s("div",yn,[s("div",kn,[s("div",bn,[s("span",null,a(u.value?.title||"Music"),1),s("span",wn,"- "+a(u.value?.style||"SmallRuralDog"),1)])])])]))}}),Vn={class:"flex justify-end items-center gap-x-2.5"},Sn={class:"text-xs"},An=C({__name:"PlayerAction",setup(e){const t=q(),u=G({get:()=>t.state.suno?.audio?.progress,set:$=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:$})}),l=G({get:()=>t.state.suno?.audio?.duration,set:$=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:$})});return($,h)=>(n(),c("div",Vn,[s("span",Sn,a(T(O)(u.value))+" / "+a(T(O)(l.value)),1)]))}}),Un={class:"player-volume flex flex-col items-center pt-2"},En={class:"text-sm mt-3"},Pn=C({__name:"PlayerVolumeSlider",setup(e){const t=q(),u=G({get:()=>t.state.suno.audio?.volume,set:h=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:h})}),l=G({get:()=>t.state.suno.audio?.muted,set:h=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:h})}),$=h=>t.dispatch("suno/setVolume",h);return(h,p)=>(n(),c("div",Un,[o(T(te),{modelValue:u.value,"onUpdate:modelValue":p[0]||(p[0]=_=>u.value=_),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:l.value,onInput:$},null,8,["modelValue","disabled"]),s("div",En,a(u.value),1)]))}}),In={class:"flex items-center justify-center gap-x-3"},Tn=C({__name:"PlayerController",setup(e){const t=q(),u=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),l=G(()=>t.state.suno.audio);return($,h)=>(n(),c("div",In,[o(se,{icon:l.value?.state==="playing"?T(Fe):T(je),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:u},null,8,["icon"]),o(T(ke),{placement:"top",width:"50px",trigger:"click"},{reference:r(()=>[o(se,{icon:T(De),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:r(()=>[o(Pn)]),_:1})]))}}),Gn={class:"flex flex-col items-stretch h-20"},Ln={class:"flex grow px-5 items-center"},Fn={class:"flex-1"},jn={class:"flex-1"},Dn={class:"flex-1"},zn=C({__name:"Player",setup(e){return(t,u)=>(n(),c("div",Gn,[o(gn),s("div",Ln,[s("div",Fn,[o(Cn)]),s("div",jn,[o(Tn)]),s("div",Dn,[o(An)])])]))}}),Rn=C({name:"RecentPanel",components:{ElSkeletonItem:we,ElSkeleton:be,TaskPreview:hn,Player:zn,NoTasks:Me,ScrollList:Te},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Mn={key:0,class:"tasks"},On={class:"left w-[70px] p-[10px] flex items-center"},Nn={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},Wn={key:2,class:"w-full flex-1 flex items-center justify-center"},qn={class:"h-20"};function Bn(e,t,u,l,$,h){const p=i("el-skeleton-item"),_=i("el-skeleton"),m=i("task-preview"),g=i("scroll-list"),v=i("no-tasks"),E=i("player");return n(),c(M,null,[e.tasks?.items===void 0?(n(),c("div",Mn,[(n(),c(M,null,J(3,k=>s("div",{key:k,class:"flex"},[s("div",On,[o(_,{animated:""},{template:r(()=>[o(p,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),s("div",Nn,[o(_,{animated:""},{template:r(()=>[o(p,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),o(p,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),y(g,{key:1,ref:"scrollList",class:"flex-1 w-full overflow-y-auto tasks p-2",loading:e.loading,onReachTop:t[0]||(t[0]=k=>e.$emit("reach-top"))},{default:r(()=>[(n(!0),c(M,null,J(e.tasks?.items,(k,S)=>(n(),y(m,{key:S,"model-value":k,class:"preview"},null,8,["model-value"]))),128))]),_:1},8,["loading"])):d("",!0),e.tasks?.items?.length===0?(n(),c("div",Wn,[o(v)])):d("",!0),F(s("div",qn,[o(E)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const Kn=A(Rn,[["render",Bn]]),Hn=C({name:"TaskPreview",components:{IconPicture:Ve,ElImage:L,ElAvatar:Ce,ElIcon:Y},computed:{audio(){return this.$store.state.suno?.audio}}}),Jn={key:0,class:"size-full overflow-hidden"},Yn={class:"relative h-[300px]"},Qn={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Xn={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"},Zn={class:"p-4"},xn={class:"flex items-center font-bold mb-2"},ei={class:"text-[var(--el-text-color-regular)] mb-2"},ti={class:"text-xs text-[var(--el-text-color-regular)]"},si={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},oi={key:1,class:"w-full h-full"};function ni(e,t,u,l,$,h){const p=i("icon-picture"),_=i("el-icon"),m=i("el-image"),g=i("el-avatar");return e.audio?.object?(n(),c("div",Jn,[s("div",Yn,[o(m,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:r(()=>[s("div",Qn,[o(_,{class:"text-3xl"},{default:r(()=>[o(p)]),_:1})])]),_:1},8,["src"]),s("h2",Xn,a(e.audio?.title),1)]),s("div",Zn,[s("div",xn,[o(g,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),s("span",null,a(e.audio?.title),1)]),s("p",ei,a(e.audio?.style),1),s("p",ti,a(e.$dayjs.format(e.audio?.created_at)),1),s("div",si,[s("p",null,a(e.audio?.lyric),1)])])])):(n(),c("div",oi))}const ii=A(Hn,[["render",ni]]),ai="https://webhook.acedata.cloud/suno",li=C({name:"SunoIndex",components:{Layout:Je,ConfigPanel:Qo,RecentPanel:Kn,PreviewPanel:ii},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===R.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===R.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===R.Request},needApply(){return this.$store.state.suno.status.getApplications===R.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 Oe({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(){Pe.create({application:this.application}).then(({data:e})=>{this.application=e,b.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ie&&b.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const 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);const{limit:t=5,createdAtMin:u,createdAtMax:l}=e||{};console.debug("limit",t,"createdAtMin",u,"createdAtMax",l),this.fetchingTasks=!0;try{await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:u,createdAtMax:l})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){const e={...this.config,callback_url:ai},t=this.credential?.token;if(!t){console.error("no token specified");return}b.info(this.$t("suno.message.startingTask")),I.audio(e,{token:t}).then(()=>{b.success(this.$t("suno.message.startTaskSuccess"))}).catch(u=>{b.error(u?.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?.()}}});function ri(e,t,u,l,$,h){const p=i("config-panel"),_=i("recent-panel"),m=i("preview-panel"),g=i("layout");return n(),y(g,null,{config:r(()=>[o(p,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:r(()=>[o(_,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),preview:r(()=>[o(m)]),_:1})}const wi=A(li,[["render",ri],["__scopeId","data-v-d1296b1a"]]);export{wi as default};
1
+ import{F as D}from"./index.es-DMehEjXB.js";import{m as N,X as ue,k as ce,O as de,P as pe,F as Y,G as Z,u as me,w as b,t as z,a6 as x,a7 as ee,_ as W,e as X,j as L,$ as te,a8 as fe,a9 as he,l as _e,f as ge,g as $e,h as ve,q as ye,r as ke,L as be,a2 as we,aa as Ce,ab as Ve}from"./vendor-element-plus-CmP9-3lX.js";import{d as C,C as c,G as s,T as o,E as H,K as r,ai as i,D as n,O as d,R as a,S as M,ag as J,J as y,Q as w,L as F,aq as j,X as U,c as G,u as T,w as Se,U as Ae}from"./vendor-vue-BhXato7y.js";import{_ as A,ck as Ue,cl as I,av as Ee,aK as R,cm as q,aD as Pe,aJ as Ie}from"./index-CtkD2JaX.js";import{I as P,S as Te}from"./ScrollList-OteSDitY.js";import{u as O,F as Ge,O as Le,_ as se,P as Fe,a as je,V as De}from"./IconPark.vue_vue_type_script_setup_true_lang-C7eA9UI3.js";import{C as ze}from"./Consumption-DEB600BC.js";import{a as Re}from"./price-lQeFOa8Q.js";import{N as Me}from"./NoTasks-ZsLHgPuo.js";import{l as Oe}from"./pagination-DLJ2pbsx.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-C5RrfhAy.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";const Ne=C({name:"LayoutSuno",components:{ElDrawer:ue,ElButton:N,FontAwesomeIcon:D},data(){return{drawer:!1,preview:!1}},computed:{}}),We={class:"main flex flex-row flex-1"},qe={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},Be={class:"result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"},Ke={class:"preview h-full w-[300px] flex flex-col"};function He(e,t,u,l,$,h){const p=i("font-awesome-icon"),_=i("el-button"),m=i("el-drawer");return n(),c("div",We,[s("div",qe,[H(e.$slots,"config",{},void 0,!0)]),s("div",Be,[H(e.$slots,"result",{},void 0,!0)]),s("div",Ke,[H(e.$slots,"preview",{},void 0,!0)]),o(_,{circle:"",class:"menu",onClick:t[0]||(t[0]=g=>e.drawer=!0)},{default:r(()=>[o(p,{icon:"fa-solid fa-magic"})]),_:1}),o(m,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:r(()=>[H(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const Je=A(Ne,[["render",He],["__scopeId","data-v-c6c85757"]]),Xe=C({name:"TypeSelector",components:{ElSelect:pe,ElOption:de,ElSwitch:ce},data(){return{options:[{label:"Suno v5.5",value:"chirp-v5-5",info:"8 min"},{label:"Suno v5",value:"chirp-v5",info:"8 min"},{label:"Suno v4.5+",value:"chirp-v4-5-plus",info:"8 min"},{label:"Suno v4.5",value:"chirp-v4-5",info:"4 min"},{label:"Suno v4",value:"chirp-v4",info:"2.5 min"},{label:"Suno v3.5",value:"chirp-v3-5",info:"2 min"},{label:"Suno v3",value:"chirp-v3-0",info:"2 min"}]}},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||(this.model=Ue)}}),Qe={class:"flex items-center justify-between mb-3"},Ye={class:"text-sm font-bold"},Ze={class:"mb-3"},xe={class:"flex items-center mb-1"},et={class:"text-sm font-bold"},tt={class:"flex items-center justify-between w-full"},st={class:"text-xs text-[var(--el-text-color-placeholder)]"},ot={key:0,class:"flex items-center justify-between mb-3"},nt={class:"text-sm font-bold"};function it(e,t,u,l,$,h){const p=i("el-switch"),_=i("el-option"),m=i("el-select");return n(),c("div",null,[s("div",Qe,[s("span",Ye,a(e.$t("suno.name.type")),1),o(p,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=g=>e.custom=g)},null,8,["modelValue"])]),s("div",Ze,[s("div",xe,[s("span",et,a(e.$t("suno.name.model")),1)]),o(m,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=g=>e.model=g),class:"w-full",size:"default",placeholder:e.$t("suno.placeholder.select")},{default:r(()=>[(n(!0),c(M,null,J(e.options,g=>(n(),y(_,{key:g.value,label:g.label,value:g.value},{default:r(()=>[s("div",tt,[s("span",null,a(g.label),1),s("span",st,a(g.info),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),e.custom?(n(),c("div",ot,[s("span",nt,a(e.$t("suno.name.instrumental")),1),o(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[2]||(t[2]=g=>e.instrumental=g)},null,8,["modelValue"])])):d("",!0)])}const at=A(Xe,[["render",it]]),lt=C({name:"UploadAudio",components:{ElUpload:me,ElButton:N,InfoIcon:P,FontAwesomeIcon:D,ElRadioGroup:Z,ElRadioButton:Y},emits:["change"],data(){return{fileList:[],uploadUrl:Ee()+"/api/v1/files/"}},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(){const 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})}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){b.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){b.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},u=this.credential?.token;if(!u){console.error("no token specified");return}b.info(this.$t("suno.message.startingUploadAudio")),I.upload(t,{token:u}).then(l=>{console.debug("get upload music success",l.data);const $=l.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:$,action:"upload_extend"}),b.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(l=>{b.error(l?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),rt={class:"relative"},ut={class:"flex justify-between"},ct={class:"flex justify-start items-center"},dt={class:"text-sm font-bold"},pt={key:0,class:"mt-2"};function mt(e,t,u,l,$,h){const p=i("info-icon"),_=i("font-awesome-icon"),m=i("el-button"),g=i("el-upload"),v=i("el-radio-button"),E=i("el-radio-group");return n(),c("div",rt,[s("div",ut,[s("div",ct,[s("span",dt,a(e.$t("suno.name.referenceAudios")),1),o(p,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),o(g,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=k=>e.fileList=k),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:r(()=>[o(m,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:r(()=>[o(_,{icon:"fa-solid fa-upload",class:"icon mr-1"}),w(" "+a(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"]),e.hasUploadedAudio?(n(),c("div",pt,[o(E,{modelValue:e.uploadAction,"onUpdate:modelValue":t[1]||(t[1]=k=>e.uploadAction=k),size:"small"},{default:r(()=>[o(v,{value:"upload_extend"},{default:r(()=>[w(a(e.$t("suno.button.extend")),1)]),_:1}),o(v,{value:"upload_cover"},{default:r(()=>[w(a(e.$t("suno.button.upload_cover")),1)]),_:1})]),_:1},8,["modelValue"])])):d("",!0)])}const ft=A(lt,[["render",mt],["__scopeId","data-v-b5153405"]]),ht="",_t=C({name:"PromptInput",components:{ElInput:z,InfoIcon:P},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),gt={class:"field"},$t={class:"flex items-center mb-1"},vt={class:"text-sm font-bold"};function yt(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-input");return n(),c("div",gt,[s("div",$t,[s("span",vt,a(e.$t("suno.name.songDescription")),1),o(p,{content:e.$t("suno.description.prompt")},null,8,["content"])]),o(_,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=m=>e.prompt=m),rows:4,type:"textarea",placeholder:e.$t("suno.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const kt=A(_t,[["render",yt]]),bt="",wt=C({name:"LyricInput",components:{ElInput:z,ElButton:N,FontAwesomeIcon:D,InfoIcon:P},data(){return{generatingLyrics:!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||(this.lyric=bt)},methods:{async onGenerateLyrics(){const e=this.credential?.token;if(!e)return;const t=this.config?.style||this.config?.title||"a beautiful song";this.generatingLyrics=!0,b.info(this.$t("suno.message.generatingLyrics"));try{const l=(await I.lyric({prompt:t},{token:e})).data?.data;l?.text&&(this.lyric=l.text,l?.title&&!this.config?.title&&this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:l.text,title:l.title}),b.success(this.$t("suno.message.generateLyricsSuccess")))}catch{b.error(this.$t("suno.message.generateLyricsFailed"))}finally{this.generatingLyrics=!1}}}}),Ct={class:"field"},Vt={class:"flex items-center justify-between mb-1"},St={class:"flex items-center"},At={class:"text-sm font-bold"};function Ut(e,t,u,l,$,h){const p=i("info-icon"),_=i("font-awesome-icon"),m=i("el-button"),g=i("el-input");return n(),c("div",Ct,[s("div",Vt,[s("div",St,[s("span",At,a(e.$t("suno.name.lyrics")),1),o(p,{content:e.$t("suno.description.lyrics")},null,8,["content"])]),e.config?.action!=="extend"?(n(),y(m,{key:0,size:"small",loading:e.generatingLyrics,round:"",onClick:e.onGenerateLyrics},{default:r(()=>[e.generatingLyrics?d("",!0):(n(),y(_,{key:0,icon:"fa-solid fa-wand-magic-sparkles",class:"mr-1"})),w(" "+a(e.$t("suno.button.generate_lyrics")),1)]),_:1},8,["loading","onClick"])):d("",!0)]),e.config?.action!=="extend"?(n(),y(g,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=v=>e.lyric=v),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics")},null,8,["modelValue","placeholder"])):(n(),y(g,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=v=>e.lyric=v),rows:5,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics")},null,8,["modelValue","placeholder"]))])}const Et=A(wt,[["render",Ut],["__scopeId","data-v-210d2670"]]),Pt=C({name:"StyleInput",components:{ElInput:z,ElButton:N,FontAwesomeIcon:D,InfoIcon:P},data(){return{optimizing:!1}},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}},methods:{async onOptimizeStyle(){const e=this.credential?.token;if(!(!e||!this.style)){this.optimizing=!0,b.info(this.$t("suno.message.optimizingStyle"));try{const t=await I.style({prompt:this.style},{token:e}),u=t.data?.text||t.data?.data?.text;u&&(this.style=u,b.success(this.$t("suno.message.optimizeStyleSuccess")))}catch{b.error(this.$t("suno.message.optimizeStyleFailed"))}finally{this.optimizing=!1}}}}}),It={class:"field"},Tt={class:"flex items-center justify-between mb-1"},Gt={class:"flex items-center"},Lt={class:"text-sm font-bold"};function Ft(e,t,u,l,$,h){const p=i("info-icon"),_=i("font-awesome-icon"),m=i("el-button"),g=i("el-input");return n(),c("div",It,[s("div",Tt,[s("div",Gt,[s("span",Lt,a(e.$t("suno.name.style")),1),o(p,{content:e.$t("suno.description.style")},null,8,["content"])]),o(m,{size:"small",loading:e.optimizing,round:"",onClick:e.onOptimizeStyle},{default:r(()=>[e.optimizing?d("",!0):(n(),y(_,{key:0,icon:"fa-solid fa-wand-magic-sparkles",class:"mr-1"})),w(" "+a(e.$t("suno.button.optimize_style")),1)]),_:1},8,["loading","onClick"])]),o(g,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=v=>e.style=v),rows:2,type:"textarea",placeholder:e.$t("suno.placeholder.style")},null,8,["modelValue","placeholder"])])}const jt=A(Pt,[["render",Ft]]),Dt=C({name:"TitleInput",components:{ElInput:z,InfoIcon:P},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}}}}),zt={class:"field"},Rt={class:"flex items-center mb-1"},Mt={class:"text-sm font-bold"};function Ot(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-input");return n(),c("div",zt,[s("div",Rt,[s("span",Mt,a(e.$t("suno.name.title")),1),o(p,{content:e.$t("suno.description.title")},null,8,["content"])]),o(_,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=m=>e.title=m),placeholder:e.$t("suno.placeholder.title")},null,8,["modelValue","placeholder"])])}const Nt=A(Dt,[["render",Ot]]),Wt=C({name:"ExtendFromInput",components:{ElImage:L,ElIcon:X,ElInputNumber:W,VideoPlay:ee,VideoPause:x},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||(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:O,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})}}}),qt={class:"field"},Bt={class:"box"},Kt={class:"title font-bold"},Ht={class:"input-wrapper"},Jt={class:"task"},Xt={class:"left"},Qt={key:2,class:"duration"},Yt={class:"info"},Zt={class:"title"},xt={class:"style"};function es(e,t,u,l,$,h){const p=i("el-input-number"),_=i("el-image"),m=i("video-pause"),g=i("el-icon"),v=i("video-play"),E=j("loading");return n(),c("div",qt,[s("div",Bt,[s("h2",Kt,a(e.$t("suno.name.extend")),1),s("div",Ht,[o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=k=>e.value=k),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"])])]),s("div",Jt,[e.audio?(n(),c("div",{key:0,class:"audio",onClick:t[3]||(t[3]=k=>e.onClick(e.audio))},[F((n(),c("div",Xt,[o(_,{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"?(n(),c("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPause(e.audio))},[o(g,null,{default:r(()=>[o(m)]),_:1})])):d("",!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")?(n(),c("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=k=>e.onPlay(e.audio))},[o(g,null,{default:r(()=>[o(v)]),_:1})])):d("",!0),e.audio?.duration?(n(),c("div",Qt,a(e.useFormatDuring(e.audio?.duration)),1)):d("",!0)])),[[E,!e.audio?.audio_url]]),s("div",Yt,[s("h2",Zt,a(e.audio?.title),1),s("p",xt,a(e.audio?.style),1)])])):d("",!0)])])}const ts=A(Wt,[["render",es],["__scopeId","data-v-bcce4821"]]),ss=C({name:"CoverFromInput",components:{ElImage:L,ElIcon:X,VideoPlay:ee,VideoPause:x},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||(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:O,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})}}}),os={class:"field"},ns={class:"box"},is={class:"title font-bold"},as={class:"task"},ls={class:"left"},rs={key:2,class:"duration"},us={class:"info"},cs={class:"title"},ds={class:"style"};function ps(e,t,u,l,$,h){const p=i("el-image"),_=i("video-pause"),m=i("el-icon"),g=i("video-play"),v=j("loading");return n(),c("div",os,[s("div",ns,[s("h2",is,a(e.$t("suno.name.cover")),1)]),s("div",as,[e.audio?(n(),c("div",{key:0,class:"audio",onClick:t[2]||(t[2]=E=>e.onClick(e.audio))},[F((n(),c("div",ls,[o(p,{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"?(n(),c("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=E=>e.onPause(e.audio))},[o(m,null,{default:r(()=>[o(_)]),_:1})])):d("",!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")?(n(),c("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=E=>e.onPlay(e.audio))},[o(m,null,{default:r(()=>[o(g)]),_:1})])):d("",!0),e.audio?.duration?(n(),c("div",rs,a(e.useFormatDuring(e.audio?.duration)),1)):d("",!0)])),[[v,!e.audio?.audio_url]]),s("div",us,[s("h2",cs,a(e.audio?.title),1),s("p",ds,a(e.audio?.style),1)])])):d("",!0)])])}const ms=A(ss,[["render",ps],["__scopeId","data-v-06640216"]]),fs=C({name:"VocalGenderSelector",components:{ElRadioGroup:Z,ElRadioButton:Y,InfoIcon:P},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})}}}}),hs={class:"mb-2"},_s={class:"flex items-center mb-1"},gs={class:"text-sm font-bold"};function $s(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-radio-button"),m=i("el-radio-group");return n(),c("div",hs,[s("div",_s,[s("span",gs,a(e.$t("suno.name.vocalGender")),1),o(p,{content:e.$t("suno.description.vocalGender")},null,8,["content"])]),o(m,{modelValue:e.vocalGender,"onUpdate:modelValue":t[0]||(t[0]=g=>e.vocalGender=g)},{default:r(()=>[o(_,{value:""},{default:r(()=>[w(a(e.$t("suno.gender.auto")),1)]),_:1}),o(_,{value:"f"},{default:r(()=>[w(a(e.$t("suno.gender.female")),1)]),_:1}),o(_,{value:"m"},{default:r(()=>[w(a(e.$t("suno.gender.male")),1)]),_:1})]),_:1},8,["modelValue"])])}const vs=A(fs,[["render",$s]]),ys=C({name:"AdvancedParams",components:{ElCollapse:he,ElCollapseItem:fe,ElInput:z,ElSlider:te,ElRadioGroup:Z,ElRadioButton:Y},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.suno?.config},isV5OrAbove(){const 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??50},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??50},set(e){this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_weight:e})}}}}),ks={key:0,class:"mb-3"},bs={class:"flex items-center mb-1"},ws={class:"text-xs font-bold"},Cs={key:1,class:"mb-3"},Vs={class:"flex items-center mb-1"},Ss={class:"text-xs font-bold"},As={key:2,class:"mb-3"},Us={class:"flex items-center justify-between mb-1"},Es={class:"text-xs font-bold"},Ps={class:"text-xs text-[var(--el-text-color-secondary)]"},Is={key:3,class:"mb-3"},Ts={class:"flex items-center justify-between mb-1"},Gs={class:"text-xs font-bold"},Ls={class:"text-xs text-[var(--el-text-color-secondary)]"},Fs={key:4,class:"mb-3"},js={class:"flex items-center mb-1"},Ds={class:"text-xs font-bold"},zs={key:5,class:"mb-3"},Rs={class:"flex items-center justify-between mb-1"},Ms={class:"text-xs font-bold"},Os={class:"text-xs text-[var(--el-text-color-secondary)]"};function Ns(e,t,u,l,$,h){const p=i("el-input"),_=i("el-slider"),m=i("el-radio-button"),g=i("el-radio-group"),v=i("el-collapse-item"),E=i("el-collapse");return n(),y(E,{modelValue:e.activeNames,"onUpdate:modelValue":t[6]||(t[6]=k=>e.activeNames=k),class:"advanced-collapse"},{default:r(()=>[o(v,{title:e.$t("suno.name.advancedParams"),name:"advanced"},{default:r(()=>[e.config?.custom?(n(),c("div",ks,[s("div",bs,[s("span",ws,a(e.$t("suno.name.styleNegative")),1)]),o(p,{modelValue:e.styleNegative,"onUpdate:modelValue":t[0]||(t[0]=k=>e.styleNegative=k),placeholder:e.$t("suno.placeholder.styleNegative")},null,8,["modelValue","placeholder"])])):d("",!0),e.config?.custom&&!e.config?.instrumental?(n(),c("div",Cs,[s("div",Vs,[s("span",Ss,a(e.$t("suno.name.lyricPrompt")),1)]),o(p,{modelValue:e.lyricPrompt,"onUpdate:modelValue":t[1]||(t[1]=k=>e.lyricPrompt=k),placeholder:e.$t("suno.placeholder.lyricPrompt")},null,8,["modelValue","placeholder"])])):d("",!0),e.config?.custom?(n(),c("div",As,[s("div",Us,[s("span",Es,a(e.$t("suno.name.weirdness")),1),s("span",Ps,a(e.weirdness??0),1)]),o(_,{modelValue:e.weirdness,"onUpdate:modelValue":t[2]||(t[2]=k=>e.weirdness=k),min:0,max:100,step:1},null,8,["modelValue"])])):d("",!0),e.config?.custom?(n(),c("div",Is,[s("div",Ts,[s("span",Gs,a(e.$t("suno.name.styleInfluence")),1),s("span",Ls,a(e.styleInfluence??50),1)]),o(_,{modelValue:e.styleInfluence,"onUpdate:modelValue":t[3]||(t[3]=k=>e.styleInfluence=k),min:0,max:100,step:1},null,8,["modelValue"])])):d("",!0),e.isV5OrAbove?(n(),c("div",Fs,[s("div",js,[s("span",Ds,a(e.$t("suno.name.variationCategory")),1)]),o(g,{modelValue:e.variationCategory,"onUpdate:modelValue":t[4]||(t[4]=k=>e.variationCategory=k)},{default:r(()=>[o(m,{value:""},{default:r(()=>[w(a(e.$t("suno.gender.auto")),1)]),_:1}),o(m,{value:"high"},{default:r(()=>[w(a(e.$t("suno.variation.high")),1)]),_:1}),o(m,{value:"low"},{default:r(()=>[w(a(e.$t("suno.variation.low")),1)]),_:1})]),_:1},8,["modelValue"])])):d("",!0),e.config?.action==="cover"?(n(),c("div",zs,[s("div",Rs,[s("span",Ms,a(e.$t("suno.name.audioWeight")),1),s("span",Os,a(e.audioWeight??50),1)]),o(_,{modelValue:e.audioWeight,"onUpdate:modelValue":t[5]||(t[5]=k=>e.audioWeight=k),min:0,max:100,step:1},null,8,["modelValue"])])):d("",!0)]),_:1},8,["title"])]),_:1},8,["modelValue"])}const Ws=A(ys,[["render",Ns],["__scopeId","data-v-a6d82e2a"]]),qs=C({name:"ReplaceSectionInput",components:{ElInputNumber:W,ElImage:L,InfoIcon:P},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"})}}}),Bs={class:"field"},Ks={class:"flex items-center mb-2"},Hs={class:"text-sm font-bold m-0"},Js={key:0,class:"task mb-2"},Xs={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},Qs={class:"info flex-1 min-w-0"},Ys={class:"text-sm font-bold m-0 truncate"},Zs={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},xs={class:"flex gap-2"};function eo(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-image"),m=i("el-input-number"),g=j("loading");return n(),c("div",Bs,[s("div",Ks,[s("h2",Hs,a(e.$t("suno.name.replaceSection")),1),o(p,{content:e.$t("suno.description.replaceSection")},null,8,["content"])]),e.audio?(n(),c("div",Js,[s("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=v=>e.onClick(e.audio))},[F((n(),c("div",Xs,[o(_,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[g,!e.audio?.audio_url]]),s("div",Qs,[s("h2",Ys,a(e.audio?.title),1),s("p",Zs,a(e.audio?.style),1)])])])):d("",!0),s("div",xs,[o(m,{modelValue:e.replaceSectionStart,"onUpdate:modelValue":t[1]||(t[1]=v=>e.replaceSectionStart=v),class:"flex-1",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.replaceSectionStart")},null,8,["modelValue","max","placeholder"]),o(m,{modelValue:e.replaceSectionEnd,"onUpdate:modelValue":t[2]||(t[2]=v=>e.replaceSectionEnd=v),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"])])])}const to=A(qs,[["render",eo]]),so=C({name:"OverpaintingInput",components:{ElInputNumber:W,ElImage:L,InfoIcon:P},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"})}}}),oo={class:"field"},no={class:"flex items-center mb-2"},io={class:"text-sm font-bold m-0"},ao={key:0,class:"task mb-2"},lo={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},ro={class:"info flex-1 min-w-0"},uo={class:"text-sm font-bold m-0 truncate"},co={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},po={class:"flex gap-2"};function mo(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-image"),m=i("el-input-number"),g=j("loading");return n(),c("div",oo,[s("div",no,[s("h2",io,a(e.$t("suno.name.overpaintingRange")),1),o(p,{content:e.$t("suno.description.overpainting")},null,8,["content"])]),e.audio?(n(),c("div",ao,[s("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=v=>e.onClick(e.audio))},[F((n(),c("div",lo,[o(_,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[g,!e.audio?.audio_url]]),s("div",ro,[s("h2",uo,a(e.audio?.title),1),s("p",co,a(e.audio?.style),1)])])])):d("",!0),s("div",po,[o(m,{modelValue:e.overpaintingStart,"onUpdate:modelValue":t[1]||(t[1]=v=>e.overpaintingStart=v),class:"flex-1",size:"small",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.overpaintingStart")},null,8,["modelValue","max","placeholder"]),o(m,{modelValue:e.overpaintingEnd,"onUpdate:modelValue":t[2]||(t[2]=v=>e.overpaintingEnd=v),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"])])])}const fo=A(so,[["render",mo]]),ho=C({name:"UnderpaintingInput",components:{ElInputNumber:W,ElImage:L,InfoIcon:P},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"})}}}),_o={class:"field"},go={class:"flex items-center mb-2"},$o={class:"text-sm font-bold m-0"},vo={key:0,class:"task mb-2"},yo={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},ko={class:"info flex-1 min-w-0"},bo={class:"text-sm font-bold m-0 truncate"},wo={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},Co={class:"flex gap-2"};function Vo(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-image"),m=i("el-input-number"),g=j("loading");return n(),c("div",_o,[s("div",go,[s("h2",$o,a(e.$t("suno.name.underpaintingRange")),1),o(p,{content:e.$t("suno.description.underpainting")},null,8,["content"])]),e.audio?(n(),c("div",vo,[s("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=v=>e.onClick(e.audio))},[F((n(),c("div",yo,[o(_,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[g,!e.audio?.audio_url]]),s("div",ko,[s("h2",bo,a(e.audio?.title),1),s("p",wo,a(e.audio?.style),1)])])])):d("",!0),s("div",Co,[o(m,{modelValue:e.underpaintingStart,"onUpdate:modelValue":t[1]||(t[1]=v=>e.underpaintingStart=v),class:"flex-1",size:"small",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.underpaintingStart")},null,8,["modelValue","max","placeholder"]),o(m,{modelValue:e.underpaintingEnd,"onUpdate:modelValue":t[2]||(t[2]=v=>e.underpaintingEnd=v),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"])])])}const So=A(ho,[["render",Vo]]),Ao=C({name:"SamplesInput",components:{ElInputNumber:W,ElImage:L,InfoIcon:P},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"})}}}),Uo={class:"field"},Eo={class:"flex items-center mb-2"},Po={class:"text-sm font-bold m-0"},Io={key:0,class:"task mb-2"},To={class:"left relative w-[50px] h-[50px] mr-3 flex-shrink-0"},Go={class:"info flex-1 min-w-0"},Lo={class:"text-sm font-bold m-0 truncate"},Fo={class:"text-xs text-[var(--el-text-color-secondary)] m-0 truncate"},jo={class:"flex gap-2"};function Do(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-image"),m=i("el-input-number"),g=j("loading");return n(),c("div",Uo,[s("div",Eo,[s("h2",Po,a(e.$t("suno.name.samplesRange")),1),o(p,{content:e.$t("suno.description.samples")},null,8,["content"])]),e.audio?(n(),c("div",Io,[s("div",{class:"audio flex items-center",onClick:t[0]||(t[0]=v=>e.onClick(e.audio))},[F((n(),c("div",To,[o(_,{src:e.audio?.image_url,class:"w-full h-full rounded",fit:"cover"},null,8,["src"])])),[[g,!e.audio?.audio_url]]),s("div",Go,[s("h2",Lo,a(e.audio?.title),1),s("p",Fo,a(e.audio?.style),1)])])])):d("",!0),s("div",jo,[o(m,{modelValue:e.samplesStart,"onUpdate:modelValue":t[1]||(t[1]=v=>e.samplesStart=v),class:"flex-1",size:"small",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.samplesStart")},null,8,["modelValue","max","placeholder"]),o(m,{modelValue:e.samplesEnd,"onUpdate:modelValue":t[2]||(t[2]=v=>e.samplesEnd=v),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"])])])}const zo=A(Ao,[["render",Do]]),Ro=C({name:"PersonaInput",components:{ElInput:z,InfoIcon:P},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})}}}}),Mo={class:"field"},Oo={class:"flex items-center mb-2"},No={class:"text-sm font-bold m-0"};function Wo(e,t,u,l,$,h){const p=i("info-icon"),_=i("el-input");return n(),c("div",Mo,[s("div",Oo,[s("h2",No,a(e.$t("suno.name.persona")),1),o(p,{content:e.$t("suno.description.persona")},null,8,["content"])]),o(_,{modelValue:e.personaId,"onUpdate:modelValue":t[0]||(t[0]=m=>e.personaId=m),size:"small",placeholder:e.$t("suno.placeholder.personaId")},null,8,["modelValue","placeholder"])])}const qo=A(Ro,[["render",Wo]]),Bo=C({name:"PresetPanel",components:{TypeSelector:at,PromptInput:kt,LyricInput:Et,StyleInput:jt,TitleInput:Nt,ExtendFromInput:ts,CoverFromInput:ms,UploadAudio:ft,VocalGenderSelector:vs,AdvancedParams:Ws,ReplaceSectionInput:to,OverpaintingInput:fo,UnderpaintingInput:So,SamplesInput:zo,PersonaInput:qo,FontAwesomeIcon:D,ElButton:N,Consumption:ze},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Re(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service},supportsVocalGender(){const e=this.config?.model||"";return["chirp-v4-5-plus","chirp-v5","chirp-v5-5"].includes(e)},supportsPersona(){const e=this.config?.action;return!e||e==="generate"||e==="artist_consistency"||e==="artist_consistency_vox"},generateButtonText(){const 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"):this.$t("suno.button.generate")}},methods:{onGenerate(){this.$emit("generate")}}}),Ko={class:"flex flex-col h-full"},Ho={class:"flex-1 overflow-y-auto p-5"},Jo={class:"flex flex-col items-center justify-center px-5 pb-5"};function Xo(e,t,u,l,$,h){const p=i("type-selector"),_=i("upload-audio"),m=i("prompt-input"),g=i("lyric-input"),v=i("style-input"),E=i("title-input"),k=i("vocal-gender-selector"),S=i("persona-input"),B=i("extend-from-input"),K=i("cover-from-input"),Q=i("replace-section-input"),f=i("overpainting-input"),V=i("underpainting-input"),ne=i("samples-input"),ie=i("advanced-params"),ae=i("consumption"),le=i("font-awesome-icon"),re=i("el-button");return n(),c("div",Ko,[s("div",Ho,[o(p,{class:"mb-4"}),o(_,{class:"mb-4"}),e.config?.custom?d("",!0):(n(),y(m,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(n(),y(g,{key:1,class:"mb-4"})):d("",!0),e.config?.custom?(n(),y(v,{key:2,class:"mb-4"})):d("",!0),e.config?.custom?(n(),y(E,{key:3,class:"mb-4"})):d("",!0),e.config?.custom&&!e.config.instrumental&&e.supportsVocalGender?(n(),y(k,{key:4,class:"mb-4"})):d("",!0),e.config?.custom&&e.supportsPersona?(n(),y(S,{key:5,class:"mb-4"})):d("",!0),e.config?.action==="extend"?(n(),y(B,{key:6,class:"mb-4"})):d("",!0),e.config?.action==="cover"?(n(),y(K,{key:7,class:"mb-4"})):d("",!0),e.config?.action==="replace_section"?(n(),y(Q,{key:8,class:"mb-4"})):d("",!0),e.config?.action==="overpainting"?(n(),y(f,{key:9,class:"mb-4"})):d("",!0),e.config?.action==="underpainting"?(n(),y(V,{key:10,class:"mb-4"})):d("",!0),e.config?.action==="samples"?(n(),y(ne,{key:11,class:"mb-4"})):d("",!0),o(ie,{class:"mb-4"})]),s("div",Jo,[o(ae,{value:e.consumption,service:e.service},null,8,["value","service"]),o(re,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:r(()=>[o(le,{icon:"fa-solid fa-magic",class:"mr-2"}),w(" "+a(e.generateButtonText),1)]),_:1},8,["onClick"])])])}const Qo=A(Bo,[["render",Xo],["__scopeId","data-v-a9d5cfc6"]]),oe="https://webhook.acedata.cloud/suno",Yo=C({name:"TaskPreview",components:{ElImage:L,ElIcon:X,ElTooltip:ye,FontAwesomeIcon:D,VideoPlay:ee,VideoPause:x,ElDropdown:ve,ElDropdownMenu:$e,ElDropdownItem:ge,Loading:_e},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,isFetchingMidi:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===R.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(u=>({...u,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:O,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);const l=new URL(t).pathname,$=l.substring(l.lastIndexOf("/")+1);console.log("on preview",$),fetch(t).then(h=>h.blob()).then(h=>{Ge.saveAs(h,$)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),b.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,u)=>{const l={audio_id:e},$=this.credential?.token;if(!$){console.error("no token specified"),u(new Error("No token specified"));return}I.mp4(l,{token:$}).then(h=>{const p=h.data?.data?.video_url;p?t(p):u(new Error("Video URL not found in response"))}).catch(h=>{u(h)})})},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})},async onExtractVocals(e){const t=this.credential?.token;t&&(b.info(this.$t("suno.message.extractingVocals")),I.vox({audio_id:e,callback_url:oe},{token:t}).then(()=>{b.success(this.$t("suno.message.extractVocalsSuccess"))}).catch(u=>{b.error(u?.response?.data?.error?.message||this.$t("suno.message.extractVocalsFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()}))},async onGetTiming(e){const t=this.credential?.token;t&&(b.info(this.$t("suno.message.fetchingTiming")),I.timing({audio_id:e},{token:t}).then(u=>{b.success(this.$t("suno.message.fetchTimingSuccess")),console.debug("timing data",u.data)}).catch(u=>{b.error(u?.response?.data?.error?.message||this.$t("suno.message.fetchTimingFailed"))}))},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;const t=this.credential?.token;if(t)try{this.isFetchingWav=!0,b.info(this.$t("suno.message.fetchingWav"));const l=(await I.wav({audio_id:e.id},{token:t})).data?.data?.audio_url;l?this.onDownload(null,l):b.error(this.$t("suno.message.fetchWavFailed"))}catch{b.error(this.$t("suno.message.fetchWavFailed"))}finally{this.isFetchingWav=!1}},async handleMidiDownload(e){if(!e?.id||this.isFetchingMidi)return;const t=this.credential?.token;if(t)try{this.isFetchingMidi=!0,b.info(this.$t("suno.message.fetchingMidi"));const l=(await I.midi({audio_id:e.id},{token:t})).data?.data?.midi_url;l?this.onDownload(null,l):b.error(this.$t("suno.message.fetchMidiFailed"))}catch{b.error(this.$t("suno.message.fetchMidiFailed"))}finally{this.isFetchingMidi=!1}},async onGenerateAudioUrl(e,t){const u={action:e,audio_id:t,callback_url:oe},l=this.credential?.token;if(!l){console.error("no token specified");return}b.info(this.$t("suno.message.startingTask")),I.audio(u,{token:l}).then(()=>{b.success(this.$t("suno.message.startTaskSuccess"))}).catch($=>{b.error($?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Zo={class:"task"},xo=["onClick"],en={class:"left"},tn=["onClick"],sn=["onClick"],on={key:2,class:"duration"},nn={class:"info"},an={class:"title"},ln={class:"style"},rn={class:"right"},un={class:"el-dropdown-link"},cn={class:"flex items-center min-w-[120px]"},dn={class:"flex items-center min-w-[120px]"},pn={class:"flex items-center min-w-[120px]"},mn={class:"el-dropdown-link"};function fn(e,t,u,l,$,h){const p=i("el-image"),_=i("video-pause"),m=i("el-icon"),g=i("video-play"),v=i("font-awesome-icon"),E=i("el-tooltip"),k=i("Loading"),S=i("el-dropdown-item"),B=i("el-dropdown-menu"),K=i("el-dropdown"),Q=j("loading");return n(),c("div",Zo,[(n(!0),c(M,null,J(e.audios,f=>(n(),c("div",{key:f.id,class:"audio",onClick:U(V=>e.onClick(f),["stop"])},[F((n(),c("div",en,[o(p,{src:f?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),f?.audio_url&&e.$store.state?.suno?.audio?.id===f.id&&e.$store.state?.suno?.audio?.state==="playing"?(n(),c("div",{key:0,class:"overlay",onClick:U(V=>e.onPause(f),["stop"])},[o(m,null,{default:r(()=>[o(_)]),_:1})],8,tn)):d("",!0),f?.audio_url&&(e.$store.state?.suno?.audio?.id!==f.id||e.$store.state?.suno?.audio?.id===f.id&&e.$store.state?.suno?.audio?.state==="paused")?(n(),c("div",{key:1,class:"overlay",onClick:U(V=>e.onPlay(f),["stop"])},[o(m,null,{default:r(()=>[o(g)]),_:1})],8,sn)):d("",!0),f?.duration?(n(),c("div",on,a(e.useFormatDuring(f?.duration)),1)):d("",!0)])),[[Q,!f?.audio_url]]),s("div",nn,[s("h2",an,a(f?.title),1),s("p",ln,a(f?.style),1)]),s("div",rn,[o(K,null,{dropdown:r(()=>[o(B,null,{default:r(()=>[o(S,{disabled:e.isFetchingVideoUrl,onClick:V=>e.handleVideoDownload(f)},{default:r(()=>[s("div",cn,[e.isFetchingVideoUrl?(n(),y(m,{key:0,class:"is-loading mr-2"},{default:r(()=>[o(k)]),_:1})):d("",!0),s("span",null,a(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),f?.audio_url?(n(),y(S,{key:0,onClick:U(V=>e.onDownload(V,f?.audio_url),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):d("",!0),o(S,{disabled:e.isFetchingWav,onClick:V=>e.handleWavDownload(f)},{default:r(()=>[s("div",dn,[e.isFetchingWav?(n(),y(m,{key:0,class:"is-loading mr-2"},{default:r(()=>[o(k)]),_:1})):d("",!0),s("span",null,a(e.$t("suno.button.download_wav")),1)])]),_:2},1032,["disabled","onClick"]),o(S,{disabled:e.isFetchingMidi,onClick:V=>e.handleMidiDownload(f)},{default:r(()=>[s("div",pn,[e.isFetchingMidi?(n(),y(m,{key:0,class:"is-loading mr-2"},{default:r(()=>[o(k)]),_:1})):d("",!0),s("span",null,a(e.$t("suno.button.download_midi")),1)])]),_:2},1032,["disabled","onClick"])]),_:2},1024)]),default:r(()=>[s("span",un,[o(E,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:r(()=>[f?.audio_url||f?.video_url?(n(),y(v,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):d("",!0)]),_:2},1032,["content"])])]),_:2},1024),o(K,null,{dropdown:r(()=>[o(B,null,{default:r(()=>[f?.audio_url?(n(),y(S,{key:0,onClick:U(V=>e.onExtend(V,f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):d("",!0),f.id?(n(),y(S,{key:1,onClick:U(V=>e.onGetStems(f.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):d("",!0),f.id?(n(),y(S,{key:2,onClick:U(V=>e.onGetAllStems(f.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.all_stems")),1)]),_:2},1032,["onClick"])):d("",!0),o(S,{onClick:U(V=>e.onCover(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),f?.id?(n(),y(S,{key:3,onClick:U(V=>e.onRemaster(f.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.remaster")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:4,onClick:U(V=>e.onReplaceSection(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.replace_section")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:5,onClick:U(V=>e.onMashup(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.mashup")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id&&f?.action==="extend"?(n(),y(S,{key:6,onClick:U(V=>e.onConcatMusic(f?.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:7,onClick:U(V=>e.onOverpainting(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.overpainting")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:8,onClick:U(V=>e.onUnderpainting(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.underpainting")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:9,onClick:U(V=>e.onSamples(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.samples")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:10,onClick:U(V=>e.onArtistConsistency(f),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.artist_consistency")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:11,onClick:U(V=>e.onExtractVocals(f.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.extract_vocals")),1)]),_:2},1032,["onClick"])):d("",!0),f?.id?(n(),y(S,{key:12,onClick:U(V=>e.onGetTiming(f.id),["stop"])},{default:r(()=>[w(a(e.$t("suno.button.get_timing")),1)]),_:2},1032,["onClick"])):d("",!0)]),_:2},1024)]),default:r(()=>[s("span",mn,[o(E,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:r(()=>[f?.audio_url||f?.video_url?(n(),y(v,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):d("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,xo))),128))])}const hn=A(Yo,[["render",fn]]),_n={class:"player-slider"},gn=C({__name:"PlayerSlider",setup(e){const t=q(),u=G({get:()=>t.state.suno?.audio?.progress,set:p=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:p})}),l=G({get:()=>t.state.suno?.audio?.duration,set:p=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:p})}),$=()=>{},h=p=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:p});return(p,_)=>(n(),c("div",_n,[o(T(te),{modelValue:u.value,"onUpdate:modelValue":_[0]||(_[0]=m=>u.value=m),"show-tooltip":!1,min:0,max:l.value,onChange:h,onInput:$},null,8,["modelValue","max"])]))}}),$n={class:"flex player-song"},vn=["src"],yn={class:"ml-2 text-xs flex flex-col justify-between"},kn={class:"w-52 2xl:w-96 cursor-pointer truncate"},bn={class:"flex"},wn={class:"ml-2 text-dc"},Cn=C({__name:"PlayerSong",setup(e){const t=q(),u=G({get:()=>t.state.suno.audio,set:l=>t.commit("suno/setAudio",l)});return Se(u,(l,$)=>{if(l?.audio_url!==$?.audio_url){console.log("audio changed",l),l.object&&(console.log("111",l.object),l.object.pause(),delete l.object);const h=new Audio(l.audio_url);l.state==="playing"?h.play():h.pause(),h.addEventListener("loadedmetadata",()=>{h.currentTime=0,h.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:h.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:h})}else if(l?.progress!==$?.progress&&Math.abs(l.progress-l.object.currentTime)>2){console.log("progress changed",l.progress);const h=t.state.suno.audio;h.object&&(h.object.currentTime=h.progress)}else l?.state!==$?.state&&(console.log("state changed",l.state),l.object&&(l.state==="playing"?l.object.play():l.object.pause()));l?.volume!==$?.volume&&(console.log("volume changed",l.volume),l.object&&(l.object.volume=l.volume/100))}),(l,$)=>(n(),c("div",$n,[s("img",{alt:"",class:"w-11 h-11 rounded",src:u.value?.image_url||T(Le)},null,8,vn),s("div",yn,[s("div",kn,[s("div",bn,[s("span",null,a(u.value?.title||"Music"),1),s("span",wn,"- "+a(u.value?.style||"SmallRuralDog"),1)])])])]))}}),Vn={class:"flex justify-end items-center gap-x-2.5"},Sn={class:"text-xs"},An=C({__name:"PlayerAction",setup(e){const t=q(),u=G({get:()=>t.state.suno?.audio?.progress,set:$=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:$})}),l=G({get:()=>t.state.suno?.audio?.duration,set:$=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:$})});return($,h)=>(n(),c("div",Vn,[s("span",Sn,a(T(O)(u.value))+" / "+a(T(O)(l.value)),1)]))}}),Un={class:"player-volume flex flex-col items-center pt-2"},En={class:"text-sm mt-3"},Pn=C({__name:"PlayerVolumeSlider",setup(e){const t=q(),u=G({get:()=>t.state.suno.audio?.volume,set:h=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:h})}),l=G({get:()=>t.state.suno.audio?.muted,set:h=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:h})}),$=h=>t.dispatch("suno/setVolume",h);return(h,p)=>(n(),c("div",Un,[o(T(te),{modelValue:u.value,"onUpdate:modelValue":p[0]||(p[0]=_=>u.value=_),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:l.value,onInput:$},null,8,["modelValue","disabled"]),s("div",En,a(u.value),1)]))}}),In={class:"flex items-center justify-center gap-x-3"},Tn=C({__name:"PlayerController",setup(e){const t=q(),u=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),l=G(()=>t.state.suno.audio);return($,h)=>(n(),c("div",In,[o(se,{icon:l.value?.state==="playing"?T(Fe):T(je),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:u},null,8,["icon"]),o(T(ke),{placement:"top",width:"50px",trigger:"click"},{reference:r(()=>[o(se,{icon:T(De),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:r(()=>[o(Pn)]),_:1})]))}}),Gn={class:"flex flex-col items-stretch h-20"},Ln={class:"flex grow px-5 items-center"},Fn={class:"flex-1"},jn={class:"flex-1"},Dn={class:"flex-1"},zn=C({__name:"Player",setup(e){return(t,u)=>(n(),c("div",Gn,[o(gn),s("div",Ln,[s("div",Fn,[o(Cn)]),s("div",jn,[o(Tn)]),s("div",Dn,[o(An)])])]))}}),Rn=C({name:"RecentPanel",components:{ElSkeletonItem:we,ElSkeleton:be,TaskPreview:hn,Player:zn,NoTasks:Me,ScrollList:Te},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Mn={key:0,class:"tasks"},On={class:"left w-[70px] p-[10px] flex items-center"},Nn={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},Wn={key:2,class:"w-full flex-1 flex items-center justify-center"},qn={class:"h-20"};function Bn(e,t,u,l,$,h){const p=i("el-skeleton-item"),_=i("el-skeleton"),m=i("task-preview"),g=i("scroll-list"),v=i("no-tasks"),E=i("player");return n(),c(M,null,[e.tasks?.items===void 0?(n(),c("div",Mn,[(n(),c(M,null,J(3,k=>s("div",{key:k,class:"flex"},[s("div",On,[o(_,{animated:""},{template:r(()=>[o(p,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),s("div",Nn,[o(_,{animated:""},{template:r(()=>[o(p,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),o(p,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),y(g,{key:1,ref:"scrollList",class:"flex-1 w-full overflow-y-auto tasks p-2",loading:e.loading,onReachTop:t[0]||(t[0]=k=>e.$emit("reach-top"))},{default:r(()=>[(n(!0),c(M,null,J(e.tasks?.items,(k,S)=>(n(),y(m,{key:S,"model-value":k,class:"preview"},null,8,["model-value"]))),128))]),_:1},8,["loading"])):d("",!0),e.tasks?.items?.length===0?(n(),c("div",Wn,[o(v)])):d("",!0),F(s("div",qn,[o(E)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const Kn=A(Rn,[["render",Bn]]),Hn=C({name:"TaskPreview",components:{IconPicture:Ve,ElImage:L,ElAvatar:Ce,ElIcon:X},computed:{audio(){return this.$store.state.suno?.audio}}}),Jn={key:0,class:"size-full overflow-hidden"},Xn={class:"relative h-[300px]"},Qn={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Yn={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"},Zn={class:"p-4"},xn={class:"flex items-center font-bold mb-2"},ei={class:"text-[var(--el-text-color-regular)] mb-2"},ti={class:"text-xs text-[var(--el-text-color-regular)]"},si={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},oi={key:1,class:"w-full h-full"};function ni(e,t,u,l,$,h){const p=i("icon-picture"),_=i("el-icon"),m=i("el-image"),g=i("el-avatar");return e.audio?.object?(n(),c("div",Jn,[s("div",Xn,[o(m,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:r(()=>[s("div",Qn,[o(_,{class:"text-3xl"},{default:r(()=>[o(p)]),_:1})])]),_:1},8,["src"]),s("h2",Yn,a(e.audio?.title),1)]),s("div",Zn,[s("div",xn,[o(g,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),s("span",null,a(e.audio?.title),1)]),s("p",ei,a(e.audio?.style),1),s("p",ti,a(e.$dayjs.format(e.audio?.created_at)),1),s("div",si,[s("p",null,a(e.audio?.lyric),1)])])])):(n(),c("div",oi))}const ii=A(Hn,[["render",ni]]),ai="https://webhook.acedata.cloud/suno",li=C({name:"SunoIndex",components:{Layout:Je,ConfigPanel:Qo,RecentPanel:Kn,PreviewPanel:ii},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===R.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===R.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===R.Request},needApply(){return this.$store.state.suno.status.getApplications===R.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 Oe({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(){Pe.create({application:this.application}).then(({data:e})=>{this.application=e,b.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ie&&b.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const 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);const{limit:t=5,createdAtMin:u,createdAtMax:l}=e||{};console.debug("limit",t,"createdAtMin",u,"createdAtMax",l),this.fetchingTasks=!0;try{await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:u,createdAtMax:l})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){const e={...this.config,callback_url:ai},t=this.credential?.token;if(!t){console.error("no token specified");return}b.info(this.$t("suno.message.startingTask")),I.audio(e,{token:t}).then(()=>{b.success(this.$t("suno.message.startTaskSuccess"))}).catch(u=>{b.error(u?.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?.()}}});function ri(e,t,u,l,$,h){const p=i("config-panel"),_=i("recent-panel"),m=i("preview-panel"),g=i("layout");return n(),y(g,null,{config:r(()=>[o(p,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:r(()=>[o(_,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),preview:r(()=>[o(m)]),_:1})}const wi=A(li,[["render",ri],["__scopeId","data-v-d1296b1a"]]);export{wi as default};
@@ -1 +1 @@
1
- import{E as T,a as D,b as E}from"./EditArray-BFLjz-wW.js";import{h as U,_ as V}from"./index-muIEJvsu.js";import{M as F,k as A,N as _,x as q,A as B,j as L,B as N,p as j}from"./vendor-element-plus-DN048TGi.js";import{d as R,J as O,K as s,T as t,ai as n,G as l,R as o,Q as m,C as y,ag as Q,S as K,D as w,L as k,O as G,U as C}from"./vendor-vue-BhXato7y.js";import"./index.es-Bqj83sQx.js";import"./vendor-web3-CIJ0oOq5.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";const J=R({name:"SiteIndex",components:{EditText:E,EditImage:D,EditArray:T,ElDivider:j,ElRow:N,ElImage:L,ElCol:B,ElCard:q,ElForm:_,ElSwitch:A,ElFormItem:F},data(){return{editing:{title:!1}}},computed:{site(){return this.$store.getters.site}},methods:{onSave(e){const a={...this.site,...e};U.update(this.site?.id,a).then(()=>{console.debug("getSite for id",this.site?.id),this.$store.dispatch("getSite")})}}}),M={class:"title"},W={class:"title"},z={class:"block w-full"},H={class:"block tip"},P={class:"block w-full"},X={class:"block tip"},Y={class:"block w-full"},Z={class:"block tip"},x={class:"block w-full"},ee={class:"block tip"},te={class:"block w-full"},ie={class:"block tip"},se={class:"title"},le={class:"block w-full"},oe={class:"block tip"},ae={class:"block w-full"},de={class:"block tip"},ne={class:"title"},re={class:"block tip"},me={class:"block tip"},ue={class:"title"},pe={class:"w-full"},fe={class:"block tip w-full"},be={key:0},ve={class:"block w-full"},he={class:"block w-full"};function ce(e,a,$e,ge,we,ke){const f=n("el-col"),h=n("el-row"),u=n("el-divider"),d=n("el-form-item"),p=n("edit-text"),c=n("el-image"),$=n("edit-image"),I=n("edit-array"),b=n("el-form"),v=n("el-card"),g=n("el-switch");return w(),O(h,{class:"panel"},{default:s(()=>[t(f,{span:24},{default:s(()=>[t(h,null,{default:s(()=>[t(f,{span:24},{default:s(()=>[l("h2",M,o(e.$t("common.title.site")),1)]),_:1})]),_:1}),t(h,{gutter:15},{default:s(()=>[t(f,{md:12,xs:24},{default:s(()=>[t(v,{shadow:"hover",class:"mb-4"},{default:s(()=>[l("h4",W,o(e.$t("site.title.basicConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[t(d,{label:e.$t("site.field.origin")},{default:s(()=>[l("span",z,o(e.site.origin),1),l("span",H,o(e.$t("site.message.originTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.title")},{default:s(()=>[l("span",P,[m(o(e.site.title)+" ",1),t(p,{"model-value":e.site.title,title:e.$t("site.title.editTitle"),placeholder:e.$t("site.placeholder.title"),onConfirm:a[0]||(a[0]=i=>e.onSave({title:i}))},null,8,["model-value","title","placeholder"])]),l("span",X,o(e.$t("site.message.titleTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.logo")},{default:s(()=>[l("span",Y,[t(c,{src:e.site.logo,class:"logo"},null,8,["src"]),t($,{"model-value":e.site.logo,title:e.$t("site.title.editLogo"),tip:e.$t("site.message.editLogoTip"),onConfirm:a[1]||(a[1]=i=>e.onSave({logo:i}))},null,8,["model-value","title","tip"])]),l("span",Z,o(e.$t("site.message.logoTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.favicon")},{default:s(()=>[l("span",x,[t(c,{src:e.site.favicon,class:"favicon"},null,8,["src"]),t($,{"model-value":e.site.favicon,title:e.$t("site.title.editFavicon"),tip:e.$t("site.message.editFaviconTip"),onConfirm:a[2]||(a[2]=i=>e.onSave({favicon:i}))},null,8,["model-value","title","tip"])]),l("span",ee,o(e.$t("site.message.faviconTip")),1)]),_:1},8,["label"]),t(u,{"border-style":"dashed"}),t(d,{label:e.$t("site.field.admins")},{default:s(()=>[l("span",te,[m(o(e.site.admins?.join(", "))+" ",1),t(I,{"model-value":e.site?.admins||[],title:e.$t("site.title.editAdmins"),placeholder:e.$t("site.placeholder.admins"),tip:e.$t("site.message.adminsTip2"),min:1,"min-error-message":e.$t("site.message.atLeastOneAdmin"),onConfirm:a[3]||(a[3]=i=>e.onSave({admins:i}))},null,8,["model-value","title","placeholder","tip","min-error-message"])]),l("span",ie,o(e.$t("site.message.adminsTip")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),_:1}),t(v,{shadow:"hover"},{default:s(()=>[l("h4",se,o(e.$t("site.title.seoConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[t(d,{label:e.$t("site.field.description")},{default:s(()=>[l("span",le,[m(o(e.site.description)+" ",1),t(p,{"model-value":e.site.description,title:e.$t("site.title.editDescription"),placeholder:e.$t("site.placeholder.description"),onConfirm:a[4]||(a[4]=i=>e.onSave({description:i}))},null,8,["model-value","title","placeholder"])]),l("span",oe,o(e.$t("site.message.descriptionTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.keywords")},{default:s(()=>[l("span",ae,[m(o(e.site.keywords?.join(", "))+" ",1),t(I,{"model-value":e.site?.keywords||[],title:e.$t("site.title.editKeywords"),placeholder:e.$t("site.placeholder.keywords"),tip:e.$t("site.message.keywordsTip2"),onConfirm:a[5]||(a[5]=i=>e.onSave({keywords:i}))},null,8,["model-value","title","placeholder","tip"])]),l("span",de,o(e.$t("site.message.keywordsTip")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),_:1})]),_:1}),t(f,{md:12,xs:24},{default:s(()=>[t(v,{shadow:"hover",class:"mb-4"},{default:s(()=>[l("h4",ne,o(e.$t("site.title.distributionConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[t(d,{label:e.$t("site.field.distributionDefaultInviterId")},{default:s(()=>[m(o(e.site.distribution?.default_inviter_id)+" ",1),t(p,{"model-value":e.site.distribution?.default_inviter_id,title:e.$t("site.title.editDistributionDefaultInviterId"),placeholder:e.$t("site.placeholder.editDistributionDefaultInviterId"),onConfirm:a[6]||(a[6]=i=>e.onSave({distribution:{...e.site.distribution,default_inviter_id:i}}))},null,8,["model-value","title","placeholder"]),l("span",re,o(e.$t("site.message.distributionDefaultInviterIdTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.distributionForceInviterId")},{default:s(()=>[m(o(e.site.distribution?.force_inviter_id)+" ",1),t(p,{"model-value":e.site.distribution?.force_inviter_id,title:e.$t("site.title.editDistributionForceInviterId"),placeholder:e.$t("site.placeholder.editDistributionForceInviterId"),onConfirm:a[7]||(a[7]=i=>e.onSave({distribution:{...e.site.distribution,force_inviter_id:i}}))},null,8,["model-value","title","placeholder"]),l("span",me,o(e.$t("site.message.distributionForceInviterIdTip")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),_:1}),t(v,{shadow:"hover"},{default:s(()=>[l("h4",ue,o(e.$t("site.title.featuresConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[(w(),y(K,null,Q(["chat","midjourney","qrart","nanobanana","openaiimage","seedream","seedance","suno","luma","pika","kling","flux","hailuo","headshots","wan","producer","serp","support"],(i,S)=>t(d,{key:S,label:e.$t("site.field.features"+i.charAt(0).toUpperCase()+i.slice(1))},{default:s(()=>[l("div",pe,[t(g,{"model-value":e.site.features[i]?.enabled||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],enabled:r}}})},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]),l("span",fe,o(e.$t("site.message.features"+i.charAt(0).toUpperCase()+i.slice(1))),1),i==="support"?k((w(),y("div",be,[t(d,{label:"WeChat"},{default:s(()=>[t(g,{"model-value":e.site.features[i]?.wechat?.enabled||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],wechat:{...e.site.features[i]?.wechat,enabled:r}}}})},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]),_:2},1024),k(t(d,{label:e.$t("site.field.qr")},{default:s(()=>[l("span",ve,[t(c,{src:e.site.features[i]?.wechat?.qr},null,8,["src"]),t($,{"model-value":e.site.features[i]?.wechat?.qr,title:e.$t("site.title.editQR"),tip:e.$t("site.message.editQRTip"),onConfirm:r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],wechat:{...e.site.features[i]?.wechat,qr:r}}}})},null,8,["model-value","title","tip","onConfirm"])])]),_:2},1032,["label"]),[[C,e.site.features[i]?.wechat?.enabled]]),t(d,{label:"Discord"},{default:s(()=>[t(g,{"model-value":e.site.features[i]?.discord?.enabled||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],discord:{...e.site.features[i]?.discord,enabled:r}}}})},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]),_:2},1024),k(t(d,{label:e.$t("site.field.url")},{default:s(()=>[l("span",he,[m(o(e.site.features[i]?.discord?.url)+" ",1),t(p,{"model-value":e.site.features[i]?.discord?.url,title:e.$t("site.title.editUrl"),placeholder:e.$t("site.placeholder.editUrl"),onConfirm:r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],discord:{...e.site.features[i]?.discord,url:r}}}})},null,8,["model-value","title","placeholder","onConfirm"])])]),_:2},1032,["label"]),[[C,e.site.features[i]?.discord?.enabled]])],512)),[[C,e.site.features[i]?.enabled]]):G("",!0)]),_:2},1032,["label"])),64))]),_:1},8,["model"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const Fe=V(J,[["render",ce],["__scopeId","data-v-38430f7a"]]);export{Fe as default};
1
+ import{E as T,a as D,b as E}from"./EditArray-DzSfUZdI.js";import{h as U,_ as V}from"./index-CtkD2JaX.js";import{M as F,k as A,N as _,x as q,A as B,j as L,B as N,p as j}from"./vendor-element-plus-CmP9-3lX.js";import{d as R,J as O,K as s,T as t,ai as n,G as l,R as o,Q as m,C as y,ag as Q,S as K,D as w,L as k,O as G,U as C}from"./vendor-vue-BhXato7y.js";import"./index.es-DMehEjXB.js";import"./vendor-web3-C5RrfhAy.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";const J=R({name:"SiteIndex",components:{EditText:E,EditImage:D,EditArray:T,ElDivider:j,ElRow:N,ElImage:L,ElCol:B,ElCard:q,ElForm:_,ElSwitch:A,ElFormItem:F},data(){return{editing:{title:!1}}},computed:{site(){return this.$store.getters.site}},methods:{onSave(e){const a={...this.site,...e};U.update(this.site?.id,a).then(()=>{console.debug("getSite for id",this.site?.id),this.$store.dispatch("getSite")})}}}),M={class:"title"},W={class:"title"},z={class:"block w-full"},H={class:"block tip"},P={class:"block w-full"},X={class:"block tip"},Y={class:"block w-full"},Z={class:"block tip"},x={class:"block w-full"},ee={class:"block tip"},te={class:"block w-full"},ie={class:"block tip"},se={class:"title"},le={class:"block w-full"},oe={class:"block tip"},ae={class:"block w-full"},de={class:"block tip"},ne={class:"title"},re={class:"block tip"},me={class:"block tip"},ue={class:"title"},pe={class:"w-full"},fe={class:"block tip w-full"},be={key:0},ve={class:"block w-full"},he={class:"block w-full"};function ce(e,a,$e,ge,we,ke){const f=n("el-col"),h=n("el-row"),u=n("el-divider"),d=n("el-form-item"),p=n("edit-text"),c=n("el-image"),$=n("edit-image"),I=n("edit-array"),b=n("el-form"),v=n("el-card"),g=n("el-switch");return w(),O(h,{class:"panel"},{default:s(()=>[t(f,{span:24},{default:s(()=>[t(h,null,{default:s(()=>[t(f,{span:24},{default:s(()=>[l("h2",M,o(e.$t("common.title.site")),1)]),_:1})]),_:1}),t(h,{gutter:15},{default:s(()=>[t(f,{md:12,xs:24},{default:s(()=>[t(v,{shadow:"hover",class:"mb-4"},{default:s(()=>[l("h4",W,o(e.$t("site.title.basicConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[t(d,{label:e.$t("site.field.origin")},{default:s(()=>[l("span",z,o(e.site.origin),1),l("span",H,o(e.$t("site.message.originTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.title")},{default:s(()=>[l("span",P,[m(o(e.site.title)+" ",1),t(p,{"model-value":e.site.title,title:e.$t("site.title.editTitle"),placeholder:e.$t("site.placeholder.title"),onConfirm:a[0]||(a[0]=i=>e.onSave({title:i}))},null,8,["model-value","title","placeholder"])]),l("span",X,o(e.$t("site.message.titleTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.logo")},{default:s(()=>[l("span",Y,[t(c,{src:e.site.logo,class:"logo"},null,8,["src"]),t($,{"model-value":e.site.logo,title:e.$t("site.title.editLogo"),tip:e.$t("site.message.editLogoTip"),onConfirm:a[1]||(a[1]=i=>e.onSave({logo:i}))},null,8,["model-value","title","tip"])]),l("span",Z,o(e.$t("site.message.logoTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.favicon")},{default:s(()=>[l("span",x,[t(c,{src:e.site.favicon,class:"favicon"},null,8,["src"]),t($,{"model-value":e.site.favicon,title:e.$t("site.title.editFavicon"),tip:e.$t("site.message.editFaviconTip"),onConfirm:a[2]||(a[2]=i=>e.onSave({favicon:i}))},null,8,["model-value","title","tip"])]),l("span",ee,o(e.$t("site.message.faviconTip")),1)]),_:1},8,["label"]),t(u,{"border-style":"dashed"}),t(d,{label:e.$t("site.field.admins")},{default:s(()=>[l("span",te,[m(o(e.site.admins?.join(", "))+" ",1),t(I,{"model-value":e.site?.admins||[],title:e.$t("site.title.editAdmins"),placeholder:e.$t("site.placeholder.admins"),tip:e.$t("site.message.adminsTip2"),min:1,"min-error-message":e.$t("site.message.atLeastOneAdmin"),onConfirm:a[3]||(a[3]=i=>e.onSave({admins:i}))},null,8,["model-value","title","placeholder","tip","min-error-message"])]),l("span",ie,o(e.$t("site.message.adminsTip")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),_:1}),t(v,{shadow:"hover"},{default:s(()=>[l("h4",se,o(e.$t("site.title.seoConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[t(d,{label:e.$t("site.field.description")},{default:s(()=>[l("span",le,[m(o(e.site.description)+" ",1),t(p,{"model-value":e.site.description,title:e.$t("site.title.editDescription"),placeholder:e.$t("site.placeholder.description"),onConfirm:a[4]||(a[4]=i=>e.onSave({description:i}))},null,8,["model-value","title","placeholder"])]),l("span",oe,o(e.$t("site.message.descriptionTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.keywords")},{default:s(()=>[l("span",ae,[m(o(e.site.keywords?.join(", "))+" ",1),t(I,{"model-value":e.site?.keywords||[],title:e.$t("site.title.editKeywords"),placeholder:e.$t("site.placeholder.keywords"),tip:e.$t("site.message.keywordsTip2"),onConfirm:a[5]||(a[5]=i=>e.onSave({keywords:i}))},null,8,["model-value","title","placeholder","tip"])]),l("span",de,o(e.$t("site.message.keywordsTip")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),_:1})]),_:1}),t(f,{md:12,xs:24},{default:s(()=>[t(v,{shadow:"hover",class:"mb-4"},{default:s(()=>[l("h4",ne,o(e.$t("site.title.distributionConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[t(d,{label:e.$t("site.field.distributionDefaultInviterId")},{default:s(()=>[m(o(e.site.distribution?.default_inviter_id)+" ",1),t(p,{"model-value":e.site.distribution?.default_inviter_id,title:e.$t("site.title.editDistributionDefaultInviterId"),placeholder:e.$t("site.placeholder.editDistributionDefaultInviterId"),onConfirm:a[6]||(a[6]=i=>e.onSave({distribution:{...e.site.distribution,default_inviter_id:i}}))},null,8,["model-value","title","placeholder"]),l("span",re,o(e.$t("site.message.distributionDefaultInviterIdTip")),1)]),_:1},8,["label"]),t(d,{label:e.$t("site.field.distributionForceInviterId")},{default:s(()=>[m(o(e.site.distribution?.force_inviter_id)+" ",1),t(p,{"model-value":e.site.distribution?.force_inviter_id,title:e.$t("site.title.editDistributionForceInviterId"),placeholder:e.$t("site.placeholder.editDistributionForceInviterId"),onConfirm:a[7]||(a[7]=i=>e.onSave({distribution:{...e.site.distribution,force_inviter_id:i}}))},null,8,["model-value","title","placeholder"]),l("span",me,o(e.$t("site.message.distributionForceInviterIdTip")),1)]),_:1},8,["label"])]),_:1},8,["model"])]),_:1}),t(v,{shadow:"hover"},{default:s(()=>[l("h4",ue,o(e.$t("site.title.featuresConfig")),1),t(u),t(b,{model:e.site,class:"form","label-width":"auto",style:{"max-width":"600px"}},{default:s(()=>[(w(),y(K,null,Q(["chat","midjourney","qrart","nanobanana","openaiimage","seedream","seedance","suno","luma","pika","kling","flux","hailuo","headshots","wan","producer","serp","support"],(i,S)=>t(d,{key:S,label:e.$t("site.field.features"+i.charAt(0).toUpperCase()+i.slice(1))},{default:s(()=>[l("div",pe,[t(g,{"model-value":e.site.features[i]?.enabled||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],enabled:r}}})},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]),l("span",fe,o(e.$t("site.message.features"+i.charAt(0).toUpperCase()+i.slice(1))),1),i==="support"?k((w(),y("div",be,[t(d,{label:"WeChat"},{default:s(()=>[t(g,{"model-value":e.site.features[i]?.wechat?.enabled||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],wechat:{...e.site.features[i]?.wechat,enabled:r}}}})},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]),_:2},1024),k(t(d,{label:e.$t("site.field.qr")},{default:s(()=>[l("span",ve,[t(c,{src:e.site.features[i]?.wechat?.qr},null,8,["src"]),t($,{"model-value":e.site.features[i]?.wechat?.qr,title:e.$t("site.title.editQR"),tip:e.$t("site.message.editQRTip"),onConfirm:r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],wechat:{...e.site.features[i]?.wechat,qr:r}}}})},null,8,["model-value","title","tip","onConfirm"])])]),_:2},1032,["label"]),[[C,e.site.features[i]?.wechat?.enabled]]),t(d,{label:"Discord"},{default:s(()=>[t(g,{"model-value":e.site.features[i]?.discord?.enabled||!1,"inline-prompt":"","active-text":e.$t("site.button.enabled"),"inactive-text":e.$t("site.button.disabled"),"onUpdate:modelValue":r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],discord:{...e.site.features[i]?.discord,enabled:r}}}})},null,8,["model-value","active-text","inactive-text","onUpdate:modelValue"])]),_:2},1024),k(t(d,{label:e.$t("site.field.url")},{default:s(()=>[l("span",he,[m(o(e.site.features[i]?.discord?.url)+" ",1),t(p,{"model-value":e.site.features[i]?.discord?.url,title:e.$t("site.title.editUrl"),placeholder:e.$t("site.placeholder.editUrl"),onConfirm:r=>e.onSave({features:{...e.site.features,[i]:{...e.site.features[i],discord:{...e.site.features[i]?.discord,url:r}}}})},null,8,["model-value","title","placeholder","onConfirm"])])]),_:2},1032,["label"]),[[C,e.site.features[i]?.discord?.enabled]])],512)),[[C,e.site.features[i]?.enabled]]):G("",!0)]),_:2},1032,["label"])),64))]),_:1},8,["model"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const Fe=V(J,[["render",ce],["__scopeId","data-v-38430f7a"]]);export{Fe as default};
@@ -1 +1 @@
1
- import{F as L}from"./index.es-Bqj83sQx.js";import{m as T,Y as R,O as A,P as M,u as j,w as S,t as D,q as B,H as O,j as q}from"./vendor-element-plus-DN048TGi.js";import{d as b,C as c,G as i,T as t,E,K as u,ai as o,D as a,R as n,S as C,ag as G,J as v,Q as p,O as h,M as V,X as z}from"./vendor-vue-BhXato7y.js";import{_ as k,cg as F,au as N,ch as H,aN as J,aJ as U}from"./index-muIEJvsu.js";import{p as K}from"./pasteUploadMixin-BurWbGNQ.js";import{I as P,S as Q}from"./ScrollList-ZiMJkMBw.js";import{I as X}from"./ImagePreview-eVaabJZn.js";import{C as Y}from"./Consumption-DB4jsCIw.js";import{a as W}from"./price-Bva0CFLK.js";import{C as Z}from"./CopyToClipboard-DY-UF17o.js";import{V as x}from"./VideoPlayer-DCxEj90A.js";import{B as ee}from"./BotPlaceholder-CcWrwFmL.js";import{N as te}from"./NoTasks-Dk7Wt2AG.js";import{l as oe}from"./pagination-DLJ2pbsx.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-CIJ0oOq5.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";import"./vue-plyr-QZFBikSk.js";const se=b({name:"LayoutHailuo",components:{ElDrawer:R,ElButton:T,FontAwesomeIcon:L},data(){return{drawer:!1}}}),ae={class:"main flex flex-row flex-1"},ne={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},le={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function ie(e,s,f,g,w,y){const d=o("font-awesome-icon"),m=o("el-button"),r=o("el-drawer");return a(),c("div",ae,[i("div",ne,[E(e.$slots,"config",{},void 0,!0)]),i("div",le,[E(e.$slots,"result",{},void 0,!0)]),t(m,{circle:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(d,{icon:"fa-solid fa-magic"})]),_:1}),t(r,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"340px"},{default:u(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const re=k(se,[["render",ie],["__scopeId","data-v-fa61db7a"]]),ce=b({name:"ModelSelector",components:{ElSelect:M,ElOption:A},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||(this.value=F)}}),ue={class:"field"},de={class:"title font-bold"},me={class:"float-left"};function pe(e,s,f,g,w,y){const d=o("el-option"),m=o("el-select");return a(),c("div",ue,[i("h2",de,n(e.$t("hailuo.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=r=>e.value=r),class:"value",placeholder:e.$t("hailuo.placeholder.select"),clearable:""},{default:u(()=>[(a(!0),c(C,null,G(e.options,r=>(a(),v(d,{key:r.value,label:r.label,value:r.value},{default:u(()=>[i("span",me,n(r.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const he=k(ce,[["render",pe],["__scopeId","data-v-a768fbd9"]]),fe=b({name:"StartImageUrlInput",components:{ElUpload:j,ElButton:T,InfoIcon:P,ImagePreview:X},mixins:[K],data(){return{fileList:[],uploadUrl:N()+"/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(){const e=this.urls?.[0];this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t("hailuo.message.uploadStartImageExceed"))},onError(){S.error(this.$t("hailuo.message.uploadStartImageError"))},async onRemove(){S.error(this.$t("hailuo.message.uploadStartImageError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ge={class:"relative"},_e={class:"flex justify-between"},$e={class:"flex justify-start items-center"},ve={class:"text-sm font-bold"};function be(e,s,f,g,w,y){const d=o("info-icon"),m=o("image-preview"),r=o("el-button"),_=o("el-upload");return a(),c("div",ge,[i("div",_e,[i("div",$e,[i("span",ve,n(e.$t("hailuo.name.startImageUrl")),1),t(d,{content:e.$t("hailuo.description.startImageUrl"),class:"info"},null,8,["content"])])]),t(_,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=l=>e.fileList=l),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:u(({file:l})=>[l.url&&l.percentage!==void 0?(a(),v(m,{key:0,url:l.url,name:l.name,percentage:l.percentage,onRemove:$=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):h("",!0)]),default:u(()=>[t(r,{size:"small",type:"primary",class:"btn btn-upload",round:""},{default:u(()=>[p(n(e.$t("hailuo.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])])}const ke=k(fe,[["render",be],["__scopeId","data-v-48f4a681"]]),we="",ye=b({name:"PromptInput",components:{ElInput:D,InfoIcon:P},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=we)}}),Se={class:"field"},Te={class:"box"},Ve={class:"title font-bold"};function Ie(e,s,f,g,w,y){const d=o("info-icon"),m=o("el-input");return a(),c("div",Se,[i("div",Te,[i("h2",Ve,n(e.$t("hailuo.name.prompt")),1),t(d,{content:e.$t("hailuo.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=r=>e.prompt=r),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("hailuo.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const Ee=k(ye,[["render",Ie],["__scopeId","data-v-c601bcba"]]),Ce=b({name:"PresetPanel",components:{ElButton:T,FontAwesomeIcon:L,PromptInput:Ee,StartImageUrlInput:ke,ModelSelector:he,Consumption:Y},emits:["generate"],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return W(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Le={class:"flex flex-col h-full"},Ue={class:"flex-1 overflow-y-auto p-5"},Ge={class:"flex flex-col items-center justify-center px-5 pb-5"};function Pe(e,s,f,g,w,y){const d=o("prompt-input"),m=o("model-selector"),r=o("start-image-url-input"),_=o("consumption"),l=o("font-awesome-icon"),$=o("el-button");return a(),c("div",Le,[i("div",Ue,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),e.config?.model==="minimax-i2v"?(a(),v(r,{key:0,class:"mb-2"})):h("",!0)]),i("div",Ge,[t(_,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),v($,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(l,{icon:"fa-solid fa-magic",class:"mr-2"}),p(" "+n(e.$t("hailuo.button.extend")),1)]),_:1},8,["onClick"])):(a(),v($,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(l,{icon:"fa-solid fa-magic",class:"mr-2"}),p(" "+n(e.$t("hailuo.button.generate")),1)]),_:1},8,["onClick"]))])])}const Re=k(Ce,[["render",Pe]]),Ae=b({name:"TaskPreview",components:{ElImage:q,CopyToClipboard:Z,FontAwesomeIcon:L,ElAlert:O,VideoPlayer:x,ElTooltip:B,ElButton:T},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")}}}),Me={class:"preview"},je={class:"left"},De={class:"main"},Be={class:"bot"},Oe={class:"datetime"},qe={class:"info"},ze={key:0,class:"prompt mt-2"},Fe={key:0},Ne={key:1},He={key:0,class:V({content:!0,failed:!0})},Je={key:0,class:"mb-4"},Ke={key:1,class:V({operations:!0,"mt-2":!0})},Qe={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Xe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ye={key:1,class:V({content:!0})},We={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ze={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},xe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},et={key:2,class:V({content:!0})},tt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function ot(e,s,f,g,w,y){const d=o("el-image"),m=o("video-player"),r=o("el-button"),_=o("el-tooltip"),l=o("font-awesome-icon"),$=o("copy-to-clipboard"),I=o("el-alert");return a(),c("div",Me,[i("div",je,[t(d,{src:"https://cdn.acedata.cloud/0qg4gp.png",class:"avatar"})]),i("div",De,[i("div",Be,[p(n(e.$t("hailuo.name.hailuoBot"))+" ",1),i("span",Oe,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",qe,[e.modelValue?.request?.prompt?(a(),c("p",ze,[p(n(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(a(),c("span",Fe," - ("+n(e.$t("hailuo.status.pending"))+") ",1)),e.video?.state==="processing"||e.video?.state==="pending"||e.video?.state==="running"?(a(),c("span",Ne," - ("+n(e.$t("hailuo.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(a(),c("div",He,[e.video?.video_url?(a(),c("div",Je,[t(m,{src:e.video?.video_url},null,8,["src"])])):h("",!0),e.video?(a(),c("div",Ke,[t(_,{class:"box-item",effect:"dark",content:e.$t("hailuo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.video?.video_url?(a(),v(r,{key:0,type:"info",size:"small",class:"mb-2",onClick:s[0]||(s[0]=z(mt=>e.onDownload(e.video?.video_url),["stop"]))},{default:u(()=>[p(n(e.$t("hailuo.button.download")),1)]),_:1})):h("",!0)]),_:1},8,["content"])])):h("",!0),t(I,{closable:!1,class:"mt-2 success"},{default:u(()=>[e.modelValue?.request?.model?(a(),c("p",Qe,[t(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.model"))+": "+n(e.modelValue?.request?.model)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])):h("",!0),i("p",Xe,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(a(),c("div",Ye,[t(I,{closable:!1,class:"failure"},{template:u(()=>[t(l,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failure")),1)]),default:u(()=>[i("p",We,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])]),i("p",Ze,[t(l,{icon:"fa-solid fa-circle-info",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t($,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),i("p",xe,[t(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t($,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===void 0?(a(),c("div",et,[t(I,{closable:!1,class:"info"},{template:u(()=>[t(l,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failure")),1)]),default:u(()=>[i("p",tt,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):h("",!0)])])}const st=k(Ae,[["render",ot],["__scopeId","data-v-48b0ddf9"]]),at=b({name:"RecentPanel",components:{TaskPreview:st,BotPlaceholder:ee,NoTasks:te,ScrollList:Q},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?.()}}}),nt={key:0},lt={key:2,class:"w-full h-full flex items-center justify-center"};function it(e,s,f,g,w,y){const d=o("bot-placeholder"),m=o("task-preview"),r=o("scroll-list"),_=o("no-tasks");return a(),c(C,null,[e.tasks?.items===void 0?(a(),c("div",nt,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),v(r,{key:1,ref:"scrollList",class:"tasks w-full h-full overflow-y-auto",loading:e.loading,onReachTop:s[0]||(s[0]=l=>e.$emit("reach-top"))},{default:u(()=>[(a(!0),c(C,null,G(e.tasks?.items,l=>(a(),v(m,{key:l.id,"model-value":l},null,8,["model-value"]))),128))]),_:1},8,["loading"])):h("",!0),e.tasks?.items?.length===0?(a(),c("div",lt,[t(_)])):h("",!0)],64)}const rt=k(at,[["render",it]]),ct="https://webhook.acedata.cloud/hailuo",ut=b({name:"HailuoIndex",components:{ConfigPanel:Re,Layout:re,RecentPanel:rt},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===U.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===U.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,s){e?.items?.length>s?.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 oe({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();const 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);const{limit:s=5,createdAtMin:f,createdAtMax:g}=e||{};console.debug("limit",s,"createdAtMin",f,"createdAtMax",g),this.fetchingTasks=!0;try{await this.$store.dispatch("hailuo/getTasks",{limit:s,createdAtMin:f,createdAtMax:g})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:ct},s=this.credential?.token;if(!s){console.error("no token specified");return}S.info(this.$t("hailuo.message.startingTask")),H.generate(e,{token:s}).then(()=>{S.success(this.$t("hailuo.message.startTaskSuccess"))}).catch(f=>{f?.response?.data?.error?.code===J?S.error(this.$t("hailuo.message.usedUp")):S.error(this.$t("hailuo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function dt(e,s,f,g,w,y){const d=o("config-panel"),m=o("recent-panel"),r=o("layout");return a(),v(r,null,{config:u(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(m,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Gt=k(ut,[["render",dt]]);export{Gt as default};
1
+ import{F as L}from"./index.es-DMehEjXB.js";import{m as T,X as R,O as A,P as M,u as j,w as S,t as D,q as B,H as O,j as q}from"./vendor-element-plus-CmP9-3lX.js";import{d as b,C as c,G as i,T as t,E,K as u,ai as o,D as a,R as n,S as C,ag as G,J as v,Q as p,O as h,M as V,X as z}from"./vendor-vue-BhXato7y.js";import{_ as k,ch as F,av as N,ci as H,aO as K,aK as U}from"./index-CtkD2JaX.js";import{p as X}from"./pasteUploadMixin-BurWbGNQ.js";import{I as P,S as J}from"./ScrollList-OteSDitY.js";import{I as Q}from"./ImagePreview-B5F24-Vs.js";import{C as W}from"./Consumption-DEB600BC.js";import{a as Y}from"./price-lQeFOa8Q.js";import{C as Z}from"./CopyToClipboard-cTbsayFn.js";import{V as x}from"./VideoPlayer-DcumvLkR.js";import{B as ee}from"./BotPlaceholder-BV2w6Q4w.js";import{N as te}from"./NoTasks-ZsLHgPuo.js";import{l as oe}from"./pagination-DLJ2pbsx.js";import"./vendor-dayjs-CzbnksQQ.js";import"./vendor-web3-C5RrfhAy.js";import"./vendor-axios-NIGUFBhG.js";import"./vendor-vue-router-8bYQCSwj.js";import"./vue-plyr-QZFBikSk.js";const se=b({name:"LayoutHailuo",components:{ElDrawer:R,ElButton:T,FontAwesomeIcon:L},data(){return{drawer:!1}}}),ae={class:"main flex flex-row flex-1"},ne={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},le={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function ie(e,s,f,g,w,y){const d=o("font-awesome-icon"),m=o("el-button"),r=o("el-drawer");return a(),c("div",ae,[i("div",ne,[E(e.$slots,"config",{},void 0,!0)]),i("div",le,[E(e.$slots,"result",{},void 0,!0)]),t(m,{circle:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(d,{icon:"fa-solid fa-magic"})]),_:1}),t(r,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"340px"},{default:u(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const re=k(se,[["render",ie],["__scopeId","data-v-fa61db7a"]]),ce=b({name:"ModelSelector",components:{ElSelect:M,ElOption:A},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||(this.value=F)}}),ue={class:"field"},de={class:"title font-bold"},me={class:"float-left"};function pe(e,s,f,g,w,y){const d=o("el-option"),m=o("el-select");return a(),c("div",ue,[i("h2",de,n(e.$t("hailuo.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=r=>e.value=r),class:"value",placeholder:e.$t("hailuo.placeholder.select"),clearable:""},{default:u(()=>[(a(!0),c(C,null,G(e.options,r=>(a(),v(d,{key:r.value,label:r.label,value:r.value},{default:u(()=>[i("span",me,n(r.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const he=k(ce,[["render",pe],["__scopeId","data-v-a768fbd9"]]),fe=b({name:"StartImageUrlInput",components:{ElUpload:j,ElButton:T,InfoIcon:P,ImagePreview:Q},mixins:[X],data(){return{fileList:[],uploadUrl:N()+"/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(){const e=this.urls?.[0];this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t("hailuo.message.uploadStartImageExceed"))},onError(){S.error(this.$t("hailuo.message.uploadStartImageError"))},async onRemove(){S.error(this.$t("hailuo.message.uploadStartImageError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ge={class:"relative"},_e={class:"flex justify-between"},$e={class:"flex justify-start items-center"},ve={class:"text-sm font-bold"};function be(e,s,f,g,w,y){const d=o("info-icon"),m=o("image-preview"),r=o("el-button"),_=o("el-upload");return a(),c("div",ge,[i("div",_e,[i("div",$e,[i("span",ve,n(e.$t("hailuo.name.startImageUrl")),1),t(d,{content:e.$t("hailuo.description.startImageUrl"),class:"info"},null,8,["content"])])]),t(_,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=l=>e.fileList=l),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:u(({file:l})=>[l.url&&l.percentage!==void 0?(a(),v(m,{key:0,url:l.url,name:l.name,percentage:l.percentage,onRemove:$=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):h("",!0)]),default:u(()=>[t(r,{size:"small",type:"primary",class:"btn btn-upload",round:""},{default:u(()=>[p(n(e.$t("hailuo.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])])}const ke=k(fe,[["render",be],["__scopeId","data-v-48f4a681"]]),we="",ye=b({name:"PromptInput",components:{ElInput:D,InfoIcon:P},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("hailuo/setConfig",{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=we)}}),Se={class:"field"},Te={class:"box"},Ve={class:"title font-bold"};function Ie(e,s,f,g,w,y){const d=o("info-icon"),m=o("el-input");return a(),c("div",Se,[i("div",Te,[i("h2",Ve,n(e.$t("hailuo.name.prompt")),1),t(d,{content:e.$t("hailuo.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=r=>e.prompt=r),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("hailuo.placeholder.prompt")},null,8,["modelValue","placeholder"])])}const Ee=k(ye,[["render",Ie],["__scopeId","data-v-c601bcba"]]),Ce=b({name:"PresetPanel",components:{ElButton:T,FontAwesomeIcon:L,PromptInput:Ee,StartImageUrlInput:ke,ModelSelector:he,Consumption:W},emits:["generate"],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return Y(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Le={class:"flex flex-col h-full"},Ue={class:"flex-1 overflow-y-auto p-5"},Ge={class:"flex flex-col items-center justify-center px-5 pb-5"};function Pe(e,s,f,g,w,y){const d=o("prompt-input"),m=o("model-selector"),r=o("start-image-url-input"),_=o("consumption"),l=o("font-awesome-icon"),$=o("el-button");return a(),c("div",Le,[i("div",Ue,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),e.config?.model==="minimax-i2v"?(a(),v(r,{key:0,class:"mb-2"})):h("",!0)]),i("div",Ge,[t(_,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),v($,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(l,{icon:"fa-solid fa-magic",class:"mr-2"}),p(" "+n(e.$t("hailuo.button.extend")),1)]),_:1},8,["onClick"])):(a(),v($,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(l,{icon:"fa-solid fa-magic",class:"mr-2"}),p(" "+n(e.$t("hailuo.button.generate")),1)]),_:1},8,["onClick"]))])])}const Re=k(Ce,[["render",Pe]]),Ae=b({name:"TaskPreview",components:{ElImage:q,CopyToClipboard:Z,FontAwesomeIcon:L,ElAlert:O,VideoPlayer:x,ElTooltip:B,ElButton:T},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")}}}),Me={class:"preview"},je={class:"left"},De={class:"main"},Be={class:"bot"},Oe={class:"datetime"},qe={class:"info"},ze={key:0,class:"prompt mt-2"},Fe={key:0},Ne={key:1},He={key:0,class:V({content:!0,failed:!0})},Ke={key:0,class:"mb-4"},Xe={key:1,class:V({operations:!0,"mt-2":!0})},Je={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},We={key:1,class:V({content:!0})},Ye={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ze={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},xe={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},et={key:2,class:V({content:!0})},tt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function ot(e,s,f,g,w,y){const d=o("el-image"),m=o("video-player"),r=o("el-button"),_=o("el-tooltip"),l=o("font-awesome-icon"),$=o("copy-to-clipboard"),I=o("el-alert");return a(),c("div",Me,[i("div",je,[t(d,{src:"https://cdn.acedata.cloud/0qg4gp.png",class:"avatar"})]),i("div",De,[i("div",Be,[p(n(e.$t("hailuo.name.hailuoBot"))+" ",1),i("span",Oe,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",qe,[e.modelValue?.request?.prompt?(a(),c("p",ze,[p(n(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(a(),c("span",Fe," - ("+n(e.$t("hailuo.status.pending"))+") ",1)),e.video?.state==="processing"||e.video?.state==="pending"||e.video?.state==="running"?(a(),c("span",Ne," - ("+n(e.$t("hailuo.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(a(),c("div",He,[e.video?.video_url?(a(),c("div",Ke,[t(m,{src:e.video?.video_url},null,8,["src"])])):h("",!0),e.video?(a(),c("div",Xe,[t(_,{class:"box-item",effect:"dark",content:e.$t("hailuo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.video?.video_url?(a(),v(r,{key:0,type:"info",size:"small",class:"mb-2",onClick:s[0]||(s[0]=z(mt=>e.onDownload(e.video?.video_url),["stop"]))},{default:u(()=>[p(n(e.$t("hailuo.button.download")),1)]),_:1})):h("",!0)]),_:1},8,["content"])])):h("",!0),t(I,{closable:!1,class:"mt-2 success"},{default:u(()=>[e.modelValue?.request?.model?(a(),c("p",Je,[t(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.model"))+": "+n(e.modelValue?.request?.model)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])):h("",!0),i("p",Qe,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(a(),c("div",We,[t(I,{closable:!1,class:"failure"},{template:u(()=>[t(l,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failure")),1)]),default:u(()=>[i("p",Ye,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])]),i("p",Ze,[t(l,{icon:"fa-solid fa-circle-info",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t($,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),i("p",xe,[t(l,{icon:"fa-solid fa-hashtag",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t($,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===void 0?(a(),c("div",et,[t(I,{closable:!1,class:"info"},{template:u(()=>[t(l,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.failure")),1)]),default:u(()=>[i("p",tt,[t(l,{icon:"fa-solid fa-magic",class:"mr-1"}),p(" "+n(e.$t("hailuo.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t($,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):h("",!0)])])}const st=k(Ae,[["render",ot],["__scopeId","data-v-48b0ddf9"]]),at=b({name:"RecentPanel",components:{TaskPreview:st,BotPlaceholder:ee,NoTasks:te,ScrollList:J},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?.()}}}),nt={key:0},lt={key:2,class:"w-full h-full flex items-center justify-center"};function it(e,s,f,g,w,y){const d=o("bot-placeholder"),m=o("task-preview"),r=o("scroll-list"),_=o("no-tasks");return a(),c(C,null,[e.tasks?.items===void 0?(a(),c("div",nt,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),v(r,{key:1,ref:"scrollList",class:"tasks w-full h-full overflow-y-auto",loading:e.loading,onReachTop:s[0]||(s[0]=l=>e.$emit("reach-top"))},{default:u(()=>[(a(!0),c(C,null,G(e.tasks?.items,l=>(a(),v(m,{key:l.id,"model-value":l},null,8,["model-value"]))),128))]),_:1},8,["loading"])):h("",!0),e.tasks?.items?.length===0?(a(),c("div",lt,[t(_)])):h("",!0)],64)}const rt=k(at,[["render",it]]),ct="https://webhook.acedata.cloud/hailuo",ut=b({name:"HailuoIndex",components:{ConfigPanel:Re,Layout:re,RecentPanel:rt},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===U.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===U.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,s){e?.items?.length>s?.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 oe({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();const 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);const{limit:s=5,createdAtMin:f,createdAtMax:g}=e||{};console.debug("limit",s,"createdAtMin",f,"createdAtMax",g),this.fetchingTasks=!0;try{await this.$store.dispatch("hailuo/getTasks",{limit:s,createdAtMin:f,createdAtMax:g})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:ct},s=this.credential?.token;if(!s){console.error("no token specified");return}S.info(this.$t("hailuo.message.startingTask")),H.generate(e,{token:s}).then(()=>{S.success(this.$t("hailuo.message.startTaskSuccess"))}).catch(f=>{f?.response?.data?.error?.code===K?S.error(this.$t("hailuo.message.usedUp")):S.error(this.$t("hailuo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function dt(e,s,f,g,w,y){const d=o("config-panel"),m=o("recent-panel"),r=o("layout");return a(),v(r,null,{config:u(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(m,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Gt=k(ut,[["render",dt]]);export{Gt as default};