@acedatacloud/nexior 3.11.1 → 3.12.1

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 (129) hide show
  1. package/dist/assets/{Auth-Uv_IvbtF.js → Auth-C9Ps3qGU.js} +1 -1
  2. package/dist/assets/{BotPlaceholder-DwgRH20-.js → BotPlaceholder-BpvmBkXD.js} +1 -1
  3. package/dist/assets/{Callback-ByCCzWcg.js → Callback-DdJe01FG.js} +1 -1
  4. package/dist/assets/{Console-DHwwvfxZ.js → Console-CQ-9fAMy.js} +1 -1
  5. package/dist/assets/{Conversation-DMA4LVfL.css → Conversation-CUJ818A7.css} +1 -1
  6. package/dist/assets/{Conversation-BpaSz31f.js → Conversation-Dr7b-i1i.js} +28 -28
  7. package/dist/assets/{CopyToClipboard-B_zjEArC.js → CopyToClipboard-DyMPPewz.js} +1 -1
  8. package/dist/assets/{Detail-CldUUlYK.js → Detail-DDW1H9ni.js} +1 -1
  9. package/dist/assets/{EditArray-Bt1sWXgD.js → EditArray-q4hekPI_.js} +1 -1
  10. package/dist/assets/{Extra-D06dGtrC.js → Extra-gxCS-7lk.js} +1 -1
  11. package/dist/assets/{FilePreview-BTDh_yU5.js → FilePreview-CCZrN5UK.js} +1 -1
  12. package/dist/assets/{History-BjWm608N.js → History-WkVpGKjF.js} +1 -1
  13. package/dist/assets/{ImagePreview-B_rmftlm.js → ImagePreview-BPc3RF_H.js} +1 -1
  14. package/dist/assets/{ImageWrapper-IsRbsLXL.js → ImageWrapper-Dgt0Q2FT.js} +1 -1
  15. package/dist/assets/{Index-4bHarnDT.js → Index-2YL8GdWf.js} +1 -1
  16. package/dist/assets/{Index-PPPaGVos.css → Index-4syFjNg7.css} +1 -1
  17. package/dist/assets/{Index-BP7CYQ7P.js → Index-BAMjKi-z.js} +1 -1
  18. package/dist/assets/{Index-BSbUQIbg.js → Index-BMW0Yq1F.js} +1 -1
  19. package/dist/assets/{Index-C2gp6gwV.css → Index-BoUiV7dx.css} +1 -1
  20. package/dist/assets/{Index-Cd_bZOhx.js → Index-BuxwizQ1.js} +1 -1
  21. package/dist/assets/{Index-CeuNLk_f.js → Index-BzWb9Rn3.js} +1 -1
  22. package/dist/assets/{Index-C0q2dzjc.js → Index-COVVy8ss.js} +1 -1
  23. package/dist/assets/{Index-CD5ywDjH.js → Index-CWsDiQU1.js} +1 -1
  24. package/dist/assets/Index-CaEXc-YO.css +1 -0
  25. package/dist/assets/{Index-C86zmZAm.js → Index-Cy_3QGWJ.js} +1 -1
  26. package/dist/assets/{Index-U3dqcrDR.js → Index-D9WMEzWT.js} +1 -1
  27. package/dist/assets/{Index-CMHnESeE.js → Index-DCMOSofU.js} +1 -1
  28. package/dist/assets/{Index-BE57Cmys.css → Index-DmxdMnbK.css} +1 -1
  29. package/dist/assets/{Index-B1debl89.js → Index-MQwg8wpz.js} +1 -1
  30. package/dist/assets/{Index-DqWTPyqq.js → Index-MiFGGOXD.js} +1 -1
  31. package/dist/assets/{Index-Yx6X3Qm1.js → Index-jUXJgRLP.js} +1 -1
  32. package/dist/assets/{Index-CXM5MBmQ.css → Index-ySYBdD2U.css} +1 -1
  33. package/dist/assets/{InfoIcon-C_-GVrFj.js → InfoIcon-_PcwxxEr.js} +1 -1
  34. package/dist/assets/{Invitees-BPVP0Aih.js → Invitees-BTuoGEYx.js} +1 -1
  35. package/dist/assets/{List-E-lT1rwt.js → List-B0lNnkcL.js} +1 -1
  36. package/dist/assets/{List-D-4zj9go.js → List-DzO9HutF.js} +1 -1
  37. package/dist/assets/{List-OpmDGTjj.js → List-JroVtBC8.js} +1 -1
  38. package/dist/assets/{Login-6lS0WBm3.js → Login--w2DTyjR.js} +1 -1
  39. package/dist/assets/{Main-CPaYaYMS.js → Main-B8iraP71.js} +1 -1
  40. package/dist/assets/{Navigator-DM74lcQp.js → Navigator-B1zOZEZQ.js} +1 -1
  41. package/dist/assets/{NoTasks-Cc2t-KhB.js → NoTasks-DHmfFJrK.js} +1 -1
  42. package/dist/assets/{Pagination-C5BddcIC.js → Pagination-_ELMMcj2.js} +1 -1
  43. package/dist/assets/{Status-CEpyyIqD.js → Status-DkLyOGsk.js} +1 -1
  44. package/dist/assets/{Subscribe-DD2lmhnE.js → Subscribe-CX73FZwD.js} +1 -1
  45. package/dist/assets/{VideoPlayer-pXfQbDQT.js → VideoPlayer-B8-Tg95m.js} +1 -1
  46. package/dist/assets/{_Uint8Array-C21Rl0N8.js → _Uint8Array-BVA9I_fE.js} +1 -1
  47. package/dist/assets/{_baseClone-B-ja3TJc.js → _baseClone-_p75hPey.js} +1 -1
  48. package/dist/assets/{_baseIteratee-JKg-PLGw.js → _baseIteratee-BnprkGcU.js} +1 -1
  49. package/dist/assets/{_initCloneObject-VeD_6fht.js → _initCloneObject-CEFMBT5z.js} +1 -1
  50. package/dist/assets/{castArray-CjJRTN8w.js → castArray-4BvTHi4D.js} +1 -1
  51. package/dist/assets/chat-BOvh2JVT.js +1 -0
  52. package/dist/assets/chat-BhlGtYCb.js +1 -0
  53. package/dist/assets/chat-BiQ9-OuF.js +1 -0
  54. package/dist/assets/chat-BuOUpCjc.js +1 -0
  55. package/dist/assets/chat-BzOZ-NNb.js +1 -0
  56. package/dist/assets/chat-CS9AcMwV.js +1 -0
  57. package/dist/assets/chat-CTHmx5bf.js +1 -0
  58. package/dist/assets/chat-ChQF2VOr.js +1 -0
  59. package/dist/assets/chat-Co3i4Nqd.js +1 -0
  60. package/dist/assets/chat-D-4GqjPf.js +1 -0
  61. package/dist/assets/chat-D15RFySP.js +1 -0
  62. package/dist/assets/chat-DLu-VcUn.js +1 -0
  63. package/dist/assets/chat-DVINcjTQ.js +1 -0
  64. package/dist/assets/chat-D_oRWFvl.js +1 -0
  65. package/dist/assets/chat-Km0aOnGR.js +1 -0
  66. package/dist/assets/chat-QSIHwjsq.js +1 -0
  67. package/dist/assets/chat-ZxnT324p.js +1 -0
  68. package/dist/assets/chat-yQfpt1lj.js +1 -0
  69. package/dist/assets/{debounce-DPEiv4qa.js → debounce-BQhVlwAs.js} +1 -1
  70. package/dist/assets/{distribution-mwsaLSCr.js → distribution-BDziq4nz.js} +1 -1
  71. package/dist/assets/{dropdown-CpNXmULE.js → dropdown-D5lWh2oc.js} +1 -1
  72. package/dist/assets/{index-D-qMYOzj.js → index-B3ZkmbIo.js} +1 -1
  73. package/dist/assets/{index-BIeRBgdC.js → index-BWKYfhQJ.js} +1 -1
  74. package/dist/assets/{index-BWD3Nss6.js → index-BXVcZgxw.js} +1 -1
  75. package/dist/assets/{index-HscBp0fS.js → index-BY4IcCmQ.js} +1 -1
  76. package/dist/assets/{index-EFW5HXXl.js → index-BehSG88T.js} +1 -1
  77. package/dist/assets/{index-v77iUQMy.js → index-C-IFZVH5.js} +1 -1
  78. package/dist/assets/{index-IHqDwSxu.js → index-CKMtc4ic.js} +1 -1
  79. package/dist/assets/{index-MUigFyNQ.js → index-CPSVYQzh.js} +1 -1
  80. package/dist/assets/{index-Dcs3jWJX.js → index-CdPm0FKF.js} +1 -1
  81. package/dist/assets/{index-52Xy00cP.js → index-CpFwyPVo.js} +1 -1
  82. package/dist/assets/{index-XZ6jwXk2.js → index-CrJlOJBH.js} +1 -1
  83. package/dist/assets/{index-C094cc3A.js → index-D2dszUUm.js} +1 -1
  84. package/dist/assets/{index-DFk1FoEG.js → index-D4I3evL9.js} +1 -1
  85. package/dist/assets/{index-DmkicCz4.js → index-DBssH7pX.js} +1 -1
  86. package/dist/assets/{index-De_ntG9v.js → index-DLmsZMpM.js} +1 -1
  87. package/dist/assets/{index-BXSgDlie.js → index-DOSbWYIy.js} +1 -1
  88. package/dist/assets/{index-DYcbA4Xy.js → index-DPUHufUs.js} +1 -1
  89. package/dist/assets/{index-BCDVF19o.js → index-DSHqbIyQ.js} +1 -1
  90. package/dist/assets/{index-BO9akAqw.js → index-DagREoh2.js} +1 -1
  91. package/dist/assets/{index-Bzx9vpDl.js → index-DjE06kE9.js} +1 -1
  92. package/dist/assets/{index-BeBmiTmh.js → index-DmnSh2xh.js} +1 -1
  93. package/dist/assets/{index-D8KZMM1b.js → index-DnYBmGDX.js} +1 -1
  94. package/dist/assets/{index-Tlw0DGaS.js → index-DqR4HY--.js} +1 -1
  95. package/dist/assets/{index-CY9KGeTn.js → index-DuvQfdS5.js} +1 -1
  96. package/dist/assets/{index-Cbr5I2Y9.js → index-PzuQTcb2.js} +37 -37
  97. package/dist/assets/{index-BeZMFg4Z.js → index-Yl4965oF.js} +1 -1
  98. package/dist/assets/{index-cur6am9k.js → index-bAaD18S5.js} +1 -1
  99. package/dist/assets/{index-BXaZ87x3.js → index-uHnIvF0e.js} +1 -1
  100. package/dist/assets/{index-_Q_QIBBy.js → index-wcGfTy7F.js} +1 -1
  101. package/dist/assets/{index.es-DaeHBJIN.js → index.es-JfM5t2Sf.js} +1 -1
  102. package/dist/assets/{isEqual-By-euu_c.js → isEqual-fTEz49hG.js} +1 -1
  103. package/dist/assets/{isPlainObject-DC7IXBFc.js → isPlainObject-Brlhjumy.js} +1 -1
  104. package/dist/assets/{order-D77l3vr6.js → order-D204BkAu.js} +1 -1
  105. package/dist/assets/{price-DfAGvI7c.js → price-CckLdzJV.js} +1 -1
  106. package/dist/assets/{strings-CzjyDUaH.js → strings-UgWiDXyr.js} +1 -1
  107. package/dist/assets/{typescript-BMcXT3c_.js → typescript-DjoIxu2M.js} +1 -1
  108. package/dist/assets/{use-form-item-DBbvHFR2.js → use-form-item-DK5EyE2z.js} +1 -1
  109. package/dist/index.html +1 -1
  110. package/package.json +1 -1
  111. package/dist/assets/Index-CMZqK4H2.css +0 -1
  112. package/dist/assets/chat-6l2vN9Qa.js +0 -1
  113. package/dist/assets/chat-Bfpp_WGx.js +0 -1
  114. package/dist/assets/chat-BjWIDz_9.js +0 -1
  115. package/dist/assets/chat-C5bO6SPI.js +0 -1
  116. package/dist/assets/chat-Cah5fNcs.js +0 -1
  117. package/dist/assets/chat-Chn1tfwo.js +0 -1
  118. package/dist/assets/chat-CmbmIqfD.js +0 -1
  119. package/dist/assets/chat-Cnjl1dWq.js +0 -1
  120. package/dist/assets/chat-Cqiyjg-R.js +0 -1
  121. package/dist/assets/chat-CzgKIYL9.js +0 -1
  122. package/dist/assets/chat-D1B3OPhq.js +0 -1
  123. package/dist/assets/chat-DRw8JMJH.js +0 -1
  124. package/dist/assets/chat-DVwY6Oj1.js +0 -1
  125. package/dist/assets/chat-Dl20uH7I.js +0 -1
  126. package/dist/assets/chat-JOlzcsrj.js +0 -1
  127. package/dist/assets/chat-Xa8w_A8o.js +0 -1
  128. package/dist/assets/chat-sEgJnB1r.js +0 -1
  129. package/dist/assets/chat-tyE-w-qj.js +0 -1
