@acedatacloud/nexior 3.18.4 → 3.18.5
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-DoNWrMIn.js → Auth-Duvpfexr.js} +1 -1
- package/dist/assets/{Callback-qfe2A1Cl.js → Callback-Cb2CSgs1.js} +1 -1
- package/dist/assets/{Console-D2B4s5xu.js → Console-DPd5nJQ6.js} +1 -1
- package/dist/assets/{Conversation-CCk14M4O.js → Conversation-CZ6CkO76.js} +2 -2
- package/dist/assets/{CopyToClipboard-CWTGukXW.js → CopyToClipboard-RknI4LM3.js} +1 -1
- package/dist/assets/{Detail-LhkHY7I6.js → Detail-BfRjUWYa.js} +1 -1
- package/dist/assets/{EditArray-Dj4DJOxY.js → EditArray-DqKEu71Y.js} +1 -1
- package/dist/assets/{Extra-BoPHaCrX.js → Extra-Cs_Ma2Mw.js} +1 -1
- package/dist/assets/{FilePreview-QU_0fuqr.js → FilePreview-D0-PWvO0.js} +1 -1
- package/dist/assets/{History-D8wHzT81.js → History-xjK6Z4vN.js} +1 -1
- package/dist/assets/{ImagePreview-B6H-c819.js → ImagePreview-TfSPkY4U.js} +1 -1
- package/dist/assets/{ImageWrapper-BjZhDlGd.js → ImageWrapper-Clo9Sn7r.js} +1 -1
- package/dist/assets/{Index-Cc8GQVTf.js → Index-BLnc2ujJ.js} +1 -1
- package/dist/assets/{Index-SUmwCSBi.js → Index-BVgISA1_.js} +1 -1
- package/dist/assets/{Index-CwEULQmd.js → Index-BpZ5e9uu.js} +1 -1
- package/dist/assets/{Index-D-laTBWt.js → Index-BujiG4ye.js} +1 -1
- package/dist/assets/{Index-Dv3emySX.js → Index-CRVLW8Rz.js} +1 -1
- package/dist/assets/{Index-C60NNo-n.js → Index-CZKcMgt4.js} +1 -1
- package/dist/assets/{Index-CRn2hnXr.js → Index-D9A7f8cq.js} +1 -1
- package/dist/assets/{Index-DwiTjnKq.js → Index-D9g9sYNT.js} +1 -1
- package/dist/assets/{Index-DWEr3dQ5.js → Index-DRfg8BG9.js} +1 -1
- package/dist/assets/{Index-DoPVqoe7.js → Index-DX38myeD.js} +1 -1
- package/dist/assets/{Index-D5kseYoP.js → Index-DlskCX9F.js} +1 -1
- package/dist/assets/{Index-ydTvLji1.js → Index-DxNWg66E.js} +1 -1
- package/dist/assets/{Index-DazoOsEe.js → Index-Dym5ulon.js} +1 -1
- package/dist/assets/{Index-D10t6YBv.js → Index-c3LJz0E-.js} +1 -1
- package/dist/assets/{InfoIcon-B_7NXzqM.js → InfoIcon-A1xDvxpg.js} +1 -1
- package/dist/assets/{Invitees-Dwf5jf5R.js → Invitees-99jEJQ1p.js} +1 -1
- package/dist/assets/{List-a_yXYN9K.js → List-BSLNdDsT.js} +1 -1
- package/dist/assets/{List-C8fER6VI.js → List-Dr9BZ1FU.js} +1 -1
- package/dist/assets/{List-DcH0a8aW.js → List-T1IZ-72o.js} +1 -1
- package/dist/assets/{Login-CQj2rq-d.js → Login-B6h-oco1.js} +1 -1
- package/dist/assets/{Main-Ck_4o8yN.js → Main-BYLLCBpR.js} +1 -1
- package/dist/assets/{Navigator-3PzSmz6k.js → Navigator-B5ifBSsu.js} +1 -1
- package/dist/assets/{NoTasks-XPY3isSt.js → NoTasks-Cdp8T7aA.js} +1 -1
- package/dist/assets/{Pagination-D6MS_uJo.js → Pagination-jZo6ton8.js} +1 -1
- package/dist/assets/{Status-CywhmmtI.js → Status-DTw3gKLP.js} +1 -1
- package/dist/assets/{Subscribe-dWvG_tL3.js → Subscribe-CuRG2X0f.js} +1 -1
- package/dist/assets/{VideoPlayer-B4vYbQji.js → VideoPlayer-bQ9vkI39.js} +1 -1
- package/dist/assets/{_baseClone-BeP5In-D.js → _baseClone-CSJOYRf5.js} +1 -1
- package/dist/assets/{_baseIteratee-Gayx4zPC.js → _baseIteratee-EXwBHC6D.js} +1 -1
- package/dist/assets/{_initCloneObject-Hx3XrS5v.js → _initCloneObject-BcH86D07.js} +1 -1
- package/dist/assets/{castArray-BFNMyvNy.js → castArray-DMPMSVhG.js} +1 -1
- package/dist/assets/{debounce-uq4Y0tBJ.js → debounce--4Ey-UiG.js} +1 -1
- package/dist/assets/{distribution-DsfLzv1o.js → distribution-CRIdn9R_.js} +1 -1
- package/dist/assets/{dropdown-K7N91EB1.js → dropdown-e5HICCuH.js} +1 -1
- package/dist/assets/{index-DNAKdnzC.js → index-6-cLyr4W.js} +1 -1
- package/dist/assets/{index-1hGPlp5P.js → index-BOWgmkBj.js} +1 -1
- package/dist/assets/{index-C9fMP4wC.js → index-BQq3lXfU.js} +1 -1
- package/dist/assets/{index-C6-YAIfm.js → index-BT7WrUPB.js} +1 -1
- package/dist/assets/{index-6eG4Alfo.js → index-BTalZB4F.js} +1 -1
- package/dist/assets/{index-D5q2zvKq.js → index-BUJDKI34.js} +1 -1
- package/dist/assets/{index-DsJzwtEG.js → index-BdcqrZwU.js} +1 -1
- package/dist/assets/{index-Da4hcGYx.js → index-Bg5mlWRY.js} +1 -1
- package/dist/assets/{index-2jAF6ZPA.js → index-BgUK6CFV.js} +1 -1
- package/dist/assets/{index-CzWlUUuG.js → index-Bt9N_pkq.js} +1 -1
- package/dist/assets/{index-DwST9-YB.js → index-C-wmX7EI.js} +1 -1
- package/dist/assets/{index-Kp6849pw.js → index-C1ao7hiD.js} +1 -1
- package/dist/assets/{index-HvkIh69g.js → index-C_tipjVA.js} +1 -1
- package/dist/assets/{index-DLOV623W.js → index-CeFYRj3z.js} +1 -1
- package/dist/assets/{index-Bp_hO4E0.js → index-Cgvi9qKr.js} +4 -4
- package/dist/assets/{index-Bc2xTmqI.js → index-CvSpx81L.js} +1 -1
- package/dist/assets/{index-BWb1p7aO.js → index-D2hwZIWA.js} +1 -1
- package/dist/assets/{index-BJYfdB7L.js → index-D402UB4e.js} +1 -1
- package/dist/assets/{index-RaOl9MLo.js → index-DG1ztSVj.js} +1 -1
- package/dist/assets/{index-De26v3kc.js → index-DNgFozYk.js} +1 -1
- package/dist/assets/{index-By0I6dZ-.js → index-DTCoUzbs.js} +1 -1
- package/dist/assets/{index-B9ydRjkI.js → index-Df5a9WGp.js} +1 -1
- package/dist/assets/{index-ADnAfaIo.js → index-Dr1yWI9s.js} +1 -1
- package/dist/assets/{index-Badrs_Tv.js → index-Gj7AGill.js} +1 -1
- package/dist/assets/{index-IIDcIl8W.js → index-GjQsR5KG.js} +1 -1
- package/dist/assets/{index-DJHmsgYy.js → index-I8eUQ22m.js} +1 -1
- package/dist/assets/{index-CU0-t0AD.js → index-VD3Emf8V.js} +1 -1
- package/dist/assets/{index-Dd5KxKjr.js → index-qGVWSNsj.js} +1 -1
- package/dist/assets/{index-D0XQbOYS.js → index-spFFY5P2.js} +1 -1
- package/dist/assets/{index.es-DuwM2xpS.js → index.es-CIc56cl6.js} +1 -1
- package/dist/assets/{isEqual-CXl2hOES.js → isEqual-CNVV21LA.js} +1 -1
- package/dist/assets/{isPlainObject-pD7JBCci.js → isPlainObject-CBF1AW8-.js} +1 -1
- package/dist/assets/{order-Bjjw7v-S.js → order-hEvneraR.js} +1 -1
- package/dist/assets/{price-Dyx4MeTf.js → price-JcCbdpjd.js} +1 -1
- package/dist/assets/{strings-Dqqb4Qff.js → strings-CaFLJNhw.js} +1 -1
- package/dist/assets/{typescript-BpY75mvT.js → typescript-BJQTyG9d.js} +1 -1
- package/dist/assets/{use-form-item-C7v6lxI-.js → use-form-item-tWhUsWWY.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as H}from"./index.es-DuwM2xpS.js";import{E as K}from"./index-Dd5KxKjr.js";import{E as de}from"./index-BWb1p7aO.js";import{aj as pe,ap as me,bI as he,ak as ae,c9 as fe,_ as _e,d as b,a as $e,al as ge,c as F,bh as ve,bn as ye,aw as le,b as f,o as l,i as w,r as U,f as oe,e as V,j as g,b8 as re,E as R,n as ke,g as we,h as E,t as r,k as n,l as c,eP as se,x as $,F as N,v as Q,eQ as q,c6 as be,D as I,eR as Y,eS as x,y as k,J as Z,cN as ee,eT as O,bR as Ce,dm as B,ah as P,eU as D,an as Se,K as Ae,eV as Le,de as Ee,dl as Ve}from"./index-Bp_hO4E0.js";import{E as ce}from"./index-IIDcIl8W.js";import{E as je,a as Fe}from"./index-By0I6dZ-.js";import{I as G}from"./InfoIcon-B_7NXzqM.js";import{E as Te}from"./index-Bc2xTmqI.js";import{E as L}from"./index-C6-YAIfm.js";import{E as X}from"./index-BJYfdB7L.js";import{E as Pe,a as ue}from"./index-CzWlUUuG.js";import{E as J}from"./index-CU0-t0AD.js";import{C as Ie,N as Ue,B as ze}from"./NoTasks-XPY3isSt.js";import{a as Re}from"./price-Dyx4MeTf.js";import{E as De,a as Ge,b as Me}from"./index-C9fMP4wC.js";import{E as Oe}from"./index-Badrs_Tv.js";import{E as Be}from"./index-Kp6849pw.js";import"./use-form-item-C7v6lxI-.js";import"./index-r5W6hzzQ.js";import"./index-6eG4Alfo.js";import"./index-DJHmsgYy.js";import"./typescript-BpY75mvT.js";import"./strings-Dqqb4Qff.js";import"./castArray-BFNMyvNy.js";import"./isEqual-CXl2hOES.js";import"./_initCloneObject-Hx3XrS5v.js";import"./debounce-uq4Y0tBJ.js";import"./_baseIteratee-Gayx4zPC.js";import"./index-Da4hcGYx.js";import"./index-DwST9-YB.js";import"./_baseClone-BeP5In-D.js";import"./index-DsJzwtEG.js";import"./index-1hGPlp5P.js";import"./dropdown-K7N91EB1.js";const We=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ae(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"}}),Ne={error:e=>e instanceof Event},qe=b({name:"ElAvatar"}),He=b({...qe,props:We,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ge(!1),u=F(()=>{const{size:s,icon:p,shape:y}=i,_=[o.b()];return ve(s)&&_.push(o.m(s)),p&&_.push(o.m("icon")),y&&_.push(o.m(y)),_}),d=F(()=>{const{size:s}=i;return ae(s)?o.cssVarBlock({size:ye(s)||""}):void 0}),m=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function h(s){a.value=!0,t("error",s)}return(s,p)=>(l(),f("span",{class:ke(V(u)),style:oe(V(d))},[(s.src||s.srcSet)&&!a.value?(l(),f("img",{key:0,src:s.src,alt:s.alt,srcset:s.srcSet,style:oe(V(m)),onError:h},null,44,["src","alt","srcset"])):s.icon?(l(),w(V(R),{key:1},{default:g(()=>[(l(),w(re(s.icon)))]),_:1})):U(s.$slots,"default",{key:2})],6))}});var Ke=_e(He,[["__file","avatar.vue"]]);const Ze=we(Ke),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:K,FontAwesomeIcon:H},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main"},Qe={class:"config"},Ye={class:"result"},xe={class:"preview"};function et(e,t,i,o,a,u){const d=c("font-awesome-icon"),m=c("el-button"),h=c("el-drawer");return l(),f("div",Je,[r("div",Qe,[U(e.$slots,"config",{},void 0,!0)]),r("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),r("div",xe,[U(e.$slots,"preview",{},void 0,!0)]),n(m,{circle:"",class:"menu",onClick:t[0]||(t[0]=s=>e.drawer=!0)},{default:g(()=>[n(d,{icon:"fa-solid fa-magic"})]),_:1}),n(h,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=s=>e.drawer=s),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:g(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const tt=E(Xe,[["render",et],["__scopeId","data-v-c954d282"]]),ot=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},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)}}),st={class:"field"},nt={class:"title font-bold"};function it(e,t,i,o,a,u){const d=c("el-switch"),m=c("el-option"),h=c("el-select");return l(),f("div",st,[r("h2",nt,$(e.$t("suno.name.type")),1),n(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=s=>e.custom=s),class:"value"},null,8,["modelValue"]),n(h,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=s=>e.model=s),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:g(()=>[(l(!0),f(N,null,Q(e.options,s=>(l(),w(m,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const at=E(ot,[["render",it],["__scopeId","data-v-5a66a01f"]]),lt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:K,InfoIcon:G,FontAwesomeIcon:H},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),q.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),rt={class:"relative"},ct={class:"flex justify-between"},ut={class:"flex justify-start items-center"},dt={class:"text-sm font-bold"};function pt(e,t,i,o,a,u){const d=c("info-icon"),m=c("font-awesome-icon"),h=c("el-button"),s=c("el-upload");return l(),f("div",rt,[r("div",ct,[r("div",ut,[r("span",dt,$(e.$t("suno.name.referenceAudios")),1),n(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),n(s,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=p=>e.fileList=p),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:g(()=>[n(h,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:g(()=>[n(m,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+$(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const mt=E(lt,[["render",pt],["__scopeId","data-v-6236152c"]]),ht="",ft=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:G},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),_t={class:"field"},$t={class:"box"},gt={class:"title-info"},vt={class:"title font-bold"},yt={class:"instrumental"},kt={class:"title inline-block"};function wt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-switch"),h=c("el-input");return l(),f("div",_t,[r("div",$t,[r("div",gt,[r("h2",vt,$(e.$t("suno.name.prompt")),1),n(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",yt,[n(m,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=s=>e.instrumental=s),class:"value mr-2"},null,8,["modelValue"]),r("h2",kt,$(e.$t("suno.name.instrumental")),1)])]),n(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=s=>e.prompt=s),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const bt=E(ft,[["render",wt],["__scopeId","data-v-d7004a7c"]]),Ct="",St=b({name:"LyricInput",components:{ElInput:X,InfoIcon:G},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=Ct)}}),At={class:"field"},Lt={class:"box"},Et={class:"title font-bold"};function Vt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",At,[r("div",Lt,[r("h2",Et,$(e.$t("suno.name.lyrics")),1),n(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(m,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(m,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const jt=E(St,[["render",Vt],["__scopeId","data-v-99dfded8"]]),Ft=b({name:"StyleInput",components:{ElInput:X,InfoIcon:G},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}}}),Tt={class:"field"},Pt={class:"title-container"},It={class:"titlefont-bold"};function Ut(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",Tt,[r("div",Pt,[r("h2",It,$(e.$t("suno.name.style")),1),n(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),n(m,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=h=>e.style=h),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const zt=E(Ft,[["render",Ut],["__scopeId","data-v-85bbfcaa"]]),Rt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:G},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})}}}}),Dt={class:"field"},Gt={class:"title-container"},Mt={class:"title font-bold"};function Ot(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",Dt,[r("div",Gt,[r("h2",Mt,$(e.$t("suno.name.title")),1),n(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),n(m,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=h=>e.title=h),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Bt=E(Rt,[["render",Ot],["__scopeId","data-v-ce70fe34"]]);function z(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const Wt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:R,ElInputNumber:Pe,VideoPlay:x,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Nt={class:"field"},qt={class:"box"},Ht={class:"title font-bold"},Kt={class:"input-wrapper"},Zt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Qt={class:"info"},Yt={class:"title"},xt={class:"style"};function eo(e,t,i,o,a,u){const d=c("el-input-number"),m=c("el-image"),h=c("video-pause"),s=c("el-icon"),p=c("video-play"),y=ee("loading");return l(),f("div",Nt,[r("div",qt,[r("h2",Ht,$(e.$t("suno.name.extend")),1),r("div",Kt,[n(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=_=>e.value=_),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",Zt,[e.audio?(l(),f("div",{key:0,class:"audio",onClick:t[3]||(t[3]=_=>e.onClick(e.audio))},[Z((l(),f("div",Xt,[n(m,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=_=>e.onPause(e.audio))},[n(s,null,{default:g(()=>[n(h)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=_=>e.onPlay(e.audio))},[n(s,null,{default:g(()=>[n(p)]),_:1})])):k("",!0),e.audio?.duration?(l(),f("div",Jt,$(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[y,!e.audio?.audio_url]]),r("div",Qt,[r("h2",Yt,$(e.audio?.title),1),r("p",xt,$(e.audio?.style),1)])])):k("",!0)])])}const to=E(Wt,[["render",eo],["__scopeId","data-v-bcce4821"]]),oo=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:R,VideoPlay:x,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,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})}}}),so={class:"field"},no={class:"box"},io={class:"title font-bold"},ao={class:"task"},lo={class:"left"},ro={key:2,class:"duration"},co={class:"info"},uo={class:"title"},po={class:"style"};function mo(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),s=c("video-play"),p=ee("loading");return l(),f("div",so,[r("div",no,[r("h2",io,$(e.$t("suno.name.cover")),1)]),r("div",ao,[e.audio?(l(),f("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[Z((l(),f("div",lo,[n(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[n(h,null,{default:g(()=>[n(m)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[n(h,null,{default:g(()=>[n(s)]),_:1})])):k("",!0),e.audio?.duration?(l(),f("div",ro,$(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[p,!e.audio?.audio_url]]),r("div",co,[r("h2",uo,$(e.audio?.title),1),r("p",po,$(e.audio?.style),1)])])):k("",!0)])])}const ho=E(oo,[["render",mo],["__scopeId","data-v-06640216"]]),fo=b({name:"PresetPanel",components:{TypeSelector:at,PromptInput:bt,LyricInput:jt,StyleInput:zt,TitleInput:Bt,ExtendFromInput:to,CoverFromInput:ho,UploadAudio:mt,FontAwesomeIcon:H,ElButton:K,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Re(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"},$o={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function vo(e,t,i,o,a,u){const d=c("type-selector"),m=c("upload-audio"),h=c("prompt-input"),s=c("lyric-input"),p=c("style-input"),y=c("title-input"),_=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),f("div",_o,[r("div",$o,[n(d,{class:"mb-4"}),n(m,{class:"mb-4"}),e.config?.custom?k("",!0):(l(),w(h,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(s,{key:1,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(p,{key:2,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(y,{key:3,class:"mb-4"})):k("",!0),e.config?.action==="extend"?(l(),w(_,{key:4,class:"mb-4"})):k("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):k("",!0)]),r("div",go,[n(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[n(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[n(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=E(fo,[["render",vo],["__scopeId","data-v-b9fab929"]]);var W={exports:{}},ko=W.exports,ne;function wo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(ko,function(){function i(s,p){return typeof p>"u"?p={autoBom:!1}:typeof p!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),p={autoBom:!p}),p.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(s.type)?new Blob(["\uFEFF",s],{type:s.type}):s}function o(s,p,y){var _=new XMLHttpRequest;_.open("GET",s),_.responseType="blob",_.onload=function(){h(_.response,p,y)},_.onerror=function(){console.error("could not download file")},_.send()}function a(s){var p=new XMLHttpRequest;p.open("HEAD",s,!1);try{p.send()}catch{}return 200<=p.status&&299>=p.status}function u(s){try{s.dispatchEvent(new MouseEvent("click"))}catch{var p=document.createEvent("MouseEvents");p.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),s.dispatchEvent(p)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,m=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(s,p,y){var _=d.URL||d.webkitURL,C=document.createElement("a");p=p||s.name||"download",C.download=p,C.rel="noopener",typeof s=="string"?(C.href=s,C.origin===location.origin?u(C):a(C.href)?o(s,p,y):u(C,C.target="_blank")):(C.href=_.createObjectURL(s),setTimeout(function(){_.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(s,p,y){if(p=p||s.name||"download",typeof s!="string")navigator.msSaveOrOpenBlob(i(s,y),p);else if(a(s))o(s,p,y);else{var _=document.createElement("a");_.href=s,_.target="_blank",setTimeout(function(){u(_)})}}:function(s,p,y,_){if(_=_||open("","_blank"),_&&(_.document.title=_.document.body.innerText="downloading..."),typeof s=="string")return o(s,p,y);var C=s.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||m)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),_?_.location.href=S:location=S,_=null},A.readAsDataURL(s)}else{var M=d.URL||d.webkitURL,v=M.createObjectURL(s);_?_.location=v:location.href=v,_=null,setTimeout(function(){M.revokeObjectURL(v)},4e4)}});d.saveAs=h.saveAs=h,e.exports=h})}(W)),W.exports}var bo=wo();const Co="https://webhook.acedata.cloud/suno",So=b({name:"TaskPreview",components:{ElImage:J,ElIcon:R,ElTooltip:Oe,ElButton:K,FontAwesomeIcon:H,VideoPlay:x,VideoPause:Y,ElDropdown:Me,ElDropdownMenu:Ge,ElDropdownItem:De,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:z,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{bo.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}q.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:Co},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),q.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Ao={class:"task"},Lo=["onClick"],Eo={class:"left"},Vo=["onClick"],jo=["onClick"],Fo={key:2,class:"duration"},To={class:"info"},Po={class:"title"},Io={class:"style"},Uo={class:"right"},zo={class:"el-dropdown-link"},Ro={class:"flex items-center min-w-[120px]"},Do={class:"el-dropdown-link"};function Go(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),s=c("video-play"),p=c("el-button"),y=c("font-awesome-icon"),_=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),M=ee("loading");return l(),f("div",Ao,[(l(!0),f(N,null,Q(e.audios,v=>(l(),f("div",{key:v.id,class:"audio",onClick:P(S=>e.onClick(v),["stop"])},[Z((l(),f("div",Eo,[n(d,{src:v?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),v?.audio_url&&e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(v),["stop"])},[n(h,null,{default:g(()=>[n(m)]),_:1})],8,Vo)):k("",!0),v?.audio_url&&(e.$store.state?.suno?.audio?.id!==v.id||e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(v),["stop"])},[n(h,null,{default:g(()=>[n(s)]),_:1})],8,jo)):k("",!0),v?.duration?(l(),f("div",Fo,$(e.useFormatDuring(v?.duration)),1)):k("",!0)])),[[M,!v?.audio_url]]),r("div",To,[r("h2",Po,$(v?.title),1),r("p",Io,$(v?.style),1)]),r("div",Uo,[v?.audio_url?(l(),w(p,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):k("",!0),n(A,null,{dropdown:g(()=>[n(T,null,{default:g(()=>[n(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(v)},{default:g(()=>[r("div",Ro,[e.isFetchingVideoUrl?(l(),w(h,{key:0,class:"is-loading mr-2"},{default:g(()=>[n(C)]),_:1})):k("",!0),r("span",null,$(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),v?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,v?.audio_url),["stop"])},{default:g(()=>[I($(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:g(()=>[r("span",zo,[n(_,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024),n(A,null,{dropdown:g(()=>[n(T,null,{default:g(()=>[v.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(v.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):k("",!0),n(j,{onClick:P(S=>e.onCover(v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),v?.id&&v?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(v?.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:g(()=>[r("span",Do,[n(_,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Lo))),128))])}const Mo=E(So,[["render",Go]]),Oo={class:"player-slider"},Bo=b({__name:"PlayerSlider",setup(e){const t=D(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,m)=>(l(),f("div",Oo,[n(V(ue),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=h=>i.value=h),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),Wo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},qo=["src"],Ho={class:"ml-2 text-xs flex flex-col justify-between"},Ko={class:"w-52 2xl:w-96 cursor-pointer truncate"},Zo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=D(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),f("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(Wo)},null,8,qo),r("div",Ho,[r("div",Ko,[r("div",Zo,[r("span",null,$(i.value?.title||"Music"),1),r("span",Xo,"- "+$(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},xo=b({__name:"PlayerAction",setup(e){const t=D(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),f("div",Qo,[r("span",Yo,$(V(z)(i.value))+" / "+$(V(z)(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||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var ss=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=ts(),m=Se(ss,es);return function(){var h=u.size,s=u.strokeWidth,p=u.strokeLinecap,y=u.strokeLinejoin,_=u.theme,C=u.fill,j=u.spin,T=os(d,{size:h,strokeWidth:s,strokeLinecap:p,strokeLinejoin:y,theme:_,fill:C},m),A=[m.prefix+"-icon"];return A.push(m.prefix+"-icon-"+e),t&&m.rtl&&A.push(m.prefix+"-icon-rtl"),j&&A.push(m.prefix+"-icon-spin"),n("span",{class:A.join(" ")},[i(T)])}}};return o}const ns=te("pause-one",!1,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),n("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),is=te("play",!0,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("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=te("volume-small",!0,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ls={class:"player-volume flex flex-col items-center pt-2"},rs={class:"text-sm mt-3"},cs=b({__name:"PlayerVolumeSlider",setup(e){const t=D(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),f("div",ls,[n(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=m=>i.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",rs,$(i.value),1)]))}}),us={class:"flex items-center justify-center gap-x-3"},ds=b({__name:"PlayerController",setup(e){const t=D(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),f("div",us,[n(ie,{icon:o.value?.state==="playing"?V(ns):V(is),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),n(V(Be),{placement:"top",width:"50px",trigger:"click"},{reference:g(()=>[n(ie,{icon:V(as),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:g(()=>[n(cs)]),_:1})]))}}),ps={class:"flex flex-col items-stretch h-20"},ms={class:"flex grow px-5 items-center"},hs={class:"flex-1"},fs={class:"flex-1"},_s={class:"flex-1"},$s=b({__name:"Player",setup(e){return(t,i)=>(l(),f("div",ps,[n(Bo),r("div",ms,[r("div",hs,[n(Jo)]),r("div",fs,[n(ds)]),r("div",_s,[n(xo)])])]))}}),gs=b({name:"RecentPanel",components:{BotPlaceholder:ze,TaskPreview:Mo,Player:$s,NoTasks:Ue},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),vs={key:0,class:"tasks"},ys={key:2,class:"w-full flex-1 flex items-center justify-center"},ks={class:"h-20"};function ws(e,t,i,o,a,u){const d=c("bot-placeholder"),m=c("task-preview"),h=c("no-tasks"),s=c("player");return l(),f(N,null,[e.tasks?.items===void 0?(l(),f("div",vs,[n(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),f("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...p)=>e.onHandleScroll&&e.onHandleScroll(...p))},[(l(!0),f(N,null,Q(e.tasks?.items,(p,y)=>(l(),w(m,{key:y,"model-value":p,class:"preview"},null,8,["model-value"]))),128))],32)):k("",!0),e.tasks?.items?.length===0?(l(),f("div",ys,[n(h)])):k("",!0),Z(r("div",ks,[n(s)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const bs=E(gs,[["render",ws]]),Cs=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:Ze,ElIcon:R},computed:{audio(){return this.$store.state.suno?.audio}}}),Ss={key:0,class:"size-full overflow-hidden"},As={class:"relative h-[300px]"},Ls={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Es={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Vs={class:"p-4"},js={class:"flex items-center font-bold mb-2"},Fs={class:"text-[var(--el-text-color-regular)] mb-2"},Ts={class:"text-xs text-[var(--el-text-color-regular)]"},Ps={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Is={key:1,class:"w-full h-full bg-gradient-to-b from-gray-200 to-gray-300"};function Us(e,t,i,o,a,u){const d=c("icon-picture"),m=c("el-icon"),h=c("el-image"),s=c("el-avatar");return e.audio?.object?(l(),f("div",Ss,[r("div",As,[n(h,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:g(()=>[r("div",Ls,[n(m,{class:"text-3xl"},{default:g(()=>[n(d)]),_:1})])]),_:1},8,["src"]),r("h2",Es,$(e.audio?.title),1)]),r("div",Vs,[r("div",js,[n(s,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,$(e.audio?.title),1)]),r("p",Fs,$(e.audio?.style),1),r("p",Ts,$(e.$dayjs.format(e.audio?.created_at)),1),r("div",Ps,[r("p",null,$(e.audio?.lyric),1)])])])):(l(),f("div",Is))}const zs=E(Cs,[["render",Us]]),Rs="https://webhook.acedata.cloud/suno",Ds=b({name:"SunoIndex",components:{Layout:tt,ConfigPanel:yo,RecentPanel:bs,PreviewPanel:zs},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===B.Request},needApply(){return this.$store.state.suno.status.getApplications===B.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Rs},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),q.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Gs(e,t,i,o,a,u){const d=c("config-panel"),m=c("recent-panel"),h=c("preview-panel"),s=c("layout");return l(),w(s,null,{config:g(()=>[n(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:g(()=>[n(m,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:g(()=>[n(h)]),_:1})}const kn=E(Ds,[["render",Gs],["__scopeId","data-v-f5721d95"]]);export{kn as default};
|
|
1
|
+
import{F as H}from"./index.es-CIc56cl6.js";import{E as K}from"./index-qGVWSNsj.js";import{E as de}from"./index-D2hwZIWA.js";import{aj as pe,ap as me,bI as he,ak as ae,c9 as fe,_ as _e,d as b,a as $e,al as ge,c as F,bh as ve,bn as ye,aw as le,b as f,o as l,i as w,r as U,f as oe,e as V,j as g,b8 as re,E as R,n as ke,g as we,h as E,t as r,k as n,l as c,eP as se,x as $,F as N,v as Q,eQ as q,c6 as be,D as I,eR as Y,eS as x,y as k,J as Z,cN as ee,eT as O,bR as Ce,dm as B,ah as P,eU as D,an as Se,K as Ae,eV as Le,de as Ee,dl as Ve}from"./index-Cgvi9qKr.js";import{E as ce}from"./index-GjQsR5KG.js";import{E as je,a as Fe}from"./index-DTCoUzbs.js";import{I as G}from"./InfoIcon-A1xDvxpg.js";import{E as Te}from"./index-CvSpx81L.js";import{E as L}from"./index-BT7WrUPB.js";import{E as X}from"./index-D402UB4e.js";import{E as Pe,a as ue}from"./index-Bt9N_pkq.js";import{E as J}from"./index-VD3Emf8V.js";import{C as Ie,N as Ue,B as ze}from"./NoTasks-Cdp8T7aA.js";import{a as Re}from"./price-JcCbdpjd.js";import{E as De,a as Ge,b as Me}from"./index-BQq3lXfU.js";import{E as Oe}from"./index-Gj7AGill.js";import{E as Be}from"./index-C1ao7hiD.js";import"./use-form-item-tWhUsWWY.js";import"./index-r5W6hzzQ.js";import"./index-BTalZB4F.js";import"./index-I8eUQ22m.js";import"./typescript-BJQTyG9d.js";import"./strings-CaFLJNhw.js";import"./castArray-DMPMSVhG.js";import"./isEqual-CNVV21LA.js";import"./_initCloneObject-BcH86D07.js";import"./debounce--4Ey-UiG.js";import"./_baseIteratee-EXwBHC6D.js";import"./index-Bg5mlWRY.js";import"./index-C-wmX7EI.js";import"./_baseClone-CSJOYRf5.js";import"./index-BdcqrZwU.js";import"./index-BOWgmkBj.js";import"./dropdown-e5HICCuH.js";const We=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ae(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"}}),Ne={error:e=>e instanceof Event},qe=b({name:"ElAvatar"}),He=b({...qe,props:We,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ge(!1),u=F(()=>{const{size:s,icon:p,shape:y}=i,_=[o.b()];return ve(s)&&_.push(o.m(s)),p&&_.push(o.m("icon")),y&&_.push(o.m(y)),_}),d=F(()=>{const{size:s}=i;return ae(s)?o.cssVarBlock({size:ye(s)||""}):void 0}),m=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function h(s){a.value=!0,t("error",s)}return(s,p)=>(l(),f("span",{class:ke(V(u)),style:oe(V(d))},[(s.src||s.srcSet)&&!a.value?(l(),f("img",{key:0,src:s.src,alt:s.alt,srcset:s.srcSet,style:oe(V(m)),onError:h},null,44,["src","alt","srcset"])):s.icon?(l(),w(V(R),{key:1},{default:g(()=>[(l(),w(re(s.icon)))]),_:1})):U(s.$slots,"default",{key:2})],6))}});var Ke=_e(He,[["__file","avatar.vue"]]);const Ze=we(Ke),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:K,FontAwesomeIcon:H},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main"},Qe={class:"config"},Ye={class:"result"},xe={class:"preview"};function et(e,t,i,o,a,u){const d=c("font-awesome-icon"),m=c("el-button"),h=c("el-drawer");return l(),f("div",Je,[r("div",Qe,[U(e.$slots,"config",{},void 0,!0)]),r("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),r("div",xe,[U(e.$slots,"preview",{},void 0,!0)]),n(m,{circle:"",class:"menu",onClick:t[0]||(t[0]=s=>e.drawer=!0)},{default:g(()=>[n(d,{icon:"fa-solid fa-magic"})]),_:1}),n(h,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=s=>e.drawer=s),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:g(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const tt=E(Xe,[["render",et],["__scopeId","data-v-c954d282"]]),ot=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},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)}}),st={class:"field"},nt={class:"title font-bold"};function it(e,t,i,o,a,u){const d=c("el-switch"),m=c("el-option"),h=c("el-select");return l(),f("div",st,[r("h2",nt,$(e.$t("suno.name.type")),1),n(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=s=>e.custom=s),class:"value"},null,8,["modelValue"]),n(h,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=s=>e.model=s),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:g(()=>[(l(!0),f(N,null,Q(e.options,s=>(l(),w(m,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const at=E(ot,[["render",it],["__scopeId","data-v-5a66a01f"]]),lt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:K,InfoIcon:G,FontAwesomeIcon:H},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),q.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),rt={class:"relative"},ct={class:"flex justify-between"},ut={class:"flex justify-start items-center"},dt={class:"text-sm font-bold"};function pt(e,t,i,o,a,u){const d=c("info-icon"),m=c("font-awesome-icon"),h=c("el-button"),s=c("el-upload");return l(),f("div",rt,[r("div",ct,[r("div",ut,[r("span",dt,$(e.$t("suno.name.referenceAudios")),1),n(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),n(s,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=p=>e.fileList=p),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:g(()=>[n(h,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:g(()=>[n(m,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+$(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const mt=E(lt,[["render",pt],["__scopeId","data-v-6236152c"]]),ht="",ft=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:G},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),_t={class:"field"},$t={class:"box"},gt={class:"title-info"},vt={class:"title font-bold"},yt={class:"instrumental"},kt={class:"title inline-block"};function wt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-switch"),h=c("el-input");return l(),f("div",_t,[r("div",$t,[r("div",gt,[r("h2",vt,$(e.$t("suno.name.prompt")),1),n(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",yt,[n(m,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=s=>e.instrumental=s),class:"value mr-2"},null,8,["modelValue"]),r("h2",kt,$(e.$t("suno.name.instrumental")),1)])]),n(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=s=>e.prompt=s),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const bt=E(ft,[["render",wt],["__scopeId","data-v-d7004a7c"]]),Ct="",St=b({name:"LyricInput",components:{ElInput:X,InfoIcon:G},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=Ct)}}),At={class:"field"},Lt={class:"box"},Et={class:"title font-bold"};function Vt(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",At,[r("div",Lt,[r("h2",Et,$(e.$t("suno.name.lyrics")),1),n(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(m,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(m,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const jt=E(St,[["render",Vt],["__scopeId","data-v-99dfded8"]]),Ft=b({name:"StyleInput",components:{ElInput:X,InfoIcon:G},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}}}),Tt={class:"field"},Pt={class:"title-container"},It={class:"titlefont-bold"};function Ut(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",Tt,[r("div",Pt,[r("h2",It,$(e.$t("suno.name.style")),1),n(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),n(m,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=h=>e.style=h),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const zt=E(Ft,[["render",Ut],["__scopeId","data-v-85bbfcaa"]]),Rt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:G},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})}}}}),Dt={class:"field"},Gt={class:"title-container"},Mt={class:"title font-bold"};function Ot(e,t,i,o,a,u){const d=c("info-icon"),m=c("el-input");return l(),f("div",Dt,[r("div",Gt,[r("h2",Mt,$(e.$t("suno.name.title")),1),n(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),n(m,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=h=>e.title=h),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Bt=E(Rt,[["render",Ot],["__scopeId","data-v-ce70fe34"]]);function z(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const Wt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:R,ElInputNumber:Pe,VideoPlay:x,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Nt={class:"field"},qt={class:"box"},Ht={class:"title font-bold"},Kt={class:"input-wrapper"},Zt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Qt={class:"info"},Yt={class:"title"},xt={class:"style"};function eo(e,t,i,o,a,u){const d=c("el-input-number"),m=c("el-image"),h=c("video-pause"),s=c("el-icon"),p=c("video-play"),y=ee("loading");return l(),f("div",Nt,[r("div",qt,[r("h2",Ht,$(e.$t("suno.name.extend")),1),r("div",Kt,[n(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=_=>e.value=_),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",Zt,[e.audio?(l(),f("div",{key:0,class:"audio",onClick:t[3]||(t[3]=_=>e.onClick(e.audio))},[Z((l(),f("div",Xt,[n(m,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=_=>e.onPause(e.audio))},[n(s,null,{default:g(()=>[n(h)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=_=>e.onPlay(e.audio))},[n(s,null,{default:g(()=>[n(p)]),_:1})])):k("",!0),e.audio?.duration?(l(),f("div",Jt,$(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[y,!e.audio?.audio_url]]),r("div",Qt,[r("h2",Yt,$(e.audio?.title),1),r("p",xt,$(e.audio?.style),1)])])):k("",!0)])])}const to=E(Wt,[["render",eo],["__scopeId","data-v-bcce4821"]]),oo=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:R,VideoPlay:x,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,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})}}}),so={class:"field"},no={class:"box"},io={class:"title font-bold"},ao={class:"task"},lo={class:"left"},ro={key:2,class:"duration"},co={class:"info"},uo={class:"title"},po={class:"style"};function mo(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),s=c("video-play"),p=ee("loading");return l(),f("div",so,[r("div",no,[r("h2",io,$(e.$t("suno.name.cover")),1)]),r("div",ao,[e.audio?(l(),f("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[Z((l(),f("div",lo,[n(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[n(h,null,{default:g(()=>[n(m)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[n(h,null,{default:g(()=>[n(s)]),_:1})])):k("",!0),e.audio?.duration?(l(),f("div",ro,$(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[p,!e.audio?.audio_url]]),r("div",co,[r("h2",uo,$(e.audio?.title),1),r("p",po,$(e.audio?.style),1)])])):k("",!0)])])}const ho=E(oo,[["render",mo],["__scopeId","data-v-06640216"]]),fo=b({name:"PresetPanel",components:{TypeSelector:at,PromptInput:bt,LyricInput:jt,StyleInput:zt,TitleInput:Bt,ExtendFromInput:to,CoverFromInput:ho,UploadAudio:mt,FontAwesomeIcon:H,ElButton:K,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Re(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"},$o={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function vo(e,t,i,o,a,u){const d=c("type-selector"),m=c("upload-audio"),h=c("prompt-input"),s=c("lyric-input"),p=c("style-input"),y=c("title-input"),_=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),f("div",_o,[r("div",$o,[n(d,{class:"mb-4"}),n(m,{class:"mb-4"}),e.config?.custom?k("",!0):(l(),w(h,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(s,{key:1,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(p,{key:2,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(y,{key:3,class:"mb-4"})):k("",!0),e.config?.action==="extend"?(l(),w(_,{key:4,class:"mb-4"})):k("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):k("",!0)]),r("div",go,[n(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[n(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[n(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=E(fo,[["render",vo],["__scopeId","data-v-b9fab929"]]);var W={exports:{}},ko=W.exports,ne;function wo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(ko,function(){function i(s,p){return typeof p>"u"?p={autoBom:!1}:typeof p!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),p={autoBom:!p}),p.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(s.type)?new Blob(["\uFEFF",s],{type:s.type}):s}function o(s,p,y){var _=new XMLHttpRequest;_.open("GET",s),_.responseType="blob",_.onload=function(){h(_.response,p,y)},_.onerror=function(){console.error("could not download file")},_.send()}function a(s){var p=new XMLHttpRequest;p.open("HEAD",s,!1);try{p.send()}catch{}return 200<=p.status&&299>=p.status}function u(s){try{s.dispatchEvent(new MouseEvent("click"))}catch{var p=document.createEvent("MouseEvents");p.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),s.dispatchEvent(p)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,m=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(s,p,y){var _=d.URL||d.webkitURL,C=document.createElement("a");p=p||s.name||"download",C.download=p,C.rel="noopener",typeof s=="string"?(C.href=s,C.origin===location.origin?u(C):a(C.href)?o(s,p,y):u(C,C.target="_blank")):(C.href=_.createObjectURL(s),setTimeout(function(){_.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(s,p,y){if(p=p||s.name||"download",typeof s!="string")navigator.msSaveOrOpenBlob(i(s,y),p);else if(a(s))o(s,p,y);else{var _=document.createElement("a");_.href=s,_.target="_blank",setTimeout(function(){u(_)})}}:function(s,p,y,_){if(_=_||open("","_blank"),_&&(_.document.title=_.document.body.innerText="downloading..."),typeof s=="string")return o(s,p,y);var C=s.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||m)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),_?_.location.href=S:location=S,_=null},A.readAsDataURL(s)}else{var M=d.URL||d.webkitURL,v=M.createObjectURL(s);_?_.location=v:location.href=v,_=null,setTimeout(function(){M.revokeObjectURL(v)},4e4)}});d.saveAs=h.saveAs=h,e.exports=h})}(W)),W.exports}var bo=wo();const Co="https://webhook.acedata.cloud/suno",So=b({name:"TaskPreview",components:{ElImage:J,ElIcon:R,ElTooltip:Oe,ElButton:K,FontAwesomeIcon:H,VideoPlay:x,VideoPause:Y,ElDropdown:Me,ElDropdownMenu:Ge,ElDropdownItem:De,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:z,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{bo.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}q.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:Co},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),q.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Ao={class:"task"},Lo=["onClick"],Eo={class:"left"},Vo=["onClick"],jo=["onClick"],Fo={key:2,class:"duration"},To={class:"info"},Po={class:"title"},Io={class:"style"},Uo={class:"right"},zo={class:"el-dropdown-link"},Ro={class:"flex items-center min-w-[120px]"},Do={class:"el-dropdown-link"};function Go(e,t,i,o,a,u){const d=c("el-image"),m=c("video-pause"),h=c("el-icon"),s=c("video-play"),p=c("el-button"),y=c("font-awesome-icon"),_=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),M=ee("loading");return l(),f("div",Ao,[(l(!0),f(N,null,Q(e.audios,v=>(l(),f("div",{key:v.id,class:"audio",onClick:P(S=>e.onClick(v),["stop"])},[Z((l(),f("div",Eo,[n(d,{src:v?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),v?.audio_url&&e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),f("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(v),["stop"])},[n(h,null,{default:g(()=>[n(m)]),_:1})],8,Vo)):k("",!0),v?.audio_url&&(e.$store.state?.suno?.audio?.id!==v.id||e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),f("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(v),["stop"])},[n(h,null,{default:g(()=>[n(s)]),_:1})],8,jo)):k("",!0),v?.duration?(l(),f("div",Fo,$(e.useFormatDuring(v?.duration)),1)):k("",!0)])),[[M,!v?.audio_url]]),r("div",To,[r("h2",Po,$(v?.title),1),r("p",Io,$(v?.style),1)]),r("div",Uo,[v?.audio_url?(l(),w(p,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):k("",!0),n(A,null,{dropdown:g(()=>[n(T,null,{default:g(()=>[n(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(v)},{default:g(()=>[r("div",Ro,[e.isFetchingVideoUrl?(l(),w(h,{key:0,class:"is-loading mr-2"},{default:g(()=>[n(C)]),_:1})):k("",!0),r("span",null,$(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),v?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,v?.audio_url),["stop"])},{default:g(()=>[I($(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:g(()=>[r("span",zo,[n(_,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024),n(A,null,{dropdown:g(()=>[n(T,null,{default:g(()=>[v.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(v.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):k("",!0),n(j,{onClick:P(S=>e.onCover(v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),v?.id&&v?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(v?.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:g(()=>[r("span",Do,[n(_,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Lo))),128))])}const Mo=E(So,[["render",Go]]),Oo={class:"player-slider"},Bo=b({__name:"PlayerSlider",setup(e){const t=D(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,m)=>(l(),f("div",Oo,[n(V(ue),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=h=>i.value=h),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),Wo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},qo=["src"],Ho={class:"ml-2 text-xs flex flex-col justify-between"},Ko={class:"w-52 2xl:w-96 cursor-pointer truncate"},Zo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=D(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),f("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(Wo)},null,8,qo),r("div",Ho,[r("div",Ko,[r("div",Zo,[r("span",null,$(i.value?.title||"Music"),1),r("span",Xo,"- "+$(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},xo=b({__name:"PlayerAction",setup(e){const t=D(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),f("div",Qo,[r("span",Yo,$(V(z)(i.value))+" / "+$(V(z)(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||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var ss=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=ts(),m=Se(ss,es);return function(){var h=u.size,s=u.strokeWidth,p=u.strokeLinecap,y=u.strokeLinejoin,_=u.theme,C=u.fill,j=u.spin,T=os(d,{size:h,strokeWidth:s,strokeLinecap:p,strokeLinejoin:y,theme:_,fill:C},m),A=[m.prefix+"-icon"];return A.push(m.prefix+"-icon-"+e),t&&m.rtl&&A.push(m.prefix+"-icon-rtl"),j&&A.push(m.prefix+"-icon-spin"),n("span",{class:A.join(" ")},[i(T)])}}};return o}const ns=te("pause-one",!1,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),n("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),is=te("play",!0,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("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=te("volume-small",!0,function(e){return n("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[n("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),n("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),ls={class:"player-volume flex flex-col items-center pt-2"},rs={class:"text-sm mt-3"},cs=b({__name:"PlayerVolumeSlider",setup(e){const t=D(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),f("div",ls,[n(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=m=>i.value=m),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",rs,$(i.value),1)]))}}),us={class:"flex items-center justify-center gap-x-3"},ds=b({__name:"PlayerController",setup(e){const t=D(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),f("div",us,[n(ie,{icon:o.value?.state==="playing"?V(ns):V(is),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),n(V(Be),{placement:"top",width:"50px",trigger:"click"},{reference:g(()=>[n(ie,{icon:V(as),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:g(()=>[n(cs)]),_:1})]))}}),ps={class:"flex flex-col items-stretch h-20"},ms={class:"flex grow px-5 items-center"},hs={class:"flex-1"},fs={class:"flex-1"},_s={class:"flex-1"},$s=b({__name:"Player",setup(e){return(t,i)=>(l(),f("div",ps,[n(Bo),r("div",ms,[r("div",hs,[n(Jo)]),r("div",fs,[n(ds)]),r("div",_s,[n(xo)])])]))}}),gs=b({name:"RecentPanel",components:{BotPlaceholder:ze,TaskPreview:Mo,Player:$s,NoTasks:Ue},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),vs={key:0,class:"tasks"},ys={key:2,class:"w-full flex-1 flex items-center justify-center"},ks={class:"h-20"};function ws(e,t,i,o,a,u){const d=c("bot-placeholder"),m=c("task-preview"),h=c("no-tasks"),s=c("player");return l(),f(N,null,[e.tasks?.items===void 0?(l(),f("div",vs,[n(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),f("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...p)=>e.onHandleScroll&&e.onHandleScroll(...p))},[(l(!0),f(N,null,Q(e.tasks?.items,(p,y)=>(l(),w(m,{key:y,"model-value":p,class:"preview"},null,8,["model-value"]))),128))],32)):k("",!0),e.tasks?.items?.length===0?(l(),f("div",ys,[n(h)])):k("",!0),Z(r("div",ks,[n(s)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const bs=E(gs,[["render",ws]]),Cs=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:Ze,ElIcon:R},computed:{audio(){return this.$store.state.suno?.audio}}}),Ss={key:0,class:"size-full overflow-hidden"},As={class:"relative h-[300px]"},Ls={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Es={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Vs={class:"p-4"},js={class:"flex items-center font-bold mb-2"},Fs={class:"text-[var(--el-text-color-regular)] mb-2"},Ts={class:"text-xs text-[var(--el-text-color-regular)]"},Ps={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Is={key:1,class:"w-full h-full bg-gradient-to-b from-gray-200 to-gray-300"};function Us(e,t,i,o,a,u){const d=c("icon-picture"),m=c("el-icon"),h=c("el-image"),s=c("el-avatar");return e.audio?.object?(l(),f("div",Ss,[r("div",As,[n(h,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:g(()=>[r("div",Ls,[n(m,{class:"text-3xl"},{default:g(()=>[n(d)]),_:1})])]),_:1},8,["src"]),r("h2",Es,$(e.audio?.title),1)]),r("div",Vs,[r("div",js,[n(s,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,$(e.audio?.title),1)]),r("p",Fs,$(e.audio?.style),1),r("p",Ts,$(e.$dayjs.format(e.audio?.created_at)),1),r("div",Ps,[r("p",null,$(e.audio?.lyric),1)])])])):(l(),f("div",Is))}const zs=E(Cs,[["render",Us]]),Rs="https://webhook.acedata.cloud/suno",Ds=b({name:"SunoIndex",components:{Layout:tt,ConfigPanel:yo,RecentPanel:bs,PreviewPanel:zs},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===B.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===B.Request},needApply(){return this.$store.state.suno.status.getApplications===B.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Rs},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),q.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Gs(e,t,i,o,a,u){const d=c("config-panel"),m=c("recent-panel"),h=c("preview-panel"),s=c("layout");return l(),w(s,null,{config:g(()=>[n(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:g(()=>[n(m,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:g(()=>[n(h)]),_:1})}const kn=E(Ds,[["render",Gs],["__scopeId","data-v-f5721d95"]]);export{kn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as S}from"./index.es-DuwM2xpS.js";import{E as I}from"./index-Dd5KxKjr.js";import{E as O}from"./index-BWb1p7aO.js";import{d as v,h as b,b as m,t as n,k as t,r as T,j as u,l as s,o as a,ek as N,x as i,el as q,em as H,c6 as j,D as g,i as k,y as f,n as C,ah as z,F as D,v as K,en as J,dr as Q,dm as W}from"./index-Bp_hO4E0.js";import{I as U}from"./InfoIcon-B_7NXzqM.js";import{E as A}from"./index-IIDcIl8W.js";import{I as F}from"./ImagePreview-B6H-c819.js";import{E as R}from"./index-Bc2xTmqI.js";import{E}from"./index-C6-YAIfm.js";import{F as X}from"./FilePreview-QU_0fuqr.js";import{E as Y}from"./index-BJYfdB7L.js";import{V as M}from"./VideoPlayer-B4vYbQji.js";import{C as Z,N as x,B as ee}from"./NoTasks-XPY3isSt.js";import{a as te}from"./price-Dyx4MeTf.js";import{C as oe}from"./CopyToClipboard-CWTGukXW.js";import{E as se}from"./index-Badrs_Tv.js";import{E as ne}from"./index-2jAF6ZPA.js";import{E as ae}from"./index-CU0-t0AD.js";import"./use-form-item-C7v6lxI-.js";import"./index-r5W6hzzQ.js";import"./index-6eG4Alfo.js";import"./index-DwST9-YB.js";import"./typescript-BpY75mvT.js";import"./_baseClone-BeP5In-D.js";import"./_initCloneObject-Hx3XrS5v.js";import"./isEqual-CXl2hOES.js";import"./index-DsJzwtEG.js";import"./vue-plyr-QZFBikSk.js";import"./index-1hGPlp5P.js";import"./debounce-uq4Y0tBJ.js";const le=v({name:"LayoutLuma",components:{ElDrawer:O,ElButton:I,FontAwesomeIcon:S},data(){return{drawer:!1}}}),ie={class:"main"},re={class:"config"},ce={class:"result"};function me(e,o,p,h,w,y){const r=s("font-awesome-icon"),d=s("el-button"),c=s("el-drawer");return a(),m("div",ie,[n("div",re,[T(e.$slots,"config",{},void 0,!0)]),n("div",ce,[T(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=_=>e.drawer=!0)},{default:u(()=>[t(r,{icon:"fa-solid fa-magic"})]),_:1}),t(c,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px",class:"drawer"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ue=b(le,[["render",me],["__scopeId","data-v-e43f6bbe"]]),de=v({name:"EnhancementSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug("set enhancement",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),pe={class:"relative"},fe={class:"flex justify-between"},_e={class:"flex justify-start items-center"},he={class:"text-sm font-bold"},$e={class:"flex justify-end items-center"};function ge(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",pe,[n("div",fe,[n("div",_e,[n("span",he,i(e.$t("luma.name.enhancement")),1),t(r,{content:e.$t("luma.description.enhancement")},null,8,["content"])]),n("div",$e,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const ve=b(de,[["render",ge]]),be=v({name:"CustomSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=q)}}),we={class:"relative"},ye={class:"flex justify-between"},ke={class:"flex justify-start items-center"},Ee={class:"text-sm font-bold"},Ve={class:"flex justify-end items-center"};function Ue(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",we,[n("div",ye,[n("div",ke,[n("span",Ee,i(e.$t("luma.name.custom")),1),t(r,{content:e.$t("luma.description.custom")},null,8,["content"])]),n("div",Ve,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Se=b(be,[["render",Ue]]),Ie=v({name:"LoopSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug("set loop",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=H)}}),Le={class:"relative"},Ce={class:"flex justify-between"},Te={class:"flex justify-start items-center"},je={class:"text-sm font-bold"},Ae={class:"flex justify-end items-center"};function Re(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",Le,[n("div",Ce,[n("div",Te,[n("span",je,i(e.$t("luma.name.loop")),1),t(r,{content:e.$t("luma.description.loop")},null,8,["content"])]),n("div",Ae,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Ge=b(Ie,[["render",Re]]),Pe=v({name:"EndImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ze={class:"relative"},De={class:"flex justify-between"},Fe={class:"flex justify-start items-center"},Me={class:"text-sm font-bold"};function Be(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",ze,[n("div",De,[n("div",Fe,[n("span",Me,i(e.$t("luma.name.endImageUrl")),1),t(r,{content:e.$t("luma.description.endImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),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:l})=>[l.url&&l.percentage!==void 0?(a(),k(d,{key:0,url:l.url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadEndImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Oe=b(Pe,[["render",Be],["__scopeId","data-v-7ab78c3e"]]),Ne=v({name:"StartImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),qe={class:"relative"},He={class:"flex justify-between"},Ke={class:"flex justify-start items-center"},Je={class:"text-sm font-bold"};function Qe(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",qe,[n("div",He,[n("div",Ke,[n("span",Je,i(e.$t("luma.name.startImageUrl")),1),t(r,{content:e.$t("luma.description.startImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),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:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const We=b(Ne,[["render",Qe],["__scopeId","data-v-425a8cec"]]),Xe=v({name:"UploadVideo",components:{ElUpload:R,ElButton:I,InfoIcon:U,FilePreview:X,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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.luma?.config?.video_url},set(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||(this.value=void 0)},methods:{onExceed(){E.warning(this.$t("luma.message.uploadVideoExceed"))},onError(){E.error(this.$t("luma.message.uploadVideoError"))},beforeUpload(e){const o=e.type==="video/mp4",p=e.size/1024/1024<10;return o?p?!0:(E.error(this.$t("luma.message.uploadVideoSizeExceed")),!1):(E.error(this.$t("luma.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e,action:"extend"})},async onSuccess(){this.onSetVideoUrl()}}}),Ye={class:"relative"},Ze={class:"flex justify-between"},xe={class:"flex justify-start items-center"},et={class:"text-sm font-bold"};function tt(e,o,p,h,w,y){const r=s("info-icon"),d=s("file-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",Ye,[n("div",Ze,[n("div",xe,[n("span",et,i(e.$t("luma.name.videoUrl")),1),t(r,{content:e.$t("luma.description.videoUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),accept:".mp4",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response?.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const ot=b(Xe,[["render",tt],["__scopeId","data-v-74e51526"]]),st="",nt=v({name:"PromptInput",components:{ElInput:Y,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=st)}}),at={class:"field"},lt={class:"box"},it={class:"title font-bold"};function rt(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-input");return a(),m("div",at,[n("div",lt,[n("h2",it,i(e.$t("luma.name.prompt")),1),t(r,{content:e.$t("luma.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=c=>e.prompt=c),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("luma.placeholder.prompt"),maxlength:2e3,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ct=b(nt,[["render",rt],["__scopeId","data-v-e8284075"]]),mt=v({name:"ExtendFromInput",components:{VideoPlayer:M},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.luma?.config}}}),ut={class:"relative"},dt={class:"flex mb-2"},pt={class:"text-sm font-bold"};function ft(e,o,p,h,w,y){const r=s("video-player");return a(),m("div",ut,[n("div",dt,[n("span",pt,i(e.$t("luma.name.extend")),1)]),n("div",null,[e.config?.video_url?(a(),k(r,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const _t=b(mt,[["render",ft]]),ht=v({name:"ConfigPanel",components:{LoopSelector:Ge,StartImageInput:We,EndImageInput:Oe,EnhancementSelector:ve,ElButton:I,FontAwesomeIcon:S,PromptInput:ct,ExtendFromInput:_t,CustomSelector:Se,UploadVideo:ot,Consumption:Z},emits:["generate"],computed:{config(){return this.$store.state.luma?.config},consumption(){return te(this.config,this.service?.metadata?.price)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$t={class:"flex flex-col h-full"},gt={class:"flex-1 overflow-y-auto p-[15px]"},vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function bt(e,o,p,h,w,y){const r=s("extend-from-input"),d=s("prompt-input"),c=s("custom-selector"),_=s("upload-video"),$=s("start-image-input"),l=s("end-image-input"),V=s("enhancement-selector"),L=s("loop-selector"),B=s("consumption"),G=s("font-awesome-icon"),P=s("el-button");return a(),m("div",$t,[n("div",gt,[e.config?.video_id||e.config?.video_url?(a(),k(r,{key:0,class:"mb-4"})):f("",!0),t(d,{class:"mb-4"}),e.config?.video_id?f("",!0):(a(),k(c,{key:1,class:"mb-4"})),e.config?.custom?(a(),k(_,{key:2,class:"mb-4"})):f("",!0),!(e.config?.video_id||e.config?.video_url)&&!e.config?.custom?(a(),k($,{key:3,class:"mb-4"})):f("",!0),t(l,{class:"mb-4"}),t(V,{class:"mb-4"}),t(L,{class:"mb-4"})]),n("div",vt,[t(B,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),k(P,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.extend")),1)]),_:1},8,["onClick"])):(a(),k(P,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.generate")),1)]),_:1},8,["onClick"]))])])}const wt=b(ht,[["render",bt]]),yt=v({name:"TaskPreview",components:{ElImage:ae,CopyToClipboard:oe,FontAwesomeIcon:S,ElAlert:ne,VideoPlayer:M,ElTooltip:se,ElButton:I},props:{modelValue:{type:Object,required:!0}},emits:["extend"],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,o){console.debug("set config",o),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_id:o.video_id,prompt:o.prompt,action:"extend",thumbnail_url:o.thumbnail_url,video_url:o.video_url}),this.$emit("extend")},onDownload(e){window.open(e,"_blank")}}}),kt={class:"preview"},Et={class:"left"},Vt={class:"main"},Ut={class:"bot"},St={class:"datetime"},It={class:"info"},Lt={key:0,class:"prompt mt-2"},Ct={key:0},Tt={key:1},jt={key:0,class:C({content:!0,failed:!0})},At={key:0,class:"mb-4"},Rt={key:1,class:C({operations:!0,"mt-2":!0,"mb-4":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Pt={key:1,class:C({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Dt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Mt={key:2,class:C({content:!0})},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Ot(e,o,p,h,w,y){const r=s("el-image"),d=s("video-player"),c=s("el-button"),_=s("el-tooltip"),$=s("font-awesome-icon"),l=s("copy-to-clipboard"),V=s("el-alert");return a(),m("div",kt,[n("div",Et,[t(r,{src:"https://cdn.acedata.cloud/ahjfwi.png",class:"avatar"})]),n("div",Vt,[n("div",Ut,[g(i(e.$t("luma.name.lumaBot"))+" ",1),n("span",St,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),n("div",It,[e.modelValue?.request?.prompt?(a(),m("p",Lt,[g(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(a(),m("span",Ct," - ("+i(e.$t("luma.status.pending"))+") ",1)),e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("span",Tt," - ("+i(e.$t("luma.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0?(a(),m("div",jt,[e.modelValue.response.video_url?(a(),m("div",At,[t(d,{src:e.modelValue.response.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response&&!e.config?.custom?(a(),m("div",Rt,[t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.extendVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=z(L=>e.onExtend(L,e.modelValue?.response),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.extend")),1)]),_:1})]),_:1},8,["content"]),t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.downloadVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=z(L=>e.onDownload(e.modelValue?.response?.video_url),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.download")),1)]),_:1})]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[n("p",Gt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.state==="failed"||e.modelValue?.response?.success===!1?(a(),m("div",Pt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",zt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])]),n("p",Dt,[t($,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+i(e.$t("luma.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(l,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),n("p",Ft,[t($,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+i(e.$t("luma.name.traceId"))+": "+i(e.modelValue?.trace_id)+" ",1),t(l,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):f("",!0),!e.modelValue?.response||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("div",Mt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",Bt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0)])])}const Nt=b(yt,[["render",Ot],["__scopeId","data-v-1b4a59bc"]]),qt=v({name:"RecentPanel",components:{BotPlaceholder:ee,TaskPreview:Nt,NoTasks:x},emits:["reach-top","extend"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.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")}}}),Ht={key:0},Kt={key:1,class:"tasks w-full h-full overflow-y-auto"},Jt={key:2,class:"w-full h-full flex items-center justify-center"};function Qt(e,o,p,h,w,y){const r=s("bot-placeholder"),d=s("task-preview"),c=s("no-tasks");return a(),m(D,null,[e.tasks?.items===void 0?(a(),m("div",Ht,[t(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),m("div",Kt,[(a(!0),m(D,null,K(e.tasks?.items,_=>(a(),k(d,{key:_.id,"model-value":_,onExtend:o[0]||(o[0]=$=>e.$emit("extend"))},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(a(),m("div",Jt,[t(c)])):f("",!0)],64)}const Wt=b(qt,[["render",Qt]]),Xt="https://webhook.acedata.cloud/luma",Yt=v({name:"LumaIndex",components:{ConfigPanel:wt,Layout:ue,RecentPanel:Wt},inject:["initialized"],emits:["extend"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.luma?.status?.getApplications===W.Request},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("luma/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("luma/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){console.debug("scrolling down"),setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:h}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",h),await this.$store.dispatch("luma/getTasks",{limit:o,createdAtMin:p,createdAtMax:h})},async onGenerate(){const e={...this.config,callback_url:Xt},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("luma.message.startingTask")),J.generate(e,{token:o}).then(()=>{E.success(this.$t("luma.message.startTaskSuccess"))}).catch(p=>{p?.response?.data?.error?.code===Q?E.error(this.$t("luma.message.usedUp")):E.error(this.$t("luma.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Zt(e,o,p,h,w,y){const r=s("config-panel"),d=s("recent-panel"),c=s("layout");return a(),k(c,null,{config:u(()=>[t(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop,onExtend:o[0]||(o[0]=_=>e.$emit("extend"))},null,8,["onReachTop"])]),_:1})}const Co=b(Yt,[["render",Zt]]);export{Co as default};
|
|
1
|
+
import{F as S}from"./index.es-CIc56cl6.js";import{E as I}from"./index-qGVWSNsj.js";import{E as O}from"./index-D2hwZIWA.js";import{d as v,h as b,b as m,t as n,k as t,r as T,j as u,l as s,o as a,ek as N,x as i,el as q,em as H,c6 as j,D as g,i as k,y as f,n as C,ah as z,F as D,v as K,en as J,dr as Q,dm as W}from"./index-Cgvi9qKr.js";import{I as U}from"./InfoIcon-A1xDvxpg.js";import{E as A}from"./index-GjQsR5KG.js";import{I as F}from"./ImagePreview-TfSPkY4U.js";import{E as R}from"./index-CvSpx81L.js";import{E}from"./index-BT7WrUPB.js";import{F as X}from"./FilePreview-D0-PWvO0.js";import{E as Y}from"./index-D402UB4e.js";import{V as M}from"./VideoPlayer-bQ9vkI39.js";import{C as Z,N as x,B as ee}from"./NoTasks-Cdp8T7aA.js";import{a as te}from"./price-JcCbdpjd.js";import{C as oe}from"./CopyToClipboard-RknI4LM3.js";import{E as se}from"./index-Gj7AGill.js";import{E as ne}from"./index-BgUK6CFV.js";import{E as ae}from"./index-VD3Emf8V.js";import"./use-form-item-tWhUsWWY.js";import"./index-r5W6hzzQ.js";import"./index-BTalZB4F.js";import"./index-C-wmX7EI.js";import"./typescript-BJQTyG9d.js";import"./_baseClone-CSJOYRf5.js";import"./_initCloneObject-BcH86D07.js";import"./isEqual-CNVV21LA.js";import"./index-BdcqrZwU.js";import"./vue-plyr-QZFBikSk.js";import"./index-BOWgmkBj.js";import"./debounce--4Ey-UiG.js";const le=v({name:"LayoutLuma",components:{ElDrawer:O,ElButton:I,FontAwesomeIcon:S},data(){return{drawer:!1}}}),ie={class:"main"},re={class:"config"},ce={class:"result"};function me(e,o,p,h,w,y){const r=s("font-awesome-icon"),d=s("el-button"),c=s("el-drawer");return a(),m("div",ie,[n("div",re,[T(e.$slots,"config",{},void 0,!0)]),n("div",ce,[T(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=_=>e.drawer=!0)},{default:u(()=>[t(r,{icon:"fa-solid fa-magic"})]),_:1}),t(c,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px",class:"drawer"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ue=b(le,[["render",me],["__scopeId","data-v-e43f6bbe"]]),de=v({name:"EnhancementSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug("set enhancement",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),pe={class:"relative"},fe={class:"flex justify-between"},_e={class:"flex justify-start items-center"},he={class:"text-sm font-bold"},$e={class:"flex justify-end items-center"};function ge(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",pe,[n("div",fe,[n("div",_e,[n("span",he,i(e.$t("luma.name.enhancement")),1),t(r,{content:e.$t("luma.description.enhancement")},null,8,["content"])]),n("div",$e,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const ve=b(de,[["render",ge]]),be=v({name:"CustomSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=q)}}),we={class:"relative"},ye={class:"flex justify-between"},ke={class:"flex justify-start items-center"},Ee={class:"text-sm font-bold"},Ve={class:"flex justify-end items-center"};function Ue(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",we,[n("div",ye,[n("div",ke,[n("span",Ee,i(e.$t("luma.name.custom")),1),t(r,{content:e.$t("luma.description.custom")},null,8,["content"])]),n("div",Ve,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Se=b(be,[["render",Ue]]),Ie=v({name:"LoopSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug("set loop",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=H)}}),Le={class:"relative"},Ce={class:"flex justify-between"},Te={class:"flex justify-start items-center"},je={class:"text-sm font-bold"},Ae={class:"flex justify-end items-center"};function Re(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",Le,[n("div",Ce,[n("div",Te,[n("span",je,i(e.$t("luma.name.loop")),1),t(r,{content:e.$t("luma.description.loop")},null,8,["content"])]),n("div",Ae,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Ge=b(Ie,[["render",Re]]),Pe=v({name:"EndImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ze={class:"relative"},De={class:"flex justify-between"},Fe={class:"flex justify-start items-center"},Me={class:"text-sm font-bold"};function Be(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",ze,[n("div",De,[n("div",Fe,[n("span",Me,i(e.$t("luma.name.endImageUrl")),1),t(r,{content:e.$t("luma.description.endImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),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:l})=>[l.url&&l.percentage!==void 0?(a(),k(d,{key:0,url:l.url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadEndImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Oe=b(Pe,[["render",Be],["__scopeId","data-v-7ab78c3e"]]),Ne=v({name:"StartImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),qe={class:"relative"},He={class:"flex justify-between"},Ke={class:"flex justify-start items-center"},Je={class:"text-sm font-bold"};function Qe(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",qe,[n("div",He,[n("div",Ke,[n("span",Je,i(e.$t("luma.name.startImageUrl")),1),t(r,{content:e.$t("luma.description.startImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),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:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const We=b(Ne,[["render",Qe],["__scopeId","data-v-425a8cec"]]),Xe=v({name:"UploadVideo",components:{ElUpload:R,ElButton:I,InfoIcon:U,FilePreview:X,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/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.luma?.config?.video_url},set(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||(this.value=void 0)},methods:{onExceed(){E.warning(this.$t("luma.message.uploadVideoExceed"))},onError(){E.error(this.$t("luma.message.uploadVideoError"))},beforeUpload(e){const o=e.type==="video/mp4",p=e.size/1024/1024<10;return o?p?!0:(E.error(this.$t("luma.message.uploadVideoSizeExceed")),!1):(E.error(this.$t("luma.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e,action:"extend"})},async onSuccess(){this.onSetVideoUrl()}}}),Ye={class:"relative"},Ze={class:"flex justify-between"},xe={class:"flex justify-start items-center"},et={class:"text-sm font-bold"};function tt(e,o,p,h,w,y){const r=s("info-icon"),d=s("file-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",Ye,[n("div",Ze,[n("div",xe,[n("span",et,i(e.$t("luma.name.videoUrl")),1),t(r,{content:e.$t("luma.description.videoUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),accept:".mp4",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response?.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const ot=b(Xe,[["render",tt],["__scopeId","data-v-74e51526"]]),st="",nt=v({name:"PromptInput",components:{ElInput:Y,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=st)}}),at={class:"field"},lt={class:"box"},it={class:"title font-bold"};function rt(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-input");return a(),m("div",at,[n("div",lt,[n("h2",it,i(e.$t("luma.name.prompt")),1),t(r,{content:e.$t("luma.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=c=>e.prompt=c),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("luma.placeholder.prompt"),maxlength:2e3,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ct=b(nt,[["render",rt],["__scopeId","data-v-e8284075"]]),mt=v({name:"ExtendFromInput",components:{VideoPlayer:M},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.luma?.config}}}),ut={class:"relative"},dt={class:"flex mb-2"},pt={class:"text-sm font-bold"};function ft(e,o,p,h,w,y){const r=s("video-player");return a(),m("div",ut,[n("div",dt,[n("span",pt,i(e.$t("luma.name.extend")),1)]),n("div",null,[e.config?.video_url?(a(),k(r,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const _t=b(mt,[["render",ft]]),ht=v({name:"ConfigPanel",components:{LoopSelector:Ge,StartImageInput:We,EndImageInput:Oe,EnhancementSelector:ve,ElButton:I,FontAwesomeIcon:S,PromptInput:ct,ExtendFromInput:_t,CustomSelector:Se,UploadVideo:ot,Consumption:Z},emits:["generate"],computed:{config(){return this.$store.state.luma?.config},consumption(){return te(this.config,this.service?.metadata?.price)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$t={class:"flex flex-col h-full"},gt={class:"flex-1 overflow-y-auto p-[15px]"},vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function bt(e,o,p,h,w,y){const r=s("extend-from-input"),d=s("prompt-input"),c=s("custom-selector"),_=s("upload-video"),$=s("start-image-input"),l=s("end-image-input"),V=s("enhancement-selector"),L=s("loop-selector"),B=s("consumption"),G=s("font-awesome-icon"),P=s("el-button");return a(),m("div",$t,[n("div",gt,[e.config?.video_id||e.config?.video_url?(a(),k(r,{key:0,class:"mb-4"})):f("",!0),t(d,{class:"mb-4"}),e.config?.video_id?f("",!0):(a(),k(c,{key:1,class:"mb-4"})),e.config?.custom?(a(),k(_,{key:2,class:"mb-4"})):f("",!0),!(e.config?.video_id||e.config?.video_url)&&!e.config?.custom?(a(),k($,{key:3,class:"mb-4"})):f("",!0),t(l,{class:"mb-4"}),t(V,{class:"mb-4"}),t(L,{class:"mb-4"})]),n("div",vt,[t(B,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),k(P,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.extend")),1)]),_:1},8,["onClick"])):(a(),k(P,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.generate")),1)]),_:1},8,["onClick"]))])])}const wt=b(ht,[["render",bt]]),yt=v({name:"TaskPreview",components:{ElImage:ae,CopyToClipboard:oe,FontAwesomeIcon:S,ElAlert:ne,VideoPlayer:M,ElTooltip:se,ElButton:I},props:{modelValue:{type:Object,required:!0}},emits:["extend"],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,o){console.debug("set config",o),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_id:o.video_id,prompt:o.prompt,action:"extend",thumbnail_url:o.thumbnail_url,video_url:o.video_url}),this.$emit("extend")},onDownload(e){window.open(e,"_blank")}}}),kt={class:"preview"},Et={class:"left"},Vt={class:"main"},Ut={class:"bot"},St={class:"datetime"},It={class:"info"},Lt={key:0,class:"prompt mt-2"},Ct={key:0},Tt={key:1},jt={key:0,class:C({content:!0,failed:!0})},At={key:0,class:"mb-4"},Rt={key:1,class:C({operations:!0,"mt-2":!0,"mb-4":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Pt={key:1,class:C({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Dt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Mt={key:2,class:C({content:!0})},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Ot(e,o,p,h,w,y){const r=s("el-image"),d=s("video-player"),c=s("el-button"),_=s("el-tooltip"),$=s("font-awesome-icon"),l=s("copy-to-clipboard"),V=s("el-alert");return a(),m("div",kt,[n("div",Et,[t(r,{src:"https://cdn.acedata.cloud/ahjfwi.png",class:"avatar"})]),n("div",Vt,[n("div",Ut,[g(i(e.$t("luma.name.lumaBot"))+" ",1),n("span",St,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),n("div",It,[e.modelValue?.request?.prompt?(a(),m("p",Lt,[g(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(a(),m("span",Ct," - ("+i(e.$t("luma.status.pending"))+") ",1)),e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("span",Tt," - ("+i(e.$t("luma.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0?(a(),m("div",jt,[e.modelValue.response.video_url?(a(),m("div",At,[t(d,{src:e.modelValue.response.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response&&!e.config?.custom?(a(),m("div",Rt,[t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.extendVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=z(L=>e.onExtend(L,e.modelValue?.response),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.extend")),1)]),_:1})]),_:1},8,["content"]),t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.downloadVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=z(L=>e.onDownload(e.modelValue?.response?.video_url),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.download")),1)]),_:1})]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[n("p",Gt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.state==="failed"||e.modelValue?.response?.success===!1?(a(),m("div",Pt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",zt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])]),n("p",Dt,[t($,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+i(e.$t("luma.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(l,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),n("p",Ft,[t($,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+i(e.$t("luma.name.traceId"))+": "+i(e.modelValue?.trace_id)+" ",1),t(l,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):f("",!0),!e.modelValue?.response||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("div",Mt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",Bt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0)])])}const Nt=b(yt,[["render",Ot],["__scopeId","data-v-1b4a59bc"]]),qt=v({name:"RecentPanel",components:{BotPlaceholder:ee,TaskPreview:Nt,NoTasks:x},emits:["reach-top","extend"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.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")}}}),Ht={key:0},Kt={key:1,class:"tasks w-full h-full overflow-y-auto"},Jt={key:2,class:"w-full h-full flex items-center justify-center"};function Qt(e,o,p,h,w,y){const r=s("bot-placeholder"),d=s("task-preview"),c=s("no-tasks");return a(),m(D,null,[e.tasks?.items===void 0?(a(),m("div",Ht,[t(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),m("div",Kt,[(a(!0),m(D,null,K(e.tasks?.items,_=>(a(),k(d,{key:_.id,"model-value":_,onExtend:o[0]||(o[0]=$=>e.$emit("extend"))},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(a(),m("div",Jt,[t(c)])):f("",!0)],64)}const Wt=b(qt,[["render",Qt]]),Xt="https://webhook.acedata.cloud/luma",Yt=v({name:"LumaIndex",components:{ConfigPanel:wt,Layout:ue,RecentPanel:Wt},inject:["initialized"],emits:["extend"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.luma?.status?.getApplications===W.Request},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("luma/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("luma/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){console.debug("scrolling down"),setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:h}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",h),await this.$store.dispatch("luma/getTasks",{limit:o,createdAtMin:p,createdAtMax:h})},async onGenerate(){const e={...this.config,callback_url:Xt},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("luma.message.startingTask")),J.generate(e,{token:o}).then(()=>{E.success(this.$t("luma.message.startTaskSuccess"))}).catch(p=>{p?.response?.data?.error?.code===Q?E.error(this.$t("luma.message.usedUp")):E.error(this.$t("luma.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Zt(e,o,p,h,w,y){const r=s("config-panel"),d=s("recent-panel"),c=s("layout");return a(),k(c,null,{config:u(()=>[t(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop,onExtend:o[0]||(o[0]=_=>e.$emit("extend"))},null,8,["onReachTop"])]),_:1})}const Co=b(Yt,[["render",Zt]]);export{Co as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as g,L as A,S as v,h as k,i as f,j as i,k as s,y as _,l as t,D as $,x as p,t as o,o as r,R as O,eX as S,m as N,p as T,q as L,eY as D,c6 as R,b as h,f as U,F as P,v as B,n as q}from"./index-
|
|
1
|
+
import{d as g,L as A,S as v,h as k,i as f,j as i,k as s,y as _,l as t,D as $,x as p,t as o,o as r,R as O,eX as S,m as N,p as T,q as L,eY as D,c6 as R,b as h,f as U,F as P,v as B,n as q}from"./index-Cgvi9qKr.js";import{F as w}from"./index.es-CIc56cl6.js";import{E as F,a as V}from"./index-CeFYRj3z.js";import{E as X}from"./index-C1ao7hiD.js";import{E as b}from"./index-VD3Emf8V.js";import"./typescript-BJQTyG9d.js";import"./index-Gj7AGill.js";import"./index-BTalZB4F.js";import"./index-r5W6hzzQ.js";import"./index-Bg5mlWRY.js";import"./dropdown-e5HICCuH.js";import"./debounce--4Ey-UiG.js";import"./index-BdcqrZwU.js";const j=g({name:"HelpEntry",components:{ElImage:b,ElDialog:A,ElPopover:X,ElMenu:V,ElMenuItem:F,FontAwesomeIcon:w},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){window.open(this.$store.state.site?.features?.support?.discord?.url,"_blank")},onProfit(){this.$router.push({name:v})}}}),H={class:"flex"},M={class:"flex-1 text-center"};function z(e,n,E,y,I,x){const c=t("font-awesome-icon"),l=t("el-menu-item"),d=t("el-image"),m=t("el-popover"),a=t("el-menu"),u=t("el-dialog");return r(),f(u,{"model-value":e.visible,width:200,class:"text-center",onClose:n[0]||(n[0]=C=>e.$emit("close"))},{default:i(()=>[s(a,{collapse:!1,class:"menu"},{default:i(()=>[e.site?.features?.support?.discord?.enabled?(r(),f(l,{key:0,index:"1",onClick:e.onJoin},{title:i(()=>[$(p(e.$t("common.message.joinDiscord")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):_("",!0),s(m,{width:350,trigger:"hover"},{reference:i(()=>[e.site?.features?.support?.wechat?.enabled?(r(),f(l,{key:0,index:"2"},{title:i(()=>[$(p(e.$t("common.message.addWeChat")),1)]),default:i(()=>[s(c,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):_("",!0)]),default:i(()=>[o("div",H,[o("div",M,[s(d,{src:e.site?.features?.support?.wechat?.qr},null,8,["src"])])])]),_:1})]),_:1})]),_:1},8,["model-value"])}const J=k(j,[["render",z],["__scopeId","data-v-0fce633f"]]),G=g({name:"ProfileIndex",components:{ElImage:b,HelpDialog:J,FontAwesomeIcon:w},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){return this.$store?.state?.site?.features?.support?.enabled&&(this.$store?.state?.site?.features?.support?.discord?.enabled||this.$store?.state?.site?.features?.support?.wechat?.enabled)},showSite(){return this.$store?.state?.site?.admins?.includes(this.$store.getters.user?.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${S()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:N,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:T,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:L,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:v,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:D,icon:"fa-solid fa-gear"}]:[],{key:"dark-setting",text:this.$t("common.nav.darkMode"),icon:"fa-solid fa-moon",callback:()=>{this.operating.dark=!0}},{key:"locale-setting",text:this.$t("common.nav.locale"),icon:"fa-solid fa-language",callback:()=>{this.operating.locale=!0}},{key:"developerPlatform",text:this.$t("console.menu.developerPlatform"),href:R(),icon:"fa-solid fa-laptop-code"},...this.showSupport?[{key:"support",text:this.$t("common.nav.support"),callback:()=>{this.operating.help=!0},icon:"fa-solid fa-question"}]:[],{key:"logout",text:this.$t("common.nav.logOut"),icon:"fa-solid fa-arrow-right-from-bracket",callback:async()=>{await this.$store.dispatch("resetAll"),await this.$store.dispatch("chat/resetAll"),await this.$store.dispatch("midjourney/resetAll"),await this.$store.dispatch("qrart/resetAll"),await this.$store.dispatch("flux/resetAll"),await this.$store.dispatch("hailuo/resetAll"),await this.$store.dispatch("headshots/resetAll"),await this.$store.dispatch("kling/resetAll"),await this.$store.dispatch("luma/resetAll"),await this.$store.dispatch("pika/resetAll"),await this.$store.dispatch("suno/resetAll"),await this.$store.dispatch("login")}}]}},methods:{onHome(){this.$router.push({name:O})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),W={class:"profile"},Y={class:"info"},K={class:"links"},Q=["onClick"],Z={class:"icon"},ee={class:"text"},te={class:"suffix"};function se(e,n,E,y,I,x){const c=t("el-image"),l=t("font-awesome-icon"),d=t("locale-selector"),m=t("help-dialog");return r(),h("div",W,[o("div",Y,[s(c,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),o("h2",null,p(e.user.username),1),o("div",{style:U({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),o("div",K,[(r(!0),h(P,null,B(e.links,(a,u)=>(r(),h("a",{key:u,class:q({link:!0,active:e.$route.name===a.name}),onClick:C=>e.onNavigate(a)},[o("span",Z,[s(l,{icon:a.icon,class:"text-sm"},null,8,["icon"])]),o("span",ee,p(a.text),1),o("span",te,[s(l,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,Q))),128))]),s(d,{visible:e.operating.locale==!0,onClose:n[0]||(n[0]=a=>e.operating.locale=!1)},null,8,["visible"]),s(m,{visible:e.operating.help==!0,onClose:n[1]||(n[1]=a=>e.operating.help=!1)},null,8,["visible"])])}const _e=k(G,[["render",se],["__scopeId","data-v-54290de4"]]);export{_e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as R}from"./index.es-DuwM2xpS.js";import{E as C}from"./index-Dd5KxKjr.js";import{E as O}from"./index-BWb1p7aO.js";import{d as $,h as g,b as r,t as l,k as t,r as U,j as m,l as s,o as a,eo as q,x as i,F as V,v as S,i as I,ep as j,D as _,eq as z,c6 as B,y as h,n as A,er as F,dr as N,de as H,dl as K,dm as P}from"./index-Bp_hO4E0.js";import{I as D}from"./InfoIcon-B_7NXzqM.js";import{E as J}from"./index-IIDcIl8W.js";import{E as G,a as L}from"./index-By0I6dZ-.js";import{a as Q,E as W}from"./index-B9ydRjkI.js";import{E as X}from"./index-Bc2xTmqI.js";import{E as w}from"./index-C6-YAIfm.js";import{E as Y}from"./index-BJYfdB7L.js";import{C as Z}from"./CopyToClipboard-CWTGukXW.js";import{s as x}from"./vue-plyr-QZFBikSk.js";import{E as ee}from"./index-Badrs_Tv.js";import{E as te}from"./index-2jAF6ZPA.js";import{E as oe}from"./index-CU0-t0AD.js";import{a as se,E as ae}from"./index-1hGPlp5P.js";import"./use-form-item-C7v6lxI-.js";import"./index-r5W6hzzQ.js";import"./index-6eG4Alfo.js";import"./index-DJHmsgYy.js";import"./typescript-BpY75mvT.js";import"./strings-Dqqb4Qff.js";import"./castArray-BFNMyvNy.js";import"./isEqual-CXl2hOES.js";import"./_initCloneObject-Hx3XrS5v.js";import"./debounce-uq4Y0tBJ.js";import"./_baseIteratee-Gayx4zPC.js";import"./index-Da4hcGYx.js";import"./index-DwST9-YB.js";import"./_baseClone-BeP5In-D.js";import"./index-DsJzwtEG.js";const ne=$({name:"LayoutPika",components:{ElDrawer:O,ElButton:C,FontAwesomeIcon:R},data(){return{drawer:!1}}}),ie={class:"main"},le={class:"config"},re={class:"result"};function ce(e,o,p,d,k,v){const c=s("font-awesome-icon"),u=s("el-button"),n=s("el-drawer");return a(),r("div",ie,[l("div",le,[U(e.$slots,"config",{},void 0,!0)]),l("div",re,[U(e.$slots,"result",{},void 0,!0)]),t(u,{circle:"",class:"menu",onClick:o[0]||(o[0]=f=>e.drawer=!0)},{default:m(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=f=>e.drawer=f),"with-header":!1,size:"350px"},{default:m(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const pe=g(ne,[["render",ce],["__scopeId","data-v-35c01ab3"]]),de=$({name:"IngredientsSelector",components:{ElSwitch:J,InfoIcon:D},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug("set ingredients",e),e||this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,model:"2.0"})}}},mounted(){this.value===void 0&&(this.value=q)}}),ue={class:"field"},me={class:"title font-bold"};function fe(e,o,p,d,k,v){const c=s("el-switch"),u=s("info-icon");return a(),r("div",ue,[l("h2",me,i(e.$t("pika.name.ingredients")),1),t(c,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value"},null,8,["modelValue"]),t(u,{content:e.$t("pika.description.ingredients"),class:"info"},null,8,["content"])])}const _e=g(de,[["render",fe],["__scopeId","data-v-17c0af5c"]]),he=$({name:"EffectSelector",components:{ElSelect:L,ElOption:G},data(){return{}},computed:{options(){return[{value:"Levitate",label:this.$t("pika.style.effect1")},{value:"Decapitate",label:this.$t("pika.style.effect2")},{value:"Eye-pop",label:this.$t("pika.style.effect3")},{value:"Ta-da",label:this.$t("pika.style.effect4")},{value:"Deflate",label:this.$t("pika.style.effect5")},{value:"Crumble",label:this.$t("pika.style.effect6")},{value:"Dissolve",label:this.$t("pika.style.effect7")},{value:"Squish",label:this.$t("pika.style.effect8")},{value:"Inflate",label:this.$t("pika.style.effect9")},{value:"Melt",label:this.$t("pika.style.effect10")},{value:"Cake-ify",label:this.$t("pika.style.effect11")},{value:"Crush",label:this.$t("pika.style.effect12")},{value:"Explode",label:this.$t("pika.style.effect13")}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,effect:e})}}}}),$e={class:"field"},ge={class:"title font-bold"},ke={class:"float-left"};function ve(e,o,p,d,k,v){const c=s("el-option"),u=s("el-select");return a(),r("div",$e,[l("h2",ge,i(e.$t("pika.name.effect")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select"),clearable:""},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.label,value:n.value},{default:m(()=>[l("span",ke,i(n.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=g(he,[["render",ve],["__scopeId","data-v-d1c54475"]]),ye=$({name:"IngredientsModelSelector",components:{ElRadioButton:W,ElRadioGroup:Q},data(){return{options:[{label:this.$t("pika.button.precise"),value:"precise"},{label:this.$t("pika.button.creative"),value:"creative"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||(this.value=j)}}),we={class:"field"},Ie={class:"title font-bold"};function Ee(e,o,p,d,k,v){const c=s("el-radio-button"),u=s("el-radio-group");return a(),r("div",we,[l("h2",Ie,i(e.$t("pika.name.ingredientsModel")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),size:"small",class:"quality"},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.value},{default:m(()=>[_(i(n.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const Ve=g(ye,[["render",Ee],["__scopeId","data-v-b948551f"]]),Se=$({name:"ModelSelector",components:{ElSelect:L,ElOption:G},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"2.0",label:"2.0"},{value:"1.5",label:"1.5"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||(this.value=z)}}),Te={class:"field"},Ce={class:"title font-bold"};function Ae(e,o,p,d,k,v){const c=s("el-option"),u=s("el-select");return a(),r("div",Te,[l("h2",Ce,i(e.$t("pika.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=g(Se,[["render",Ae],["__scopeId","data-v-7b2e870a"]]),Pe=$({name:"ImageUrlInput",components:{ElUpload:X,ElButton:C,InfoIcon:D},data(){return{fileList:[],uploadUrl:B()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.pika?.config?.image_url},set(){const e=this.urls?.[0];this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){w.warning(this.$t("pika.message.uploadStartImageExceed"))},onError(){w.error(this.$t("pika.message.uploadStartImageError"))},async onRemove(){w.error(this.$t("pika.message.uploadStartImageError"))},onSetStartImageUrl(){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),Re={class:"field"},De={class:"title font-bold"},Ge={class:"upload-wrapper"};function Le(e,o,p,d,k,v){const c=s("el-button"),u=s("el-upload"),n=s("info-icon");return a(),r("div",Re,[l("h2",De,i(e.$t("pika.name.imageUrl")),1),l("div",Ge,[t(u,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=f=>e.fileList=f),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:3,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{default:m(()=>[t(c,{size:"small",type:"primary",round:""},{default:m(()=>[_(i(e.$t("pika.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])]),t(n,{content:e.$t("pika.description.imageUrl"),class:"info"},null,8,["content"])])}const Me=g(Pe,[["render",Le],["__scopeId","data-v-55a9552e"]]),Oe="",qe=$({name:"PromptInput",components:{ElInput:Y,InfoIcon:D},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Oe)}}),je={class:"field"},ze={class:"box"},Be={class:"title font-bold"};function Fe(e,o,p,d,k,v){const c=s("info-icon"),u=s("el-input");return a(),r("div",je,[l("div",ze,[l("h2",Be,i(e.$t("pika.name.prompt")),1),t(c,{content:e.$t("pika.description.prompt"),class:"info"},null,8,["content"])]),t(u,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pika.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ne=g(qe,[["render",Fe],["__scopeId","data-v-b94e7a3e"]]),He=$({name:"PresetPanel",components:{ImageUrlInput:Me,ElButton:C,FontAwesomeIcon:R,PromptInput:Ne,IngredientsSelector:_e,IngredientsModelSelector:Ve,ModelSelector:Ue,EffectSelector:be},emits:["generate"],computed:{config(){return this.$store.state.pika?.config}},methods:{onGenerate(){this.$emit("generate")}}}),Ke={class:"panel"},Je={class:"config"},Qe={class:"actions"};function We(e,o,p,d,k,v){const c=s("prompt-input"),u=s("model-selector"),n=s("ingredients-selector"),f=s("effect-selector"),b=s("image-url-input"),E=s("ingredients-model-selector"),T=s("font-awesome-icon"),y=s("el-button");return a(),r("div",Ke,[l("div",Je,[t(c,{class:"mb-4"}),t(u,{class:"mb-4"}),t(n,{class:"mb-4"}),t(f,{class:"mb-4"}),e.config?.ingredients?(a(),I(b,{key:0,class:"mb-4"})):h("",!0),e.config?.ingredients?(a(),I(E,{key:1,class:"mb-4"})):h("",!0),l("div",Qe,[t(y,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[t(T,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("pika.button.generate")),1)]),_:1},8,["onClick"])])])])}const Xe=g(He,[["render",We],["__scopeId","data-v-53b25bc4"]]),Ye=$({name:"VideoPlayer",components:{VuePlyr:x},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),Ze=["data-poster"],xe=["src"];function et(e,o,p,d,k,v){const c=s("vue-plyr");return a(),r("div",null,[t(c,{options:e.options,class:"video"},{default:m(()=>[l("video",{controls:"",crossorigin:"",playsinline:"","data-poster":e.modelValue?.image_url},[l("source",{size:"1080",src:e.modelValue?.video_url,type:"video/mp4"},null,8,xe)],8,Ze)]),_:1},8,["options"])])}const tt=g(Ye,[["render",et],["__scopeId","data-v-fc420430"]]),ot=$({name:"TaskPreview",components:{ElImage:oe,CopyToClipboard:Z,FontAwesomeIcon:R,ElAlert:te,VideoPlayer:tt,ElTooltip:ee,ElButton:C},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(p=>{let d=p;o&&(d.action=o),e.push(d)}),e}},methods:{onDownload(e){console.log("on download"),window.open(e,"_blank")},onReload(e){const o=e.target,p=new URL(o.src),d=p.searchParams.get("retry");if(!d)p.searchParams.set("retry","1");else if(parseInt(d)<2)p.searchParams.set("retry",(parseInt(d)+1).toString());else return;o.src=p.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),st={class:"left"},at={class:"main"},nt={class:"bot"},it={class:"datetime"},lt={class:"info"},rt={key:0,class:"prompt mt-2"},ct={key:0},pt={key:1},dt={key:0,class:A({content:!0,failed:!0})},ut={class:"image-wrapper"},mt={key:0,class:A({operations:!0,"mt-2":!0})},ft={class:"description"},_t={key:1,class:A({content:!0})},ht={class:"description"},$t={class:"description"},gt={class:"description"},kt={key:2,class:A({content:!0})},vt={class:"description"};function bt(e,o,p,d,k,v){const c=s("el-image"),u=s("VideoPlayer"),n=s("el-button"),f=s("el-tooltip"),b=s("font-awesome-icon"),E=s("copy-to-clipboard"),T=s("el-alert");return a(!0),r(V,null,S(e.videos,(y,M)=>(a(),r("div",{key:M,class:"preview"},[l("div",st,[t(c,{src:"https://cdn.acedata.cloud/i80tgn.png",class:"avatar"})]),l("div",at,[l("div",nt,[_(i(e.$t("pika.name.pikaBot"))+" ",1),l("span",it,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",lt,[e.modelValue?.request?.prompt?(a(),r("p",rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(a(),r("span",ct," - ("+i(e.$t("pika.status.pending"))+") ",1)),y?.state==="processing"||y?.state==="pending"||y?.state==="completed"?(a(),r("span",pt," - ("+i(e.$t("pika.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(a(),r("div",dt,[l("div",ut,[t(u,{"model-value":y},null,8,["model-value"])]),y?(a(),r("div",mt,[t(f,{class:"box-item",effect:"dark",content:e.$t("pika.message.downloadVideo"),placement:"top-start"},{default:m(()=>[y?.video_url?(a(),I(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:Dt=>e.onDownload(y?.video_url)},{default:m(()=>[_(i(e.$t("pika.button.download")),1)]),_:2},1032,["onClick"])):h("",!0)]),_:2},1032,["content"])])):h("",!0),t(T,{closable:!1,class:"mt-2 success"},{default:m(()=>[l("p",ft,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(a(),r("div",_t,[t(T,{closable:!1,class:"failure"},{template:m(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[l("p",ht,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),l("p",$t,[t(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("pika.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(E,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),l("p",gt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("pika.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(E,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0),!e.modelValue?.response||y?.state==="processing"||y?.state==="pending"?(a(),r("div",kt,[t(T,{closable:!1,class:"info"},{template:m(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[l("p",vt,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0)])]))),128)}const yt=g(ot,[["render",bt],["__scopeId","data-v-052d49ba"]]),wt=$({name:"RecentPanel",components:{TaskPreview:yt,ElSkeleton:ae,ElSkeletonItem:se},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.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")}}}),It={key:0,class:"tasks"},Et={class:"left"},Vt={class:"main"},St={key:1,class:"tasks"},Tt={key:2,class:"w-full h-full flex items-center justify-center"};function Ct(e,o,p,d,k,v){const c=s("el-skeleton-item"),u=s("el-skeleton"),n=s("task-preview");return a(),r("div",{ref:"panel",class:"panel recent",onScroll:o[0]||(o[0]=(...f)=>e.onHandleScroll&&e.onHandleScroll(...f))},[e.tasks?.items===void 0?(a(),r("div",It,[(a(),r(V,null,S(3,f=>l("div",{key:f,class:"task placeholder"},[l("div",Et,[t(u,{animated:""},{template:m(()=>[t(c,{variant:"image",class:"avatar"})]),_:1})]),l("div",Vt,[t(u,{animated:""},{template:m(()=>[t(c,{variant:"p",class:"title"}),t(c,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),r("div",St,[(a(!0),r(V,null,S(e.tasks?.items,(f,b)=>(a(),I(n,{key:b,"model-value":f,class:"preview"},null,8,["model-value"]))),128))])):h("",!0),e.tasks?.items?.length===0?(a(),r("p",Tt,i(e.$t("pika.message.noTasks")),1)):h("",!0)],544)}const At=g(wt,[["render",Ct],["__scopeId","data-v-1f6b602e"]]),Ut="https://webhook.acedata.cloud/pika",Pt=$({name:"PikaIndex",components:{ConfigPanel:Xe,Layout:pe,RecentPanel:At},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.pika?.status?.getApplications===P.Request},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===P.Request},needApply(){return this.$store.state.pika.status.getApplications===P.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("pika/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pika/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){H.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===K&&w.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:d}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",d),await this.$store.dispatch("pika/getTasks",{limit:o,createdAtMin:p,createdAtMax:d})},async onGenerate(){const e={...this.config,callback_url:Ut},o=this.credential?.token;if(!o){console.error("no token specified");return}w.info(this.$t("pika.message.startingTask")),F.generate(e,{token:o}).then(()=>{w.success(this.$t("pika.message.startTaskSuccess")),this.$store.commit("pika/setConfig",{config:void 0})}).catch(p=>{p?.response?.data?.error?.code===N?w.error(this.$t("pika.message.usedUp")):w.error(this.$t("pika.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Rt(e,o,p,d,k,v){const c=s("config-panel"),u=s("recent-panel"),n=s("layout");return a(),I(n,null,{config:m(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[t(u,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const fo=g(Pt,[["render",Rt],["__scopeId","data-v-bc973743"]]);export{fo as default};
|
|
1
|
+
import{F as R}from"./index.es-CIc56cl6.js";import{E as C}from"./index-qGVWSNsj.js";import{E as O}from"./index-D2hwZIWA.js";import{d as $,h as g,b as r,t as l,k as t,r as U,j as m,l as s,o as a,eo as q,x as i,F as V,v as S,i as I,ep as j,D as _,eq as z,c6 as B,y as h,n as A,er as F,dr as N,de as H,dl as K,dm as P}from"./index-Cgvi9qKr.js";import{I as D}from"./InfoIcon-A1xDvxpg.js";import{E as J}from"./index-GjQsR5KG.js";import{E as G,a as L}from"./index-DTCoUzbs.js";import{a as Q,E as W}from"./index-Df5a9WGp.js";import{E as X}from"./index-CvSpx81L.js";import{E as w}from"./index-BT7WrUPB.js";import{E as Y}from"./index-D402UB4e.js";import{C as Z}from"./CopyToClipboard-RknI4LM3.js";import{s as x}from"./vue-plyr-QZFBikSk.js";import{E as ee}from"./index-Gj7AGill.js";import{E as te}from"./index-BgUK6CFV.js";import{E as oe}from"./index-VD3Emf8V.js";import{a as se,E as ae}from"./index-BOWgmkBj.js";import"./use-form-item-tWhUsWWY.js";import"./index-r5W6hzzQ.js";import"./index-BTalZB4F.js";import"./index-I8eUQ22m.js";import"./typescript-BJQTyG9d.js";import"./strings-CaFLJNhw.js";import"./castArray-DMPMSVhG.js";import"./isEqual-CNVV21LA.js";import"./_initCloneObject-BcH86D07.js";import"./debounce--4Ey-UiG.js";import"./_baseIteratee-EXwBHC6D.js";import"./index-Bg5mlWRY.js";import"./index-C-wmX7EI.js";import"./_baseClone-CSJOYRf5.js";import"./index-BdcqrZwU.js";const ne=$({name:"LayoutPika",components:{ElDrawer:O,ElButton:C,FontAwesomeIcon:R},data(){return{drawer:!1}}}),ie={class:"main"},le={class:"config"},re={class:"result"};function ce(e,o,p,d,k,v){const c=s("font-awesome-icon"),u=s("el-button"),n=s("el-drawer");return a(),r("div",ie,[l("div",le,[U(e.$slots,"config",{},void 0,!0)]),l("div",re,[U(e.$slots,"result",{},void 0,!0)]),t(u,{circle:"",class:"menu",onClick:o[0]||(o[0]=f=>e.drawer=!0)},{default:m(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=f=>e.drawer=f),"with-header":!1,size:"350px"},{default:m(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const pe=g(ne,[["render",ce],["__scopeId","data-v-35c01ab3"]]),de=$({name:"IngredientsSelector",components:{ElSwitch:J,InfoIcon:D},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug("set ingredients",e),e||this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,model:"2.0"})}}},mounted(){this.value===void 0&&(this.value=q)}}),ue={class:"field"},me={class:"title font-bold"};function fe(e,o,p,d,k,v){const c=s("el-switch"),u=s("info-icon");return a(),r("div",ue,[l("h2",me,i(e.$t("pika.name.ingredients")),1),t(c,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value"},null,8,["modelValue"]),t(u,{content:e.$t("pika.description.ingredients"),class:"info"},null,8,["content"])])}const _e=g(de,[["render",fe],["__scopeId","data-v-17c0af5c"]]),he=$({name:"EffectSelector",components:{ElSelect:L,ElOption:G},data(){return{}},computed:{options(){return[{value:"Levitate",label:this.$t("pika.style.effect1")},{value:"Decapitate",label:this.$t("pika.style.effect2")},{value:"Eye-pop",label:this.$t("pika.style.effect3")},{value:"Ta-da",label:this.$t("pika.style.effect4")},{value:"Deflate",label:this.$t("pika.style.effect5")},{value:"Crumble",label:this.$t("pika.style.effect6")},{value:"Dissolve",label:this.$t("pika.style.effect7")},{value:"Squish",label:this.$t("pika.style.effect8")},{value:"Inflate",label:this.$t("pika.style.effect9")},{value:"Melt",label:this.$t("pika.style.effect10")},{value:"Cake-ify",label:this.$t("pika.style.effect11")},{value:"Crush",label:this.$t("pika.style.effect12")},{value:"Explode",label:this.$t("pika.style.effect13")}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,effect:e})}}}}),$e={class:"field"},ge={class:"title font-bold"},ke={class:"float-left"};function ve(e,o,p,d,k,v){const c=s("el-option"),u=s("el-select");return a(),r("div",$e,[l("h2",ge,i(e.$t("pika.name.effect")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select"),clearable:""},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.label,value:n.value},{default:m(()=>[l("span",ke,i(n.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=g(he,[["render",ve],["__scopeId","data-v-d1c54475"]]),ye=$({name:"IngredientsModelSelector",components:{ElRadioButton:W,ElRadioGroup:Q},data(){return{options:[{label:this.$t("pika.button.precise"),value:"precise"},{label:this.$t("pika.button.creative"),value:"creative"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||(this.value=j)}}),we={class:"field"},Ie={class:"title font-bold"};function Ee(e,o,p,d,k,v){const c=s("el-radio-button"),u=s("el-radio-group");return a(),r("div",we,[l("h2",Ie,i(e.$t("pika.name.ingredientsModel")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),size:"small",class:"quality"},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.value},{default:m(()=>[_(i(n.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const Ve=g(ye,[["render",Ee],["__scopeId","data-v-b948551f"]]),Se=$({name:"ModelSelector",components:{ElSelect:L,ElOption:G},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"2.0",label:"2.0"},{value:"1.5",label:"1.5"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||(this.value=z)}}),Te={class:"field"},Ce={class:"title font-bold"};function Ae(e,o,p,d,k,v){const c=s("el-option"),u=s("el-select");return a(),r("div",Te,[l("h2",Ce,i(e.$t("pika.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=g(Se,[["render",Ae],["__scopeId","data-v-7b2e870a"]]),Pe=$({name:"ImageUrlInput",components:{ElUpload:X,ElButton:C,InfoIcon:D},data(){return{fileList:[],uploadUrl:B()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.pika?.config?.image_url},set(){const e=this.urls?.[0];this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){w.warning(this.$t("pika.message.uploadStartImageExceed"))},onError(){w.error(this.$t("pika.message.uploadStartImageError"))},async onRemove(){w.error(this.$t("pika.message.uploadStartImageError"))},onSetStartImageUrl(){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),Re={class:"field"},De={class:"title font-bold"},Ge={class:"upload-wrapper"};function Le(e,o,p,d,k,v){const c=s("el-button"),u=s("el-upload"),n=s("info-icon");return a(),r("div",Re,[l("h2",De,i(e.$t("pika.name.imageUrl")),1),l("div",Ge,[t(u,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=f=>e.fileList=f),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:3,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{default:m(()=>[t(c,{size:"small",type:"primary",round:""},{default:m(()=>[_(i(e.$t("pika.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])]),t(n,{content:e.$t("pika.description.imageUrl"),class:"info"},null,8,["content"])])}const Me=g(Pe,[["render",Le],["__scopeId","data-v-55a9552e"]]),Oe="",qe=$({name:"PromptInput",components:{ElInput:Y,InfoIcon:D},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Oe)}}),je={class:"field"},ze={class:"box"},Be={class:"title font-bold"};function Fe(e,o,p,d,k,v){const c=s("info-icon"),u=s("el-input");return a(),r("div",je,[l("div",ze,[l("h2",Be,i(e.$t("pika.name.prompt")),1),t(c,{content:e.$t("pika.description.prompt"),class:"info"},null,8,["content"])]),t(u,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pika.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ne=g(qe,[["render",Fe],["__scopeId","data-v-b94e7a3e"]]),He=$({name:"PresetPanel",components:{ImageUrlInput:Me,ElButton:C,FontAwesomeIcon:R,PromptInput:Ne,IngredientsSelector:_e,IngredientsModelSelector:Ve,ModelSelector:Ue,EffectSelector:be},emits:["generate"],computed:{config(){return this.$store.state.pika?.config}},methods:{onGenerate(){this.$emit("generate")}}}),Ke={class:"panel"},Je={class:"config"},Qe={class:"actions"};function We(e,o,p,d,k,v){const c=s("prompt-input"),u=s("model-selector"),n=s("ingredients-selector"),f=s("effect-selector"),b=s("image-url-input"),E=s("ingredients-model-selector"),T=s("font-awesome-icon"),y=s("el-button");return a(),r("div",Ke,[l("div",Je,[t(c,{class:"mb-4"}),t(u,{class:"mb-4"}),t(n,{class:"mb-4"}),t(f,{class:"mb-4"}),e.config?.ingredients?(a(),I(b,{key:0,class:"mb-4"})):h("",!0),e.config?.ingredients?(a(),I(E,{key:1,class:"mb-4"})):h("",!0),l("div",Qe,[t(y,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[t(T,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("pika.button.generate")),1)]),_:1},8,["onClick"])])])])}const Xe=g(He,[["render",We],["__scopeId","data-v-53b25bc4"]]),Ye=$({name:"VideoPlayer",components:{VuePlyr:x},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),Ze=["data-poster"],xe=["src"];function et(e,o,p,d,k,v){const c=s("vue-plyr");return a(),r("div",null,[t(c,{options:e.options,class:"video"},{default:m(()=>[l("video",{controls:"",crossorigin:"",playsinline:"","data-poster":e.modelValue?.image_url},[l("source",{size:"1080",src:e.modelValue?.video_url,type:"video/mp4"},null,8,xe)],8,Ze)]),_:1},8,["options"])])}const tt=g(Ye,[["render",et],["__scopeId","data-v-fc420430"]]),ot=$({name:"TaskPreview",components:{ElImage:oe,CopyToClipboard:Z,FontAwesomeIcon:R,ElAlert:te,VideoPlayer:tt,ElTooltip:ee,ElButton:C},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(p=>{let d=p;o&&(d.action=o),e.push(d)}),e}},methods:{onDownload(e){console.log("on download"),window.open(e,"_blank")},onReload(e){const o=e.target,p=new URL(o.src),d=p.searchParams.get("retry");if(!d)p.searchParams.set("retry","1");else if(parseInt(d)<2)p.searchParams.set("retry",(parseInt(d)+1).toString());else return;o.src=p.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),st={class:"left"},at={class:"main"},nt={class:"bot"},it={class:"datetime"},lt={class:"info"},rt={key:0,class:"prompt mt-2"},ct={key:0},pt={key:1},dt={key:0,class:A({content:!0,failed:!0})},ut={class:"image-wrapper"},mt={key:0,class:A({operations:!0,"mt-2":!0})},ft={class:"description"},_t={key:1,class:A({content:!0})},ht={class:"description"},$t={class:"description"},gt={class:"description"},kt={key:2,class:A({content:!0})},vt={class:"description"};function bt(e,o,p,d,k,v){const c=s("el-image"),u=s("VideoPlayer"),n=s("el-button"),f=s("el-tooltip"),b=s("font-awesome-icon"),E=s("copy-to-clipboard"),T=s("el-alert");return a(!0),r(V,null,S(e.videos,(y,M)=>(a(),r("div",{key:M,class:"preview"},[l("div",st,[t(c,{src:"https://cdn.acedata.cloud/i80tgn.png",class:"avatar"})]),l("div",at,[l("div",nt,[_(i(e.$t("pika.name.pikaBot"))+" ",1),l("span",it,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",lt,[e.modelValue?.request?.prompt?(a(),r("p",rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(a(),r("span",ct," - ("+i(e.$t("pika.status.pending"))+") ",1)),y?.state==="processing"||y?.state==="pending"||y?.state==="completed"?(a(),r("span",pt," - ("+i(e.$t("pika.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(a(),r("div",dt,[l("div",ut,[t(u,{"model-value":y},null,8,["model-value"])]),y?(a(),r("div",mt,[t(f,{class:"box-item",effect:"dark",content:e.$t("pika.message.downloadVideo"),placement:"top-start"},{default:m(()=>[y?.video_url?(a(),I(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:Dt=>e.onDownload(y?.video_url)},{default:m(()=>[_(i(e.$t("pika.button.download")),1)]),_:2},1032,["onClick"])):h("",!0)]),_:2},1032,["content"])])):h("",!0),t(T,{closable:!1,class:"mt-2 success"},{default:m(()=>[l("p",ft,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(a(),r("div",_t,[t(T,{closable:!1,class:"failure"},{template:m(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[l("p",ht,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),l("p",$t,[t(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("pika.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(E,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),l("p",gt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("pika.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(E,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0),!e.modelValue?.response||y?.state==="processing"||y?.state==="pending"?(a(),r("div",kt,[t(T,{closable:!1,class:"info"},{template:m(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[l("p",vt,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0)])]))),128)}const yt=g(ot,[["render",bt],["__scopeId","data-v-052d49ba"]]),wt=$({name:"RecentPanel",components:{TaskPreview:yt,ElSkeleton:ae,ElSkeletonItem:se},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.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")}}}),It={key:0,class:"tasks"},Et={class:"left"},Vt={class:"main"},St={key:1,class:"tasks"},Tt={key:2,class:"w-full h-full flex items-center justify-center"};function Ct(e,o,p,d,k,v){const c=s("el-skeleton-item"),u=s("el-skeleton"),n=s("task-preview");return a(),r("div",{ref:"panel",class:"panel recent",onScroll:o[0]||(o[0]=(...f)=>e.onHandleScroll&&e.onHandleScroll(...f))},[e.tasks?.items===void 0?(a(),r("div",It,[(a(),r(V,null,S(3,f=>l("div",{key:f,class:"task placeholder"},[l("div",Et,[t(u,{animated:""},{template:m(()=>[t(c,{variant:"image",class:"avatar"})]),_:1})]),l("div",Vt,[t(u,{animated:""},{template:m(()=>[t(c,{variant:"p",class:"title"}),t(c,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),r("div",St,[(a(!0),r(V,null,S(e.tasks?.items,(f,b)=>(a(),I(n,{key:b,"model-value":f,class:"preview"},null,8,["model-value"]))),128))])):h("",!0),e.tasks?.items?.length===0?(a(),r("p",Tt,i(e.$t("pika.message.noTasks")),1)):h("",!0)],544)}const At=g(wt,[["render",Ct],["__scopeId","data-v-1f6b602e"]]),Ut="https://webhook.acedata.cloud/pika",Pt=$({name:"PikaIndex",components:{ConfigPanel:Xe,Layout:pe,RecentPanel:At},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.pika?.status?.getApplications===P.Request},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===P.Request},needApply(){return this.$store.state.pika.status.getApplications===P.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("pika/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pika/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){H.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===K&&w.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:d}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",d),await this.$store.dispatch("pika/getTasks",{limit:o,createdAtMin:p,createdAtMax:d})},async onGenerate(){const e={...this.config,callback_url:Ut},o=this.credential?.token;if(!o){console.error("no token specified");return}w.info(this.$t("pika.message.startingTask")),F.generate(e,{token:o}).then(()=>{w.success(this.$t("pika.message.startTaskSuccess")),this.$store.commit("pika/setConfig",{config:void 0})}).catch(p=>{p?.response?.data?.error?.code===N?w.error(this.$t("pika.message.usedUp")):w.error(this.$t("pika.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Rt(e,o,p,d,k,v){const c=s("config-panel"),u=s("recent-panel"),n=s("layout");return a(),I(n,null,{config:m(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[t(u,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const fo=g(Pt,[["render",Rt],["__scopeId","data-v-bc973743"]]);export{fo as default};
|