@acedatacloud/nexior 3.25.0 → 3.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/assets/{Auth-DiaClekA.js → Auth-ZFL9tEYY.js} +1 -1
  2. package/dist/assets/{BotPlaceholder-8zDrksua.js → BotPlaceholder-Bn7lEbyW.js} +1 -1
  3. package/dist/assets/{Callback-C_Dr06kX.js → Callback-ADArovCk.js} +1 -1
  4. package/dist/assets/{Console-Dmx5CHpc.js → Console-R7Nq1XW4.js} +1 -1
  5. package/dist/assets/{Conversation-CtzRNEej.js → Conversation-s6SlHgmF.js} +2 -2
  6. package/dist/assets/{CopyToClipboard-DgotqLxr.js → CopyToClipboard-B0sXY0gf.js} +1 -1
  7. package/dist/assets/{Detail-yzBLTp7w.js → Detail-DGqa0niQ.js} +1 -1
  8. package/dist/assets/{EditArray-DAVh2_3U.js → EditArray-sXU-nuer.js} +1 -1
  9. package/dist/assets/{Extra-CkE6xMlZ.js → Extra-BGCl3fdy.js} +1 -1
  10. package/dist/assets/{FilePreview-3hkMnxl9.js → FilePreview-BOf1jXGA.js} +1 -1
  11. package/dist/assets/{History-WQNUHUYK.js → History-D3P-BDSp.js} +1 -1
  12. package/dist/assets/{ImagePreview-DhYLHTps.js → ImagePreview-fjeQ_mXr.js} +1 -1
  13. package/dist/assets/{ImageWrapper-Dm7lQPbW.js → ImageWrapper-ChFtniNG.js} +1 -1
  14. package/dist/assets/{Index-auRXRiEC.js → Index-48R8KP_e.js} +1 -1
  15. package/dist/assets/{Index-CQx6M-dc.js → Index-B9UAbq7K.js} +1 -1
  16. package/dist/assets/{Index--bhZUAUU.js → Index-BBVkiDLK.js} +1 -1
  17. package/dist/assets/{Index-CJdMjC2Y.js → Index-Bp0DnFP8.js} +1 -1
  18. package/dist/assets/{Index-C-_Csfw1.js → Index-C2XSfdlG.js} +1 -1
  19. package/dist/assets/{Index-DiA-s1qk.js → Index-CVKSxmPU.js} +1 -1
  20. package/dist/assets/{Index-Scdh2Egu.js → Index-Ci0cxJdC.js} +1 -1
  21. package/dist/assets/{Index-T1yLCrp1.js → Index-CpzsdYan.js} +1 -1
  22. package/dist/assets/{Index-BuJiqDOn.js → Index-CqUvleXZ.js} +1 -1
  23. package/dist/assets/{Index-u2kvh-xO.js → Index-DEi3lR31.js} +1 -1
  24. package/dist/assets/{Index-7yNwhUjv.js → Index-DHwfKCWu.js} +1 -1
  25. package/dist/assets/{Index-DKVNaQli.js → Index-DK4gRSuD.js} +1 -1
  26. package/dist/assets/{Index-3_jggFoZ.js → Index-DlQVMfXj.js} +1 -1
  27. package/dist/assets/{Index-CS86PFor.js → Index-Dns4RHLB.js} +1 -1
  28. package/dist/assets/{Index-DrTIdg50.js → Index-Dw-C8knr.js} +1 -1
  29. package/dist/assets/{Index-BOZv_JDV.js → Index-PWykWvWS.js} +1 -1
  30. package/dist/assets/{Invitees-CLI9lTbv.js → Invitees-DPR5dxyo.js} +1 -1
  31. package/dist/assets/{List-CvX3QDar.js → List-CB6PvsV4.js} +1 -1
  32. package/dist/assets/{List-BHdScwPg.js → List-CvNpui7s.js} +1 -1
  33. package/dist/assets/{List-ec-G1e57.js → List-DF1xAj8f.js} +1 -1
  34. package/dist/assets/{Login-BoBId3b9.js → Login-BBVssM83.js} +1 -1
  35. package/dist/assets/{Main-3kEz8U8Q.js → Main-B8Gn8wFB.js} +1 -1
  36. package/dist/assets/{Navigator-B8aaZIOz.js → Navigator-DeAMelPW.js} +1 -1
  37. package/dist/assets/{NoTasks-BpOa5vFX.js → NoTasks-Cxeor42D.js} +1 -1
  38. package/dist/assets/{Pagination-BwG1s5G4.js → Pagination-CV1s64tj.js} +1 -1
  39. package/dist/assets/ScrollList-BsWg1Oco.js +1 -0
  40. package/dist/assets/{ScrollList-Cyjz48lZ.css → ScrollList-DgGwAdqA.css} +1 -1
  41. package/dist/assets/{Status-CifADRQi.js → Status-Cb0oPjbf.js} +1 -1
  42. package/dist/assets/{Subscribe-NVrrwFIC.js → Subscribe-1vCwy75C.js} +1 -1
  43. package/dist/assets/{VideoPlayer-DleRW6I6.js → VideoPlayer-Bkc77RHA.js} +1 -1
  44. package/dist/assets/{_baseClone-BNWubnsE.js → _baseClone-Bm9igNTj.js} +1 -1
  45. package/dist/assets/{_baseIteratee-DabyO38L.js → _baseIteratee-C0prYj3x.js} +1 -1
  46. package/dist/assets/{_initCloneObject-j_ExEGAU.js → _initCloneObject-CAySSrJV.js} +1 -1
  47. package/dist/assets/{castArray-KB0R_QyF.js → castArray-CGkY3K20.js} +1 -1
  48. package/dist/assets/{debounce-C3VeLj5t.js → debounce-CguuKO1r.js} +1 -1
  49. package/dist/assets/{distribution-C85LoBvQ.js → distribution-DyIdWLTX.js} +1 -1
  50. package/dist/assets/{dropdown-B6EDyfs2.js → dropdown-D2LCpybK.js} +1 -1
  51. package/dist/assets/{index-Cx5qFJ0y.js → index-B9M5gqZj.js} +1 -1
  52. package/dist/assets/{index-pMVrQRue.js → index-BBae-ry6.js} +1 -1
  53. package/dist/assets/{index-RNrLf-1I.js → index-BKPV2Two.js} +1 -1
  54. package/dist/assets/{index-BN7nYLDK.js → index-BNhORE5b.js} +1 -1
  55. package/dist/assets/{index-CCKUub4u.js → index-BY87tdIk.js} +1 -1
  56. package/dist/assets/{index-BrZEkGia.js → index-Ba60uEk-.js} +1 -1
  57. package/dist/assets/{index-DZtScTkG.js → index-BhccfPia.js} +1 -1
  58. package/dist/assets/{index-CrAgxKlm.js → index-BjFSM9Qd.js} +1 -1
  59. package/dist/assets/{index-CmsT3Np_.js → index-Bk5nP9u2.js} +1 -1
  60. package/dist/assets/{index-BTdPZbJx.js → index-Bp5pMMj1.js} +1 -1
  61. package/dist/assets/{index-CN0tS-0l.js → index-C5xIFTe8.js} +1 -1
  62. package/dist/assets/{index-DDqBSSFk.js → index-C7JbjCIG.js} +1 -1
  63. package/dist/assets/{index-_Y99ywre.js → index-C9snhxjP.js} +1 -1
  64. package/dist/assets/{index-Bgzvc62r.js → index-CHfsm--8.js} +1 -1
  65. package/dist/assets/{index-B92my1Q0.js → index-CUr7KGdA.js} +1 -1
  66. package/dist/assets/{index-BHWAOEcf.js → index-Cltw-TPy.js} +2 -2
  67. package/dist/assets/{index-DpwLjErO.js → index-CpH9j3dB.js} +1 -1
  68. package/dist/assets/{index-FULpWQi5.js → index-D4wnX0xO.js} +1 -1
  69. package/dist/assets/{index-BNZB7Wrx.js → index-DSp1QfJq.js} +1 -1
  70. package/dist/assets/{index-DjcJC0zK.js → index-DTitzyRz.js} +1 -1
  71. package/dist/assets/{index-IMW6uuh-.js → index-DU1Jn2Bq.js} +1 -1
  72. package/dist/assets/{index-CZeM6Tp2.js → index-Daydyphg.js} +1 -1
  73. package/dist/assets/{index-CKtbhR9a.js → index-Douq3tkS.js} +1 -1
  74. package/dist/assets/{index-Dno4ZZGJ.js → index-Duh1U13K.js} +1 -1
  75. package/dist/assets/{index-BAjjsEGt.js → index-FtmKCcb9.js} +1 -1
  76. package/dist/assets/{index-CbmaAtUr.js → index-J3_g86Kc.js} +1 -1
  77. package/dist/assets/{index-CABd8l27.js → index-RTh02r3m.js} +1 -1
  78. package/dist/assets/{index-yCwOWgs4.js → index-TO8m0FZI.js} +1 -1
  79. package/dist/assets/{index-B5Lioaz1.js → index-TiR34Adr.js} +1 -1
  80. package/dist/assets/{index-DRhl7LNX.js → index-h2hg5mzg.js} +1 -1
  81. package/dist/assets/{index.es-B5BxExPu.js → index.es-Dw-ikv9u.js} +1 -1
  82. package/dist/assets/{isEqual-VZNlgh-o.js → isEqual-CbOgjKmk.js} +1 -1
  83. package/dist/assets/{isPlainObject-B0WNvF5u.js → isPlainObject-BHOEH-Zh.js} +1 -1
  84. package/dist/assets/{order-BdrXZ9es.js → order-izH8TeES.js} +1 -1
  85. package/dist/assets/pagination-BA1VbgK9.js +1 -0
  86. package/dist/assets/{price-HfrxdcfW.js → price-B71O9NlG.js} +1 -1
  87. package/dist/assets/{strings-CASQTtYR.js → strings-CNKL_IWi.js} +1 -1
  88. package/dist/assets/{typescript-BJu9PjgO.js → typescript-DOVFb1BD.js} +1 -1
  89. package/dist/assets/{use-form-item-Cfa-OGdg.js → use-form-item-Be29d0-B.js} +1 -1
  90. package/dist/index.html +1 -1
  91. package/package.json +1 -1
  92. package/dist/assets/ScrollList-9YjkSrQI.js +0 -1
  93. package/dist/assets/pagination-Cj4ffYe2.js +0 -1
