@acedatacloud/nexior 3.20.0 → 3.20.2
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-Dp5SxRsQ.js → Auth-reb_cTTa.js} +1 -1
- package/dist/assets/{BotPlaceholder-C-r3HBsb.js → BotPlaceholder-D2NiVhQ8.js} +1 -1
- package/dist/assets/{Callback-CMbVwekp.js → Callback-CVUgDQem.js} +1 -1
- package/dist/assets/{Console-sgqybV9e.js → Console-Ca63tau1.js} +1 -1
- package/dist/assets/{Conversation-C47wQMzC.js → Conversation-2A8SBfUC.js} +2 -2
- package/dist/assets/{CopyToClipboard-D10YM_7m.js → CopyToClipboard-DvCoKPTQ.js} +1 -1
- package/dist/assets/{Detail-nFXkCo1c.js → Detail-CvhtIeRy.js} +1 -1
- package/dist/assets/{EditArray-DSLzgbUV.js → EditArray-MMbURpBP.js} +1 -1
- package/dist/assets/{Extra-DuTFCrI1.js → Extra-IXS2bWS_.js} +1 -1
- package/dist/assets/{FilePreview-_imIFzEr.js → FilePreview-BJ3vUSDz.js} +1 -1
- package/dist/assets/{History-Cfq_nM0O.js → History-Aqy3xZW2.js} +1 -1
- package/dist/assets/{ImagePreview-DpKPZpzN.js → ImagePreview-B5tjfDBl.js} +1 -1
- package/dist/assets/{ImageWrapper-CJTWD-PJ.js → ImageWrapper-uh4-bLz8.js} +1 -1
- package/dist/assets/{Index-CKUhP8Wa.js → Index-B4R54zVR.js} +1 -1
- package/dist/assets/{Index-BBA2fb8p.js → Index-B8Hmq-H5.js} +1 -1
- package/dist/assets/{Index-C66oDpzY.js → Index-BYjJbLBL.js} +1 -1
- package/dist/assets/{Index-BpS5nKKm.js → Index-C3GywBR-.js} +1 -1
- package/dist/assets/{Index--HrzVZr-.js → Index-CKPw1XWi.js} +1 -1
- package/dist/assets/{Index-aibBgpds.js → Index-CgHCD8F_.js} +1 -1
- package/dist/assets/{Index-Und3gfGe.css → Index-Cj_OO_Dg.css} +1 -1
- package/dist/assets/{Index-Bj3l491h.js → Index-CppB2_PP.js} +1 -1
- package/dist/assets/{Index-5q6HTX0d.js → Index-Cti0GnFj.js} +1 -1
- package/dist/assets/{Index-B6VOYE6t.js → Index-D6dzOan0.js} +1 -1
- package/dist/assets/{Index-CPso7j9R.js → Index-DKgwZx0k.js} +1 -1
- package/dist/assets/{Index-Dh1XasMQ.js → Index-DO2VQGJq.js} +1 -1
- package/dist/assets/{Index-r8HFp0Fa.js → Index-DSFEw-bV.js} +1 -1
- package/dist/assets/Index-DTU7mbji.js +1 -0
- package/dist/assets/Index-DWoukX8V.css +1 -0
- package/dist/assets/Index-DcOK3IHr.js +1 -0
- package/dist/assets/{Index-DNCwSGrb.js → Index-GMH2vdgm.js} +1 -1
- package/dist/assets/{Index-B9G3QABi.js → Index-_9Ja3xG1.js} +1 -1
- package/dist/assets/{InfoIcon-DJgGdcM4.js → InfoIcon-LF-0__cu.js} +1 -1
- package/dist/assets/{Invitees-KgSZx4Uj.js → Invitees-mvzOVLg1.js} +1 -1
- package/dist/assets/{List-DYVn4yzw.js → List-BrEN_ox4.js} +1 -1
- package/dist/assets/{List-B-AP-_iP.js → List-D3Bnx2me.js} +1 -1
- package/dist/assets/{List-C_U16Ogh.js → List-DWosUHeV.js} +1 -1
- package/dist/assets/{Login-BDLFzWKY.js → Login-Cqu7_Y9i.js} +1 -1
- package/dist/assets/{Main-w_kAoQvr.js → Main-dlRoCvwJ.js} +1 -1
- package/dist/assets/{Navigator-Cir0Tory.js → Navigator-B4f_FBsX.js} +1 -1
- package/dist/assets/{NoTasks-BAFsp5y-.js → NoTasks-7U68u4-g.js} +1 -1
- package/dist/assets/{Pagination-yeTIoBfb.js → Pagination-uDw6u3ix.js} +1 -1
- package/dist/assets/{Status-C1VcHGOO.js → Status-BEXW_X3u.js} +1 -1
- package/dist/assets/{Subscribe-D4gyA5GB.js → Subscribe-DQUWyRIv.js} +1 -1
- package/dist/assets/{VideoPlayer-DAFte4NK.js → VideoPlayer-DAzEIQG8.js} +1 -1
- package/dist/assets/{_baseClone-DfZip4NQ.js → _baseClone-CkMTtQ9D.js} +1 -1
- package/dist/assets/{_baseIteratee-DVuly0os.js → _baseIteratee-FPmiAqiQ.js} +1 -1
- package/dist/assets/{_initCloneObject-BNJJfRAs.js → _initCloneObject-DBpc_lNE.js} +1 -1
- package/dist/assets/{castArray-F6UtPTG2.js → castArray-CCwFp0WG.js} +1 -1
- package/dist/assets/{debounce-DUU4g0Vw.js → debounce-BdbhCXbs.js} +1 -1
- package/dist/assets/{distribution-B-aGOgvr.js → distribution-D4pz8Isc.js} +1 -1
- package/dist/assets/{dropdown-Dk5TLA40.js → dropdown-qurKCg-v.js} +1 -1
- package/dist/assets/{index-ZR2WC3y6.js → index-B0lmXmn1.js} +1 -1
- package/dist/assets/{index-Dgon4P8g.js → index-B1ltQzXY.js} +1 -1
- package/dist/assets/{index-2wYQGjlL.js → index-BNsx4-7B.js} +1 -1
- package/dist/assets/{index-CkGfGBH1.js → index-BPDafUhu.js} +1 -1
- package/dist/assets/{index-fKcIRqyn.js → index-Bbv8AcsL.js} +1 -1
- package/dist/assets/{index-IUOnFE33.js → index-BquyEGf6.js} +34 -34
- package/dist/assets/{index-C6pJT5Z8.js → index-BwG5X1Uf.js} +1 -1
- package/dist/assets/{index-Br08pmUn.js → index-BwryP3xv.js} +1 -1
- package/dist/assets/{index-D_GDwTBQ.js → index-C4dxWzTO.js} +1 -1
- package/dist/assets/{index-IPLndquX.js → index-C80KlKYJ.js} +1 -1
- package/dist/assets/{index-v3LBqa1e.js → index-C9eZxc-b.js} +1 -1
- package/dist/assets/{index-DLEpULvj.js → index-CGd3r2k1.js} +1 -1
- package/dist/assets/{index-CcIQaw9t.js → index-CIHcknCS.js} +1 -1
- package/dist/assets/{index-dSqsT--9.js → index-CN_utBEJ.js} +1 -1
- package/dist/assets/{index-yLAe503u.js → index-CPI8vpXJ.js} +1 -1
- package/dist/assets/{index-3NDJx6NE.js → index-CYVG-TAg.js} +1 -1
- package/dist/assets/{index-778MgwIZ.js → index-CiLZ_bC6.js} +1 -1
- package/dist/assets/{index-1fW-uAwf.js → index-Cwls0ZAN.js} +1 -1
- package/dist/assets/{index-Dun7_PXv.js → index-D5Tzz_9x.js} +1 -1
- package/dist/assets/{index-CkSqGmwg.js → index-DMcrRoGp.js} +1 -1
- package/dist/assets/{index-BlfhaCBe.js → index-DO2Q3h3U.js} +1 -1
- package/dist/assets/{index-aLPamwRW.js → index-D_OfWunA.js} +1 -1
- package/dist/assets/{index-D9ZkPdjT.js → index-DcHF8gEn.js} +1 -1
- package/dist/assets/{index-CwsOuzih.js → index-Dns87zhU.js} +1 -1
- package/dist/assets/{index-ayOK3esB.js → index-Dq4LiRTf.js} +1 -1
- package/dist/assets/{index-DyhtTOcR.js → index-Dt1y58on.js} +1 -1
- package/dist/assets/{index-BXh5SszT.js → index-Dvf0QjP1.js} +1 -1
- package/dist/assets/{index-DSNMx2cO.js → index-FdU7uO_k.js} +1 -1
- package/dist/assets/{index-CF5Kx3lT.js → index-bP-68lHF.js} +1 -1
- package/dist/assets/{index.es-CcpVHvSx.js → index.es-p3WzQOq6.js} +1 -1
- package/dist/assets/{isEqual-DT9q1wUz.js → isEqual-CD5SlWKj.js} +1 -1
- package/dist/assets/{isPlainObject-_HKxhcoH.js → isPlainObject-DvwkK7xb.js} +1 -1
- package/dist/assets/{order-DohWanVo.js → order-wD86u0Bp.js} +1 -1
- package/dist/assets/{price-BmpkejfA.js → price-QrgS9vBm.js} +1 -1
- package/dist/assets/{strings-ByIYpJrS.js → strings-Bbr3e8ju.js} +1 -1
- package/dist/assets/{typescript-CrbS__OB.js → typescript-C_0I_mxX.js} +1 -1
- package/dist/assets/{use-form-item-DNI3l--g.js → use-form-item-n2htyTGx.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/Index-BfXX3_X5.js +0 -1
- package/dist/assets/Index-m5GlW6Tw.css +0 -1
- package/dist/assets/Index-r39yB5QH.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as K}from"./index.es-CcpVHvSx.js";import{E as Z}from"./index-CkGfGBH1.js";import{E as de}from"./index-ZR2WC3y6.js";import{am as pe,as as me,bL as fe,an as ae,cc as he,_ as _e,d as b,a as $e,ao as ve,c as F,bk as ge,bq as ke,az as le,b as h,o as l,i as w,r as U,f as oe,e as V,j as $,bb as re,E as R,n as ye,g as we,h as E,t as r,k as s,l as c,f2 as se,x as v,F as z,v as N,f3 as H,c9 as be,D as I,f4 as Q,f5 as Y,y,J as x,cQ as ee,f6 as B,bU as Ce,dq as q,ak as P,f7 as G,aq as Se,K as Ae,f8 as Le,dh as Ee,dp as Ve}from"./index-IUOnFE33.js";import{E as ce}from"./index-CkSqGmwg.js";import{E as je,a as Fe}from"./index-fKcIRqyn.js";import{I as M}from"./InfoIcon-DJgGdcM4.js";import{E as Te}from"./index-DLEpULvj.js";import{E as L}from"./index-Dgon4P8g.js";import{E as X}from"./index-BlfhaCBe.js";import{E as Pe,a as ue}from"./index-C6pJT5Z8.js";import{E as J}from"./index-DSNMx2cO.js";import{C as Ie,N as Ue}from"./NoTasks-BAFsp5y-.js";import{a as ze}from"./price-BmpkejfA.js";import{E as De,a as Re,b as Ge}from"./index-Br08pmUn.js";import{E as Me}from"./index-1fW-uAwf.js";import{E as Oe}from"./index-v3LBqa1e.js";import{E as Be,a as qe}from"./index-CwsOuzih.js";import"./use-form-item-DNI3l--g.js";import"./index-r5W6hzzQ.js";import"./index-aLPamwRW.js";import"./index-BXh5SszT.js";import"./typescript-CrbS__OB.js";import"./strings-ByIYpJrS.js";import"./castArray-F6UtPTG2.js";import"./isEqual-DT9q1wUz.js";import"./_initCloneObject-BNJJfRAs.js";import"./debounce-DUU4g0Vw.js";import"./_baseIteratee-DVuly0os.js";import"./index-D_GDwTBQ.js";import"./index-D9ZkPdjT.js";import"./_baseClone-DfZip4NQ.js";import"./index-3NDJx6NE.js";import"./dropdown-Dk5TLA40.js";const We=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Ne={error:e=>e instanceof Event},He=b({name:"ElAvatar"}),Ke=b({...He,props:We,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ve(!1),u=F(()=>{const{size:n,icon:m,shape:k}=i,f=[o.b()];return ge(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),k&&f.push(o.m(k)),f}),d=F(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function _(n){a.value=!0,t("error",n)}return(n,m)=>(l(),h("span",{class:ye(V(u)),style:oe(V(d))},[(n.src||n.srcSet)&&!a.value?(l(),h("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(V(p)),onError:_},null,44,["src","alt","srcset"])):n.icon?(l(),w(V(R),{key:1},{default:$(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ze=_e(Ke,[["__file","avatar.vue"]]);const xe=we(Ze),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:Z,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main flex flex-row flex-1"},Qe={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},Ye={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},et={class:"preview h-full w-[300px] flex flex-col"};function tt(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),_=c("el-drawer");return l(),h("div",Je,[r("div",Qe,[U(e.$slots,"config",{},void 0,!0)]),r("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),r("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=E(Xe,[["render",tt],["__scopeId","data-v-6cc632e5"]]),st=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"},{label:this.$t("suno.model.model45plus"),value:"chirp-v4-5-plus"},{label:this.$t("suno.model.model5"),value:"chirp-v5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,a,u){const d=c("el-switch"),p=c("el-option"),_=c("el-select");return l(),h("div",nt,[r("h2",it,v(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(l(!0),h(z,null,N(e.options,n=>(l(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=E(st,[["render",at],["__scopeId","data-v-5ebe40d6"]]),rt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:Z,InfoIcon:M,FontAwesomeIcon:K},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),H.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),_=c("el-button"),n=c("el-upload");return l(),h("div",ct,[r("div",ut,[r("div",dt,[r("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=E(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ht="",_t=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:M},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},kt={class:"title font-bold"},yt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),_=c("el-input");return l(),h("div",$t,[r("div",vt,[r("div",gt,[r("h2",kt,v(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",yt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(_,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=E(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",At=b({name:"LyricInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),Lt={class:"field"},Et={class:"box"},Vt={class:"title font-bold"};function jt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Lt,[r("div",Et,[r("h2",Vt,v(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Ft=E(At,[["render",jt],["__scopeId","data-v-99dfded8"]]),Tt=b({name:"StyleInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},It={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Pt,[r("div",It,[r("h2",Ut,v(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Dt=E(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Rt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Mt={class:"title-container"},Ot={class:"title font-bold"};function Bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Gt,[r("div",Mt,[r("h2",Ot,v(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const qt=E(Rt,[["render",Bt],["__scopeId","data-v-ce70fe34"]]);function D(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const Wt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:R,ElInputNumber:Pe,VideoPlay:Y,VideoPause:Q},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:D,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Nt={class:"field"},Ht={class:"box"},Kt={class:"title font-bold"},Zt={class:"input-wrapper"},xt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Qt={class:"info"},Yt={class:"title"},eo={class:"style"};function to(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),_=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=ee("loading");return l(),h("div",Nt,[r("div",Ht,[r("h2",Kt,v(e.$t("suno.name.extend")),1),r("div",Zt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",xt,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[x((l(),h("div",Xt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(_)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(l(),h("div",Jt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),r("div",Qt,[r("h2",Yt,v(e.audio?.title),1),r("p",eo,v(e.audio?.style),1)])])):y("",!0)])])}const oo=E(Wt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:R,VideoPlay:Y,VideoPause:Q},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:D,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function fo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),h("div",no,[r("div",io,[r("h2",ao,v(e.$t("suno.name.cover")),1)]),r("div",lo,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[x((l(),h("div",ro,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(_,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(_,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(l(),h("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),r("div",uo,[r("h2",po,v(e.audio?.title),1),r("p",mo,v(e.audio?.style),1)])])):y("",!0)])])}const ho=E(so,[["render",fo],["__scopeId","data-v-06640216"]]),_o=b({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:Ft,StyleInput:Dt,TitleInput:qt,ExtendFromInput:oo,CoverFromInput:ho,UploadAudio:ft,FontAwesomeIcon:K,ElButton:Z,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return ze(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ko(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),_=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),f=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),h("div",$o,[r("div",vo,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(l(),w(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(l(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(l(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(l(),w(f,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):y("",!0)]),r("div",go,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=E(_o,[["render",ko],["__scopeId","data-v-b9fab929"]]);var W={exports:{}},wo=W.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var f=new XMLHttpRequest;f.open("GET",n),f.responseType="blob",f.onload=function(){_(f.response,m,k)},f.onerror=function(){console.error("could not download file")},f.send()}function a(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function u(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof B=="object"&&B.global===B?B:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),_=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var f=d.URL||d.webkitURL,C=document.createElement("a");m=m||n.name||"download",C.download=m,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,m,k):u(C,C.target="_blank")):(C.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(a(n))o(n,m,k);else{var f=document.createElement("a");f.href=n,f.target="_blank",setTimeout(function(){u(f)})}}:function(n,m,k,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var C=n.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},A.readAsDataURL(n)}else{var O=d.URL||d.webkitURL,g=O.createObjectURL(n);f?f.location=g:location.href=g,f=null,setTimeout(function(){O.revokeObjectURL(g)},4e4)}});d.saveAs=_.saveAs=_,e.exports=_})}(W)),W.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:J,ElIcon:R,ElTooltip:Me,ElButton:Z,FontAwesomeIcon:K,VideoPlay:Y,VideoPause:Q,ElDropdown:Ge,ElDropdownMenu:Re,ElDropdownItem:De,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===q.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:D,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{Co.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Lo={class:"task"},Eo=["onClick"],Vo={class:"left"},jo=["onClick"],Fo=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Io={class:"title"},Uo={class:"style"},zo={class:"right"},Do={class:"el-dropdown-link"},Ro={class:"flex items-center min-w-[120px]"},Go={class:"el-dropdown-link"};function Mo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),f=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),O=ee("loading");return l(),h("div",Lo,[(l(!0),h(z,null,N(e.audios,g=>(l(),h("div",{key:g.id,class:"audio",onClick:P(S=>e.onClick(g),["stop"])},[x((l(),h("div",Vo,[s(d,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(g),["stop"])},[s(_,null,{default:$(()=>[s(p)]),_:1})],8,jo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(g),["stop"])},[s(_,null,{default:$(()=>[s(n)]),_:1})],8,Fo)):y("",!0),g?.duration?(l(),h("div",To,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[O,!g?.audio_url]]),r("div",Po,[r("h2",Io,v(g?.title),1),r("p",Uo,v(g?.style),1)]),r("div",zo,[g?.audio_url?(l(),w(m,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[s(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(g)},{default:$(()=>[r("div",Ro,[e.isFetchingVideoUrl?(l(),w(_,{key:0,class:"is-loading mr-2"},{default:$(()=>[s(C)]),_:1})):y("",!0),r("span",null,v(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,g?.audio_url),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[r("span",Do,[s(f,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(g.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(j,{onClick:P(S=>e.onCover(g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(g?.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[r("span",Go,[s(f,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Eo))),128))])}const Oo=E(Ao,[["render",Mo]]),Bo={class:"player-slider"},qo=b({__name:"PlayerSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,p)=>(l(),h("div",Bo,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=_=>i.value=_),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),Wo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},Ho=["src"],Ko={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},xo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),h("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(Wo)},null,8,Ho),r("div",Ko,[r("div",Zo,[r("div",xo,[r("span",null,v(i.value?.title||"Music"),1),r("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},es=b({__name:"PlayerAction",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),h("div",Qo,[r("span",Yo,v(V(D)(i.value))+" / "+v(V(D)(o.value)),1)]))}});var ts={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function os(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function ss(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var ns=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=os(),p=Se(ns,ts);return function(){var _=u.size,n=u.strokeWidth,m=u.strokeLinecap,k=u.strokeLinejoin,f=u.theme,C=u.fill,j=u.spin,T=ss(d,{size:_,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:f,fill:C},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),j&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(T)])}}};return o}const is=te("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),as=te("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ls=te("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),rs={class:"player-volume flex flex-col items-center pt-2"},cs={class:"text-sm mt-3"},us=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),h("div",rs,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=p=>i.value=p),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",cs,v(i.value),1)]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=b({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),h("div",ds,[s(ie,{icon:o.value?.state==="playing"?V(is):V(as),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(V(Oe),{placement:"top",width:"50px",trigger:"click"},{reference:$(()=>[s(ie,{icon:V(ls),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},fs={class:"flex grow px-5 items-center"},hs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=b({__name:"Player",setup(e){return(t,i)=>(l(),h("div",ms,[s(qo),r("div",fs,[r("div",hs,[s(Jo)]),r("div",_s,[s(ps)]),r("div",$s,[s(es)])])]))}}),gs=b({name:"RecentPanel",components:{ElSkeletonItem:qe,ElSkeleton:Be,TaskPreview:Oo,Player:vs,NoTasks:Ue},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),ks={key:0,class:"tasks"},ys={class:"left w-[70px] p-[10px] flex items-center"},ws={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},bs={key:2,class:"w-full flex-1 flex items-center justify-center"},Cs={class:"h-20"};function Ss(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),_=c("task-preview"),n=c("no-tasks"),m=c("player");return l(),h(z,null,[e.tasks?.items===void 0?(l(),h("div",ks,[(l(),h(z,null,N(3,k=>r("div",{key:k,class:"flex"},[r("div",ys,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",ws,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),h("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[(l(!0),h(z,null,N(e.tasks?.items,(k,f)=>(l(),w(_,{key:f,"model-value":k,class:"preview"},null,8,["model-value"]))),128))],32)):y("",!0),e.tasks?.items?.length===0?(l(),h("div",bs,[s(n)])):y("",!0),x(r("div",Cs,[s(m)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(gs,[["render",Ss]]),Ls=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:xe,ElIcon:R},computed:{audio(){return this.$store.state.suno?.audio}}}),Es={key:0,class:"size-full overflow-hidden"},Vs={class:"relative h-[300px]"},js={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Fs={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Ts={class:"p-4"},Ps={class:"flex items-center font-bold mb-2"},Is={class:"text-[var(--el-text-color-regular)] mb-2"},Us={class:"text-xs text-[var(--el-text-color-regular)]"},zs={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Ds={key:1,class:"w-full h-full"};function Rs(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),_=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),h("div",Es,[r("div",Vs,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:$(()=>[r("div",js,[s(p,{class:"text-3xl"},{default:$(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Fs,v(e.audio?.title),1)]),r("div",Ts,[r("div",Ps,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,v(e.audio?.title),1)]),r("p",Is,v(e.audio?.style),1),r("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),r("div",zs,[r("p",null,v(e.audio?.lyric),1)])])])):(l(),h("div",Ds))}const Gs=E(Ls,[["render",Rs]]),Ms="https://webhook.acedata.cloud/suno",Os=b({name:"SunoIndex",components:{Layout:ot,ConfigPanel:yo,RecentPanel:As,PreviewPanel:Gs},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===q.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===q.Request},needApply(){return this.$store.state.suno.status.getApplications===q.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ms},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Bs(e,t,i,o,a,u){const d=c("config-panel"),p=c("recent-panel"),_=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:$(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(_)]),_:1})}const Cn=E(Os,[["render",Bs],["__scopeId","data-v-f5721d95"]]);export{Cn as default};
|
|
1
|
+
import{F as K}from"./index.es-p3WzQOq6.js";import{E as Z}from"./index-BPDafUhu.js";import{E as de}from"./index-B0lmXmn1.js";import{am as pe,as as me,bL as fe,an as ae,cc as he,_ as _e,d as b,a as $e,ao as ve,c as F,bk as ge,bq as ke,az as le,b as h,o as l,i as w,r as U,f as oe,e as V,j as $,bb as re,E as R,n as ye,g as we,h as E,t as r,k as s,l as c,f2 as se,x as v,F as z,v as N,f3 as H,c9 as be,D as I,f4 as Q,f5 as Y,y,J as x,cQ as ee,f6 as B,bU as Ce,dq as q,ak as P,f7 as G,aq as Se,K as Ae,f8 as Le,dh as Ee,dp as Ve}from"./index-BquyEGf6.js";import{E as ce}from"./index-DMcrRoGp.js";import{E as je,a as Fe}from"./index-Bbv8AcsL.js";import{I as M}from"./InfoIcon-LF-0__cu.js";import{E as Te}from"./index-CGd3r2k1.js";import{E as L}from"./index-B1ltQzXY.js";import{E as X}from"./index-DO2Q3h3U.js";import{E as Pe,a as ue}from"./index-BwG5X1Uf.js";import{E as J}from"./index-FdU7uO_k.js";import{C as Ie,N as Ue}from"./NoTasks-7U68u4-g.js";import{a as ze}from"./price-QrgS9vBm.js";import{E as De,a as Re,b as Ge}from"./index-BwryP3xv.js";import{E as Me}from"./index-Cwls0ZAN.js";import{E as Oe}from"./index-C9eZxc-b.js";import{E as Be,a as qe}from"./index-Dns87zhU.js";import"./use-form-item-n2htyTGx.js";import"./index-r5W6hzzQ.js";import"./index-D_OfWunA.js";import"./index-Dvf0QjP1.js";import"./typescript-C_0I_mxX.js";import"./strings-Bbr3e8ju.js";import"./castArray-CCwFp0WG.js";import"./isEqual-CD5SlWKj.js";import"./_initCloneObject-DBpc_lNE.js";import"./debounce-BdbhCXbs.js";import"./_baseIteratee-FPmiAqiQ.js";import"./index-C4dxWzTO.js";import"./index-DcHF8gEn.js";import"./_baseClone-CkMTtQ9D.js";import"./index-CYVG-TAg.js";import"./dropdown-qurKCg-v.js";const We=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Ne={error:e=>e instanceof Event},He=b({name:"ElAvatar"}),Ke=b({...He,props:We,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ve(!1),u=F(()=>{const{size:n,icon:m,shape:k}=i,f=[o.b()];return ge(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),k&&f.push(o.m(k)),f}),d=F(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function _(n){a.value=!0,t("error",n)}return(n,m)=>(l(),h("span",{class:ye(V(u)),style:oe(V(d))},[(n.src||n.srcSet)&&!a.value?(l(),h("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(V(p)),onError:_},null,44,["src","alt","srcset"])):n.icon?(l(),w(V(R),{key:1},{default:$(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ze=_e(Ke,[["__file","avatar.vue"]]);const xe=we(Ze),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:Z,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main flex flex-row flex-1"},Qe={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},Ye={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},et={class:"preview h-full w-[300px] flex flex-col"};function tt(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),_=c("el-drawer");return l(),h("div",Je,[r("div",Qe,[U(e.$slots,"config",{},void 0,!0)]),r("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),r("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=E(Xe,[["render",tt],["__scopeId","data-v-6cc632e5"]]),st=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"},{label:this.$t("suno.model.model45plus"),value:"chirp-v4-5-plus"},{label:this.$t("suno.model.model5"),value:"chirp-v5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,a,u){const d=c("el-switch"),p=c("el-option"),_=c("el-select");return l(),h("div",nt,[r("h2",it,v(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(l(!0),h(z,null,N(e.options,n=>(l(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=E(st,[["render",at],["__scopeId","data-v-5ebe40d6"]]),rt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:Z,InfoIcon:M,FontAwesomeIcon:K},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),H.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),_=c("el-button"),n=c("el-upload");return l(),h("div",ct,[r("div",ut,[r("div",dt,[r("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=E(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ht="",_t=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:M},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},kt={class:"title font-bold"},yt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),_=c("el-input");return l(),h("div",$t,[r("div",vt,[r("div",gt,[r("h2",kt,v(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",yt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(_,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=E(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",At=b({name:"LyricInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),Lt={class:"field"},Et={class:"box"},Vt={class:"title font-bold"};function jt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Lt,[r("div",Et,[r("h2",Vt,v(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Ft=E(At,[["render",jt],["__scopeId","data-v-99dfded8"]]),Tt=b({name:"StyleInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},It={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Pt,[r("div",It,[r("h2",Ut,v(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Dt=E(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Rt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Mt={class:"title-container"},Ot={class:"title font-bold"};function Bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Gt,[r("div",Mt,[r("h2",Ot,v(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const qt=E(Rt,[["render",Bt],["__scopeId","data-v-ce70fe34"]]);function D(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const Wt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:R,ElInputNumber:Pe,VideoPlay:Y,VideoPause:Q},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:D,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Nt={class:"field"},Ht={class:"box"},Kt={class:"title font-bold"},Zt={class:"input-wrapper"},xt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Qt={class:"info"},Yt={class:"title"},eo={class:"style"};function to(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),_=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=ee("loading");return l(),h("div",Nt,[r("div",Ht,[r("h2",Kt,v(e.$t("suno.name.extend")),1),r("div",Zt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",xt,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[x((l(),h("div",Xt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(_)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(l(),h("div",Jt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),r("div",Qt,[r("h2",Yt,v(e.audio?.title),1),r("p",eo,v(e.audio?.style),1)])])):y("",!0)])])}const oo=E(Wt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:R,VideoPlay:Y,VideoPause:Q},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:D,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function fo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),h("div",no,[r("div",io,[r("h2",ao,v(e.$t("suno.name.cover")),1)]),r("div",lo,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[x((l(),h("div",ro,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(_,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(_,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(l(),h("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),r("div",uo,[r("h2",po,v(e.audio?.title),1),r("p",mo,v(e.audio?.style),1)])])):y("",!0)])])}const ho=E(so,[["render",fo],["__scopeId","data-v-06640216"]]),_o=b({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:Ft,StyleInput:Dt,TitleInput:qt,ExtendFromInput:oo,CoverFromInput:ho,UploadAudio:ft,FontAwesomeIcon:K,ElButton:Z,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return ze(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ko(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),_=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),f=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),h("div",$o,[r("div",vo,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(l(),w(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(l(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(l(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(l(),w(f,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):y("",!0)]),r("div",go,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const yo=E(_o,[["render",ko],["__scopeId","data-v-b9fab929"]]);var W={exports:{}},wo=W.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var f=new XMLHttpRequest;f.open("GET",n),f.responseType="blob",f.onload=function(){_(f.response,m,k)},f.onerror=function(){console.error("could not download file")},f.send()}function a(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function u(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof B=="object"&&B.global===B?B:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),_=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var f=d.URL||d.webkitURL,C=document.createElement("a");m=m||n.name||"download",C.download=m,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,m,k):u(C,C.target="_blank")):(C.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(a(n))o(n,m,k);else{var f=document.createElement("a");f.href=n,f.target="_blank",setTimeout(function(){u(f)})}}:function(n,m,k,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var C=n.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},A.readAsDataURL(n)}else{var O=d.URL||d.webkitURL,g=O.createObjectURL(n);f?f.location=g:location.href=g,f=null,setTimeout(function(){O.revokeObjectURL(g)},4e4)}});d.saveAs=_.saveAs=_,e.exports=_})}(W)),W.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:J,ElIcon:R,ElTooltip:Me,ElButton:Z,FontAwesomeIcon:K,VideoPlay:Y,VideoPause:Q,ElDropdown:Ge,ElDropdownMenu:Re,ElDropdownItem:De,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===q.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:D,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{Co.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Lo={class:"task"},Eo=["onClick"],Vo={class:"left"},jo=["onClick"],Fo=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Io={class:"title"},Uo={class:"style"},zo={class:"right"},Do={class:"el-dropdown-link"},Ro={class:"flex items-center min-w-[120px]"},Go={class:"el-dropdown-link"};function Mo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),f=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),O=ee("loading");return l(),h("div",Lo,[(l(!0),h(z,null,N(e.audios,g=>(l(),h("div",{key:g.id,class:"audio",onClick:P(S=>e.onClick(g),["stop"])},[x((l(),h("div",Vo,[s(d,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(g),["stop"])},[s(_,null,{default:$(()=>[s(p)]),_:1})],8,jo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(g),["stop"])},[s(_,null,{default:$(()=>[s(n)]),_:1})],8,Fo)):y("",!0),g?.duration?(l(),h("div",To,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[O,!g?.audio_url]]),r("div",Po,[r("h2",Io,v(g?.title),1),r("p",Uo,v(g?.style),1)]),r("div",zo,[g?.audio_url?(l(),w(m,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[s(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(g)},{default:$(()=>[r("div",Ro,[e.isFetchingVideoUrl?(l(),w(_,{key:0,class:"is-loading mr-2"},{default:$(()=>[s(C)]),_:1})):y("",!0),r("span",null,v(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,g?.audio_url),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[r("span",Do,[s(f,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(g.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(j,{onClick:P(S=>e.onCover(g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(g?.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[r("span",Go,[s(f,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Eo))),128))])}const Oo=E(Ao,[["render",Mo]]),Bo={class:"player-slider"},qo=b({__name:"PlayerSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,p)=>(l(),h("div",Bo,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=_=>i.value=_),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),Wo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},Ho=["src"],Ko={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},xo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),h("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(Wo)},null,8,Ho),r("div",Ko,[r("div",Zo,[r("div",xo,[r("span",null,v(i.value?.title||"Music"),1),r("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Qo={class:"flex justify-end items-center gap-x-2.5"},Yo={class:"text-xs"},es=b({__name:"PlayerAction",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),h("div",Qo,[r("span",Yo,v(V(D)(i.value))+" / "+v(V(D)(o.value)),1)]))}});var ts={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function os(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function ss(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var ns=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=os(),p=Se(ns,ts);return function(){var _=u.size,n=u.strokeWidth,m=u.strokeLinecap,k=u.strokeLinejoin,f=u.theme,C=u.fill,j=u.spin,T=ss(d,{size:_,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:f,fill:C},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),j&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(T)])}}};return o}const is=te("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),as=te("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ls=te("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),rs={class:"player-volume flex flex-col items-center pt-2"},cs={class:"text-sm mt-3"},us=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),h("div",rs,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=p=>i.value=p),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",cs,v(i.value),1)]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=b({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),h("div",ds,[s(ie,{icon:o.value?.state==="playing"?V(is):V(as),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(V(Oe),{placement:"top",width:"50px",trigger:"click"},{reference:$(()=>[s(ie,{icon:V(ls),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},fs={class:"flex grow px-5 items-center"},hs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=b({__name:"Player",setup(e){return(t,i)=>(l(),h("div",ms,[s(qo),r("div",fs,[r("div",hs,[s(Jo)]),r("div",_s,[s(ps)]),r("div",$s,[s(es)])])]))}}),gs=b({name:"RecentPanel",components:{ElSkeletonItem:qe,ElSkeleton:Be,TaskPreview:Oo,Player:vs,NoTasks:Ue},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),ks={key:0,class:"tasks"},ys={class:"left w-[70px] p-[10px] flex items-center"},ws={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},bs={key:2,class:"w-full flex-1 flex items-center justify-center"},Cs={class:"h-20"};function Ss(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),_=c("task-preview"),n=c("no-tasks"),m=c("player");return l(),h(z,null,[e.tasks?.items===void 0?(l(),h("div",ks,[(l(),h(z,null,N(3,k=>r("div",{key:k,class:"flex"},[r("div",ys,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",ws,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),h("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[(l(!0),h(z,null,N(e.tasks?.items,(k,f)=>(l(),w(_,{key:f,"model-value":k,class:"preview"},null,8,["model-value"]))),128))],32)):y("",!0),e.tasks?.items?.length===0?(l(),h("div",bs,[s(n)])):y("",!0),x(r("div",Cs,[s(m)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(gs,[["render",Ss]]),Ls=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:xe,ElIcon:R},computed:{audio(){return this.$store.state.suno?.audio}}}),Es={key:0,class:"size-full overflow-hidden"},Vs={class:"relative h-[300px]"},js={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Fs={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Ts={class:"p-4"},Ps={class:"flex items-center font-bold mb-2"},Is={class:"text-[var(--el-text-color-regular)] mb-2"},Us={class:"text-xs text-[var(--el-text-color-regular)]"},zs={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Ds={key:1,class:"w-full h-full"};function Rs(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),_=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),h("div",Es,[r("div",Vs,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:$(()=>[r("div",js,[s(p,{class:"text-3xl"},{default:$(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Fs,v(e.audio?.title),1)]),r("div",Ts,[r("div",Ps,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,v(e.audio?.title),1)]),r("p",Is,v(e.audio?.style),1),r("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),r("div",zs,[r("p",null,v(e.audio?.lyric),1)])])])):(l(),h("div",Ds))}const Gs=E(Ls,[["render",Rs]]),Ms="https://webhook.acedata.cloud/suno",Os=b({name:"SunoIndex",components:{Layout:ot,ConfigPanel:yo,RecentPanel:As,PreviewPanel:Gs},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===q.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===q.Request},needApply(){return this.$store.state.suno.status.getApplications===q.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ms},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Bs(e,t,i,o,a,u){const d=c("config-panel"),p=c("recent-panel"),_=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:$(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(_)]),_:1})}const Cn=E(Os,[["render",Bs],["__scopeId","data-v-f5721d95"]]);export{Cn as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as I}from"./index.es-p3WzQOq6.js";import{E as S}from"./index-BPDafUhu.js";import{E as P}from"./index-B0lmXmn1.js";import{d as $,h as g,b as i,t as l,k as t,r as U,j as f,l as s,o as a,eX as R,x as r,F as V,v as T,i as y,eY as D,eZ as F,c9 as B,D as h,y as x,n as C,e_ as O,du as M,dq as q}from"./index-BquyEGf6.js";import{E as L,a as G}from"./index-Bbv8AcsL.js";import{I as A}from"./InfoIcon-LF-0__cu.js";import{E as N,a as z}from"./index-BwG5X1Uf.js";import{I as X}from"./ImagePreview-B5tjfDBl.js";import{E as H}from"./index-CGd3r2k1.js";import{E as k}from"./index-B1ltQzXY.js";import{E as K}from"./index-DO2Q3h3U.js";import{C as W,N as Y}from"./NoTasks-7U68u4-g.js";import{a as Z}from"./price-QrgS9vBm.js";import{C as J}from"./CopyToClipboard-DvCoKPTQ.js";import{I as Q}from"./ImageWrapper-uh4-bLz8.js";import{E as ee}from"./index-bP-68lHF.js";import{E as te}from"./index-FdU7uO_k.js";import{B as oe}from"./BotPlaceholder-D2NiVhQ8.js";import"./use-form-item-n2htyTGx.js";import"./index-r5W6hzzQ.js";import"./index-Cwls0ZAN.js";import"./index-D_OfWunA.js";import"./typescript-C_0I_mxX.js";import"./index-Dvf0QjP1.js";import"./strings-Bbr3e8ju.js";import"./castArray-CCwFp0WG.js";import"./isEqual-CD5SlWKj.js";import"./_initCloneObject-DBpc_lNE.js";import"./debounce-BdbhCXbs.js";import"./_baseIteratee-FPmiAqiQ.js";import"./index-C4dxWzTO.js";import"./index-DcHF8gEn.js";import"./_baseClone-CkMTtQ9D.js";import"./index-CYVG-TAg.js";import"./index-Dns87zhU.js";const se=$({name:"LayoutFlux",components:{ElDrawer:P,ElButton:S,FontAwesomeIcon:I},data(){return{drawer:!1}}}),ne={class:"main flex flex-row flex-1"},le={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ae={class:"result h-full p-[15px] flex-1 flex flex-col"};function re(e,o,m,p,v,b){const c=s("font-awesome-icon"),u=s("el-button"),n=s("el-drawer");return a(),i("div",ne,[l("div",le,[U(e.$slots,"config",{},void 0,!0)]),l("div",ae,[U(e.$slots,"result",{},void 0,!0)]),t(u,{circle:"",class:"menu",onClick:o[0]||(o[0]=d=>e.drawer=!0)},{default:f(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=d=>e.drawer=d),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:f(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ie=g(se,[["render",re],["__scopeId","data-v-468dfa4e"]]),ce=$({name:"ModelSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"flux-dev",label:"flux-dev"},{value:"flux-pro",label:"flux-pro"},{value:"flux-pro-1.1",label:"flux-pro-1.1"},{value:"flux-pro-1.1-ultra",label:"flux-pro-1.1-ultra"},{value:"flux-kontext-pro",label:"flux-kontext-pro"},{value:"flux-kontext-max",label:"flux-kontext-max"}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||(this.value=R)}}),ue={class:"field"},de={class:"title font-bold"};function pe(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return a(),i("div",ue,[l("h2",de,r(e.$t("flux.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(a(!0),i(V,null,T(e.options,n=>(a(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const me=g(ce,[["render",pe],["__scopeId","data-v-8df4b8a7"]]),fe=$({name:"CountSelector",components:{ElSlider:z,InfoIcon:A,ElInputNumber:N},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug("set count",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||(this.value=D)}}),_e={class:"flex justify-between"},he={class:"flex justify-start items-center"},$e={class:"text-sm font-bold"},ge={class:"flex justify-end items-center"},ve={class:"w-full"};function be(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input-number"),n=s("el-slider");return a(),i("div",null,[l("div",_e,[l("div",he,[l("span",$e,r(e.$t("flux.name.numbers")),1),t(c,{content:e.$t("flux.description.numbers")},null,8,["content"])]),l("div",ge,[t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=d=>e.value=d),"controls-position":"right"},null,8,["modelValue"])])]),l("div",ve,[t(n,{modelValue:e.value,"onUpdate:modelValue":o[1]||(o[1]=d=>e.value=d),min:1,max:4,step:1},null,8,["modelValue"])])])}const xe=g(fe,[["render",be]]),we=$({name:"ActionSelector",components:{ElSelect:G,ElOption:L},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"generate",label:this.$t("flux.name.generate")},{value:"edits",label:this.$t("flux.name.edits")}]}},computed:{value:{get(){return this.$store.state.flux?.config?.action},set(e){this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,action:e})}}},mounted(){this.value||(this.value=F)}}),ke={class:"field"},ye={class:"title font-bold"};function Ve(e,o,m,p,v,b){const c=s("el-option"),u=s("el-select");return a(),i("div",ke,[l("h2",ye,r(e.$t("flux.name.task")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=n=>e.value=n),class:"value",placeholder:e.$t("flux.placeholder.select")},{default:f(()=>[(a(!0),i(V,null,T(e.options,n=>(a(),y(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(we,[["render",Ve],["__scopeId","data-v-81fd05e5"]]),Ie=$({name:"ImageUrlInput",components:{ElUpload:H,ElButton:S,InfoIcon:A,FontAwesomeIcon:I,ImagePreview:X},emits:["change"],data(){return{fileList:[],uploadUrl:B()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{urls:{handler(e){console.debug("URLs changed:",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux.config,image_url:e[0]})}}},methods:{onExceed(){k.warning(this.$t("flux.message.uploadStartImageExceed"))},onError(){k.error(this.$t("flux.message.uploadStartImageError"))}}}),Te={class:"relative"},Ue={class:"flex justify-between"},Se={class:"flex justify-start items-center"},Ce={class:"text-sm font-bold"};function Ae(e,o,m,p,v,b){const c=s("info-icon"),u=s("image-preview"),n=s("font-awesome-icon"),d=s("el-button"),w=s("el-upload");return a(),i("div",Te,[l("div",Ue,[l("div",Se,[l("span",Ce,r(e.$t("flux.name.imageUrl")),1),t(c,{content:e.$t("flux.description.imageUrl")},null,8,["content"])])]),t(w,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=_=>e.fileList=_),name:"file",limit:5,class:"upload-wrapper",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,headers:e.headers},{file:f(({file:_})=>[t(u,{url:_.url||_.response?.file_url,name:_.name,percentage:_.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])]),default:f(()=>[t(d,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:f(()=>[t(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+r(e.$t("flux.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","headers"])])}const Le=g(Ie,[["render",Ae],["__scopeId","data-v-04710032"]]),Ge="",je=$({name:"PromptInput",components:{ElInput:K,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("flux/setConfig",{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Ge)}}),Pe={class:"field"},Re={class:"box"},De={class:"title font-bold"};function Fe(e,o,m,p,v,b){const c=s("info-icon"),u=s("el-input");return a(),i("div",Pe,[l("div",Re,[l("h2",De,r(e.$t("flux.name.prompt")),1),t(c,{content:e.$t("flux.description.prompt"),class:"info"},null,8,["content"])]),t(u,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("flux.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Be=g(je,[["render",Fe],["__scopeId","data-v-4c101a17"]]),Oe=$({name:"PresetPanel",components:{ElButton:S,FontAwesomeIcon:I,PromptInput:Be,ModelSelector:me,CountSelector:xe,Consumption:W,ActionSelector:Ee,ImageUrlInput:Le},emits:["generate"],computed:{config(){return this.$store.state.flux?.config},consumption(){return Z(this.config,this.service?.metadata?.price)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit("generate")}}}),Me={class:"flex flex-col h-full"},qe={class:"flex-1 overflow-y-auto p-[15px]"},Ne={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ze(e,o,m,p,v,b){const c=s("action-selector"),u=s("prompt-input"),n=s("image-url-input"),d=s("model-selector"),w=s("count-selector"),_=s("consumption"),E=s("font-awesome-icon"),j=s("el-button");return a(),i("div",Me,[l("div",qe,[t(c,{class:"mb-4"}),t(u,{class:"mb-4"}),e.config?.action==="edits"?(a(),y(n,{key:0,class:"mb-4"})):x("",!0),t(d,{class:"mb-4"}),t(w,{class:"mb-4"})]),l("div",Ne,[t(_,{value:e.consumption,service:e.service},null,8,["value","service"]),t(j,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[t(E,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+r(e.$t("flux.button.generate")),1)]),_:1},8,["onClick"])])])}const Xe=g(Oe,[["render",ze]]),He=$({name:"TaskPreview",components:{ElImage:te,CopyToClipboard:J,FontAwesomeIcon:I,ElAlert:ee,ImageWrapper:Q},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(m=>{let p=m;o&&(p.action=o),e.push(p)}),e}},methods:{onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenImage(e){window.open(e,"_blank")}}}),Ke={class:"preview"},We={class:"left"},Ye={class:"main"},Ze={class:"bot"},Je={class:"datetime"},Qe={class:"info"},et={key:0,class:"prompt mt-2"},tt={key:0},ot={key:0,class:C({content:!0,failed:!0})},st={class:"flex justify-start items-center gap-4 w-full overflow-x-auto"},nt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},lt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},at={key:1,class:C({content:!0})},rt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},it={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ct={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ut={key:2,class:C({content:!0})},dt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function pt(e,o,m,p,v,b){const c=s("el-image"),u=s("image-wrapper"),n=s("font-awesome-icon"),d=s("copy-to-clipboard"),w=s("el-alert");return a(),i("div",Ke,[l("div",We,[t(c,{src:"https://cdn.acedata.cloud/ogm2oa.png",class:"avatar"})]),l("div",Ye,[l("div",Ze,[h(r(e.$t("flux.name.fluxBot"))+" ",1),l("span",Je,r(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Qe,[e.modelValue?.request?.prompt?(a(),i("p",et,[h(r(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?x("",!0):(a(),i("span",tt," - ("+r(e.$t("flux.status.pending"))+") ",1))])):x("",!0)]),e.modelValue?.response?.success===!0?(a(),i("div",ot,[l("div",st,[(a(!0),i(V,null,T(e.images,(_,E)=>(a(),y(u,{key:E,src:_?.image_url,"raw-src":_?.image_url,"model-value":_},null,8,["src","raw-src","model-value"]))),128))]),t(w,{closable:!1,class:"mt-2 success"},{default:f(()=>[l("p",nt,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.model"))+": "+r(e.modelValue?.request?.model),1)]),l("p",lt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy inline-block"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?.success===!1?(a(),i("div",at,[t(w,{closable:!1,class:"failure"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[l("p",rt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),l("p",it,[t(n,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+r(e.$t("flux.name.failureReason"))+": "+r(e.modelValue?.response?.error?.message)+" ",1),t(d,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),l("p",ct,[t(n,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+r(e.$t("flux.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),t(d,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):x("",!0),e.modelValue?.response?x("",!0):(a(),i("div",ut,[t(w,{closable:!1,class:"info"},{template:f(()=>[t(n,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+r(e.$t("flux.name.failure")),1)]),default:f(()=>[l("p",dt,[t(n,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+r(e.$t("flux.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),t(d,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})]))])])}const mt=g(He,[["render",pt],["__scopeId","data-v-fd5838a5"]]),ft=$({name:"RecentPanel",components:{TaskPreview:mt,BotPlaceholder:oe,NoTasks:Y},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),_t={key:0},ht={key:1,class:"tasks h-full w-full overflow-y-auto"},$t={key:2,class:"w-full h-full flex items-center justify-center"};function gt(e,o,m,p,v,b){const c=s("bot-placeholder"),u=s("task-preview"),n=s("no-tasks");return a(),i(V,null,[e.tasks?.items===void 0?(a(),i("div",_t,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),i("div",ht,[(a(!0),i(V,null,T(e.tasks?.items,d=>(a(),y(u,{key:d.id,"model-value":d},null,8,["model-value"]))),128))])):x("",!0),e.tasks?.items?.length===0?(a(),i("div",$t,[t(n)])):x("",!0)],64)}const vt=g(ft,[["render",gt]]),bt="https://webhook.acedata.cloud/flux",xt=$({name:"FluxIndex",components:{ConfigPanel:Xe,Layout:ie,RecentPanel:vt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.flux?.status?.getApplications===q.Request},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("flux/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("flux/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:p}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",p),await this.$store.dispatch("flux/getTasks",{limit:o,createdAtMin:m,createdAtMax:p})},async onGenerate(){const e={...this.config,callback_url:bt},o=this.credential?.token;if(!o){console.error("no token specified");return}k.info(this.$t("flux.message.startingTask")),O.generate(e,{token:o}).then(()=>{k.success(this.$t("flux.message.startTaskSuccess"))}).catch(m=>{const p=m?.response?.data;p?.error?.code===M?k.error(this.$t("flux.message.usedUp")):k.error(this.$t("flux.message.startTaskFailed")+p?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function wt(e,o,m,p,v,b){const c=s("config-panel"),u=s("recent-panel"),n=s("layout");return a(),y(n,null,{config:f(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:f(()=>[t(u,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const no=g(xt,[["render",wt]]);export{no as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.menu[data-v-966c9b2c]{display:none}@media (max-width: 767px){.config[data-v-966c9b2c]{display:none}.result[data-v-966c9b2c]{width:100%}.menu[data-v-966c9b2c]{display:block;position:absolute;right:8px;top:45px;z-index:1000}}.field[data-v-3a7abba8]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .title[data-v-3a7abba8]{font-size:14px;margin:0;width:30%}.field .value[data-v-3a7abba8]{width:120px}.field[data-v-7b82fa7f]{display:flex;flex-direction:row;align-items:center}.field .title[data-v-7b82fa7f]{font-size:14px;margin:0;width:30%}.field .value[data-v-7b82fa7f]{flex:1}.field[data-v-c2934598]{display:flex;flex-direction:column}.control[data-v-c2934598]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.title[data-v-c2934598]{font-size:14px;margin:0;width:30%}.value[data-v-c2934598]{width:120px}.title[data-v-d6940af8]{font-size:14px;margin-bottom:10px}.items[data-v-d6940af8]{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:12px}.items .item[data-v-d6940af8]{width:48px;height:65px;border:1px solid var(--el-border-color);display:flex;flex-direction:column;align-items:center;cursor:pointer;border-radius:var(--el-border-radius-base)}.items .item .preview[data-v-d6940af8]{margin-top:5px;margin-bottom:3px;width:30px;height:30px;display:flex;flex-direction:row;align-items:center;justify-content:center}.items .item .preview .rect[data-v-d6940af8]{border:1px solid var(--el-border-color);width:20px;height:20px;border-radius:2px}.items .item .name[data-v-d6940af8]{display:block;font-size:12px;color:var(--el-text-color-primary)}.items .item.active[data-v-d6940af8],.items .item.active .rect[data-v-d6940af8]{border-color:var(--el-color-primary)}.title[data-v-fd6e5c97]{font-size:14px;margin-bottom:0;width:30%}.btn.btn-upload[data-v-fd6e5c97]{position:absolute;top:5px;right:0}.upload-wrapper{height:auto;display:flex}.upload-wrapper .el-upload-list{margin:0;width:100%}.field[data-v-8c485f0f]{display:flex;flex-direction:column}.control[data-v-8c485f0f]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.title[data-v-8c485f0f]{font-size:14px;margin:0;width:30%}.value[data-v-8c485f0f]{width:120px}.field .box[data-v-cf3a1497]{display:flex;flex-direction:row;align-items:center;justify-content:space-between;position:relative}.field .box .title[data-v-cf3a1497]{font-size:14px;margin-bottom:10px}.field .info[data-v-cf3a1497]{margin-left:auto}.preview[data-v-183a4d07]{width:100%;height:-moz-fit-content;height:fit-content;text-align:left;display:flex;flex-direction:row;margin-bottom:15px}.preview .left[data-v-183a4d07]{width:70px}.preview .left .avatar[data-v-183a4d07]{width:50px;height:50px;margin:10px;border-radius:50%}.preview .main[data-v-183a4d07]{flex:1;width:calc(100% - 70px);padding:10px 10px 0}.preview .main .bot[data-v-183a4d07]{font-size:16px;font-weight:700;color:#2ecc71;margin-bottom:0;margin-top:0}.preview .main .bot .datetime[data-v-183a4d07]{font-size:12px;font-weight:400;color:var(--el-text-color-secondary);margin-left:10px}.preview .main .info .prompt[data-v-183a4d07]{font-size:16px;font-weight:700;color:var(--el-text-color-regular);margin-bottom:10px}.preview .main .content .el-alert[data-v-183a4d07]{border-left-width:2px;border-left-style:solid}.preview .main .content .el-alert.failure[data-v-183a4d07]{border-color:var(--el-color-danger)}.preview .main .content .el-alert.success[data-v-183a4d07]{border-color:var(--el-color-success)}.preview .main .content .el-alert.info[data-v-183a4d07]{border-color:var(--el-color-info)}.preview .main .operations[data-v-183a4d07]{display:flex;justify-content:left;flex-direction:row;width:100%;align-items:baseline;flex-wrap:wrap;overflow:hidden;text-align:center;color:var(--el-text-color-regular);font-size:14px;overflow-y:scroll}.preview .main .operations.full[data-v-183a4d07]{height:70px}.preview .main .operations .btn-action[data-v-183a4d07]{margin-bottom:10px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as D}from"./index.es-p3WzQOq6.js";import{E as C}from"./index-BPDafUhu.js";import{E as N}from"./index-B0lmXmn1.js";import{d as b,h as w,b as r,t as i,k as o,r as U,j as p,l as s,o as n,eG as G,eH as z,eI as S,eJ as P,eK as B,eL as q,x as l,F as V,v as T,i as y,eM as H,eN as J,n as A,f as K,c9 as W,D as h,y as $,eO as Z,J as Y,K as Q,eP as X,du as x,dq as ee}from"./index-BquyEGf6.js";import{E as O,a as R}from"./index-Bbv8AcsL.js";import{I as M}from"./InfoIcon-LF-0__cu.js";import{I as te}from"./ImagePreview-B5tjfDBl.js";import{E as oe}from"./index-CGd3r2k1.js";import{E as I}from"./index-B1ltQzXY.js";import{C as se,N as ae}from"./NoTasks-7U68u4-g.js";import{E as ne}from"./index-DO2Q3h3U.js";import{a as le}from"./price-QrgS9vBm.js";import{C as re}from"./CopyToClipboard-DvCoKPTQ.js";import{V as ie}from"./VideoPlayer-DAzEIQG8.js";import{E as ce}from"./index-Cwls0ZAN.js";import{E as de}from"./index-bP-68lHF.js";import{E as ue}from"./index-FdU7uO_k.js";import{B as pe}from"./BotPlaceholder-D2NiVhQ8.js";import"./use-form-item-n2htyTGx.js";import"./index-r5W6hzzQ.js";import"./index-Dvf0QjP1.js";import"./typescript-C_0I_mxX.js";import"./index-D_OfWunA.js";import"./strings-Bbr3e8ju.js";import"./castArray-CCwFp0WG.js";import"./isEqual-CD5SlWKj.js";import"./_initCloneObject-DBpc_lNE.js";import"./debounce-BdbhCXbs.js";import"./_baseIteratee-FPmiAqiQ.js";import"./index-C4dxWzTO.js";import"./index-DcHF8gEn.js";import"./_baseClone-CkMTtQ9D.js";import"./index-CYVG-TAg.js";import"./vue-plyr-QZFBikSk.js";import"./index-Dns87zhU.js";const me=b({name:"LayoutSora",components:{ElDrawer:N,ElButton:C,FontAwesomeIcon:D},data(){return{drawer:!1}}}),fe={class:"main flex flex-row flex-1"},_e={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},he={class:"result h-full p-[15px] flex-1 flex flex-col"};function $e(e,t,u,m,v,g){const c=s("font-awesome-icon"),d=s("el-button"),a=s("el-drawer");return n(),r("div",fe,[i("div",_e,[U(e.$slots,"config",{},void 0,!0)]),i("div",he,[U(e.$slots,"result",{},void 0,!0)]),o(d,{circle:"",class:"menu",onClick:t[0]||(t[0]=k=>e.drawer=!0)},{default:p(()=>[o(c,{icon:"fa-solid fa-magic"})]),_:1}),o(a,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=k=>e.drawer=k),direction:"ltr","with-header":!1,size:"350px"},{default:p(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ve=w(me,[["render",$e],["__scopeId","data-v-966c9b2c"]]),ge=b({name:"ModelSelector",components:{ElSelect:R,ElOption:O},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:B,label:"sora-2"},{value:q,label:"sora-2-pro"}]}},computed:{value:{get(){return this.$store.state.sora?.config?.model},set(e){const t=this.$store.state.sora?.config||{},u=z[e]||[S],m=t.duration,v=m&&u.includes(m)?m:u.includes(S)?S:u[0],g={...t,model:e,duration:v,size:t.size||P};this.$store.commit("sora/setConfig",g)}}},mounted(){this.value||(this.value=G)}}),be={class:"field"},we={class:"title font-bold"};function ke(e,t,u,m,v,g){const c=s("el-option"),d=s("el-select");return n(),r("div",be,[i("h2",we,l(e.$t("sora.name.model")),1),o(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("sora.placeholder.select")},{default:p(()=>[(n(!0),r(V,null,T(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ye=w(ge,[["render",ke],["__scopeId","data-v-3a7abba8"]]),Se=b({name:"ActionSelector",components:{ElSelect:R,ElOption:O},data(){return{}},computed:{options(){return[{value:"text2video",label:this.$t("sora.button.action1")},{value:"image2video",label:this.$t("sora.button.action2")}]},value:{get(){return this.$store.state.sora?.config?.action},set(e){this.$store.commit("sora/setConfig",{...this.$store.state.sora?.config,action:e})}}},mounted(){this.value||(this.value=H)}}),Ve={class:"field"},Ee={class:"title font-bold"},Ie={class:"float-left"};function Ae(e,t,u,m,v,g){const c=s("el-option"),d=s("el-select");return n(),r("div",Ve,[i("h2",Ee,l(e.$t("sora.name.action")),1),o(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("sora.placeholder.select"),clearable:""},{default:p(()=>[(n(!0),r(V,null,T(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},{default:p(()=>[i("span",Ie,l(a.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Te=w(Se,[["render",Ae],["__scopeId","data-v-7b82fa7f"]]),De=b({name:"DurationSelector",components:{ElSelect:R,ElOption:O},computed:{model(){return this.$store.state.sora?.config?.model||G},allowedDurations(){return z[this.model]||[S]},optionsForModel(){return this.allowedDurations.map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.sora?.config?.duration},set(e){const t=this.$store.state.sora?.config||{};this.$store.commit("sora/setConfig",{...t,duration:e})}}},watch:{allowedDurations(){const e=this.allowedDurations;if(!e.includes(this.value)){const t=e.includes(S)?S:e[0];this.value=t}}},mounted(){this.value||(this.value=S)}}),Ce={class:"field"},Oe={class:"control"},Re={class:"title font-bold"};function Le(e,t,u,m,v,g){const c=s("el-option"),d=s("el-select");return n(),r("div",Ce,[i("div",Oe,[i("h2",Re,l(e.$t("sora.name.duration")),1),o(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("sora.placeholder.select")},{default:p(()=>[(n(!0),r(V,null,T(e.optionsForModel,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])])}const Ue=w(De,[["render",Le],["__scopeId","data-v-c2934598"]]),Ge=b({name:"OrientationSelector",data(){return{options:[{value:"portrait",label:"竖屏",width:13,height:25},{value:"landscape",label:"横屏",width:25,height:13}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.sora?.config?.orientation},set(e){console.debug("set orientation",e),this.$store.commit("sora/setConfig",{...this.$store.state?.sora?.config,orientation:e})}}},mounted(){this.value||(this.value=J)}}),ze={class:"text-sm font-bold mb-2 block"},Pe={class:"items"},Me=["onClick"],je={class:"name"};function Fe(e,t,u,m,v,g){return n(),r("div",null,[i("span",ze,l(e.$t("sora.name.orientation")),1),i("div",Pe,[(n(!0),r(V,null,T(e.options,(c,d)=>(n(),r("div",{key:d,class:A({active:e.active===d,item:!0}),onClick:a=>e.value=c.value},[i("div",{class:A(["preview",c.value])},[i("div",{class:"rect",style:K({width:c.width+"px",height:c.height+"px"})},null,4)],2),i("p",je,l(c.label),1)],10,Me))),128))])])}const Ne=w(Ge,[["render",Fe],["__scopeId","data-v-d6940af8"]]),Be=b({name:"StartEndImage",components:{ElUpload:oe,ElButton:C,InfoIcon:M,FontAwesomeIcon:D,ImagePreview:te},emits:["change"],data(){return{fileList:[],uploadUrl:W()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.sora?.config?.image_urls},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartEndImageUrl()},methods:{onExceed(){I.warning(this.$t("sora.message.uploadReferencesExceed"))},onError(){I.error(this.$t("sora.message.uploadReferencesError"))},onSetStartEndImageUrl(){const e=this.urls;this.$store.commit("sora/setConfig",{...this.$store.state?.sora?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),qe={class:"relative"},He={class:"flex justify-between"},Je={class:"flex justify-start items-center"},Ke={class:"text-sm font-bold"};function We(e,t,u,m,v,g){const c=s("info-icon"),d=s("image-preview"),a=s("font-awesome-icon"),k=s("el-button"),_=s("el-upload");return n(),r("div",qe,[i("div",He,[i("div",Je,[i("span",Ke,l(e.$t("sora.name.startEndImage")),1),o(c,{content:e.$t("sora.description.uploadStartEndImage")},null,8,["content"])])]),o(_,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=f=>e.fileList=f),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:2,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:p(({file:f})=>[f.url&&f.percentage!==void 0?(n(),y(d,{key:0,url:f.url,name:f.name,percentage:f.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(f),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:p(()=>[o(k,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:p(()=>[o(a,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+l(e.$t("sora.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ze=w(Be,[["render",We],["__scopeId","data-v-fd6e5c97"]]),Ye=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),Qe=b({name:"SizeSelector",components:{ElSelect:R,ElOption:O},data(){return{options:Z.map(e=>({value:e,label:Ye(e)}))}},computed:{value:{get(){return this.$store.state.sora?.config?.size},set(e){const t=this.$store.state.sora?.config||{};this.$store.commit("sora/setConfig",{...t,size:e})}}},mounted(){this.value||(this.value=P)}}),Xe={class:"field"},xe={class:"control"},et={class:"title font-bold"};function tt(e,t,u,m,v,g){const c=s("el-option"),d=s("el-select");return n(),r("div",Xe,[i("div",xe,[i("h2",et,l(e.$t("sora.name.size")),1),o(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=a=>e.value=a),class:"value",placeholder:e.$t("sora.placeholder.select")},{default:p(()=>[(n(!0),r(V,null,T(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])])}const ot=w(Qe,[["render",tt],["__scopeId","data-v-8c485f0f"]]),st="",at=b({name:"PromptInput",components:{ElInput:ne,InfoIcon:M},computed:{prompt:{get(){return this.$store.state.sora?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("sora/setConfig",{...this.$store.state.sora?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=st)}}),nt={class:"field"},lt={class:"box"},rt={class:"title font-bold"};function it(e,t,u,m,v,g){const c=s("info-icon"),d=s("el-input");return n(),r("div",nt,[i("div",lt,[i("h2",rt,l(e.$t("sora.name.prompt")),1),o(c,{content:e.$t("sora.description.prompt"),class:"info"},null,8,["content"])]),o(d,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=a=>e.prompt=a),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("sora.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ct=w(at,[["render",it],["__scopeId","data-v-cf3a1497"]]),dt=b({name:"ConfigPanel",components:{ElButton:C,Consumption:se,FontAwesomeIcon:D,PromptInput:ct,ModelSelector:ye,StartEndImage:Ze,SizeSelector:ot,ActionSelector:Te,OrientationSelector:Ne,DurationSelector:Ue},emits:["generate"],computed:{config(){return this.$store.state.sora?.config},consumption(){return le(this.config,this.service?.metadata?.price)},service(){return this.$store.state.sora?.service}},methods:{onGenerate(){this.$emit("generate")}}}),ut={class:"flex flex-col h-full"},pt={class:"flex-1 overflow-y-auto p-[15px]"},mt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ft(e,t,u,m,v,g){const c=s("model-selector"),d=s("action-selector"),a=s("duration-selector"),k=s("size-selector"),_=s("orientation-selector"),f=s("prompt-input"),E=s("start-end-image"),L=s("consumption"),j=s("font-awesome-icon"),F=s("el-button");return n(),r("div",ut,[i("div",pt,[o(c,{class:"mb-4"}),o(d,{class:"mb-4"}),o(a,{class:"mb-4"}),o(k,{class:"mb-4"}),o(_,{class:"mb-4"}),o(f,{class:"mb-4"}),Y(o(E,{class:"mb-2"},null,512),[[Q,e.config?.action==="image2video"]])]),i("div",mt,[o(L,{value:e.consumption,service:e.service},null,8,["value","service"]),o(F,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[o(j,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+l(e.$t("sora.button.generate")),1)]),_:1},8,["onClick"])])])}const _t=w(dt,[["render",ft]]),ht=b({name:"TaskPreview",components:{ElImage:ue,CopyToClipboard:re,FontAwesomeIcon:D,ElAlert:de,VideoPlayer:ie,ElTooltip:ce,ElButton:C},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.sora?.application},config(){return this.$store.state.sora?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),$t={class:"preview"},vt={class:"left"},gt={class:"main"},bt={class:"bot"},wt={class:"datetime"},kt={class:"info"},yt={key:0,class:"prompt mt-2"},St={key:0},Vt={key:1},Et={key:0,class:A({content:!0,failed:!0})},It={key:0,class:"mb-4"},At={key:1,class:A({operations:!0,"mt-2":!0})},Tt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Dt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ct={key:1,class:A({content:!0})},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Rt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Lt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ut={key:2,class:A({content:!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},zt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Pt(e,t,u,m,v,g){const c=s("el-image"),d=s("video-player"),a=s("el-button"),k=s("el-tooltip"),_=s("font-awesome-icon"),f=s("copy-to-clipboard"),E=s("el-alert");return n(),r("div",$t,[i("div",vt,[o(c,{src:"https://cdn.acedata.cloud/z5id1u.png",class:"avatar"})]),i("div",gt,[i("div",bt,[h(l(e.$t("sora.name.soraBot"))+" ",1),i("span",wt,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",kt,[e.modelValue?.request?.prompt?(n(),r("p",yt,[h(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",St," - ("+l(e.$t("sora.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="pending"?(n(),r("span",Vt," - ("+l(e.$t("sora.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",Et,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",It,[o(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",At,[o(k,{class:"box-item",effect:"dark",content:e.$t("sora.message.downloadVideo"),placement:"top-start"},{default:p(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(a,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=L=>e.onDownload(L,e.modelValue?.response?.data[0]?.video_url))},{default:p(()=>[h(l(e.$t("sora.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),o(E,{closable:!1,class:"mt-2 success"},{default:p(()=>[i("p",Tt,[o(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+l(e.$t("sora.name.model"))+": "+l(e.modelValue?.request?.model),1)]),i("p",Dt,[o(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+l(e.$t("sora.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),o(f,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Ct,[o(E,{closable:!1,class:"failure"},{template:p(()=>[o(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+l(e.$t("sora.name.failure")),1)]),default:p(()=>[i("p",Ot,[o(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+l(e.$t("sora.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),o(f,{content:e.modelValue?.id},null,8,["content"])]),i("p",Rt,[o(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+l(e.$t("sora.name.failureReason"))+": "+l(e.modelValue?.response?.error?.message)+" ",1),o(f,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Lt,[o(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+l(e.$t("sora.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),o(f,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Ut,[o(E,{closable:!1,class:"info"},{template:p(()=>[o(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+l(e.$t("sora.name.failure")),1)]),default:p(()=>[i("p",Gt,[o(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+l(e.$t("sora.name.taskId"))+": "+l(e.modelValue?.id)+" ",1),o(f,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",zt,[o(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+l(e.$t("sora.name.traceId"))+": "+l(e.modelValue?.response?.trace_id)+" ",1),o(f,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Mt=w(ht,[["render",Pt],["__scopeId","data-v-183a4d07"]]),jt=b({name:"RecentPanel",components:{TaskPreview:Mt,NoTasks:ae,BotPlaceholder:pe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.sora?.tasks,items:this.$store.state.sora?.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")}}}),Ft={key:0},Nt={key:1,class:"tasks h-full w-full overflow-y-auto"},Bt={key:2,class:"w-full h-full flex items-center justify-center"};function qt(e,t,u,m,v,g){const c=s("bot-placeholder"),d=s("task-preview"),a=s("no-tasks");return n(),r(V,null,[e.tasks?.items===void 0?(n(),r("div",Ft,[o(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",Nt,[(n(!0),r(V,null,T(e.tasks?.items,(k,_)=>(n(),y(d,{key:_,"model-value":k},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",Bt,[o(a)])):$("",!0)],64)}const Ht=w(jt,[["render",qt]]),Jt="https://webhook.acedata.cloud/sora",Kt=b({name:"SoraIndex",components:{ConfigPanel:_t,Layout:ve,RecentPanel:Ht},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.sora?.status?.getApplications===ee.Request},credential(){return this.$store.state.sora.credential},config(){return this.$store.state.sora.config},tasks(){return this.$store.state.sora.tasks}},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("sora/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("sora/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:u,createdAtMax:m}=e||{};console.debug("limit",t,"createdAtMin",u,"createdAtMax",m),await this.$store.dispatch("sora/getTasks",{limit:t,createdAtMin:u,createdAtMax:m})},async onGenerate(){const e={...this.config,callback_url:Jt},t=this.credential?.token;if(!t){console.error("no token specified");return}I.info(this.$t("sora.message.startingTask")),X.generate(e,{token:t}).then(()=>{I.success(this.$t("sora.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===x?I.error(this.$t("sora.message.usedUp")):I.error(this.$t("sora.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Wt(e,t,u,m,v,g){const c=s("config-panel"),d=s("recent-panel"),a=s("layout");return n(),y(a,null,{config:p(()=>[o(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:p(()=>[o(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Co=w(Kt,[["render",Wt]]);export{Co as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as G}from"./index.es-CcpVHvSx.js";import{E as R}from"./index-CkGfGBH1.js";import{E as q}from"./index-ZR2WC3y6.js";import{d as $,h as g,b as r,t as l,k as t,r as L,j as u,l as s,o as n,eB as z,x as a,F as A,v as U,i as y,eC as M,eD as N,eE as H,n as T,f as J,y as f,c9 as K,D as h,J as E,K as S,eF as Q,du as W,dq as X}from"./index-IUOnFE33.js";import{E as D,a as O}from"./index-fKcIRqyn.js";import{I as j}from"./InfoIcon-DJgGdcM4.js";import{E as Y}from"./index-CkSqGmwg.js";import{V as P}from"./VideoPlayer-DAFte4NK.js";import{I as Z}from"./ImagePreview-DpKPZpzN.js";import{E as x}from"./index-DLEpULvj.js";import{E as I}from"./index-Dgon4P8g.js";import{C as ee,N as te}from"./NoTasks-BAFsp5y-.js";import{E as oe}from"./index-BlfhaCBe.js";import{a as se}from"./price-BmpkejfA.js";import{C as ne}from"./CopyToClipboard-D10YM_7m.js";import{E as ae}from"./index-1fW-uAwf.js";import{E as le}from"./index-CF5Kx3lT.js";import{E as ie}from"./index-DSNMx2cO.js";import{B as re}from"./BotPlaceholder-C-r3HBsb.js";import"./use-form-item-DNI3l--g.js";import"./index-r5W6hzzQ.js";import"./index-BXh5SszT.js";import"./typescript-CrbS__OB.js";import"./index-aLPamwRW.js";import"./strings-ByIYpJrS.js";import"./castArray-F6UtPTG2.js";import"./isEqual-DT9q1wUz.js";import"./_initCloneObject-BNJJfRAs.js";import"./debounce-DUU4g0Vw.js";import"./_baseIteratee-DVuly0os.js";import"./index-D_GDwTBQ.js";import"./vue-plyr-QZFBikSk.js";import"./index-D9ZkPdjT.js";import"./_baseClone-DfZip4NQ.js";import"./index-3NDJx6NE.js";import"./index-CwsOuzih.js";const ce=$({name:"LayoutVeo",components:{ElDrawer:q,ElButton:R,FontAwesomeIcon:G},data(){return{drawer:!1}}}),de={class:"main flex flex-row flex-1"},ue={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},pe={class:"result h-full p-[15px] flex-1 flex flex-col"};function me(e,o,m,v,b,w){const c=s("font-awesome-icon"),d=s("el-button"),i=s("el-drawer");return n(),r("div",de,[l("div",ue,[L(e.$slots,"config",{},void 0,!0)]),l("div",pe,[L(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=k=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=k=>e.drawer=k),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[L(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const fe=g(ce,[["render",me],["__scopeId","data-v-cfe3cae3"]]),ve=$({name:"ModelSelector",components:{ElSelect:O,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"veo2",label:"veo2"},{value:"veo2-fast",label:"veo2-fast"},{value:"veo3",label:"veo3"},{value:"veo3-fast",label:"veo3-fast"}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||(this.value=z)}}),_e={class:"field"},he={class:"title font-bold"};function $e(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",_e,[l("h2",he,a(e.$t("veo.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select")},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ge=g(ve,[["render",$e],["__scopeId","data-v-ef445fc5"]]),be=$({name:"ActionSelector",components:{ElSelect:O,ElOption:D},data(){return{}},computed:{options(){return[{value:"text2video",label:this.$t("veo.button.action1")},{value:"image2video",label:this.$t("veo.button.action2")},{value:"get1080p",label:this.$t("veo.button.action3")}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||(this.value=M)}}),we={class:"field"},ke={class:"title font-bold"},ye={class:"float-left"};function Ve(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",we,[l("h2",ke,a(e.$t("veo.name.action")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select"),clearable:""},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},{default:u(()=>[l("span",ye,a(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(be,[["render",Ve],["__scopeId","data-v-ba5abc8a"]]),Se=$({name:"TranslationSelector",components:{ElSwitch:Y,InfoIcon:j},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug("set translation",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),Ie={class:"relative"},Te={class:"flex justify-between"},Ce={class:"flex justify-start items-center"},Ae={class:"text-sm font-bold"},Ge={class:"flex justify-end items-center"};function Re(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-switch");return n(),r("div",Ie,[l("div",Te,[l("div",Ce,[l("span",Ae,a(e.$t("veo.name.translation")),1),t(c,{content:e.$t("veo.description.translation")},null,8,["content"])]),l("div",Ge,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"])])])])}const Ue=g(Se,[["render",Re]]),Le=$({name:"AspectRatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=H)}}),je={class:"text-sm font-bold mb-2 block"},De={class:"items"},Oe=["onClick"],Pe={class:"name"};function Fe(e,o,m,v,b,w){return n(),r("div",null,[l("span",je,a(e.$t("veo.name.ratio")),1),l("div",De,[(n(!0),r(A,null,U(e.options,(c,d)=>(n(),r("div",{key:d,class:T({active:e.active===d,item:!0}),onClick:i=>e.value=c.value},[l("div",{class:T(["preview",c.label])},[l("div",{class:"rect",style:J({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Pe,a(c.label),1)],10,Oe))),128))])])}const Be=g(Le,[["render",Fe],["__scopeId","data-v-688d3e9d"]]),qe=$({name:"VideoFromInput",components:{VideoPlayer:P},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),ze={class:"relative"},Me={class:"flex mb-2"},Ne={class:"text-sm font-bold"};function He(e,o,m,v,b,w){const c=s("video-player");return n(),r("div",ze,[l("div",Me,[l("span",Ne,a(e.$t("veo.name.action3")),1)]),l("div",null,[e.config?.video_url?(n(),y(c,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const Je=g(qe,[["render",He]]),Ke=$({name:"StartEndImage",components:{ElUpload:x,ElButton:R,InfoIcon:j,FontAwesomeIcon:G,ImagePreview:Z},emits:["change"],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartEndImageUrl()},methods:{onExceed(){I.warning(this.$t("veo.message.uploadReferencesExceed"))},onError(){I.error(this.$t("veo.message.uploadReferencesError"))},onSetStartEndImageUrl(){const e=this.urls;this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Qe={class:"relative"},We={class:"flex justify-between"},Xe={class:"flex justify-start items-center"},Ye={class:"text-sm font-bold"};function Ze(e,o,m,v,b,w){const c=s("info-icon"),d=s("image-preview"),i=s("font-awesome-icon"),k=s("el-button"),_=s("el-upload");return n(),r("div",Qe,[l("div",We,[l("div",Xe,[l("span",Ye,a(e.$t("veo.name.startEndImage")),1),t(c,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),t(_,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:2,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(k,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(i,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+a(e.$t("veo.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const xe=g(Ke,[["render",Ze],["__scopeId","data-v-43d971b7"]]),et="",tt=$({name:"PromptInput",components:{ElInput:oe,InfoIcon:j},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=et)}}),ot={class:"field"},st={class:"box"},nt={class:"title font-bold"};function at(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-input");return n(),r("div",ot,[l("div",st,[l("h2",nt,a(e.$t("veo.name.prompt")),1),t(c,{content:e.$t("veo.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=i=>e.prompt=i),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("veo.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const lt=g(tt,[["render",at],["__scopeId","data-v-9189572a"]]),it=$({name:"ConfigPanel",components:{ElButton:R,Consumption:ee,FontAwesomeIcon:G,PromptInput:lt,ModelSelector:ge,StartEndImage:xe,ActionSelector:Ee,VideoFromInput:Je,TranslationSelector:Ue,AspectRatioSelector:Be},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return se(this.config,this.service?.metadata?.price)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),rt={class:"flex flex-col h-full"},ct={class:"flex-1 overflow-y-auto p-[15px]"},dt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ut(e,o,m,v,b,w){const c=s("video-from-input"),d=s("action-selector"),i=s("translation-selector"),k=s("aspect-ratio-selector"),_=s("prompt-input"),p=s("model-selector"),V=s("start-end-image"),C=s("consumption"),F=s("font-awesome-icon"),B=s("el-button");return n(),r("div",rt,[l("div",ct,[E(t(c,{class:"mb-4"},null,512),[[S,e.config?.action==="get1080p"]]),t(d,{class:"mb-4"}),E(t(i,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(k,{class:"mb-4"},null,512),[[S,e.config?.action==="image2video"]]),E(t(_,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(p,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(V,{class:"mb-2"},null,512),[[S,e.config?.action==="image2video"]])]),l("div",dt,[t(C,{value:e.consumption,service:e.service},null,8,["value","service"]),t(B,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(F,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+a(e.$t("veo.button.generate")),1)]),_:1},8,["onClick"])])])}const pt=g(it,[["render",ut]]),mt=$({name:"TaskPreview",components:{ElImage:ie,CopyToClipboard:ne,FontAwesomeIcon:G,ElAlert:le,VideoPlayer:P,ElTooltip:ae,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onGet1080p(e,o){console.debug("set config",o),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,video_id:o?.data?.[0]?.id,video_url:o?.data[0]?.video_url,action:"get1080p"})},onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ft={class:"preview"},vt={class:"left"},_t={class:"main"},ht={class:"bot"},$t={class:"datetime"},gt={class:"info"},bt={key:0,class:"prompt mt-2"},wt={key:0},kt={key:1},yt={key:0,class:T({content:!0,failed:!0})},Vt={key:0,class:"mb-4"},Et={key:1,class:T({operations:!0,"mt-2":!0})},St={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},It={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Tt={key:1,class:T({content:!0})},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},At={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Gt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Rt={key:2,class:T({content:!0})},Ut={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Lt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function jt(e,o,m,v,b,w){const c=s("el-image"),d=s("video-player"),i=s("el-button"),k=s("el-tooltip"),_=s("font-awesome-icon"),p=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",ft,[l("div",vt,[t(c,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),l("div",_t,[l("div",ht,[h(a(e.$t("veo.name.veoBot"))+" ",1),l("span",$t,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",gt,[e.modelValue?.request?.prompt?(n(),r("p",bt,[h(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(n(),r("span",wt," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",kt," - ("+a(e.$t("veo.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",yt,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",Vt,[t(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response.success?(n(),r("div",Et,[t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=C=>e.onGet1080p(C,e.modelValue?.response))},{default:u(()=>[h(a(e.$t("veo.button.action3")),1)]),_:1})):f("",!0)]),_:1},8,["content"]),t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=C=>e.onDownload(C,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(a(e.$t("veo.button.download")),1)]),_:1})):f("",!0)]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",St,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),l("p",It,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Tt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ct,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",At,[t(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+a(e.$t("veo.name.failureReason"))+": "+a(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Gt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Rt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ut,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Lt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0)])])}const Dt=g(mt,[["render",jt],["__scopeId","data-v-5372c9d1"]]),Ot=$({name:"RecentPanel",components:{TaskPreview:Dt,NoTasks:te,BotPlaceholder:re},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Pt={key:0},Ft={key:1,class:"tasks h-full w-full overflow-y-auto"},Bt={key:2,class:"w-full h-full flex items-center justify-center"};function qt(e,o,m,v,b,w){const c=s("bot-placeholder"),d=s("task-preview"),i=s("no-tasks");return n(),r(A,null,[e.tasks?.items===void 0?(n(),r("div",Pt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",Ft,[(n(!0),r(A,null,U(e.tasks?.items,(k,_)=>(n(),y(d,{key:_,"model-value":k},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(n(),r("div",Bt,[t(i)])):f("",!0)],64)}const zt=g(Ot,[["render",qt]]),Mt="https://webhook.acedata.cloud/veo",Nt=$({name:"VeoIndex",components:{ConfigPanel:pt,Layout:fe,RecentPanel:zt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.veo?.status?.getApplications===X.Request},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("veo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("veo/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:v}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",v),await this.$store.dispatch("veo/getTasks",{limit:o,createdAtMin:m,createdAtMax:v})},async onGenerate(){const e={...this.config,callback_url:Mt},o=this.credential?.token;if(!o){console.error("no token specified");return}I.info(this.$t("veo.message.startingTask")),Q.generate(e,{token:o}).then(()=>{I.success(this.$t("veo.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===W?I.error(this.$t("veo.message.usedUp")):I.error(this.$t("veo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ht(e,o,m,v,b,w){const c=s("config-panel"),d=s("recent-panel"),i=s("layout");return n(),y(i,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Co=g(Nt,[["render",Ht]]);export{Co as default};
|
|
1
|
+
import{F as G}from"./index.es-p3WzQOq6.js";import{E as R}from"./index-BPDafUhu.js";import{E as q}from"./index-B0lmXmn1.js";import{d as $,h as g,b as r,t as l,k as t,r as L,j as u,l as s,o as n,eB as z,x as a,F as A,v as U,i as y,eC as M,eD as N,eE as H,n as T,f as J,y as f,c9 as K,D as h,J as E,K as S,eF as Q,du as W,dq as X}from"./index-BquyEGf6.js";import{E as D,a as O}from"./index-Bbv8AcsL.js";import{I as j}from"./InfoIcon-LF-0__cu.js";import{E as Y}from"./index-DMcrRoGp.js";import{V as P}from"./VideoPlayer-DAzEIQG8.js";import{I as Z}from"./ImagePreview-B5tjfDBl.js";import{E as x}from"./index-CGd3r2k1.js";import{E as I}from"./index-B1ltQzXY.js";import{C as ee,N as te}from"./NoTasks-7U68u4-g.js";import{E as oe}from"./index-DO2Q3h3U.js";import{a as se}from"./price-QrgS9vBm.js";import{C as ne}from"./CopyToClipboard-DvCoKPTQ.js";import{E as ae}from"./index-Cwls0ZAN.js";import{E as le}from"./index-bP-68lHF.js";import{E as ie}from"./index-FdU7uO_k.js";import{B as re}from"./BotPlaceholder-D2NiVhQ8.js";import"./use-form-item-n2htyTGx.js";import"./index-r5W6hzzQ.js";import"./index-Dvf0QjP1.js";import"./typescript-C_0I_mxX.js";import"./index-D_OfWunA.js";import"./strings-Bbr3e8ju.js";import"./castArray-CCwFp0WG.js";import"./isEqual-CD5SlWKj.js";import"./_initCloneObject-DBpc_lNE.js";import"./debounce-BdbhCXbs.js";import"./_baseIteratee-FPmiAqiQ.js";import"./index-C4dxWzTO.js";import"./vue-plyr-QZFBikSk.js";import"./index-DcHF8gEn.js";import"./_baseClone-CkMTtQ9D.js";import"./index-CYVG-TAg.js";import"./index-Dns87zhU.js";const ce=$({name:"LayoutVeo",components:{ElDrawer:q,ElButton:R,FontAwesomeIcon:G},data(){return{drawer:!1}}}),de={class:"main flex flex-row flex-1"},ue={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},pe={class:"result h-full p-[15px] flex-1 flex flex-col"};function me(e,o,m,v,b,w){const c=s("font-awesome-icon"),d=s("el-button"),i=s("el-drawer");return n(),r("div",de,[l("div",ue,[L(e.$slots,"config",{},void 0,!0)]),l("div",pe,[L(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=k=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=k=>e.drawer=k),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[L(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const fe=g(ce,[["render",me],["__scopeId","data-v-cfe3cae3"]]),ve=$({name:"ModelSelector",components:{ElSelect:O,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"veo2",label:"veo2"},{value:"veo2-fast",label:"veo2-fast"},{value:"veo3",label:"veo3"},{value:"veo3-fast",label:"veo3-fast"}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||(this.value=z)}}),_e={class:"field"},he={class:"title font-bold"};function $e(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",_e,[l("h2",he,a(e.$t("veo.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select")},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ge=g(ve,[["render",$e],["__scopeId","data-v-ef445fc5"]]),be=$({name:"ActionSelector",components:{ElSelect:O,ElOption:D},data(){return{}},computed:{options(){return[{value:"text2video",label:this.$t("veo.button.action1")},{value:"image2video",label:this.$t("veo.button.action2")},{value:"get1080p",label:this.$t("veo.button.action3")}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||(this.value=M)}}),we={class:"field"},ke={class:"title font-bold"},ye={class:"float-left"};function Ve(e,o,m,v,b,w){const c=s("el-option"),d=s("el-select");return n(),r("div",we,[l("h2",ke,a(e.$t("veo.name.action")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("veo.placeholder.select"),clearable:""},{default:u(()=>[(n(!0),r(A,null,U(e.options,i=>(n(),y(c,{key:i.value,label:i.label,value:i.value},{default:u(()=>[l("span",ye,a(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ee=g(be,[["render",Ve],["__scopeId","data-v-ba5abc8a"]]),Se=$({name:"TranslationSelector",components:{ElSwitch:Y,InfoIcon:j},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug("set translation",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),Ie={class:"relative"},Te={class:"flex justify-between"},Ce={class:"flex justify-start items-center"},Ae={class:"text-sm font-bold"},Ge={class:"flex justify-end items-center"};function Re(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-switch");return n(),r("div",Ie,[l("div",Te,[l("div",Ce,[l("span",Ae,a(e.$t("veo.name.translation")),1),t(c,{content:e.$t("veo.description.translation")},null,8,["content"])]),l("div",Ge,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"])])])])}const Ue=g(Se,[["render",Re]]),Le=$({name:"AspectRatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"4:3",label:"4:3",width:20,height:15},{value:"3:4",label:"3:4",width:15,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=H)}}),je={class:"text-sm font-bold mb-2 block"},De={class:"items"},Oe=["onClick"],Pe={class:"name"};function Fe(e,o,m,v,b,w){return n(),r("div",null,[l("span",je,a(e.$t("veo.name.ratio")),1),l("div",De,[(n(!0),r(A,null,U(e.options,(c,d)=>(n(),r("div",{key:d,class:T({active:e.active===d,item:!0}),onClick:i=>e.value=c.value},[l("div",{class:T(["preview",c.label])},[l("div",{class:"rect",style:J({width:c.width+"px",height:c.height+"px"})},null,4)],2),l("p",Pe,a(c.label),1)],10,Oe))),128))])])}const Be=g(Le,[["render",Fe],["__scopeId","data-v-688d3e9d"]]),qe=$({name:"VideoFromInput",components:{VideoPlayer:P},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.veo?.config}}}),ze={class:"relative"},Me={class:"flex mb-2"},Ne={class:"text-sm font-bold"};function He(e,o,m,v,b,w){const c=s("video-player");return n(),r("div",ze,[l("div",Me,[l("span",Ne,a(e.$t("veo.name.action3")),1)]),l("div",null,[e.config?.video_url?(n(),y(c,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const Je=g(qe,[["render",He]]),Ke=$({name:"StartEndImage",components:{ElUpload:x,ElButton:R,InfoIcon:j,FontAwesomeIcon:G,ImagePreview:Z},emits:["change"],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartEndImageUrl()},methods:{onExceed(){I.warning(this.$t("veo.message.uploadReferencesExceed"))},onError(){I.error(this.$t("veo.message.uploadReferencesError"))},onSetStartEndImageUrl(){const e=this.urls;this.$store.commit("veo/setConfig",{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Qe={class:"relative"},We={class:"flex justify-between"},Xe={class:"flex justify-start items-center"},Ye={class:"text-sm font-bold"};function Ze(e,o,m,v,b,w){const c=s("info-icon"),d=s("image-preview"),i=s("font-awesome-icon"),k=s("el-button"),_=s("el-upload");return n(),r("div",Qe,[l("div",We,[l("div",Xe,[l("span",Ye,a(e.$t("veo.name.startEndImage")),1),t(c,{content:e.$t("veo.description.uploadStartEndImage")},null,8,["content"])])]),t(_,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:2,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(k,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(i,{icon:"fa-solid fa-upload",class:"icon mr-1"}),h(" "+a(e.$t("veo.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const xe=g(Ke,[["render",Ze],["__scopeId","data-v-43d971b7"]]),et="",tt=$({name:"PromptInput",components:{ElInput:oe,InfoIcon:j},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=et)}}),ot={class:"field"},st={class:"box"},nt={class:"title font-bold"};function at(e,o,m,v,b,w){const c=s("info-icon"),d=s("el-input");return n(),r("div",ot,[l("div",st,[l("h2",nt,a(e.$t("veo.name.prompt")),1),t(c,{content:e.$t("veo.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=i=>e.prompt=i),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("veo.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const lt=g(tt,[["render",at],["__scopeId","data-v-9189572a"]]),it=$({name:"ConfigPanel",components:{ElButton:R,Consumption:ee,FontAwesomeIcon:G,PromptInput:lt,ModelSelector:ge,StartEndImage:xe,ActionSelector:Ee,VideoFromInput:Je,TranslationSelector:Ue,AspectRatioSelector:Be},emits:["generate"],computed:{config(){return this.$store.state.veo?.config},consumption(){return se(this.config,this.service?.metadata?.price)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit("generate")}}}),rt={class:"flex flex-col h-full"},ct={class:"flex-1 overflow-y-auto p-[15px]"},dt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ut(e,o,m,v,b,w){const c=s("video-from-input"),d=s("action-selector"),i=s("translation-selector"),k=s("aspect-ratio-selector"),_=s("prompt-input"),p=s("model-selector"),V=s("start-end-image"),C=s("consumption"),F=s("font-awesome-icon"),B=s("el-button");return n(),r("div",rt,[l("div",ct,[E(t(c,{class:"mb-4"},null,512),[[S,e.config?.action==="get1080p"]]),t(d,{class:"mb-4"}),E(t(i,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(k,{class:"mb-4"},null,512),[[S,e.config?.action==="image2video"]]),E(t(_,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(p,{class:"mb-4"},null,512),[[S,e.config?.action!=="get1080p"]]),E(t(V,{class:"mb-2"},null,512),[[S,e.config?.action==="image2video"]])]),l("div",dt,[t(C,{value:e.consumption,service:e.service},null,8,["value","service"]),t(B,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(F,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+a(e.$t("veo.button.generate")),1)]),_:1},8,["onClick"])])])}const pt=g(it,[["render",ut]]),mt=$({name:"TaskPreview",components:{ElImage:ie,CopyToClipboard:ne,FontAwesomeIcon:G,ElAlert:le,VideoPlayer:P,ElTooltip:ae,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onGet1080p(e,o){console.debug("set config",o),this.$store.commit("veo/setConfig",{...this.$store.state.veo?.config,video_id:o?.data?.[0]?.id,video_url:o?.data[0]?.video_url,action:"get1080p"})},onDownload(e,o){e.stopPropagation(),console.log("on download"),window.open(o,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ft={class:"preview"},vt={class:"left"},_t={class:"main"},ht={class:"bot"},$t={class:"datetime"},gt={class:"info"},bt={key:0,class:"prompt mt-2"},wt={key:0},kt={key:1},yt={key:0,class:T({content:!0,failed:!0})},Vt={key:0,class:"mb-4"},Et={key:1,class:T({operations:!0,"mt-2":!0})},St={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},It={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Tt={key:1,class:T({content:!0})},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},At={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Gt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Rt={key:2,class:T({content:!0})},Ut={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Lt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function jt(e,o,m,v,b,w){const c=s("el-image"),d=s("video-player"),i=s("el-button"),k=s("el-tooltip"),_=s("font-awesome-icon"),p=s("copy-to-clipboard"),V=s("el-alert");return n(),r("div",ft,[l("div",vt,[t(c,{src:"https://cdn.acedata.cloud/8nxyy9.jpg",class:"avatar"})]),l("div",_t,[l("div",ht,[h(a(e.$t("veo.name.veoBot"))+" ",1),l("span",$t,a(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",gt,[e.modelValue?.request?.prompt?(n(),r("p",bt,[h(a(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(n(),r("span",wt," - ("+a(e.$t("veo.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="running"?(n(),r("span",kt," - ("+a(e.$t("veo.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),r("div",yt,[e.modelValue?.response?.data[0]?.video_url?(n(),r("div",Vt,[t(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response.success?(n(),r("div",Et,[t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=C=>e.onGet1080p(C,e.modelValue?.response))},{default:u(()=>[h(a(e.$t("veo.button.action3")),1)]),_:1})):f("",!0)]),_:1},8,["content"]),t(k,{class:"box-item",effect:"dark",content:e.$t("veo.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=C=>e.onDownload(C,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(a(e.$t("veo.button.download")),1)]),_:1})):f("",!0)]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[l("p",St,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.model"))+": "+a(e.modelValue?.request?.model),1)]),l("p",It,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Tt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ct,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),l("p",At,[t(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),h(" "+a(e.$t("veo.name.failureReason"))+": "+a(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Gt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Rt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+a(e.$t("veo.name.failure")),1)]),default:u(()=>[l("p",Ut,[t(_,{icon:"fa-solid fa-magic",class:"mr-1"}),h(" "+a(e.$t("veo.name.taskId"))+": "+a(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Lt,[t(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+a(e.$t("veo.name.traceId"))+": "+a(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):f("",!0)]),_:1})])):f("",!0)])])}const Dt=g(mt,[["render",jt],["__scopeId","data-v-5372c9d1"]]),Ot=$({name:"RecentPanel",components:{TaskPreview:Dt,NoTasks:te,BotPlaceholder:re},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Pt={key:0},Ft={key:1,class:"tasks h-full w-full overflow-y-auto"},Bt={key:2,class:"w-full h-full flex items-center justify-center"};function qt(e,o,m,v,b,w){const c=s("bot-placeholder"),d=s("task-preview"),i=s("no-tasks");return n(),r(A,null,[e.tasks?.items===void 0?(n(),r("div",Pt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",Ft,[(n(!0),r(A,null,U(e.tasks?.items,(k,_)=>(n(),y(d,{key:_,"model-value":k},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(n(),r("div",Bt,[t(i)])):f("",!0)],64)}const zt=g(Ot,[["render",qt]]),Mt="https://webhook.acedata.cloud/veo",Nt=$({name:"VeoIndex",components:{ConfigPanel:pt,Layout:fe,RecentPanel:zt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.veo?.status?.getApplications===X.Request},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("veo/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("veo/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:m,createdAtMax:v}=e||{};console.debug("limit",o,"createdAtMin",m,"createdAtMax",v),await this.$store.dispatch("veo/getTasks",{limit:o,createdAtMin:m,createdAtMax:v})},async onGenerate(){const e={...this.config,callback_url:Mt},o=this.credential?.token;if(!o){console.error("no token specified");return}I.info(this.$t("veo.message.startingTask")),Q.generate(e,{token:o}).then(()=>{I.success(this.$t("veo.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===W?I.error(this.$t("veo.message.usedUp")):I.error(this.$t("veo.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ht(e,o,m,v,b,w){const c=s("config-panel"),d=s("recent-panel"),i=s("layout");return n(),y(i,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Co=g(Nt,[["render",Ht]]);export{Co as default};
|