@@ -1 +1 @@
1
- import{F as q}from"./index.es-DaeHBJIN.js";import{E as H}from"./index-EFW5HXXl.js";import{E as de}from"./index-D8KZMM1b.js";import{ah as pe,an as me,bG as he,ai as ie,c7 as fe,_ as _e,d as C,a as $e,aj as ve,c as j,bf as ge,bl as ke,au as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b6 as le,E as M,n as ye,g as we,h as A,t as l,k as s,l as c,eB as se,x as v,F as z,v as N,eC as Q,c4 as be,D as P,eD as x,eE as ee,y,J as Z,cL as te,eF as O,dj as B,eG as R,al as Ce,K as Se,eH as Le,db as Ae,di as Ee}from"./index-Cbr5I2Y9.js";import{E as re}from"./index-DmkicCz4.js";import{E as je,a as Ve}from"./index-Bzx9vpDl.js";import{I as D}from"./InfoIcon-C_-GVrFj.js";import{E as Ie}from"./index-BXSgDlie.js";import{E}from"./index-BeZMFg4Z.js";import{E as K}from"./index-Tlw0DGaS.js";import{E as Te,a as ce}from"./index-HscBp0fS.js";import{E as X}from"./index-BWD3Nss6.js";import{E as Pe,a as Fe,b as Ue}from"./index-D-qMYOzj.js";import{E as ze}from"./index-BeBmiTmh.js";import{E as Ge}from"./index-IHqDwSxu.js";import{N as Me}from"./NoTasks-Cc2t-KhB.js";import{a as Re,E as De}from"./index-BCDVF19o.js";import{E as Oe}from"./index-BO9akAqw.js";import"./use-form-item-DBbvHFR2.js";import"./index-r5W6hzzQ.js";import"./index-DFk1FoEG.js";import"./strings-CzjyDUaH.js";import"./castArray-CjJRTN8w.js";import"./isEqual-By-euu_c.js";import"./_Uint8Array-C21Rl0N8.js";import"./typescript-BMcXT3c_.js";import"./debounce-DPEiv4qa.js";import"./_baseIteratee-JKg-PLGw.js";import"./index-Dcs3jWJX.js";import"./index-_Q_QIBBy.js";import"./_baseClone-B-ja3TJc.js";import"./_initCloneObject-VeD_6fht.js";import"./index-BXaZ87x3.js";import"./dropdown-CpNXmULE.js";const Be=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),We={error:e=>e instanceof Event},Ne=C({name:"ElAvatar"}),qe=C({...Ne,props:Be,emits:We,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=j(()=>{const{size:n,icon:m,shape:k}=i,h=[o.b()];return ge(n)&&h.push(o.m(n)),m&&h.push(o.m("icon")),k&&h.push(o.m(k)),h}),u=j(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=j(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function f(n){r.value=!0,t("error",n)}return(n,m)=>(a(),_("span",{class:ye(L(d)),style:oe(L(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(L(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(L(M),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var He=_e(qe,[["__file","avatar.vue"]]);const Ze=we(He),Ke=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Xe={class:"main"},Je={class:"config"},Ye={class:"result"},Qe={class:"preview"};function xe(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Xe,[l("div",Je,[U(e.$slots,"config",{},void 0,!0)]),l("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),l("div",Qe,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),"with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const et=A(Ke,[["render",xe],["__scopeId","data-v-230fd591"]]),tt=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:je,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),ot={class:"field"},st={class:"title font-bold"};function nt(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",ot,[l("h2",st,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(f,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),_(z,null,N(e.options,n=>(a(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const it=A(tt,[["render",nt],["__scopeId","data-v-5a66a01f"]]),at=C({name:"UploadAudio",components:{ElUpload:Ie,ElButton:H,InfoIcon:D,FontAwesomeIcon:q},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/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(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.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},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Q.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),lt={class:"relative"},rt={class:"flex justify-between"},ct={class:"flex justify-start items-center"},ut={class:"text-sm font-bold"};function dt(e,t,i,o,r,d){const u=c("info-icon"),p=c("font-awesome-icon"),f=c("el-button"),n=c("el-upload");return a(),_("div",lt,[l("div",rt,[l("div",ct,[l("span",ut,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),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:$(()=>[s(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),P(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const pt=A(at,[["render",dt],["__scopeId","data-v-6236152c"]]),mt="",ht=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=mt)}}),ft={class:"field"},_t={class:"box"},$t={class:"title-info"},vt={class:"title font-bold"},gt={class:"instrumental"},kt={class:"title inline-block"};function yt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",ft,[l("div",_t,[l("div",$t,[l("h2",vt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",gt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",kt,v(e.$t("suno.name.instrumental")),1)])]),s(f,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const wt=A(ht,[["render",yt],["__scopeId","data-v-d7004a7c"]]),bt="",Ct=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=bt)}}),St={class:"field"},Lt={class:"box"},At={class:"title font-bold"};function Et(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",St,[l("div",Lt,[l("h2",At,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const jt=A(Ct,[["render",Et],["__scopeId","data-v-99dfded8"]]),Vt=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),It={class:"field"},Tt={class:"title-container"},Pt={class:"titlefont-bold"};function Ft(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",It,[l("div",Tt,[l("h2",Pt,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=f=>e.style=f),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ut=A(Vt,[["render",Ft],["__scopeId","data-v-85bbfcaa"]]),zt=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Mt={class:"title-container"},Rt={class:"title font-bold"};function Dt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Gt,[l("div",Mt,[l("h2",Rt,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=f=>e.title=f),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ot=A(zt,[["render",Dt],["__scopeId","data-v-ce70fe34"]]);function G(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Bt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:M,ElInputNumber:Te,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:G,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})}}}),Wt={class:"field"},Nt={class:"box"},qt={class:"title font-bold"},Ht={class:"input-wrapper"},Zt={class:"task"},Kt={class:"left"},Xt={key:2,class:"duration"},Jt={class:"info"},Yt={class:"title"},Qt={class:"style"};function xt(e,t,i,o,r,d){const u=c("el-input-number"),p=c("el-image"),f=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=te("loading");return a(),_("div",Wt,[l("div",Nt,[l("h2",qt,v(e.$t("suno.name.extend")),1),l("div",Ht,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=h=>e.value=h),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"])])]),l("div",Zt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Kt,[s(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"?(a(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=h=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(f)]),_:1})])):y("",!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")?(a(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=h=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",Xt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Jt,[l("h2",Yt,v(e.audio?.title),1),l("p",Qt,v(e.audio?.style),1)])])):y("",!0)])])}const eo=A(Bt,[["render",xt],["__scopeId","data-v-bcce4821"]]),to=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:M,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:G,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})}}}),oo={class:"field"},so={class:"box"},no={class:"title font-bold"},io={class:"task"},ao={class:"left"},lo={key:2,class:"duration"},ro={class:"info"},co={class:"title"},uo={class:"style"};function po(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=te("loading");return a(),_("div",oo,[l("div",so,[l("h2",no,v(e.$t("suno.name.cover")),1)]),l("div",io,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ao,[s(u,{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"?(a(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(f,null,{default:$(()=>[s(p)]),_:1})])):y("",!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")?(a(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(f,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",lo,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",ro,[l("h2",co,v(e.audio?.title),1),l("p",uo,v(e.audio?.style),1)])])):y("",!0)])])}const mo=A(to,[["render",po],["__scopeId","data-v-06640216"]]),ho=C({name:"PresetPanel",components:{TypeSelector:it,PromptInput:wt,LyricInput:jt,StyleInput:Ut,TitleInput:Ot,ExtendFromInput:eo,CoverFromInput:mo,UploadAudio:pt,FontAwesomeIcon:q,ElButton:H},emits:["generate"],computed:{config(){return this.$store.state.suno?.config}},methods:{onGenerate(){this.$emit("generate")}}}),fo={class:"panel"},_o={class:"config"},$o={class:"actions"};function vo(e,t,i,o,r,d){const u=c("type-selector"),p=c("upload-audio"),f=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),h=c("extend-from-input"),b=c("cover-from-input"),T=c("font-awesome-icon"),V=c("el-button");return a(),_("div",fo,[l("div",_o,[s(u,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(f,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(h,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0),l("div",$o,[e.config?.action!=="extend"?(a(),w(V,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(V,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}const go=A(ho,[["render",vo],["__scopeId","data-v-dc0dc608"]]);var W={exports:{}},ko=W.exports,ne;function yo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(ko,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var h=new XMLHttpRequest;h.open("GET",n),h.responseType="blob",h.onload=function(){f(h.response,m,k)},h.onerror=function(){console.error("could not download file")},h.send()}function r(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,p=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var h=u.URL||u.webkitURL,b=document.createElement("a");m=m||n.name||"download",b.download=m,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,m,k):d(b,b.target="_blank")):(b.href=h.createObjectURL(n),setTimeout(function(){h.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(r(n))o(n,m,k);else{var h=document.createElement("a");h.href=n,h.target="_blank",setTimeout(function(){d(h)})}}:function(n,m,k,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var b=n.type==="application/octet-stream",T=/constructor/i.test(u.HTMLElement)||u.safari,V=/CriOS\/[\d]+/.test(navigator.userAgent);if((V||b&&T||p)&&typeof FileReader<"u"){var I=new FileReader;I.onloadend=function(){var S=I.result;S=V?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},I.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);h?h.location=F:location.href=F,h=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=f.saveAs=f,e.exports=f})}(W)),W.exports}var wo=yo();const bo="https://webhook.acedata.cloud/suno",Co=C({name:"TaskPreview",components:{ElImage:X,ElIcon:M,ElTooltip:ze,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Ue,ElDropdownMenu:Fe,ElDropdownItem:Pe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:G,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.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{wo.saveAs(d,r)})},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 onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:bo},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");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})}}}),So={class:"task"},Lo=["onClick"],Ao={class:"left"},Eo=["onClick"],jo=["onClick"],Vo={key:2,class:"duration"},Io={class:"info"},To={class:"title"},Po={class:"style"},Fo={class:"right"},Uo={class:"el-dropdown-link"},zo={class:"el-dropdown-link"};function Go(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),h=c("el-tooltip"),b=c("el-dropdown-item"),T=c("el-dropdown-menu"),V=c("el-dropdown"),I=te("loading");return a(),_("div",So,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Ao,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(f,null,{default:$(()=>[s(p)]),_:1})],8,Eo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(f,null,{default:$(()=>[s(n)]),_:1})],8,jo)):y("",!0),g?.duration?(a(),_("div",Vo,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[I,!g?.audio_url]]),l("div",Io,[l("h2",To,v(g?.title),1),l("p",Po,v(g?.style),1)]),l("div",Fo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[P(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(h,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[P(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[P(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Uo,[s(h,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[P(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[P(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[P(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",zo,[s(h,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Lo))),128))])}const Mo=A(Co,[["render",Go]]),Ro={class:"player-slider"},Do=C({__name:"PlayerSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=j({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,p)=>(a(),_("div",Ro,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Oo="/assets/disk-XFRmVAfp.png",Bo={class:"flex player-song"},Wo=["src"],No={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ho={class:"flex"},Zo={class:"ml-2 text-dc"},Ko=C({__name:"PlayerSong",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),_("div",Bo,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Oo)},null,8,Wo),l("div",No,[l("div",qo,[l("div",Ho,[l("span",null,v(i.value?.title||"Music"),1),l("span",Zo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Xo={class:"flex justify-end items-center gap-x-2.5"},Jo={class:"text-xs"},Yo=C({__name:"PlayerAction",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=j({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Xo,[l("span",Jo,v(L(G)(i.value))+" / "+v(L(G)(o.value)),1)]))}});var Qo={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function xo(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function es(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var ts=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=xo(),p=Ce(ts,Qo);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,T=d.spin,V=es(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),I=[p.prefix+"-icon"];return I.push(p.prefix+"-icon-"+e),t&&p.rtl&&I.push(p.prefix+"-icon-rtl"),T&&I.push(p.prefix+"-icon-spin"),s("span",{class:I.join(" ")},[i(V)])}}};return o}const os=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ss=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ns=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Y=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),is={class:"player-volume flex flex-col items-center pt-2"},as={class:"text-sm mt-3"},ls={class:"mt-2"},rs=C({__name:"PlayerVolumeSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=j({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,p)=>(a(),_("div",is,[l("div",null,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",as,v(i.value),1),l("div",ls,[s(Y,{icon:o.value?L(ns):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),cs={class:"flex items-center justify-center gap-x-3"},us=C({__name:"PlayerController",setup(e){const t=R(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=j(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",cs,[s(Y,{icon:o.value?.state==="playing"?L(os):L(ss),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(Ge),{placement:"top",width:"50px"},{reference:$(()=>[s(Y,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(rs)]),_:1})]))}}),ds={class:"flex flex-col items-stretch h-20"},ps={class:"flex grow px-5 items-center"},ms={class:"flex-1"},hs={class:"flex-1"},fs={class:"flex-1"},_s=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ds,[s(Do),l("div",ps,[l("div",ms,[s(Ko)]),l("div",hs,[s(us)]),l("div",fs,[s(Yo)])])]))}}),$s=C({name:"RecentPanel",components:{TaskPreview:Mo,ElSkeleton:De,ElSkeletonItem:Re,Player:_s,NoTasks:Me},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),vs={key:0,class:"tasks"},gs={class:"left"},ks={class:"main"},ys={key:1,class:"tasks"},ws={key:2,class:"w-full h-full flex items-center justify-center"},bs={class:"flex-1 flex flex-col"},Cs={class:"h-20"};function Ss(e,t,i,o,r,d){const u=c("el-skeleton-item"),p=c("el-skeleton"),f=c("task-preview"),n=c("no-tasks"),m=c("player");return a(),_(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[e.tasks?.items===void 0?(a(),_("div",vs,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",gs,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ks,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),_("div",ys,[(a(!0),_(z,null,N(e.tasks?.items,(k,h)=>(a(),w(f,{key:h,"model-value":k,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),_("div",ws,[s(n)])):y("",!0)],544),Z(l("div",bs,[l("div",Cs,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const Ls=A($s,[["render",Ss],["__scopeId","data-v-959f8920"]]),As=C({name:"TaskPreview",components:{ElScrollbar:Oe,IconPicture:Le,ElImage:X,ElAvatar:Ze,ElIcon:M},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Es={key:0,class:"card"},js={class:"image-container"},Vs={class:"image-slot"},Is={class:"title"},Ts={class:"content"},Ps={class:"artist"},Fs={class:"style"},Us={class:"time"},zs={class:"lyrics"},Gs={key:1,class:"gradient-background"};function Ms(e,t,i,o,r,d){const u=c("icon-picture"),p=c("el-icon"),f=c("el-image"),n=c("el-avatar"),m=c("el-scrollbar");return a(),w(m,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),_("div",Es,[l("div",js,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Vs,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Is,v(e.audio?.title),1)]),l("div",Ts,[l("div",Ps,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",Fs,v(e.audio?.style),1),l("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",zs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Gs))]),_:1})}const Rs=A(As,[["render",Ms],["__scopeId","data-v-9b29e9f9"]]),Ds="https://webhook.acedata.cloud/suno",Os=C({name:"SunoIndex",components:{Layout:et,ConfigPanel:go,RecentPanel:Ls,PreviewPanel:Rs},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.Request},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===B.Request},needApply(){return this.$store.state.suno.status.getApplications===B.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}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},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(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ee&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ds},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Bs(e,t,i,o,r,d){const u=c("config-panel"),p=c("recent-panel"),f=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(f)]),_:1})}const Cn=A(Os,[["render",Bs],["__scopeId","data-v-69332928"]]);export{Cn as default};
1
+ import{F as q}from"./index.es-JfM5t2Sf.js";import{E as H}from"./index-BehSG88T.js";import{E as de}from"./index-DnYBmGDX.js";import{ah as pe,an as me,bG as he,ai as ie,c7 as fe,_ as _e,d as C,a as $e,aj as ve,c as j,bf as ge,bl as ke,au as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b6 as le,E as M,n as ye,g as we,h as A,t as l,k as s,l as c,eC as se,x as v,F as z,v as N,eD as Q,c4 as be,D as P,eE as x,eF as ee,y,J as Z,cL as te,eG as O,dj as W,eH as R,al as Ce,K as Se,eI as Le,db as Ae,di as Ee}from"./index-PzuQTcb2.js";import{E as re}from"./index-DBssH7pX.js";import{E as je,a as Ie}from"./index-DjE06kE9.js";import{I as D}from"./InfoIcon-_PcwxxEr.js";import{E as Ve}from"./index-DOSbWYIy.js";import{E}from"./index-Yl4965oF.js";import{E as K}from"./index-DqR4HY--.js";import{E as Te,a as ce}from"./index-BY4IcCmQ.js";import{E as X}from"./index-BXVcZgxw.js";import{E as Pe,a as Fe,b as Ue}from"./index-B3ZkmbIo.js";import{E as ze}from"./index-DmnSh2xh.js";import{E as Ge}from"./index-CKMtc4ic.js";import{N as Me}from"./NoTasks-DHmfFJrK.js";import{a as Re,E as De}from"./index-DSHqbIyQ.js";import{E as Oe}from"./index-DagREoh2.js";import"./use-form-item-DK5EyE2z.js";import"./index-r5W6hzzQ.js";import"./index-D4I3evL9.js";import"./strings-UgWiDXyr.js";import"./castArray-4BvTHi4D.js";import"./isEqual-fTEz49hG.js";import"./_Uint8Array-BVA9I_fE.js";import"./typescript-DjoIxu2M.js";import"./debounce-BQhVlwAs.js";import"./_baseIteratee-BnprkGcU.js";import"./index-CdPm0FKF.js";import"./index-wcGfTy7F.js";import"./_baseClone-_p75hPey.js";import"./_initCloneObject-CEFMBT5z.js";import"./index-uHnIvF0e.js";import"./dropdown-D5lWh2oc.js";const We=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Be={error:e=>e instanceof Event},Ne=C({name:"ElAvatar"}),qe=C({...Ne,props:We,emits:Be,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=j(()=>{const{size:n,icon:m,shape:k}=i,h=[o.b()];return ge(n)&&h.push(o.m(n)),m&&h.push(o.m("icon")),k&&h.push(o.m(k)),h}),u=j(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=j(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function f(n){r.value=!0,t("error",n)}return(n,m)=>(a(),_("span",{class:ye(L(d)),style:oe(L(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(L(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(L(M),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var He=_e(qe,[["__file","avatar.vue"]]);const Ze=we(He),Ke=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Xe={class:"main"},Je={class:"config"},Ye={class:"result"},Qe={class:"preview"};function xe(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Xe,[l("div",Je,[U(e.$slots,"config",{},void 0,!0)]),l("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),l("div",Qe,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),"with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const et=A(Ke,[["render",xe],["__scopeId","data-v-230fd591"]]),tt=C({name:"VersionSelector",components:{ElSelect:Ie,ElOption:je,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),ot={class:"field"},st={class:"title font-bold"};function nt(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",ot,[l("h2",st,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(f,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),_(z,null,N(e.options,n=>(a(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const it=A(tt,[["render",nt],["__scopeId","data-v-5a66a01f"]]),at=C({name:"UploadAudio",components:{ElUpload:Ve,ElButton:H,InfoIcon:D,FontAwesomeIcon:q},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/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(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.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},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Q.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),lt={class:"relative"},rt={class:"flex justify-between"},ct={class:"flex justify-start items-center"},ut={class:"text-sm font-bold"};function dt(e,t,i,o,r,d){const u=c("info-icon"),p=c("font-awesome-icon"),f=c("el-button"),n=c("el-upload");return a(),_("div",lt,[l("div",rt,[l("div",ct,[l("span",ut,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),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:$(()=>[s(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),P(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const pt=A(at,[["render",dt],["__scopeId","data-v-6236152c"]]),mt="",ht=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=mt)}}),ft={class:"field"},_t={class:"box"},$t={class:"title-info"},vt={class:"title font-bold"},gt={class:"instrumental"},kt={class:"title inline-block"};function yt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",ft,[l("div",_t,[l("div",$t,[l("h2",vt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",gt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",kt,v(e.$t("suno.name.instrumental")),1)])]),s(f,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const wt=A(ht,[["render",yt],["__scopeId","data-v-d7004a7c"]]),bt="",Ct=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=bt)}}),St={class:"field"},Lt={class:"box"},At={class:"title font-bold"};function Et(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",St,[l("div",Lt,[l("h2",At,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const jt=A(Ct,[["render",Et],["__scopeId","data-v-99dfded8"]]),It=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Vt={class:"field"},Tt={class:"title-container"},Pt={class:"titlefont-bold"};function Ft(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Vt,[l("div",Tt,[l("h2",Pt,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=f=>e.style=f),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ut=A(It,[["render",Ft],["__scopeId","data-v-85bbfcaa"]]),zt=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Mt={class:"title-container"},Rt={class:"title font-bold"};function Dt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Gt,[l("div",Mt,[l("h2",Rt,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=f=>e.title=f),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ot=A(zt,[["render",Dt],["__scopeId","data-v-ce70fe34"]]);function G(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Wt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:M,ElInputNumber:Te,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:G,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})}}}),Bt={class:"field"},Nt={class:"box"},qt={class:"title font-bold"},Ht={class:"input-wrapper"},Zt={class:"task"},Kt={class:"left"},Xt={key:2,class:"duration"},Jt={class:"info"},Yt={class:"title"},Qt={class:"style"};function xt(e,t,i,o,r,d){const u=c("el-input-number"),p=c("el-image"),f=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=te("loading");return a(),_("div",Bt,[l("div",Nt,[l("h2",qt,v(e.$t("suno.name.extend")),1),l("div",Ht,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=h=>e.value=h),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"])])]),l("div",Zt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Kt,[s(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"?(a(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=h=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(f)]),_:1})])):y("",!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")?(a(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=h=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",Xt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Jt,[l("h2",Yt,v(e.audio?.title),1),l("p",Qt,v(e.audio?.style),1)])])):y("",!0)])])}const eo=A(Wt,[["render",xt],["__scopeId","data-v-bcce4821"]]),to=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:M,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:G,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})}}}),oo={class:"field"},so={class:"box"},no={class:"title font-bold"},io={class:"task"},ao={class:"left"},lo={key:2,class:"duration"},ro={class:"info"},co={class:"title"},uo={class:"style"};function po(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=te("loading");return a(),_("div",oo,[l("div",so,[l("h2",no,v(e.$t("suno.name.cover")),1)]),l("div",io,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ao,[s(u,{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"?(a(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(f,null,{default:$(()=>[s(p)]),_:1})])):y("",!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")?(a(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(f,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",lo,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",ro,[l("h2",co,v(e.audio?.title),1),l("p",uo,v(e.audio?.style),1)])])):y("",!0)])])}const mo=A(to,[["render",po],["__scopeId","data-v-06640216"]]),ho=C({name:"PresetPanel",components:{TypeSelector:it,PromptInput:wt,LyricInput:jt,StyleInput:Ut,TitleInput:Ot,ExtendFromInput:eo,CoverFromInput:mo,UploadAudio:pt,FontAwesomeIcon:q,ElButton:H},emits:["generate"],computed:{config(){return this.$store.state.suno?.config}},methods:{onGenerate(){this.$emit("generate")}}}),fo={class:"panel"},_o={class:"config"},$o={class:"actions"};function vo(e,t,i,o,r,d){const u=c("type-selector"),p=c("upload-audio"),f=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),h=c("extend-from-input"),b=c("cover-from-input"),T=c("font-awesome-icon"),I=c("el-button");return a(),_("div",fo,[l("div",_o,[s(u,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(f,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(h,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0),l("div",$o,[e.config?.action!=="extend"?(a(),w(I,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(I,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}const go=A(ho,[["render",vo],["__scopeId","data-v-dc0dc608"]]);var B={exports:{}},ko=B.exports,ne;function yo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(ko,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var h=new XMLHttpRequest;h.open("GET",n),h.responseType="blob",h.onload=function(){f(h.response,m,k)},h.onerror=function(){console.error("could not download file")},h.send()}function r(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,p=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var h=u.URL||u.webkitURL,b=document.createElement("a");m=m||n.name||"download",b.download=m,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,m,k):d(b,b.target="_blank")):(b.href=h.createObjectURL(n),setTimeout(function(){h.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(r(n))o(n,m,k);else{var h=document.createElement("a");h.href=n,h.target="_blank",setTimeout(function(){d(h)})}}:function(n,m,k,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var b=n.type==="application/octet-stream",T=/constructor/i.test(u.HTMLElement)||u.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||b&&T||p)&&typeof FileReader<"u"){var V=new FileReader;V.onloadend=function(){var S=V.result;S=I?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},V.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);h?h.location=F:location.href=F,h=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=f.saveAs=f,e.exports=f})}(B)),B.exports}var wo=yo();const bo="https://webhook.acedata.cloud/suno",Co=C({name:"TaskPreview",components:{ElImage:X,ElIcon:M,ElTooltip:ze,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Ue,ElDropdownMenu:Fe,ElDropdownItem:Pe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:G,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.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{wo.saveAs(d,r)})},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 onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:bo},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");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})}}}),So={class:"task"},Lo=["onClick"],Ao={class:"left"},Eo=["onClick"],jo=["onClick"],Io={key:2,class:"duration"},Vo={class:"info"},To={class:"title"},Po={class:"style"},Fo={class:"right"},Uo={class:"el-dropdown-link"},zo={class:"el-dropdown-link"};function Go(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),h=c("el-tooltip"),b=c("el-dropdown-item"),T=c("el-dropdown-menu"),I=c("el-dropdown"),V=te("loading");return a(),_("div",So,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Ao,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(f,null,{default:$(()=>[s(p)]),_:1})],8,Eo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(f,null,{default:$(()=>[s(n)]),_:1})],8,jo)):y("",!0),g?.duration?(a(),_("div",Io,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[V,!g?.audio_url]]),l("div",Vo,[l("h2",To,v(g?.title),1),l("p",Po,v(g?.style),1)]),l("div",Fo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[P(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(h,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(I,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[P(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[P(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Uo,[s(h,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(I,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[P(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[P(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[P(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",zo,[s(h,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Lo))),128))])}const Mo=A(Co,[["render",Go]]),Ro={class:"player-slider"},Do=C({__name:"PlayerSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=j({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,p)=>(a(),_("div",Ro,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Oo="/assets/disk-XFRmVAfp.png",Wo={class:"flex player-song"},Bo=["src"],No={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ho={class:"flex"},Zo={class:"ml-2 text-dc"},Ko=C({__name:"PlayerSong",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),_("div",Wo,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Oo)},null,8,Bo),l("div",No,[l("div",qo,[l("div",Ho,[l("span",null,v(i.value?.title||"Music"),1),l("span",Zo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Xo={class:"flex justify-end items-center gap-x-2.5"},Jo={class:"text-xs"},Yo=C({__name:"PlayerAction",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=j({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Xo,[l("span",Jo,v(L(G)(i.value))+" / "+v(L(G)(o.value)),1)]))}});var Qo={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function xo(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function es(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var ts=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=xo(),p=Ce(ts,Qo);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,T=d.spin,I=es(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),V=[p.prefix+"-icon"];return V.push(p.prefix+"-icon-"+e),t&&p.rtl&&V.push(p.prefix+"-icon-rtl"),T&&V.push(p.prefix+"-icon-spin"),s("span",{class:V.join(" ")},[i(I)])}}};return o}const os=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ss=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ns=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Y=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),is={class:"player-volume flex flex-col items-center pt-2"},as={class:"text-sm mt-3"},ls={class:"mt-2"},rs=C({__name:"PlayerVolumeSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=j({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,p)=>(a(),_("div",is,[l("div",null,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",as,v(i.value),1),l("div",ls,[s(Y,{icon:o.value?L(ns):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),cs={class:"flex items-center justify-center gap-x-3"},us=C({__name:"PlayerController",setup(e){const t=R(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=j(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",cs,[s(Y,{icon:o.value?.state==="playing"?L(os):L(ss),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(Ge),{placement:"top",width:"50px"},{reference:$(()=>[s(Y,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(rs)]),_:1})]))}}),ds={class:"flex flex-col items-stretch h-20"},ps={class:"flex grow px-5 items-center"},ms={class:"flex-1"},hs={class:"flex-1"},fs={class:"flex-1"},_s=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ds,[s(Do),l("div",ps,[l("div",ms,[s(Ko)]),l("div",hs,[s(us)]),l("div",fs,[s(Yo)])])]))}}),$s=C({name:"RecentPanel",components:{TaskPreview:Mo,ElSkeleton:De,ElSkeletonItem:Re,Player:_s,NoTasks:Me},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),vs={key:0,class:"tasks"},gs={class:"left"},ks={class:"main"},ys={key:1,class:"tasks"},ws={key:2,class:"w-full h-full flex items-center justify-center"},bs={class:"flex-1 flex flex-col"},Cs={class:"h-20"};function Ss(e,t,i,o,r,d){const u=c("el-skeleton-item"),p=c("el-skeleton"),f=c("task-preview"),n=c("no-tasks"),m=c("player");return a(),_(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[e.tasks?.items===void 0?(a(),_("div",vs,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",gs,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ks,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),_("div",ys,[(a(!0),_(z,null,N(e.tasks?.items,(k,h)=>(a(),w(f,{key:h,"model-value":k,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),_("div",ws,[s(n)])):y("",!0)],544),Z(l("div",bs,[l("div",Cs,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const Ls=A($s,[["render",Ss],["__scopeId","data-v-959f8920"]]),As=C({name:"TaskPreview",components:{ElScrollbar:Oe,IconPicture:Le,ElImage:X,ElAvatar:Ze,ElIcon:M},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Es={key:0,class:"card"},js={class:"image-container"},Is={class:"image-slot"},Vs={class:"title"},Ts={class:"content"},Ps={class:"artist"},Fs={class:"style"},Us={class:"time"},zs={class:"lyrics"},Gs={key:1,class:"gradient-background"};function Ms(e,t,i,o,r,d){const u=c("icon-picture"),p=c("el-icon"),f=c("el-image"),n=c("el-avatar"),m=c("el-scrollbar");return a(),w(m,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),_("div",Es,[l("div",js,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Is,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Vs,v(e.audio?.title),1)]),l("div",Ts,[l("div",Ps,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",Fs,v(e.audio?.style),1),l("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",zs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Gs))]),_:1})}const Rs=A(As,[["render",Ms],["__scopeId","data-v-9b29e9f9"]]),Ds="https://webhook.acedata.cloud/suno",Os=C({name:"SunoIndex",components:{Layout:et,ConfigPanel:go,RecentPanel:Ls,PreviewPanel:Rs},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},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===W.Request},needApply(){return this.$store.state.suno.status.getApplications===W.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}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},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(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ee&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ds},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ws(e,t,i,o,r,d){const u=c("config-panel"),p=c("recent-panel"),f=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(f)]),_:1})}const Cn=A(Os,[["render",Ws],["__scopeId","data-v-69332928"]]);export{Cn as default};
@@ -1 +1 @@
1
- import{C}from"./CopyToClipboard-B_zjEArC.js";import{d as I,d8 as F,dX as T,dY as N,dZ as P,h as B,i as r,j as o,k as i,l,t as e,x as s,b as p,D as m,y as k,o as n}from"./index-Cbr5I2Y9.js";import{d as O,a as w,s as M}from"./distribution-mwsaLSCr.js";import{g as q}from"./price-DfAGvI7c.js";import{F as R}from"./index.es-DaeHBJIN.js";import{E as z}from"./index-BCDVF19o.js";import{E as U,a as V}from"./index-XZ6jwXk2.js";import{E as A}from"./index-BeBmiTmh.js";import{E as H,a as G,b as Q}from"./index-De_ntG9v.js";import{E as Y}from"./index-DYcbA4Xy.js";import{E as j}from"./index-EFW5HXXl.js";import{E as W}from"./index-_Q_QIBBy.js";import"./index-BO9akAqw.js";import"./typescript-BMcXT3c_.js";import"./index-DFk1FoEG.js";import"./_Uint8Array-C21Rl0N8.js";import"./_initCloneObject-VeD_6fht.js";import"./isPlainObject-DC7IXBFc.js";import"./_baseIteratee-JKg-PLGw.js";import"./isEqual-By-euu_c.js";import"./castArray-CjJRTN8w.js";import"./debounce-DPEiv4qa.js";import"./index-cur6am9k.js";import"./use-form-item-DBbvHFR2.js";import"./index-Dcs3jWJX.js";import"./index-r5W6hzzQ.js";const X=I({name:"ConsoleDistributionList",components:{CopyToClipboard:C,FontAwesomeIcon:R,QrCode:F,ElProgress:W,ElRow:Q,ElCol:G,ElButton:j,ElDivider:Y,ElCard:H,ElTooltip:A,ElTable:V,ElTableColumn:U,ElSkeleton:z},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||"1")},distributionLevelMap(){let t={};return this.distributionLevels.forEach(a=>{t[a.level]=a}),t}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:q,goHistory(){this.$router.push({name:P})},goInvitees(){this.$router.push({name:N})},onPageChange(t){this.$router.push({name:this.$route.name?.toString(),query:{page:t}})},getPercentageForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,a=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-t)/(a-t)*100)},getDeltaForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(t-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await w.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){const a=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{const v=(await M.create(a))?.data?.data?.url;this.distributionLink=(v||a).replace("surl.id","share.acedata.cloud")}catch{this.distributionLink=a}},async onFetchDistributionStatus(){const{data:t}=await w.getAll({user_id:this.$store.getters.user.id});t.items&&t.items.length>0&&(this.distributionStatus=t.items[0])},async onFetchDistributionLevels(){const{data:t}=await O.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=t.items},async onFetchInvitees(){const{data:t}=await T.getInvitees({});this.invitees=t.items,this.inviteesCount=t.count}}}),Z={class:"title"},J={key:1},K={class:"icon-wrapper"},x={class:"text-left"},tt={class:"description"},et={class:"value"},it={key:1},st={class:"icon-wrapper"},ot={class:"text-left"},nt={class:"description"},lt={class:"value"},at={key:1},rt={class:"icon-wrapper"},dt={class:"text-left"},ct={class:"description"},ut={class:"value"},pt={key:1},ht={class:"icon-wrapper"},mt={class:"text-left"},_t={class:"description"},bt={class:"value"},vt={key:1},ft={class:"title"},gt={class:"clear-both overflow-hidden"},kt={class:"float-left description"},yt={class:"float-right description"},$t={class:"description"},wt={class:"level"},Lt={class:"level"},St={class:"level"},Et={key:1},Dt={class:"title"},Ct={class:"link-wrapper text-center"},It=["href"],Ft={class:"qr-wrapper ml-auto mr-auto"},Tt={class:"mt-0"},Nt={class:"description"},Pt={class:"more"};function Bt(t,a,v,Ot,Mt,qt){const d=l("el-col"),_=l("el-row"),c=l("el-skeleton"),b=l("font-awesome-icon"),f=l("el-button"),u=l("el-card"),y=l("el-tooltip"),L=l("el-progress"),$=l("el-divider"),g=l("el-table-column"),S=l("el-table"),E=l("copy-to-clipboard"),D=l("qr-code");return n(),r(_,{class:"panel"},{default:o(()=>[i(d,{span:24},{default:o(()=>[i(_,null,{default:o(()=>[i(d,{span:24},{default:o(()=>[e("h2",Z,s(t.$t("common.title.distribution")),1)]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",J,[e("div",K,[i(b,{icon:"fa-solid fa-wallet",class:"icon"})]),e("div",x,[e("p",tt,s(t.$t("distribution.title.price")),1),e("p",et,s(t.getPriceString({value:t.distributionStatus?.price})),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goHistory},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",it,[e("div",st,[i(b,{icon:"fa-solid fa-coins",class:"icon"})]),e("div",ot,[e("p",nt,s(t.$t("distribution.title.reward")),1),e("p",lt,s(t.getPriceString({value:t.distributionStatus?.reward})),1)]),i(y,{effect:"dark",content:t.$t("distribution.message.developingWithDrawal"),placement:"top"},{default:o(()=>[i(f,{type:"primary",round:"",size:"small",class:"btn"},{default:o(()=>[m(s(t.$t("distribution.button.withdrawal")),1)]),_:1})]),_:1},8,["content"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",at,[e("div",rt,[i(b,{icon:"fa-solid fa-percent",class:"icon"})]),e("div",dt,[e("p",ct,s(t.$t("distribution.title.percentage")),1),e("p",ut,s(t.distributionStatus?.level?.percentage)+"%",1)])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",pt,[e("div",ht,[i(b,{icon:"fa-regular fa-user",class:"icon"})]),e("div",mt,[e("p",_t,s(t.$t("distribution.title.inviteesCount")),1),e("p",bt,s(t.inviteesCount),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goInvitees},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"level-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",vt,[e("h4",ft,s(t.$t("distribution.title.levelInfo")),1),e("div",gt,[e("div",kt,[e("p",null,s(t.$t("distribution.title.currentLevel"))+": L"+s(t.distributionStatus?.level?.level),1),e("p",null,s(t.$t("distribution.title.currentPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level]?.percentage)+"% ",1)]),e("div",yt,[e("p",null,s(t.$t("distribution.title.nextLevel"))+": L"+s(t.distributionStatus?.level?.level+1),1),e("p",null,s(t.$t("distribution.title.nextPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level+1]?.percentage)+"% ",1)])]),i(L,{"text-inside":!0,"stroke-width":20,percentage:t.getPercentageForNextLevel(),class:"mb-2"},null,8,["percentage"]),e("p",$t,s(t.$t("distribution.message.deltaPriceForNextLevel"))+": $"+s(t.getDeltaForNextLevel()),1),i($),t.distributionLevels?(n(),r(S,{key:0,data:t.distributionLevels,stripe:""},{default:o(()=>[i(g,{label:t.$t("distribution.field.level")},{default:o(h=>[e("span",wt,"L"+s(h.row?.level),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.threshold")},{default:o(h=>[e("span",Lt,"$"+s(h.row?.threshold),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.percentage")},{default:o(h=>[e("span",St,s(h.row?.percentage)+"%",1)]),_:1},8,["label"])]),_:1},8,["data"])):k("",!0)]))]),_:1})]),_:1}),i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"distribution-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",Et,[e("h4",Dt,s(t.$t("distribution.title.distributionLink")),1),i($),e("div",Ct,[k("",!0),e("a",{href:t.distributionLink,class:"link"},s(t.distributionLink),9,It),i(E,{content:t.distributionLink},null,8,["content"])]),e("div",Ft,[t.distributionLink?(n(),r(D,{key:0,value:t.distributionLink,size:180,margin:2,class:"block mb-2 ml-auto mr-auto",type:"image/png",color:{dark:"#000000",light:"#ffffff"}},null,8,["value"])):k("",!0),e("p",Tt,s(t.$t("distribution.message.distributionQrDescription")),1)]),e("p",Nt,[m(s(t.$t("distribution.message.distributionLinkDescription"))+" ",1),e("span",Pt,[i(y,{effect:"dark",content:t.$t("distribution.message.distributionLinkDescription2"),placement:"top"},{default:o(()=>[m(s(t.$t("distribution.message.technicalDetail")),1)]),_:1},8,["content"])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const ce=B(X,[["render",Bt],["__scopeId","data-v-a8befdf2"]]);export{ce as default};
1
+ import{C}from"./CopyToClipboard-DyMPPewz.js";import{d as I,d8 as F,dY as T,dZ as N,d_ as P,h as B,i as r,j as o,k as i,l,t as e,x as s,b as p,D as m,y as k,o as n}from"./index-PzuQTcb2.js";import{d as O,a as w,s as M}from"./distribution-BDziq4nz.js";import{g as q}from"./price-CckLdzJV.js";import{F as R}from"./index.es-JfM5t2Sf.js";import{E as z}from"./index-DSHqbIyQ.js";import{E as U,a as V}from"./index-CrJlOJBH.js";import{E as A}from"./index-DmnSh2xh.js";import{E as H,a as G,b as Q}from"./index-DLmsZMpM.js";import{E as Y}from"./index-DPUHufUs.js";import{E as j}from"./index-BehSG88T.js";import{E as W}from"./index-wcGfTy7F.js";import"./index-DagREoh2.js";import"./typescript-DjoIxu2M.js";import"./index-D4I3evL9.js";import"./_Uint8Array-BVA9I_fE.js";import"./_initCloneObject-CEFMBT5z.js";import"./isPlainObject-Brlhjumy.js";import"./_baseIteratee-BnprkGcU.js";import"./isEqual-fTEz49hG.js";import"./castArray-4BvTHi4D.js";import"./debounce-BQhVlwAs.js";import"./index-bAaD18S5.js";import"./use-form-item-DK5EyE2z.js";import"./index-CdPm0FKF.js";import"./index-r5W6hzzQ.js";const Z=I({name:"ConsoleDistributionList",components:{CopyToClipboard:C,FontAwesomeIcon:R,QrCode:F,ElProgress:W,ElRow:Q,ElCol:G,ElButton:j,ElDivider:Y,ElCard:H,ElTooltip:A,ElTable:V,ElTableColumn:U,ElSkeleton:z},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||"1")},distributionLevelMap(){let t={};return this.distributionLevels.forEach(a=>{t[a.level]=a}),t}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:q,goHistory(){this.$router.push({name:P})},goInvitees(){this.$router.push({name:N})},onPageChange(t){this.$router.push({name:this.$route.name?.toString(),query:{page:t}})},getPercentageForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,a=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-t)/(a-t)*100)},getDeltaForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(t-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await w.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){const a=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{const v=(await M.create(a))?.data?.data?.url;this.distributionLink=(v||a).replace("surl.id","share.acedata.cloud")}catch{this.distributionLink=a}},async onFetchDistributionStatus(){const{data:t}=await w.getAll({user_id:this.$store.getters.user.id});t.items&&t.items.length>0&&(this.distributionStatus=t.items[0])},async onFetchDistributionLevels(){const{data:t}=await O.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=t.items},async onFetchInvitees(){const{data:t}=await T.getInvitees({});this.invitees=t.items,this.inviteesCount=t.count}}}),J={class:"title"},K={key:1},X={class:"icon-wrapper"},x={class:"text-left"},tt={class:"description"},et={class:"value"},it={key:1},st={class:"icon-wrapper"},ot={class:"text-left"},nt={class:"description"},lt={class:"value"},at={key:1},rt={class:"icon-wrapper"},dt={class:"text-left"},ct={class:"description"},ut={class:"value"},pt={key:1},ht={class:"icon-wrapper"},mt={class:"text-left"},_t={class:"description"},bt={class:"value"},vt={key:1},ft={class:"title"},gt={class:"clear-both overflow-hidden"},kt={class:"float-left description"},yt={class:"float-right description"},$t={class:"description"},wt={class:"level"},Lt={class:"level"},St={class:"level"},Et={key:1},Dt={class:"title"},Ct={class:"link-wrapper text-center"},It=["href"],Ft={class:"qr-wrapper ml-auto mr-auto"},Tt={class:"mt-0"},Nt={class:"description"},Pt={class:"more"};function Bt(t,a,v,Ot,Mt,qt){const d=l("el-col"),_=l("el-row"),c=l("el-skeleton"),b=l("font-awesome-icon"),f=l("el-button"),u=l("el-card"),y=l("el-tooltip"),L=l("el-progress"),$=l("el-divider"),g=l("el-table-column"),S=l("el-table"),E=l("copy-to-clipboard"),D=l("qr-code");return n(),r(_,{class:"panel"},{default:o(()=>[i(d,{span:24},{default:o(()=>[i(_,null,{default:o(()=>[i(d,{span:24},{default:o(()=>[e("h2",J,s(t.$t("common.title.distribution")),1)]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",K,[e("div",X,[i(b,{icon:"fa-solid fa-wallet",class:"icon"})]),e("div",x,[e("p",tt,s(t.$t("distribution.title.price")),1),e("p",et,s(t.getPriceString({value:t.distributionStatus?.price})),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goHistory},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",it,[e("div",st,[i(b,{icon:"fa-solid fa-coins",class:"icon"})]),e("div",ot,[e("p",nt,s(t.$t("distribution.title.reward")),1),e("p",lt,s(t.getPriceString({value:t.distributionStatus?.reward})),1)]),i(y,{effect:"dark",content:t.$t("distribution.message.developingWithDrawal"),placement:"top"},{default:o(()=>[i(f,{type:"primary",round:"",size:"small",class:"btn"},{default:o(()=>[m(s(t.$t("distribution.button.withdrawal")),1)]),_:1})]),_:1},8,["content"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",at,[e("div",rt,[i(b,{icon:"fa-solid fa-percent",class:"icon"})]),e("div",dt,[e("p",ct,s(t.$t("distribution.title.percentage")),1),e("p",ut,s(t.distributionStatus?.level?.percentage)+"%",1)])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",pt,[e("div",ht,[i(b,{icon:"fa-regular fa-user",class:"icon"})]),e("div",mt,[e("p",_t,s(t.$t("distribution.title.inviteesCount")),1),e("p",bt,s(t.inviteesCount),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goInvitees},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"level-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",vt,[e("h4",ft,s(t.$t("distribution.title.levelInfo")),1),e("div",gt,[e("div",kt,[e("p",null,s(t.$t("distribution.title.currentLevel"))+": L"+s(t.distributionStatus?.level?.level),1),e("p",null,s(t.$t("distribution.title.currentPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level]?.percentage)+"% ",1)]),e("div",yt,[e("p",null,s(t.$t("distribution.title.nextLevel"))+": L"+s(t.distributionStatus?.level?.level+1),1),e("p",null,s(t.$t("distribution.title.nextPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level+1]?.percentage)+"% ",1)])]),i(L,{"text-inside":!0,"stroke-width":20,percentage:t.getPercentageForNextLevel(),class:"mb-2"},null,8,["percentage"]),e("p",$t,s(t.$t("distribution.message.deltaPriceForNextLevel"))+": $"+s(t.getDeltaForNextLevel()),1),i($),t.distributionLevels?(n(),r(S,{key:0,data:t.distributionLevels,stripe:""},{default:o(()=>[i(g,{label:t.$t("distribution.field.level")},{default:o(h=>[e("span",wt,"L"+s(h.row?.level),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.threshold")},{default:o(h=>[e("span",Lt,"$"+s(h.row?.threshold),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.percentage")},{default:o(h=>[e("span",St,s(h.row?.percentage)+"%",1)]),_:1},8,["label"])]),_:1},8,["data"])):k("",!0)]))]),_:1})]),_:1}),i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"distribution-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",Et,[e("h4",Dt,s(t.$t("distribution.title.distributionLink")),1),i($),e("div",Ct,[k("",!0),e("a",{href:t.distributionLink,class:"link"},s(t.distributionLink),9,It),i(E,{content:t.distributionLink},null,8,["content"])]),e("div",Ft,[t.distributionLink?(n(),r(D,{key:0,value:t.distributionLink,size:180,margin:2,class:"block mb-2 ml-auto mr-auto",type:"image/png",color:{dark:"#000000",light:"#ffffff"}},null,8,["value"])):k("",!0),e("p",Tt,s(t.$t("distribution.message.distributionQrDescription")),1)]),e("p",Nt,[m(s(t.$t("distribution.message.distributionLinkDescription"))+" ",1),e("span",Pt,[i(y,{effect:"dark",content:t.$t("distribution.message.distributionLinkDescription2"),placement:"top"},{default:o(()=>[m(s(t.$t("distribution.message.technicalDetail")),1)]),_:1},8,["content"])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const ce=B(Z,[["render",Bt],["__scopeId","data-v-a8befdf2"]]);export{ce as default};
@@ -0,0 +1 @@
1
+ .main[data-v-d0a34fc4]{flex:1;display:flex;flex-direction:row}.main .config[data-v-d0a34fc4]{width:300px;height:100%;overflow-y:scroll;border-right:1px solid var(--el-border-color)}.main .result[data-v-d0a34fc4]{padding:15px;flex:1;width:calc(100% - 300px);height:100%;display:flex;flex-direction:column}.menu[data-v-d0a34fc4]{display:none}@media (max-width: 767px){.config[data-v-d0a34fc4]{display:none}.result[data-v-d0a34fc4]{width:100%}.menu[data-v-d0a34fc4]{display:block;position:fixed;left:15px;top:15px;z-index:2000}}.field[data-v-17c0af5c]{display:flex;flex-direction:row;align-items:center}.field .title[data-v-17c0af5c]{font-size:14px;margin:0;width:30%}.field .value[data-v-17c0af5c]{flex:1;margin-left:60px}.field[data-v-d1c54475]{display:flex;flex-direction:row;align-items:center}.field .title[data-v-d1c54475]{font-size:14px;margin:0;width:30%}.field .value[data-v-d1c54475]{flex:1}.field[data-v-b948551f]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .title[data-v-b948551f]{font-size:14px;margin:0;width:30%}.field .value[data-v-b948551f]{flex:1}.quality .el-radio-button--small .el-radio-button__inner{padding:8px 11px}.field[data-v-7b2e870a]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .title[data-v-7b2e870a]{font-size:14px;margin:0;width:30%}.field .value[data-v-7b2e870a]{width:80px}.field[data-v-55a9552e]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .title[data-v-55a9552e]{font-size:14px;margin:0;width:30%}.field .value[data-v-55a9552e]{flex:1;margin-left:60px}.field .upload-wrapper[data-v-55a9552e]{transform:translate(-26px,5px)}.field .info[data-v-55a9552e]{margin-left:auto}.field .box[data-v-b94e7a3e]{display:flex;flex-direction:row;align-items:center;justify-content:space-between;position:relative}.field .box .title[data-v-b94e7a3e]{font-size:14px;margin-bottom:10px}.field .info[data-v-b94e7a3e]{margin-left:auto}.panel[data-v-53b25bc4]{height:100%;padding:15px;display:flex;flex-direction:column;flex:1;height:calc(100% - 40px)}.panel .config[data-v-53b25bc4]{width:100%;height:calc(100% - 50px);flex:1}.panel .actions[data-v-53b25bc4]{height:50px;display:flex;justify-content:center;align-items:center}.panel .actions .btn[data-v-53b25bc4]{width:100%}.video[data-v-fc420430]{max-width:100%;height:450px}.preview[data-v-052d49ba]{width:100%;height:-moz-fit-content;height:fit-content;text-align:left;display:flex;flex-direction:row;margin-bottom:15px}.preview .left[data-v-052d49ba]{width:70px}.preview .left .avatar[data-v-052d49ba]{background-color:#222;padding:2px;width:50px;height:50px;margin:10px;border-radius:50%}.preview .main[data-v-052d49ba]{flex:1;width:calc(100% - 70px);padding:10px 10px 0}.preview .main .bot[data-v-052d49ba]{font-size:16px;font-weight:700;color:#2ecc71;margin-bottom:0;margin-top:0}.preview .main .bot .datetime[data-v-052d49ba]{font-size:12px;font-weight:400;color:var(--el-text-color-secondary);margin-left:10px}.preview .main .info .prompt[data-v-052d49ba]{font-size:14px;font-weight:700;color:var(--el-text-color-regular);margin-bottom:10px}.preview .main .content .el-alert[data-v-052d49ba]{border-left-width:2px;border-left-style:solid}.preview .main .content .el-alert.failure[data-v-052d49ba]{border-color:var(--el-color-danger)}.preview .main .content .el-alert.success[data-v-052d49ba]{border-color:var(--el-color-success)}.preview .main .content .el-alert.info[data-v-052d49ba]{border-color:var(--el-color-info)}.preview .main .image-wrapper[data-v-052d49ba]{position:relative;width:-moz-fit-content;width:fit-content;min-height:50px;min-width:100px}.preview .main .image-wrapper .image[data-v-052d49ba]{max-height:400px;max-width:500px;display:block;width:-moz-fit-content;width:fit-content}.preview .main .image-wrapper .btn-raw[data-v-052d49ba]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:1000;display:none}.preview .main .image-wrapper .play-icon[data-v-052d49ba]{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:48px;color:#fff;z-index:500;pointer-events:none}.preview .main .image-wrapper:hover .image[data-v-052d49ba]{filter:brightness(.6)}.preview .main .image-wrapper:hover .btn-raw[data-v-052d49ba]{display:block}.preview .main .image-wrapper:hover .play-icon[data-v-052d49ba]{display:none}.preview .main .operations[data-v-052d49ba]{display:flex;justify-content:left;flex-direction:row;width:100%;align-items:baseline;flex-wrap:wrap;overflow:hidden;text-align:center;color:var(--el-text-color-regular);font-size:14px;overflow-y:scroll}.preview .main .operations.full[data-v-052d49ba]{height:70px}.preview .main .operations .btn-action[data-v-052d49ba]{margin-bottom:10px}.panel[data-v-1f6b602e]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%}.panel.recent[data-v-1f6b602e]{width:100%;height:100%;display:flex;overflow-y:auto;flex-direction:column}.panel.recent .preview[data-v-1f6b602e]{margin-right:15px}.panel.recent .description[data-v-1f6b602e]{text-align:left;font-size:14px;color:var(--el-text-color-secondary)}.panel.recent .tasks[data-v-1f6b602e]{width:100%}.panel.recent .tasks .task[data-v-1f6b602e]{margin-bottom:15px;width:100%;height:-moz-fit-content;height:fit-content;text-align:left}.panel.recent .tasks .task.placeholder[data-v-1f6b602e]{display:flex;flex-direction:row}.panel.recent .tasks .task.placeholder .left[data-v-1f6b602e]{width:70px;padding:10px}.panel.recent .tasks .task.placeholder .left .avatar[data-v-1f6b602e]{width:50px;height:50px;border-radius:50%}.panel.recent .tasks .task.placeholder .main[data-v-1f6b602e]{width:calc(100% - 70px);flex:1;padding:10px;margin-bottom:10px}.panel.recent .tasks .task.placeholder .main .icon[data-v-1f6b602e]{display:flex;height:200px;width:300px}.panel.recent .tasks .task.placeholder .main .title[data-v-1f6b602e]{display:block;width:200px;height:20px;margin-bottom:15px}.panel.recent .tasks .task .operations[data-v-1f6b602e]{height:-moz-fit-content!important;height:fit-content!important}.status[data-v-f27a6245]{margin-bottom:10px}.panel.detail[data-v-f27a6245]{width:100%;flex:1;overflow-y:scroll}.panel.recent[data-v-f27a6245]{height:100%;width:100%;margin-bottom:10px;position:relative;justify-content:initial}.panel.operation[data-v-f27a6245]{position:relative}
@@ -1 +1 @@
1
- import{F as E}from"./index.es-DaeHBJIN.js";import{E as C}from"./index-EFW5HXXl.js";import{E as D}from"./index-D8KZMM1b.js";import{d as h,h as $,b as i,t as a,k as t,r as T,j as _,l as n,o as r,ev as U,x as l,F as w,v as I,i as y,ew as P,D as f,y as k,n as S,ex as j,dn as F,dj as R}from"./index-Cbr5I2Y9.js";import{E as L,a as M}from"./index-Bzx9vpDl.js";import{I as G}from"./InfoIcon-C_-GVrFj.js";import{E as B,a as O}from"./index-HscBp0fS.js";import{E as q}from"./index-Tlw0DGaS.js";import{C as N}from"./CopyToClipboard-B_zjEArC.js";import{I as z}from"./ImageWrapper-IsRbsLXL.js";import{E as H}from"./index-MUigFyNQ.js";import{E as X}from"./index-BWD3Nss6.js";import{B as K}from"./BotPlaceholder-DwgRH20-.js";import{N as W}from"./NoTasks-Cc2t-KhB.js";import{E as x}from"./index-BeZMFg4Z.js";import"./use-form-item-DBbvHFR2.js";import"./index-r5W6hzzQ.js";import"./index-BeBmiTmh.js";import"./index-DFk1FoEG.js";import"./typescript-BMcXT3c_.js";import"./index-BO9akAqw.js";import"./strings-CzjyDUaH.js";import"./castArray-CjJRTN8w.js";import"./isEqual-By-euu_c.js";import"./_Uint8Array-C21Rl0N8.js";import"./debounce-DPEiv4qa.js";import"./_baseIteratee-JKg-PLGw.js";import"./index-Dcs3jWJX.js";import"./index-BXaZ87x3.js";import"./index-BCDVF19o.js";const J=h({name:"LayoutFlux",components:{ElDrawer:D,ElButton:C,FontAwesomeIcon:E},data(){return{drawer:!1}}}),Q={class:"main"},Y={class:"config"},Z={class:"result"};function ee(e,o,p,c,g,v){const d=n("font-awesome-icon"),m=n("el-button"),s=n("el-drawer");return r(),i("div",Q,[a("div",Y,[T(e.$slots,"config",{},void 0,!0)]),a("div",Z,[T(e.$slots,"result",{},void 0,!0)]),t(m,{round:"",class:"menu",onClick:o[0]||(o[0]=u=>e.drawer=!0)},{default:_(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(s,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=u=>e.drawer=u),"with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const te=$(J,[["render",ee],["__scopeId","data-v-76342769"]]),oe=h({name:"ModelSelector",components:{ElSelect:M,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=U)}}),se={class:"field"},ne={class:"title font-bold"};function ae(e,o,p,c,g,v){const d=n("el-option"),m=n("el-select");return r(),i("div",se,[a("h2",ne,l(e.$t("flux.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=s=>e.value=s),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:_(()=>[(r(!0),i(w,null,I(e.options,s=>(r(),y(d,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const le=$(oe,[["render",ae],["__scopeId","data-v-2e94cca6"]]),re=h({name:"CountSelector",components:{ElSlider:O,InfoIcon:G,ElInputNumber:B},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=P)}}),ie={class:"flex justify-between"},ce={class:"flex justify-start items-center"},ue={class:"text-sm font-bold"},de={class:"flex justify-end items-center"},me={class:"w-full"};function pe(e,o,p,c,g,v){const d=n("info-icon"),m=n("el-input-number"),s=n("el-slider");return r(),i("div",null,[a("div",ie,[a("div",ce,[a("span",ue,l(e.$t("flux.name.numbers")),1),t(d,{content:e.$t("flux.description.numbers")},null,8,["content"])]),a("div",de,[t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=u=>e.value=u),"controls-position":"right"},null,8,["modelValue"])])]),a("div",me,[t(s,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=u=>e.value=u),min:1,max:4,step:1},null,8,["modelValue"])])])}const fe=$(re,[["render",pe]]),_e="",he=h({name:"PromptInput",components:{ElInput:q,InfoIcon:G},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=_e)}}),$e={class:"field"},ge={class:"box"},ve={class:"title font-bold"};function be(e,o,p,c,g,v){const d=n("info-icon"),m=n("el-input");return r(),i("div",$e,[a("div",ge,[a("h2",ve,l(e.$t("flux.name.prompt")),1),t(d,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=s=>e.prompt=s),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ke=$(he,[["render",be],["__scopeId","data-v-4c101a17"]]),xe=h({name:"PresetPanel",components:{ElButton:C,FontAwesomeIcon:E,PromptInput:ke,ModelSelector:le,CountSelector:fe},emits:["generate"],computed:{config(){return this.$store.state.flux?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},ye={class:"config"},Ve={class:"actions"};function Te(e,o,p,c,g,v){const d=n("prompt-input"),m=n("model-selector"),s=n("count-selector"),u=n("font-awesome-icon"),b=n("el-button");return r(),i("div",we,[a("div",ye,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),t(s,{class:"mb-4"}),a("div",Ve,[t(b,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[t(u,{icon:"fa-solid fa-magic",class:"mr-2"}),f(" "+l(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ee=$(xe,[["render",Te],["__scopeId","data-v-534faaf3"]]),Ie=h({name:"TaskPreview",components:{ElImage:X,CopyToClipboard:N,FontAwesomeIcon:E,ElAlert:H,ImageWrapper:z},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(p=>{let c=p;o&&(c.action=o),e.push(c)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Se={class:"preview"},Ce={class:"left"},Ge={class:"main"},Ae={class:"bot"},De={class:"datetime"},Ue={class:"info"},Pe={key:0,class:"prompt mt-2"},je={key:0},Fe={key:0,class:S({content:!0,failed:!0})},Re={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},Le={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Me={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Be={key:1,class:S({content:!0})},Oe={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qe={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ne={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ze={key:2,class:S({content:!0})},He={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Xe(e,o,p,c,g,v){const d=n("el-image"),m=n("image-wrapper"),s=n("font-awesome-icon"),u=n("copy-to-clipboard"),b=n("el-alert");return r(),i("div",Se,[a("div",Ce,[t(d,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),a("div",Ge,[a("div",Ae,[f(l(e.$t("flux.name.fluxBot"))+" ",1),a("span",De,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Ue,[e.modelValue?.request?.prompt?(r(),i("p",Pe,[f(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?k("",!0):(r(),i("span",je," - ("+l(e.$t("flux.status.pending"))+") ",1))])):k("",!0)]),e.modelValue?.response?.success===!0?(r(),i("div",Fe,[a("div",Re,[(r(!0),i(w,null,I(e.images,(V,A)=>(r(),y(m,{key:A,src:V?.image_url,"raw-src":V?.image_url,"model-value":V},null,8,["src","raw-src","model-value"]))),128))]),t(b,{closable:!1,class:"mt-2 success"},{default:_(()=>[a("p",Le,[t(s,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.model"))+": "+l(e.modelValue?.request?.model),1)]),a("p",Me,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):k("",!0),e.modelValue?.response?.success===!1?(r(),i("div",Be,[t(b,{closable:!1,class:"failure"},{template:_(()=>[t(s,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Oe,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),a("p",qe,[t(s,{icon:"fa-solid fa-circle-info",class:"mr-1"}),f(" "+l(e.$t("flux.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),t(u,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),a("p",Ne,[t(s,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),t(u,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):k("",!0),e.modelValue?.response?k("",!0):(r(),i("div",ze,[t(b,{closable:!1,class:"info"},{template:_(()=>[t(s,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",He,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const Ke=$(Ie,[["render",Xe],["__scopeId","data-v-fd5838a5"]]),We=h({name:"RecentPanel",components:{TaskPreview:Ke,BotPlaceholder:K,NoTasks:W},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Je={key:0},Qe={key:1,class:"tasks h-full w-full overflow-y-auto"},Ye={key:2,class:"w-full h-full flex items-center justify-center"};function Ze(e,o,p,c,g,v){const d=n("bot-placeholder"),m=n("task-preview"),s=n("no-tasks");return r(),i(w,null,[e.tasks?.items===void 0?(r(),i("div",Je,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(r(),i("div",Qe,[(r(!0),i(w,null,I(e.tasks?.items,(u,b)=>(r(),y(m,{key:b,"model-value":u},null,8,["model-value"]))),128))])):k("",!0),e.tasks?.items?.length===0?(r(),i("div",Ye,[t(s)])):k("",!0)],64)}const et=$(We,[["render",Ze]]),tt="https://webhook.acedata.cloud/flux",ot=h({name:"FluxIndex",components:{ConfigPanel:Ee,Layout:te,RecentPanel:et},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===R.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:c}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",c),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:p,createdAtMax:c})},async onGenerate(){const e={...this.config,callback_url:tt},o=this.credential?.token;if(!o){console.error("no token specified");return}x.info(this.$t("flux.message.startingTask")),j.generate(e,{token:o}).then(()=>{x.success(this.$t("flux.message.startTaskSuccess"))}).catch(p=>{const c=p?.response?.data;c?.error?.code===F?x.error(this.$t("flux.message.usedUp")):x.error(this.$t("flux.message.startTaskFailed")+c?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function st(e,o,p,c,g,v){const d=n("config-panel"),m=n("recent-panel"),s=n("layout");return r(),y(s,null,{config:_(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[t(m,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ut=$(ot,[["render",st]]);export{Ut as default};
1
+ import{F as E}from"./index.es-JfM5t2Sf.js";import{E as C}from"./index-BehSG88T.js";import{E as D}from"./index-DnYBmGDX.js";import{d as h,h as $,b as i,t as a,k as t,r as T,j as _,l as n,o as r,ew as U,x as l,F as w,v as I,i as y,ex as P,D as f,y as k,n as S,ey as j,dn as F,dj as R}from"./index-PzuQTcb2.js";import{E as L,a as M}from"./index-DjE06kE9.js";import{I as G}from"./InfoIcon-_PcwxxEr.js";import{E as B,a as O}from"./index-BY4IcCmQ.js";import{E as q}from"./index-DqR4HY--.js";import{C as N}from"./CopyToClipboard-DyMPPewz.js";import{I as z}from"./ImageWrapper-Dgt0Q2FT.js";import{E as H}from"./index-CPSVYQzh.js";import{E as X}from"./index-BXVcZgxw.js";import{B as K}from"./BotPlaceholder-BpvmBkXD.js";import{N as W}from"./NoTasks-DHmfFJrK.js";import{E as x}from"./index-Yl4965oF.js";import"./use-form-item-DK5EyE2z.js";import"./index-r5W6hzzQ.js";import"./index-DmnSh2xh.js";import"./index-D4I3evL9.js";import"./typescript-DjoIxu2M.js";import"./index-DagREoh2.js";import"./strings-UgWiDXyr.js";import"./castArray-4BvTHi4D.js";import"./isEqual-fTEz49hG.js";import"./_Uint8Array-BVA9I_fE.js";import"./debounce-BQhVlwAs.js";import"./_baseIteratee-BnprkGcU.js";import"./index-CdPm0FKF.js";import"./index-uHnIvF0e.js";import"./index-DSHqbIyQ.js";const J=h({name:"LayoutFlux",components:{ElDrawer:D,ElButton:C,FontAwesomeIcon:E},data(){return{drawer:!1}}}),Q={class:"main"},Y={class:"config"},Z={class:"result"};function ee(e,o,p,c,g,v){const d=n("font-awesome-icon"),m=n("el-button"),s=n("el-drawer");return r(),i("div",Q,[a("div",Y,[T(e.$slots,"config",{},void 0,!0)]),a("div",Z,[T(e.$slots,"result",{},void 0,!0)]),t(m,{round:"",class:"menu",onClick:o[0]||(o[0]=u=>e.drawer=!0)},{default:_(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(s,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=u=>e.drawer=u),"with-header":!1,size:"340px",class:"drawer"},{default:_(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const te=$(J,[["render",ee],["__scopeId","data-v-76342769"]]),oe=h({name:"ModelSelector",components:{ElSelect:M,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-schnell",label:"flux-schnell"},{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=U)}}),se={class:"field"},ne={class:"title font-bold"};function ae(e,o,p,c,g,v){const d=n("el-option"),m=n("el-select");return r(),i("div",se,[a("h2",ne,l(e.$t("flux.name.model")),1),t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=s=>e.value=s),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:_(()=>[(r(!0),i(w,null,I(e.options,s=>(r(),y(d,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const le=$(oe,[["render",ae],["__scopeId","data-v-2e94cca6"]]),re=h({name:"CountSelector",components:{ElSlider:O,InfoIcon:G,ElInputNumber:B},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=P)}}),ie={class:"flex justify-between"},ce={class:"flex justify-start items-center"},ue={class:"text-sm font-bold"},de={class:"flex justify-end items-center"},me={class:"w-full"};function pe(e,o,p,c,g,v){const d=n("info-icon"),m=n("el-input-number"),s=n("el-slider");return r(),i("div",null,[a("div",ie,[a("div",ce,[a("span",ue,l(e.$t("flux.name.numbers")),1),t(d,{content:e.$t("flux.description.numbers")},null,8,["content"])]),a("div",de,[t(m,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=u=>e.value=u),"controls-position":"right"},null,8,["modelValue"])])]),a("div",me,[t(s,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=u=>e.value=u),min:1,max:4,step:1},null,8,["modelValue"])])])}const fe=$(re,[["render",pe]]),_e="",he=h({name:"PromptInput",components:{ElInput:q,InfoIcon:G},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=_e)}}),$e={class:"field"},ge={class:"box"},ve={class:"title font-bold"};function be(e,o,p,c,g,v){const d=n("info-icon"),m=n("el-input");return r(),i("div",$e,[a("div",ge,[a("h2",ve,l(e.$t("flux.name.prompt")),1),t(d,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(m,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=s=>e.prompt=s),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ke=$(he,[["render",be],["__scopeId","data-v-4c101a17"]]),xe=h({name:"PresetPanel",components:{ElButton:C,FontAwesomeIcon:E,PromptInput:ke,ModelSelector:le,CountSelector:fe},emits:["generate"],computed:{config(){return this.$store.state.flux?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},ye={class:"config"},Ve={class:"actions"};function Te(e,o,p,c,g,v){const d=n("prompt-input"),m=n("model-selector"),s=n("count-selector"),u=n("font-awesome-icon"),b=n("el-button");return r(),i("div",we,[a("div",ye,[t(d,{class:"mb-4"}),t(m,{class:"mb-4"}),t(s,{class:"mb-4"}),a("div",Ve,[t(b,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:_(()=>[t(u,{icon:"fa-solid fa-magic",class:"mr-2"}),f(" "+l(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ee=$(xe,[["render",Te],["__scopeId","data-v-534faaf3"]]),Ie=h({name:"TaskPreview",components:{ElImage:X,CopyToClipboard:N,FontAwesomeIcon:E,ElAlert:H,ImageWrapper:z},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(p=>{let c=p;o&&(c.action=o),e.push(c)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Se={class:"preview"},Ce={class:"left"},Ge={class:"main"},Ae={class:"bot"},De={class:"datetime"},Ue={class:"info"},Pe={key:0,class:"prompt mt-2"},je={key:0},Fe={key:0,class:S({content:!0,failed:!0})},Re={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},Le={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Me={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Be={key:1,class:S({content:!0})},Oe={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qe={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ne={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ze={key:2,class:S({content:!0})},He={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Xe(e,o,p,c,g,v){const d=n("el-image"),m=n("image-wrapper"),s=n("font-awesome-icon"),u=n("copy-to-clipboard"),b=n("el-alert");return r(),i("div",Se,[a("div",Ce,[t(d,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),a("div",Ge,[a("div",Ae,[f(l(e.$t("flux.name.fluxBot"))+" ",1),a("span",De,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Ue,[e.modelValue?.request?.prompt?(r(),i("p",Pe,[f(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?k("",!0):(r(),i("span",je," - ("+l(e.$t("flux.status.pending"))+") ",1))])):k("",!0)]),e.modelValue?.response?.success===!0?(r(),i("div",Fe,[a("div",Re,[(r(!0),i(w,null,I(e.images,(V,A)=>(r(),y(m,{key:A,src:V?.image_url,"raw-src":V?.image_url,"model-value":V},null,8,["src","raw-src","model-value"]))),128))]),t(b,{closable:!1,class:"mt-2 success"},{default:_(()=>[a("p",Le,[t(s,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.model"))+": "+l(e.modelValue?.request?.model),1)]),a("p",Me,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):k("",!0),e.modelValue?.response?.success===!1?(r(),i("div",Be,[t(b,{closable:!1,class:"failure"},{template:_(()=>[t(s,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",Oe,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),a("p",qe,[t(s,{icon:"fa-solid fa-circle-info",class:"mr-1"}),f(" "+l(e.$t("flux.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),t(u,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),a("p",Ne,[t(s,{icon:"fa-solid fa-hashtag",class:"mr-1"}),f(" "+l(e.$t("flux.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),t(u,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):k("",!0),e.modelValue?.response?k("",!0):(r(),i("div",ze,[t(b,{closable:!1,class:"info"},{template:_(()=>[t(s,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),f(" "+l(e.$t("flux.name.failure")),1)]),default:_(()=>[a("p",He,[t(s,{icon:"fa-solid fa-magic",class:"mr-1"}),f(" "+l(e.$t("flux.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),t(u,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const Ke=$(Ie,[["render",Xe],["__scopeId","data-v-fd5838a5"]]),We=h({name:"RecentPanel",components:{TaskPreview:Ke,BotPlaceholder:K,NoTasks:W},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Je={key:0},Qe={key:1,class:"tasks h-full w-full overflow-y-auto"},Ye={key:2,class:"w-full h-full flex items-center justify-center"};function Ze(e,o,p,c,g,v){const d=n("bot-placeholder"),m=n("task-preview"),s=n("no-tasks");return r(),i(w,null,[e.tasks?.items===void 0?(r(),i("div",Je,[t(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(r(),i("div",Qe,[(r(!0),i(w,null,I(e.tasks?.items,(u,b)=>(r(),y(m,{key:b,"model-value":u},null,8,["model-value"]))),128))])):k("",!0),e.tasks?.items?.length===0?(r(),i("div",Ye,[t(s)])):k("",!0)],64)}const et=$(We,[["render",Ze]]),tt="https://webhook.acedata.cloud/flux",ot=h({name:"FluxIndex",components:{ConfigPanel:Ee,Layout:te,RecentPanel:et},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===R.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:c}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",c),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:p,createdAtMax:c})},async onGenerate(){const e={...this.config,callback_url:tt},o=this.credential?.token;if(!o){console.error("no token specified");return}x.info(this.$t("flux.message.startingTask")),j.generate(e,{token:o}).then(()=>{x.success(this.$t("flux.message.startTaskSuccess"))}).catch(p=>{const c=p?.response?.data;c?.error?.code===F?x.error(this.$t("flux.message.usedUp")):x.error(this.$t("flux.message.startTaskFailed")+c?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function st(e,o,p,c,g,v){const d=n("config-panel"),m=n("recent-panel"),s=n("layout");return r(),y(s,null,{config:_(()=>[t(d,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:_(()=>[t(m,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ut=$(ot,[["render",st]]);export{Ut as default};