@@ -1 +1 @@
1
- import{F as L}from"./index.es-B5BxExPu.js";import{E as R}from"./index-BrZEkGia.js";import{E as z}from"./index-DRhl7LNX.js";import{d as g,h as $,b as r,t as l,k as t,r as G,j as u,l as s,o as n,eT as N,x as a,F as A,v as U,i as y,eU as q,eV as J,eW as H,n as I,f as K,y as v,cf as W,D as h,J as E,K as S,eX as X,dN as Q,dJ as j}from"./index-BHWAOEcf.js";import{E as D,a as O}from"./index-IMW6uuh-.js";import{I as P,S as Y}from"./ScrollList-9YjkSrQI.js";import{E as Z}from"./index-_Y99ywre.js";import{V as B}from"./VideoPlayer-DleRW6I6.js";import{I as x}from"./ImagePreview-DhYLHTps.js";import{E as ee}from"./index-DjcJC0zK.js";import{E as T}from"./index-DDqBSSFk.js";import{C as te,N as oe}from"./NoTasks-BpOa5vFX.js";import{E as se}from"./index-CCKUub4u.js";import{a as ne}from"./price-HfrxdcfW.js";import{C as ae}from"./CopyToClipboard-DgotqLxr.js";import{E as le}from"./index-BTdPZbJx.js";import{E as ie}from"./index-Bgzvc62r.js";import{E as re}from"./index-CmsT3Np_.js";import{B as ce}from"./BotPlaceholder-8zDrksua.js";import{l as de}from"./pagination-Cj4ffYe2.js";import"./use-form-item-Cfa-OGdg.js";import"./index-r5W6hzzQ.js";import"./index-DpwLjErO.js";import"./typescript-BJu9PjgO.js";import"./index-CZeM6Tp2.js";import"./strings-CASQTtYR.js";import"./castArray-KB0R_QyF.js";import"./isEqual-VZNlgh-o.js";import"./_initCloneObject-j_ExEGAU.js";import"./debounce-C3VeLj5t.js";import"./_baseIteratee-DabyO38L.js";import"./index-CrAgxKlm.js";import"./vue-plyr-QZFBikSk.js";import"./index-CABd8l27.js";import"./_baseClone-BNWubnsE.js";import"./index-DZtScTkG.js";import"./index-yCwOWgs4.js";const ue=g({name:"LayoutVeo",components:{ElDrawer:z,ElButton:R,FontAwesomeIcon:L},data(){return{drawer:!1}}}),pe={class:"main flex flex-row flex-1"},me={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},fe={class:"result h-full p-[15px] flex-1 flex flex-col"};function ve(e,o,m,_,b,k){const c=s("font-awesome-icon"),d=s("el-button"),i=s("el-drawer");return n(),r("div",pe,[l("div",me,[G(e.$slots,"config",{},void 0,!0)]),l("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=w=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=w=>e.drawer=w),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=$(ue,[["render",ve],["__scopeId","data-v-cfe3cae3"]]),he=g({name:"ModelSelector",components:{ElSelect:O,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"veo2-fast",label:"veo2-fast"},{value:"veo3",label:"veo3"},{value:"veo3-fast",label:"veo3-fast"},{value:"veo31-fast",label:"veo31-fast"},{value:"veo31",label:"veo31"},{value:"veo31-fast-ingredient",label:"veo31-fast-ingredient"}]}},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=N)}}),ge={class:"field"},$e={class:"title font-bold"};function be(e,o,m,_,b,k){const c=s("el-option"),d=s("el-select");return n(),r("div",ge,[l("h2",$e,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(A,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 ke=$(he,[["render",be],["__scopeId","data-v-5bb2f809"]]),we=g({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=q)}}),ye={class:"field"},Ve={class:"title font-bold"},Ee={class:"float-left"};function Se(e,o,m,_,b,k){const c=s("el-option"),d=s("el-select");return n(),r("div",ye,[l("h2",Ve,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(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},{default:u(()=>[l("span",Ee,a(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Te=$(we,[["render",Se],["__scopeId","data-v-ba5abc8a"]]),Ie=g({name:"TranslationSelector",components:{ElSwitch:Z,InfoIcon:P},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=J)}}),Ce={class:"relative"},Ae={class:"flex justify-between"},Le={class:"flex justify-start items-center"},Re={class:"text-sm font-bold"},Ue={class:"flex justify-end items-center"};function Ge(e,o,m,_,b,k){const c=s("info-icon"),d=s("el-switch");return n(),r("div",Ce,[l("div",Ae,[l("div",Le,[l("span",Re,a(e.$t("veo.name.translation")),1),t(c,{content:e.$t("veo.description.translation")},null,8,["content"])]),l("div",Ue,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"])])])])}const Pe=$(Ie,[["render",Ge]]),je=g({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)}}),De={class:"text-sm font-bold mb-2 block"},Oe={class:"items"},Be=["onClick"],Fe={class:"name"};function Me(e,o,m,_,b,k){return n(),r("div",null,[l("span",De,a(e.$t("veo.name.ratio")),1),l("div",Oe,[(n(!0),r(A,null,U(e.options,(c,d)=>(n(),r("div",{key:d,class:I({active:e.active===d,item:!0}),onClick:i=>e.value=c.value},[l("div",{class:I(["preview",c.label])},[l("div",{class:"rect",style:K({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Fe,a(c.label),1)],10,Be))),128))])])}const ze=$(je,[["render",Me],["__scopeId","data-v-688d3e9d"]]),Ne=g({name:"VideoFromInput",components:{VideoPlayer:B},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),qe={class:"relative"},Je={class:"flex mb-2"},He={class:"text-sm font-bold"};function Ke(e,o,m,_,b,k){const c=s("video-player");return n(),r("div",qe,[l("div",Je,[l("span",He,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"])):v("",!0)])])}const We=$(Ne,[["render",Ke]]),Xe=g({name:"StartEndImage",components:{ElUpload:ee,ElButton:R,InfoIcon:P,FontAwesomeIcon:L,ImagePreview:x},emits:["change"],data(){return{fileList:[],uploadUrl:W()+"/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(){T.warning(this.$t("veo.message.uploadReferencesExceed"))},onError(){T.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"},Ye={class:"flex justify-between"},Ze={class:"flex justify-start items-center"},xe={class:"text-sm font-bold"};function et(e,o,m,_,b,k){const c=s("info-icon"),d=s("image-preview"),i=s("font-awesome-icon"),w=s("el-button"),f=s("el-upload");return n(),r("div",Qe,[l("div",Ye,[l("div",Ze,[l("span",xe,a(e.$t("veo.name.startEndImage")),1),t(c,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),t(f,{"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"])):v("",!0)]),default:u(()=>[t(w,{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 tt=$(Xe,[["render",et],["__scopeId","data-v-43d971b7"]]),ot="",st=g({name:"PromptInput",components:{ElInput:se,InfoIcon:P},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=ot)}}),nt={class:"field"},at={class:"box"},lt={class:"title font-bold"};function it(e,o,m,_,b,k){const c=s("info-icon"),d=s("el-input");return n(),r("div",nt,[l("div",at,[l("h2",lt,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 rt=$(st,[["render",it],["__scopeId","data-v-9189572a"]]),ct=g({name:"ConfigPanel",components:{ElButton:R,Consumption:te,FontAwesomeIcon:L,PromptInput:rt,ModelSelector:ke,StartEndImage:tt,ActionSelector:Te,VideoFromInput:We,TranslationSelector:Pe,AspectRatioSelector:ze},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return ne(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),dt={class:"flex flex-col h-full"},ut={class:"flex-1 overflow-y-auto p-[15px]"},pt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function mt(e,o,m,_,b,k){const c=s("video-from-input"),d=s("action-selector"),i=s("translation-selector"),w=s("aspect-ratio-selector"),f=s("prompt-input"),p=s("model-selector"),V=s("start-end-image"),C=s("consumption"),F=s("font-awesome-icon"),M=s("el-button");return n(),r("div",dt,[l("div",ut,[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(w,{class:"mb-4"},null,512),[[S,e.config?.action==="image2video"]]),E(t(f,{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",pt,[t(C,{value:e.consumption,service:e.service},null,8,["value","service"]),t(M,{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 ft=$(ct,[["render",mt]]),vt=g({name:"TaskPreview",components:{ElImage:re,CopyToClipboard:ae,FontAwesomeIcon:L,ElAlert:ie,VideoPlayer:B,ElTooltip:le,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")}}}),_t={class:"preview"},ht={class:"left"},gt={class:"main"},$t={class:"bot"},bt={class:"datetime"},kt={class:"info"},wt={key:0,class:"prompt mt-2"},yt={key:0},Vt={key:1},Et={key:0,class:I({content:!0,failed:!0})},St={key:0,class:"mb-4"},Tt={key:1,class:I({operations:!0,"mt-2":!0})},It={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},At={key:1,class:I({content:!0})},Lt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Rt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ut={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Gt={key:2,class:I({content:!0})},Pt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},jt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Dt(e,o,m,_,b,k){const c=s("el-image"),d=s("video-player"),i=s("el-button"),w=s("el-tooltip"),f=s("font-awesome-icon"),p=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",_t,[l("div",ht,[t(c,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),l("div",gt,[l("div",$t,[h(a(e.$t("veo.name.veoBot"))+" ",1),l("span",bt,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",kt,[e.modelValue?.request?.prompt?(n(),r("p",wt,[h(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?v("",!0):(n(),r("span",yt," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",Vt," - ("+a(e.$t("veo.status.processing"))+") ",1)):v("",!0)])):v("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",Et,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",St,[t(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):v("",!0),e.modelValue?.response.success?(n(),r("div",Tt,[t(w,{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]=C=>e.onGet1080p(C,e.modelValue?.response))},{default:u(()=>[h(a(e.$t("veo.button.action3")),1)]),_:1})):v("",!0)]),_:1},8,["content"]),t(w,{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]=C=>e.onDownload(C,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(a(e.$t("veo.button.download")),1)]),_:1})):v("",!0)]),_:1},8,["content"])])):v("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",It,[t(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),l("p",Ct,[t(f,{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})])):v("",!0),e.modelValue?.response?.success===!1?(n(),r("div",At,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Lt,[t(f,{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",Rt,[t(f,{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",Ut,[t(f,{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"])])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Gt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Pt,[t(f,{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",jt,[t(f,{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"])])):v("",!0)]),_:1})])):v("",!0)])])}const Ot=$(vt,[["render",Dt],["__scopeId","data-v-5372c9d1"]]),Bt=g({name:"RecentPanel",components:{TaskPreview:Ot,NoTasks:oe,BotPlaceholder:ce,ScrollList:Y},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ft={key:0},Mt={key:2,class:"w-full h-full flex items-center justify-center"};function zt(e,o,m,_,b,k){const c=s("bot-placeholder"),d=s("task-preview"),i=s("scroll-list"),w=s("no-tasks");return n(),r(A,null,[e.tasks?.items===void 0?(n(),r("div",Ft,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),y(i,{key:1,ref:"scrollList",class:"tasks h-full w-full overflow-y-auto",loading:e.loading,onReachTop:o[0]||(o[0]=f=>e.$emit("reach-top"))},{default:u(()=>[(n(!0),r(A,null,U(e.tasks?.items,(f,p)=>(n(),y(d,{key:p,"model-value":f},null,8,["model-value"]))),128))]),_:1},8,["loading"])):v("",!0),e.tasks?.items?.length===0?(n(),r("div",Mt,[t(w)])):v("",!0)],64)}const Nt=$(Bt,[["render",zt]]),qt="https://webhook.acedata.cloud/veo",Jt=g({name:"VeoIndex",components:{ConfigPanel:ft,Layout:_e,RecentPanel:Nt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===j.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===j.Request||this.fetchingTasks},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(){await de({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("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(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:_}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",_),this.fetchingTasks=!0;try{await this.$store.dispatch("veo/getTasks",{limit:o,createdAtMin:m,createdAtMax:_})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:qt},o=this.credential?.token;if(!o){console.error("no token specified");return}T.info(this.$t("veo.message.startingTask")),X.generate(e,{token:o}).then(()=>{T.success(this.$t("veo.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Q?T.error(this.$t("veo.message.usedUp")):T.error(this.$t("veo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ht(e,o,m,_,b,k){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,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Lo=$(Jt,[["render",Ht]]);export{Lo as default};
1
+ import{F as L}from"./index.es-Dw-ikv9u.js";import{E as R}from"./index-Ba60uEk-.js";import{E as z}from"./index-h2hg5mzg.js";import{d as g,h as $,b as r,t as l,k as t,r as G,j as u,l as s,o as n,eT as N,x as a,F as A,v as U,i as y,eU as q,eV as J,eW as H,n as I,f as K,y as v,cf as W,D as h,J as E,K as S,eX as X,dN as Q,dJ as j}from"./index-Cltw-TPy.js";import{E as D,a as O}from"./index-DU1Jn2Bq.js";import{I as P,S as Y}from"./ScrollList-BsWg1Oco.js";import{E as Z}from"./index-C9snhxjP.js";import{V as B}from"./VideoPlayer-Bkc77RHA.js";import{I as x}from"./ImagePreview-fjeQ_mXr.js";import{E as ee}from"./index-DTitzyRz.js";import{E as T}from"./index-C7JbjCIG.js";import{C as te,N as oe}from"./NoTasks-Cxeor42D.js";import{E as se}from"./index-BY87tdIk.js";import{a as ne}from"./price-B71O9NlG.js";import{C as ae}from"./CopyToClipboard-B0sXY0gf.js";import{E as le}from"./index-Bp5pMMj1.js";import{E as ie}from"./index-CHfsm--8.js";import{E as re}from"./index-Bk5nP9u2.js";import{B as ce}from"./BotPlaceholder-Bn7lEbyW.js";import{l as de}from"./pagination-BA1VbgK9.js";import"./use-form-item-Be29d0-B.js";import"./index-r5W6hzzQ.js";import"./index-CpH9j3dB.js";import"./typescript-DOVFb1BD.js";import"./index-Daydyphg.js";import"./strings-CNKL_IWi.js";import"./castArray-CGkY3K20.js";import"./isEqual-CbOgjKmk.js";import"./_initCloneObject-CAySSrJV.js";import"./debounce-CguuKO1r.js";import"./_baseIteratee-C0prYj3x.js";import"./index-BjFSM9Qd.js";import"./vue-plyr-QZFBikSk.js";import"./index-RTh02r3m.js";import"./_baseClone-Bm9igNTj.js";import"./index-BhccfPia.js";import"./index-TO8m0FZI.js";const ue=g({name:"LayoutVeo",components:{ElDrawer:z,ElButton:R,FontAwesomeIcon:L},data(){return{drawer:!1}}}),pe={class:"main flex flex-row flex-1"},me={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},fe={class:"result h-full p-[15px] flex-1 flex flex-col"};function ve(e,o,m,_,b,k){const c=s("font-awesome-icon"),d=s("el-button"),i=s("el-drawer");return n(),r("div",pe,[l("div",me,[G(e.$slots,"config",{},void 0,!0)]),l("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=w=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=w=>e.drawer=w),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=$(ue,[["render",ve],["__scopeId","data-v-cfe3cae3"]]),he=g({name:"ModelSelector",components:{ElSelect:O,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"veo2-fast",label:"veo2-fast"},{value:"veo3",label:"veo3"},{value:"veo3-fast",label:"veo3-fast"},{value:"veo31-fast",label:"veo31-fast"},{value:"veo31",label:"veo31"},{value:"veo31-fast-ingredient",label:"veo31-fast-ingredient"}]}},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=N)}}),ge={class:"field"},$e={class:"title font-bold"};function be(e,o,m,_,b,k){const c=s("el-option"),d=s("el-select");return n(),r("div",ge,[l("h2",$e,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(A,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 ke=$(he,[["render",be],["__scopeId","data-v-5bb2f809"]]),we=g({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=q)}}),ye={class:"field"},Ve={class:"title font-bold"},Ee={class:"float-left"};function Se(e,o,m,_,b,k){const c=s("el-option"),d=s("el-select");return n(),r("div",ye,[l("h2",Ve,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(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},{default:u(()=>[l("span",Ee,a(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Te=$(we,[["render",Se],["__scopeId","data-v-ba5abc8a"]]),Ie=g({name:"TranslationSelector",components:{ElSwitch:Z,InfoIcon:P},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=J)}}),Ce={class:"relative"},Ae={class:"flex justify-between"},Le={class:"flex justify-start items-center"},Re={class:"text-sm font-bold"},Ue={class:"flex justify-end items-center"};function Ge(e,o,m,_,b,k){const c=s("info-icon"),d=s("el-switch");return n(),r("div",Ce,[l("div",Ae,[l("div",Le,[l("span",Re,a(e.$t("veo.name.translation")),1),t(c,{content:e.$t("veo.description.translation")},null,8,["content"])]),l("div",Ue,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"])])])])}const Pe=$(Ie,[["render",Ge]]),je=g({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)}}),De={class:"text-sm font-bold mb-2 block"},Oe={class:"items"},Be=["onClick"],Fe={class:"name"};function Me(e,o,m,_,b,k){return n(),r("div",null,[l("span",De,a(e.$t("veo.name.ratio")),1),l("div",Oe,[(n(!0),r(A,null,U(e.options,(c,d)=>(n(),r("div",{key:d,class:I({active:e.active===d,item:!0}),onClick:i=>e.value=c.value},[l("div",{class:I(["preview",c.label])},[l("div",{class:"rect",style:K({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Fe,a(c.label),1)],10,Be))),128))])])}const ze=$(je,[["render",Me],["__scopeId","data-v-688d3e9d"]]),Ne=g({name:"VideoFromInput",components:{VideoPlayer:B},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),qe={class:"relative"},Je={class:"flex mb-2"},He={class:"text-sm font-bold"};function Ke(e,o,m,_,b,k){const c=s("video-player");return n(),r("div",qe,[l("div",Je,[l("span",He,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"])):v("",!0)])])}const We=$(Ne,[["render",Ke]]),Xe=g({name:"StartEndImage",components:{ElUpload:ee,ElButton:R,InfoIcon:P,FontAwesomeIcon:L,ImagePreview:x},emits:["change"],data(){return{fileList:[],uploadUrl:W()+"/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(){T.warning(this.$t("veo.message.uploadReferencesExceed"))},onError(){T.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"},Ye={class:"flex justify-between"},Ze={class:"flex justify-start items-center"},xe={class:"text-sm font-bold"};function et(e,o,m,_,b,k){const c=s("info-icon"),d=s("image-preview"),i=s("font-awesome-icon"),w=s("el-button"),f=s("el-upload");return n(),r("div",Qe,[l("div",Ye,[l("div",Ze,[l("span",xe,a(e.$t("veo.name.startEndImage")),1),t(c,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),t(f,{"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"])):v("",!0)]),default:u(()=>[t(w,{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 tt=$(Xe,[["render",et],["__scopeId","data-v-43d971b7"]]),ot="",st=g({name:"PromptInput",components:{ElInput:se,InfoIcon:P},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=ot)}}),nt={class:"field"},at={class:"box"},lt={class:"title font-bold"};function it(e,o,m,_,b,k){const c=s("info-icon"),d=s("el-input");return n(),r("div",nt,[l("div",at,[l("h2",lt,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 rt=$(st,[["render",it],["__scopeId","data-v-9189572a"]]),ct=g({name:"ConfigPanel",components:{ElButton:R,Consumption:te,FontAwesomeIcon:L,PromptInput:rt,ModelSelector:ke,StartEndImage:tt,ActionSelector:Te,VideoFromInput:We,TranslationSelector:Pe,AspectRatioSelector:ze},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return ne(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),dt={class:"flex flex-col h-full"},ut={class:"flex-1 overflow-y-auto p-[15px]"},pt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function mt(e,o,m,_,b,k){const c=s("video-from-input"),d=s("action-selector"),i=s("translation-selector"),w=s("aspect-ratio-selector"),f=s("prompt-input"),p=s("model-selector"),V=s("start-end-image"),C=s("consumption"),F=s("font-awesome-icon"),M=s("el-button");return n(),r("div",dt,[l("div",ut,[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(w,{class:"mb-4"},null,512),[[S,e.config?.action==="image2video"]]),E(t(f,{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",pt,[t(C,{value:e.consumption,service:e.service},null,8,["value","service"]),t(M,{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 ft=$(ct,[["render",mt]]),vt=g({name:"TaskPreview",components:{ElImage:re,CopyToClipboard:ae,FontAwesomeIcon:L,ElAlert:ie,VideoPlayer:B,ElTooltip:le,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")}}}),_t={class:"preview"},ht={class:"left"},gt={class:"main"},$t={class:"bot"},bt={class:"datetime"},kt={class:"info"},wt={key:0,class:"prompt mt-2"},yt={key:0},Vt={key:1},Et={key:0,class:I({content:!0,failed:!0})},St={key:0,class:"mb-4"},Tt={key:1,class:I({operations:!0,"mt-2":!0})},It={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},At={key:1,class:I({content:!0})},Lt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Rt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ut={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Gt={key:2,class:I({content:!0})},Pt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},jt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Dt(e,o,m,_,b,k){const c=s("el-image"),d=s("video-player"),i=s("el-button"),w=s("el-tooltip"),f=s("font-awesome-icon"),p=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",_t,[l("div",ht,[t(c,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),l("div",gt,[l("div",$t,[h(a(e.$t("veo.name.veoBot"))+" ",1),l("span",bt,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",kt,[e.modelValue?.request?.prompt?(n(),r("p",wt,[h(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?v("",!0):(n(),r("span",yt," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",Vt," - ("+a(e.$t("veo.status.processing"))+") ",1)):v("",!0)])):v("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",Et,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",St,[t(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):v("",!0),e.modelValue?.response.success?(n(),r("div",Tt,[t(w,{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]=C=>e.onGet1080p(C,e.modelValue?.response))},{default:u(()=>[h(a(e.$t("veo.button.action3")),1)]),_:1})):v("",!0)]),_:1},8,["content"]),t(w,{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]=C=>e.onDownload(C,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(a(e.$t("veo.button.download")),1)]),_:1})):v("",!0)]),_:1},8,["content"])])):v("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",It,[t(f,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),l("p",Ct,[t(f,{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})])):v("",!0),e.modelValue?.response?.success===!1?(n(),r("div",At,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Lt,[t(f,{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",Rt,[t(f,{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",Ut,[t(f,{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"])])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Gt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t(f,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Pt,[t(f,{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",jt,[t(f,{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"])])):v("",!0)]),_:1})])):v("",!0)])])}const Ot=$(vt,[["render",Dt],["__scopeId","data-v-5372c9d1"]]),Bt=g({name:"RecentPanel",components:{TaskPreview:Ot,NoTasks:oe,BotPlaceholder:ce,ScrollList:Y},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ft={key:0},Mt={key:2,class:"w-full h-full flex items-center justify-center"};function zt(e,o,m,_,b,k){const c=s("bot-placeholder"),d=s("task-preview"),i=s("scroll-list"),w=s("no-tasks");return n(),r(A,null,[e.tasks?.items===void 0?(n(),r("div",Ft,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),y(i,{key:1,ref:"scrollList",class:"tasks h-full w-full overflow-y-auto",loading:e.loading,onReachTop:o[0]||(o[0]=f=>e.$emit("reach-top"))},{default:u(()=>[(n(!0),r(A,null,U(e.tasks?.items,(f,p)=>(n(),y(d,{key:p,"model-value":f},null,8,["model-value"]))),128))]),_:1},8,["loading"])):v("",!0),e.tasks?.items?.length===0?(n(),r("div",Mt,[t(w)])):v("",!0)],64)}const Nt=$(Bt,[["render",zt]]),qt="https://webhook.acedata.cloud/veo",Jt=g({name:"VeoIndex",components:{ConfigPanel:ft,Layout:_e,RecentPanel:Nt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===j.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===j.Request||this.fetchingTasks},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(){await de({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("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(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:_}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",_),this.fetchingTasks=!0;try{await this.$store.dispatch("veo/getTasks",{limit:o,createdAtMin:m,createdAtMax:_})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:qt},o=this.credential?.token;if(!o){console.error("no token specified");return}T.info(this.$t("veo.message.startingTask")),X.generate(e,{token:o}).then(()=>{T.success(this.$t("veo.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Q?T.error(this.$t("veo.message.usedUp")):T.error(this.$t("veo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ht(e,o,m,_,b,k){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,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Lo=$(Jt,[["render",Ht]]);export{Lo as default};
@@ -1 +1 @@
1
- import{F as K}from"./index.es-B5BxExPu.js";import{E as Z}from"./index-BrZEkGia.js";import{E as de}from"./index-DRhl7LNX.js";import{as as pe,ay as me,bR as fe,at as ae,ci as he,_ as _e,d as b,a as ge,au as $e,c as j,bq as ve,bw as ke,aF as le,b as _,o as l,i as w,r as U,f as oe,e as T,j as g,bh as re,E as M,n as ye,g as we,h as A,t as r,k as s,l as c,fk as se,x as $,F as R,v as N,fl as H,cf as be,D as I,fm as Y,fn as Q,y,J as X,cT as ee,fo as q,b_ as Ce,dJ as z,aq as P,fp as G,aw as Le,K as Se,fq as Ee,dr as Ae,dI as Te}from"./index-BHWAOEcf.js";import{E as ce}from"./index-_Y99ywre.js";import{E as Ve,a as je}from"./index-IMW6uuh-.js";import{I as O,S as Fe}from"./ScrollList-9YjkSrQI.js";import{E as Pe}from"./index-DjcJC0zK.js";import{E}from"./index-DDqBSSFk.js";import{E as x}from"./index-CCKUub4u.js";import{E as Ie,a as ue}from"./index-B92my1Q0.js";import{E as J}from"./index-CmsT3Np_.js";import{C as Ue,N as ze}from"./NoTasks-BpOa5vFX.js";import{a as Re}from"./price-HfrxdcfW.js";import{E as De,a as Me,b as Ge}from"./index-RNrLf-1I.js";import{E as Oe}from"./index-BTdPZbJx.js";import{E as Be}from"./index-BNZB7Wrx.js";import{E as qe,a as We}from"./index-yCwOWgs4.js";import{l as Ne}from"./pagination-Cj4ffYe2.js";import"./use-form-item-Cfa-OGdg.js";import"./index-r5W6hzzQ.js";import"./index-CZeM6Tp2.js";import"./index-DpwLjErO.js";import"./typescript-BJu9PjgO.js";import"./strings-CASQTtYR.js";import"./castArray-KB0R_QyF.js";import"./isEqual-VZNlgh-o.js";import"./_initCloneObject-j_ExEGAU.js";import"./debounce-C3VeLj5t.js";import"./_baseIteratee-DabyO38L.js";import"./index-CrAgxKlm.js";import"./index-CABd8l27.js";import"./_baseClone-BNWubnsE.js";import"./index-DZtScTkG.js";import"./index-BAjjsEGt.js";import"./dropdown-B6EDyfs2.js";const He=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"}}),Ke={error:e=>e instanceof Event},Ze=b({name:"ElAvatar"}),Xe=b({...Ze,props:He,emits:Ke,setup(e,{emit:t}){const i=e,o=ge("avatar"),a=$e(!1),u=j(()=>{const{size:n,icon:f,shape:k}=i,p=[o.b()];return ve(n)&&p.push(o.m(n)),f&&p.push(o.m("icon")),k&&p.push(o.m(k)),p}),d=j(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),m=j(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function h(n){a.value=!0,t("error",n)}return(n,f)=>(l(),_("span",{class:ye(T(u)),style:oe(T(d))},[(n.src||n.srcSet)&&!a.value?(l(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(T(m)),onError:h},null,44,["src","alt","srcset"])):n.icon?(l(),w(T(M),{key:1},{default:g(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var xe=_e(Xe,[["__file","avatar.vue"]]);const Je=we(xe),Ye=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:Z,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Qe={class:"main flex flex-row flex-1"},et={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},tt={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},ot={class:"preview h-full w-[300px] flex flex-col"};function st(e,t,i,o,a,u){const d=c("font-awesome-icon"),m=c("el-button"),h=c("el-drawer");return l(),_("div",Qe,[r("div",et,[U(e.$slots,"config",{},void 0,!0)]),r("div",tt,[U(e.$slots,"result",{},void 0,!0)]),r("div",ot,[U(e.$slots,"preview",{},void 0,!0)]),s(m,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:g(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(h,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:g(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const nt=A(Ye,[["render",st],["__scopeId","data-v-6cc632e5"]]),it=b({name:"VersionSelector",components:{ElSelect:je,ElOption:Ve,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)}}),at={class:"field"},lt={class:"title font-bold"};function rt(e,t,i,o,a,u){const d=c("el-switch"),m=c("el-option"),h=c("el-select");return l(),_("div",at,[r("h2",lt,$(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(h,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:g(()=>[(l(!0),_(R,null,N(e.options,n=>(l(),w(m,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ct=A(it,[["render",rt],["__scopeId","data-v-5ebe40d6"]]),ut=b({name:"UploadAudio",components:{ElUpload:Pe,ElButton:Z,InfoIcon:O,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(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),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"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),dt={class:"relative"},pt={class:"flex justify-between"},mt={class:"flex justify-start items-center"},ft={class:"text-sm font-bold"};function ht(e,t,i,o,a,u){const d=c("info-icon"),m=c("font-awesome-icon"),h=c("el-button"),n=c("el-upload");return l(),_("div",dt,[r("div",pt,[r("div",mt,[r("span",ft,$(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]=f=>e.fileList=f),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:g(()=>[s(h,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:g(()=>[s(m,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+$(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const _t=A(ut,[["render",ht],["__scopeId","data-v-6236152c"]]),gt="",$t=b({name:"PromptInput",components:{ElInput:x,ElSwitch:ce,InfoIcon:O},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=gt)}}),vt={class:"field"},kt={class:"box"},yt={class:"title-info"},wt={class:"title font-bold"},bt={class:"instrumental"},Ct={class:"title inline-block"};function Lt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-switch"),h=c("el-input");return l(),_("div",vt,[r("div",kt,[r("div",yt,[r("h2",wt,$(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",bt,[s(m,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",Ct,$(e.$t("suno.name.instrumental")),1)])]),s(h,{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 St=A($t,[["render",Lt],["__scopeId","data-v-d7004a7c"]]),Et="",At=b({name:"LyricInput",components:{ElInput:x,InfoIcon:O},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=Et)}}),Tt={class:"field"},Vt={class:"box"},jt={class:"title font-bold"};function Ft(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),_("div",Tt,[r("div",Vt,[r("h2",jt,$(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(m,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(m,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Pt=A(At,[["render",Ft],["__scopeId","data-v-99dfded8"]]),It=b({name:"StyleInput",components:{ElInput:x,InfoIcon:O},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}}}),Ut={class:"field"},zt={class:"title-container"},Rt={class:"titlefont-bold"};function Dt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),_("div",Ut,[r("div",zt,[r("h2",Rt,$(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(m,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=h=>e.style=h),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Mt=A(It,[["render",Dt],["__scopeId","data-v-85bbfcaa"]]),Gt=b({name:"TitleInput",components:{ElInput:x,InfoIcon:O},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})}}}}),Ot={class:"field"},Bt={class:"title-container"},qt={class:"title font-bold"};function Wt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),_("div",Ot,[r("div",Bt,[r("h2",qt,$(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(m,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=h=>e.title=h),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Nt=A(Gt,[["render",Wt],["__scopeId","data-v-ce70fe34"]]);function D(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 Ht=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:M,ElInputNumber:Ie,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:D,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})}}}),Kt={class:"field"},Zt={class:"box"},Xt={class:"title font-bold"},xt={class:"input-wrapper"},Jt={class:"task"},Yt={class:"left"},Qt={key:2,class:"duration"},eo={class:"info"},to={class:"title"},oo={class:"style"};function so(e,t,i,o,a,u){const d=c("el-input-number"),m=c("el-image"),h=c("video-pause"),n=c("el-icon"),f=c("video-play"),k=ee("loading");return l(),_("div",Kt,[r("div",Zt,[r("h2",Xt,$(e.$t("suno.name.extend")),1),r("div",xt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=p=>e.value=p),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",Jt,[e.audio?(l(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=p=>e.onClick(e.audio))},[X((l(),_("div",Yt,[s(m,{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(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=p=>e.onPause(e.audio))},[s(n,null,{default:g(()=>[s(h)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=p=>e.onPlay(e.audio))},[s(n,null,{default:g(()=>[s(f)]),_:1})])):y("",!0),e.audio?.duration?(l(),_("div",Qt,$(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),r("div",eo,[r("h2",to,$(e.audio?.title),1),r("p",oo,$(e.audio?.style),1)])])):y("",!0)])])}const no=A(Ht,[["render",so],["__scopeId","data-v-bcce4821"]]),io=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:M,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:D,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})}}}),ao={class:"field"},lo={class:"box"},ro={class:"title font-bold"},co={class:"task"},uo={class:"left"},po={key:2,class:"duration"},mo={class:"info"},fo={class:"title"},ho={class:"style"};function _o(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),n=c("video-play"),f=ee("loading");return l(),_("div",ao,[r("div",lo,[r("h2",ro,$(e.$t("suno.name.cover")),1)]),r("div",co,[e.audio?(l(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[X((l(),_("div",uo,[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(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(h,null,{default:g(()=>[s(m)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(h,null,{default:g(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(l(),_("div",po,$(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[f,!e.audio?.audio_url]]),r("div",mo,[r("h2",fo,$(e.audio?.title),1),r("p",ho,$(e.audio?.style),1)])])):y("",!0)])])}const go=A(io,[["render",_o],["__scopeId","data-v-06640216"]]),$o=b({name:"PresetPanel",components:{TypeSelector:ct,PromptInput:St,LyricInput:Pt,StyleInput:Mt,TitleInput:Nt,ExtendFromInput:no,CoverFromInput:go,UploadAudio:_t,FontAwesomeIcon:K,ElButton:Z,Consumption:Ue},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Re(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),vo={class:"flex flex-col h-full"},ko={class:"flex-1 overflow-y-auto p-[15px]"},yo={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function wo(e,t,i,o,a,u){const d=c("type-selector"),m=c("upload-audio"),h=c("prompt-input"),n=c("lyric-input"),f=c("style-input"),k=c("title-input"),p=c("extend-from-input"),C=c("cover-from-input"),V=c("consumption"),F=c("font-awesome-icon"),S=c("el-button");return l(),_("div",vo,[r("div",ko,[s(d,{class:"mb-4"}),s(m,{class:"mb-4"}),e.config?.custom?y("",!0):(l(),w(h,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(l(),w(f,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(l(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(l(),w(p,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):y("",!0)]),r("div",yo,[s(V,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(S,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[s(F,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(S,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[s(F,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const bo=A($o,[["render",wo],["__scopeId","data-v-8c98e5e5"]]);var W={exports:{}},Co=W.exports,ne;function Lo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(Co,function(){function i(n,f){return typeof f>"u"?f={autoBom:!1}:typeof f!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),f={autoBom:!f}),f.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,f,k){var p=new XMLHttpRequest;p.open("GET",n),p.responseType="blob",p.onload=function(){h(p.response,f,k)},p.onerror=function(){console.error("could not download file")},p.send()}function a(n){var f=new XMLHttpRequest;f.open("HEAD",n,!1);try{f.send()}catch{}return 200<=f.status&&299>=f.status}function u(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var f=document.createEvent("MouseEvents");f.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(f)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof q=="object"&&q.global===q?q:void 0,m=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(n,f,k){var p=d.URL||d.webkitURL,C=document.createElement("a");f=f||n.name||"download",C.download=f,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,f,k):u(C,C.target="_blank")):(C.href=p.createObjectURL(n),setTimeout(function(){p.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,f,k){if(f=f||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),f);else if(a(n))o(n,f,k);else{var p=document.createElement("a");p.href=n,p.target="_blank",setTimeout(function(){u(p)})}}:function(n,f,k,p){if(p=p||open("","_blank"),p&&(p.document.title=p.document.body.innerText="downloading..."),typeof n=="string")return o(n,f,k);var C=n.type==="application/octet-stream",V=/constructor/i.test(d.HTMLElement)||d.safari,F=/CriOS\/[\d]+/.test(navigator.userAgent);if((F||C&&V||m)&&typeof FileReader<"u"){var S=new FileReader;S.onloadend=function(){var L=S.result;L=F?L:L.replace(/^data:[^;]*;/,"data:attachment/file;"),p?p.location.href=L:location=L,p=null},S.readAsDataURL(n)}else{var B=d.URL||d.webkitURL,v=B.createObjectURL(n);p?p.location=v:location.href=v,p=null,setTimeout(function(){B.revokeObjectURL(v)},4e4)}});d.saveAs=h.saveAs=h,e.exports=h})}(W)),W.exports}var So=Lo();const Eo="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:J,ElIcon:M,ElTooltip:Oe,ElButton:Z,FontAwesomeIcon:K,VideoPlay:Q,VideoPause:Y,ElDropdown:Ge,ElDropdownMenu:Me,ElDropdownItem:De,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===z.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:D,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=>{So.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),E.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:Eo},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{E.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})}}}),To={class:"task"},Vo=["onClick"],jo={class:"left"},Fo=["onClick"],Po=["onClick"],Io={key:2,class:"duration"},Uo={class:"info"},zo={class:"title"},Ro={class:"style"},Do={class:"right"},Mo={class:"el-dropdown-link"},Go={class:"flex items-center min-w-[120px]"},Oo={class:"el-dropdown-link"};function Bo(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),n=c("video-play"),f=c("el-button"),k=c("font-awesome-icon"),p=c("el-tooltip"),C=c("Loading"),V=c("el-dropdown-item"),F=c("el-dropdown-menu"),S=c("el-dropdown"),B=ee("loading");return l(),_("div",To,[(l(!0),_(R,null,N(e.audios,v=>(l(),_("div",{key:v.id,class:"audio",onClick:P(L=>e.onClick(v),["stop"])},[X((l(),_("div",jo,[s(d,{src:v?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),v?.audio_url&&e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),_("div",{key:0,class:"overlay",onClick:P(L=>e.onPause(v),["stop"])},[s(h,null,{default:g(()=>[s(m)]),_:1})],8,Fo)):y("",!0),v?.audio_url&&(e.$store.state?.suno?.audio?.id!==v.id||e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:P(L=>e.onPlay(v),["stop"])},[s(h,null,{default:g(()=>[s(n)]),_:1})],8,Po)):y("",!0),v?.duration?(l(),_("div",Io,$(e.useFormatDuring(v?.duration)),1)):y("",!0)])),[[B,!v?.audio_url]]),r("div",Uo,[r("h2",zo,$(v?.title),1),r("p",Ro,$(v?.style),1)]),r("div",Do,[v?.audio_url?(l(),w(f,{key:0,size:"small",round:"",onClick:P(L=>e.onExtend(L,v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(S,null,{dropdown:g(()=>[s(F,null,{default:g(()=>[s(V,{disabled:e.isFetchingVideoUrl,onClick:L=>e.handleVideoDownload(v)},{default:g(()=>[r("div",Go,[e.isFetchingVideoUrl?(l(),w(h,{key:0,class:"is-loading mr-2"},{default:g(()=>[s(C)]),_:1})):y("",!0),r("span",null,$(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),v?.audio_url?(l(),w(V,{key:0,onClick:P(L=>e.onDownload(L,v?.audio_url),["stop"])},{default:g(()=>[I($(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:g(()=>[r("span",Mo,[s(p,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(S,null,{dropdown:g(()=>[s(F,null,{default:g(()=>[v.id?(l(),w(V,{key:0,onClick:P(L=>e.onGetStems(v.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(V,{onClick:P(L=>e.onCover(v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),v?.id&&v?.action==="extend"?(l(),w(V,{key:1,onClick:P(L=>e.onConcatMusic(v?.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:g(()=>[r("span",Oo,[s(p,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Vo))),128))])}const qo=A(Ao,[["render",Bo]]),Wo={class:"player-slider"},No=b({__name:"PlayerSlider",setup(e){const t=G(),i=j({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=j({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,m)=>(l(),_("div",Wo,[s(T(ue),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=h=>i.value=h),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),Ho="/assets/disk-XFRmVAfp.png",Ko={class:"flex player-song"},Zo=["src"],Xo={class:"ml-2 text-xs flex flex-col justify-between"},xo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Jo={class:"flex"},Yo={class:"ml-2 text-dc"},Qo=b({__name:"PlayerSong",setup(e){const t=G(),i=j({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(),_("div",Ko,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||T(Ho)},null,8,Zo),r("div",Xo,[r("div",xo,[r("div",Jo,[r("span",null,$(i.value?.title||"Music"),1),r("span",Yo,"- "+$(i.value?.style||"SmallRuralDog"),1)])])])]))}}),es={class:"flex justify-end items-center gap-x-2.5"},ts={class:"text-xs"},os=b({__name:"PlayerAction",setup(e){const t=G(),i=j({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=j({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),_("div",es,[r("span",ts,$(T(D)(i.value))+" / "+$(T(D)(o.value)),1)]))}});var ss={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 ns(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function is(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 as=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=ns(),m=Le(as,ss);return function(){var h=u.size,n=u.strokeWidth,f=u.strokeLinecap,k=u.strokeLinejoin,p=u.theme,C=u.fill,V=u.spin,F=is(d,{size:h,strokeWidth:n,strokeLinecap:f,strokeLinejoin:k,theme:p,fill:C},m),S=[m.prefix+"-icon"];return S.push(m.prefix+"-icon-"+e),t&&m.rtl&&S.push(m.prefix+"-icon-rtl"),V&&S.push(m.prefix+"-icon-spin"),s("span",{class:S.join(" ")},[i(F)])}}};return o}const ls=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)])}),rs=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)])}),cs=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"]))}}),us={class:"player-volume flex flex-col items-center pt-2"},ds={class:"text-sm mt-3"},ps=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=j({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=j({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),_("div",us,[s(T(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=m=>i.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",ds,$(i.value),1)]))}}),ms={class:"flex items-center justify-center gap-x-3"},fs=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=j(()=>t.state.suno.audio);return(a,u)=>(l(),_("div",ms,[s(ie,{icon:o.value?.state==="playing"?T(ls):T(rs),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(T(Be),{placement:"top",width:"50px",trigger:"click"},{reference:g(()=>[s(ie,{icon:T(cs),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:g(()=>[s(ps)]),_:1})]))}}),hs={class:"flex flex-col items-stretch h-20"},_s={class:"flex grow px-5 items-center"},gs={class:"flex-1"},$s={class:"flex-1"},vs={class:"flex-1"},ks=b({__name:"Player",setup(e){return(t,i)=>(l(),_("div",hs,[s(No),r("div",_s,[r("div",gs,[s(Qo)]),r("div",$s,[s(fs)]),r("div",vs,[s(os)])])]))}}),ys=b({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:qe,TaskPreview:qo,Player:ks,NoTasks:ze,ScrollList:Fe},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),ws={key:0,class:"tasks"},bs={class:"left w-[70px] p-[10px] flex items-center"},Cs={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},Ls={key:2,class:"w-full flex-1 flex items-center justify-center"},Ss={class:"h-20"};function Es(e,t,i,o,a,u){const d=c("el-skeleton-item"),m=c("el-skeleton"),h=c("task-preview"),n=c("scroll-list"),f=c("no-tasks"),k=c("player");return l(),_(R,null,[e.tasks?.items===void 0?(l(),_("div",ws,[(l(),_(R,null,N(3,p=>r("div",{key:p,class:"flex"},[r("div",bs,[s(m,{animated:""},{template:g(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",Cs,[s(m,{animated:""},{template:g(()=>[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(),w(n,{key:1,ref:"scrollList",class:"flex-1 w-full overflow-y-auto tasks p-2",loading:e.loading,onReachTop:t[0]||(t[0]=p=>e.$emit("reach-top"))},{default:g(()=>[(l(!0),_(R,null,N(e.tasks?.items,(p,C)=>(l(),w(h,{key:C,"model-value":p,class:"preview"},null,8,["model-value"]))),128))]),_:1},8,["loading"])):y("",!0),e.tasks?.items?.length===0?(l(),_("div",Ls,[s(f)])):y("",!0),X(r("div",Ss,[s(k)],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=A(ys,[["render",Es]]),Ts=b({name:"TaskPreview",components:{IconPicture:Ee,ElImage:J,ElAvatar:Je,ElIcon:M},computed:{audio(){return this.$store.state.suno?.audio}}}),Vs={key:0,class:"size-full overflow-hidden"},js={class:"relative h-[300px]"},Fs={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Ps={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"},Is={class:"p-4"},Us={class:"flex items-center font-bold mb-2"},zs={class:"text-[var(--el-text-color-regular)] mb-2"},Rs={class:"text-xs text-[var(--el-text-color-regular)]"},Ds={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Ms={key:1,class:"w-full h-full"};function Gs(e,t,i,o,a,u){const d=c("icon-picture"),m=c("el-icon"),h=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),_("div",Vs,[r("div",js,[s(h,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:g(()=>[r("div",Fs,[s(m,{class:"text-3xl"},{default:g(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Ps,$(e.audio?.title),1)]),r("div",Is,[r("div",Us,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,$(e.audio?.title),1)]),r("p",zs,$(e.audio?.style),1),r("p",Rs,$(e.$dayjs.format(e.audio?.created_at)),1),r("div",Ds,[r("p",null,$(e.audio?.lyric),1)])])])):(l(),_("div",Ms))}const Os=A(Ts,[["render",Gs]]),Bs="https://webhook.acedata.cloud/suno",qs=b({name:"SunoIndex",components:{Layout:nt,ConfigPanel:bo,RecentPanel:As,PreviewPanel:Os},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===z.Request||this.fetchingTasks},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===z.Request},needApply(){return this.$store.state.suno.status.getApplications===z.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(){await Ne({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Te&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),this.fetchingTasks=!0;try{await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){const e={...this.config,callback_url:Bs},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ws(e,t,i,o,a,u){const d=c("config-panel"),m=c("recent-panel"),h=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:g(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:g(()=>[s(m,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),preview:g(()=>[s(h)]),_:1})}const An=A(qs,[["render",Ws],["__scopeId","data-v-3a925b34"]]);export{An as default};
1
+ import{F as K}from"./index.es-Dw-ikv9u.js";import{E as Z}from"./index-Ba60uEk-.js";import{E as de}from"./index-h2hg5mzg.js";import{as as pe,ay as me,bR as fe,at as ae,ci as he,_ as _e,d as b,a as ge,au as $e,c as j,bq as ve,bw as ke,aF as le,b as _,o as l,i as w,r as U,f as oe,e as T,j as g,bh as re,E as M,n as ye,g as we,h as A,t as r,k as s,l as c,fk as se,x as $,F as R,v as N,fl as H,cf as be,D as I,fm as Y,fn as Q,y,J as X,cT as ee,fo as q,b_ as Ce,dJ as z,aq as P,fp as G,aw as Le,K as Se,fq as Ee,dr as Ae,dI as Te}from"./index-Cltw-TPy.js";import{E as ce}from"./index-C9snhxjP.js";import{E as Ve,a as je}from"./index-DU1Jn2Bq.js";import{I as O,S as Fe}from"./ScrollList-BsWg1Oco.js";import{E as Pe}from"./index-DTitzyRz.js";import{E}from"./index-C7JbjCIG.js";import{E as x}from"./index-BY87tdIk.js";import{E as Ie,a as ue}from"./index-CUr7KGdA.js";import{E as J}from"./index-Bk5nP9u2.js";import{C as Ue,N as ze}from"./NoTasks-Cxeor42D.js";import{a as Re}from"./price-B71O9NlG.js";import{E as De,a as Me,b as Ge}from"./index-BKPV2Two.js";import{E as Oe}from"./index-Bp5pMMj1.js";import{E as Be}from"./index-DSp1QfJq.js";import{E as qe,a as We}from"./index-TO8m0FZI.js";import{l as Ne}from"./pagination-BA1VbgK9.js";import"./use-form-item-Be29d0-B.js";import"./index-r5W6hzzQ.js";import"./index-Daydyphg.js";import"./index-CpH9j3dB.js";import"./typescript-DOVFb1BD.js";import"./strings-CNKL_IWi.js";import"./castArray-CGkY3K20.js";import"./isEqual-CbOgjKmk.js";import"./_initCloneObject-CAySSrJV.js";import"./debounce-CguuKO1r.js";import"./_baseIteratee-C0prYj3x.js";import"./index-BjFSM9Qd.js";import"./index-RTh02r3m.js";import"./_baseClone-Bm9igNTj.js";import"./index-BhccfPia.js";import"./index-FtmKCcb9.js";import"./dropdown-D2LCpybK.js";const He=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"}}),Ke={error:e=>e instanceof Event},Ze=b({name:"ElAvatar"}),Xe=b({...Ze,props:He,emits:Ke,setup(e,{emit:t}){const i=e,o=ge("avatar"),a=$e(!1),u=j(()=>{const{size:n,icon:f,shape:k}=i,p=[o.b()];return ve(n)&&p.push(o.m(n)),f&&p.push(o.m("icon")),k&&p.push(o.m(k)),p}),d=j(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),m=j(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function h(n){a.value=!0,t("error",n)}return(n,f)=>(l(),_("span",{class:ye(T(u)),style:oe(T(d))},[(n.src||n.srcSet)&&!a.value?(l(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(T(m)),onError:h},null,44,["src","alt","srcset"])):n.icon?(l(),w(T(M),{key:1},{default:g(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var xe=_e(Xe,[["__file","avatar.vue"]]);const Je=we(xe),Ye=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:Z,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Qe={class:"main flex flex-row flex-1"},et={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},tt={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},ot={class:"preview h-full w-[300px] flex flex-col"};function st(e,t,i,o,a,u){const d=c("font-awesome-icon"),m=c("el-button"),h=c("el-drawer");return l(),_("div",Qe,[r("div",et,[U(e.$slots,"config",{},void 0,!0)]),r("div",tt,[U(e.$slots,"result",{},void 0,!0)]),r("div",ot,[U(e.$slots,"preview",{},void 0,!0)]),s(m,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:g(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(h,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:g(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const nt=A(Ye,[["render",st],["__scopeId","data-v-6cc632e5"]]),it=b({name:"VersionSelector",components:{ElSelect:je,ElOption:Ve,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)}}),at={class:"field"},lt={class:"title font-bold"};function rt(e,t,i,o,a,u){const d=c("el-switch"),m=c("el-option"),h=c("el-select");return l(),_("div",at,[r("h2",lt,$(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(h,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:g(()=>[(l(!0),_(R,null,N(e.options,n=>(l(),w(m,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ct=A(it,[["render",rt],["__scopeId","data-v-5ebe40d6"]]),ut=b({name:"UploadAudio",components:{ElUpload:Pe,ElButton:Z,InfoIcon:O,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(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),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"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),dt={class:"relative"},pt={class:"flex justify-between"},mt={class:"flex justify-start items-center"},ft={class:"text-sm font-bold"};function ht(e,t,i,o,a,u){const d=c("info-icon"),m=c("font-awesome-icon"),h=c("el-button"),n=c("el-upload");return l(),_("div",dt,[r("div",pt,[r("div",mt,[r("span",ft,$(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]=f=>e.fileList=f),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:g(()=>[s(h,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:g(()=>[s(m,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+$(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const _t=A(ut,[["render",ht],["__scopeId","data-v-6236152c"]]),gt="",$t=b({name:"PromptInput",components:{ElInput:x,ElSwitch:ce,InfoIcon:O},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=gt)}}),vt={class:"field"},kt={class:"box"},yt={class:"title-info"},wt={class:"title font-bold"},bt={class:"instrumental"},Ct={class:"title inline-block"};function Lt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-switch"),h=c("el-input");return l(),_("div",vt,[r("div",kt,[r("div",yt,[r("h2",wt,$(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",bt,[s(m,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",Ct,$(e.$t("suno.name.instrumental")),1)])]),s(h,{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 St=A($t,[["render",Lt],["__scopeId","data-v-d7004a7c"]]),Et="",At=b({name:"LyricInput",components:{ElInput:x,InfoIcon:O},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=Et)}}),Tt={class:"field"},Vt={class:"box"},jt={class:"title font-bold"};function Ft(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),_("div",Tt,[r("div",Vt,[r("h2",jt,$(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(m,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(m,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Pt=A(At,[["render",Ft],["__scopeId","data-v-99dfded8"]]),It=b({name:"StyleInput",components:{ElInput:x,InfoIcon:O},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}}}),Ut={class:"field"},zt={class:"title-container"},Rt={class:"titlefont-bold"};function Dt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),_("div",Ut,[r("div",zt,[r("h2",Rt,$(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(m,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=h=>e.style=h),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Mt=A(It,[["render",Dt],["__scopeId","data-v-85bbfcaa"]]),Gt=b({name:"TitleInput",components:{ElInput:x,InfoIcon:O},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})}}}}),Ot={class:"field"},Bt={class:"title-container"},qt={class:"title font-bold"};function Wt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),_("div",Ot,[r("div",Bt,[r("h2",qt,$(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(m,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=h=>e.title=h),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Nt=A(Gt,[["render",Wt],["__scopeId","data-v-ce70fe34"]]);function D(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 Ht=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:M,ElInputNumber:Ie,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:D,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})}}}),Kt={class:"field"},Zt={class:"box"},Xt={class:"title font-bold"},xt={class:"input-wrapper"},Jt={class:"task"},Yt={class:"left"},Qt={key:2,class:"duration"},eo={class:"info"},to={class:"title"},oo={class:"style"};function so(e,t,i,o,a,u){const d=c("el-input-number"),m=c("el-image"),h=c("video-pause"),n=c("el-icon"),f=c("video-play"),k=ee("loading");return l(),_("div",Kt,[r("div",Zt,[r("h2",Xt,$(e.$t("suno.name.extend")),1),r("div",xt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=p=>e.value=p),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",Jt,[e.audio?(l(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=p=>e.onClick(e.audio))},[X((l(),_("div",Yt,[s(m,{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(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=p=>e.onPause(e.audio))},[s(n,null,{default:g(()=>[s(h)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=p=>e.onPlay(e.audio))},[s(n,null,{default:g(()=>[s(f)]),_:1})])):y("",!0),e.audio?.duration?(l(),_("div",Qt,$(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),r("div",eo,[r("h2",to,$(e.audio?.title),1),r("p",oo,$(e.audio?.style),1)])])):y("",!0)])])}const no=A(Ht,[["render",so],["__scopeId","data-v-bcce4821"]]),io=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:M,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:D,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})}}}),ao={class:"field"},lo={class:"box"},ro={class:"title font-bold"},co={class:"task"},uo={class:"left"},po={key:2,class:"duration"},mo={class:"info"},fo={class:"title"},ho={class:"style"};function _o(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),n=c("video-play"),f=ee("loading");return l(),_("div",ao,[r("div",lo,[r("h2",ro,$(e.$t("suno.name.cover")),1)]),r("div",co,[e.audio?(l(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[X((l(),_("div",uo,[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(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(h,null,{default:g(()=>[s(m)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(h,null,{default:g(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(l(),_("div",po,$(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[f,!e.audio?.audio_url]]),r("div",mo,[r("h2",fo,$(e.audio?.title),1),r("p",ho,$(e.audio?.style),1)])])):y("",!0)])])}const go=A(io,[["render",_o],["__scopeId","data-v-06640216"]]),$o=b({name:"PresetPanel",components:{TypeSelector:ct,PromptInput:St,LyricInput:Pt,StyleInput:Mt,TitleInput:Nt,ExtendFromInput:no,CoverFromInput:go,UploadAudio:_t,FontAwesomeIcon:K,ElButton:Z,Consumption:Ue},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Re(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),vo={class:"flex flex-col h-full"},ko={class:"flex-1 overflow-y-auto p-[15px]"},yo={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function wo(e,t,i,o,a,u){const d=c("type-selector"),m=c("upload-audio"),h=c("prompt-input"),n=c("lyric-input"),f=c("style-input"),k=c("title-input"),p=c("extend-from-input"),C=c("cover-from-input"),V=c("consumption"),F=c("font-awesome-icon"),S=c("el-button");return l(),_("div",vo,[r("div",ko,[s(d,{class:"mb-4"}),s(m,{class:"mb-4"}),e.config?.custom?y("",!0):(l(),w(h,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(l(),w(f,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(l(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(l(),w(p,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):y("",!0)]),r("div",yo,[s(V,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(S,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[s(F,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(S,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[s(F,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const bo=A($o,[["render",wo],["__scopeId","data-v-8c98e5e5"]]);var W={exports:{}},Co=W.exports,ne;function Lo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(Co,function(){function i(n,f){return typeof f>"u"?f={autoBom:!1}:typeof f!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),f={autoBom:!f}),f.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,f,k){var p=new XMLHttpRequest;p.open("GET",n),p.responseType="blob",p.onload=function(){h(p.response,f,k)},p.onerror=function(){console.error("could not download file")},p.send()}function a(n){var f=new XMLHttpRequest;f.open("HEAD",n,!1);try{f.send()}catch{}return 200<=f.status&&299>=f.status}function u(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var f=document.createEvent("MouseEvents");f.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(f)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof q=="object"&&q.global===q?q:void 0,m=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(n,f,k){var p=d.URL||d.webkitURL,C=document.createElement("a");f=f||n.name||"download",C.download=f,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,f,k):u(C,C.target="_blank")):(C.href=p.createObjectURL(n),setTimeout(function(){p.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,f,k){if(f=f||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),f);else if(a(n))o(n,f,k);else{var p=document.createElement("a");p.href=n,p.target="_blank",setTimeout(function(){u(p)})}}:function(n,f,k,p){if(p=p||open("","_blank"),p&&(p.document.title=p.document.body.innerText="downloading..."),typeof n=="string")return o(n,f,k);var C=n.type==="application/octet-stream",V=/constructor/i.test(d.HTMLElement)||d.safari,F=/CriOS\/[\d]+/.test(navigator.userAgent);if((F||C&&V||m)&&typeof FileReader<"u"){var S=new FileReader;S.onloadend=function(){var L=S.result;L=F?L:L.replace(/^data:[^;]*;/,"data:attachment/file;"),p?p.location.href=L:location=L,p=null},S.readAsDataURL(n)}else{var B=d.URL||d.webkitURL,v=B.createObjectURL(n);p?p.location=v:location.href=v,p=null,setTimeout(function(){B.revokeObjectURL(v)},4e4)}});d.saveAs=h.saveAs=h,e.exports=h})}(W)),W.exports}var So=Lo();const Eo="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:J,ElIcon:M,ElTooltip:Oe,ElButton:Z,FontAwesomeIcon:K,VideoPlay:Q,VideoPause:Y,ElDropdown:Ge,ElDropdownMenu:Me,ElDropdownItem:De,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===z.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:D,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=>{So.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),E.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:Eo},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{E.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})}}}),To={class:"task"},Vo=["onClick"],jo={class:"left"},Fo=["onClick"],Po=["onClick"],Io={key:2,class:"duration"},Uo={class:"info"},zo={class:"title"},Ro={class:"style"},Do={class:"right"},Mo={class:"el-dropdown-link"},Go={class:"flex items-center min-w-[120px]"},Oo={class:"el-dropdown-link"};function Bo(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),n=c("video-play"),f=c("el-button"),k=c("font-awesome-icon"),p=c("el-tooltip"),C=c("Loading"),V=c("el-dropdown-item"),F=c("el-dropdown-menu"),S=c("el-dropdown"),B=ee("loading");return l(),_("div",To,[(l(!0),_(R,null,N(e.audios,v=>(l(),_("div",{key:v.id,class:"audio",onClick:P(L=>e.onClick(v),["stop"])},[X((l(),_("div",jo,[s(d,{src:v?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),v?.audio_url&&e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),_("div",{key:0,class:"overlay",onClick:P(L=>e.onPause(v),["stop"])},[s(h,null,{default:g(()=>[s(m)]),_:1})],8,Fo)):y("",!0),v?.audio_url&&(e.$store.state?.suno?.audio?.id!==v.id||e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:P(L=>e.onPlay(v),["stop"])},[s(h,null,{default:g(()=>[s(n)]),_:1})],8,Po)):y("",!0),v?.duration?(l(),_("div",Io,$(e.useFormatDuring(v?.duration)),1)):y("",!0)])),[[B,!v?.audio_url]]),r("div",Uo,[r("h2",zo,$(v?.title),1),r("p",Ro,$(v?.style),1)]),r("div",Do,[v?.audio_url?(l(),w(f,{key:0,size:"small",round:"",onClick:P(L=>e.onExtend(L,v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(S,null,{dropdown:g(()=>[s(F,null,{default:g(()=>[s(V,{disabled:e.isFetchingVideoUrl,onClick:L=>e.handleVideoDownload(v)},{default:g(()=>[r("div",Go,[e.isFetchingVideoUrl?(l(),w(h,{key:0,class:"is-loading mr-2"},{default:g(()=>[s(C)]),_:1})):y("",!0),r("span",null,$(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),v?.audio_url?(l(),w(V,{key:0,onClick:P(L=>e.onDownload(L,v?.audio_url),["stop"])},{default:g(()=>[I($(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:g(()=>[r("span",Mo,[s(p,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(S,null,{dropdown:g(()=>[s(F,null,{default:g(()=>[v.id?(l(),w(V,{key:0,onClick:P(L=>e.onGetStems(v.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(V,{onClick:P(L=>e.onCover(v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),v?.id&&v?.action==="extend"?(l(),w(V,{key:1,onClick:P(L=>e.onConcatMusic(v?.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:g(()=>[r("span",Oo,[s(p,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Vo))),128))])}const qo=A(Ao,[["render",Bo]]),Wo={class:"player-slider"},No=b({__name:"PlayerSlider",setup(e){const t=G(),i=j({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=j({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,m)=>(l(),_("div",Wo,[s(T(ue),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=h=>i.value=h),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),Ho="/assets/disk-XFRmVAfp.png",Ko={class:"flex player-song"},Zo=["src"],Xo={class:"ml-2 text-xs flex flex-col justify-between"},xo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Jo={class:"flex"},Yo={class:"ml-2 text-dc"},Qo=b({__name:"PlayerSong",setup(e){const t=G(),i=j({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(),_("div",Ko,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||T(Ho)},null,8,Zo),r("div",Xo,[r("div",xo,[r("div",Jo,[r("span",null,$(i.value?.title||"Music"),1),r("span",Yo,"- "+$(i.value?.style||"SmallRuralDog"),1)])])])]))}}),es={class:"flex justify-end items-center gap-x-2.5"},ts={class:"text-xs"},os=b({__name:"PlayerAction",setup(e){const t=G(),i=j({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=j({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),_("div",es,[r("span",ts,$(T(D)(i.value))+" / "+$(T(D)(o.value)),1)]))}});var ss={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 ns(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function is(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 as=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=ns(),m=Le(as,ss);return function(){var h=u.size,n=u.strokeWidth,f=u.strokeLinecap,k=u.strokeLinejoin,p=u.theme,C=u.fill,V=u.spin,F=is(d,{size:h,strokeWidth:n,strokeLinecap:f,strokeLinejoin:k,theme:p,fill:C},m),S=[m.prefix+"-icon"];return S.push(m.prefix+"-icon-"+e),t&&m.rtl&&S.push(m.prefix+"-icon-rtl"),V&&S.push(m.prefix+"-icon-spin"),s("span",{class:S.join(" ")},[i(F)])}}};return o}const ls=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)])}),rs=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)])}),cs=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"]))}}),us={class:"player-volume flex flex-col items-center pt-2"},ds={class:"text-sm mt-3"},ps=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=j({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=j({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),_("div",us,[s(T(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=m=>i.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",ds,$(i.value),1)]))}}),ms={class:"flex items-center justify-center gap-x-3"},fs=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=j(()=>t.state.suno.audio);return(a,u)=>(l(),_("div",ms,[s(ie,{icon:o.value?.state==="playing"?T(ls):T(rs),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(T(Be),{placement:"top",width:"50px",trigger:"click"},{reference:g(()=>[s(ie,{icon:T(cs),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:g(()=>[s(ps)]),_:1})]))}}),hs={class:"flex flex-col items-stretch h-20"},_s={class:"flex grow px-5 items-center"},gs={class:"flex-1"},$s={class:"flex-1"},vs={class:"flex-1"},ks=b({__name:"Player",setup(e){return(t,i)=>(l(),_("div",hs,[s(No),r("div",_s,[r("div",gs,[s(Qo)]),r("div",$s,[s(fs)]),r("div",vs,[s(os)])])]))}}),ys=b({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:qe,TaskPreview:qo,Player:ks,NoTasks:ze,ScrollList:Fe},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),ws={key:0,class:"tasks"},bs={class:"left w-[70px] p-[10px] flex items-center"},Cs={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},Ls={key:2,class:"w-full flex-1 flex items-center justify-center"},Ss={class:"h-20"};function Es(e,t,i,o,a,u){const d=c("el-skeleton-item"),m=c("el-skeleton"),h=c("task-preview"),n=c("scroll-list"),f=c("no-tasks"),k=c("player");return l(),_(R,null,[e.tasks?.items===void 0?(l(),_("div",ws,[(l(),_(R,null,N(3,p=>r("div",{key:p,class:"flex"},[r("div",bs,[s(m,{animated:""},{template:g(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",Cs,[s(m,{animated:""},{template:g(()=>[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(),w(n,{key:1,ref:"scrollList",class:"flex-1 w-full overflow-y-auto tasks p-2",loading:e.loading,onReachTop:t[0]||(t[0]=p=>e.$emit("reach-top"))},{default:g(()=>[(l(!0),_(R,null,N(e.tasks?.items,(p,C)=>(l(),w(h,{key:C,"model-value":p,class:"preview"},null,8,["model-value"]))),128))]),_:1},8,["loading"])):y("",!0),e.tasks?.items?.length===0?(l(),_("div",Ls,[s(f)])):y("",!0),X(r("div",Ss,[s(k)],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=A(ys,[["render",Es]]),Ts=b({name:"TaskPreview",components:{IconPicture:Ee,ElImage:J,ElAvatar:Je,ElIcon:M},computed:{audio(){return this.$store.state.suno?.audio}}}),Vs={key:0,class:"size-full overflow-hidden"},js={class:"relative h-[300px]"},Fs={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Ps={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"},Is={class:"p-4"},Us={class:"flex items-center font-bold mb-2"},zs={class:"text-[var(--el-text-color-regular)] mb-2"},Rs={class:"text-xs text-[var(--el-text-color-regular)]"},Ds={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Ms={key:1,class:"w-full h-full"};function Gs(e,t,i,o,a,u){const d=c("icon-picture"),m=c("el-icon"),h=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),_("div",Vs,[r("div",js,[s(h,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:g(()=>[r("div",Fs,[s(m,{class:"text-3xl"},{default:g(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Ps,$(e.audio?.title),1)]),r("div",Is,[r("div",Us,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,$(e.audio?.title),1)]),r("p",zs,$(e.audio?.style),1),r("p",Rs,$(e.$dayjs.format(e.audio?.created_at)),1),r("div",Ds,[r("p",null,$(e.audio?.lyric),1)])])])):(l(),_("div",Ms))}const Os=A(Ts,[["render",Gs]]),Bs="https://webhook.acedata.cloud/suno",qs=b({name:"SunoIndex",components:{Layout:nt,ConfigPanel:bo,RecentPanel:As,PreviewPanel:Os},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===z.Request||this.fetchingTasks},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===z.Request},needApply(){return this.$store.state.suno.status.getApplications===z.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(){await Ne({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Te&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),this.fetchingTasks=!0;try{await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){const e={...this.config,callback_url:Bs},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ws(e,t,i,o,a,u){const d=c("config-panel"),m=c("recent-panel"),h=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:g(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:g(()=>[s(m,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),preview:g(()=>[s(h)]),_:1})}const An=A(qs,[["render",Ws],["__scopeId","data-v-3a925b34"]]);export{An as default};
@@ -1 +1 @@
1
- import{C}from"./CopyToClipboard-DgotqLxr.js";import{d as I,dj as F,en as T,eo as N,ep as P,h as B,i as r,j as o,k as i,l,t as e,x as s,b as p,D as m,y as k,o as n}from"./index-BHWAOEcf.js";import{d as O,a as w,s as M}from"./distribution-C85LoBvQ.js";import{g as q}from"./price-HfrxdcfW.js";import{F as R}from"./index.es-B5BxExPu.js";import{E as z}from"./index-yCwOWgs4.js";import{E as U,a as V}from"./index-pMVrQRue.js";import{E as A}from"./index-BTdPZbJx.js";import{E as H,a as j,b as G}from"./index-B5Lioaz1.js";import{E as Q}from"./index-Dno4ZZGJ.js";import{E as W}from"./index-BrZEkGia.js";import{E as Y}from"./index-CABd8l27.js";import"./index-DpwLjErO.js";import"./typescript-BJu9PjgO.js";import"./index-CZeM6Tp2.js";import"./_initCloneObject-j_ExEGAU.js";import"./isPlainObject-B0WNvF5u.js";import"./_baseIteratee-DabyO38L.js";import"./isEqual-VZNlgh-o.js";import"./castArray-KB0R_QyF.js";import"./debounce-C3VeLj5t.js";import"./index-Cx5qFJ0y.js";import"./use-form-item-Cfa-OGdg.js";import"./index-CrAgxKlm.js";import"./index-r5W6hzzQ.js";const J=I({name:"ConsoleDistributionList",components:{CopyToClipboard:C,FontAwesomeIcon:R,QrCode:F,ElProgress:Y,ElRow:G,ElCol:j,ElButton:W,ElDivider:Q,ElCard:H,ElTooltip:A,ElTable:V,ElTableColumn:U,ElSkeleton:z},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||"1")},distributionLevelMap(){let t={};return this.distributionLevels.forEach(a=>{t[a.level]=a}),t}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:q,goHistory(){this.$router.push({name:P})},goInvitees(){this.$router.push({name:N})},onPageChange(t){this.$router.push({name:this.$route.name?.toString(),query:{page:t}})},getPercentageForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,a=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-t)/(a-t)*100)},getDeltaForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(t-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await w.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){const a=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{const v=(await M.create(a))?.data?.data?.url;this.distributionLink=(v||a).replace("surl.id","share.acedata.cloud")}catch{this.distributionLink=a}},async onFetchDistributionStatus(){const{data:t}=await w.getAll({user_id:this.$store.getters.user.id});t.items&&t.items.length>0&&(this.distributionStatus=t.items[0])},async onFetchDistributionLevels(){const{data:t}=await O.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=t.items},async onFetchInvitees(){const{data:t}=await T.getInvitees({});this.invitees=t.items,this.inviteesCount=t.count}}}),K={class:"title"},X={key:1},Z={class:"icon-wrapper"},x={class:"text-left"},tt={class:"description"},et={class:"value"},it={key:1},st={class:"icon-wrapper"},ot={class:"text-left"},nt={class:"description"},lt={class:"value"},at={key:1},rt={class:"icon-wrapper"},dt={class:"text-left"},ct={class:"description"},ut={class:"value"},pt={key:1},ht={class:"icon-wrapper"},mt={class:"text-left"},_t={class:"description"},bt={class:"value"},vt={key:1},ft={class:"title"},gt={class:"clear-both overflow-hidden"},kt={class:"float-left description"},yt={class:"float-right description"},$t={class:"description"},wt={class:"level"},Lt={class:"level"},St={class:"level"},Et={key:1},Dt={class:"title"},Ct={class:"link-wrapper text-center"},It=["href"],Ft={class:"qr-wrapper ml-auto mr-auto"},Tt={class:"mt-0"},Nt={class:"description"},Pt={class:"more"};function Bt(t,a,v,Ot,Mt,qt){const d=l("el-col"),_=l("el-row"),c=l("el-skeleton"),b=l("font-awesome-icon"),f=l("el-button"),u=l("el-card"),y=l("el-tooltip"),L=l("el-progress"),$=l("el-divider"),g=l("el-table-column"),S=l("el-table"),E=l("copy-to-clipboard"),D=l("qr-code");return n(),r(_,{class:"panel"},{default:o(()=>[i(d,{span:24},{default:o(()=>[i(_,null,{default:o(()=>[i(d,{span:24},{default:o(()=>[e("h2",K,s(t.$t("common.title.distribution")),1)]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",X,[e("div",Z,[i(b,{icon:"fa-solid fa-wallet",class:"icon"})]),e("div",x,[e("p",tt,s(t.$t("distribution.title.price")),1),e("p",et,s(t.getPriceString({value:t.distributionStatus?.price})),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goHistory},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",it,[e("div",st,[i(b,{icon:"fa-solid fa-coins",class:"icon"})]),e("div",ot,[e("p",nt,s(t.$t("distribution.title.reward")),1),e("p",lt,s(t.getPriceString({value:t.distributionStatus?.reward})),1)]),i(y,{effect:"dark",content:t.$t("distribution.message.developingWithDrawal"),placement:"top"},{default:o(()=>[i(f,{type:"primary",round:"",size:"small",class:"btn"},{default:o(()=>[m(s(t.$t("distribution.button.withdrawal")),1)]),_:1})]),_:1},8,["content"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",at,[e("div",rt,[i(b,{icon:"fa-solid fa-percent",class:"icon"})]),e("div",dt,[e("p",ct,s(t.$t("distribution.title.percentage")),1),e("p",ut,s(t.distributionStatus?.level?.percentage)+"%",1)])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",pt,[e("div",ht,[i(b,{icon:"fa-regular fa-user",class:"icon"})]),e("div",mt,[e("p",_t,s(t.$t("distribution.title.inviteesCount")),1),e("p",bt,s(t.inviteesCount),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goInvitees},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"level-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",vt,[e("h4",ft,s(t.$t("distribution.title.levelInfo")),1),e("div",gt,[e("div",kt,[e("p",null,s(t.$t("distribution.title.currentLevel"))+": L"+s(t.distributionStatus?.level?.level),1),e("p",null,s(t.$t("distribution.title.currentPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level]?.percentage)+"% ",1)]),e("div",yt,[e("p",null,s(t.$t("distribution.title.nextLevel"))+": L"+s(t.distributionStatus?.level?.level+1),1),e("p",null,s(t.$t("distribution.title.nextPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level+1]?.percentage)+"% ",1)])]),i(L,{"text-inside":!0,"stroke-width":20,percentage:t.getPercentageForNextLevel(),class:"mb-2"},null,8,["percentage"]),e("p",$t,s(t.$t("distribution.message.deltaPriceForNextLevel"))+": $"+s(t.getDeltaForNextLevel()),1),i($),t.distributionLevels?(n(),r(S,{key:0,data:t.distributionLevels,stripe:""},{default:o(()=>[i(g,{label:t.$t("distribution.field.level")},{default:o(h=>[e("span",wt,"L"+s(h.row?.level),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.threshold")},{default:o(h=>[e("span",Lt,"$"+s(h.row?.threshold),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.percentage")},{default:o(h=>[e("span",St,s(h.row?.percentage)+"%",1)]),_:1},8,["label"])]),_:1},8,["data"])):k("",!0)]))]),_:1})]),_:1}),i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"distribution-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",Et,[e("h4",Dt,s(t.$t("distribution.title.distributionLink")),1),i($),e("div",Ct,[k("",!0),e("a",{href:t.distributionLink,class:"link"},s(t.distributionLink),9,It),i(E,{content:t.distributionLink},null,8,["content"])]),e("div",Ft,[t.distributionLink?(n(),r(D,{key:0,value:t.distributionLink,size:180,margin:2,class:"block mb-2 ml-auto mr-auto",type:"image/png",color:{dark:"#000000",light:"#ffffff"}},null,8,["value"])):k("",!0),e("p",Tt,s(t.$t("distribution.message.distributionQrDescription")),1)]),e("p",Nt,[m(s(t.$t("distribution.message.distributionLinkDescription"))+" ",1),e("span",Pt,[i(y,{effect:"dark",content:t.$t("distribution.message.distributionLinkDescription2"),placement:"top"},{default:o(()=>[m(s(t.$t("distribution.message.technicalDetail")),1)]),_:1},8,["content"])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const de=B(J,[["render",Bt],["__scopeId","data-v-a8befdf2"]]);export{de as default};
1
+ import{C}from"./CopyToClipboard-B0sXY0gf.js";import{d as I,dj as F,en as T,eo as N,ep as P,h as B,i as r,j as o,k as i,l,t as e,x as s,b as p,D as m,y as k,o as n}from"./index-Cltw-TPy.js";import{d as O,a as w,s as M}from"./distribution-DyIdWLTX.js";import{g as q}from"./price-B71O9NlG.js";import{F as R}from"./index.es-Dw-ikv9u.js";import{E as z}from"./index-TO8m0FZI.js";import{E as U,a as V}from"./index-BBae-ry6.js";import{E as A}from"./index-Bp5pMMj1.js";import{E as H,a as j,b as G}from"./index-TiR34Adr.js";import{E as Q}from"./index-Duh1U13K.js";import{E as W}from"./index-Ba60uEk-.js";import{E as Y}from"./index-RTh02r3m.js";import"./index-CpH9j3dB.js";import"./typescript-DOVFb1BD.js";import"./index-Daydyphg.js";import"./_initCloneObject-CAySSrJV.js";import"./isPlainObject-BHOEH-Zh.js";import"./_baseIteratee-C0prYj3x.js";import"./isEqual-CbOgjKmk.js";import"./castArray-CGkY3K20.js";import"./debounce-CguuKO1r.js";import"./index-B9M5gqZj.js";import"./use-form-item-Be29d0-B.js";import"./index-BjFSM9Qd.js";import"./index-r5W6hzzQ.js";const J=I({name:"ConsoleDistributionList",components:{CopyToClipboard:C,FontAwesomeIcon:R,QrCode:F,ElProgress:Y,ElRow:G,ElCol:j,ElButton:W,ElDivider:Q,ElCard:H,ElTooltip:A,ElTable:V,ElTableColumn:U,ElSkeleton:z},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||"1")},distributionLevelMap(){let t={};return this.distributionLevels.forEach(a=>{t[a.level]=a}),t}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:q,goHistory(){this.$router.push({name:P})},goInvitees(){this.$router.push({name:N})},onPageChange(t){this.$router.push({name:this.$route.name?.toString(),query:{page:t}})},getPercentageForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,a=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-t)/(a-t)*100)},getDeltaForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(t-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await w.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){const a=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{const v=(await M.create(a))?.data?.data?.url;this.distributionLink=(v||a).replace("surl.id","share.acedata.cloud")}catch{this.distributionLink=a}},async onFetchDistributionStatus(){const{data:t}=await w.getAll({user_id:this.$store.getters.user.id});t.items&&t.items.length>0&&(this.distributionStatus=t.items[0])},async onFetchDistributionLevels(){const{data:t}=await O.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=t.items},async onFetchInvitees(){const{data:t}=await T.getInvitees({});this.invitees=t.items,this.inviteesCount=t.count}}}),K={class:"title"},X={key:1},Z={class:"icon-wrapper"},x={class:"text-left"},tt={class:"description"},et={class:"value"},it={key:1},st={class:"icon-wrapper"},ot={class:"text-left"},nt={class:"description"},lt={class:"value"},at={key:1},rt={class:"icon-wrapper"},dt={class:"text-left"},ct={class:"description"},ut={class:"value"},pt={key:1},ht={class:"icon-wrapper"},mt={class:"text-left"},_t={class:"description"},bt={class:"value"},vt={key:1},ft={class:"title"},gt={class:"clear-both overflow-hidden"},kt={class:"float-left description"},yt={class:"float-right description"},$t={class:"description"},wt={class:"level"},Lt={class:"level"},St={class:"level"},Et={key:1},Dt={class:"title"},Ct={class:"link-wrapper text-center"},It=["href"],Ft={class:"qr-wrapper ml-auto mr-auto"},Tt={class:"mt-0"},Nt={class:"description"},Pt={class:"more"};function Bt(t,a,v,Ot,Mt,qt){const d=l("el-col"),_=l("el-row"),c=l("el-skeleton"),b=l("font-awesome-icon"),f=l("el-button"),u=l("el-card"),y=l("el-tooltip"),L=l("el-progress"),$=l("el-divider"),g=l("el-table-column"),S=l("el-table"),E=l("copy-to-clipboard"),D=l("qr-code");return n(),r(_,{class:"panel"},{default:o(()=>[i(d,{span:24},{default:o(()=>[i(_,null,{default:o(()=>[i(d,{span:24},{default:o(()=>[e("h2",K,s(t.$t("common.title.distribution")),1)]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",X,[e("div",Z,[i(b,{icon:"fa-solid fa-wallet",class:"icon"})]),e("div",x,[e("p",tt,s(t.$t("distribution.title.price")),1),e("p",et,s(t.getPriceString({value:t.distributionStatus?.price})),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goHistory},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",it,[e("div",st,[i(b,{icon:"fa-solid fa-coins",class:"icon"})]),e("div",ot,[e("p",nt,s(t.$t("distribution.title.reward")),1),e("p",lt,s(t.getPriceString({value:t.distributionStatus?.reward})),1)]),i(y,{effect:"dark",content:t.$t("distribution.message.developingWithDrawal"),placement:"top"},{default:o(()=>[i(f,{type:"primary",round:"",size:"small",class:"btn"},{default:o(()=>[m(s(t.$t("distribution.button.withdrawal")),1)]),_:1})]),_:1},8,["content"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",at,[e("div",rt,[i(b,{icon:"fa-solid fa-percent",class:"icon"})]),e("div",dt,[e("p",ct,s(t.$t("distribution.title.percentage")),1),e("p",ut,s(t.distributionStatus?.level?.percentage)+"%",1)])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",pt,[e("div",ht,[i(b,{icon:"fa-regular fa-user",class:"icon"})]),e("div",mt,[e("p",_t,s(t.$t("distribution.title.inviteesCount")),1),e("p",bt,s(t.inviteesCount),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goInvitees},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"level-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",vt,[e("h4",ft,s(t.$t("distribution.title.levelInfo")),1),e("div",gt,[e("div",kt,[e("p",null,s(t.$t("distribution.title.currentLevel"))+": L"+s(t.distributionStatus?.level?.level),1),e("p",null,s(t.$t("distribution.title.currentPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level]?.percentage)+"% ",1)]),e("div",yt,[e("p",null,s(t.$t("distribution.title.nextLevel"))+": L"+s(t.distributionStatus?.level?.level+1),1),e("p",null,s(t.$t("distribution.title.nextPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level+1]?.percentage)+"% ",1)])]),i(L,{"text-inside":!0,"stroke-width":20,percentage:t.getPercentageForNextLevel(),class:"mb-2"},null,8,["percentage"]),e("p",$t,s(t.$t("distribution.message.deltaPriceForNextLevel"))+": $"+s(t.getDeltaForNextLevel()),1),i($),t.distributionLevels?(n(),r(S,{key:0,data:t.distributionLevels,stripe:""},{default:o(()=>[i(g,{label:t.$t("distribution.field.level")},{default:o(h=>[e("span",wt,"L"+s(h.row?.level),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.threshold")},{default:o(h=>[e("span",Lt,"$"+s(h.row?.threshold),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.percentage")},{default:o(h=>[e("span",St,s(h.row?.percentage)+"%",1)]),_:1},8,["label"])]),_:1},8,["data"])):k("",!0)]))]),_:1})]),_:1}),i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"distribution-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",Et,[e("h4",Dt,s(t.$t("distribution.title.distributionLink")),1),i($),e("div",Ct,[k("",!0),e("a",{href:t.distributionLink,class:"link"},s(t.distributionLink),9,It),i(E,{content:t.distributionLink},null,8,["content"])]),e("div",Ft,[t.distributionLink?(n(),r(D,{key:0,value:t.distributionLink,size:180,margin:2,class:"block mb-2 ml-auto mr-auto",type:"image/png",color:{dark:"#000000",light:"#ffffff"}},null,8,["value"])):k("",!0),e("p",Tt,s(t.$t("distribution.message.distributionQrDescription")),1)]),e("p",Nt,[m(s(t.$t("distribution.message.distributionLinkDescription"))+" ",1),e("span",Pt,[i(y,{effect:"dark",content:t.$t("distribution.message.distributionLinkDescription2"),placement:"top"},{default:o(()=>[m(s(t.$t("distribution.message.technicalDetail")),1)]),_:1},8,["content"])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const de=B(J,[["render",Bt],["__scopeId","data-v-a8befdf2"]]);export{de as default};
@@ -1 +1 @@
1
- import{F as T}from"./index.es-B5BxExPu.js";import{E as L}from"./index-BrZEkGia.js";import{E as K}from"./index-DRhl7LNX.js";import{d as v,h as k,b as c,t as a,k as t,r as P,j as u,l as o,o as n,eN as H,x as i,F as S,v as C,i as y,eO as J,eP as Q,eQ as W,n as I,f as X,cf as N,D as h,y as $,eR as Y,eS as Z,dN as x,dJ as M}from"./index-BHWAOEcf.js";import{E as G,a as A}from"./index-IMW6uuh-.js";import{I as U,S as ee}from"./ScrollList-9YjkSrQI.js";import{I as O}from"./ImagePreview-DhYLHTps.js";import{E as B}from"./index-DjcJC0zK.js";import{E as V}from"./index-DDqBSSFk.js";import{C as te,N as oe}from"./NoTasks-BpOa5vFX.js";import{E as se,a as ne}from"./index-B92my1Q0.js";import{E as F}from"./index-CCKUub4u.js";import{a as le}from"./price-HfrxdcfW.js";import{C as ae}from"./CopyToClipboard-DgotqLxr.js";import{V as ie}from"./VideoPlayer-DleRW6I6.js";import{E as re}from"./index-BTdPZbJx.js";import{E as ce}from"./index-Bgzvc62r.js";import{E as de}from"./index-CmsT3Np_.js";import{B as pe}from"./BotPlaceholder-8zDrksua.js";import{l as ue}from"./pagination-Cj4ffYe2.js";import"./use-form-item-Cfa-OGdg.js";import"./index-r5W6hzzQ.js";import"./index-DpwLjErO.js";import"./typescript-BJu9PjgO.js";import"./index-CZeM6Tp2.js";import"./strings-CASQTtYR.js";import"./castArray-KB0R_QyF.js";import"./isEqual-VZNlgh-o.js";import"./_initCloneObject-j_ExEGAU.js";import"./debounce-C3VeLj5t.js";import"./_baseIteratee-DabyO38L.js";import"./index-CrAgxKlm.js";import"./index-CABd8l27.js";import"./_baseClone-BNWubnsE.js";import"./index-BAjjsEGt.js";import"./index-DZtScTkG.js";import"./vue-plyr-QZFBikSk.js";import"./index-yCwOWgs4.js";const me=v({name:"LayoutKling",components:{ElDrawer:K,ElButton:L,FontAwesomeIcon:T},data(){return{drawer:!1}}}),fe={class:"main flex flex-row flex-1"},ge={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},_e={class:"result h-full p-[15px] flex-1 flex flex-col"};function he(e,s,f,g,b,w){const r=o("font-awesome-icon"),d=o("el-button"),l=o("el-drawer");return n(),c("div",fe,[a("div",ge,[P(e.$slots,"config",{},void 0,!0)]),a("div",_e,[P(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(r,{icon:"fa-solid fa-magic"})]),_:1}),t(l,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const $e=k(me,[["render",he],["__scopeId","data-v-fae64b48"]]),ve=v({name:"ModelSelector",components:{ElSelect:A,ElOption:G},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1-master",label:"v2.1-Master"},{value:"kling-v2-5-turbo",label:"v2.5-Turbo"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=H)}}),ke={class:"field"},be={class:"title font-bold"};function we(e,s,f,g,b,w){const r=o("el-option"),d=o("el-select");return n(),c("div",ke,[a("h2",be,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),c(S,null,C(e.options,l=>(n(),y(r,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ye=k(ve,[["render",we],["__scopeId","data-v-e476bacf"]]),Ve=v({name:"ModeSelector",components:{ElSelect:A,ElOption:G},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]}},computed:{value:{get(){return this.$store.state.kling?.config?.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=J)}}),Ee={class:"field"},Se={class:"title font-bold"};function Ie(e,s,f,g,b,w){const r=o("el-option"),d=o("el-select");return n(),c("div",Ee,[a("h2",Se,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),c(S,null,C(e.options,l=>(n(),y(r,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Te=k(Ve,[["render",Ie],["__scopeId","data-v-daa57765"]]),Le=v({name:"DurationSelector",components:{ElSelect:A,ElOption:G},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5秒"},{value:10,label:"10秒"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=Q)}}),Ce={class:"field"},Ue={class:"title font-bold"};function Re(e,s,f,g,b,w){const r=o("el-option"),d=o("el-select");return n(),c("div",Ce,[a("h2",Ue,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),c(S,null,C(e.options,l=>(n(),y(r,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Pe=k(Le,[["render",Re],["__scopeId","data-v-02112e2c"]]),Ge=v({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,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?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=W)}}),Ae={class:"text-sm font-bold mb-2 block"},De={class:"items"},je=["onClick"],Me={class:"name"};function Ne(e,s,f,g,b,w){return n(),c("div",null,[a("span",Ae,i(e.$t("kling.name.ratio")),1),a("div",De,[(n(!0),c(S,null,C(e.options,(r,d)=>(n(),c("div",{key:d,class:I({active:e.active===d,item:!0}),onClick:l=>e.value=r.value},[a("div",{class:I(["preview",r.label])},[a("div",{class:"rect",style:X({width:r.width+"px",height:r.height+"px"})},null,4)],2),a("p",Me,i(r.label),1)],10,je))),128))])])}const Oe=k(Ge,[["render",Ne],["__scopeId","data-v-2601284f"]]),Be=v({name:"StartImage",components:{ElUpload:B,ElButton:L,InfoIcon:U,FontAwesomeIcon:T,ImagePreview:O},emits:["change"],data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Fe={class:"relative"},ze={class:"flex justify-between"},qe={class:"flex justify-start items-center"},Ke={class:"text-sm font-bold"};function He(e,s,f,g,b,w){const r=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),_=o("el-button"),m=o("el-upload");return n(),c("div",Fe,[a("div",ze,[a("div",qe,[a("span",Ke,i(e.$t("kling.name.startImage")),1),t(r,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(m,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,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:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Je=k(Be,[["render",He],["__scopeId","data-v-e2205d5b"]]),Qe=v({name:"EndImage",components:{ElUpload:B,ElButton:L,ImagePreview:O,InfoIcon:U,FontAwesomeIcon:T},data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),We={class:"relative"},Xe={class:"flex justify-between"},Ye={class:"flex justify-start items-center"},Ze={class:"text-sm font-bold"};function xe(e,s,f,g,b,w){const r=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),_=o("el-button"),m=o("el-upload");return n(),c("div",We,[a("div",Xe,[a("div",Ye,[a("span",Ze,i(e.$t("kling.name.endImage")),1),t(r,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(m,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,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:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const et=k(Qe,[["render",xe],["__scopeId","data-v-caf87d80"]]),tt=v({name:"CfgScaleSelector",components:{ElSlider:ne,InfoIcon:U,ElInputNumber:se},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=Y)}}),ot={class:"flex justify-between"},st={class:"flex justify-start items-center"},nt={class:"text-sm font-bold"},lt={class:"flex justify-end items-center"},at={class:"w-full"};function it(e,s,f,g,b,w){const r=o("info-icon"),d=o("el-input-number"),l=o("el-slider");return n(),c("div",null,[a("div",ot,[a("div",st,[a("span",nt,i(e.$t("kling.name.cfgScale")),1),t(r,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),a("div",lt,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),a("div",at,[t(l,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=_=>e.value=_),min:0,max:1,step:.1},null,8,["modelValue"])])])}const rt=k(tt,[["render",it]]),ct="",dt=v({name:"PromptInput",components:{ElInput:F,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ct)}}),pt={class:"field"},ut={class:"box"},mt={class:"title font-bold"};function ft(e,s,f,g,b,w){const r=o("info-icon"),d=o("el-input");return n(),c("div",pt,[a("div",ut,[a("h2",mt,i(e.$t("kling.name.prompt")),1),t(r,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const gt=k(dt,[["render",ft],["__scopeId","data-v-0e95dea6"]]),_t="",ht=v({name:"NegativePromptInput",components:{ElInput:F,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=_t)}}),$t={class:"field"},vt={class:"box"},kt={class:"title font-bold"};function bt(e,s,f,g,b,w){const r=o("info-icon"),d=o("el-input");return n(),c("div",$t,[a("div",vt,[a("h2",kt,i(e.$t("kling.name.negativePrompt")),1),t(r,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const wt=k(ht,[["render",bt],["__scopeId","data-v-dfc5338b"]]),yt=v({name:"ConfigPanel",components:{ElButton:L,Consumption:te,FontAwesomeIcon:T,PromptInput:gt,NegativePromptInput:wt,ModelSelector:ye,ModeSelector:Te,DurationSelector:Pe,RatioSelector:Oe,StartImage:Je,CfgScaleSelector:rt,EndImage:et},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return le(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Vt={class:"flex flex-col h-full"},Et={class:"flex-1 overflow-y-auto p-[15px]"},St={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function It(e,s,f,g,b,w){const r=o("prompt-input"),d=o("model-selector"),l=o("ratio-selector"),_=o("start-image"),m=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),R=o("cfg-scale-selector"),z=o("negative-prompt-input"),q=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),c("div",Vt,[a("div",Et,[t(r,{class:"mb-4"}),t(d,{class:"mb-4"}),t(l,{class:"mb-4"}),t(_,{class:"mb-2"}),t(m,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(R,{class:"mb-4"}),t(z,{class:"mb-4"})]),a("div",St,[t(q,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(n(),y(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+i(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(n(),y(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const Tt=k(yt,[["render",It]]),Lt=v({name:"TaskPreview",components:{ElImage:de,CopyToClipboard:ae,FontAwesomeIcon:T,ElAlert:ce,VideoPlayer:ie,ElTooltip:re,ElButton:L},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Ct={class:"preview"},Ut={class:"left"},Rt={class:"main"},Pt={class:"bot"},Gt={class:"datetime"},At={class:"info"},Dt={key:0,class:"prompt mt-2"},jt={key:0},Mt={key:1},Nt={key:0,class:I({content:!0,failed:!0})},Ot={key:0,class:"mb-4"},Bt={key:1,class:I({operations:!0,"mt-2":!0})},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},qt={key:1,class:I({content:!0})},Kt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ht={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Jt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Qt={key:2,class:I({content:!0})},Wt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Xt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Yt(e,s,f,g,b,w){const r=o("el-image"),d=o("video-player"),l=o("el-button"),_=o("el-tooltip"),m=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),c("div",Ct,[a("div",Ut,[t(r,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),a("div",Rt,[a("div",Pt,[h(i(e.$t("kling.name.klingBot"))+" ",1),a("span",Gt,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",At,[e.modelValue?.request?.prompt?(n(),c("p",Dt,[h(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),c("span",jt," - ("+i(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(n(),c("span",Mt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),c("div",Nt,[e.modelValue?.response.video_url?(n(),c("div",Ot,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),c("div",Bt,[t(_,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(l,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=R=>e.onDownload(R,e.modelValue?.response.video_url))},{default:u(()=>[h(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[a("p",Ft,[t(m,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),a("p",zt,[t(m,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),c("div",qt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(m,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",Kt,[t(m,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),a("p",Ht,[t(m,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+i(e.$t("kling.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),c("p",Jt,[t(m,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),c("div",Qt,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(m,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",Wt,[t(m,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),c("p",Xt,[t(m,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Zt=k(Lt,[["render",Yt],["__scopeId","data-v-c0a171a2"]]),xt=v({name:"RecentPanel",components:{TaskPreview:Zt,NoTasks:oe,BotPlaceholder:pe,ScrollList:ee},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),eo={key:0},to={key:2,class:"w-full h-full flex items-center justify-center"};function oo(e,s,f,g,b,w){const r=o("bot-placeholder"),d=o("task-preview"),l=o("scroll-list"),_=o("no-tasks");return n(),c(S,null,[e.tasks?.items===void 0?(n(),c("div",eo,[t(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),y(l,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:s[0]||(s[0]=m=>e.$emit("reach-top"))},{default:u(()=>[(n(!0),c(S,null,C(e.tasks?.items,m=>(n(),y(d,{key:m.id,"model-value":m},null,8,["model-value"]))),128))]),_:1},8,["loading"])):$("",!0),e.tasks?.items?.length===0?(n(),c("div",to,[t(_)])):$("",!0)],64)}const so=k(xt,[["render",oo]]),no="https://webhook.acedata.cloud/kling",lo=v({name:"KlingIndex",components:{ConfigPanel:Tt,Layout:$e,RecentPanel:so},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===M.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===M.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){await ue({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:f,createdAtMax:g}=e||{};console.debug("limit",s,"createdAtMin",f,"createdAtMax",g),this.fetchingTasks=!0;try{await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:f,createdAtMax:g})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:no},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Z.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(f=>{f?.response?.data?.error?.code===x?V.error(this.$t("kling.message.usedUp")):V.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function ao(e,s,f,g,b,w){const r=o("config-panel"),d=o("recent-panel"),l=o("layout");return n(),y(l,null,{config:u(()=>[t(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Ho=k(lo,[["render",ao]]);export{Ho as default};
1
+ import{F as T}from"./index.es-Dw-ikv9u.js";import{E as L}from"./index-Ba60uEk-.js";import{E as K}from"./index-h2hg5mzg.js";import{d as v,h as k,b as c,t as a,k as t,r as P,j as u,l as o,o as n,eN as H,x as i,F as S,v as C,i as y,eO as J,eP as Q,eQ as W,n as I,f as X,cf as N,D as h,y as $,eR as Y,eS as Z,dN as x,dJ as M}from"./index-Cltw-TPy.js";import{E as G,a as A}from"./index-DU1Jn2Bq.js";import{I as U,S as ee}from"./ScrollList-BsWg1Oco.js";import{I as O}from"./ImagePreview-fjeQ_mXr.js";import{E as B}from"./index-DTitzyRz.js";import{E as V}from"./index-C7JbjCIG.js";import{C as te,N as oe}from"./NoTasks-Cxeor42D.js";import{E as se,a as ne}from"./index-CUr7KGdA.js";import{E as F}from"./index-BY87tdIk.js";import{a as le}from"./price-B71O9NlG.js";import{C as ae}from"./CopyToClipboard-B0sXY0gf.js";import{V as ie}from"./VideoPlayer-Bkc77RHA.js";import{E as re}from"./index-Bp5pMMj1.js";import{E as ce}from"./index-CHfsm--8.js";import{E as de}from"./index-Bk5nP9u2.js";import{B as pe}from"./BotPlaceholder-Bn7lEbyW.js";import{l as ue}from"./pagination-BA1VbgK9.js";import"./use-form-item-Be29d0-B.js";import"./index-r5W6hzzQ.js";import"./index-CpH9j3dB.js";import"./typescript-DOVFb1BD.js";import"./index-Daydyphg.js";import"./strings-CNKL_IWi.js";import"./castArray-CGkY3K20.js";import"./isEqual-CbOgjKmk.js";import"./_initCloneObject-CAySSrJV.js";import"./debounce-CguuKO1r.js";import"./_baseIteratee-C0prYj3x.js";import"./index-BjFSM9Qd.js";import"./index-RTh02r3m.js";import"./_baseClone-Bm9igNTj.js";import"./index-FtmKCcb9.js";import"./index-BhccfPia.js";import"./vue-plyr-QZFBikSk.js";import"./index-TO8m0FZI.js";const me=v({name:"LayoutKling",components:{ElDrawer:K,ElButton:L,FontAwesomeIcon:T},data(){return{drawer:!1}}}),fe={class:"main flex flex-row flex-1"},ge={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},_e={class:"result h-full p-[15px] flex-1 flex flex-col"};function he(e,s,f,g,b,w){const r=o("font-awesome-icon"),d=o("el-button"),l=o("el-drawer");return n(),c("div",fe,[a("div",ge,[P(e.$slots,"config",{},void 0,!0)]),a("div",_e,[P(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(r,{icon:"fa-solid fa-magic"})]),_:1}),t(l,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const $e=k(me,[["render",he],["__scopeId","data-v-fae64b48"]]),ve=v({name:"ModelSelector",components:{ElSelect:A,ElOption:G},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1-master",label:"v2.1-Master"},{value:"kling-v2-5-turbo",label:"v2.5-Turbo"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=H)}}),ke={class:"field"},be={class:"title font-bold"};function we(e,s,f,g,b,w){const r=o("el-option"),d=o("el-select");return n(),c("div",ke,[a("h2",be,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),c(S,null,C(e.options,l=>(n(),y(r,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ye=k(ve,[["render",we],["__scopeId","data-v-e476bacf"]]),Ve=v({name:"ModeSelector",components:{ElSelect:A,ElOption:G},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]}},computed:{value:{get(){return this.$store.state.kling?.config?.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=J)}}),Ee={class:"field"},Se={class:"title font-bold"};function Ie(e,s,f,g,b,w){const r=o("el-option"),d=o("el-select");return n(),c("div",Ee,[a("h2",Se,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),c(S,null,C(e.options,l=>(n(),y(r,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Te=k(Ve,[["render",Ie],["__scopeId","data-v-daa57765"]]),Le=v({name:"DurationSelector",components:{ElSelect:A,ElOption:G},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5秒"},{value:10,label:"10秒"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=Q)}}),Ce={class:"field"},Ue={class:"title font-bold"};function Re(e,s,f,g,b,w){const r=o("el-option"),d=o("el-select");return n(),c("div",Ce,[a("h2",Ue,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),c(S,null,C(e.options,l=>(n(),y(r,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Pe=k(Le,[["render",Re],["__scopeId","data-v-02112e2c"]]),Ge=v({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,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?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=W)}}),Ae={class:"text-sm font-bold mb-2 block"},De={class:"items"},je=["onClick"],Me={class:"name"};function Ne(e,s,f,g,b,w){return n(),c("div",null,[a("span",Ae,i(e.$t("kling.name.ratio")),1),a("div",De,[(n(!0),c(S,null,C(e.options,(r,d)=>(n(),c("div",{key:d,class:I({active:e.active===d,item:!0}),onClick:l=>e.value=r.value},[a("div",{class:I(["preview",r.label])},[a("div",{class:"rect",style:X({width:r.width+"px",height:r.height+"px"})},null,4)],2),a("p",Me,i(r.label),1)],10,je))),128))])])}const Oe=k(Ge,[["render",Ne],["__scopeId","data-v-2601284f"]]),Be=v({name:"StartImage",components:{ElUpload:B,ElButton:L,InfoIcon:U,FontAwesomeIcon:T,ImagePreview:O},emits:["change"],data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Fe={class:"relative"},ze={class:"flex justify-between"},qe={class:"flex justify-start items-center"},Ke={class:"text-sm font-bold"};function He(e,s,f,g,b,w){const r=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),_=o("el-button"),m=o("el-upload");return n(),c("div",Fe,[a("div",ze,[a("div",qe,[a("span",Ke,i(e.$t("kling.name.startImage")),1),t(r,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(m,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,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:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Je=k(Be,[["render",He],["__scopeId","data-v-e2205d5b"]]),Qe=v({name:"EndImage",components:{ElUpload:B,ElButton:L,ImagePreview:O,InfoIcon:U,FontAwesomeIcon:T},data(){return{fileList:[],uploadUrl:N()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),We={class:"relative"},Xe={class:"flex justify-between"},Ye={class:"flex justify-start items-center"},Ze={class:"text-sm font-bold"};function xe(e,s,f,g,b,w){const r=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),_=o("el-button"),m=o("el-upload");return n(),c("div",We,[a("div",Xe,[a("div",Ye,[a("span",Ze,i(e.$t("kling.name.endImage")),1),t(r,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(m,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,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:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const et=k(Qe,[["render",xe],["__scopeId","data-v-caf87d80"]]),tt=v({name:"CfgScaleSelector",components:{ElSlider:ne,InfoIcon:U,ElInputNumber:se},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=Y)}}),ot={class:"flex justify-between"},st={class:"flex justify-start items-center"},nt={class:"text-sm font-bold"},lt={class:"flex justify-end items-center"},at={class:"w-full"};function it(e,s,f,g,b,w){const r=o("info-icon"),d=o("el-input-number"),l=o("el-slider");return n(),c("div",null,[a("div",ot,[a("div",st,[a("span",nt,i(e.$t("kling.name.cfgScale")),1),t(r,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),a("div",lt,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),a("div",at,[t(l,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=_=>e.value=_),min:0,max:1,step:.1},null,8,["modelValue"])])])}const rt=k(tt,[["render",it]]),ct="",dt=v({name:"PromptInput",components:{ElInput:F,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=ct)}}),pt={class:"field"},ut={class:"box"},mt={class:"title font-bold"};function ft(e,s,f,g,b,w){const r=o("info-icon"),d=o("el-input");return n(),c("div",pt,[a("div",ut,[a("h2",mt,i(e.$t("kling.name.prompt")),1),t(r,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const gt=k(dt,[["render",ft],["__scopeId","data-v-0e95dea6"]]),_t="",ht=v({name:"NegativePromptInput",components:{ElInput:F,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=_t)}}),$t={class:"field"},vt={class:"box"},kt={class:"title font-bold"};function bt(e,s,f,g,b,w){const r=o("info-icon"),d=o("el-input");return n(),c("div",$t,[a("div",vt,[a("h2",kt,i(e.$t("kling.name.negativePrompt")),1),t(r,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const wt=k(ht,[["render",bt],["__scopeId","data-v-dfc5338b"]]),yt=v({name:"ConfigPanel",components:{ElButton:L,Consumption:te,FontAwesomeIcon:T,PromptInput:gt,NegativePromptInput:wt,ModelSelector:ye,ModeSelector:Te,DurationSelector:Pe,RatioSelector:Oe,StartImage:Je,CfgScaleSelector:rt,EndImage:et},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return le(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Vt={class:"flex flex-col h-full"},Et={class:"flex-1 overflow-y-auto p-[15px]"},St={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function It(e,s,f,g,b,w){const r=o("prompt-input"),d=o("model-selector"),l=o("ratio-selector"),_=o("start-image"),m=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),R=o("cfg-scale-selector"),z=o("negative-prompt-input"),q=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),c("div",Vt,[a("div",Et,[t(r,{class:"mb-4"}),t(d,{class:"mb-4"}),t(l,{class:"mb-4"}),t(_,{class:"mb-2"}),t(m,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(R,{class:"mb-4"}),t(z,{class:"mb-4"})]),a("div",St,[t(q,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(n(),y(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+i(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(n(),y(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const Tt=k(yt,[["render",It]]),Lt=v({name:"TaskPreview",components:{ElImage:de,CopyToClipboard:ae,FontAwesomeIcon:T,ElAlert:ce,VideoPlayer:ie,ElTooltip:re,ElButton:L},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Ct={class:"preview"},Ut={class:"left"},Rt={class:"main"},Pt={class:"bot"},Gt={class:"datetime"},At={class:"info"},Dt={key:0,class:"prompt mt-2"},jt={key:0},Mt={key:1},Nt={key:0,class:I({content:!0,failed:!0})},Ot={key:0,class:"mb-4"},Bt={key:1,class:I({operations:!0,"mt-2":!0})},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},qt={key:1,class:I({content:!0})},Kt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ht={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Jt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Qt={key:2,class:I({content:!0})},Wt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Xt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Yt(e,s,f,g,b,w){const r=o("el-image"),d=o("video-player"),l=o("el-button"),_=o("el-tooltip"),m=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),c("div",Ct,[a("div",Ut,[t(r,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),a("div",Rt,[a("div",Pt,[h(i(e.$t("kling.name.klingBot"))+" ",1),a("span",Gt,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",At,[e.modelValue?.request?.prompt?(n(),c("p",Dt,[h(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),c("span",jt," - ("+i(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(n(),c("span",Mt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),c("div",Nt,[e.modelValue?.response.video_url?(n(),c("div",Ot,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),c("div",Bt,[t(_,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(l,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=R=>e.onDownload(R,e.modelValue?.response.video_url))},{default:u(()=>[h(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[a("p",Ft,[t(m,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),a("p",zt,[t(m,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),c("div",qt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(m,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",Kt,[t(m,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),a("p",Ht,[t(m,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+i(e.$t("kling.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),c("p",Jt,[t(m,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),c("div",Qt,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(m,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",Wt,[t(m,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),c("p",Xt,[t(m,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Zt=k(Lt,[["render",Yt],["__scopeId","data-v-c0a171a2"]]),xt=v({name:"RecentPanel",components:{TaskPreview:Zt,NoTasks:oe,BotPlaceholder:pe,ScrollList:ee},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),eo={key:0},to={key:2,class:"w-full h-full flex items-center justify-center"};function oo(e,s,f,g,b,w){const r=o("bot-placeholder"),d=o("task-preview"),l=o("scroll-list"),_=o("no-tasks");return n(),c(S,null,[e.tasks?.items===void 0?(n(),c("div",eo,[t(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),y(l,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:s[0]||(s[0]=m=>e.$emit("reach-top"))},{default:u(()=>[(n(!0),c(S,null,C(e.tasks?.items,m=>(n(),y(d,{key:m.id,"model-value":m},null,8,["model-value"]))),128))]),_:1},8,["loading"])):$("",!0),e.tasks?.items?.length===0?(n(),c("div",to,[t(_)])):$("",!0)],64)}const so=k(xt,[["render",oo]]),no="https://webhook.acedata.cloud/kling",lo=v({name:"KlingIndex",components:{ConfigPanel:Tt,Layout:$e,RecentPanel:so},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===M.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===M.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){await ue({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:f,createdAtMax:g}=e||{};console.debug("limit",s,"createdAtMin",f,"createdAtMax",g),this.fetchingTasks=!0;try{await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:f,createdAtMax:g})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:no},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Z.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(f=>{f?.response?.data?.error?.code===x?V.error(this.$t("kling.message.usedUp")):V.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function ao(e,s,f,g,b,w){const r=o("config-panel"),d=o("recent-panel"),l=o("layout");return n(),y(l,null,{config:u(()=>[t(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Ho=k(lo,[["render",ao]]);export{Ho as default};