@acedatacloud/nexior 3.17.0 → 3.17.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.
- package/dist/assets/{Auth-BOyf0KUK.js → Auth-7LrIaRXX.js} +1 -1
- package/dist/assets/{BotPlaceholder-DLI4FHw7.js → BotPlaceholder-BVT46TAd.js} +1 -1
- package/dist/assets/{Callback-CfZSbFhQ.js → Callback-hABhRKIt.js} +1 -1
- package/dist/assets/{Console-f-tEsvV2.js → Console-8ND3fATq.js} +1 -1
- package/dist/assets/{Conversation-DdQtvYCm.js → Conversation-DE57lMgT.js} +2 -2
- package/dist/assets/{CopyToClipboard-dTRt17Kr.js → CopyToClipboard-UijJbsqJ.js} +1 -1
- package/dist/assets/{Detail-Dd4zICiT.js → Detail-8Ugy1eYF.js} +1 -1
- package/dist/assets/{EditArray-CxfYCs2l.js → EditArray-gm5t_Kz0.js} +1 -1
- package/dist/assets/{Extra-BDJHXOT4.js → Extra-CKR7SAc_.js} +1 -1
- package/dist/assets/{FilePreview-CrWNTrmN.js → FilePreview-Cdc19MKr.js} +1 -1
- package/dist/assets/{History-DxRtYYYe.js → History-DliNkRyl.js} +1 -1
- package/dist/assets/{ImagePreview-DV1WrQNh.js → ImagePreview-6EIbC_sR.js} +1 -1
- package/dist/assets/{ImageWrapper-BDxTSoQ7.js → ImageWrapper-fi7fasjx.js} +1 -1
- package/dist/assets/{Index-DoRTKRbk.js → Index-6hjuvHB8.js} +1 -1
- package/dist/assets/{Index-DhH_Hyi1.js → Index-BNo1miBD.js} +1 -1
- package/dist/assets/{Index-DtnCCz5o.js → Index-BfvqSRlg.js} +1 -1
- package/dist/assets/{Index-BmCu8slL.js → Index-BsCRjHo8.js} +1 -1
- package/dist/assets/{Index-BsHw6nn2.js → Index-C6i06Gmt.js} +1 -1
- package/dist/assets/{Index-CcfWRB15.js → Index-CC7s4u_Q.js} +1 -1
- package/dist/assets/Index-CNupoaje.js +1 -0
- package/dist/assets/{Index-3vx5D-V7.js → Index-CrGil6g0.js} +1 -1
- package/dist/assets/{Index-Bi5kUBP-.css → Index-CuveKqEU.css} +1 -1
- package/dist/assets/{Index-CElNZ-cy.js → Index-D14rIJOY.js} +1 -1
- package/dist/assets/{Index-BOskpYwm.js → Index-DIJCfRzw.js} +1 -1
- package/dist/assets/{Index-Dx1OzPHf.js → Index-DtOJNhKA.js} +1 -1
- package/dist/assets/{Index-CVy4MFuO.js → Index-DwJQGhU2.js} +1 -1
- package/dist/assets/{Index-9lJWmMdn.js → Index-Srfbm7-U.js} +1 -1
- package/dist/assets/{Index-BAKgeqiC.js → Index-i5itoYxe.js} +1 -1
- package/dist/assets/{InfoIcon-CR695ufA.js → InfoIcon-Xl69Q1MM.js} +1 -1
- package/dist/assets/{Invitees-C7ideZ_0.js → Invitees-DBy66OXl.js} +1 -1
- package/dist/assets/{List-CvWTVbrj.js → List-Bd073jPw.js} +1 -1
- package/dist/assets/{List-DScXjyY4.js → List-F2vQUMUP.js} +1 -1
- package/dist/assets/{List-CqhCJaVx.js → List-MTniuJeY.js} +1 -1
- package/dist/assets/{Login--kTnSJn-.js → Login-MW3GOqC9.js} +1 -1
- package/dist/assets/{Main-Cof4ZOB6.js → Main-0mcjc1zN.js} +1 -1
- package/dist/assets/Navigator-C7-4_HoX.js +1 -0
- package/dist/assets/{Navigator-DPaFseDr.css → Navigator-Ceq4Wad_.css} +1 -1
- package/dist/assets/{NoTasks-DPySH-qR.js → NoTasks-CE2VHR2V.js} +1 -1
- package/dist/assets/{Pagination-3rQ7JXeW.js → Pagination-Dj1BGjQp.js} +1 -1
- package/dist/assets/{Status-BC8c7-WE.js → Status-NJPGZDSw.js} +1 -1
- package/dist/assets/{Subscribe-DJjsckst.js → Subscribe-BgoU29ka.js} +1 -1
- package/dist/assets/{VideoPlayer-LYCV9MuE.js → VideoPlayer-DKkdcOyq.js} +1 -1
- package/dist/assets/{_Uint8Array-Bdooy9AK.js → _Uint8Array-CP8wtPEA.js} +1 -1
- package/dist/assets/{_baseClone-qufK5Sex.js → _baseClone-CoApr6-J.js} +1 -1
- package/dist/assets/{_baseIteratee-DZ2YvAcL.js → _baseIteratee-C5G35sz0.js} +1 -1
- package/dist/assets/{_initCloneObject-Bk5aFlNA.js → _initCloneObject-BA-9LMnp.js} +1 -1
- package/dist/assets/{castArray-Bfjgey1B.js → castArray-CDAve6Uh.js} +1 -1
- package/dist/assets/{debounce-znxeRhUH.js → debounce-1efl_mvL.js} +1 -1
- package/dist/assets/{distribution-B0ArTNTv.js → distribution-DPUYoKcb.js} +1 -1
- package/dist/assets/{dropdown-CXePO7wS.js → dropdown-BnhCaS_f.js} +1 -1
- package/dist/assets/{index-DchjM2DH.js → index--3Z-xHzh.js} +1 -1
- package/dist/assets/{index-nA-KAadb.js → index-BBQ_UUnS.js} +4 -4
- package/dist/assets/{index-CR5eH4ys.js → index-BGabSj17.js} +1 -1
- package/dist/assets/{index-BiH-ehNW.js → index-BMCjpD48.js} +1 -1
- package/dist/assets/{index-CB99gthx.js → index-BSDI4dFo.js} +1 -1
- package/dist/assets/{index-BmNvGNis.js → index-BTlX-Tfg.js} +1 -1
- package/dist/assets/{index-DIe9QyqZ.js → index-BapylglA.js} +1 -1
- package/dist/assets/{index-CKtAhY-s.js → index-BiNYa2x2.js} +1 -1
- package/dist/assets/{index-BbKd2na-.js → index-C3SYsYu_.js} +1 -1
- package/dist/assets/{index-CWL1zWCv.js → index-CM8ayRyw.js} +1 -1
- package/dist/assets/{index-BNeU4duQ.js → index-COT9fz42.js} +1 -1
- package/dist/assets/{index-CAn3RarN.js → index-CTEN31bH.js} +1 -1
- package/dist/assets/{index-ByuWOFZS.js → index-CdvQ8ZtS.js} +1 -1
- package/dist/assets/{index-Cr990IMl.js → index-Cr0sAHeI.js} +1 -1
- package/dist/assets/{index-3Ez9HcS_.js → index-CwMR5y3F.js} +1 -1
- package/dist/assets/{index-XCXDGhWV.js → index-CxoDu7WD.js} +1 -1
- package/dist/assets/{index-BunkSVlB.js → index-D7neHZ0I.js} +1 -1
- package/dist/assets/{index-Bn92fKGe.js → index-DDVvuE-e.js} +1 -1
- package/dist/assets/{index-Ci_9zUBa.js → index-DI3fGy7J.js} +1 -1
- package/dist/assets/{index-DZOe-iSx.js → index-DJVhLku9.js} +1 -1
- package/dist/assets/{index-C5fxjt4O.js → index-DMZoP9hn.js} +1 -1
- package/dist/assets/{index-CYhI27vG.js → index-DQZbejQA.js} +1 -1
- package/dist/assets/{index-DhsSA5Ku.js → index-DXtnUso3.js} +1 -1
- package/dist/assets/{index-K2-1oMVV.js → index-LbigwZMB.js} +1 -1
- package/dist/assets/{index-DieUsk35.js → index-a35IcFm1.js} +1 -1
- package/dist/assets/{index-C--_iHhn.js → index-aPXY01Tj.js} +1 -1
- package/dist/assets/{index-DrPuBcQd.js → index-bwlt2UVM.js} +1 -1
- package/dist/assets/{index-DwBHjA3D.js → index-g36qfLkk.js} +1 -1
- package/dist/assets/{index-CUBWoiru.js → index-uuDZo75T.js} +1 -1
- package/dist/assets/{index.es-BWmc-Ids.js → index.es-BxnzRC37.js} +1 -1
- package/dist/assets/{isEqual-BwZuGT6W.js → isEqual-BUS99vVF.js} +1 -1
- package/dist/assets/{isPlainObject-CVrnJwwT.js → isPlainObject-BVC9L144.js} +1 -1
- package/dist/assets/midjourney-DPAw3bi8.js +1 -0
- package/dist/assets/{order-CtrL1NTP.js → order-CxcKlnfR.js} +1 -1
- package/dist/assets/{price-CCwZcNw3.js → price-Cv9IK5ng.js} +1 -1
- package/dist/assets/{strings-B0sKE5ZU.js → strings-D6mb3ZVz.js} +1 -1
- package/dist/assets/{typescript-b8ZbHHzg.js → typescript-51mfcZRW.js} +1 -1
- package/dist/assets/{use-form-item-DUTsbuH3.js → use-form-item-CxqykdJA.js} +1 -1
- package/dist/assets/veo-3zKgxer5.js +1 -0
- package/dist/assets/veo-BI4g6x_1.js +1 -0
- package/dist/assets/veo-BR3H2R4F.js +1 -0
- package/dist/assets/veo-BXcltFVR.js +1 -0
- package/dist/assets/veo-BocIIMgA.js +1 -0
- package/dist/assets/veo-CVaSyNQn.js +1 -0
- package/dist/assets/veo-CZOVKp22.js +1 -0
- package/dist/assets/veo-CZqDkrPQ.js +1 -0
- package/dist/assets/veo-CZra50B-.js +1 -0
- package/dist/assets/veo-CbGSG0_a.js +1 -0
- package/dist/assets/veo-DDTWG0_-.js +1 -0
- package/dist/assets/veo-DU-VU18f.js +1 -0
- package/dist/assets/veo-D_Y5yWq9.js +1 -0
- package/dist/assets/veo-DhJcbz6F.js +1 -0
- package/dist/assets/veo-Ds3v9g7y.js +1 -0
- package/dist/assets/veo-K6G5xBEu.js +1 -0
- package/dist/assets/veo-RAvxcZeN.js +1 -0
- package/dist/assets/veo-a4_wVvTS.js +1 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/Index-Bg6aPqWI.js +0 -1
- package/dist/assets/Navigator-DOkEz1_T.js +0 -1
- package/dist/assets/midjourney-ClhQVRIK.js +0 -1
- package/dist/assets/veo-BAdFM5rx.js +0 -1
- package/dist/assets/veo-BFwiIe48.js +0 -1
- package/dist/assets/veo-BXaYgclf.js +0 -1
- package/dist/assets/veo-BbLI9GvB.js +0 -1
- package/dist/assets/veo-Bd8c0cZH.js +0 -1
- package/dist/assets/veo-CAqSBfJQ.js +0 -1
- package/dist/assets/veo-CDOAeF7t.js +0 -1
- package/dist/assets/veo-CFH9k3NO.js +0 -1
- package/dist/assets/veo-CJamipKx.js +0 -1
- package/dist/assets/veo-CNfDSPQ2.js +0 -1
- package/dist/assets/veo-CWA-468q.js +0 -1
- package/dist/assets/veo-CZXCPJiQ.js +0 -1
- package/dist/assets/veo-CaFb0TUk.js +0 -1
- package/dist/assets/veo-CgjflTg6.js +0 -1
- package/dist/assets/veo-DGmUHtSI.js +0 -1
- package/dist/assets/veo-DYtp0NV7.js +0 -1
- package/dist/assets/veo-LVcXNxc8.js +0 -1
- package/dist/assets/veo-pdDM2t7d.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as q}from"./index.es-BWmc-Ids.js";import{E as H}from"./index-ByuWOFZS.js";import{E as de}from"./index-DwBHjA3D.js";import{aj as pe,ap as me,bI as he,ak as ie,c9 as fe,_ as _e,d as C,a as $e,al as ve,c as V,bh as ge,bn as ke,aw as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b8 as le,E as R,n as ye,g as we,h as A,t as l,k as s,l as c,eL as se,x as v,F as z,v as N,eM as Y,c6 as be,D as T,eN as x,eO as ee,y,J as Z,cN as te,eP as O,dm as W,eQ as G,an as Ce,K as Se,eR as Le,de as Ae,dl as je}from"./index-nA-KAadb.js";import{E as re}from"./index-3Ez9HcS_.js";import{E as Ee,a as Ve}from"./index-DhsSA5Ku.js";import{I as D}from"./InfoIcon-CR695ufA.js";import{E as Ie}from"./index-Cr990IMl.js";import{E}from"./index-DIe9QyqZ.js";import{E as K}from"./index-CYhI27vG.js";import{E as Te,a as ce}from"./index-Ci_9zUBa.js";import{E as X}from"./index-CB99gthx.js";import{C as Pe,N as Fe}from"./NoTasks-DPySH-qR.js";import{a as Ue}from"./price-CCwZcNw3.js";import{E as ze,a as Me,b as Re}from"./index-BbKd2na-.js";import{E as Ge}from"./index-CAn3RarN.js";import{E as De}from"./index-C--_iHhn.js";import{a as Oe,E as We}from"./index-DchjM2DH.js";import{E as Be}from"./index-BmNvGNis.js";import"./use-form-item-DUTsbuH3.js";import"./index-r5W6hzzQ.js";import"./index-DZOe-iSx.js";import"./strings-B0sKE5ZU.js";import"./castArray-Bfjgey1B.js";import"./isEqual-BwZuGT6W.js";import"./_Uint8Array-Bdooy9AK.js";import"./typescript-b8ZbHHzg.js";import"./debounce-znxeRhUH.js";import"./_baseIteratee-DZ2YvAcL.js";import"./index-CWL1zWCv.js";import"./index-CR5eH4ys.js";import"./_baseClone-qufK5Sex.js";import"./_initCloneObject-Bk5aFlNA.js";import"./index-BiH-ehNW.js";import"./dropdown-CXePO7wS.js";const Ne=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),qe={error:e=>e instanceof Event},He=C({name:"ElAvatar"}),Ze=C({...He,props:Ne,emits:qe,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=V(()=>{const{size:n,icon:m,shape:k}=i,h=[o.b()];return ge(n)&&h.push(o.m(n)),m&&h.push(o.m("icon")),k&&h.push(o.m(k)),h}),u=V(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=V(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function f(n){r.value=!0,t("error",n)}return(n,m)=>(a(),_("span",{class:ye(L(d)),style:oe(L(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(L(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(L(R),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ke=_e(Ze,[["__file","avatar.vue"]]);const Xe=we(Ke),Je=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Qe={class:"main"},Ye={class:"config"},xe={class:"result"},et={class:"preview"};function tt(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Qe,[l("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),l("div",xe,[U(e.$slots,"result",{},void 0,!0)]),l("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-magic"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=A(Je,[["render",tt],["__scopeId","data-v-5859e958"]]),st=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:Ee,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",nt,[l("h2",it,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(f,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),_(z,null,N(e.options,n=>(a(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=A(st,[["render",at],["__scopeId","data-v-5a66a01f"]]),rt=C({name:"UploadAudio",components:{ElUpload:Ie,ElButton:H,InfoIcon:D,FontAwesomeIcon:q},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Y.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,r,d){const u=c("info-icon"),p=c("font-awesome-icon"),f=c("el-button"),n=c("el-upload");return a(),_("div",ct,[l("div",ut,[l("div",dt,[l("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),T(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ht=A(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ft="",_t=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},kt={class:"title font-bold"},yt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",$t,[l("div",vt,[l("div",gt,[l("h2",kt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",yt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(f,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=A(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",Lt=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),At={class:"field"},jt={class:"box"},Et={class:"title font-bold"};function Vt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",At,[l("div",jt,[l("h2",Et,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const It=A(Lt,[["render",Vt],["__scopeId","data-v-99dfded8"]]),Tt=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},Ft={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Pt,[l("div",Ft,[l("h2",Ut,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=f=>e.style=f),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Mt=A(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Rt=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Dt={class:"title-container"},Ot={class:"title font-bold"};function Wt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Gt,[l("div",Dt,[l("h2",Ot,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=f=>e.title=f),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Bt=A(Rt,[["render",Wt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Nt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:R,ElInputNumber:Te,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),qt={class:"field"},Ht={class:"box"},Zt={class:"title font-bold"},Kt={class:"input-wrapper"},Xt={class:"task"},Jt={class:"left"},Qt={key:2,class:"duration"},Yt={class:"info"},xt={class:"title"},eo={class:"style"};function to(e,t,i,o,r,d){const u=c("el-input-number"),p=c("el-image"),f=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=te("loading");return a(),_("div",qt,[l("div",Ht,[l("h2",Zt,v(e.$t("suno.name.extend")),1),l("div",Kt,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=h=>e.value=h),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",Xt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Jt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=h=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(f)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=h=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",Qt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Yt,[l("h2",xt,v(e.audio?.title),1),l("p",eo,v(e.audio?.style),1)])])):y("",!0)])])}const oo=A(Nt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:R,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function ho(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=te("loading");return a(),_("div",no,[l("div",io,[l("h2",ao,v(e.$t("suno.name.cover")),1)]),l("div",lo,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ro,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(f,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(f,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",uo,[l("h2",po,v(e.audio?.title),1),l("p",mo,v(e.audio?.style),1)])])):y("",!0)])])}const fo=A(so,[["render",ho],["__scopeId","data-v-06640216"]]),_o=C({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:It,StyleInput:Mt,TitleInput:Bt,ExtendFromInput:oo,CoverFromInput:fo,UploadAudio:ht,FontAwesomeIcon:q,ElButton:H,Consumption:Pe},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Ue(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ko(e,t,i,o,r,d){const u=c("type-selector"),p=c("upload-audio"),f=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),h=c("extend-from-input"),b=c("cover-from-input"),P=c("consumption"),I=c("font-awesome-icon"),j=c("el-button");return a(),_("div",$o,[l("div",vo,[s(u,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(f,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(h,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0)]),l("div",go,[s(P,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(a(),w(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=A(_o,[["render",ko],["__scopeId","data-v-b9fab929"]]);var B={exports:{}},wo=B.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var h=new XMLHttpRequest;h.open("GET",n),h.responseType="blob",h.onload=function(){f(h.response,m,k)},h.onerror=function(){console.error("could not download file")},h.send()}function r(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,p=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var h=u.URL||u.webkitURL,b=document.createElement("a");m=m||n.name||"download",b.download=m,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,m,k):d(b,b.target="_blank")):(b.href=h.createObjectURL(n),setTimeout(function(){h.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(r(n))o(n,m,k);else{var h=document.createElement("a");h.href=n,h.target="_blank",setTimeout(function(){d(h)})}}:function(n,m,k,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var b=n.type==="application/octet-stream",P=/constructor/i.test(u.HTMLElement)||u.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||b&&P||p)&&typeof FileReader<"u"){var j=new FileReader;j.onloadend=function(){var S=j.result;S=I?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},j.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);h?h.location=F:location.href=F,h=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=f.saveAs=f,e.exports=f})}(B)),B.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Lo=C({name:"TaskPreview",components:{ElImage:X,ElIcon:R,ElTooltip:Ge,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Re,ElDropdownMenu:Me,ElDropdownItem:ze},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{Co.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Ao={class:"task"},jo=["onClick"],Eo={class:"left"},Vo=["onClick"],Io=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Fo={class:"title"},Uo={class:"style"},zo={class:"right"},Mo={class:"el-dropdown-link"},Ro={class:"el-dropdown-link"};function Go(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),h=c("el-tooltip"),b=c("el-dropdown-item"),P=c("el-dropdown-menu"),I=c("el-dropdown"),j=te("loading");return a(),_("div",Ao,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Eo,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(f,null,{default:$(()=>[s(p)]),_:1})],8,Vo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(f,null,{default:$(()=>[s(n)]),_:1})],8,Io)):y("",!0),g?.duration?(a(),_("div",To,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[j,!g?.audio_url]]),l("div",Po,[l("h2",Fo,v(g?.title),1),l("p",Uo,v(g?.style),1)]),l("div",zo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[T(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(h,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[T(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[T(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Mo,[s(h,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[T(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[T(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[T(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Ro,[s(h,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,jo))),128))])}const Do=A(Lo,[["render",Go]]),Oo={class:"player-slider"},Wo=C({__name:"PlayerSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=V({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,p)=>(a(),_("div",Oo,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Bo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},qo=["src"],Ho={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ko={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=C({__name:"PlayerSong",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),_("div",No,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Bo)},null,8,qo),l("div",Ho,[l("div",Zo,[l("div",Ko,[l("span",null,v(i.value?.title||"Music"),1),l("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},xo=C({__name:"PlayerAction",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=V({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Qo,[l("span",Yo,v(L(M)(i.value))+" / "+v(L(M)(o.value)),1)]))}});var es={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 ts(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function os(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var ss=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=ts(),p=Ce(ss,es);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,P=d.spin,I=os(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),j=[p.prefix+"-icon"];return j.push(p.prefix+"-icon-"+e),t&&p.rtl&&j.push(p.prefix+"-icon-rtl"),P&&j.push(p.prefix+"-icon-spin"),s("span",{class:j.join(" ")},[i(I)])}}};return o}const ns=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),is=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),as=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Q=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ls={class:"player-volume flex flex-col items-center pt-2"},rs={class:"text-sm mt-3"},cs={class:"mt-2"},us=C({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=V({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,p)=>(a(),_("div",ls,[l("div",null,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",rs,v(i.value),1),l("div",cs,[s(Q,{icon:o.value?L(as):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=C({__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=V(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",ds,[s(Q,{icon:o.value?.state==="playing"?L(ns):L(is),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(De),{placement:"top",width:"50px"},{reference:$(()=>[s(Q,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},hs={class:"flex grow px-5 items-center"},fs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ms,[s(Wo),l("div",hs,[l("div",fs,[s(Jo)]),l("div",_s,[s(ps)]),l("div",$s,[s(xo)])])]))}}),gs=C({name:"RecentPanel",components:{TaskPreview:Do,ElSkeleton:We,ElSkeletonItem:Oe,Player:vs,NoTasks:Fe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),ks={key:0,class:"tasks"},ys={class:"left"},ws={class:"main"},bs={key:1,class:"tasks"},Cs={key:2,class:"w-full h-full flex items-center justify-center"},Ss={class:"flex-1 flex flex-col"},Ls={class:"h-20"};function As(e,t,i,o,r,d){const u=c("el-skeleton-item"),p=c("el-skeleton"),f=c("task-preview"),n=c("no-tasks"),m=c("player");return a(),_(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[e.tasks?.items===void 0?(a(),_("div",ks,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",ys,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ws,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),_("div",bs,[(a(!0),_(z,null,N(e.tasks?.items,(k,h)=>(a(),w(f,{key:h,"model-value":k,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),_("div",Cs,[s(n)])):y("",!0)],544),Z(l("div",Ss,[l("div",Ls,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const js=A(gs,[["render",As],["__scopeId","data-v-959f8920"]]),Es=C({name:"TaskPreview",components:{ElScrollbar:Be,IconPicture:Le,ElImage:X,ElAvatar:Xe,ElIcon:R},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Vs={key:0,class:"card"},Is={class:"image-container"},Ts={class:"image-slot"},Ps={class:"title"},Fs={class:"content"},Us={class:"artist"},zs={class:"style"},Ms={class:"time"},Rs={class:"lyrics"},Gs={key:1,class:"gradient-background"};function Ds(e,t,i,o,r,d){const u=c("icon-picture"),p=c("el-icon"),f=c("el-image"),n=c("el-avatar"),m=c("el-scrollbar");return a(),w(m,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),_("div",Vs,[l("div",Is,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Ts,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Ps,v(e.audio?.title),1)]),l("div",Fs,[l("div",Us,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",zs,v(e.audio?.style),1),l("p",Ms,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",Rs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Gs))]),_:1})}const Os=A(Es,[["render",Ds],["__scopeId","data-v-9b29e9f9"]]),Ws="https://webhook.acedata.cloud/suno",Bs=C({name:"SunoIndex",components:{Layout:ot,ConfigPanel:yo,RecentPanel:js,PreviewPanel:Os},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===W.Request},needApply(){return this.$store.state.suno.status.getApplications===W.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===je&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ws},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ns(e,t,i,o,r,d){const u=c("config-panel"),p=c("recent-panel"),f=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(f)]),_:1})}const An=A(Bs,[["render",Ns],["__scopeId","data-v-f5721d95"]]);export{An as default};
|
|
1
|
+
import{F as q}from"./index.es-BxnzRC37.js";import{E as H}from"./index-CdvQ8ZtS.js";import{E as de}from"./index-g36qfLkk.js";import{aj as pe,ap as me,bI as he,ak as ie,c9 as fe,_ as _e,d as C,a as $e,al as ve,c as V,bh as ge,bn as ke,aw as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b8 as le,E as R,n as ye,g as we,h as A,t as l,k as s,l as c,eL as se,x as v,F as z,v as N,eM as Y,c6 as be,D as T,eN as x,eO as ee,y,J as Z,cN as te,eP as O,dm as W,eQ as G,an as Ce,K as Se,eR as Le,de as Ae,dl as je}from"./index-BBQ_UUnS.js";import{E as re}from"./index-CwMR5y3F.js";import{E as Ee,a as Ve}from"./index-DXtnUso3.js";import{I as D}from"./InfoIcon-Xl69Q1MM.js";import{E as Ie}from"./index-Cr0sAHeI.js";import{E}from"./index-BapylglA.js";import{E as K}from"./index-DQZbejQA.js";import{E as Te,a as ce}from"./index-DI3fGy7J.js";import{E as X}from"./index-BSDI4dFo.js";import{C as Pe,N as Fe}from"./NoTasks-CE2VHR2V.js";import{a as Ue}from"./price-Cv9IK5ng.js";import{E as ze,a as Me,b as Re}from"./index-C3SYsYu_.js";import{E as Ge}from"./index-CTEN31bH.js";import{E as De}from"./index-aPXY01Tj.js";import{a as Oe,E as We}from"./index--3Z-xHzh.js";import{E as Be}from"./index-BTlX-Tfg.js";import"./use-form-item-CxqykdJA.js";import"./index-r5W6hzzQ.js";import"./index-DJVhLku9.js";import"./strings-D6mb3ZVz.js";import"./castArray-CDAve6Uh.js";import"./isEqual-BUS99vVF.js";import"./_Uint8Array-CP8wtPEA.js";import"./typescript-51mfcZRW.js";import"./debounce-1efl_mvL.js";import"./_baseIteratee-C5G35sz0.js";import"./index-CM8ayRyw.js";import"./index-BGabSj17.js";import"./_baseClone-CoApr6-J.js";import"./_initCloneObject-BA-9LMnp.js";import"./index-BMCjpD48.js";import"./dropdown-BnhCaS_f.js";const Ne=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),qe={error:e=>e instanceof Event},He=C({name:"ElAvatar"}),Ze=C({...He,props:Ne,emits:qe,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=V(()=>{const{size:n,icon:m,shape:k}=i,h=[o.b()];return ge(n)&&h.push(o.m(n)),m&&h.push(o.m("icon")),k&&h.push(o.m(k)),h}),u=V(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=V(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function f(n){r.value=!0,t("error",n)}return(n,m)=>(a(),_("span",{class:ye(L(d)),style:oe(L(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(L(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(L(R),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ke=_e(Ze,[["__file","avatar.vue"]]);const Xe=we(Ke),Je=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Qe={class:"main"},Ye={class:"config"},xe={class:"result"},et={class:"preview"};function tt(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Qe,[l("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),l("div",xe,[U(e.$slots,"result",{},void 0,!0)]),l("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-magic"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=A(Je,[["render",tt],["__scopeId","data-v-5859e958"]]),st=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:Ee,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",nt,[l("h2",it,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(f,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),_(z,null,N(e.options,n=>(a(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=A(st,[["render",at],["__scopeId","data-v-5a66a01f"]]),rt=C({name:"UploadAudio",components:{ElUpload:Ie,ElButton:H,InfoIcon:D,FontAwesomeIcon:q},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Y.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,r,d){const u=c("info-icon"),p=c("font-awesome-icon"),f=c("el-button"),n=c("el-upload");return a(),_("div",ct,[l("div",ut,[l("div",dt,[l("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),T(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ht=A(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ft="",_t=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},kt={class:"title font-bold"},yt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",$t,[l("div",vt,[l("div",gt,[l("h2",kt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",yt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(f,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=A(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",Lt=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),At={class:"field"},jt={class:"box"},Et={class:"title font-bold"};function Vt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",At,[l("div",jt,[l("h2",Et,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const It=A(Lt,[["render",Vt],["__scopeId","data-v-99dfded8"]]),Tt=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},Ft={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Pt,[l("div",Ft,[l("h2",Ut,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=f=>e.style=f),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Mt=A(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Rt=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Dt={class:"title-container"},Ot={class:"title font-bold"};function Wt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Gt,[l("div",Dt,[l("h2",Ot,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=f=>e.title=f),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Bt=A(Rt,[["render",Wt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Nt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:R,ElInputNumber:Te,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),qt={class:"field"},Ht={class:"box"},Zt={class:"title font-bold"},Kt={class:"input-wrapper"},Xt={class:"task"},Jt={class:"left"},Qt={key:2,class:"duration"},Yt={class:"info"},xt={class:"title"},eo={class:"style"};function to(e,t,i,o,r,d){const u=c("el-input-number"),p=c("el-image"),f=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=te("loading");return a(),_("div",qt,[l("div",Ht,[l("h2",Zt,v(e.$t("suno.name.extend")),1),l("div",Kt,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=h=>e.value=h),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",Xt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Jt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=h=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(f)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=h=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",Qt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Yt,[l("h2",xt,v(e.audio?.title),1),l("p",eo,v(e.audio?.style),1)])])):y("",!0)])])}const oo=A(Nt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:R,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function ho(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=te("loading");return a(),_("div",no,[l("div",io,[l("h2",ao,v(e.$t("suno.name.cover")),1)]),l("div",lo,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ro,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(f,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(f,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",uo,[l("h2",po,v(e.audio?.title),1),l("p",mo,v(e.audio?.style),1)])])):y("",!0)])])}const fo=A(so,[["render",ho],["__scopeId","data-v-06640216"]]),_o=C({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:It,StyleInput:Mt,TitleInput:Bt,ExtendFromInput:oo,CoverFromInput:fo,UploadAudio:ht,FontAwesomeIcon:q,ElButton:H,Consumption:Pe},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Ue(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ko(e,t,i,o,r,d){const u=c("type-selector"),p=c("upload-audio"),f=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),h=c("extend-from-input"),b=c("cover-from-input"),P=c("consumption"),I=c("font-awesome-icon"),j=c("el-button");return a(),_("div",$o,[l("div",vo,[s(u,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(f,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(h,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0)]),l("div",go,[s(P,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(a(),w(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(I,{icon:"fa-solid fa-magic",class:"mr-2"}),T(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=A(_o,[["render",ko],["__scopeId","data-v-b9fab929"]]);var B={exports:{}},wo=B.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var h=new XMLHttpRequest;h.open("GET",n),h.responseType="blob",h.onload=function(){f(h.response,m,k)},h.onerror=function(){console.error("could not download file")},h.send()}function r(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,p=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var h=u.URL||u.webkitURL,b=document.createElement("a");m=m||n.name||"download",b.download=m,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,m,k):d(b,b.target="_blank")):(b.href=h.createObjectURL(n),setTimeout(function(){h.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(r(n))o(n,m,k);else{var h=document.createElement("a");h.href=n,h.target="_blank",setTimeout(function(){d(h)})}}:function(n,m,k,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var b=n.type==="application/octet-stream",P=/constructor/i.test(u.HTMLElement)||u.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||b&&P||p)&&typeof FileReader<"u"){var j=new FileReader;j.onloadend=function(){var S=j.result;S=I?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},j.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);h?h.location=F:location.href=F,h=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=f.saveAs=f,e.exports=f})}(B)),B.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Lo=C({name:"TaskPreview",components:{ElImage:X,ElIcon:R,ElTooltip:Ge,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Re,ElDropdownMenu:Me,ElDropdownItem:ze},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{Co.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Ao={class:"task"},jo=["onClick"],Eo={class:"left"},Vo=["onClick"],Io=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Fo={class:"title"},Uo={class:"style"},zo={class:"right"},Mo={class:"el-dropdown-link"},Ro={class:"el-dropdown-link"};function Go(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),h=c("el-tooltip"),b=c("el-dropdown-item"),P=c("el-dropdown-menu"),I=c("el-dropdown"),j=te("loading");return a(),_("div",Ao,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Eo,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(f,null,{default:$(()=>[s(p)]),_:1})],8,Vo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(f,null,{default:$(()=>[s(n)]),_:1})],8,Io)):y("",!0),g?.duration?(a(),_("div",To,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[j,!g?.audio_url]]),l("div",Po,[l("h2",Fo,v(g?.title),1),l("p",Uo,v(g?.style),1)]),l("div",zo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[T(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(h,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[T(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[T(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Mo,[s(h,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(I,null,{dropdown:$(()=>[s(P,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[T(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[T(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[T(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Ro,[s(h,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,jo))),128))])}const Do=A(Lo,[["render",Go]]),Oo={class:"player-slider"},Wo=C({__name:"PlayerSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=V({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,p)=>(a(),_("div",Oo,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Bo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},qo=["src"],Ho={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ko={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=C({__name:"PlayerSong",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),_("div",No,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Bo)},null,8,qo),l("div",Ho,[l("div",Zo,[l("div",Ko,[l("span",null,v(i.value?.title||"Music"),1),l("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},xo=C({__name:"PlayerAction",setup(e){const t=G(),i=V({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=V({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Qo,[l("span",Yo,v(L(M)(i.value))+" / "+v(L(M)(o.value)),1)]))}});var es={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 ts(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function os(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var ss=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=ts(),p=Ce(ss,es);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,P=d.spin,I=os(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),j=[p.prefix+"-icon"];return j.push(p.prefix+"-icon-"+e),t&&p.rtl&&j.push(p.prefix+"-icon-rtl"),P&&j.push(p.prefix+"-icon-spin"),s("span",{class:j.join(" ")},[i(I)])}}};return o}const ns=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),is=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),as=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Q=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ls={class:"player-volume flex flex-col items-center pt-2"},rs={class:"text-sm mt-3"},cs={class:"mt-2"},us=C({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=V({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=V({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,p)=>(a(),_("div",ls,[l("div",null,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",rs,v(i.value),1),l("div",cs,[s(Q,{icon:o.value?L(as):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=C({__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=V(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",ds,[s(Q,{icon:o.value?.state==="playing"?L(ns):L(is),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(De),{placement:"top",width:"50px"},{reference:$(()=>[s(Q,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},hs={class:"flex grow px-5 items-center"},fs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ms,[s(Wo),l("div",hs,[l("div",fs,[s(Jo)]),l("div",_s,[s(ps)]),l("div",$s,[s(xo)])])]))}}),gs=C({name:"RecentPanel",components:{TaskPreview:Do,ElSkeleton:We,ElSkeletonItem:Oe,Player:vs,NoTasks:Fe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),ks={key:0,class:"tasks"},ys={class:"left"},ws={class:"main"},bs={key:1,class:"tasks"},Cs={key:2,class:"w-full h-full flex items-center justify-center"},Ss={class:"flex-1 flex flex-col"},Ls={class:"h-20"};function As(e,t,i,o,r,d){const u=c("el-skeleton-item"),p=c("el-skeleton"),f=c("task-preview"),n=c("no-tasks"),m=c("player");return a(),_(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[e.tasks?.items===void 0?(a(),_("div",ks,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",ys,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ws,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),_("div",bs,[(a(!0),_(z,null,N(e.tasks?.items,(k,h)=>(a(),w(f,{key:h,"model-value":k,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),_("div",Cs,[s(n)])):y("",!0)],544),Z(l("div",Ss,[l("div",Ls,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const js=A(gs,[["render",As],["__scopeId","data-v-959f8920"]]),Es=C({name:"TaskPreview",components:{ElScrollbar:Be,IconPicture:Le,ElImage:X,ElAvatar:Xe,ElIcon:R},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Vs={key:0,class:"card"},Is={class:"image-container"},Ts={class:"image-slot"},Ps={class:"title"},Fs={class:"content"},Us={class:"artist"},zs={class:"style"},Ms={class:"time"},Rs={class:"lyrics"},Gs={key:1,class:"gradient-background"};function Ds(e,t,i,o,r,d){const u=c("icon-picture"),p=c("el-icon"),f=c("el-image"),n=c("el-avatar"),m=c("el-scrollbar");return a(),w(m,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),_("div",Vs,[l("div",Is,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Ts,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Ps,v(e.audio?.title),1)]),l("div",Fs,[l("div",Us,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",zs,v(e.audio?.style),1),l("p",Ms,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",Rs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Gs))]),_:1})}const Os=A(Es,[["render",Ds],["__scopeId","data-v-9b29e9f9"]]),Ws="https://webhook.acedata.cloud/suno",Bs=C({name:"SunoIndex",components:{Layout:ot,ConfigPanel:yo,RecentPanel:js,PreviewPanel:Os},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===W.Request},needApply(){return this.$store.state.suno.status.getApplications===W.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===je&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ws},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Y.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ns(e,t,i,o,r,d){const u=c("config-panel"),p=c("recent-panel"),f=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(f)]),_:1})}const An=A(Bs,[["render",Ns],["__scopeId","data-v-f5721d95"]]);export{An as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.main[data-v-4d2fe7ef]{flex:1;display:flex;flex-direction:row}.main .config[data-v-4d2fe7ef]{width:300px;height:100%;overflow-y:scroll;border-right:1px solid var(--el-border-color)}.main .result[data-v-4d2fe7ef]{padding:15px;flex:1;width:calc(100% - 300px);height:100%;display:flex;flex-direction:column}.menu[data-v-4d2fe7ef]{display:none}@media (max-width: 767px){.config[data-v-4d2fe7ef]{display:none}.result[data-v-4d2fe7ef]{width:100%}.menu[data-v-4d2fe7ef]{display:block;position:fixed;left:15px;top:15px;z-index:2000;background-color:var(--el-color-black)}}.field[data-v-ef445fc5]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .title[data-v-ef445fc5]{font-size:14px;margin:0;width:30%}.field .value[data-v-ef445fc5]{width:120px}.field[data-v-
|
|
1
|
+
.main[data-v-4d2fe7ef]{flex:1;display:flex;flex-direction:row}.main .config[data-v-4d2fe7ef]{width:300px;height:100%;overflow-y:scroll;border-right:1px solid var(--el-border-color)}.main .result[data-v-4d2fe7ef]{padding:15px;flex:1;width:calc(100% - 300px);height:100%;display:flex;flex-direction:column}.menu[data-v-4d2fe7ef]{display:none}@media (max-width: 767px){.config[data-v-4d2fe7ef]{display:none}.result[data-v-4d2fe7ef]{width:100%}.menu[data-v-4d2fe7ef]{display:block;position:fixed;left:15px;top:15px;z-index:2000;background-color:var(--el-color-black)}}.field[data-v-ef445fc5]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .title[data-v-ef445fc5]{font-size:14px;margin:0;width:30%}.field .value[data-v-ef445fc5]{width:120px}.field[data-v-821be9a3]{display:flex;flex-direction:row;align-items:center}.field .title[data-v-821be9a3]{font-size:14px;margin:0;width:30%}.field .value[data-v-821be9a3]{flex:1}.title[data-v-43d971b7]{font-size:14px;margin-bottom:0;width:30%}.btn.btn-upload[data-v-43d971b7]{position:absolute;top:5px;right:0}.upload-wrapper{height:auto;display:flex}.upload-wrapper .el-upload-list{margin:0;width:100%}.field .box[data-v-9189572a]{display:flex;flex-direction:row;align-items:center;justify-content:space-between;position:relative}.field .box .title[data-v-9189572a]{font-size:14px;margin-bottom:10px}.field .info[data-v-9189572a]{margin-left:auto}.preview[data-v-5372c9d1]{width:100%;height:-moz-fit-content;height:fit-content;text-align:left;display:flex;flex-direction:row;margin-bottom:15px}.preview .left[data-v-5372c9d1]{width:70px}.preview .left .avatar[data-v-5372c9d1]{width:50px;height:50px;margin:10px;border-radius:50%}.preview .main[data-v-5372c9d1]{flex:1;width:calc(100% - 70px);padding:10px 10px 0}.preview .main .bot[data-v-5372c9d1]{font-size:16px;font-weight:700;color:#2ecc71;margin-bottom:0;margin-top:0}.preview .main .bot .datetime[data-v-5372c9d1]{font-size:12px;font-weight:400;color:var(--el-text-color-secondary);margin-left:10px}.preview .main .info .prompt[data-v-5372c9d1]{font-size:16px;font-weight:700;color:var(--el-text-color-regular);margin-bottom:10px}.preview .main .content .el-alert[data-v-5372c9d1]{border-left-width:2px;border-left-style:solid}.preview .main .content .el-alert.failure[data-v-5372c9d1]{border-color:var(--el-color-danger)}.preview .main .content .el-alert.success[data-v-5372c9d1]{border-color:var(--el-color-success)}.preview .main .content .el-alert.info[data-v-5372c9d1]{border-color:var(--el-color-info)}.preview .main .operations[data-v-5372c9d1]{display:flex;justify-content:left;flex-direction:row;width:100%;align-items:baseline;flex-wrap:wrap;overflow:hidden;text-align:center;color:var(--el-text-color-regular);font-size:14px;overflow-y:scroll}.preview .main .operations.full[data-v-5372c9d1]{height:70px}.preview .main .operations .btn-action[data-v-5372c9d1]{margin-bottom:10px}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as C}from"./index.es-BWmc-Ids.js";import{E as T}from"./index-ByuWOFZS.js";import{E as q}from"./index-DwBHjA3D.js";import{d as v,h as k,b as r,t as l,k as t,r as G,j as u,l as o,o as n,ep as K,x as i,F as I,v as L,i as y,eq as H,er as J,es as Q,n as S,f as W,c6 as M,D as h,y as $,et as X,eu as Y,dr as Z,dm as x}from"./index-nA-KAadb.js";import{E as R,a as P}from"./index-DhsSA5Ku.js";import{I as U}from"./InfoIcon-CR695ufA.js";import{I as N}from"./ImagePreview-DV1WrQNh.js";import{E as F}from"./index-Cr990IMl.js";import{E as V}from"./index-DIe9QyqZ.js";import{C as ee,N as te}from"./NoTasks-DPySH-qR.js";import{E as oe,a as se}from"./index-Ci_9zUBa.js";import{E as O}from"./index-CYhI27vG.js";import{a as ne}from"./price-CCwZcNw3.js";import{C as ae}from"./CopyToClipboard-dTRt17Kr.js";import{V as le}from"./VideoPlayer-LYCV9MuE.js";import{E as ie}from"./index-CAn3RarN.js";import{E as re}from"./index-K2-1oMVV.js";import{E as ce}from"./index-CB99gthx.js";import{B as de}from"./BotPlaceholder-DLI4FHw7.js";import"./use-form-item-DUTsbuH3.js";import"./index-r5W6hzzQ.js";import"./index-BmNvGNis.js";import"./typescript-b8ZbHHzg.js";import"./index-DZOe-iSx.js";import"./strings-B0sKE5ZU.js";import"./castArray-Bfjgey1B.js";import"./isEqual-BwZuGT6W.js";import"./_Uint8Array-Bdooy9AK.js";import"./debounce-znxeRhUH.js";import"./_baseIteratee-DZ2YvAcL.js";import"./index-CWL1zWCv.js";import"./index-CR5eH4ys.js";import"./_baseClone-qufK5Sex.js";import"./_initCloneObject-Bk5aFlNA.js";import"./index-BiH-ehNW.js";import"./vue-plyr-QZFBikSk.js";import"./index-DchjM2DH.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main"},me={class:"config"},fe={class:"result"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),a=o("el-drawer");return n(),r("div",ue,[l("div",me,[G(e.$slots,"config",{},void 0,!0)]),l("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{round:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=k(pe,[["render",ge],["__scopeId","data-v-ace3cd94"]]),he=v({name:"ModelSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-5",label:"v1.5"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1",label:"v2.1"},{value:"kling-v2-1-master",label:"v2.1-Master"}]}},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=K)}}),$e={class:"field"},ve={class:"title font-bold"};function ke(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",$e,[l("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ke],["__scopeId","data-v-4a40b66a"]]),we=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},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=H)}}),ye={class:"field"},Ve={class:"title font-bold"};function Ee(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ye,[l("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=k(we,[["render",Ee],["__scopeId","data-v-daa57765"]]),Se=v({name:"DurationSelector",components:{ElSelect:P,ElOption:R},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=J)}}),Ce={class:"field"},Te={class:"title font-bold"};function Le(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ce,[l("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Le],["__scopeId","data-v-02112e2c"]]),Ae=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=Q)}}),Ge={class:"text-sm font-bold mb-2 block"},Re={class:"items"},Pe=["onClick"],De={class:"name"};function je(e,s,m,f,b,w){return n(),r("div",null,[l("span",Ge,i(e.$t("kling.name.ratio")),1),l("div",Re,[(n(!0),r(I,null,L(e.options,(c,d)=>(n(),r("div",{key:d,class:S({active:e.active===d,item:!0}),onClick:a=>e.value=c.value},[l("div",{class:S(["preview",c.label])},[l("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",De,i(c.label),1)],10,Pe))),128))])])}const Me=k(Ae,[["render",je],["__scopeId","data-v-2601284f"]]),Ne=v({name:"StartImage",components:{ElUpload:F,ElButton:T,InfoIcon:U,FontAwesomeIcon:C,ImagePreview:N},emits:["change"],data(){return{fileList:[],uploadUrl:M()+"/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"},Oe={class:"flex justify-between"},Be={class:"flex justify-start items-center"},ze={class:"text-sm font-bold"};function qe(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),_=o("el-button"),g=o("el-upload");return n(),r("div",Fe,[l("div",Oe,[l("div",Be,[l("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(g,{"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(a,{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 Ke=k(Ne,[["render",qe],["__scopeId","data-v-e2205d5b"]]),He=v({name:"EndImage",components:{ElUpload:F,ElButton:T,ImagePreview:N,InfoIcon:U,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:M()+"/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()}}}),Je={class:"relative"},Qe={class:"flex justify-between"},We={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"};function Ye(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),_=o("el-button"),g=o("el-upload");return n(),r("div",Je,[l("div",Qe,[l("div",We,[l("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(g,{"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(a,{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 Ze=k(He,[["render",Ye],["__scopeId","data-v-caf87d80"]]),xe=v({name:"CfgScaleSelector",components:{ElSlider:se,InfoIcon:U,ElInputNumber:oe},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=X)}}),et={class:"flex justify-between"},tt={class:"flex justify-start items-center"},ot={class:"text-sm font-bold"},st={class:"flex justify-end items-center"},nt={class:"w-full"};function at(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),a=o("el-slider");return n(),r("div",null,[l("div",et,[l("div",tt,[l("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),l("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),l("div",nt,[t(a,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=_=>e.value=_),min:0,max:1,step:.1},null,8,["modelValue"])])])}const lt=k(xe,[["render",at]]),it="",rt=v({name:"PromptInput",components:{ElInput:O,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=it)}}),ct={class:"field"},dt={class:"box"},pt={class:"title font-bold"};function ut(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ct,[l("div",dt,[l("h2",pt,i(e.$t("kling.name.prompt")),1),t(c,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=a=>e.prompt=a),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const mt=k(rt,[["render",ut],["__scopeId","data-v-0e95dea6"]]),ft="",gt=v({name:"NegativePromptInput",components:{ElInput:O,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=ft)}}),_t={class:"field"},ht={class:"box"},$t={class:"title font-bold"};function vt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",_t,[l("div",ht,[l("h2",$t,i(e.$t("kling.name.negativePrompt")),1),t(c,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=a=>e.prompt=a),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const kt=k(gt,[["render",vt],["__scopeId","data-v-dfc5338b"]]),bt=v({name:"ConfigPanel",components:{ElButton:T,Consumption:ee,FontAwesomeIcon:C,PromptInput:mt,NegativePromptInput:kt,ModelSelector:be,ModeSelector:Ie,DurationSelector:Ue,RatioSelector:Me,StartImage:Ke,CfgScaleSelector:lt,EndImage:Ze},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return ne(this.config,this.service?.metadata?.price)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),wt={class:"flex flex-col h-full"},yt={class:"flex-1 overflow-y-auto p-[15px]"},Vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Et(e,s,m,f,b,w){const c=o("prompt-input"),d=o("model-selector"),a=o("ratio-selector"),_=o("start-image"),g=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),z=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",wt,[l("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(a,{class:"mb-4"}),t(_,{class:"mb-2"}),t(g,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),l("div",Vt,[t(z,{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 It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:ce,CopyToClipboard:ae,FontAwesomeIcon:C,ElAlert:re,VideoPlayer:le,ElTooltip:ie,ElButton:T},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"},Tt={class:"left"},Lt={class:"main"},Ut={class:"bot"},At={class:"datetime"},Gt={class:"info"},Rt={key:0,class:"prompt mt-2"},Pt={key:0},Dt={key:1},jt={key:0,class:S({content:!0,failed:!0})},Mt={key:0,class:"mb-4"},Nt={key:1,class:S({operations:!0,"mt-2":!0})},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Bt={key:1,class:S({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Kt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ht={key:2,class:S({content:!0})},Jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Wt(e,s,m,f,b,w){const c=o("el-image"),d=o("video-player"),a=o("el-button"),_=o("el-tooltip"),g=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[l("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),l("div",Lt,[l("div",Ut,[h(i(e.$t("kling.name.klingBot"))+" ",1),l("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[h(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",Pt," - ("+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(),r("span",Dt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",jt,[e.modelValue?.response.video_url?(n(),r("div",Mt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Nt,[t(_,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(a,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,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(()=>[l("p",Ft,[t(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),l("p",Ot,[t(g,{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(),r("div",Bt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",zt,[t(g,{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"])]),l("p",qt,[t(g,{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(),r("p",Kt,[t(g,{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(),r("div",Ht,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",Jt,[t(g,{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(),r("p",Qt,[t(g,{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 Xt=k(St,[["render",Wt],["__scopeId","data-v-c0a171a2"]]),Yt=v({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:te,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Zt={key:0},xt={key:1,class:"h-full w-full overflow-y-auto"},eo={key:2,class:"w-full h-full flex items-center justify-center"};function to(e,s,m,f,b,w){const c=o("bot-placeholder"),d=o("task-preview"),a=o("no-tasks");return n(),r(I,null,[e.tasks?.items===void 0?(n(),r("div",Zt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",xt,[(n(!0),r(I,null,L(e.tasks?.items,(_,g)=>(n(),y(d,{key:g,"model-value":_},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(a)])):$("",!0)],64)}const oo=k(Yt,[["render",to]]),so="https://webhook.acedata.cloud/kling",no=v({name:"KlingIndex",components:{ConfigPanel:It,Layout:_e,RecentPanel:oo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===x.Request},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(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},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(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:f}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",f),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:m,createdAtMax:f})},async onGenerate(){const e={...this.config,callback_url:so},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Y.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Z?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)})}}});function ao(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),a=o("layout");return n(),y(a,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const qo=k(no,[["render",ao]]);export{qo as default};
|
|
1
|
+
import{F as C}from"./index.es-BxnzRC37.js";import{E as T}from"./index-CdvQ8ZtS.js";import{E as q}from"./index-g36qfLkk.js";import{d as v,h as k,b as r,t as l,k as t,r as G,j as u,l as o,o as n,ep as K,x as i,F as I,v as L,i as y,eq as H,er as J,es as Q,n as S,f as W,c6 as M,D as h,y as $,et as X,eu as Y,dr as Z,dm as x}from"./index-BBQ_UUnS.js";import{E as R,a as P}from"./index-DXtnUso3.js";import{I as U}from"./InfoIcon-Xl69Q1MM.js";import{I as N}from"./ImagePreview-6EIbC_sR.js";import{E as F}from"./index-Cr0sAHeI.js";import{E as V}from"./index-BapylglA.js";import{C as ee,N as te}from"./NoTasks-CE2VHR2V.js";import{E as oe,a as se}from"./index-DI3fGy7J.js";import{E as O}from"./index-DQZbejQA.js";import{a as ne}from"./price-Cv9IK5ng.js";import{C as ae}from"./CopyToClipboard-UijJbsqJ.js";import{V as le}from"./VideoPlayer-DKkdcOyq.js";import{E as ie}from"./index-CTEN31bH.js";import{E as re}from"./index-LbigwZMB.js";import{E as ce}from"./index-BSDI4dFo.js";import{B as de}from"./BotPlaceholder-BVT46TAd.js";import"./use-form-item-CxqykdJA.js";import"./index-r5W6hzzQ.js";import"./index-BTlX-Tfg.js";import"./typescript-51mfcZRW.js";import"./index-DJVhLku9.js";import"./strings-D6mb3ZVz.js";import"./castArray-CDAve6Uh.js";import"./isEqual-BUS99vVF.js";import"./_Uint8Array-CP8wtPEA.js";import"./debounce-1efl_mvL.js";import"./_baseIteratee-C5G35sz0.js";import"./index-CM8ayRyw.js";import"./index-BGabSj17.js";import"./_baseClone-CoApr6-J.js";import"./_initCloneObject-BA-9LMnp.js";import"./index-BMCjpD48.js";import"./vue-plyr-QZFBikSk.js";import"./index--3Z-xHzh.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main"},me={class:"config"},fe={class:"result"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),a=o("el-drawer");return n(),r("div",ue,[l("div",me,[G(e.$slots,"config",{},void 0,!0)]),l("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{round:"",class:"menu",onClick:s[0]||(s[0]=_=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=k(pe,[["render",ge],["__scopeId","data-v-ace3cd94"]]),he=v({name:"ModelSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-5",label:"v1.5"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1",label:"v2.1"},{value:"kling-v2-1-master",label:"v2.1-Master"}]}},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=K)}}),$e={class:"field"},ve={class:"title font-bold"};function ke(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",$e,[l("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ke],["__scopeId","data-v-4a40b66a"]]),we=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},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=H)}}),ye={class:"field"},Ve={class:"title font-bold"};function Ee(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ye,[l("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=k(we,[["render",Ee],["__scopeId","data-v-daa57765"]]),Se=v({name:"DurationSelector",components:{ElSelect:P,ElOption:R},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=J)}}),Ce={class:"field"},Te={class:"title font-bold"};function Le(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ce,[l("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Le],["__scopeId","data-v-02112e2c"]]),Ae=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=Q)}}),Ge={class:"text-sm font-bold mb-2 block"},Re={class:"items"},Pe=["onClick"],De={class:"name"};function je(e,s,m,f,b,w){return n(),r("div",null,[l("span",Ge,i(e.$t("kling.name.ratio")),1),l("div",Re,[(n(!0),r(I,null,L(e.options,(c,d)=>(n(),r("div",{key:d,class:S({active:e.active===d,item:!0}),onClick:a=>e.value=c.value},[l("div",{class:S(["preview",c.label])},[l("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",De,i(c.label),1)],10,Pe))),128))])])}const Me=k(Ae,[["render",je],["__scopeId","data-v-2601284f"]]),Ne=v({name:"StartImage",components:{ElUpload:F,ElButton:T,InfoIcon:U,FontAwesomeIcon:C,ImagePreview:N},emits:["change"],data(){return{fileList:[],uploadUrl:M()+"/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"},Oe={class:"flex justify-between"},Be={class:"flex justify-start items-center"},ze={class:"text-sm font-bold"};function qe(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),_=o("el-button"),g=o("el-upload");return n(),r("div",Fe,[l("div",Oe,[l("div",Be,[l("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(g,{"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(a,{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 Ke=k(Ne,[["render",qe],["__scopeId","data-v-e2205d5b"]]),He=v({name:"EndImage",components:{ElUpload:F,ElButton:T,ImagePreview:N,InfoIcon:U,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:M()+"/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()}}}),Je={class:"relative"},Qe={class:"flex justify-between"},We={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"};function Ye(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),a=o("font-awesome-icon"),_=o("el-button"),g=o("el-upload");return n(),r("div",Je,[l("div",Qe,[l("div",We,[l("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(g,{"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(a,{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 Ze=k(He,[["render",Ye],["__scopeId","data-v-caf87d80"]]),xe=v({name:"CfgScaleSelector",components:{ElSlider:se,InfoIcon:U,ElInputNumber:oe},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=X)}}),et={class:"flex justify-between"},tt={class:"flex justify-start items-center"},ot={class:"text-sm font-bold"},st={class:"flex justify-end items-center"},nt={class:"w-full"};function at(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),a=o("el-slider");return n(),r("div",null,[l("div",et,[l("div",tt,[l("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),l("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=_=>e.value=_),"controls-position":"right"},null,8,["modelValue"])])]),l("div",nt,[t(a,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=_=>e.value=_),min:0,max:1,step:.1},null,8,["modelValue"])])])}const lt=k(xe,[["render",at]]),it="",rt=v({name:"PromptInput",components:{ElInput:O,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=it)}}),ct={class:"field"},dt={class:"box"},pt={class:"title font-bold"};function ut(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ct,[l("div",dt,[l("h2",pt,i(e.$t("kling.name.prompt")),1),t(c,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=a=>e.prompt=a),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const mt=k(rt,[["render",ut],["__scopeId","data-v-0e95dea6"]]),ft="",gt=v({name:"NegativePromptInput",components:{ElInput:O,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=ft)}}),_t={class:"field"},ht={class:"box"},$t={class:"title font-bold"};function vt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",_t,[l("div",ht,[l("h2",$t,i(e.$t("kling.name.negativePrompt")),1),t(c,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=a=>e.prompt=a),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const kt=k(gt,[["render",vt],["__scopeId","data-v-dfc5338b"]]),bt=v({name:"ConfigPanel",components:{ElButton:T,Consumption:ee,FontAwesomeIcon:C,PromptInput:mt,NegativePromptInput:kt,ModelSelector:be,ModeSelector:Ie,DurationSelector:Ue,RatioSelector:Me,StartImage:Ke,CfgScaleSelector:lt,EndImage:Ze},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return ne(this.config,this.service?.metadata?.price)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),wt={class:"flex flex-col h-full"},yt={class:"flex-1 overflow-y-auto p-[15px]"},Vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Et(e,s,m,f,b,w){const c=o("prompt-input"),d=o("model-selector"),a=o("ratio-selector"),_=o("start-image"),g=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),z=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",wt,[l("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(a,{class:"mb-4"}),t(_,{class:"mb-2"}),t(g,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),l("div",Vt,[t(z,{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 It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:ce,CopyToClipboard:ae,FontAwesomeIcon:C,ElAlert:re,VideoPlayer:le,ElTooltip:ie,ElButton:T},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"},Tt={class:"left"},Lt={class:"main"},Ut={class:"bot"},At={class:"datetime"},Gt={class:"info"},Rt={key:0,class:"prompt mt-2"},Pt={key:0},Dt={key:1},jt={key:0,class:S({content:!0,failed:!0})},Mt={key:0,class:"mb-4"},Nt={key:1,class:S({operations:!0,"mt-2":!0})},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Bt={key:1,class:S({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Kt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ht={key:2,class:S({content:!0})},Jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Wt(e,s,m,f,b,w){const c=o("el-image"),d=o("video-player"),a=o("el-button"),_=o("el-tooltip"),g=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[l("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),l("div",Lt,[l("div",Ut,[h(i(e.$t("kling.name.klingBot"))+" ",1),l("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[h(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",Pt," - ("+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(),r("span",Dt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",jt,[e.modelValue?.response.video_url?(n(),r("div",Mt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Nt,[t(_,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(a,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,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(()=>[l("p",Ft,[t(g,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),l("p",Ot,[t(g,{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(),r("div",Bt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",zt,[t(g,{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"])]),l("p",qt,[t(g,{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(),r("p",Kt,[t(g,{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(),r("div",Ht,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(g,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[l("p",Jt,[t(g,{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(),r("p",Qt,[t(g,{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 Xt=k(St,[["render",Wt],["__scopeId","data-v-c0a171a2"]]),Yt=v({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:te,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Zt={key:0},xt={key:1,class:"h-full w-full overflow-y-auto"},eo={key:2,class:"w-full h-full flex items-center justify-center"};function to(e,s,m,f,b,w){const c=o("bot-placeholder"),d=o("task-preview"),a=o("no-tasks");return n(),r(I,null,[e.tasks?.items===void 0?(n(),r("div",Zt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",xt,[(n(!0),r(I,null,L(e.tasks?.items,(_,g)=>(n(),y(d,{key:g,"model-value":_},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(a)])):$("",!0)],64)}const oo=k(Yt,[["render",to]]),so="https://webhook.acedata.cloud/kling",no=v({name:"KlingIndex",components:{ConfigPanel:It,Layout:_e,RecentPanel:oo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===x.Request},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(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},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(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:f}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",f),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:m,createdAtMax:f})},async onGenerate(){const e={...this.config,callback_url:so},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Y.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Z?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)})}}});function ao(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),a=o("layout");return n(),y(a,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const qo=k(no,[["render",ao]]);export{qo as default};
|