@acedatacloud/nexior 3.22.0 → 3.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/assets/{Auth-8L5cO3io.js → Auth-Jv-eQvKt.js} +1 -1
  2. package/dist/assets/{BotPlaceholder-BgltR-o8.js → BotPlaceholder-BLa0cpzt.js} +1 -1
  3. package/dist/assets/{Callback-DyWvDfJO.js → Callback-Bum9BiM1.js} +1 -1
  4. package/dist/assets/{Console-BJFopxlS.js → Console-BRtrzR0A.js} +1 -1
  5. package/dist/assets/{Conversation-CAb0AtWK.js → Conversation-BaJFtqm8.js} +2 -2
  6. package/dist/assets/{CopyToClipboard-C7oZlhvf.js → CopyToClipboard-DY2B74b1.js} +1 -1
  7. package/dist/assets/{Detail-CmtTUE6G.js → Detail-CsD16GOT.js} +1 -1
  8. package/dist/assets/{EditArray-DtrBeA53.js → EditArray-4S9UzBWi.js} +1 -1
  9. package/dist/assets/{Extra-tK8KoRgk.js → Extra-5VrW6DST.js} +1 -1
  10. package/dist/assets/{FilePreview-Bc3WRYrz.js → FilePreview-wN5kQB_e.js} +1 -1
  11. package/dist/assets/{History-C3Z8TiCw.js → History-1TQ6OxMr.js} +1 -1
  12. package/dist/assets/{ImagePreview-BKjWRoxg.js → ImagePreview-0sgpwQOv.js} +1 -1
  13. package/dist/assets/{ImageWrapper-BiD890LG.js → ImageWrapper-DKM5_uAi.js} +1 -1
  14. package/dist/assets/{Index-DlwzbkYR.js → Index-2Kvi3ZG1.js} +1 -1
  15. package/dist/assets/{Index-rnba5CTp.js → Index-BgkCorWK.js} +1 -1
  16. package/dist/assets/{Index-DrByJhQj.js → Index-BvPUbw3x.js} +1 -1
  17. package/dist/assets/{Index-BLGPvG-T.js → Index-CCn1iJlI.js} +1 -1
  18. package/dist/assets/{Index-zRPRgkjp.js → Index-CNM-0MfT.js} +1 -1
  19. package/dist/assets/Index-CYdr8UQ2.css +1 -0
  20. package/dist/assets/{Index-CUIPtrqw.js → Index-Cc3XvXxK.js} +1 -1
  21. package/dist/assets/{Index-BHd9oY8p.js → Index-DJgYEmuh.js} +1 -1
  22. package/dist/assets/{Index-DNq9vfq1.js → Index-DVACGwRD.js} +1 -1
  23. package/dist/assets/{Index-B8Dt7dnR.js → Index-DofUt9jJ.js} +1 -1
  24. package/dist/assets/{Index-DMog6Dda.js → Index-DwLZ1a2J.js} +1 -1
  25. package/dist/assets/{Index-DMy8azyp.js → Index-Klpq_0LX.js} +1 -1
  26. package/dist/assets/{Index-CKlmvquc.js → Index-NtKIB8DX.js} +1 -1
  27. package/dist/assets/Index-QmEJSwQc.js +1 -0
  28. package/dist/assets/{Index-B7hP1SMu.js → Index-ic3DPXte.js} +1 -1
  29. package/dist/assets/{Index-D41eONzM.js → Index-n-YFdroV.js} +1 -1
  30. package/dist/assets/{Index-CSY50Dj-.js → Index-pH7if56e.js} +1 -1
  31. package/dist/assets/{InfoIcon-xpG6wYiZ.js → InfoIcon-GyiV0uTg.js} +1 -1
  32. package/dist/assets/{Invitees-XSlpAqAQ.js → Invitees-DR4v9AWr.js} +1 -1
  33. package/dist/assets/{List-DDJBHhhY.js → List-BImE_WZ2.js} +1 -1
  34. package/dist/assets/{List-BkGqvy_3.js → List-CdFyoNeW.js} +1 -1
  35. package/dist/assets/{List-DskwzxQy.js → List-D0g4cR_L.js} +1 -1
  36. package/dist/assets/{Login-CX-tCVs4.js → Login-fI1z72UV.js} +1 -1
  37. package/dist/assets/{Main-Dh_NJ6DX.js → Main-D2_nU9FR.js} +1 -1
  38. package/dist/assets/{Navigator-BSwktn2R.js → Navigator-VREjPTKi.js} +1 -1
  39. package/dist/assets/{NoTasks-RqxH5tU5.js → NoTasks-DpyAtW8T.js} +1 -1
  40. package/dist/assets/{Pagination-Tjr-mTrC.js → Pagination-Thhn5SDm.js} +1 -1
  41. package/dist/assets/{Status-hwkT5ahP.js → Status-BMJ-I8Pc.js} +1 -1
  42. package/dist/assets/{Subscribe-C9_YYuhz.js → Subscribe-CfYHt3j-.js} +1 -1
  43. package/dist/assets/{VideoPlayer-BAU_i6Xt.js → VideoPlayer-CvwYdNWk.js} +1 -1
  44. package/dist/assets/{_baseClone-DtzNljAk.js → _baseClone-Cfbcx9ep.js} +1 -1
  45. package/dist/assets/{_baseIteratee-W5a_Nlyi.js → _baseIteratee-B9yhARKH.js} +1 -1
  46. package/dist/assets/{_initCloneObject-BzNbsgMU.js → _initCloneObject-BWBFVXzM.js} +1 -1
  47. package/dist/assets/{castArray-C-yFxvxW.js → castArray-BOdIXw7P.js} +1 -1
  48. package/dist/assets/{debounce-D_GSfnKF.js → debounce-Dh9PsM_P.js} +1 -1
  49. package/dist/assets/{distribution-4bP9Z08I.js → distribution-DasSjrEb.js} +1 -1
  50. package/dist/assets/{dropdown-BDVhc981.js → dropdown-4Npcf-Kr.js} +1 -1
  51. package/dist/assets/{index-Bu8GYl4M.js → index-0bjCiAZ5.js} +1 -1
  52. package/dist/assets/{index-CfFbRlb3.js → index-23_QYN9_.js} +1 -1
  53. package/dist/assets/{index-DpWAouU9.js → index-3GaWssMK.js} +1 -1
  54. package/dist/assets/{index-BPLDIKYi.js → index-B6ZMVaO2.js} +1 -1
  55. package/dist/assets/{index-DG2fa-ow.js → index-B8kT6Wsa.js} +1 -1
  56. package/dist/assets/{index-BG27krBY.js → index-BEdCWb2D.js} +1 -1
  57. package/dist/assets/{index-CDRWFNPw.js → index-BXPOquOZ.js} +1 -1
  58. package/dist/assets/{index-kwhOoHli.js → index-BZ9SU4fU.js} +1 -1
  59. package/dist/assets/{index-DwKtBxI9.js → index-BiBmUtMR.js} +1 -1
  60. package/dist/assets/{index-B5qqirtZ.js → index-Bpm1ZwFr.js} +1 -1
  61. package/dist/assets/{index-D9TXWw5i.js → index-C82OwUK5.js} +1 -1
  62. package/dist/assets/{index-KMXdPkbR.js → index-CcrMfubT.js} +1 -1
  63. package/dist/assets/{index-CvUpzdE1.js → index-DEgVEBTr.js} +1 -1
  64. package/dist/assets/{index-qF8ceE1g.js → index-DF1zc4Q3.js} +1 -1
  65. package/dist/assets/{index-PrnYVdZU.js → index-DHDO1-7Q.js} +1 -1
  66. package/dist/assets/{index-DkwacTMf.js → index-DKp7DEix.js} +1 -1
  67. package/dist/assets/{index-ekLS25Os.js → index-DQAnfDDD.js} +1 -1
  68. package/dist/assets/{index-zhXzFU3e.js → index-DUw1QSi5.js} +1 -1
  69. package/dist/assets/{index-BZxyIS6v.js → index-DksfIPPT.js} +1 -1
  70. package/dist/assets/{index-ZXXqKgb5.js → index-Dyigdg3o.js} +1 -1
  71. package/dist/assets/{index-YB7WcHHr.js → index-GuFZ4Z-f.js} +1 -1
  72. package/dist/assets/{index-DA1L1iqe.js → index-TQTp7cjo.js} +1 -1
  73. package/dist/assets/{index-I256GqO3.js → index-TeONk5U_.js} +1 -1
  74. package/dist/assets/{index-Nq6BDZRS.js → index-XAvGfO8a.js} +1 -1
  75. package/dist/assets/{index-CiupJjd2.js → index-Z-vlaGQn.js} +1 -1
  76. package/dist/assets/{index-Bxn0D_Ay.js → index-Z3Ble6S3.js} +25 -25
  77. package/dist/assets/{index-CMofrOYp.js → index-iPc5VB6N.js} +1 -1
  78. package/dist/assets/{index-r5mkEdBU.js → index-k5p91wLN.js} +1 -1
  79. package/dist/assets/{index-C7dq5GDX.js → index-rzb_p--k.js} +1 -1
  80. package/dist/assets/{index.es-B1Cre0ht.js → index.es-Biw5Cjoa.js} +1 -1
  81. package/dist/assets/{isEqual-CYpeyoZ0.js → isEqual-yI-vexye.js} +1 -1
  82. package/dist/assets/{isPlainObject-STqtLEhU.js → isPlainObject-DzEmpk4D.js} +1 -1
  83. package/dist/assets/{nanobanana-2YrRz6v3.js → nanobanana-B0ViKaD_.js} +1 -1
  84. package/dist/assets/{nanobanana-BKAc3hZx.js → nanobanana-B7yj4kOe.js} +1 -1
  85. package/dist/assets/{nanobanana-D2SSwOis.js → nanobanana-B89QnYd4.js} +1 -1
  86. package/dist/assets/{nanobanana-CmkY_P0e.js → nanobanana-B8Ae8gkp.js} +1 -1
  87. package/dist/assets/{nanobanana-C0rBkMcA.js → nanobanana-BtRQd3w7.js} +1 -1
  88. package/dist/assets/{nanobanana-14UAEgql.js → nanobanana-Bz89-Qb7.js} +1 -1
  89. package/dist/assets/{nanobanana-CyP_cCvV.js → nanobanana-C6B46C-_.js} +1 -1
  90. package/dist/assets/{nanobanana-e3klWTef.js → nanobanana-CUYyVMP1.js} +1 -1
  91. package/dist/assets/{nanobanana-DfgUm0gg.js → nanobanana-D7vdmVw-.js} +1 -1
  92. package/dist/assets/{nanobanana-i9onTA8a.js → nanobanana-DFm4URNr.js} +1 -1
  93. package/dist/assets/{nanobanana-CJSXIMZE.js → nanobanana-DKwkrzv-.js} +1 -1
  94. package/dist/assets/{nanobanana-DvU_PLnr.js → nanobanana-DZufxl6k.js} +1 -1
  95. package/dist/assets/{nanobanana-t2ullRDK.js → nanobanana-DurrjwGy.js} +1 -1
  96. package/dist/assets/{nanobanana-DeJ85MK6.js → nanobanana-Dw0I1Eb-.js} +1 -1
  97. package/dist/assets/{nanobanana-D-BctJBY.js → nanobanana-GEAVYS-8.js} +1 -1
  98. package/dist/assets/{nanobanana-r4VFbfgj.js → nanobanana-HyGT4_eo.js} +1 -1
  99. package/dist/assets/{nanobanana-DzCmp44-.js → nanobanana-P-H1OheZ.js} +1 -1
  100. package/dist/assets/{nanobanana-BGAQ6TuW.js → nanobanana-vrR8h4Kp.js} +1 -1
  101. package/dist/assets/{order-DhJ-UIdx.js → order-DeDblogv.js} +1 -1
  102. package/dist/assets/{price-crtYVYmR.js → price-Bv6OtNKd.js} +1 -1
  103. package/dist/assets/{strings-Djoxz8AJ.js → strings-qqMjRuAB.js} +1 -1
  104. package/dist/assets/{typescript-14ZN9Iqb.js → typescript-CzuhH513.js} +1 -1
  105. package/dist/assets/{use-form-item-BHzDGeGF.js → use-form-item-CY8nvbwg.js} +1 -1
  106. package/dist/index.html +1 -1
  107. package/package.json +1 -1
  108. package/dist/assets/Index-3hzmS3eW.css +0 -1
  109. package/dist/assets/Index-ydXTdHB_.js +0 -1
@@ -1 +1 @@
1
- import{F as K}from"./index.es-B1Cre0ht.js";import{E as Z}from"./index-CvUpzdE1.js";import{E as de}from"./index-CDRWFNPw.js";import{as as pe,ay as me,bR as fe,at as ae,ci as he,_ as _e,d as b,a as $e,au as ve,c as F,bq as ge,bw as ye,aF as le,b as h,o as l,i as w,r as U,f as oe,e as V,j as $,bh as re,E as D,n as ke,g as we,h as E,t as r,k as s,l as c,fa as se,x as v,F as z,v as N,fb as H,cf as be,D as I,fc as Y,fd as Q,y as k,J as x,cW as ee,fe as B,b_ as Ce,dw as W,aq as P,ff as G,aw as Se,K as Ae,fg as Le,dn as Ee,dv as Ve}from"./index-Bxn0D_Ay.js";import{E as ce}from"./index-Nq6BDZRS.js";import{E as je,a as Fe}from"./index-ZXXqKgb5.js";import{I as M}from"./InfoIcon-xpG6wYiZ.js";import{E as Te}from"./index-CiupJjd2.js";import{E as L}from"./index-KMXdPkbR.js";import{E as X}from"./index-BG27krBY.js";import{E as Pe,a as ue}from"./index-CfFbRlb3.js";import{E as J}from"./index-r5mkEdBU.js";import{C as Ie,N as Ue}from"./NoTasks-RqxH5tU5.js";import{a as ze}from"./price-crtYVYmR.js";import{E as Re,a as De,b as Ge}from"./index-D9TXWw5i.js";import{E as Me}from"./index-zhXzFU3e.js";import{E as Oe}from"./index-Bu8GYl4M.js";import{E as Be,a as We}from"./index-CMofrOYp.js";import"./use-form-item-BHzDGeGF.js";import"./index-r5W6hzzQ.js";import"./index-DA1L1iqe.js";import"./index-BZxyIS6v.js";import"./typescript-14ZN9Iqb.js";import"./strings-Djoxz8AJ.js";import"./castArray-C-yFxvxW.js";import"./isEqual-CYpeyoZ0.js";import"./_initCloneObject-BzNbsgMU.js";import"./debounce-D_GSfnKF.js";import"./_baseIteratee-W5a_Nlyi.js";import"./index-ekLS25Os.js";import"./index-C7dq5GDX.js";import"./_baseClone-DtzNljAk.js";import"./index-kwhOoHli.js";import"./dropdown-BDVhc981.js";const qe=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Ne={error:e=>e instanceof Event},He=b({name:"ElAvatar"}),Ke=b({...He,props:qe,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ve(!1),u=F(()=>{const{size:n,icon:m,shape:y}=i,f=[o.b()];return ge(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),y&&f.push(o.m(y)),f}),d=F(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ye(n)||""}):void 0}),p=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function _(n){a.value=!0,t("error",n)}return(n,m)=>(l(),h("span",{class:ke(V(u)),style:oe(V(d))},[(n.src||n.srcSet)&&!a.value?(l(),h("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(V(p)),onError:_},null,44,["src","alt","srcset"])):n.icon?(l(),w(V(D),{key:1},{default:$(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ze=_e(Ke,[["__file","avatar.vue"]]);const xe=we(Ze),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:Z,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main flex flex-row flex-1"},Ye={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},Qe={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},et={class:"preview h-full w-[300px] flex flex-col"};function tt(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),_=c("el-drawer");return l(),h("div",Je,[r("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),r("div",Qe,[U(e.$slots,"result",{},void 0,!0)]),r("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=E(Xe,[["render",tt],["__scopeId","data-v-6cc632e5"]]),st=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},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"},{label:this.$t("suno.model.model45plus"),value:"chirp-v4-5-plus"},{label:this.$t("suno.model.model5"),value:"chirp-v5"}]}},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)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,a,u){const d=c("el-switch"),p=c("el-option"),_=c("el-select");return l(),h("div",nt,[r("h2",it,v(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(l(!0),h(z,null,N(e.options,n=>(l(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=E(st,[["render",at],["__scopeId","data-v-5ebe40d6"]]),rt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:Z,InfoIcon:M,FontAwesomeIcon:K},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(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.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}L.info(this.$t("suno.message.startingUploadAudio")),H.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),_=c("el-button"),n=c("el-upload");return l(),h("div",ct,[r("div",ut,[r("div",dt,[r("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(d,{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(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=E(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ht="",_t=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:M},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=ht)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},yt={class:"title font-bold"},kt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),_=c("el-input");return l(),h("div",$t,[r("div",vt,[r("div",gt,[r("h2",yt,v(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",kt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(_,{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 Ct=E(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",At=b({name:"LyricInput",components:{ElInput:X,InfoIcon:M},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=St)}}),Lt={class:"field"},Et={class:"box"},Vt={class:"title font-bold"};function jt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Lt,[r("div",Et,[r("h2",Vt,v(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Ft=E(At,[["render",jt],["__scopeId","data-v-99dfded8"]]),Tt=b({name:"StyleInput",components:{ElInput:X,InfoIcon:M},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}}}),Pt={class:"field"},It={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Pt,[r("div",It,[r("h2",Ut,v(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Rt=E(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Dt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:M},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"},Ot={class:"title font-bold"};function Bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Gt,[r("div",Mt,[r("h2",Ot,v(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Wt=E(Dt,[["render",Bt],["__scopeId","data-v-ce70fe34"]]);function R(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const qt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:D,ElInputNumber:Pe,VideoPlay:Q,VideoPause:Y},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:R,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})}}}),Nt={class:"field"},Ht={class:"box"},Kt={class:"title font-bold"},Zt={class:"input-wrapper"},xt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Yt={class:"info"},Qt={class:"title"},eo={class:"style"};function to(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),_=c("video-pause"),n=c("el-icon"),m=c("video-play"),y=ee("loading");return l(),h("div",Nt,[r("div",Ht,[r("h2",Kt,v(e.$t("suno.name.extend")),1),r("div",Zt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",xt,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[x((l(),h("div",Xt,[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"?(l(),h("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(_)]),_:1})])):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",Jt,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[y,!e.audio?.audio_url]]),r("div",Yt,[r("h2",Qt,v(e.audio?.title),1),r("p",eo,v(e.audio?.style),1)])])):k("",!0)])])}const oo=E(qt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:D,VideoPlay:Q,VideoPause:Y},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:R,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})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function fo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),h("div",no,[r("div",io,[r("h2",ao,v(e.$t("suno.name.cover")),1)]),r("div",lo,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[x((l(),h("div",ro,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[s(_,null,{default:$(()=>[s(p)]),_:1})])):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[s(_,null,{default:$(()=>[s(n)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[m,!e.audio?.audio_url]]),r("div",uo,[r("h2",po,v(e.audio?.title),1),r("p",mo,v(e.audio?.style),1)])])):k("",!0)])])}const ho=E(so,[["render",fo],["__scopeId","data-v-06640216"]]),_o=b({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:Ft,StyleInput:Rt,TitleInput:Wt,ExtendFromInput:oo,CoverFromInput:ho,UploadAudio:ft,FontAwesomeIcon:K,ElButton:Z,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return ze(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function yo(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),_=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),y=c("title-input"),f=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),h("div",$o,[r("div",vo,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?k("",!0):(l(),w(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(m,{key:2,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(y,{key:3,class:"mb-4"})):k("",!0),e.config?.action==="extend"?(l(),w(f,{key:4,class:"mb-4"})):k("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):k("",!0)]),r("div",go,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const ko=E(_o,[["render",yo],["__scopeId","data-v-b9fab929"]]);var q={exports:{}},wo=q.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,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,y){var f=new XMLHttpRequest;f.open("GET",n),f.responseType="blob",f.onload=function(){_(f.response,m,y)},f.onerror=function(){console.error("could not download file")},f.send()}function a(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function u(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 d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof B=="object"&&B.global===B?B:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),_=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,y){var f=d.URL||d.webkitURL,C=document.createElement("a");m=m||n.name||"download",C.download=m,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,m,y):u(C,C.target="_blank")):(C.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,y){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,y),m);else if(a(n))o(n,m,y);else{var f=document.createElement("a");f.href=n,f.target="_blank",setTimeout(function(){u(f)})}}:function(n,m,y,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,y);var C=n.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},A.readAsDataURL(n)}else{var O=d.URL||d.webkitURL,g=O.createObjectURL(n);f?f.location=g:location.href=g,f=null,setTimeout(function(){O.revokeObjectURL(g)},4e4)}});d.saveAs=_.saveAs=_,e.exports=_})}(q)),q.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:J,ElIcon:D,ElTooltip:Me,ElButton:Z,FontAwesomeIcon:K,VideoPlay:Q,VideoPause:Y,ElDropdown:Ge,ElDropdownMenu:De,ElDropdownItem:Re,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},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(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{Co.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},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:So},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Lo={class:"task"},Eo=["onClick"],Vo={class:"left"},jo=["onClick"],Fo=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Io={class:"title"},Uo={class:"style"},zo={class:"right"},Ro={class:"el-dropdown-link"},Do={class:"flex items-center min-w-[120px]"},Go={class:"el-dropdown-link"};function Mo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=c("el-button"),y=c("font-awesome-icon"),f=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),O=ee("loading");return l(),h("div",Lo,[(l(!0),h(z,null,N(e.audios,g=>(l(),h("div",{key:g.id,class:"audio",onClick:P(S=>e.onClick(g),["stop"])},[x((l(),h("div",Vo,[s(d,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(g),["stop"])},[s(_,null,{default:$(()=>[s(p)]),_:1})],8,jo)):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(g),["stop"])},[s(_,null,{default:$(()=>[s(n)]),_:1})],8,Fo)):k("",!0),g?.duration?(l(),h("div",To,v(e.useFormatDuring(g?.duration)),1)):k("",!0)])),[[O,!g?.audio_url]]),r("div",Po,[r("h2",Io,v(g?.title),1),r("p",Uo,v(g?.style),1)]),r("div",zo,[g?.audio_url?(l(),w(m,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):k("",!0),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[s(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(g)},{default:$(()=>[r("div",Do,[e.isFetchingVideoUrl?(l(),w(_,{key:0,class:"is-loading mr-2"},{default:$(()=>[s(C)]),_:1})):k("",!0),r("span",null,v(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,g?.audio_url),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Ro,[s(f,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(g.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):k("",!0),s(j,{onClick:P(S=>e.onCover(g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(g?.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Go,[s(f,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Eo))),128))])}const Oo=E(Ao,[["render",Mo]]),Bo={class:"player-slider"},Wo=b({__name:"PlayerSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,p)=>(l(),h("div",Bo,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=_=>i.value=_),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),qo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},Ho=["src"],Ko={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},xo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),h("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(qo)},null,8,Ho),r("div",Ko,[r("div",Zo,[r("div",xo,[r("span",null,v(i.value?.title||"Music"),1),r("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Yo={class:"flex justify-end items-center gap-x-2.5"},Qo={class:"text-xs"},es=b({__name:"PlayerAction",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),h("div",Yo,[r("span",Qo,v(V(R)(i.value))+" / "+v(V(R)(o.value)),1)]))}});var ts={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 os(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function ss(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.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:a,id:e}}var ns=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=os(),p=Se(ns,ts);return function(){var _=u.size,n=u.strokeWidth,m=u.strokeLinecap,y=u.strokeLinejoin,f=u.theme,C=u.fill,j=u.spin,T=ss(d,{size:_,strokeWidth:n,strokeLinecap:m,strokeLinejoin:y,theme:f,fill:C},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),j&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(T)])}}};return o}const is=te("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)])}),as=te("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)])}),ls=te("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)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(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"]))}}),rs={class:"player-volume flex flex-col items-center pt-2"},cs={class:"text-sm mt-3"},us=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),h("div",rs,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=p=>i.value=p),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",cs,v(i.value),1)]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=b({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),h("div",ds,[s(ie,{icon:o.value?.state==="playing"?V(is):V(as),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(V(Oe),{placement:"top",width:"50px",trigger:"click"},{reference:$(()=>[s(ie,{icon:V(ls),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},fs={class:"flex grow px-5 items-center"},hs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=b({__name:"Player",setup(e){return(t,i)=>(l(),h("div",ms,[s(Wo),r("div",fs,[r("div",hs,[s(Jo)]),r("div",_s,[s(ps)]),r("div",$s,[s(es)])])]))}}),gs=b({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:Be,TaskPreview:Oo,Player:vs,NoTasks:Ue},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"),e.scrollTop===0&&this.$emit("reach-top")}}}),ys={key:0,class:"tasks"},ks={class:"left w-[70px] p-[10px] flex items-center"},ws={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},bs={key:2,class:"w-full flex-1 flex items-center justify-center"},Cs={class:"h-20"};function Ss(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),_=c("task-preview"),n=c("no-tasks"),m=c("player");return l(),h(z,null,[e.tasks?.items===void 0?(l(),h("div",ys,[(l(),h(z,null,N(3,y=>r("div",{key:y,class:"flex"},[r("div",ks,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",ws,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),h("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...y)=>e.onHandleScroll&&e.onHandleScroll(...y))},[(l(!0),h(z,null,N(e.tasks?.items,(y,f)=>(l(),w(_,{key:f,"model-value":y,class:"preview"},null,8,["model-value"]))),128))],32)):k("",!0),e.tasks?.items?.length===0?(l(),h("div",bs,[s(n)])):k("",!0),x(r("div",Cs,[s(m)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(gs,[["render",Ss]]),Ls=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:xe,ElIcon:D},computed:{audio(){return this.$store.state.suno?.audio}}}),Es={key:0,class:"size-full overflow-hidden"},Vs={class:"relative h-[300px]"},js={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Fs={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Ts={class:"p-4"},Ps={class:"flex items-center font-bold mb-2"},Is={class:"text-[var(--el-text-color-regular)] mb-2"},Us={class:"text-xs text-[var(--el-text-color-regular)]"},zs={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Rs={key:1,class:"w-full h-full"};function Ds(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),_=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),h("div",Es,[r("div",Vs,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:$(()=>[r("div",js,[s(p,{class:"text-3xl"},{default:$(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Fs,v(e.audio?.title),1)]),r("div",Ts,[r("div",Ps,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,v(e.audio?.title),1)]),r("p",Is,v(e.audio?.style),1),r("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),r("div",zs,[r("p",null,v(e.audio?.lyric),1)])])])):(l(),h("div",Rs))}const Gs=E(Ls,[["render",Ds]]),Ms="https://webhook.acedata.cloud/suno",Os=b({name:"SunoIndex",components:{Layout:ot,ConfigPanel:ko,RecentPanel:As,PreviewPanel:Gs},inject:["initialized"],data(){return{task:void 0,job: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},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},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(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.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:Ms},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.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,a,u){const d=c("config-panel"),p=c("recent-panel"),_=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:$(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(_)]),_:1})}const Cn=E(Os,[["render",Bs],["__scopeId","data-v-f5721d95"]]);export{Cn as default};
1
+ import{F as K}from"./index.es-Biw5Cjoa.js";import{E as Z}from"./index-DEgVEBTr.js";import{E as de}from"./index-BXPOquOZ.js";import{as as pe,ay as me,bR as fe,at as ae,ci as he,_ as _e,d as b,a as $e,au as ve,c as F,bq as ge,bw as ye,aF as le,b as h,o as l,i as w,r as U,f as oe,e as V,j as $,bh as re,E as D,n as ke,g as we,h as E,t as r,k as s,l as c,fa as se,x as v,F as z,v as N,fb as H,cf as be,D as I,fc as Y,fd as Q,y as k,J as x,cW as ee,fe as B,b_ as Ce,dw as W,aq as P,ff as G,aw as Se,K as Ae,fg as Le,dn as Ee,dv as Ve}from"./index-Z3Ble6S3.js";import{E as ce}from"./index-XAvGfO8a.js";import{E as je,a as Fe}from"./index-Dyigdg3o.js";import{I as M}from"./InfoIcon-GyiV0uTg.js";import{E as Te}from"./index-Z-vlaGQn.js";import{E as L}from"./index-CcrMfubT.js";import{E as X}from"./index-BEdCWb2D.js";import{E as Pe,a as ue}from"./index-23_QYN9_.js";import{E as J}from"./index-k5p91wLN.js";import{C as Ie,N as Ue}from"./NoTasks-DpyAtW8T.js";import{a as ze}from"./price-Bv6OtNKd.js";import{E as Re,a as De,b as Ge}from"./index-C82OwUK5.js";import{E as Me}from"./index-DUw1QSi5.js";import{E as Oe}from"./index-0bjCiAZ5.js";import{E as Be,a as We}from"./index-iPc5VB6N.js";import"./use-form-item-CY8nvbwg.js";import"./index-r5W6hzzQ.js";import"./index-TQTp7cjo.js";import"./index-DksfIPPT.js";import"./typescript-CzuhH513.js";import"./strings-qqMjRuAB.js";import"./castArray-BOdIXw7P.js";import"./isEqual-yI-vexye.js";import"./_initCloneObject-BWBFVXzM.js";import"./debounce-Dh9PsM_P.js";import"./_baseIteratee-B9yhARKH.js";import"./index-DQAnfDDD.js";import"./index-rzb_p--k.js";import"./_baseClone-Cfbcx9ep.js";import"./index-BZ9SU4fU.js";import"./dropdown-4Npcf-Kr.js";const qe=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Ne={error:e=>e instanceof Event},He=b({name:"ElAvatar"}),Ke=b({...He,props:qe,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ve(!1),u=F(()=>{const{size:n,icon:m,shape:y}=i,f=[o.b()];return ge(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),y&&f.push(o.m(y)),f}),d=F(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ye(n)||""}):void 0}),p=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function _(n){a.value=!0,t("error",n)}return(n,m)=>(l(),h("span",{class:ke(V(u)),style:oe(V(d))},[(n.src||n.srcSet)&&!a.value?(l(),h("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(V(p)),onError:_},null,44,["src","alt","srcset"])):n.icon?(l(),w(V(D),{key:1},{default:$(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ze=_e(Ke,[["__file","avatar.vue"]]);const xe=we(Ze),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:Z,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main flex flex-row flex-1"},Ye={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},Qe={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},et={class:"preview h-full w-[300px] flex flex-col"};function tt(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),_=c("el-drawer");return l(),h("div",Je,[r("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),r("div",Qe,[U(e.$slots,"result",{},void 0,!0)]),r("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=E(Xe,[["render",tt],["__scopeId","data-v-6cc632e5"]]),st=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},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"},{label:this.$t("suno.model.model45plus"),value:"chirp-v4-5-plus"},{label:this.$t("suno.model.model5"),value:"chirp-v5"}]}},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)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,a,u){const d=c("el-switch"),p=c("el-option"),_=c("el-select");return l(),h("div",nt,[r("h2",it,v(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(l(!0),h(z,null,N(e.options,n=>(l(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=E(st,[["render",at],["__scopeId","data-v-5ebe40d6"]]),rt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:Z,InfoIcon:M,FontAwesomeIcon:K},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(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.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}L.info(this.$t("suno.message.startingUploadAudio")),H.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),_=c("el-button"),n=c("el-upload");return l(),h("div",ct,[r("div",ut,[r("div",dt,[r("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(d,{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(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=E(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ht="",_t=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:M},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=ht)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},yt={class:"title font-bold"},kt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),_=c("el-input");return l(),h("div",$t,[r("div",vt,[r("div",gt,[r("h2",yt,v(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",kt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(_,{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 Ct=E(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",At=b({name:"LyricInput",components:{ElInput:X,InfoIcon:M},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=St)}}),Lt={class:"field"},Et={class:"box"},Vt={class:"title font-bold"};function jt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Lt,[r("div",Et,[r("h2",Vt,v(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Ft=E(At,[["render",jt],["__scopeId","data-v-99dfded8"]]),Tt=b({name:"StyleInput",components:{ElInput:X,InfoIcon:M},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}}}),Pt={class:"field"},It={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Pt,[r("div",It,[r("h2",Ut,v(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Rt=E(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Dt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:M},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"},Ot={class:"title font-bold"};function Bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Gt,[r("div",Mt,[r("h2",Ot,v(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Wt=E(Dt,[["render",Bt],["__scopeId","data-v-ce70fe34"]]);function R(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const qt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:D,ElInputNumber:Pe,VideoPlay:Q,VideoPause:Y},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:R,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})}}}),Nt={class:"field"},Ht={class:"box"},Kt={class:"title font-bold"},Zt={class:"input-wrapper"},xt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Yt={class:"info"},Qt={class:"title"},eo={class:"style"};function to(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),_=c("video-pause"),n=c("el-icon"),m=c("video-play"),y=ee("loading");return l(),h("div",Nt,[r("div",Ht,[r("h2",Kt,v(e.$t("suno.name.extend")),1),r("div",Zt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",xt,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[x((l(),h("div",Xt,[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"?(l(),h("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(_)]),_:1})])):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",Jt,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[y,!e.audio?.audio_url]]),r("div",Yt,[r("h2",Qt,v(e.audio?.title),1),r("p",eo,v(e.audio?.style),1)])])):k("",!0)])])}const oo=E(qt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:D,VideoPlay:Q,VideoPause:Y},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:R,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})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function fo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),h("div",no,[r("div",io,[r("h2",ao,v(e.$t("suno.name.cover")),1)]),r("div",lo,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[x((l(),h("div",ro,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[s(_,null,{default:$(()=>[s(p)]),_:1})])):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[s(_,null,{default:$(()=>[s(n)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[m,!e.audio?.audio_url]]),r("div",uo,[r("h2",po,v(e.audio?.title),1),r("p",mo,v(e.audio?.style),1)])])):k("",!0)])])}const ho=E(so,[["render",fo],["__scopeId","data-v-06640216"]]),_o=b({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:Ft,StyleInput:Rt,TitleInput:Wt,ExtendFromInput:oo,CoverFromInput:ho,UploadAudio:ft,FontAwesomeIcon:K,ElButton:Z,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return ze(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function yo(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),_=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),y=c("title-input"),f=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),h("div",$o,[r("div",vo,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?k("",!0):(l(),w(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(m,{key:2,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(y,{key:3,class:"mb-4"})):k("",!0),e.config?.action==="extend"?(l(),w(f,{key:4,class:"mb-4"})):k("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):k("",!0)]),r("div",go,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const ko=E(_o,[["render",yo],["__scopeId","data-v-b9fab929"]]);var q={exports:{}},wo=q.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,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,y){var f=new XMLHttpRequest;f.open("GET",n),f.responseType="blob",f.onload=function(){_(f.response,m,y)},f.onerror=function(){console.error("could not download file")},f.send()}function a(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function u(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 d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof B=="object"&&B.global===B?B:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),_=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,y){var f=d.URL||d.webkitURL,C=document.createElement("a");m=m||n.name||"download",C.download=m,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,m,y):u(C,C.target="_blank")):(C.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,y){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,y),m);else if(a(n))o(n,m,y);else{var f=document.createElement("a");f.href=n,f.target="_blank",setTimeout(function(){u(f)})}}:function(n,m,y,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,y);var C=n.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},A.readAsDataURL(n)}else{var O=d.URL||d.webkitURL,g=O.createObjectURL(n);f?f.location=g:location.href=g,f=null,setTimeout(function(){O.revokeObjectURL(g)},4e4)}});d.saveAs=_.saveAs=_,e.exports=_})}(q)),q.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:J,ElIcon:D,ElTooltip:Me,ElButton:Z,FontAwesomeIcon:K,VideoPlay:Q,VideoPause:Y,ElDropdown:Ge,ElDropdownMenu:De,ElDropdownItem:Re,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},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(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{Co.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},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:So},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Lo={class:"task"},Eo=["onClick"],Vo={class:"left"},jo=["onClick"],Fo=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Io={class:"title"},Uo={class:"style"},zo={class:"right"},Ro={class:"el-dropdown-link"},Do={class:"flex items-center min-w-[120px]"},Go={class:"el-dropdown-link"};function Mo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=c("el-button"),y=c("font-awesome-icon"),f=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),O=ee("loading");return l(),h("div",Lo,[(l(!0),h(z,null,N(e.audios,g=>(l(),h("div",{key:g.id,class:"audio",onClick:P(S=>e.onClick(g),["stop"])},[x((l(),h("div",Vo,[s(d,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(g),["stop"])},[s(_,null,{default:$(()=>[s(p)]),_:1})],8,jo)):k("",!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")?(l(),h("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(g),["stop"])},[s(_,null,{default:$(()=>[s(n)]),_:1})],8,Fo)):k("",!0),g?.duration?(l(),h("div",To,v(e.useFormatDuring(g?.duration)),1)):k("",!0)])),[[O,!g?.audio_url]]),r("div",Po,[r("h2",Io,v(g?.title),1),r("p",Uo,v(g?.style),1)]),r("div",zo,[g?.audio_url?(l(),w(m,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):k("",!0),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[s(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(g)},{default:$(()=>[r("div",Do,[e.isFetchingVideoUrl?(l(),w(_,{key:0,class:"is-loading mr-2"},{default:$(()=>[s(C)]),_:1})):k("",!0),r("span",null,v(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,g?.audio_url),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Ro,[s(f,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(g.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):k("",!0),s(j,{onClick:P(S=>e.onCover(g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(g?.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Go,[s(f,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Eo))),128))])}const Oo=E(Ao,[["render",Mo]]),Bo={class:"player-slider"},Wo=b({__name:"PlayerSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,p)=>(l(),h("div",Bo,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=_=>i.value=_),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),qo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},Ho=["src"],Ko={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},xo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),h("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(qo)},null,8,Ho),r("div",Ko,[r("div",Zo,[r("div",xo,[r("span",null,v(i.value?.title||"Music"),1),r("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Yo={class:"flex justify-end items-center gap-x-2.5"},Qo={class:"text-xs"},es=b({__name:"PlayerAction",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),h("div",Yo,[r("span",Qo,v(V(R)(i.value))+" / "+v(V(R)(o.value)),1)]))}});var ts={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 os(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function ss(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.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:a,id:e}}var ns=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=os(),p=Se(ns,ts);return function(){var _=u.size,n=u.strokeWidth,m=u.strokeLinecap,y=u.strokeLinejoin,f=u.theme,C=u.fill,j=u.spin,T=ss(d,{size:_,strokeWidth:n,strokeLinecap:m,strokeLinejoin:y,theme:f,fill:C},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),j&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(T)])}}};return o}const is=te("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)])}),as=te("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)])}),ls=te("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)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(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"]))}}),rs={class:"player-volume flex flex-col items-center pt-2"},cs={class:"text-sm mt-3"},us=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),h("div",rs,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=p=>i.value=p),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",cs,v(i.value),1)]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=b({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),h("div",ds,[s(ie,{icon:o.value?.state==="playing"?V(is):V(as),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(V(Oe),{placement:"top",width:"50px",trigger:"click"},{reference:$(()=>[s(ie,{icon:V(ls),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},fs={class:"flex grow px-5 items-center"},hs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=b({__name:"Player",setup(e){return(t,i)=>(l(),h("div",ms,[s(Wo),r("div",fs,[r("div",hs,[s(Jo)]),r("div",_s,[s(ps)]),r("div",$s,[s(es)])])]))}}),gs=b({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:Be,TaskPreview:Oo,Player:vs,NoTasks:Ue},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"),e.scrollTop===0&&this.$emit("reach-top")}}}),ys={key:0,class:"tasks"},ks={class:"left w-[70px] p-[10px] flex items-center"},ws={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},bs={key:2,class:"w-full flex-1 flex items-center justify-center"},Cs={class:"h-20"};function Ss(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),_=c("task-preview"),n=c("no-tasks"),m=c("player");return l(),h(z,null,[e.tasks?.items===void 0?(l(),h("div",ys,[(l(),h(z,null,N(3,y=>r("div",{key:y,class:"flex"},[r("div",ks,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",ws,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),h("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...y)=>e.onHandleScroll&&e.onHandleScroll(...y))},[(l(!0),h(z,null,N(e.tasks?.items,(y,f)=>(l(),w(_,{key:f,"model-value":y,class:"preview"},null,8,["model-value"]))),128))],32)):k("",!0),e.tasks?.items?.length===0?(l(),h("div",bs,[s(n)])):k("",!0),x(r("div",Cs,[s(m)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(gs,[["render",Ss]]),Ls=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:xe,ElIcon:D},computed:{audio(){return this.$store.state.suno?.audio}}}),Es={key:0,class:"size-full overflow-hidden"},Vs={class:"relative h-[300px]"},js={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Fs={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Ts={class:"p-4"},Ps={class:"flex items-center font-bold mb-2"},Is={class:"text-[var(--el-text-color-regular)] mb-2"},Us={class:"text-xs text-[var(--el-text-color-regular)]"},zs={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Rs={key:1,class:"w-full h-full"};function Ds(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),_=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),h("div",Es,[r("div",Vs,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:$(()=>[r("div",js,[s(p,{class:"text-3xl"},{default:$(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Fs,v(e.audio?.title),1)]),r("div",Ts,[r("div",Ps,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,v(e.audio?.title),1)]),r("p",Is,v(e.audio?.style),1),r("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),r("div",zs,[r("p",null,v(e.audio?.lyric),1)])])])):(l(),h("div",Rs))}const Gs=E(Ls,[["render",Ds]]),Ms="https://webhook.acedata.cloud/suno",Os=b({name:"SunoIndex",components:{Layout:ot,ConfigPanel:ko,RecentPanel:As,PreviewPanel:Gs},inject:["initialized"],data(){return{task:void 0,job: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},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},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(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.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:Ms},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.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,a,u){const d=c("config-panel"),p=c("recent-panel"),_=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:$(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(_)]),_:1})}const Cn=E(Os,[["render",Bs],["__scopeId","data-v-f5721d95"]]);export{Cn as default};
@@ -1 +1 @@
1
- import{F as G}from"./index.es-B1Cre0ht.js";import{E as R}from"./index-CvUpzdE1.js";import{E as M}from"./index-CDRWFNPw.js";import{d as $,h as g,b as r,t as l,k as t,r as L,j as u,l as s,o as n,eJ as z,x as a,F as C,v as U,i as y,eK as N,eL as q,eM as H,n as T,f as J,y as f,cf as K,D as h,J as E,K as S,eN as Q,dA as W,dw as X}from"./index-Bxn0D_Ay.js";import{E as D,a as O}from"./index-ZXXqKgb5.js";import{I as j}from"./InfoIcon-xpG6wYiZ.js";import{E as Y}from"./index-Nq6BDZRS.js";import{V as P}from"./VideoPlayer-BAU_i6Xt.js";import{I as Z}from"./ImagePreview-BKjWRoxg.js";import{E as x}from"./index-CiupJjd2.js";import{E as I}from"./index-KMXdPkbR.js";import{C as ee,N as te}from"./NoTasks-RqxH5tU5.js";import{E as oe}from"./index-BG27krBY.js";import{a as se}from"./price-crtYVYmR.js";import{C as ne}from"./CopyToClipboard-C7oZlhvf.js";import{E as ae}from"./index-zhXzFU3e.js";import{E as le}from"./index-I256GqO3.js";import{E as ie}from"./index-r5mkEdBU.js";import{B as re}from"./BotPlaceholder-BgltR-o8.js";import"./use-form-item-BHzDGeGF.js";import"./index-r5W6hzzQ.js";import"./index-BZxyIS6v.js";import"./typescript-14ZN9Iqb.js";import"./index-DA1L1iqe.js";import"./strings-Djoxz8AJ.js";import"./castArray-C-yFxvxW.js";import"./isEqual-CYpeyoZ0.js";import"./_initCloneObject-BzNbsgMU.js";import"./debounce-D_GSfnKF.js";import"./_baseIteratee-W5a_Nlyi.js";import"./index-ekLS25Os.js";import"./vue-plyr-QZFBikSk.js";import"./index-C7dq5GDX.js";import"./_baseClone-DtzNljAk.js";import"./index-kwhOoHli.js";import"./index-CMofrOYp.js";const ce=$({name:"LayoutVeo",components:{ElDrawer:M,ElButton:R,FontAwesomeIcon:G},data(){return{drawer:!1}}}),de={class:"main flex flex-row flex-1"},ue={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},pe={class:"result h-full p-[15px] flex-1 flex flex-col"};function me(e,o,m,v,b,w){const c=s("font-awesome-icon"),d=s("el-button"),i=s("el-drawer");return n(),r("div",de,[l("div",ue,[L(e.$slots,"config",{},void 0,!0)]),l("div",pe,[L(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=k=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=k=>e.drawer=k),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[L(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const fe=g(ce,[["render",me],["__scopeId","data-v-cfe3cae3"]]),ve=$({name:"ModelSelector",components:{ElSelect:O,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"veo2",label:"veo2"},{value:"veo2-fast",label:"veo2-fast"},{value:"veo3",label:"veo3"},{value:"veo3-fast",label:"veo3-fast"}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||(this.value=z)}}),_e={class:"field"},he={class:"title font-bold"};function $e(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",_e,[l("h2",he,a(e.$t("veo.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select")},{default:u(()=>[(n(!0),r(C,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ge=g(ve,[["render",$e],["__scopeId","data-v-ef445fc5"]]),be=$({name:"ActionSelector",components:{ElSelect:O,ElOption:D},data(){return{}},computed:{options(){return[{value:"text2video",label:this.$t("veo.button.action1")},{value:"image2video",label:this.$t("veo.button.action2")},{value:"get1080p",label:this.$t("veo.button.action3")}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||(this.value=N)}}),we={class:"field"},ke={class:"title font-bold"},ye={class:"float-left"};function Ve(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",we,[l("h2",ke,a(e.$t("veo.name.action")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select"),clearable:""},{default:u(()=>[(n(!0),r(C,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},{default:u(()=>[l("span",ye,a(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(be,[["render",Ve],["__scopeId","data-v-ba5abc8a"]]),Se=$({name:"TranslationSelector",components:{ElSwitch:Y,InfoIcon:j},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug("set translation",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=q)}}),Ie={class:"relative"},Te={class:"flex justify-between"},Ae={class:"flex justify-start items-center"},Ce={class:"text-sm font-bold"},Ge={class:"flex justify-end items-center"};function Re(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-switch");return n(),r("div",Ie,[l("div",Te,[l("div",Ae,[l("span",Ce,a(e.$t("veo.name.translation")),1),t(c,{content:e.$t("veo.description.translation")},null,8,["content"])]),l("div",Ge,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"])])])])}const Ue=g(Se,[["render",Re]]),Le=$({name:"AspectRatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=H)}}),je={class:"text-sm font-bold mb-2 block"},De={class:"items"},Oe=["onClick"],Pe={class:"name"};function Fe(e,o,m,v,b,w){return n(),r("div",null,[l("span",je,a(e.$t("veo.name.ratio")),1),l("div",De,[(n(!0),r(C,null,U(e.options,(c,d)=>(n(),r("div",{key:d,class:T({active:e.active===d,item:!0}),onClick:i=>e.value=c.value},[l("div",{class:T(["preview",c.label])},[l("div",{class:"rect",style:J({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Pe,a(c.label),1)],10,Oe))),128))])])}const Be=g(Le,[["render",Fe],["__scopeId","data-v-688d3e9d"]]),Me=$({name:"VideoFromInput",components:{VideoPlayer:P},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),ze={class:"relative"},Ne={class:"flex mb-2"},qe={class:"text-sm font-bold"};function He(e,o,m,v,b,w){const c=s("video-player");return n(),r("div",ze,[l("div",Ne,[l("span",qe,a(e.$t("veo.name.action3")),1)]),l("div",null,[e.config?.video_url?(n(),y(c,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const Je=g(Me,[["render",He]]),Ke=$({name:"StartEndImage",components:{ElUpload:x,ElButton:R,InfoIcon:j,FontAwesomeIcon:G,ImagePreview:Z},emits:["change"],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartEndImageUrl()},methods:{onExceed(){I.warning(this.$t("veo.message.uploadReferencesExceed"))},onError(){I.error(this.$t("veo.message.uploadReferencesError"))},onSetStartEndImageUrl(){const e=this.urls;this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Qe={class:"relative"},We={class:"flex justify-between"},Xe={class:"flex justify-start items-center"},Ye={class:"text-sm font-bold"};function Ze(e,o,m,v,b,w){const c=s("info-icon"),d=s("image-preview"),i=s("font-awesome-icon"),k=s("el-button"),_=s("el-upload");return n(),r("div",Qe,[l("div",We,[l("div",Xe,[l("span",Ye,a(e.$t("veo.name.startEndImage")),1),t(c,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),t(_,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:2,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(k,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(i,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+a(e.$t("veo.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const xe=g(Ke,[["render",Ze],["__scopeId","data-v-43d971b7"]]),et="",tt=$({name:"PromptInput",components:{ElInput:oe,InfoIcon:j},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=et)}}),ot={class:"field"},st={class:"box"},nt={class:"title font-bold"};function at(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-input");return n(),r("div",ot,[l("div",st,[l("h2",nt,a(e.$t("veo.name.prompt")),1),t(c,{content:e.$t("veo.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=i=>e.prompt=i),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("veo.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const lt=g(tt,[["render",at],["__scopeId","data-v-9189572a"]]),it=$({name:"ConfigPanel",components:{ElButton:R,Consumption:ee,FontAwesomeIcon:G,PromptInput:lt,ModelSelector:ge,StartEndImage:xe,ActionSelector:Ee,VideoFromInput:Je,TranslationSelector:Ue,AspectRatioSelector:Be},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return se(this.config,this.service?.metadata?.price)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),rt={class:"flex flex-col h-full"},ct={class:"flex-1 overflow-y-auto p-[15px]"},dt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ut(e,o,m,v,b,w){const c=s("video-from-input"),d=s("action-selector"),i=s("translation-selector"),k=s("aspect-ratio-selector"),_=s("prompt-input"),p=s("model-selector"),V=s("start-end-image"),A=s("consumption"),F=s("font-awesome-icon"),B=s("el-button");return n(),r("div",rt,[l("div",ct,[E(t(c,{class:"mb-4"},null,512),[[S,e.config?.action==="get1080p"]]),t(d,{class:"mb-4"}),E(t(i,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(k,{class:"mb-4"},null,512),[[S,e.config?.action==="image2video"]]),E(t(_,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(p,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(V,{class:"mb-2"},null,512),[[S,e.config?.action==="image2video"]])]),l("div",dt,[t(A,{value:e.consumption,service:e.service},null,8,["value","service"]),t(B,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(F,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+a(e.$t("veo.button.generate")),1)]),_:1},8,["onClick"])])])}const pt=g(it,[["render",ut]]),mt=$({name:"TaskPreview",components:{ElImage:ie,CopyToClipboard:ne,FontAwesomeIcon:G,ElAlert:le,VideoPlayer:P,ElTooltip:ae,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onGet1080p(e,o){console.debug("set config",o),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,video_id:o?.data?.[0]?.id,video_url:o?.data[0]?.video_url,action:"get1080p"})},onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ft={class:"preview"},vt={class:"left"},_t={class:"main"},ht={class:"bot"},$t={class:"datetime"},gt={class:"info"},bt={key:0,class:"prompt mt-2"},wt={key:0},kt={key:1},yt={key:0,class:T({content:!0,failed:!0})},Vt={key:0,class:"mb-4"},Et={key:1,class:T({operations:!0,"mt-2":!0})},St={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},It={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Tt={key:1,class:T({content:!0})},At={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Gt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Rt={key:2,class:T({content:!0})},Ut={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Lt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function jt(e,o,m,v,b,w){const c=s("el-image"),d=s("video-player"),i=s("el-button"),k=s("el-tooltip"),_=s("font-awesome-icon"),p=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",ft,[l("div",vt,[t(c,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),l("div",_t,[l("div",ht,[h(a(e.$t("veo.name.veoBot"))+" ",1),l("span",$t,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",gt,[e.modelValue?.request?.prompt?(n(),r("p",bt,[h(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(n(),r("span",wt," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",kt," - ("+a(e.$t("veo.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",yt,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",Vt,[t(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response.success?(n(),r("div",Et,[t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=A=>e.onGet1080p(A,e.modelValue?.response))},{default:u(()=>[h(a(e.$t("veo.button.action3")),1)]),_:1})):f("",!0)]),_:1},8,["content"]),t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=A=>e.onDownload(A,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(a(e.$t("veo.button.download")),1)]),_:1})):f("",!0)]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",St,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),l("p",It,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Tt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",At,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",Ct,[t(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+a(e.$t("veo.name.failureReason"))+": "+a(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Gt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Rt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ut,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Lt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0)])])}const Dt=g(mt,[["render",jt],["__scopeId","data-v-5372c9d1"]]),Ot=$({name:"RecentPanel",components:{TaskPreview:Dt,NoTasks:te,BotPlaceholder:re},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.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")}}}),Pt={key:0},Ft={key:1,class:"tasks h-full w-full overflow-y-auto"},Bt={key:2,class:"w-full h-full flex items-center justify-center"};function Mt(e,o,m,v,b,w){const c=s("bot-placeholder"),d=s("task-preview"),i=s("no-tasks");return n(),r(C,null,[e.tasks?.items===void 0?(n(),r("div",Pt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",Ft,[(n(!0),r(C,null,U(e.tasks?.items,(k,_)=>(n(),y(d,{key:_,"model-value":k},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(n(),r("div",Bt,[t(i)])):f("",!0)],64)}const zt=g(Ot,[["render",Mt]]),Nt="https://webhook.acedata.cloud/veo",qt=$({name:"VeoIndex",components:{ConfigPanel:pt,Layout:fe,RecentPanel:zt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.veo?.status?.getApplications===X.Request},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},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("veo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("veo/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:v}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",v),await this.$store.dispatch("veo/getTasks",{limit:o,createdAtMin:m,createdAtMax:v})},async onGenerate(){const e={...this.config,callback_url:Nt},o=this.credential?.token;if(!o){console.error("no token specified");return}I.info(this.$t("veo.message.startingTask")),Q.generate(e,{token:o}).then(()=>{I.success(this.$t("veo.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===W?I.error(this.$t("veo.message.usedUp")):I.error(this.$t("veo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ht(e,o,m,v,b,w){const c=s("config-panel"),d=s("recent-panel"),i=s("layout");return n(),y(i,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ao=g(qt,[["render",Ht]]);export{Ao as default};
1
+ import{F as G}from"./index.es-Biw5Cjoa.js";import{E as R}from"./index-DEgVEBTr.js";import{E as M}from"./index-BXPOquOZ.js";import{d as $,h as g,b as r,t as l,k as t,r as L,j as u,l as s,o as n,eJ as z,x as a,F as C,v as U,i as y,eK as N,eL as q,eM as H,n as T,f as J,y as f,cf as K,D as h,J as E,K as S,eN as Q,dA as W,dw as X}from"./index-Z3Ble6S3.js";import{E as D,a as O}from"./index-Dyigdg3o.js";import{I as j}from"./InfoIcon-GyiV0uTg.js";import{E as Y}from"./index-XAvGfO8a.js";import{V as P}from"./VideoPlayer-CvwYdNWk.js";import{I as Z}from"./ImagePreview-0sgpwQOv.js";import{E as x}from"./index-Z-vlaGQn.js";import{E as I}from"./index-CcrMfubT.js";import{C as ee,N as te}from"./NoTasks-DpyAtW8T.js";import{E as oe}from"./index-BEdCWb2D.js";import{a as se}from"./price-Bv6OtNKd.js";import{C as ne}from"./CopyToClipboard-DY2B74b1.js";import{E as ae}from"./index-DUw1QSi5.js";import{E as le}from"./index-TeONk5U_.js";import{E as ie}from"./index-k5p91wLN.js";import{B as re}from"./BotPlaceholder-BLa0cpzt.js";import"./use-form-item-CY8nvbwg.js";import"./index-r5W6hzzQ.js";import"./index-DksfIPPT.js";import"./typescript-CzuhH513.js";import"./index-TQTp7cjo.js";import"./strings-qqMjRuAB.js";import"./castArray-BOdIXw7P.js";import"./isEqual-yI-vexye.js";import"./_initCloneObject-BWBFVXzM.js";import"./debounce-Dh9PsM_P.js";import"./_baseIteratee-B9yhARKH.js";import"./index-DQAnfDDD.js";import"./vue-plyr-QZFBikSk.js";import"./index-rzb_p--k.js";import"./_baseClone-Cfbcx9ep.js";import"./index-BZ9SU4fU.js";import"./index-iPc5VB6N.js";const ce=$({name:"LayoutVeo",components:{ElDrawer:M,ElButton:R,FontAwesomeIcon:G},data(){return{drawer:!1}}}),de={class:"main flex flex-row flex-1"},ue={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},pe={class:"result h-full p-[15px] flex-1 flex flex-col"};function me(e,o,m,v,b,w){const c=s("font-awesome-icon"),d=s("el-button"),i=s("el-drawer");return n(),r("div",de,[l("div",ue,[L(e.$slots,"config",{},void 0,!0)]),l("div",pe,[L(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=k=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=k=>e.drawer=k),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[L(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const fe=g(ce,[["render",me],["__scopeId","data-v-cfe3cae3"]]),ve=$({name:"ModelSelector",components:{ElSelect:O,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"veo2",label:"veo2"},{value:"veo2-fast",label:"veo2-fast"},{value:"veo3",label:"veo3"},{value:"veo3-fast",label:"veo3-fast"}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||(this.value=z)}}),_e={class:"field"},he={class:"title font-bold"};function $e(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",_e,[l("h2",he,a(e.$t("veo.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select")},{default:u(()=>[(n(!0),r(C,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ge=g(ve,[["render",$e],["__scopeId","data-v-ef445fc5"]]),be=$({name:"ActionSelector",components:{ElSelect:O,ElOption:D},data(){return{}},computed:{options(){return[{value:"text2video",label:this.$t("veo.button.action1")},{value:"image2video",label:this.$t("veo.button.action2")},{value:"get1080p",label:this.$t("veo.button.action3")}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||(this.value=N)}}),we={class:"field"},ke={class:"title font-bold"},ye={class:"float-left"};function Ve(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",we,[l("h2",ke,a(e.$t("veo.name.action")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select"),clearable:""},{default:u(()=>[(n(!0),r(C,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},{default:u(()=>[l("span",ye,a(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(be,[["render",Ve],["__scopeId","data-v-ba5abc8a"]]),Se=$({name:"TranslationSelector",components:{ElSwitch:Y,InfoIcon:j},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug("set translation",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=q)}}),Ie={class:"relative"},Te={class:"flex justify-between"},Ae={class:"flex justify-start items-center"},Ce={class:"text-sm font-bold"},Ge={class:"flex justify-end items-center"};function Re(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-switch");return n(),r("div",Ie,[l("div",Te,[l("div",Ae,[l("span",Ce,a(e.$t("veo.name.translation")),1),t(c,{content:e.$t("veo.description.translation")},null,8,["content"])]),l("div",Ge,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"])])])])}const Ue=g(Se,[["render",Re]]),Le=$({name:"AspectRatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=H)}}),je={class:"text-sm font-bold mb-2 block"},De={class:"items"},Oe=["onClick"],Pe={class:"name"};function Fe(e,o,m,v,b,w){return n(),r("div",null,[l("span",je,a(e.$t("veo.name.ratio")),1),l("div",De,[(n(!0),r(C,null,U(e.options,(c,d)=>(n(),r("div",{key:d,class:T({active:e.active===d,item:!0}),onClick:i=>e.value=c.value},[l("div",{class:T(["preview",c.label])},[l("div",{class:"rect",style:J({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Pe,a(c.label),1)],10,Oe))),128))])])}const Be=g(Le,[["render",Fe],["__scopeId","data-v-688d3e9d"]]),Me=$({name:"VideoFromInput",components:{VideoPlayer:P},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),ze={class:"relative"},Ne={class:"flex mb-2"},qe={class:"text-sm font-bold"};function He(e,o,m,v,b,w){const c=s("video-player");return n(),r("div",ze,[l("div",Ne,[l("span",qe,a(e.$t("veo.name.action3")),1)]),l("div",null,[e.config?.video_url?(n(),y(c,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const Je=g(Me,[["render",He]]),Ke=$({name:"StartEndImage",components:{ElUpload:x,ElButton:R,InfoIcon:j,FontAwesomeIcon:G,ImagePreview:Z},emits:["change"],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartEndImageUrl()},methods:{onExceed(){I.warning(this.$t("veo.message.uploadReferencesExceed"))},onError(){I.error(this.$t("veo.message.uploadReferencesError"))},onSetStartEndImageUrl(){const e=this.urls;this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Qe={class:"relative"},We={class:"flex justify-between"},Xe={class:"flex justify-start items-center"},Ye={class:"text-sm font-bold"};function Ze(e,o,m,v,b,w){const c=s("info-icon"),d=s("image-preview"),i=s("font-awesome-icon"),k=s("el-button"),_=s("el-upload");return n(),r("div",Qe,[l("div",We,[l("div",Xe,[l("span",Ye,a(e.$t("veo.name.startEndImage")),1),t(c,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),t(_,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:2,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(k,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(i,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+a(e.$t("veo.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const xe=g(Ke,[["render",Ze],["__scopeId","data-v-43d971b7"]]),et="",tt=$({name:"PromptInput",components:{ElInput:oe,InfoIcon:j},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=et)}}),ot={class:"field"},st={class:"box"},nt={class:"title font-bold"};function at(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-input");return n(),r("div",ot,[l("div",st,[l("h2",nt,a(e.$t("veo.name.prompt")),1),t(c,{content:e.$t("veo.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=i=>e.prompt=i),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("veo.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const lt=g(tt,[["render",at],["__scopeId","data-v-9189572a"]]),it=$({name:"ConfigPanel",components:{ElButton:R,Consumption:ee,FontAwesomeIcon:G,PromptInput:lt,ModelSelector:ge,StartEndImage:xe,ActionSelector:Ee,VideoFromInput:Je,TranslationSelector:Ue,AspectRatioSelector:Be},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return se(this.config,this.service?.metadata?.price)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),rt={class:"flex flex-col h-full"},ct={class:"flex-1 overflow-y-auto p-[15px]"},dt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ut(e,o,m,v,b,w){const c=s("video-from-input"),d=s("action-selector"),i=s("translation-selector"),k=s("aspect-ratio-selector"),_=s("prompt-input"),p=s("model-selector"),V=s("start-end-image"),A=s("consumption"),F=s("font-awesome-icon"),B=s("el-button");return n(),r("div",rt,[l("div",ct,[E(t(c,{class:"mb-4"},null,512),[[S,e.config?.action==="get1080p"]]),t(d,{class:"mb-4"}),E(t(i,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(k,{class:"mb-4"},null,512),[[S,e.config?.action==="image2video"]]),E(t(_,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(p,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(V,{class:"mb-2"},null,512),[[S,e.config?.action==="image2video"]])]),l("div",dt,[t(A,{value:e.consumption,service:e.service},null,8,["value","service"]),t(B,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(F,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+a(e.$t("veo.button.generate")),1)]),_:1},8,["onClick"])])])}const pt=g(it,[["render",ut]]),mt=$({name:"TaskPreview",components:{ElImage:ie,CopyToClipboard:ne,FontAwesomeIcon:G,ElAlert:le,VideoPlayer:P,ElTooltip:ae,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onGet1080p(e,o){console.debug("set config",o),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,video_id:o?.data?.[0]?.id,video_url:o?.data[0]?.video_url,action:"get1080p"})},onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ft={class:"preview"},vt={class:"left"},_t={class:"main"},ht={class:"bot"},$t={class:"datetime"},gt={class:"info"},bt={key:0,class:"prompt mt-2"},wt={key:0},kt={key:1},yt={key:0,class:T({content:!0,failed:!0})},Vt={key:0,class:"mb-4"},Et={key:1,class:T({operations:!0,"mt-2":!0})},St={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},It={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Tt={key:1,class:T({content:!0})},At={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Gt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Rt={key:2,class:T({content:!0})},Ut={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Lt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function jt(e,o,m,v,b,w){const c=s("el-image"),d=s("video-player"),i=s("el-button"),k=s("el-tooltip"),_=s("font-awesome-icon"),p=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",ft,[l("div",vt,[t(c,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),l("div",_t,[l("div",ht,[h(a(e.$t("veo.name.veoBot"))+" ",1),l("span",$t,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",gt,[e.modelValue?.request?.prompt?(n(),r("p",bt,[h(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(n(),r("span",wt," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",kt," - ("+a(e.$t("veo.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",yt,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",Vt,[t(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response.success?(n(),r("div",Et,[t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=A=>e.onGet1080p(A,e.modelValue?.response))},{default:u(()=>[h(a(e.$t("veo.button.action3")),1)]),_:1})):f("",!0)]),_:1},8,["content"]),t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=A=>e.onDownload(A,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(a(e.$t("veo.button.download")),1)]),_:1})):f("",!0)]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",St,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),l("p",It,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Tt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",At,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",Ct,[t(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+a(e.$t("veo.name.failureReason"))+": "+a(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Gt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Rt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ut,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Lt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0)])])}const Dt=g(mt,[["render",jt],["__scopeId","data-v-5372c9d1"]]),Ot=$({name:"RecentPanel",components:{TaskPreview:Dt,NoTasks:te,BotPlaceholder:re},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.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")}}}),Pt={key:0},Ft={key:1,class:"tasks h-full w-full overflow-y-auto"},Bt={key:2,class:"w-full h-full flex items-center justify-center"};function Mt(e,o,m,v,b,w){const c=s("bot-placeholder"),d=s("task-preview"),i=s("no-tasks");return n(),r(C,null,[e.tasks?.items===void 0?(n(),r("div",Pt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",Ft,[(n(!0),r(C,null,U(e.tasks?.items,(k,_)=>(n(),y(d,{key:_,"model-value":k},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(n(),r("div",Bt,[t(i)])):f("",!0)],64)}const zt=g(Ot,[["render",Mt]]),Nt="https://webhook.acedata.cloud/veo",qt=$({name:"VeoIndex",components:{ConfigPanel:pt,Layout:fe,RecentPanel:zt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.veo?.status?.getApplications===X.Request},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},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("veo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("veo/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:v}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",v),await this.$store.dispatch("veo/getTasks",{limit:o,createdAtMin:m,createdAtMax:v})},async onGenerate(){const e={...this.config,callback_url:Nt},o=this.credential?.token;if(!o){console.error("no token specified");return}I.info(this.$t("veo.message.startingTask")),Q.generate(e,{token:o}).then(()=>{I.success(this.$t("veo.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===W?I.error(this.$t("veo.message.usedUp")):I.error(this.$t("veo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ht(e,o,m,v,b,w){const c=s("config-panel"),d=s("recent-panel"),i=s("layout");return n(),y(i,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ao=g(qt,[["render",Ht]]);export{Ao as default};
@@ -1 +1 @@
1
- import{F as I}from"./index.es-B1Cre0ht.js";import{E as S}from"./index-CvUpzdE1.js";import{E as P}from"./index-CDRWFNPw.js";import{d as $,h as g,b as i,t as l,k as t,r as U,j as f,l as s,o as a,f3 as R,x as r,F as V,v as T,i as y,f4 as D,f5 as F,cf as B,D as h,y as x,n as C,f6 as O,dA as M,dw as N}from"./index-Bxn0D_Ay.js";import{E as L,a as G}from"./index-ZXXqKgb5.js";import{I as A}from"./InfoIcon-xpG6wYiZ.js";import{E as q,a as z}from"./index-CfFbRlb3.js";import{I as X}from"./ImagePreview-BKjWRoxg.js";import{E as H}from"./index-CiupJjd2.js";import{E as k}from"./index-KMXdPkbR.js";import{E as K}from"./index-BG27krBY.js";import{C as W,N as J}from"./NoTasks-RqxH5tU5.js";import{a as Q}from"./price-crtYVYmR.js";import{C as Y}from"./CopyToClipboard-C7oZlhvf.js";import{I as Z}from"./ImageWrapper-BiD890LG.js";import{E as ee}from"./index-I256GqO3.js";import{E as te}from"./index-r5mkEdBU.js";import{B as oe}from"./BotPlaceholder-BgltR-o8.js";import"./use-form-item-BHzDGeGF.js";import"./index-r5W6hzzQ.js";import"./index-zhXzFU3e.js";import"./index-DA1L1iqe.js";import"./typescript-14ZN9Iqb.js";import"./index-BZxyIS6v.js";import"./strings-Djoxz8AJ.js";import"./castArray-C-yFxvxW.js";import"./isEqual-CYpeyoZ0.js";import"./_initCloneObject-BzNbsgMU.js";import"./debounce-D_GSfnKF.js";import"./_baseIteratee-W5a_Nlyi.js";import"./index-ekLS25Os.js";import"./index-C7dq5GDX.js";import"./_baseClone-DtzNljAk.js";import"./index-kwhOoHli.js";import"./index-CMofrOYp.js";const se=$({name:"LayoutFlux",components:{ElDrawer:P,ElButton:S,FontAwesomeIcon:I},data(){return{drawer:!1}}}),ne={class:"main flex flex-row flex-1"},le={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ae={class:"result h-full p-[15px] flex-1 flex flex-col"};function re(e,o,m,p,v,b){const c=s("font-awesome-icon"),u=s("el-button"),n=s("el-drawer");return a(),i("div",ne,[l("div",le,[U(e.$slots,"config",{},void 0,!0)]),l("div",ae,[U(e.$slots,"result",{},void 0,!0)]),t(u,{circle:"",class:"menu",onClick:o[0]||(o[0]=d=>e.drawer=!0)},{default:f(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=d=>e.drawer=d),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:f(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ie=g(se,[["render",re],["__scopeId","data-v-468dfa4e"]]),ce=$({name:"ModelSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{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=R)}}),ue={class:"field"},de={class:"title font-bold"};function pe(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return a(),i("div",ue,[l("h2",de,r(e.$t("flux.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(a(!0),i(V,null,T(e.options,n=>(a(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const me=g(ce,[["render",pe],["__scopeId","data-v-8df4b8a7"]]),fe=$({name:"CountSelector",components:{ElSlider:z,InfoIcon:A,ElInputNumber:q},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=D)}}),_e={class:"flex justify-between"},he={class:"flex justify-start items-center"},$e={class:"text-sm font-bold"},ge={class:"flex justify-end items-center"},ve={class:"w-full"};function be(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input-number"),n=s("el-slider");return a(),i("div",null,[l("div",_e,[l("div",he,[l("span",$e,r(e.$t("flux.name.numbers")),1),t(c,{content:e.$t("flux.description.numbers")},null,8,["content"])]),l("div",ge,[t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=d=>e.value=d),"controls-position":"right"},null,8,["modelValue"])])]),l("div",ve,[t(n,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=d=>e.value=d),min:1,max:4,step:1},null,8,["modelValue"])])])}const xe=g(fe,[["render",be]]),we=$({name:"ActionSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"generate",label:this.$t("flux.name.generate")},{value:"edits",label:this.$t("flux.name.edits")}]}},computed:{value:{get(){return this.$store.state.flux?.config?.action},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,action:e})}}},mounted(){this.value||(this.value=F)}}),ke={class:"field"},ye={class:"title font-bold"};function Ve(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return a(),i("div",ke,[l("h2",ye,r(e.$t("flux.name.task")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(a(!0),i(V,null,T(e.options,n=>(a(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(we,[["render",Ve],["__scopeId","data-v-81fd05e5"]]),Ie=$({name:"ImageUrlInput",components:{ElUpload:H,ElButton:S,InfoIcon:A,FontAwesomeIcon:I,ImagePreview:X},emits:["change"],data(){return{fileList:[],uploadUrl:B()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{urls:{handler(e){console.debug("URLs changed:",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,image_url:e[0]})}}},methods:{onExceed(){k.warning(this.$t("flux.message.uploadStartImageExceed"))},onError(){k.error(this.$t("flux.message.uploadStartImageError"))}}}),Te={class:"relative"},Ue={class:"flex justify-between"},Se={class:"flex justify-start items-center"},Ce={class:"text-sm font-bold"};function Ae(e,o,m,p,v,b){const c=s("info-icon"),u=s("image-preview"),n=s("font-awesome-icon"),d=s("el-button"),w=s("el-upload");return a(),i("div",Te,[l("div",Ue,[l("div",Se,[l("span",Ce,r(e.$t("flux.name.imageUrl")),1),t(c,{content:e.$t("flux.description.imageUrl")},null,8,["content"])])]),t(w,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=_=>e.fileList=_),name:"file",limit:5,class:"upload-wrapper",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,headers:e.headers},{file:f(({file:_})=>[t(u,{url:_.url||_.response?.file_url,name:_.name,percentage:_.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])]),default:f(()=>[t(d,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:f(()=>[t(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+r(e.$t("flux.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","headers"])])}const Le=g(Ie,[["render",Ae],["__scopeId","data-v-04710032"]]),Ge="",je=$({name:"PromptInput",components:{ElInput:K,InfoIcon:A},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=Ge)}}),Pe={class:"field"},Re={class:"box"},De={class:"title font-bold"};function Fe(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input");return a(),i("div",Pe,[l("div",Re,[l("h2",De,r(e.$t("flux.name.prompt")),1),t(c,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(u,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Be=g(je,[["render",Fe],["__scopeId","data-v-4c101a17"]]),Oe=$({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:I,PromptInput:Be,ModelSelector:me,CountSelector:xe,Consumption:W,ActionSelector:Ee,ImageUrlInput:Le},emits:["generate"],computed:{config(){return this.$store.state.flux?.config},consumption(){return Q(this.config,this.service?.metadata?.price)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Me={class:"flex flex-col h-full"},Ne={class:"flex-1 overflow-y-auto p-[15px]"},qe={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ze(e,o,m,p,v,b){const c=s("action-selector"),u=s("prompt-input"),n=s("image-url-input"),d=s("model-selector"),w=s("count-selector"),_=s("consumption"),E=s("font-awesome-icon"),j=s("el-button");return a(),i("div",Me,[l("div",Ne,[t(c,{class:"mb-4"}),t(u,{class:"mb-4"}),e.config?.action==="edits"?(a(),y(n,{key:0,class:"mb-4"})):x("",!0),t(d,{class:"mb-4"}),t(w,{class:"mb-4"})]),l("div",qe,[t(_,{value:e.consumption,service:e.service},null,8,["value","service"]),t(j,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[t(E,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+r(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])}const Xe=g(Oe,[["render",ze]]),He=$({name:"TaskPreview",components:{ElImage:te,CopyToClipboard:Y,FontAwesomeIcon:I,ElAlert:ee,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(m=>{let p=m;o&&(p.action=o),e.push(p)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ke={class:"preview"},We={class:"left"},Je={class:"main"},Qe={class:"bot"},Ye={class:"datetime"},Ze={class:"info"},et={key:0,class:"prompt mt-2"},tt={key:0},ot={key:0,class:C({content:!0,failed:!0})},st={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},nt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},lt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},at={key:1,class:C({content:!0})},rt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},it={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ct={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ut={key:2,class:C({content:!0})},dt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function pt(e,o,m,p,v,b){const c=s("el-image"),u=s("image-wrapper"),n=s("font-awesome-icon"),d=s("copy-to-clipboard"),w=s("el-alert");return a(),i("div",Ke,[l("div",We,[t(c,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),l("div",Je,[l("div",Qe,[h(r(e.$t("flux.name.fluxBot"))+" ",1),l("span",Ye,r(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Ze,[e.modelValue?.request?.prompt?(a(),i("p",et,[h(r(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?x("",!0):(a(),i("span",tt," - ("+r(e.$t("flux.status.pending"))+") ",1))])):x("",!0)]),e.modelValue?.response?.success===!0?(a(),i("div",ot,[l("div",st,[(a(!0),i(V,null,T(e.images,(_,E)=>(a(),y(u,{key:E,src:_?.image_url,"raw-src":_?.image_url,"model-value":_},null,8,["src","raw-src","model-value"]))),128))]),t(w,{closable:!1,class:"mt-2 success"},{default:f(()=>[l("p",nt,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.model"))+": "+r(e.modelValue?.request?.model),1)]),l("p",lt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?.success===!1?(a(),i("div",at,[t(w,{closable:!1,class:"failure"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[l("p",rt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),l("p",it,[t(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+r(e.$t("flux.name.failureReason"))+": "+r(e.modelValue?.response?.error?.message)+" ",1),t(d,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),l("p",ct,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),t(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?x("",!0):(a(),i("div",ut,[t(w,{closable:!1,class:"info"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[l("p",dt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const mt=g(He,[["render",pt],["__scopeId","data-v-fd5838a5"]]),ft=$({name:"RecentPanel",components:{TaskPreview:mt,BotPlaceholder:oe,NoTasks:J},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")}}}),_t={key:0},ht={key:1,class:"tasks h-full w-full overflow-y-auto"},$t={key:2,class:"w-full h-full flex items-center justify-center"};function gt(e,o,m,p,v,b){const c=s("bot-placeholder"),u=s("task-preview"),n=s("no-tasks");return a(),i(V,null,[e.tasks?.items===void 0?(a(),i("div",_t,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),i("div",ht,[(a(!0),i(V,null,T(e.tasks?.items,d=>(a(),y(u,{key:d.id,"model-value":d},null,8,["model-value"]))),128))])):x("",!0),e.tasks?.items?.length===0?(a(),i("div",$t,[t(n)])):x("",!0)],64)}const vt=g(ft,[["render",gt]]),bt="https://webhook.acedata.cloud/flux",xt=$({name:"FluxIndex",components:{ConfigPanel:Xe,Layout:ie,RecentPanel:vt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===N.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},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},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:m,createdAtMax:p}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",p),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:m,createdAtMax:p})},async onGenerate(){const e={...this.config,callback_url:bt},o=this.credential?.token;if(!o){console.error("no token specified");return}k.info(this.$t("flux.message.startingTask")),O.generate(e,{token:o}).then(()=>{k.success(this.$t("flux.message.startTaskSuccess"))}).catch(m=>{const p=m?.response?.data;p?.error?.code===M?k.error(this.$t("flux.message.usedUp")):k.error(this.$t("flux.message.startTaskFailed")+p?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function wt(e,o,m,p,v,b){const c=s("config-panel"),u=s("recent-panel"),n=s("layout");return a(),y(n,null,{config:f(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:f(()=>[t(u,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const no=g(xt,[["render",wt]]);export{no as default};
1
+ import{F as I}from"./index.es-Biw5Cjoa.js";import{E as S}from"./index-DEgVEBTr.js";import{E as P}from"./index-BXPOquOZ.js";import{d as $,h as g,b as i,t as l,k as t,r as U,j as f,l as s,o as a,f3 as R,x as r,F as V,v as T,i as y,f4 as D,f5 as F,cf as B,D as h,y as x,n as C,f6 as O,dA as M,dw as N}from"./index-Z3Ble6S3.js";import{E as L,a as G}from"./index-Dyigdg3o.js";import{I as A}from"./InfoIcon-GyiV0uTg.js";import{E as q,a as z}from"./index-23_QYN9_.js";import{I as X}from"./ImagePreview-0sgpwQOv.js";import{E as H}from"./index-Z-vlaGQn.js";import{E as k}from"./index-CcrMfubT.js";import{E as K}from"./index-BEdCWb2D.js";import{C as W,N as J}from"./NoTasks-DpyAtW8T.js";import{a as Q}from"./price-Bv6OtNKd.js";import{C as Y}from"./CopyToClipboard-DY2B74b1.js";import{I as Z}from"./ImageWrapper-DKM5_uAi.js";import{E as ee}from"./index-TeONk5U_.js";import{E as te}from"./index-k5p91wLN.js";import{B as oe}from"./BotPlaceholder-BLa0cpzt.js";import"./use-form-item-CY8nvbwg.js";import"./index-r5W6hzzQ.js";import"./index-DUw1QSi5.js";import"./index-TQTp7cjo.js";import"./typescript-CzuhH513.js";import"./index-DksfIPPT.js";import"./strings-qqMjRuAB.js";import"./castArray-BOdIXw7P.js";import"./isEqual-yI-vexye.js";import"./_initCloneObject-BWBFVXzM.js";import"./debounce-Dh9PsM_P.js";import"./_baseIteratee-B9yhARKH.js";import"./index-DQAnfDDD.js";import"./index-rzb_p--k.js";import"./_baseClone-Cfbcx9ep.js";import"./index-BZ9SU4fU.js";import"./index-iPc5VB6N.js";const se=$({name:"LayoutFlux",components:{ElDrawer:P,ElButton:S,FontAwesomeIcon:I},data(){return{drawer:!1}}}),ne={class:"main flex flex-row flex-1"},le={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ae={class:"result h-full p-[15px] flex-1 flex flex-col"};function re(e,o,m,p,v,b){const c=s("font-awesome-icon"),u=s("el-button"),n=s("el-drawer");return a(),i("div",ne,[l("div",le,[U(e.$slots,"config",{},void 0,!0)]),l("div",ae,[U(e.$slots,"result",{},void 0,!0)]),t(u,{circle:"",class:"menu",onClick:o[0]||(o[0]=d=>e.drawer=!0)},{default:f(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=d=>e.drawer=d),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:f(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ie=g(se,[["render",re],["__scopeId","data-v-468dfa4e"]]),ce=$({name:"ModelSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{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=R)}}),ue={class:"field"},de={class:"title font-bold"};function pe(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return a(),i("div",ue,[l("h2",de,r(e.$t("flux.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(a(!0),i(V,null,T(e.options,n=>(a(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const me=g(ce,[["render",pe],["__scopeId","data-v-8df4b8a7"]]),fe=$({name:"CountSelector",components:{ElSlider:z,InfoIcon:A,ElInputNumber:q},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=D)}}),_e={class:"flex justify-between"},he={class:"flex justify-start items-center"},$e={class:"text-sm font-bold"},ge={class:"flex justify-end items-center"},ve={class:"w-full"};function be(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input-number"),n=s("el-slider");return a(),i("div",null,[l("div",_e,[l("div",he,[l("span",$e,r(e.$t("flux.name.numbers")),1),t(c,{content:e.$t("flux.description.numbers")},null,8,["content"])]),l("div",ge,[t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=d=>e.value=d),"controls-position":"right"},null,8,["modelValue"])])]),l("div",ve,[t(n,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=d=>e.value=d),min:1,max:4,step:1},null,8,["modelValue"])])])}const xe=g(fe,[["render",be]]),we=$({name:"ActionSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"generate",label:this.$t("flux.name.generate")},{value:"edits",label:this.$t("flux.name.edits")}]}},computed:{value:{get(){return this.$store.state.flux?.config?.action},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,action:e})}}},mounted(){this.value||(this.value=F)}}),ke={class:"field"},ye={class:"title font-bold"};function Ve(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return a(),i("div",ke,[l("h2",ye,r(e.$t("flux.name.task")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(a(!0),i(V,null,T(e.options,n=>(a(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(we,[["render",Ve],["__scopeId","data-v-81fd05e5"]]),Ie=$({name:"ImageUrlInput",components:{ElUpload:H,ElButton:S,InfoIcon:A,FontAwesomeIcon:I,ImagePreview:X},emits:["change"],data(){return{fileList:[],uploadUrl:B()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{urls:{handler(e){console.debug("URLs changed:",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,image_url:e[0]})}}},methods:{onExceed(){k.warning(this.$t("flux.message.uploadStartImageExceed"))},onError(){k.error(this.$t("flux.message.uploadStartImageError"))}}}),Te={class:"relative"},Ue={class:"flex justify-between"},Se={class:"flex justify-start items-center"},Ce={class:"text-sm font-bold"};function Ae(e,o,m,p,v,b){const c=s("info-icon"),u=s("image-preview"),n=s("font-awesome-icon"),d=s("el-button"),w=s("el-upload");return a(),i("div",Te,[l("div",Ue,[l("div",Se,[l("span",Ce,r(e.$t("flux.name.imageUrl")),1),t(c,{content:e.$t("flux.description.imageUrl")},null,8,["content"])])]),t(w,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=_=>e.fileList=_),name:"file",limit:5,class:"upload-wrapper",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,headers:e.headers},{file:f(({file:_})=>[t(u,{url:_.url||_.response?.file_url,name:_.name,percentage:_.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])]),default:f(()=>[t(d,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:f(()=>[t(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+r(e.$t("flux.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","headers"])])}const Le=g(Ie,[["render",Ae],["__scopeId","data-v-04710032"]]),Ge="",je=$({name:"PromptInput",components:{ElInput:K,InfoIcon:A},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=Ge)}}),Pe={class:"field"},Re={class:"box"},De={class:"title font-bold"};function Fe(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input");return a(),i("div",Pe,[l("div",Re,[l("h2",De,r(e.$t("flux.name.prompt")),1),t(c,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(u,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Be=g(je,[["render",Fe],["__scopeId","data-v-4c101a17"]]),Oe=$({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:I,PromptInput:Be,ModelSelector:me,CountSelector:xe,Consumption:W,ActionSelector:Ee,ImageUrlInput:Le},emits:["generate"],computed:{config(){return this.$store.state.flux?.config},consumption(){return Q(this.config,this.service?.metadata?.price)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Me={class:"flex flex-col h-full"},Ne={class:"flex-1 overflow-y-auto p-[15px]"},qe={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ze(e,o,m,p,v,b){const c=s("action-selector"),u=s("prompt-input"),n=s("image-url-input"),d=s("model-selector"),w=s("count-selector"),_=s("consumption"),E=s("font-awesome-icon"),j=s("el-button");return a(),i("div",Me,[l("div",Ne,[t(c,{class:"mb-4"}),t(u,{class:"mb-4"}),e.config?.action==="edits"?(a(),y(n,{key:0,class:"mb-4"})):x("",!0),t(d,{class:"mb-4"}),t(w,{class:"mb-4"})]),l("div",qe,[t(_,{value:e.consumption,service:e.service},null,8,["value","service"]),t(j,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[t(E,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+r(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])}const Xe=g(Oe,[["render",ze]]),He=$({name:"TaskPreview",components:{ElImage:te,CopyToClipboard:Y,FontAwesomeIcon:I,ElAlert:ee,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(m=>{let p=m;o&&(p.action=o),e.push(p)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ke={class:"preview"},We={class:"left"},Je={class:"main"},Qe={class:"bot"},Ye={class:"datetime"},Ze={class:"info"},et={key:0,class:"prompt mt-2"},tt={key:0},ot={key:0,class:C({content:!0,failed:!0})},st={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},nt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},lt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},at={key:1,class:C({content:!0})},rt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},it={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ct={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ut={key:2,class:C({content:!0})},dt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function pt(e,o,m,p,v,b){const c=s("el-image"),u=s("image-wrapper"),n=s("font-awesome-icon"),d=s("copy-to-clipboard"),w=s("el-alert");return a(),i("div",Ke,[l("div",We,[t(c,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),l("div",Je,[l("div",Qe,[h(r(e.$t("flux.name.fluxBot"))+" ",1),l("span",Ye,r(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Ze,[e.modelValue?.request?.prompt?(a(),i("p",et,[h(r(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?x("",!0):(a(),i("span",tt," - ("+r(e.$t("flux.status.pending"))+") ",1))])):x("",!0)]),e.modelValue?.response?.success===!0?(a(),i("div",ot,[l("div",st,[(a(!0),i(V,null,T(e.images,(_,E)=>(a(),y(u,{key:E,src:_?.image_url,"raw-src":_?.image_url,"model-value":_},null,8,["src","raw-src","model-value"]))),128))]),t(w,{closable:!1,class:"mt-2 success"},{default:f(()=>[l("p",nt,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.model"))+": "+r(e.modelValue?.request?.model),1)]),l("p",lt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?.success===!1?(a(),i("div",at,[t(w,{closable:!1,class:"failure"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[l("p",rt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),l("p",it,[t(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+r(e.$t("flux.name.failureReason"))+": "+r(e.modelValue?.response?.error?.message)+" ",1),t(d,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),l("p",ct,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),t(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?x("",!0):(a(),i("div",ut,[t(w,{closable:!1,class:"info"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[l("p",dt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const mt=g(He,[["render",pt],["__scopeId","data-v-fd5838a5"]]),ft=$({name:"RecentPanel",components:{TaskPreview:mt,BotPlaceholder:oe,NoTasks:J},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")}}}),_t={key:0},ht={key:1,class:"tasks h-full w-full overflow-y-auto"},$t={key:2,class:"w-full h-full flex items-center justify-center"};function gt(e,o,m,p,v,b){const c=s("bot-placeholder"),u=s("task-preview"),n=s("no-tasks");return a(),i(V,null,[e.tasks?.items===void 0?(a(),i("div",_t,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),i("div",ht,[(a(!0),i(V,null,T(e.tasks?.items,d=>(a(),y(u,{key:d.id,"model-value":d},null,8,["model-value"]))),128))])):x("",!0),e.tasks?.items?.length===0?(a(),i("div",$t,[t(n)])):x("",!0)],64)}const vt=g(ft,[["render",gt]]),bt="https://webhook.acedata.cloud/flux",xt=$({name:"FluxIndex",components:{ConfigPanel:Xe,Layout:ie,RecentPanel:vt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===N.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},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},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:m,createdAtMax:p}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",p),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:m,createdAtMax:p})},async onGenerate(){const e={...this.config,callback_url:bt},o=this.credential?.token;if(!o){console.error("no token specified");return}k.info(this.$t("flux.message.startingTask")),O.generate(e,{token:o}).then(()=>{k.success(this.$t("flux.message.startTaskSuccess"))}).catch(m=>{const p=m?.response?.data;p?.error?.code===M?k.error(this.$t("flux.message.usedUp")):k.error(this.$t("flux.message.startTaskFailed")+p?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function wt(e,o,m,p,v,b){const c=s("config-panel"),u=s("recent-panel"),n=s("layout");return a(),y(n,null,{config:f(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:f(()=>[t(u,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const no=g(xt,[["render",wt]]);export{no as default};