@acedatacloud/nexior 3.25.2 → 3.25.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/assets/{Auth-uEaTvgIG.js → Auth-BHNFFaW0.js} +1 -1
  2. package/dist/assets/{BotPlaceholder-CWIWz7Gv.js → BotPlaceholder-X527oxpB.js} +1 -1
  3. package/dist/assets/{Callback-DeogbX_Z.js → Callback-BwvM2Leh.js} +1 -1
  4. package/dist/assets/{Console-DVy8L3h3.js → Console-Co0hX4yW.js} +1 -1
  5. package/dist/assets/{Conversation-Bq-Is833.js → Conversation-QA7hKXys.js} +2 -2
  6. package/dist/assets/{CopyToClipboard-BaNpbWBZ.js → CopyToClipboard-CIkwptVu.js} +1 -1
  7. package/dist/assets/{Detail-CupfVvNT.js → Detail-DschNOpf.js} +1 -1
  8. package/dist/assets/{EditArray-D56-95ng.js → EditArray-D6OZGcO-.js} +1 -1
  9. package/dist/assets/{Extra-BF8dUGzC.js → Extra-5Iq9o04S.js} +1 -1
  10. package/dist/assets/{FilePreview-OF0R4eHf.js → FilePreview-NHNFD0Lq.js} +1 -1
  11. package/dist/assets/{History-C8lzpKpg.js → History-pwiuyUOc.js} +1 -1
  12. package/dist/assets/{ImagePreview-B9AiNOkr.js → ImagePreview-dRRztBTN.js} +1 -1
  13. package/dist/assets/{ImageWrapper-CxP_Xv7_.js → ImageWrapper-BOEqMoAZ.js} +1 -1
  14. package/dist/assets/{Index-CCBAqPjz.js → Index-8AhOD6eW.js} +1 -1
  15. package/dist/assets/Index-BgIeGjY2.js +1 -0
  16. package/dist/assets/{Index-D4Mg8ioS.js → Index-BwZBZoCO.js} +1 -1
  17. package/dist/assets/{Index-ChyPCxhS.js → Index-C4OpOA5V.js} +1 -1
  18. package/dist/assets/{Index-DMlsiz-D.js → Index-CFtAbBiB.js} +1 -1
  19. package/dist/assets/{Index-BvvIHasV.js → Index-COlN-eC-.js} +1 -1
  20. package/dist/assets/{Index-GSNorvTQ.js → Index-CmRfVRCL.js} +1 -1
  21. package/dist/assets/{Index-H2tBAlzy.css → Index-D7WrHku9.css} +1 -1
  22. package/dist/assets/{Index-CXln4m8b.js → Index-DEX8v4L9.js} +1 -1
  23. package/dist/assets/{Index-aLG14e34.js → Index-DLovrzIx.js} +1 -1
  24. package/dist/assets/{Index-GRmuvl1O.js → Index-DOT63mlR.js} +1 -1
  25. package/dist/assets/{Index-QKJc2d4a.js → Index-DeDHuYXP.js} +1 -1
  26. package/dist/assets/{Index-BbZJL92i.js → Index-Dhb0KcdB.js} +1 -1
  27. package/dist/assets/{Index-BceVb1yY.js → Index-PXHiibWZ.js} +1 -1
  28. package/dist/assets/{Index-CYb4mBk-.js → Index-VnMSXV_o.js} +1 -1
  29. package/dist/assets/{Index-BpclUPkG.js → Index-_ElaLMG0.js} +1 -1
  30. package/dist/assets/{Index-BuZyLDaH.js → Index-fpQ_5d8o.js} +1 -1
  31. package/dist/assets/{Invitees-Cqd-IJvM.js → Invitees-BMRcxvWX.js} +1 -1
  32. package/dist/assets/{List-BD_W29o7.js → List-B0dEnow9.js} +1 -1
  33. package/dist/assets/{List-BG6SK2bv.js → List-DV0E4VwB.js} +1 -1
  34. package/dist/assets/{List-CNIIIa2p.js → List-GKL_gIHW.js} +1 -1
  35. package/dist/assets/{Login-SbUGPFRV.js → Login-CipyYI2X.js} +1 -1
  36. package/dist/assets/{Main-Cx7zMhzU.js → Main-Cdl_IZ7q.js} +1 -1
  37. package/dist/assets/{Navigator-BvURz3Ii.js → Navigator-BW4Fq1YT.js} +1 -1
  38. package/dist/assets/{NoTasks-LBG69HXd.js → NoTasks-CTLWrX9X.js} +1 -1
  39. package/dist/assets/{Pagination-DuQkmlmU.js → Pagination-CEhDRM0w.js} +1 -1
  40. package/dist/assets/{ScrollList-Da5H8n1W.js → ScrollList-DJyagTd9.js} +1 -1
  41. package/dist/assets/{Status-DLLXrg8C.js → Status-DdGv5F_f.js} +1 -1
  42. package/dist/assets/{Subscribe-C8pwHU9y.js → Subscribe-CQzRmtqj.js} +1 -1
  43. package/dist/assets/{VideoPlayer-1sMyrvvI.js → VideoPlayer-Cc0aqBXp.js} +1 -1
  44. package/dist/assets/{_baseClone-BMdvC2Mn.js → _baseClone-Ds-s3IuL.js} +1 -1
  45. package/dist/assets/{_baseIteratee-DChJIcFX.js → _baseIteratee-CPuZRdwJ.js} +1 -1
  46. package/dist/assets/{_initCloneObject-DbztCTz9.js → _initCloneObject-B9BC83jE.js} +1 -1
  47. package/dist/assets/{castArray-DeMftDkR.js → castArray-DhOK83j4.js} +1 -1
  48. package/dist/assets/{debounce-VZSmCnjc.js → debounce-BUHPvvRx.js} +1 -1
  49. package/dist/assets/{distribution-BhtEnCdU.js → distribution-OPhlJ0iO.js} +1 -1
  50. package/dist/assets/{dropdown-Zkpj2dmg.js → dropdown-CaEtFY5K.js} +1 -1
  51. package/dist/assets/{index--7ePKMSn.js → index-1DvQjuZj.js} +1 -1
  52. package/dist/assets/{index-D0WBECq3.js → index-26q3vWe3.js} +1 -1
  53. package/dist/assets/{index-De2Qy988.js → index-2amtGE73.js} +1 -1
  54. package/dist/assets/{index-CBjH-ba3.js → index-4xbTEHb4.js} +1 -1
  55. package/dist/assets/{index-mzmwNl_7.js → index-B3SbvjbA.js} +1 -1
  56. package/dist/assets/{index-YkYnrHwJ.js → index-BRW1meHI.js} +1 -1
  57. package/dist/assets/{index-CnT57L09.js → index-BVPDEl6k.js} +1 -1
  58. package/dist/assets/{index-KgukxKxV.js → index-BaT0jRk-.js} +1 -1
  59. package/dist/assets/{index-3NYwkLyG.js → index-Bd52b9MQ.js} +1 -1
  60. package/dist/assets/{index-Te4f4sQ1.js → index-BmMTzT1e.js} +1 -1
  61. package/dist/assets/{index-YThWA6RB.js → index-C7z3Qnen.js} +1 -1
  62. package/dist/assets/{index-Cs4PWpId.js → index-CDNBMXQ3.js} +1 -1
  63. package/dist/assets/{index-Ku6Sz2EJ.js → index-CDNsPXeD.js} +1 -1
  64. package/dist/assets/{index-Hs3vNnfT.js → index-CNtJ-qZ0.js} +1 -1
  65. package/dist/assets/{index-DocBcnBZ.js → index-CSXF3X1e.js} +1 -1
  66. package/dist/assets/{index-37AxtFjF.js → index-CTL_q_Ls.js} +1 -1
  67. package/dist/assets/{index-DM378UJ5.js → index-CW8-s5uS.js} +1 -1
  68. package/dist/assets/{index-D9pvcimv.js → index-CyrG-q_g.js} +1 -1
  69. package/dist/assets/{index-DYnnhtAJ.js → index-D4jtulwF.js} +1 -1
  70. package/dist/assets/{index-CiHUKD8b.js → index-DGxwm39f.js} +1 -1
  71. package/dist/assets/{index-mx0WSQ4c.js → index-DKQ8F7GC.js} +1 -1
  72. package/dist/assets/{index-BsqHMnHM.js → index-DND3fxYf.js} +1 -1
  73. package/dist/assets/{index-CStoqsn2.js → index-DVU3OOIj.js} +1 -1
  74. package/dist/assets/{index-b8eWDndR.js → index-DW12D-0Y.js} +1 -1
  75. package/dist/assets/{index-D1FLNvCi.js → index-OA9O6lVC.js} +2 -2
  76. package/dist/assets/{index-C-3cQPP1.js → index-fTsXD2fu.js} +1 -1
  77. package/dist/assets/{index-CMszY_K9.js → index-i6VHNkjA.js} +1 -1
  78. package/dist/assets/{index-BdosEN9l.js → index-jczR9H1q.js} +1 -1
  79. package/dist/assets/{index-BWP7r6hW.js → index-oXM3BzcC.js} +1 -1
  80. package/dist/assets/{index-D3JIjilD.js → index-vNo-DKgh.js} +1 -1
  81. package/dist/assets/{index-B2k0ADfO.css → index-vxVcmqZU.css} +1 -1
  82. package/dist/assets/{index.es-luG_1liH.js → index.es-D3TSGwa1.js} +1 -1
  83. package/dist/assets/{isEqual-DLFFes9f.js → isEqual-vZWfltqX.js} +1 -1
  84. package/dist/assets/{isPlainObject-DmCe5CCK.js → isPlainObject-DkP5CYDL.js} +1 -1
  85. package/dist/assets/{order-Bb5Mw26J.js → order-DnqhjHpP.js} +1 -1
  86. package/dist/assets/{pagination-D0-pgnZd.js → pagination-Bwva12lc.js} +1 -1
  87. package/dist/assets/{price-D62LsAs8.js → price-DX6_QWGs.js} +1 -1
  88. package/dist/assets/{strings-MRnF76Oy.js → strings-CE5wx3lU.js} +1 -1
  89. package/dist/assets/{typescript-BOpWBj_W.js → typescript-D5kqm2pC.js} +1 -1
  90. package/dist/assets/{use-form-item-o9ewPWuR.js → use-form-item-CLxXgCpM.js} +1 -1
  91. package/dist/index.html +2 -2
  92. package/package.json +1 -1
  93. package/dist/assets/Index-B4kwXaJe.js +0 -1
@@ -1 +1 @@
1
- import{F as L}from"./index.es-luG_1liH.js";import{E as R}from"./index-D3JIjilD.js";import{E as F}from"./index-CiHUKD8b.js";import{d as _,h,b as r,t as l,k as o,r as P,j as d,l as s,o as a,f6 as O,x as c,F as V,v as S,i as w,f7 as q,f8 as N,f9 as z,fa as X,fb as Q,n as T,f as Y,cf as H,D as k,y,fc as J,dN as K,dJ as D}from"./index-D1FLNvCi.js";import{E as I,a as C}from"./index-mx0WSQ4c.js";import{I as A,S as W}from"./ScrollList-Da5H8n1W.js";import{E as Z,a as ee}from"./index-C-3cQPP1.js";import{I as te}from"./ImagePreview-B9AiNOkr.js";import{E as se}from"./index-DocBcnBZ.js";import{E as x}from"./index--7ePKMSn.js";import{E as oe}from"./index-YkYnrHwJ.js";import{C as ne,N as ae}from"./NoTasks-LBG69HXd.js";import{a as le}from"./price-D62LsAs8.js";import{C as ie}from"./CopyToClipboard-BaNpbWBZ.js";import{V as re}from"./VideoPlayer-1sMyrvvI.js";import{E as ce}from"./index-CnT57L09.js";import{E as pe}from"./index-De2Qy988.js";import{E as de}from"./index-3NYwkLyG.js";import{B as ue}from"./BotPlaceholder-CWIWz7Gv.js";import{l as me}from"./pagination-D0-pgnZd.js";import"./use-form-item-o9ewPWuR.js";import"./index-r5W6hzzQ.js";import"./index-DYnnhtAJ.js";import"./typescript-BOpWBj_W.js";import"./index-YThWA6RB.js";import"./strings-MRnF76Oy.js";import"./castArray-DeMftDkR.js";import"./isEqual-DLFFes9f.js";import"./_initCloneObject-DbztCTz9.js";import"./debounce-VZSmCnjc.js";import"./_baseIteratee-DChJIcFX.js";import"./index-37AxtFjF.js";import"./index-CMszY_K9.js";import"./index-b8eWDndR.js";import"./_baseClone-BMdvC2Mn.js";import"./index-DM378UJ5.js";import"./vue-plyr-QZFBikSk.js";import"./index-CStoqsn2.js";const ve=_({name:"LayoutPixverse",components:{ElDrawer:F,ElButton:R,FontAwesomeIcon:L},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,$,g){const i=s("font-awesome-icon"),p=s("el-button"),n=s("el-drawer");return a(),r("div",fe,[l("div",_e,[P(e.$slots,"config",{},void 0,!0)]),l("div",he,[P(e.$slots,"result",{},void 0,!0)]),o(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=f=>e.drawer=!0)},{default:d(()=>[o(i,{icon:"fa-solid fa-magic"})]),_:1}),o(n,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=f=>e.drawer=f),direction:"ltr","with-header":!1,size:"350px"},{default:d(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ge=h(ve,[["render",$e],["__scopeId","data-v-0646853d"]]),be=_({name:"ModelSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"v3.5",label:"v3.5"},{value:"v4",label:"v4"},{value:"v4.5",label:"v4.5"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||(this.value=O)}}),ye={class:"field"},ke={class:"title font-bold"};function we(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",ye,[l("h2",ke,c(e.$t("pixverse.name.model")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ve=h(be,[["render",we],["__scopeId","data-v-e8f337ca"]]),Se=_({name:"QualitySelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"360p",label:"360p"},{value:"540p",label:"540p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||(this.value=q)}}),xe={class:"field"},Ee={class:"title font-bold"};function Te(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",xe,[l("h2",Ee,c(e.$t("pixverse.name.quality")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=h(Se,[["render",Te],["__scopeId","data-v-64aeaae9"]]),Ce=_({name:"MotionSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"normal",label:this.$t("pixverse.name.motion1")},{value:"fast",label:this.$t("pixverse.name.motion2")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||(this.value=N)}}),Le={class:"field"},Re={class:"title font-bold"};function Ue(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",Le,[l("h2",Re,c(e.$t("pixverse.name.motion")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Pe=h(Ce,[["render",Ue],["__scopeId","data-v-94237408"]]),Ae=_({name:"StyleSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"cyberpunk",label:this.$t("pixverse.name.style1")},{value:"anime",label:this.$t("pixverse.name.style2")},{value:"comic",label:this.$t("pixverse.name.style3")},{value:"clay",label:this.$t("pixverse.name.style4")},{value:"3d_animation",label:this.$t("pixverse.name.style5")},{value:"realistic",label:this.$t("pixverse.name.style6")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||(this.value=z)}}),De={class:"field"},Ge={class:"title font-bold"};function je(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",De,[l("h2",Ge,c(e.$t("pixverse.name.style")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Me=h(Ae,[["render",je],["__scopeId","data-v-64e17b3c"]]),Be=_({name:"SeedSelector",components:{ElSlider:ee,InfoIcon:A,ElInputNumber:Z},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug("set seed",e),this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||(this.value=void 0)}}),Fe={class:"flex justify-between"},Oe={class:"flex justify-start items-center"},qe={class:"text-sm font-bold"},Ne={class:"flex justify-end items-center"},ze={class:"w-full"};function Xe(e,t,u,m,$,g){const i=s("info-icon"),p=s("el-input-number"),n=s("el-slider");return a(),r("div",null,[l("div",Fe,[l("div",Oe,[l("span",qe,c(e.$t("pixverse.name.seed")),1),o(i,{content:e.$t("pixverse.description.seed")},null,8,["content"])]),l("div",Ne,[o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),"controls-position":"right"},null,8,["modelValue"])])]),l("div",ze,[o(n,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=f=>e.value=f),min:0,max:1e3,step:1},null,8,["modelValue"])])])}const Qe=h(Be,[["render",Xe]]),Ye=_({name:"DurationSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5s"},{value:8,label:"8s"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||(this.value=X)}}),He={class:"field"},Je={class:"title font-bold"};function Ke(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",He,[l("h2",Je,c(e.$t("pixverse.name.duration")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const We=h(Ye,[["render",Ke],["__scopeId","data-v-065c77ef"]]),Ze=_({name:"RatioSelector",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.pixverse.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Q)}}),et={class:"text-sm font-bold mb-2 block"},tt={class:"items"},st=["onClick"],ot={class:"name"};function nt(e,t,u,m,$,g){return a(),r("div",null,[l("span",et,c(e.$t("pixverse.name.aspectRatio")),1),l("div",tt,[(a(!0),r(V,null,S(e.options,(i,p)=>(a(),r("div",{key:p,class:T({active:e.active===p,item:!0}),onClick:n=>e.value=i.value},[l("div",{class:T(["preview",i.label])},[l("div",{class:"rect",style:Y({width:i.width+"px",height:i.height+"px"})},null,4)],2),l("p",ot,c(i.label),1)],10,st))),128))])])}const at=h(Ze,[["render",nt],["__scopeId","data-v-32a7677f"]]),lt=_({name:"StartImage",components:{ElUpload:se,ElButton:R,InfoIcon:A,FontAwesomeIcon:L,ImagePreview:te},emits:["change"],data(){return{fileList:[],uploadUrl:H()+"/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?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){x.warning(this.$t("pixverse.message.uploadReferencesExceed"))},onError(){x.error(this.$t("pixverse.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),it={class:"relative"},rt={class:"flex justify-between"},ct={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function dt(e,t,u,m,$,g){const i=s("info-icon"),p=s("image-preview"),n=s("font-awesome-icon"),f=s("el-button"),b=s("el-upload");return a(),r("div",it,[l("div",rt,[l("div",ct,[l("span",pt,c(e.$t("pixverse.name.startImage")),1),o(i,{content:e.$t("pixverse.description.uploadStartImage")},null,8,["content"])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=v=>e.fileList=v),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:d(({file:v})=>[v.url&&v.percentage!==void 0?(a(),w(p,{key:0,url:v.url,name:v.name,percentage:v.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(v),1)},null,8,["url","name","percentage","onRemove"])):y("",!0)]),default:d(()=>[o(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:d(()=>[o(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),k(" "+c(e.$t("pixverse.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ut=h(lt,[["render",dt],["__scopeId","data-v-666104e4"]]),mt="",vt=_({name:"PromptInput",components:{ElInput:oe,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=mt)}}),ft={class:"field"},_t={class:"box"},ht={class:"title font-bold"};function $t(e,t,u,m,$,g){const i=s("info-icon"),p=s("el-input");return a(),r("div",ft,[l("div",_t,[l("h2",ht,c(e.$t("pixverse.name.prompt")),1),o(i,{content:e.$t("pixverse.description.prompt"),class:"info"},null,8,["content"])]),o(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pixverse.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const gt=h(vt,[["render",$t],["__scopeId","data-v-b3dd608e"]]),bt=_({name:"ConfigPanel",components:{ElButton:R,FontAwesomeIcon:L,PromptInput:gt,ModelSelector:Ve,QualitySelector:Ie,MotionSelector:Pe,StyleSelector:Me,DurationSelector:We,StartImage:ut,SeedSelector:Qe,RatioSelector:at,Consumption:ne},emits:["generate"],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return le(this.config,this.service?.cost)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit("generate")}}}),yt={class:"flex flex-col h-full"},kt={class:"flex-1 overflow-y-auto p-[15px]"},wt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Vt(e,t,u,m,$,g){const i=s("prompt-input"),p=s("model-selector"),n=s("style-selector"),f=s("ratio-selector"),b=s("motion-selector"),v=s("quality-selector"),E=s("start-image"),U=s("seed-selector"),G=s("duration-selector"),j=s("consumption"),M=s("font-awesome-icon"),B=s("el-button");return a(),r("div",yt,[l("div",kt,[o(i,{class:"mb-4"}),o(p,{class:"mb-4"}),o(n,{class:"mb-4"}),o(f,{class:"mb-4"}),o(b,{class:"mb-4"}),o(v,{class:"mb-4"}),o(E,{class:"mb-2"}),o(U,{class:"mb-4"}),o(G,{class:"mb-4"})]),l("div",wt,[o(j,{value:e.consumption,service:e.service},null,8,["value","service"]),o(B,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[o(M,{icon:"fa-solid fa-magic",class:"mr-2"}),k(" "+c(e.$t("pixverse.button.generate")),1)]),_:1},8,["onClick"])])])}const St=h(bt,[["render",Vt]]),xt=_({name:"TaskPreview",components:{ElImage:de,CopyToClipboard:ie,FontAwesomeIcon:L,ElAlert:pe,VideoPlayer:re,ElTooltip:ce,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Et={class:"preview"},Tt={class:"left"},It={class:"main"},Ct={class:"bot"},Lt={class:"datetime"},Rt={class:"info"},Ut={key:0,class:"prompt mt-2"},Pt={key:0},At={key:1},Dt={key:0,class:T({content:!0,failed:!0})},Gt={key:0,class:"mb-4"},jt={key:1,class:T({operations:!0,"mt-2":!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ft={key:1,class:T({content:!0})},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Nt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function zt(e,t,u,m,$,g){const i=s("el-image"),p=s("video-player"),n=s("el-button"),f=s("el-tooltip"),b=s("font-awesome-icon"),v=s("copy-to-clipboard"),E=s("el-alert");return a(),r("div",Et,[l("div",Tt,[o(i,{src:"https://cdn.acedata.cloud/viy61r.jpg",class:"avatar"})]),l("div",It,[l("div",Ct,[k(c(e.$t("pixverse.name.pixverseBot"))+" ",1),l("span",Lt,c(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Rt,[e.modelValue?.request?.prompt?(a(),r("p",Ut,[k(c(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?y("",!0):(a(),r("span",Pt," - ("+c(e.$t("pixverse.status.pending"))+") ",1)),e.modelValue?.response?.data&&(e.modelValue?.response?.data[0]?.state==="processing"||e.modelValue?.response?.data[0]?.state==="pending")?(a(),r("span",At," - ("+c(e.$t("pixverse.status.processing"))+") ",1)):y("",!0)])):y("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(a(),r("div",Dt,[e.modelValue?.response?.data[0]?.video_url?(a(),r("div",Gt,[o(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):y("",!0),e.modelValue?.response.success?(a(),r("div",jt,[o(f,{class:"box-item",effect:"dark",content:e.$t("pixverse.message.downloadVideo"),placement:"top-start"},{default:d(()=>[e.modelValue?.response?.data[0]?.video_url?(a(),w(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=U=>e.onDownload(U,e.modelValue?.response?.data[0]?.video_url))},{default:d(()=>[k(c(e.$t("pixverse.button.download")),1)]),_:1})):y("",!0)]),_:1},8,["content"])])):y("",!0),o(E,{closable:!1,class:"mt-2 success"},{default:d(()=>[l("p",Mt,[o(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.model"))+": "+c(e.modelValue?.request?.model),1)]),l("p",Bt,[o(b,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):y("",!0),e.modelValue?.response?.success===!1?(a(),r("div",Ft,[o(E,{closable:!1,class:"info"},{template:d(()=>[o(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.failure")),1)]),default:d(()=>[l("p",Ot,[o(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.failureReason"))+": "+c(e.modelValue?.response?.error?.message)+" ",1),o(v,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),l("p",qt,[o(b,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),r("p",Nt,[o(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.traceId"))+": "+c(e.modelValue?.response?.trace_id)+" ",1),o(v,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):y("",!0)]),_:1})])):y("",!0)])])}const Xt=h(xt,[["render",zt],["__scopeId","data-v-3f3bff8a"]]),Qt=_({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:ae,BotPlaceholder:ue,ScrollList:W},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Yt={key:0},Ht={key:2,class:"w-full h-full flex items-center justify-center"};function Jt(e,t,u,m,$,g){const i=s("bot-placeholder"),p=s("task-preview"),n=s("scroll-list"),f=s("no-tasks");return a(),r(V,null,[e.tasks?.items===void 0?(a(),r("div",Yt,[o(i)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),w(n,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:t[0]||(t[0]=b=>e.$emit("reach-top"))},{default:d(()=>[(a(!0),r(V,null,S(e.tasks?.items,(b,v)=>(a(),w(p,{key:v,"model-value":b},null,8,["model-value"]))),128))]),_:1},8,["loading"])):y("",!0),e.tasks?.items?.length===0?(a(),r("div",Ht,[o(f)])):y("",!0)],64)}const Kt=h(Qt,[["render",Jt]]),Wt="https://webhook.acedata.cloud/pixverse",Zt=_({name:"PixverseIndex",components:{ConfigPanel:St,Layout:ge,RecentPanel:Kt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===D.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===D.Request||this.fetchingTasks},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.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(){await me({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("pixverse/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pixverse/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:u,createdAtMax:m}=e||{};console.debug("limit",t,"createdAtMin",u,"createdAtMax",m),this.fetchingTasks=!0;try{await this.$store.dispatch("pixverse/getTasks",{limit:t,createdAtMin:u,createdAtMax:m})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:Wt},t=this.credential?.token;if(!t){console.error("no token specified");return}x.info(this.$t("pixverse.message.startingTask")),J.generate(e,{token:t}).then(()=>{x.success(this.$t("pixverse.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===K?x.error(this.$t("pixverse.message.usedUp")):x.error(this.$t("pixverse.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function es(e,t,u,m,$,g){const i=s("config-panel"),p=s("recent-panel"),n=s("layout");return a(),w(n,null,{config:d(()=>[o(i,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:d(()=>[o(p,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Ms=h(Zt,[["render",es]]);export{Ms as default};
1
+ import{F as L}from"./index.es-D3TSGwa1.js";import{E as R}from"./index-vNo-DKgh.js";import{E as F}from"./index-DGxwm39f.js";import{d as _,h,b as r,t as l,k as o,r as P,j as d,l as s,o as a,f6 as O,x as c,F as V,v as S,i as w,f7 as q,f8 as N,f9 as z,fa as X,fb as Q,n as T,f as Y,cf as H,D as k,y,fc as J,dN as K,dJ as D}from"./index-OA9O6lVC.js";import{E as I,a as C}from"./index-DKQ8F7GC.js";import{I as A,S as W}from"./ScrollList-DJyagTd9.js";import{E as Z,a as ee}from"./index-fTsXD2fu.js";import{I as te}from"./ImagePreview-dRRztBTN.js";import{E as se}from"./index-CSXF3X1e.js";import{E as x}from"./index-1DvQjuZj.js";import{E as oe}from"./index-BRW1meHI.js";import{C as ne,N as ae}from"./NoTasks-CTLWrX9X.js";import{a as le}from"./price-DX6_QWGs.js";import{C as ie}from"./CopyToClipboard-CIkwptVu.js";import{V as re}from"./VideoPlayer-Cc0aqBXp.js";import{E as ce}from"./index-BVPDEl6k.js";import{E as pe}from"./index-2amtGE73.js";import{E as de}from"./index-Bd52b9MQ.js";import{B as ue}from"./BotPlaceholder-X527oxpB.js";import{l as me}from"./pagination-Bwva12lc.js";import"./use-form-item-CLxXgCpM.js";import"./index-r5W6hzzQ.js";import"./index-D4jtulwF.js";import"./typescript-D5kqm2pC.js";import"./index-C7z3Qnen.js";import"./strings-CE5wx3lU.js";import"./castArray-DhOK83j4.js";import"./isEqual-vZWfltqX.js";import"./_initCloneObject-B9BC83jE.js";import"./debounce-BUHPvvRx.js";import"./_baseIteratee-CPuZRdwJ.js";import"./index-CTL_q_Ls.js";import"./index-i6VHNkjA.js";import"./index-DW12D-0Y.js";import"./_baseClone-Ds-s3IuL.js";import"./index-CW8-s5uS.js";import"./vue-plyr-QZFBikSk.js";import"./index-DVU3OOIj.js";const ve=_({name:"LayoutPixverse",components:{ElDrawer:F,ElButton:R,FontAwesomeIcon:L},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,$,g){const i=s("font-awesome-icon"),p=s("el-button"),n=s("el-drawer");return a(),r("div",fe,[l("div",_e,[P(e.$slots,"config",{},void 0,!0)]),l("div",he,[P(e.$slots,"result",{},void 0,!0)]),o(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=f=>e.drawer=!0)},{default:d(()=>[o(i,{icon:"fa-solid fa-magic"})]),_:1}),o(n,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=f=>e.drawer=f),direction:"ltr","with-header":!1,size:"350px"},{default:d(()=>[P(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ge=h(ve,[["render",$e],["__scopeId","data-v-0646853d"]]),be=_({name:"ModelSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"v3.5",label:"v3.5"},{value:"v4",label:"v4"},{value:"v4.5",label:"v4.5"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||(this.value=O)}}),ye={class:"field"},ke={class:"title font-bold"};function we(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",ye,[l("h2",ke,c(e.$t("pixverse.name.model")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ve=h(be,[["render",we],["__scopeId","data-v-e8f337ca"]]),Se=_({name:"QualitySelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"360p",label:"360p"},{value:"540p",label:"540p"},{value:"720p",label:"720p"},{value:"1080p",label:"1080p"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||(this.value=q)}}),xe={class:"field"},Ee={class:"title font-bold"};function Te(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",xe,[l("h2",Ee,c(e.$t("pixverse.name.quality")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=h(Se,[["render",Te],["__scopeId","data-v-64aeaae9"]]),Ce=_({name:"MotionSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"normal",label:this.$t("pixverse.name.motion1")},{value:"fast",label:this.$t("pixverse.name.motion2")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||(this.value=N)}}),Le={class:"field"},Re={class:"title font-bold"};function Ue(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",Le,[l("h2",Re,c(e.$t("pixverse.name.motion")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Pe=h(Ce,[["render",Ue],["__scopeId","data-v-94237408"]]),Ae=_({name:"StyleSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"cyberpunk",label:this.$t("pixverse.name.style1")},{value:"anime",label:this.$t("pixverse.name.style2")},{value:"comic",label:this.$t("pixverse.name.style3")},{value:"clay",label:this.$t("pixverse.name.style4")},{value:"3d_animation",label:this.$t("pixverse.name.style5")},{value:"realistic",label:this.$t("pixverse.name.style6")}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||(this.value=z)}}),De={class:"field"},Ge={class:"title font-bold"};function je(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",De,[l("h2",Ge,c(e.$t("pixverse.name.style")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Me=h(Ae,[["render",je],["__scopeId","data-v-64e17b3c"]]),Be=_({name:"SeedSelector",components:{ElSlider:ee,InfoIcon:A,ElInputNumber:Z},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug("set seed",e),this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||(this.value=void 0)}}),Fe={class:"flex justify-between"},Oe={class:"flex justify-start items-center"},qe={class:"text-sm font-bold"},Ne={class:"flex justify-end items-center"},ze={class:"w-full"};function Xe(e,t,u,m,$,g){const i=s("info-icon"),p=s("el-input-number"),n=s("el-slider");return a(),r("div",null,[l("div",Fe,[l("div",Oe,[l("span",qe,c(e.$t("pixverse.name.seed")),1),o(i,{content:e.$t("pixverse.description.seed")},null,8,["content"])]),l("div",Ne,[o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),"controls-position":"right"},null,8,["modelValue"])])]),l("div",ze,[o(n,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=f=>e.value=f),min:0,max:1e3,step:1},null,8,["modelValue"])])])}const Qe=h(Be,[["render",Xe]]),Ye=_({name:"DurationSelector",components:{ElSelect:C,ElOption:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5s"},{value:8,label:"8s"}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||(this.value=X)}}),He={class:"field"},Je={class:"title font-bold"};function Ke(e,t,u,m,$,g){const i=s("el-option"),p=s("el-select");return a(),r("div",He,[l("h2",Je,c(e.$t("pixverse.name.duration")),1),o(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=n=>e.value=n),class:"value",placeholder:e.$t("pixverse.placeholder.select")},{default:d(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),w(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const We=h(Ye,[["render",Ke],["__scopeId","data-v-065c77ef"]]),Ze=_({name:"RatioSelector",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.pixverse.config?.aspect_ratio},set(e){console.debug("set aspect_ratio",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Q)}}),et={class:"text-sm font-bold mb-2 block"},tt={class:"items"},st=["onClick"],ot={class:"name"};function nt(e,t,u,m,$,g){return a(),r("div",null,[l("span",et,c(e.$t("pixverse.name.aspectRatio")),1),l("div",tt,[(a(!0),r(V,null,S(e.options,(i,p)=>(a(),r("div",{key:p,class:T({active:e.active===p,item:!0}),onClick:n=>e.value=i.value},[l("div",{class:T(["preview",i.label])},[l("div",{class:"rect",style:Y({width:i.width+"px",height:i.height+"px"})},null,4)],2),l("p",ot,c(i.label),1)],10,st))),128))])])}const at=h(Ze,[["render",nt],["__scopeId","data-v-32a7677f"]]),lt=_({name:"StartImage",components:{ElUpload:se,ElButton:R,InfoIcon:A,FontAwesomeIcon:L,ImagePreview:te},emits:["change"],data(){return{fileList:[],uploadUrl:H()+"/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?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){x.warning(this.$t("pixverse.message.uploadReferencesExceed"))},onError(){x.error(this.$t("pixverse.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("pixverse/setConfig",{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),it={class:"relative"},rt={class:"flex justify-between"},ct={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function dt(e,t,u,m,$,g){const i=s("info-icon"),p=s("image-preview"),n=s("font-awesome-icon"),f=s("el-button"),b=s("el-upload");return a(),r("div",it,[l("div",rt,[l("div",ct,[l("span",pt,c(e.$t("pixverse.name.startImage")),1),o(i,{content:e.$t("pixverse.description.uploadStartImage")},null,8,["content"])])]),o(b,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=v=>e.fileList=v),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:d(({file:v})=>[v.url&&v.percentage!==void 0?(a(),w(p,{key:0,url:v.url,name:v.name,percentage:v.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(v),1)},null,8,["url","name","percentage","onRemove"])):y("",!0)]),default:d(()=>[o(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:d(()=>[o(n,{icon:"fa-solid fa-upload",class:"icon mr-1"}),k(" "+c(e.$t("pixverse.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ut=h(lt,[["render",dt],["__scopeId","data-v-666104e4"]]),mt="",vt=_({name:"PromptInput",components:{ElInput:oe,InfoIcon:A},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pixverse/setConfig",{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=mt)}}),ft={class:"field"},_t={class:"box"},ht={class:"title font-bold"};function $t(e,t,u,m,$,g){const i=s("info-icon"),p=s("el-input");return a(),r("div",ft,[l("div",_t,[l("h2",ht,c(e.$t("pixverse.name.prompt")),1),o(i,{content:e.$t("pixverse.description.prompt"),class:"info"},null,8,["content"])]),o(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pixverse.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const gt=h(vt,[["render",$t],["__scopeId","data-v-b3dd608e"]]),bt=_({name:"ConfigPanel",components:{ElButton:R,FontAwesomeIcon:L,PromptInput:gt,ModelSelector:Ve,QualitySelector:Ie,MotionSelector:Pe,StyleSelector:Me,DurationSelector:We,StartImage:ut,SeedSelector:Qe,RatioSelector:at,Consumption:ne},emits:["generate"],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return le(this.config,this.service?.cost)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit("generate")}}}),yt={class:"flex flex-col h-full"},kt={class:"flex-1 overflow-y-auto p-[15px]"},wt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Vt(e,t,u,m,$,g){const i=s("prompt-input"),p=s("model-selector"),n=s("style-selector"),f=s("ratio-selector"),b=s("motion-selector"),v=s("quality-selector"),E=s("start-image"),U=s("seed-selector"),G=s("duration-selector"),j=s("consumption"),M=s("font-awesome-icon"),B=s("el-button");return a(),r("div",yt,[l("div",kt,[o(i,{class:"mb-4"}),o(p,{class:"mb-4"}),o(n,{class:"mb-4"}),o(f,{class:"mb-4"}),o(b,{class:"mb-4"}),o(v,{class:"mb-4"}),o(E,{class:"mb-2"}),o(U,{class:"mb-4"}),o(G,{class:"mb-4"})]),l("div",wt,[o(j,{value:e.consumption,service:e.service},null,8,["value","service"]),o(B,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:d(()=>[o(M,{icon:"fa-solid fa-magic",class:"mr-2"}),k(" "+c(e.$t("pixverse.button.generate")),1)]),_:1},8,["onClick"])])])}const St=h(bt,[["render",Vt]]),xt=_({name:"TaskPreview",components:{ElImage:de,CopyToClipboard:ie,FontAwesomeIcon:L,ElAlert:pe,VideoPlayer:re,ElTooltip:ce,ElButton:R},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Et={class:"preview"},Tt={class:"left"},It={class:"main"},Ct={class:"bot"},Lt={class:"datetime"},Rt={class:"info"},Ut={key:0,class:"prompt mt-2"},Pt={key:0},At={key:1},Dt={key:0,class:T({content:!0,failed:!0})},Gt={key:0,class:"mb-4"},jt={key:1,class:T({operations:!0,"mt-2":!0})},Mt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ft={key:1,class:T({content:!0})},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Nt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function zt(e,t,u,m,$,g){const i=s("el-image"),p=s("video-player"),n=s("el-button"),f=s("el-tooltip"),b=s("font-awesome-icon"),v=s("copy-to-clipboard"),E=s("el-alert");return a(),r("div",Et,[l("div",Tt,[o(i,{src:"https://cdn.acedata.cloud/viy61r.jpg",class:"avatar"})]),l("div",It,[l("div",Ct,[k(c(e.$t("pixverse.name.pixverseBot"))+" ",1),l("span",Lt,c(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",Rt,[e.modelValue?.request?.prompt?(a(),r("p",Ut,[k(c(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?y("",!0):(a(),r("span",Pt," - ("+c(e.$t("pixverse.status.pending"))+") ",1)),e.modelValue?.response?.data&&(e.modelValue?.response?.data[0]?.state==="processing"||e.modelValue?.response?.data[0]?.state==="pending")?(a(),r("span",At," - ("+c(e.$t("pixverse.status.processing"))+") ",1)):y("",!0)])):y("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(a(),r("div",Dt,[e.modelValue?.response?.data[0]?.video_url?(a(),r("div",Gt,[o(p,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):y("",!0),e.modelValue?.response.success?(a(),r("div",jt,[o(f,{class:"box-item",effect:"dark",content:e.$t("pixverse.message.downloadVideo"),placement:"top-start"},{default:d(()=>[e.modelValue?.response?.data[0]?.video_url?(a(),w(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=U=>e.onDownload(U,e.modelValue?.response?.data[0]?.video_url))},{default:d(()=>[k(c(e.$t("pixverse.button.download")),1)]),_:1})):y("",!0)]),_:1},8,["content"])])):y("",!0),o(E,{closable:!1,class:"mt-2 success"},{default:d(()=>[l("p",Mt,[o(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.model"))+": "+c(e.modelValue?.request?.model),1)]),l("p",Bt,[o(b,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):y("",!0),e.modelValue?.response?.success===!1?(a(),r("div",Ft,[o(E,{closable:!1,class:"info"},{template:d(()=>[o(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.failure")),1)]),default:d(()=>[l("p",Ot,[o(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.failureReason"))+": "+c(e.modelValue?.response?.error?.message)+" ",1),o(v,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),l("p",qt,[o(b,{icon:"fa-solid fa-magic",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.taskId"))+": "+c(e.modelValue?.id)+" ",1),o(v,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),r("p",Nt,[o(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),k(" "+c(e.$t("pixverse.name.traceId"))+": "+c(e.modelValue?.response?.trace_id)+" ",1),o(v,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):y("",!0)]),_:1})])):y("",!0)])])}const Xt=h(xt,[["render",zt],["__scopeId","data-v-3f3bff8a"]]),Qt=_({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:ae,BotPlaceholder:ue,ScrollList:W},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Yt={key:0},Ht={key:2,class:"w-full h-full flex items-center justify-center"};function Jt(e,t,u,m,$,g){const i=s("bot-placeholder"),p=s("task-preview"),n=s("scroll-list"),f=s("no-tasks");return a(),r(V,null,[e.tasks?.items===void 0?(a(),r("div",Yt,[o(i)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),w(n,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:t[0]||(t[0]=b=>e.$emit("reach-top"))},{default:d(()=>[(a(!0),r(V,null,S(e.tasks?.items,(b,v)=>(a(),w(p,{key:v,"model-value":b},null,8,["model-value"]))),128))]),_:1},8,["loading"])):y("",!0),e.tasks?.items?.length===0?(a(),r("div",Ht,[o(f)])):y("",!0)],64)}const Kt=h(Qt,[["render",Jt]]),Wt="https://webhook.acedata.cloud/pixverse",Zt=_({name:"PixverseIndex",components:{ConfigPanel:St,Layout:ge,RecentPanel:Kt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===D.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===D.Request||this.fetchingTasks},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.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(){await me({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("pixverse/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pixverse/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:u,createdAtMax:m}=e||{};console.debug("limit",t,"createdAtMin",u,"createdAtMax",m),this.fetchingTasks=!0;try{await this.$store.dispatch("pixverse/getTasks",{limit:t,createdAtMin:u,createdAtMax:m})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:Wt},t=this.credential?.token;if(!t){console.error("no token specified");return}x.info(this.$t("pixverse.message.startingTask")),J.generate(e,{token:t}).then(()=>{x.success(this.$t("pixverse.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===K?x.error(this.$t("pixverse.message.usedUp")):x.error(this.$t("pixverse.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function es(e,t,u,m,$,g){const i=s("config-panel"),p=s("recent-panel"),n=s("layout");return a(),w(n,null,{config:d(()=>[o(i,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:d(()=>[o(p,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Ms=h(Zt,[["render",es]]);export{Ms as default};
@@ -1 +1 @@
1
- import{d as $,L as O,S as v,h as k,i as f,j as n,k as o,y as _,l as t,D as g,x as m,t as s,o as r,R as S,fA as N,m as T,p as L,q as D,fB as R,cf as U,b as h,f as B,F as P,v as A,n as F}from"./index-D1FLNvCi.js";import{F as b}from"./index.es-luG_1liH.js";import{E as V,a as q}from"./index-BdosEN9l.js";import{E as H}from"./index-D9pvcimv.js";import{E}from"./index-3NYwkLyG.js";import"./typescript-BOpWBj_W.js";import"./index-CnT57L09.js";import"./index-YThWA6RB.js";import"./index-r5W6hzzQ.js";import"./index-37AxtFjF.js";import"./dropdown-Zkpj2dmg.js";import"./debounce-VZSmCnjc.js";import"./index-DM378UJ5.js";const M=$({name:"HelpEntry",components:{ElImage:E,ElDialog:O,ElPopover:H,ElMenu:q,ElMenuItem:V,FontAwesomeIcon:b},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){window.open(this.$store.state.site?.features?.support?.discord?.url,"_blank")},onProfit(){this.$router.push({name:v})}}}),X={class:"flex"},j={class:"flex-1 text-center"};function z(e,i,w,y,I,x){const c=t("font-awesome-icon"),l=t("el-menu-item"),p=t("el-image"),d=t("el-popover"),a=t("el-menu"),u=t("el-dialog");return r(),f(u,{"model-value":e.visible,width:200,class:"text-center",onClose:i[0]||(i[0]=C=>e.$emit("close"))},{default:n(()=>[o(a,{collapse:!1,class:"menu"},{default:n(()=>[e.site?.features?.support?.discord?.enabled?(r(),f(l,{key:0,index:"1",onClick:e.onJoin},{title:n(()=>[g(m(e.$t("common.message.joinDiscord")),1)]),default:n(()=>[o(c,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):_("",!0),o(d,{width:350,trigger:"hover"},{reference:n(()=>[e.site?.features?.support?.wechat?.enabled?(r(),f(l,{key:0,index:"2"},{title:n(()=>[g(m(e.$t("common.message.addWeChat")),1)]),default:n(()=>[o(c,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):_("",!0)]),default:n(()=>[s("div",X,[s("div",j,[o(p,{src:e.site?.features?.support?.wechat?.qr},null,8,["src"])])])]),_:1})]),_:1})]),_:1},8,["model-value"])}const J=k(M,[["render",z],["__scopeId","data-v-0fce633f"]]),G=$({name:"ProfileIndex",components:{ElImage:E,HelpDialog:J,FontAwesomeIcon:b},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){return this.$store?.state?.site?.features?.support?.enabled&&(this.$store?.state?.site?.features?.support?.discord?.enabled||this.$store?.state?.site?.features?.support?.wechat?.enabled)},showSite(){return this.$store?.state?.site?.admins?.includes(this.$store.getters.user?.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${N()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:T,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:L,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:D,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:v,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:R,icon:"fa-solid fa-gear"}]:[],{key:"dark-setting",text:this.$t("common.nav.darkMode"),icon:"fa-solid fa-moon",callback:()=>{this.operating.dark=!0}},{key:"locale-setting",text:this.$t("common.nav.locale"),icon:"fa-solid fa-language",callback:()=>{this.operating.locale=!0}},{key:"developerPlatform",text:this.$t("console.menu.developerPlatform"),href:U(),icon:"fa-solid fa-laptop-code"},...this.showSupport?[{key:"support",text:this.$t("common.nav.support"),callback:()=>{this.operating.help=!0},icon:"fa-solid fa-question"}]:[],{key:"logout",text:this.$t("common.nav.logOut"),icon:"fa-solid fa-arrow-right-from-bracket",callback:async()=>{await this.$store.dispatch("logout")}}]}},methods:{onHome(){this.$router.push({name:S})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),W={class:"profile"},K={class:"info"},Q={class:"links"},Y=["onClick"],Z={class:"icon"},ee={class:"text"},te={class:"suffix"};function oe(e,i,w,y,I,x){const c=t("el-image"),l=t("font-awesome-icon"),p=t("locale-selector"),d=t("help-dialog");return r(),h("div",W,[s("div",K,[o(c,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),s("h2",null,m(e.user.username),1),s("div",{style:B({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),s("div",Q,[(r(!0),h(P,null,A(e.links,(a,u)=>(r(),h("a",{key:u,class:F({link:!0,active:e.$route.name===a.name}),onClick:C=>e.onNavigate(a)},[s("span",Z,[o(l,{icon:a.icon,class:"text-sm"},null,8,["icon"])]),s("span",ee,m(a.text),1),s("span",te,[o(l,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,Y))),128))]),o(p,{visible:e.operating.locale==!0,onClose:i[0]||(i[0]=a=>e.operating.locale=!1)},null,8,["visible"]),o(d,{visible:e.operating.help==!0,onClose:i[1]||(i[1]=a=>e.operating.help=!1)},null,8,["visible"])])}const _e=k(G,[["render",oe],["__scopeId","data-v-8eb3b1d9"]]);export{_e as default};
1
+ import{d as $,L as O,S as v,h as k,i as f,j as n,k as o,y as _,l as t,D as g,x as m,t as s,o as r,R as S,fA as N,m as T,p as L,q as D,fB as R,cf as U,b as h,f as B,F as P,v as A,n as F}from"./index-OA9O6lVC.js";import{F as b}from"./index.es-D3TSGwa1.js";import{E as V,a as q}from"./index-jczR9H1q.js";import{E as H}from"./index-CyrG-q_g.js";import{E}from"./index-Bd52b9MQ.js";import"./typescript-D5kqm2pC.js";import"./index-BVPDEl6k.js";import"./index-C7z3Qnen.js";import"./index-r5W6hzzQ.js";import"./index-CTL_q_Ls.js";import"./dropdown-CaEtFY5K.js";import"./debounce-BUHPvvRx.js";import"./index-CW8-s5uS.js";const M=$({name:"HelpEntry",components:{ElImage:E,ElDialog:O,ElPopover:H,ElMenu:q,ElMenuItem:V,FontAwesomeIcon:b},props:{visible:{type:Boolean,default:!0}},emits:["close"],computed:{site(){return this.$store.state.site}},methods:{onJoin(){window.open(this.$store.state.site?.features?.support?.discord?.url,"_blank")},onProfit(){this.$router.push({name:v})}}}),X={class:"flex"},j={class:"flex-1 text-center"};function z(e,i,w,y,I,x){const c=t("font-awesome-icon"),l=t("el-menu-item"),p=t("el-image"),d=t("el-popover"),a=t("el-menu"),u=t("el-dialog");return r(),f(u,{"model-value":e.visible,width:200,class:"text-center",onClose:i[0]||(i[0]=C=>e.$emit("close"))},{default:n(()=>[o(a,{collapse:!1,class:"menu"},{default:n(()=>[e.site?.features?.support?.discord?.enabled?(r(),f(l,{key:0,index:"1",onClick:e.onJoin},{title:n(()=>[g(m(e.$t("common.message.joinDiscord")),1)]),default:n(()=>[o(c,{icon:"fa-brands fa-discord",class:"mr-2"})]),_:1},8,["onClick"])):_("",!0),o(d,{width:350,trigger:"hover"},{reference:n(()=>[e.site?.features?.support?.wechat?.enabled?(r(),f(l,{key:0,index:"2"},{title:n(()=>[g(m(e.$t("common.message.addWeChat")),1)]),default:n(()=>[o(c,{icon:"fa-brands fa-weixin",class:"mr-2"})]),_:1})):_("",!0)]),default:n(()=>[s("div",X,[s("div",j,[o(p,{src:e.site?.features?.support?.wechat?.qr},null,8,["src"])])])]),_:1})]),_:1})]),_:1},8,["model-value"])}const J=k(M,[["render",z],["__scopeId","data-v-0fce633f"]]),G=$({name:"ProfileIndex",components:{ElImage:E,HelpDialog:J,FontAwesomeIcon:b},data(){return{operating:{locale:!1,dark:!1,help:!1}}},computed:{user(){return this.$store.getters.user},showSupport(){return this.$store?.state?.site?.features?.support?.enabled&&(this.$store?.state?.site?.features?.support?.discord?.enabled||this.$store?.state?.site?.features?.support?.wechat?.enabled)},showSite(){return this.$store?.state?.site?.admins?.includes(this.$store.getters.user?.id)},links(){return[{key:"profile",text:this.$t("console.menu.userProfile"),href:`${N()}/user/profile`,icon:"fa-regular fa-user"},{key:"application-list",text:this.$t("console.menu.applicationList"),name:T,icon:"fa-solid fa-cube"},{key:"order-list",text:this.$t("console.menu.orderList"),name:L,icon:"fa-solid fa-store"},{key:"usage-list",text:this.$t("console.menu.usageList"),name:D,icon:"fa-solid fa-rotate-left"},{key:"distribution-index",text:this.$t("console.menu.distributionIndex"),name:v,icon:"fa-solid fa-coins"},...this.showSite?[{key:"site-index",text:this.$t("common.nav.site"),name:R,icon:"fa-solid fa-gear"}]:[],{key:"dark-setting",text:this.$t("common.nav.darkMode"),icon:"fa-solid fa-moon",callback:()=>{this.operating.dark=!0}},{key:"locale-setting",text:this.$t("common.nav.locale"),icon:"fa-solid fa-language",callback:()=>{this.operating.locale=!0}},{key:"developerPlatform",text:this.$t("console.menu.developerPlatform"),href:U(),icon:"fa-solid fa-laptop-code"},...this.showSupport?[{key:"support",text:this.$t("common.nav.support"),callback:()=>{this.operating.help=!0},icon:"fa-solid fa-question"}]:[],{key:"logout",text:this.$t("common.nav.logOut"),icon:"fa-solid fa-arrow-right-from-bracket",callback:async()=>{await this.$store.dispatch("logout")}}]}},methods:{onHome(){this.$router.push({name:S})},onNavigate(e){e.name?this.$router.push({name:e.name}):e.href?window.open(e.href,"_blank"):e.callback&&e.callback()}}}),W={class:"profile"},K={class:"info"},Q={class:"links"},Y=["onClick"],Z={class:"icon"},ee={class:"text"},te={class:"suffix"};function oe(e,i,w,y,I,x){const c=t("el-image"),l=t("font-awesome-icon"),p=t("locale-selector"),d=t("help-dialog");return r(),h("div",W,[s("div",K,[o(c,{src:e.user.avatar,fit:"cover",class:"avatar"},null,8,["src"]),s("h2",null,m(e.user.username),1),s("div",{style:B({backgroundImage:"url("+e.user.avatar+")"}),class:"background"},null,4)]),s("div",Q,[(r(!0),h(P,null,A(e.links,(a,u)=>(r(),h("a",{key:u,class:F({link:!0,active:e.$route.name===a.name}),onClick:C=>e.onNavigate(a)},[s("span",Z,[o(l,{icon:a.icon,class:"text-sm"},null,8,["icon"])]),s("span",ee,m(a.text),1),s("span",te,[o(l,{icon:"fa-solid fa-chevron-right",class:"text-sm"})])],10,Y))),128))]),o(p,{visible:e.operating.locale==!0,onClose:i[0]||(i[0]=a=>e.operating.locale=!1)},null,8,["visible"]),o(d,{visible:e.operating.help==!0,onClose:i[1]||(i[1]=a=>e.operating.help=!1)},null,8,["visible"])])}const _e=k(G,[["render",oe],["__scopeId","data-v-8eb3b1d9"]]);export{_e as default};
@@ -1 +1 @@
1
- .menu[data-v-3794959b]{display:none}@media (max-width: 767px){.config[data-v-3794959b]{display:none}.result[data-v-3794959b]{width:100%}.menu[data-v-3794959b]{display:block;position:absolute;right:8px;top:45px;z-index:1000}}.field .box[data-v-38b040ab]{display:flex;flex-direction:row;align-items:center;justify-content:space-between;position:relative}.field .box .title[data-v-38b040ab]{font-size:14px;margin-bottom:10px}.field .info[data-v-38b040ab]{margin-left:auto}.field .prompt[data-v-38b040ab]{resize:none}.field[data-v-67f08a08]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .title[data-v-67f08a08]{font-size:14px;margin:0;width:30%}.field .value[data-v-67f08a08]{width:160px}.field[data-v-e279ee32]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .label[data-v-e279ee32]{width:30%;display:flex;align-items:center}.field .label .box[data-v-e279ee32]{display:flex;flex-direction:row;align-items:center}.field .label .box .title[data-v-e279ee32]{font-size:14px;margin:0}.field .label .box .info[data-v-e279ee32]{margin-left:6px}.field .value[data-v-e279ee32]{width:160px}.field[data-v-05ae87bb]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .label[data-v-05ae87bb]{width:30%;display:flex;align-items:center}.field .label .box[data-v-05ae87bb]{display:flex;flex-direction:row;align-items:center}.field .label .box .title[data-v-05ae87bb]{font-size:14px;margin:0}.field .label .box .info[data-v-05ae87bb]{margin-left:6px}.field .value[data-v-05ae87bb]{width:160px}.preview[data-v-c93459a1]{width:100%;height:-moz-fit-content;height:fit-content;text-align:left;display:flex;flex-direction:row;margin-bottom:10px}.preview .left[data-v-c93459a1]{width:70px}.preview .left .avatar[data-v-c93459a1]{width:50px;height:50px;margin:10px;border-radius:50%}.preview .main[data-v-c93459a1]{flex:1;width:calc(100% - 70px);padding:10px 10px 0}.preview .main .bot[data-v-c93459a1]{font-size:16px;font-weight:700;color:#2ecc71;margin-bottom:0;margin-top:0}.preview .main .bot .datetime[data-v-c93459a1]{font-size:12px;font-weight:400;color:var(--el-text-color-secondary);margin-left:10px}.preview .main .info .prompt[data-v-c93459a1]{font-size:16px;font-weight:700;color:var(--el-text-color-regular);margin-bottom:15px}.preview .main .content .el-alert[data-v-c93459a1]{border-left-width:2px;border-left-style:solid}.preview .main .content .el-alert.failure[data-v-c93459a1]{border-color:var(--el-color-danger)}.preview .main .content .el-alert.success[data-v-c93459a1]{border-color:var(--el-color-success)}.preview .main .content .el-alert.info[data-v-c93459a1]{border-color:var(--el-color-info)}.preview .main .operations[data-v-c93459a1]{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}.preview .main .operations .btn-action[data-v-c93459a1]{margin-bottom:10px}
1
+ .menu[data-v-3794959b]{display:none}@media (max-width: 767px){.config[data-v-3794959b]{display:none}.result[data-v-3794959b]{width:100%}.menu[data-v-3794959b]{display:block;position:absolute;right:8px;top:45px;z-index:1000}}.field .box[data-v-38b040ab]{display:flex;flex-direction:row;align-items:center;justify-content:space-between;position:relative}.field .box .title[data-v-38b040ab]{font-size:14px;margin-bottom:10px}.field .info[data-v-38b040ab]{margin-left:auto}.field .prompt[data-v-38b040ab]{resize:none}.field[data-v-67f08a08]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .title[data-v-67f08a08]{font-size:14px;margin:0;width:30%}.field .value[data-v-67f08a08]{width:160px}.field[data-v-e279ee32]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .label[data-v-e279ee32]{width:30%;display:flex;align-items:center}.field .label .box[data-v-e279ee32]{display:flex;flex-direction:row;align-items:center}.field .label .box .title[data-v-e279ee32]{font-size:14px;margin:0}.field .label .box .info[data-v-e279ee32]{margin-left:6px}.field .value[data-v-e279ee32]{width:160px}.field[data-v-05ae87bb]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .label[data-v-05ae87bb]{width:30%;display:flex;align-items:center}.field .label .box[data-v-05ae87bb]{display:flex;flex-direction:row;align-items:center}.field .label .box .title[data-v-05ae87bb]{font-size:14px;margin:0}.field .label .box .info[data-v-05ae87bb]{margin-left:6px}.field .value[data-v-05ae87bb]{width:160px}.preview[data-v-9e0f580a]{width:100%;height:-moz-fit-content;height:fit-content;text-align:left;display:flex;flex-direction:row;margin-bottom:10px}.preview .left[data-v-9e0f580a]{width:70px}.preview .left .avatar[data-v-9e0f580a]{width:50px;height:50px;margin:10px;border-radius:50%}.preview .main[data-v-9e0f580a]{flex:1;width:calc(100% - 70px);padding:10px 10px 0}.preview .main .bot[data-v-9e0f580a]{font-size:16px;font-weight:700;color:#2ecc71;margin-bottom:0;margin-top:0}.preview .main .bot .datetime[data-v-9e0f580a]{font-size:12px;font-weight:400;color:var(--el-text-color-secondary);margin-left:10px}.preview .main .info .prompt[data-v-9e0f580a]{font-size:16px;font-weight:700;color:var(--el-text-color-regular);margin-bottom:15px}.preview .main .content .el-alert[data-v-9e0f580a]{border-left-width:2px;border-left-style:solid}.preview .main .content .el-alert.failure[data-v-9e0f580a]{border-color:var(--el-color-danger)}.preview .main .content .el-alert.success[data-v-9e0f580a]{border-color:var(--el-color-success)}.preview .main .content .el-alert.info[data-v-9e0f580a]{border-color:var(--el-color-info)}.preview .main .operations[data-v-9e0f580a]{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}.preview .main .operations .btn-action[data-v-9e0f580a]{margin-bottom:10px}
@@ -1 +1 @@
1
- import{F as K}from"./index.es-luG_1liH.js";import{E as J}from"./index-D3JIjilD.js";import{E as de}from"./index-CiHUKD8b.js";import{as as pe,ay as me,bR as fe,at as ae,ci as he,_ as _e,d as C,a as ge,au as $e,c as V,bq as ve,bw as ke,aF as le,b as _,o as l,i as b,r as z,f as oe,e as T,j as g,bh as re,E as G,n as ye,g as we,h as E,t as r,k as s,l as c,fk as se,x as $,F as D,v as N,fl as H,cf as be,D as I,fm as Y,fn as Q,y as w,J as Z,cT as ee,fo as q,b_ as Ce,dJ as R,aq as P,fp as O,aw as Le,K as Se,fq as Ee,dr as Ae,dI as Te}from"./index-D1FLNvCi.js";import{E as ce}from"./index-Te4f4sQ1.js";import{E as Ve,a as je}from"./index-mx0WSQ4c.js";import{I as B,S as Fe}from"./ScrollList-Da5H8n1W.js";import{E as Pe}from"./index-DocBcnBZ.js";import{E as S}from"./index--7ePKMSn.js";import{E as X}from"./index-YkYnrHwJ.js";import{E as Ie,a as ue}from"./index-C-3cQPP1.js";import{E as x}from"./index-3NYwkLyG.js";import{C as Ue,N as ze}from"./NoTasks-LBG69HXd.js";import{a as Re}from"./price-D62LsAs8.js";import{E as De,a as Me,b as Ge}from"./index-CBjH-ba3.js";import{E as Oe}from"./index-CnT57L09.js";import{E as Be}from"./index-D9pvcimv.js";import{E as qe,a as We}from"./index-CStoqsn2.js";import{l as Ne}from"./pagination-D0-pgnZd.js";import"./use-form-item-o9ewPWuR.js";import"./index-r5W6hzzQ.js";import"./index-YThWA6RB.js";import"./index-DYnnhtAJ.js";import"./typescript-BOpWBj_W.js";import"./strings-MRnF76Oy.js";import"./castArray-DeMftDkR.js";import"./isEqual-DLFFes9f.js";import"./_initCloneObject-DbztCTz9.js";import"./debounce-VZSmCnjc.js";import"./_baseIteratee-DChJIcFX.js";import"./index-37AxtFjF.js";import"./index-b8eWDndR.js";import"./_baseClone-BMdvC2Mn.js";import"./index-DM378UJ5.js";import"./index-CMszY_K9.js";import"./dropdown-Zkpj2dmg.js";const He=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Ke={error:e=>e instanceof Event},Ze=C({name:"ElAvatar"}),Xe=C({...Ze,props:He,emits:Ke,setup(e,{emit:t}){const i=e,o=ge("avatar"),a=$e(!1),u=V(()=>{const{size:n,icon:m,shape:k}=i,f=[o.b()];return ve(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),k&&f.push(o.m(k)),f}),d=V(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=V(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function h(n){a.value=!0,t("error",n)}return(n,m)=>(l(),_("span",{class:ye(T(u)),style:oe(T(d))},[(n.src||n.srcSet)&&!a.value?(l(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(T(p)),onError:h},null,44,["src","alt","srcset"])):n.icon?(l(),b(T(G),{key:1},{default:g(()=>[(l(),b(re(n.icon)))]),_:1})):z(n.$slots,"default",{key:2})],6))}});var xe=_e(Xe,[["__file","avatar.vue"]]);const Je=we(xe),Ye=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:J,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Qe={class:"main flex flex-row flex-1"},et={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},tt={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},ot={class:"preview h-full w-[300px] flex flex-col"};function st(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),h=c("el-drawer");return l(),_("div",Qe,[r("div",et,[z(e.$slots,"config",{},void 0,!0)]),r("div",tt,[z(e.$slots,"result",{},void 0,!0)]),r("div",ot,[z(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:g(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(h,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:g(()=>[z(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const nt=E(Ye,[["render",st],["__scopeId","data-v-6cc632e5"]]),it=C({name:"VersionSelector",components:{ElSelect:je,ElOption:Ve,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"},{label:this.$t("suno.model.model45plus"),value:"chirp-v4-5-plus"},{label:this.$t("suno.model.model5"),value:"chirp-v5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),at={class:"field"},lt={class:"title font-bold"};function rt(e,t,i,o,a,u){const d=c("el-switch"),p=c("el-option"),h=c("el-select");return l(),_("div",at,[r("h2",lt,$(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(h,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:g(()=>[(l(!0),_(D,null,N(e.options,n=>(l(),b(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ct=E(it,[["render",rt],["__scopeId","data-v-5ebe40d6"]]),ut=C({name:"UploadAudio",components:{ElUpload:Pe,ElButton:J,InfoIcon:B,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(){S.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){S.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}S.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"}),S.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{S.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),dt={class:"relative"},pt={class:"flex justify-between"},mt={class:"flex justify-start items-center"},ft={class:"text-sm font-bold"};function ht(e,t,i,o,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),h=c("el-button"),n=c("el-upload");return l(),_("div",dt,[r("div",pt,[r("div",mt,[r("span",ft,$(e.$t("suno.name.referenceAudios")),1),s(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=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:g(()=>[s(h,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:g(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+$(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const _t=E(ut,[["render",ht],["__scopeId","data-v-6236152c"]]),gt="",$t=C({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:B},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=gt)}}),vt={class:"field"},kt={class:"box"},yt={class:"title-info"},wt={class:"title font-bold"},bt={class:"instrumental"},Ct={class:"title inline-block"};function Lt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),h=c("el-input");return l(),_("div",vt,[r("div",kt,[r("div",yt,[r("h2",wt,$(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",bt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",Ct,$(e.$t("suno.name.instrumental")),1)])]),s(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const St=E($t,[["render",Lt],["__scopeId","data-v-d7004a7c"]]),Et="",At=C({name:"LyricInput",components:{ElInput:X,InfoIcon:B},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=Et)}}),Tt={class:"field"},Vt={class:"box"},jt={class:"title font-bold"};function Ft(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),_("div",Tt,[r("div",Vt,[r("h2",jt,$(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),b(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),b(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Pt=E(At,[["render",Ft],["__scopeId","data-v-99dfded8"]]),It=C({name:"StyleInput",components:{ElInput:X,InfoIcon:B},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Ut={class:"field"},zt={class:"title-container"},Rt={class:"titlefont-bold"};function Dt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),_("div",Ut,[r("div",zt,[r("h2",Rt,$(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=h=>e.style=h),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Mt=E(It,[["render",Dt],["__scopeId","data-v-85bbfcaa"]]),Gt=C({name:"TitleInput",components:{ElInput:X,InfoIcon:B},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Ot={class:"field"},Bt={class:"title-container"},qt={class:"title font-bold"};function Wt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),_("div",Ot,[r("div",Bt,[r("h2",qt,$(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=h=>e.title=h),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Nt=E(Gt,[["render",Wt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const Ht=C({name:"ExtendFromInput",components:{ElImage:x,ElIcon:G,ElInputNumber:Ie,VideoPlay:Q,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Kt={class:"field"},Zt={class:"box"},Xt={class:"title font-bold"},xt={class:"input-wrapper"},Jt={class:"task"},Yt={class:"left"},Qt={key:2,class:"duration"},eo={class:"info"},to={class:"title"},oo={class:"style"};function so(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),h=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=ee("loading");return l(),_("div",Kt,[r("div",Zt,[r("h2",Xt,$(e.$t("suno.name.extend")),1),r("div",xt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=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",Jt,[e.audio?(l(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[Z((l(),_("div",Yt,[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(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:g(()=>[s(h)]),_:1})])):w("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:g(()=>[s(m)]),_:1})])):w("",!0),e.audio?.duration?(l(),_("div",Qt,$(e.useFormatDuring(e.audio?.duration)),1)):w("",!0)])),[[k,!e.audio?.audio_url]]),r("div",eo,[r("h2",to,$(e.audio?.title),1),r("p",oo,$(e.audio?.style),1)])])):w("",!0)])])}const no=E(Ht,[["render",so],["__scopeId","data-v-bcce4821"]]),io=C({name:"CoverFromInput",components:{ElImage:x,ElIcon:G,VideoPlay:Q,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),ao={class:"field"},lo={class:"box"},ro={class:"title font-bold"},co={class:"task"},uo={class:"left"},po={key:2,class:"duration"},mo={class:"info"},fo={class:"title"},ho={class:"style"};function _o(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),h=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),_("div",ao,[r("div",lo,[r("h2",ro,$(e.$t("suno.name.cover")),1)]),r("div",co,[e.audio?(l(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((l(),_("div",uo,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(h,null,{default:g(()=>[s(p)]),_:1})])):w("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(h,null,{default:g(()=>[s(n)]),_:1})])):w("",!0),e.audio?.duration?(l(),_("div",po,$(e.useFormatDuring(e.audio?.duration)),1)):w("",!0)])),[[m,!e.audio?.audio_url]]),r("div",mo,[r("h2",fo,$(e.audio?.title),1),r("p",ho,$(e.audio?.style),1)])])):w("",!0)])])}const go=E(io,[["render",_o],["__scopeId","data-v-06640216"]]),$o=C({name:"PresetPanel",components:{TypeSelector:ct,PromptInput:St,LyricInput:Pt,StyleInput:Mt,TitleInput:Nt,ExtendFromInput:no,CoverFromInput:go,UploadAudio:_t,FontAwesomeIcon:K,ElButton:J,Consumption:Ue},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Re(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),vo={class:"flex flex-col h-full"},ko={class:"flex-1 overflow-y-auto p-[15px]"},yo={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function wo(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),h=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),f=c("extend-from-input"),y=c("cover-from-input"),F=c("consumption"),j=c("font-awesome-icon"),A=c("el-button");return l(),_("div",vo,[r("div",ko,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?w("",!0):(l(),b(h,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),b(n,{key:1,class:"mb-4"})):w("",!0),e.config?.custom?(l(),b(m,{key:2,class:"mb-4"})):w("",!0),e.config?.custom?(l(),b(k,{key:3,class:"mb-4"})):w("",!0),e.config?.action==="extend"?(l(),b(f,{key:4,class:"mb-4"})):w("",!0),e.config?.action==="cover"?(l(),b(y,{key:5,class:"mb-4"})):w("",!0)]),r("div",yo,[s(F,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),b(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[s(j,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),b(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[s(j,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const bo=E($o,[["render",wo],["__scopeId","data-v-8c98e5e5"]]);var W={exports:{}},Co=W.exports,ne;function Lo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(Co,function(){function i(n,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(){h(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 q=="object"&&q.global===q?q:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var f=d.URL||d.webkitURL,y=document.createElement("a");m=m||n.name||"download",y.download=m,y.rel="noopener",typeof n=="string"?(y.href=n,y.origin===location.origin?u(y):a(y.href)?o(n,m,k):u(y,y.target="_blank")):(y.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(y.href)},4e4),setTimeout(function(){u(y)},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 y=n.type==="application/octet-stream",F=/constructor/i.test(d.HTMLElement)||d.safari,j=/CriOS\/[\d]+/.test(navigator.userAgent);if((j||y&&F||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var U=A.result;U=j?U:U.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=U:location=U,f=null},A.readAsDataURL(n)}else{var v=d.URL||d.webkitURL,L=v.createObjectURL(n);f?f.location=L:location.href=L,f=null,setTimeout(function(){v.revokeObjectURL(L)},4e4)}});d.saveAs=h.saveAs=h,e.exports=h})}(W)),W.exports}var So=Lo();const Eo="https://webhook.acedata.cloud/suno",Ao=C({name:"TaskPreview",components:{ElImage:x,ElIcon:G,ElTooltip:Oe,FontAwesomeIcon:K,VideoPlay:Q,VideoPause:Y,ElDropdown:Ge,ElDropdownMenu:Me,ElDropdownItem:De,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===R.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:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{So.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),S.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:Eo},o=this.credential?.token;if(!o){console.error("no token specified");return}S.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{S.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{S.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),To={class:"task"},Vo=["onClick"],jo={class:"left"},Fo=["onClick"],Po=["onClick"],Io={key:2,class:"duration"},Uo={class:"info"},zo={class:"title"},Ro={class:"style"},Do={class:"right"},Mo={class:"el-dropdown-link"},Go={class:"flex items-center min-w-[120px]"},Oo={class:"el-dropdown-link"};function Bo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),h=c("el-icon"),n=c("video-play"),m=c("font-awesome-icon"),k=c("el-tooltip"),f=c("Loading"),y=c("el-dropdown-item"),F=c("el-dropdown-menu"),j=c("el-dropdown"),A=ee("loading");return l(),_("div",To,[(l(!0),_(D,null,N(e.audios,v=>(l(),_("div",{key:v.id,class:"audio",onClick:P(L=>e.onClick(v),["stop"])},[Z((l(),_("div",jo,[s(d,{src:v?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),v?.audio_url&&e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),_("div",{key:0,class:"overlay",onClick:P(L=>e.onPause(v),["stop"])},[s(h,null,{default:g(()=>[s(p)]),_:1})],8,Fo)):w("",!0),v?.audio_url&&(e.$store.state?.suno?.audio?.id!==v.id||e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:P(L=>e.onPlay(v),["stop"])},[s(h,null,{default:g(()=>[s(n)]),_:1})],8,Po)):w("",!0),v?.duration?(l(),_("div",Io,$(e.useFormatDuring(v?.duration)),1)):w("",!0)])),[[A,!v?.audio_url]]),r("div",Uo,[r("h2",zo,$(v?.title),1),r("p",Ro,$(v?.style),1)]),r("div",Do,[s(j,null,{dropdown:g(()=>[s(F,null,{default:g(()=>[s(y,{disabled:e.isFetchingVideoUrl,onClick:L=>e.handleVideoDownload(v)},{default:g(()=>[r("div",Go,[e.isFetchingVideoUrl?(l(),b(h,{key:0,class:"is-loading mr-2"},{default:g(()=>[s(f)]),_:1})):w("",!0),r("span",null,$(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),v?.audio_url?(l(),b(y,{key:0,onClick:P(L=>e.onDownload(L,v?.audio_url),["stop"])},{default:g(()=>[I($(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):w("",!0)]),_:2},1024)]),default:g(()=>[r("span",Mo,[s(k,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),b(m,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):w("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(j,null,{dropdown:g(()=>[s(F,null,{default:g(()=>[v?.audio_url?(l(),b(y,{key:0,onClick:P(L=>e.onExtend(L,v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):w("",!0),v.id?(l(),b(y,{key:1,onClick:P(L=>e.onGetStems(v.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):w("",!0),s(y,{onClick:P(L=>e.onCover(v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),v?.id&&v?.action==="extend"?(l(),b(y,{key:2,onClick:P(L=>e.onConcatMusic(v?.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):w("",!0)]),_:2},1024)]),default:g(()=>[r("span",Oo,[s(k,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),b(m,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):w("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Vo))),128))])}const qo=E(Ao,[["render",Bo]]),Wo={class:"player-slider"},No=C({__name:"PlayerSlider",setup(e){const t=O(),i=V({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=V({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(),_("div",Wo,[s(T(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=h=>i.value=h),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),Ho="/assets/disk-XFRmVAfp.png",Ko={class:"flex player-song"},Zo=["src"],Xo={class:"ml-2 text-xs flex flex-col justify-between"},xo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Jo={class:"flex"},Yo={class:"ml-2 text-dc"},Qo=C({__name:"PlayerSong",setup(e){const t=O(),i=V({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),_("div",Ko,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||T(Ho)},null,8,Zo),r("div",Xo,[r("div",xo,[r("div",Jo,[r("span",null,$(i.value?.title||"Music"),1),r("span",Yo,"- "+$(i.value?.style||"SmallRuralDog"),1)])])])]))}}),es={class:"flex justify-end items-center gap-x-2.5"},ts={class:"text-xs"},os=C({__name:"PlayerAction",setup(e){const t=O(),i=V({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=V({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),_("div",es,[r("span",ts,$(T(M)(i.value))+" / "+$(T(M)(o.value)),1)]))}});var ss={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function ns(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function is(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var as=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=ns(),p=Le(as,ss);return function(){var h=u.size,n=u.strokeWidth,m=u.strokeLinecap,k=u.strokeLinejoin,f=u.theme,y=u.fill,F=u.spin,j=is(d,{size:h,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:f,fill:y},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),F&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(j)])}}};return o}const ls=te("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),rs=te("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),cs=te("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),b(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),us={class:"player-volume flex flex-col items-center pt-2"},ds={class:"text-sm mt-3"},ps=C({__name:"PlayerVolumeSlider",setup(e){const t=O(),i=V({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=V({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),_("div",us,[s(T(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=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",ds,$(i.value),1)]))}}),ms={class:"flex items-center justify-center gap-x-3"},fs=C({__name:"PlayerController",setup(e){const t=O(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=V(()=>t.state.suno.audio);return(a,u)=>(l(),_("div",ms,[s(ie,{icon:o.value?.state==="playing"?T(ls):T(rs),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(T(Be),{placement:"top",width:"50px",trigger:"click"},{reference:g(()=>[s(ie,{icon:T(cs),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:g(()=>[s(ps)]),_:1})]))}}),hs={class:"flex flex-col items-stretch h-20"},_s={class:"flex grow px-5 items-center"},gs={class:"flex-1"},$s={class:"flex-1"},vs={class:"flex-1"},ks=C({__name:"Player",setup(e){return(t,i)=>(l(),_("div",hs,[s(No),r("div",_s,[r("div",gs,[s(Qo)]),r("div",$s,[s(fs)]),r("div",vs,[s(os)])])]))}}),ys=C({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:qe,TaskPreview:qo,Player:ks,NoTasks:ze,ScrollList:Fe},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),ws={key:0,class:"tasks"},bs={class:"left w-[70px] p-[10px] flex items-center"},Cs={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},Ls={key:2,class:"w-full flex-1 flex items-center justify-center"},Ss={class:"h-20"};function Es(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),h=c("task-preview"),n=c("scroll-list"),m=c("no-tasks"),k=c("player");return l(),_(D,null,[e.tasks?.items===void 0?(l(),_("div",ws,[(l(),_(D,null,N(3,f=>r("div",{key:f,class:"flex"},[r("div",bs,[s(p,{animated:""},{template:g(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",Cs,[s(p,{animated:""},{template:g(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),b(n,{key:1,ref:"scrollList",class:"flex-1 w-full overflow-y-auto tasks p-2",loading:e.loading,onReachTop:t[0]||(t[0]=f=>e.$emit("reach-top"))},{default:g(()=>[(l(!0),_(D,null,N(e.tasks?.items,(f,y)=>(l(),b(h,{key:y,"model-value":f,class:"preview"},null,8,["model-value"]))),128))]),_:1},8,["loading"])):w("",!0),e.tasks?.items?.length===0?(l(),_("div",Ls,[s(m)])):w("",!0),Z(r("div",Ss,[s(k)],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(ys,[["render",Es]]),Ts=C({name:"TaskPreview",components:{IconPicture:Ee,ElImage:x,ElAvatar:Je,ElIcon:G},computed:{audio(){return this.$store.state.suno?.audio}}}),Vs={key:0,class:"size-full overflow-hidden"},js={class:"relative h-[300px]"},Fs={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Ps={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Is={class:"p-4"},Us={class:"flex items-center font-bold mb-2"},zs={class:"text-[var(--el-text-color-regular)] mb-2"},Rs={class:"text-xs text-[var(--el-text-color-regular)]"},Ds={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Ms={key:1,class:"w-full h-full"};function Gs(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),h=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),_("div",Vs,[r("div",js,[s(h,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:g(()=>[r("div",Fs,[s(p,{class:"text-3xl"},{default:g(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Ps,$(e.audio?.title),1)]),r("div",Is,[r("div",Us,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,$(e.audio?.title),1)]),r("p",zs,$(e.audio?.style),1),r("p",Rs,$(e.$dayjs.format(e.audio?.created_at)),1),r("div",Ds,[r("p",null,$(e.audio?.lyric),1)])])])):(l(),_("div",Ms))}const Os=E(Ts,[["render",Gs]]),Bs="https://webhook.acedata.cloud/suno",qs=C({name:"SunoIndex",components:{Layout:nt,ConfigPanel:bo,RecentPanel:As,PreviewPanel:Os},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===R.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===R.Request||this.fetchingTasks},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===R.Request},needApply(){return this.$store.state.suno.status.getApplications===R.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){await Ne({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,S.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Te&&S.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),this.fetchingTasks=!0;try{await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){const e={...this.config,callback_url:Bs},t=this.credential?.token;if(!t){console.error("no token specified");return}S.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{S.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{S.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ws(e,t,i,o,a,u){const d=c("config-panel"),p=c("recent-panel"),h=c("preview-panel"),n=c("layout");return l(),b(n,null,{config:g(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:g(()=>[s(p,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),preview:g(()=>[s(h)]),_:1})}const An=E(qs,[["render",Ws],["__scopeId","data-v-3a925b34"]]);export{An as default};
1
+ import{F as K}from"./index.es-D3TSGwa1.js";import{E as J}from"./index-vNo-DKgh.js";import{E as de}from"./index-DGxwm39f.js";import{as as pe,ay as me,bR as fe,at as ae,ci as he,_ as _e,d as C,a as ge,au as $e,c as V,bq as ve,bw as ke,aF as le,b as _,o as l,i as b,r as z,f as oe,e as T,j as g,bh as re,E as G,n as ye,g as we,h as E,t as r,k as s,l as c,fk as se,x as $,F as D,v as N,fl as H,cf as be,D as I,fm as Y,fn as Q,y as w,J as Z,cT as ee,fo as q,b_ as Ce,dJ as R,aq as P,fp as O,aw as Le,K as Se,fq as Ee,dr as Ae,dI as Te}from"./index-OA9O6lVC.js";import{E as ce}from"./index-BmMTzT1e.js";import{E as Ve,a as je}from"./index-DKQ8F7GC.js";import{I as B,S as Fe}from"./ScrollList-DJyagTd9.js";import{E as Pe}from"./index-CSXF3X1e.js";import{E as S}from"./index-1DvQjuZj.js";import{E as X}from"./index-BRW1meHI.js";import{E as Ie,a as ue}from"./index-fTsXD2fu.js";import{E as x}from"./index-Bd52b9MQ.js";import{C as Ue,N as ze}from"./NoTasks-CTLWrX9X.js";import{a as Re}from"./price-DX6_QWGs.js";import{E as De,a as Me,b as Ge}from"./index-4xbTEHb4.js";import{E as Oe}from"./index-BVPDEl6k.js";import{E as Be}from"./index-CyrG-q_g.js";import{E as qe,a as We}from"./index-DVU3OOIj.js";import{l as Ne}from"./pagination-Bwva12lc.js";import"./use-form-item-CLxXgCpM.js";import"./index-r5W6hzzQ.js";import"./index-C7z3Qnen.js";import"./index-D4jtulwF.js";import"./typescript-D5kqm2pC.js";import"./strings-CE5wx3lU.js";import"./castArray-DhOK83j4.js";import"./isEqual-vZWfltqX.js";import"./_initCloneObject-B9BC83jE.js";import"./debounce-BUHPvvRx.js";import"./_baseIteratee-CPuZRdwJ.js";import"./index-CTL_q_Ls.js";import"./index-DW12D-0Y.js";import"./_baseClone-Ds-s3IuL.js";import"./index-CW8-s5uS.js";import"./index-i6VHNkjA.js";import"./dropdown-CaEtFY5K.js";const He=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Ke={error:e=>e instanceof Event},Ze=C({name:"ElAvatar"}),Xe=C({...Ze,props:He,emits:Ke,setup(e,{emit:t}){const i=e,o=ge("avatar"),a=$e(!1),u=V(()=>{const{size:n,icon:m,shape:k}=i,f=[o.b()];return ve(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),k&&f.push(o.m(k)),f}),d=V(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=V(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function h(n){a.value=!0,t("error",n)}return(n,m)=>(l(),_("span",{class:ye(T(u)),style:oe(T(d))},[(n.src||n.srcSet)&&!a.value?(l(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(T(p)),onError:h},null,44,["src","alt","srcset"])):n.icon?(l(),b(T(G),{key:1},{default:g(()=>[(l(),b(re(n.icon)))]),_:1})):z(n.$slots,"default",{key:2})],6))}});var xe=_e(Xe,[["__file","avatar.vue"]]);const Je=we(xe),Ye=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:J,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Qe={class:"main flex flex-row flex-1"},et={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},tt={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},ot={class:"preview h-full w-[300px] flex flex-col"};function st(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),h=c("el-drawer");return l(),_("div",Qe,[r("div",et,[z(e.$slots,"config",{},void 0,!0)]),r("div",tt,[z(e.$slots,"result",{},void 0,!0)]),r("div",ot,[z(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:g(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(h,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:g(()=>[z(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const nt=E(Ye,[["render",st],["__scopeId","data-v-6cc632e5"]]),it=C({name:"VersionSelector",components:{ElSelect:je,ElOption:Ve,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"},{label:this.$t("suno.model.model45plus"),value:"chirp-v4-5-plus"},{label:this.$t("suno.model.model5"),value:"chirp-v5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),at={class:"field"},lt={class:"title font-bold"};function rt(e,t,i,o,a,u){const d=c("el-switch"),p=c("el-option"),h=c("el-select");return l(),_("div",at,[r("h2",lt,$(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(h,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:g(()=>[(l(!0),_(D,null,N(e.options,n=>(l(),b(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ct=E(it,[["render",rt],["__scopeId","data-v-5ebe40d6"]]),ut=C({name:"UploadAudio",components:{ElUpload:Pe,ElButton:J,InfoIcon:B,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(){S.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){S.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}S.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"}),S.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{S.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),dt={class:"relative"},pt={class:"flex justify-between"},mt={class:"flex justify-start items-center"},ft={class:"text-sm font-bold"};function ht(e,t,i,o,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),h=c("el-button"),n=c("el-upload");return l(),_("div",dt,[r("div",pt,[r("div",mt,[r("span",ft,$(e.$t("suno.name.referenceAudios")),1),s(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=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:g(()=>[s(h,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:g(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+$(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const _t=E(ut,[["render",ht],["__scopeId","data-v-6236152c"]]),gt="",$t=C({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:B},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=gt)}}),vt={class:"field"},kt={class:"box"},yt={class:"title-info"},wt={class:"title font-bold"},bt={class:"instrumental"},Ct={class:"title inline-block"};function Lt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),h=c("el-input");return l(),_("div",vt,[r("div",kt,[r("div",yt,[r("h2",wt,$(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",bt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",Ct,$(e.$t("suno.name.instrumental")),1)])]),s(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const St=E($t,[["render",Lt],["__scopeId","data-v-d7004a7c"]]),Et="",At=C({name:"LyricInput",components:{ElInput:X,InfoIcon:B},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=Et)}}),Tt={class:"field"},Vt={class:"box"},jt={class:"title font-bold"};function Ft(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),_("div",Tt,[r("div",Vt,[r("h2",jt,$(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),b(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),b(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=h=>e.lyric=h),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Pt=E(At,[["render",Ft],["__scopeId","data-v-99dfded8"]]),It=C({name:"StyleInput",components:{ElInput:X,InfoIcon:B},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Ut={class:"field"},zt={class:"title-container"},Rt={class:"titlefont-bold"};function Dt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),_("div",Ut,[r("div",zt,[r("h2",Rt,$(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=h=>e.style=h),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Mt=E(It,[["render",Dt],["__scopeId","data-v-85bbfcaa"]]),Gt=C({name:"TitleInput",components:{ElInput:X,InfoIcon:B},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Ot={class:"field"},Bt={class:"title-container"},qt={class:"title font-bold"};function Wt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),_("div",Ot,[r("div",Bt,[r("h2",qt,$(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=h=>e.title=h),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Nt=E(Gt,[["render",Wt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const Ht=C({name:"ExtendFromInput",components:{ElImage:x,ElIcon:G,ElInputNumber:Ie,VideoPlay:Q,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Kt={class:"field"},Zt={class:"box"},Xt={class:"title font-bold"},xt={class:"input-wrapper"},Jt={class:"task"},Yt={class:"left"},Qt={key:2,class:"duration"},eo={class:"info"},to={class:"title"},oo={class:"style"};function so(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),h=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=ee("loading");return l(),_("div",Kt,[r("div",Zt,[r("h2",Xt,$(e.$t("suno.name.extend")),1),r("div",xt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=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",Jt,[e.audio?(l(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[Z((l(),_("div",Yt,[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(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:g(()=>[s(h)]),_:1})])):w("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:g(()=>[s(m)]),_:1})])):w("",!0),e.audio?.duration?(l(),_("div",Qt,$(e.useFormatDuring(e.audio?.duration)),1)):w("",!0)])),[[k,!e.audio?.audio_url]]),r("div",eo,[r("h2",to,$(e.audio?.title),1),r("p",oo,$(e.audio?.style),1)])])):w("",!0)])])}const no=E(Ht,[["render",so],["__scopeId","data-v-bcce4821"]]),io=C({name:"CoverFromInput",components:{ElImage:x,ElIcon:G,VideoPlay:Q,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),ao={class:"field"},lo={class:"box"},ro={class:"title font-bold"},co={class:"task"},uo={class:"left"},po={key:2,class:"duration"},mo={class:"info"},fo={class:"title"},ho={class:"style"};function _o(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),h=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),_("div",ao,[r("div",lo,[r("h2",ro,$(e.$t("suno.name.cover")),1)]),r("div",co,[e.audio?(l(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((l(),_("div",uo,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(h,null,{default:g(()=>[s(p)]),_:1})])):w("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(h,null,{default:g(()=>[s(n)]),_:1})])):w("",!0),e.audio?.duration?(l(),_("div",po,$(e.useFormatDuring(e.audio?.duration)),1)):w("",!0)])),[[m,!e.audio?.audio_url]]),r("div",mo,[r("h2",fo,$(e.audio?.title),1),r("p",ho,$(e.audio?.style),1)])])):w("",!0)])])}const go=E(io,[["render",_o],["__scopeId","data-v-06640216"]]),$o=C({name:"PresetPanel",components:{TypeSelector:ct,PromptInput:St,LyricInput:Pt,StyleInput:Mt,TitleInput:Nt,ExtendFromInput:no,CoverFromInput:go,UploadAudio:_t,FontAwesomeIcon:K,ElButton:J,Consumption:Ue},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return Re(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),vo={class:"flex flex-col h-full"},ko={class:"flex-1 overflow-y-auto p-[15px]"},yo={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function wo(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),h=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),f=c("extend-from-input"),y=c("cover-from-input"),F=c("consumption"),j=c("font-awesome-icon"),A=c("el-button");return l(),_("div",vo,[r("div",ko,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?w("",!0):(l(),b(h,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),b(n,{key:1,class:"mb-4"})):w("",!0),e.config?.custom?(l(),b(m,{key:2,class:"mb-4"})):w("",!0),e.config?.custom?(l(),b(k,{key:3,class:"mb-4"})):w("",!0),e.config?.action==="extend"?(l(),b(f,{key:4,class:"mb-4"})):w("",!0),e.config?.action==="cover"?(l(),b(y,{key:5,class:"mb-4"})):w("",!0)]),r("div",yo,[s(F,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),b(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[s(j,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),b(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:g(()=>[s(j,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+$(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const bo=E($o,[["render",wo],["__scopeId","data-v-8c98e5e5"]]);var W={exports:{}},Co=W.exports,ne;function Lo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(Co,function(){function i(n,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(){h(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 q=="object"&&q.global===q?q:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),h=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var f=d.URL||d.webkitURL,y=document.createElement("a");m=m||n.name||"download",y.download=m,y.rel="noopener",typeof n=="string"?(y.href=n,y.origin===location.origin?u(y):a(y.href)?o(n,m,k):u(y,y.target="_blank")):(y.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(y.href)},4e4),setTimeout(function(){u(y)},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 y=n.type==="application/octet-stream",F=/constructor/i.test(d.HTMLElement)||d.safari,j=/CriOS\/[\d]+/.test(navigator.userAgent);if((j||y&&F||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var U=A.result;U=j?U:U.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=U:location=U,f=null},A.readAsDataURL(n)}else{var v=d.URL||d.webkitURL,L=v.createObjectURL(n);f?f.location=L:location.href=L,f=null,setTimeout(function(){v.revokeObjectURL(L)},4e4)}});d.saveAs=h.saveAs=h,e.exports=h})}(W)),W.exports}var So=Lo();const Eo="https://webhook.acedata.cloud/suno",Ao=C({name:"TaskPreview",components:{ElImage:x,ElIcon:G,ElTooltip:Oe,FontAwesomeIcon:K,VideoPlay:Q,VideoPause:Y,ElDropdown:Ge,ElDropdownMenu:Me,ElDropdownItem:De,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===R.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:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{So.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),S.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:Eo},o=this.credential?.token;if(!o){console.error("no token specified");return}S.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{S.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{S.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),To={class:"task"},Vo=["onClick"],jo={class:"left"},Fo=["onClick"],Po=["onClick"],Io={key:2,class:"duration"},Uo={class:"info"},zo={class:"title"},Ro={class:"style"},Do={class:"right"},Mo={class:"el-dropdown-link"},Go={class:"flex items-center min-w-[120px]"},Oo={class:"el-dropdown-link"};function Bo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),h=c("el-icon"),n=c("video-play"),m=c("font-awesome-icon"),k=c("el-tooltip"),f=c("Loading"),y=c("el-dropdown-item"),F=c("el-dropdown-menu"),j=c("el-dropdown"),A=ee("loading");return l(),_("div",To,[(l(!0),_(D,null,N(e.audios,v=>(l(),_("div",{key:v.id,class:"audio",onClick:P(L=>e.onClick(v),["stop"])},[Z((l(),_("div",jo,[s(d,{src:v?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),v?.audio_url&&e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),_("div",{key:0,class:"overlay",onClick:P(L=>e.onPause(v),["stop"])},[s(h,null,{default:g(()=>[s(p)]),_:1})],8,Fo)):w("",!0),v?.audio_url&&(e.$store.state?.suno?.audio?.id!==v.id||e.$store.state?.suno?.audio?.id===v.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),_("div",{key:1,class:"overlay",onClick:P(L=>e.onPlay(v),["stop"])},[s(h,null,{default:g(()=>[s(n)]),_:1})],8,Po)):w("",!0),v?.duration?(l(),_("div",Io,$(e.useFormatDuring(v?.duration)),1)):w("",!0)])),[[A,!v?.audio_url]]),r("div",Uo,[r("h2",zo,$(v?.title),1),r("p",Ro,$(v?.style),1)]),r("div",Do,[s(j,null,{dropdown:g(()=>[s(F,null,{default:g(()=>[s(y,{disabled:e.isFetchingVideoUrl,onClick:L=>e.handleVideoDownload(v)},{default:g(()=>[r("div",Go,[e.isFetchingVideoUrl?(l(),b(h,{key:0,class:"is-loading mr-2"},{default:g(()=>[s(f)]),_:1})):w("",!0),r("span",null,$(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),v?.audio_url?(l(),b(y,{key:0,onClick:P(L=>e.onDownload(L,v?.audio_url),["stop"])},{default:g(()=>[I($(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):w("",!0)]),_:2},1024)]),default:g(()=>[r("span",Mo,[s(k,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),b(m,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):w("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(j,null,{dropdown:g(()=>[s(F,null,{default:g(()=>[v?.audio_url?(l(),b(y,{key:0,onClick:P(L=>e.onExtend(L,v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):w("",!0),v.id?(l(),b(y,{key:1,onClick:P(L=>e.onGetStems(v.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):w("",!0),s(y,{onClick:P(L=>e.onCover(v),["stop"])},{default:g(()=>[I($(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),v?.id&&v?.action==="extend"?(l(),b(y,{key:2,onClick:P(L=>e.onConcatMusic(v?.id),["stop"])},{default:g(()=>[I($(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):w("",!0)]),_:2},1024)]),default:g(()=>[r("span",Oo,[s(k,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:g(()=>[v?.audio_url||v?.video_url?(l(),b(m,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):w("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Vo))),128))])}const qo=E(Ao,[["render",Bo]]),Wo={class:"player-slider"},No=C({__name:"PlayerSlider",setup(e){const t=O(),i=V({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=V({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(),_("div",Wo,[s(T(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=h=>i.value=h),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),Ho="/assets/disk-XFRmVAfp.png",Ko={class:"flex player-song"},Zo=["src"],Xo={class:"ml-2 text-xs flex flex-col justify-between"},xo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Jo={class:"flex"},Yo={class:"ml-2 text-dc"},Qo=C({__name:"PlayerSong",setup(e){const t=O(),i=V({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),_("div",Ko,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||T(Ho)},null,8,Zo),r("div",Xo,[r("div",xo,[r("div",Jo,[r("span",null,$(i.value?.title||"Music"),1),r("span",Yo,"- "+$(i.value?.style||"SmallRuralDog"),1)])])])]))}}),es={class:"flex justify-end items-center gap-x-2.5"},ts={class:"text-xs"},os=C({__name:"PlayerAction",setup(e){const t=O(),i=V({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=V({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),_("div",es,[r("span",ts,$(T(M)(i.value))+" / "+$(T(M)(o.value)),1)]))}});var ss={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function ns(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function is(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var as=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=ns(),p=Le(as,ss);return function(){var h=u.size,n=u.strokeWidth,m=u.strokeLinecap,k=u.strokeLinejoin,f=u.theme,y=u.fill,F=u.spin,j=is(d,{size:h,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:f,fill:y},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),F&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(j)])}}};return o}const ls=te("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),rs=te("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),cs=te("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),b(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),us={class:"player-volume flex flex-col items-center pt-2"},ds={class:"text-sm mt-3"},ps=C({__name:"PlayerVolumeSlider",setup(e){const t=O(),i=V({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=V({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),_("div",us,[s(T(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=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",ds,$(i.value),1)]))}}),ms={class:"flex items-center justify-center gap-x-3"},fs=C({__name:"PlayerController",setup(e){const t=O(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=V(()=>t.state.suno.audio);return(a,u)=>(l(),_("div",ms,[s(ie,{icon:o.value?.state==="playing"?T(ls):T(rs),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(T(Be),{placement:"top",width:"50px",trigger:"click"},{reference:g(()=>[s(ie,{icon:T(cs),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:g(()=>[s(ps)]),_:1})]))}}),hs={class:"flex flex-col items-stretch h-20"},_s={class:"flex grow px-5 items-center"},gs={class:"flex-1"},$s={class:"flex-1"},vs={class:"flex-1"},ks=C({__name:"Player",setup(e){return(t,i)=>(l(),_("div",hs,[s(No),r("div",_s,[r("div",gs,[s(Qo)]),r("div",$s,[s(fs)]),r("div",vs,[s(os)])])]))}}),ys=C({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:qe,TaskPreview:qo,Player:ks,NoTasks:ze,ScrollList:Fe},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),ws={key:0,class:"tasks"},bs={class:"left w-[70px] p-[10px] flex items-center"},Cs={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},Ls={key:2,class:"w-full flex-1 flex items-center justify-center"},Ss={class:"h-20"};function Es(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),h=c("task-preview"),n=c("scroll-list"),m=c("no-tasks"),k=c("player");return l(),_(D,null,[e.tasks?.items===void 0?(l(),_("div",ws,[(l(),_(D,null,N(3,f=>r("div",{key:f,class:"flex"},[r("div",bs,[s(p,{animated:""},{template:g(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",Cs,[s(p,{animated:""},{template:g(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),b(n,{key:1,ref:"scrollList",class:"flex-1 w-full overflow-y-auto tasks p-2",loading:e.loading,onReachTop:t[0]||(t[0]=f=>e.$emit("reach-top"))},{default:g(()=>[(l(!0),_(D,null,N(e.tasks?.items,(f,y)=>(l(),b(h,{key:y,"model-value":f,class:"preview"},null,8,["model-value"]))),128))]),_:1},8,["loading"])):w("",!0),e.tasks?.items?.length===0?(l(),_("div",Ls,[s(m)])):w("",!0),Z(r("div",Ss,[s(k)],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(ys,[["render",Es]]),Ts=C({name:"TaskPreview",components:{IconPicture:Ee,ElImage:x,ElAvatar:Je,ElIcon:G},computed:{audio(){return this.$store.state.suno?.audio}}}),Vs={key:0,class:"size-full overflow-hidden"},js={class:"relative h-[300px]"},Fs={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Ps={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Is={class:"p-4"},Us={class:"flex items-center font-bold mb-2"},zs={class:"text-[var(--el-text-color-regular)] mb-2"},Rs={class:"text-xs text-[var(--el-text-color-regular)]"},Ds={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Ms={key:1,class:"w-full h-full"};function Gs(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),h=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),_("div",Vs,[r("div",js,[s(h,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:g(()=>[r("div",Fs,[s(p,{class:"text-3xl"},{default:g(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Ps,$(e.audio?.title),1)]),r("div",Is,[r("div",Us,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,$(e.audio?.title),1)]),r("p",zs,$(e.audio?.style),1),r("p",Rs,$(e.$dayjs.format(e.audio?.created_at)),1),r("div",Ds,[r("p",null,$(e.audio?.lyric),1)])])])):(l(),_("div",Ms))}const Os=E(Ts,[["render",Gs]]),Bs="https://webhook.acedata.cloud/suno",qs=C({name:"SunoIndex",components:{Layout:nt,ConfigPanel:bo,RecentPanel:As,PreviewPanel:Os},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===R.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===R.Request||this.fetchingTasks},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===R.Request},needApply(){return this.$store.state.suno.status.getApplications===R.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){await Ne({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,S.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Te&&S.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),this.fetchingTasks=!0;try{await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){const e={...this.config,callback_url:Bs},t=this.credential?.token;if(!t){console.error("no token specified");return}S.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{S.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{S.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ws(e,t,i,o,a,u){const d=c("config-panel"),p=c("recent-panel"),h=c("preview-panel"),n=c("layout");return l(),b(n,null,{config:g(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:g(()=>[s(p,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),preview:g(()=>[s(h)]),_:1})}const An=E(qs,[["render",Ws],["__scopeId","data-v-3a925b34"]]);export{An as default};
@@ -1 +1 @@
1
- import{F as D}from"./index.es-luG_1liH.js";import{E as L}from"./index-D3JIjilD.js";import{E as N}from"./index-CiHUKD8b.js";import{d as b,h as k,b as i,t as r,k as o,r as U,j as u,l as s,o as n,eY as G,eZ as z,e_ as S,e$ as M,f0 as q,f1 as Z,x as l,F as V,v as A,i as y,f2 as J,f3 as W,n as I,f as Y,cf as H,D as h,y as $,f4 as K,J as Q,K as X,f5 as x,dN as ee,dJ as P}from"./index-D1FLNvCi.js";import{E as C,a as R}from"./index-mx0WSQ4c.js";import{I as j,S as te}from"./ScrollList-Da5H8n1W.js";import{I as oe}from"./ImagePreview-B9AiNOkr.js";import{E as se}from"./index-DocBcnBZ.js";import{E as T}from"./index--7ePKMSn.js";import{C as ae,N as ne}from"./NoTasks-LBG69HXd.js";import{E as le}from"./index-YkYnrHwJ.js";import{a as re}from"./price-D62LsAs8.js";import{C as ie}from"./CopyToClipboard-BaNpbWBZ.js";import{V as ce}from"./VideoPlayer-1sMyrvvI.js";import{E as de}from"./index-CnT57L09.js";import{E as ue}from"./index-De2Qy988.js";import{E as pe}from"./index-3NYwkLyG.js";import{B as me}from"./BotPlaceholder-CWIWz7Gv.js";import{l as fe}from"./pagination-D0-pgnZd.js";import"./use-form-item-o9ewPWuR.js";import"./index-r5W6hzzQ.js";import"./index-DYnnhtAJ.js";import"./typescript-BOpWBj_W.js";import"./index-YThWA6RB.js";import"./strings-MRnF76Oy.js";import"./castArray-DeMftDkR.js";import"./isEqual-DLFFes9f.js";import"./_initCloneObject-DbztCTz9.js";import"./debounce-VZSmCnjc.js";import"./_baseIteratee-DChJIcFX.js";import"./index-37AxtFjF.js";import"./index-b8eWDndR.js";import"./_baseClone-BMdvC2Mn.js";import"./index-DM378UJ5.js";import"./vue-plyr-QZFBikSk.js";import"./index-CStoqsn2.js";const _e=b({name:"LayoutSora",components:{ElDrawer:N,ElButton:L,FontAwesomeIcon:D},data(){return{drawer:!1}}}),he={class:"main flex flex-row flex-1"},$e={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ge={class:"result h-full p-[15px] flex-1 flex flex-col"};function ve(e,t,p,m,g,v){const c=s("font-awesome-icon"),d=s("el-button"),a=s("el-drawer");return n(),i("div",he,[r("div",$e,[U(e.$slots,"config",{},void 0,!0)]),r("div",ge,[U(e.$slots,"result",{},void 0,!0)]),o(d,{circle:"",class:"menu",onClick:t[0]||(t[0]=w=>e.drawer=!0)},{default:u(()=>[o(c,{icon:"fa-solid fa-magic"})]),_:1}),o(a,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=w=>e.drawer=w),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const be=k(_e,[["render",ve],["__scopeId","data-v-966c9b2c"]]),ke=b({name:"ModelSelector",components:{ElSelect:R,ElOption:C},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:q,label:"sora-2"},{value:Z,label:"sora-2-pro"}]}},computed:{value:{get(){return this.$store.state.sora?.config?.model},set(e){const t=this.$store.state.sora?.config||{},p=z[e]||[S],m=t.duration,g=m&&p.includes(m)?m:p.includes(S)?S:p[0],v={...t,model:e,duration:g,size:t.size||M};this.$store.commit("sora/setConfig",v)}}},mounted(){this.value||(this.value=G)}}),we={class:"field"},ye={class:"title font-bold"};function Se(e,t,p,m,g,v){const c=s("el-option"),d=s("el-select");return n(),i("div",we,[r("h2",ye,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:u(()=>[(n(!0),i(V,null,A(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 Ve=k(ke,[["render",Se],["__scopeId","data-v-3a7abba8"]]),Ee=b({name:"ActionSelector",components:{ElSelect:R,ElOption:C},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=J)}}),Te={class:"field"},Ie={class:"title font-bold"},Ae={class:"float-left"};function De(e,t,p,m,g,v){const c=s("el-option"),d=s("el-select");return n(),i("div",Te,[r("h2",Ie,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:u(()=>[(n(!0),i(V,null,A(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},{default:u(()=>[r("span",Ae,l(a.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Le=k(Ee,[["render",De],["__scopeId","data-v-7b82fa7f"]]),Ce=b({name:"DurationSelector",components:{ElSelect:R,ElOption:C},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)}}),Re={class:"field"},Oe={class:"control"},Ue={class:"title font-bold"};function Pe(e,t,p,m,g,v){const c=s("el-option"),d=s("el-select");return n(),i("div",Re,[r("div",Oe,[r("h2",Ue,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:u(()=>[(n(!0),i(V,null,A(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 Ge=k(Ce,[["render",Pe],["__scopeId","data-v-c2934598"]]),ze=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=W)}}),Me={class:"text-sm font-bold mb-2 block"},je={class:"items"},Be=["onClick"],Fe={class:"name"};function Ne(e,t,p,m,g,v){return n(),i("div",null,[r("span",Me,l(e.$t("sora.name.orientation")),1),r("div",je,[(n(!0),i(V,null,A(e.options,(c,d)=>(n(),i("div",{key:d,class:I({active:e.active===d,item:!0}),onClick:a=>e.value=c.value},[r("div",{class:I(["preview",c.value])},[r("div",{class:"rect",style:Y({width:c.width+"px",height:c.height+"px"})},null,4)],2),r("p",Fe,l(c.label),1)],10,Be))),128))])])}const qe=k(ze,[["render",Ne],["__scopeId","data-v-d6940af8"]]),Ze=b({name:"StartEndImage",components:{ElUpload:se,ElButton:L,InfoIcon:j,FontAwesomeIcon:D,ImagePreview:oe},emits:["change"],data(){return{fileList:[],uploadUrl:H()+"/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(){T.warning(this.$t("sora.message.uploadReferencesExceed"))},onError(){T.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()}}}),Je={class:"relative"},We={class:"flex justify-between"},Ye={class:"flex justify-start items-center"},He={class:"text-sm font-bold"};function Ke(e,t,p,m,g,v){const c=s("info-icon"),d=s("image-preview"),a=s("font-awesome-icon"),w=s("el-button"),_=s("el-upload");return n(),i("div",Je,[r("div",We,[r("div",Ye,[r("span",He,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:u(({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:u(()=>[o(w,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[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 Qe=k(Ze,[["render",Ke],["__scopeId","data-v-fd6e5c97"]]),Xe=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),xe=b({name:"SizeSelector",components:{ElSelect:R,ElOption:C},data(){return{options:K.map(e=>({value:e,label:Xe(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=M)}}),et={class:"field"},tt={class:"control"},ot={class:"title font-bold"};function st(e,t,p,m,g,v){const c=s("el-option"),d=s("el-select");return n(),i("div",et,[r("div",tt,[r("h2",ot,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:u(()=>[(n(!0),i(V,null,A(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 at=k(xe,[["render",st],["__scopeId","data-v-8c485f0f"]]),nt="",lt=b({name:"PromptInput",components:{ElInput:le,InfoIcon:j},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=nt)}}),rt={class:"field"},it={class:"box"},ct={class:"title font-bold"};function dt(e,t,p,m,g,v){const c=s("info-icon"),d=s("el-input");return n(),i("div",rt,[r("div",it,[r("h2",ct,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 ut=k(lt,[["render",dt],["__scopeId","data-v-cf3a1497"]]),pt=b({name:"ConfigPanel",components:{ElButton:L,Consumption:ae,FontAwesomeIcon:D,PromptInput:ut,ModelSelector:Ve,StartEndImage:Qe,SizeSelector:at,ActionSelector:Le,OrientationSelector:qe,DurationSelector:Ge},emits:["generate"],computed:{config(){return this.$store.state.sora?.config},consumption(){return re(this.config,this.service?.cost)},service(){return this.$store.state.sora?.service}},methods:{onGenerate(){this.$emit("generate")}}}),mt={class:"flex flex-col h-full"},ft={class:"flex-1 overflow-y-auto p-[15px]"},_t={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ht(e,t,p,m,g,v){const c=s("model-selector"),d=s("action-selector"),a=s("duration-selector"),w=s("size-selector"),_=s("orientation-selector"),f=s("prompt-input"),E=s("start-end-image"),O=s("consumption"),B=s("font-awesome-icon"),F=s("el-button");return n(),i("div",mt,[r("div",ft,[o(c,{class:"mb-4"}),o(d,{class:"mb-4"}),o(a,{class:"mb-4"}),o(w,{class:"mb-4"}),o(_,{class:"mb-4"}),o(f,{class:"mb-4"}),Q(o(E,{class:"mb-2"},null,512),[[X,e.config?.action==="image2video"]])]),r("div",_t,[o(O,{value:e.consumption,service:e.service},null,8,["value","service"]),o(F,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[o(B,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+l(e.$t("sora.button.generate")),1)]),_:1},8,["onClick"])])])}const $t=k(pt,[["render",ht]]),gt=b({name:"TaskPreview",components:{ElImage:pe,CopyToClipboard:ie,FontAwesomeIcon:D,ElAlert:ue,VideoPlayer:ce,ElTooltip:de,ElButton:L},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")}}}),vt={class:"preview"},bt={class:"left"},kt={class:"main"},wt={class:"bot"},yt={class:"datetime"},St={class:"info"},Vt={key:0,class:"prompt mt-2"},Et={key:0},Tt={key:1},It={key:0,class:I({content:!0,failed:!0})},At={key:0,class:"mb-4"},Dt={key:1,class:I({operations:!0,"mt-2":!0})},Lt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Rt={key:1,class:I({content:!0})},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ut={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Pt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Gt={key:2,class:I({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Mt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function jt(e,t,p,m,g,v){const c=s("el-image"),d=s("video-player"),a=s("el-button"),w=s("el-tooltip"),_=s("font-awesome-icon"),f=s("copy-to-clipboard"),E=s("el-alert");return n(),i("div",vt,[r("div",bt,[o(c,{src:"https://cdn.acedata.cloud/z5id1u.png",class:"avatar"})]),r("div",kt,[r("div",wt,[h(l(e.$t("sora.name.soraBot"))+" ",1),r("span",yt,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),r("div",St,[e.modelValue?.request?.prompt?(n(),i("p",Vt,[h(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),i("span",Et," - ("+l(e.$t("sora.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="pending"?(n(),i("span",Tt," - ("+l(e.$t("sora.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),i("div",It,[e.modelValue?.response?.data[0]?.video_url?(n(),i("div",At,[o(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),i("div",Dt,[o(w,{class:"box-item",effect:"dark",content:e.$t("sora.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(a,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=O=>e.onDownload(O,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(l(e.$t("sora.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),o(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[r("p",Lt,[o(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+l(e.$t("sora.name.model"))+": "+l(e.modelValue?.request?.model),1)]),r("p",Ct,[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(),i("div",Rt,[o(E,{closable:!1,class:"failure"},{template:u(()=>[o(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+l(e.$t("sora.name.failure")),1)]),default:u(()=>[r("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"])]),r("p",Ut,[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(),i("p",Pt,[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(),i("div",Gt,[o(E,{closable:!1,class:"info"},{template:u(()=>[o(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+l(e.$t("sora.name.failure")),1)]),default:u(()=>[r("p",zt,[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(),i("p",Mt,[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 Bt=k(gt,[["render",jt],["__scopeId","data-v-183a4d07"]]),Ft=b({name:"RecentPanel",components:{TaskPreview:Bt,NoTasks:ne,BotPlaceholder:me,ScrollList:te},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.sora?.tasks,items:this.$store.state.sora?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nt={key:0},qt={key:2,class:"w-full h-full flex items-center justify-center"};function Zt(e,t,p,m,g,v){const c=s("bot-placeholder"),d=s("task-preview"),a=s("scroll-list"),w=s("no-tasks");return n(),i(V,null,[e.tasks?.items===void 0?(n(),i("div",Nt,[o(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),y(a,{key:1,ref:"scrollList",class:"tasks h-full w-full overflow-y-auto",loading:e.loading,onReachTop:t[0]||(t[0]=_=>e.$emit("reach-top"))},{default:u(()=>[(n(!0),i(V,null,A(e.tasks?.items,(_,f)=>(n(),y(d,{key:f,"model-value":_},null,8,["model-value"]))),128))]),_:1},8,["loading"])):$("",!0),e.tasks?.items?.length===0?(n(),i("div",qt,[o(w)])):$("",!0)],64)}const Jt=k(Ft,[["render",Zt]]),Wt="https://webhook.acedata.cloud/sora",Yt=b({name:"SoraIndex",components:{ConfigPanel:$t,Layout:be,RecentPanel:Jt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.sora?.status?.getApplications===P.Request},tasksLoading(){return this.$store.state.sora?.status?.getTasks===P.Request||this.fetchingTasks},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(){await fe({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("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(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:p,createdAtMax:m}=e||{};console.debug("limit",t,"createdAtMin",p,"createdAtMax",m),this.fetchingTasks=!0;try{await this.$store.dispatch("sora/getTasks",{limit:t,createdAtMin:p,createdAtMax:m})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:Wt},t=this.credential?.token;if(!t){console.error("no token specified");return}T.info(this.$t("sora.message.startingTask")),x.generate(e,{token:t}).then(()=>{T.success(this.$t("sora.message.startTaskSuccess"))}).catch(p=>{p?.response?.data?.error?.code===ee?T.error(this.$t("sora.message.usedUp")):T.error(this.$t("sora.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ht(e,t,p,m,g,v){const c=s("config-panel"),d=s("recent-panel"),a=s("layout");return n(),y(a,null,{config:u(()=>[o(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[o(d,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Ro=k(Yt,[["render",Ht]]);export{Ro as default};
1
+ import{F as D}from"./index.es-D3TSGwa1.js";import{E as L}from"./index-vNo-DKgh.js";import{E as N}from"./index-DGxwm39f.js";import{d as b,h as k,b as i,t as r,k as o,r as U,j as u,l as s,o as n,eY as G,eZ as z,e_ as S,e$ as M,f0 as q,f1 as Z,x as l,F as V,v as A,i as y,f2 as J,f3 as W,n as I,f as Y,cf as H,D as h,y as $,f4 as K,J as Q,K as X,f5 as x,dN as ee,dJ as P}from"./index-OA9O6lVC.js";import{E as C,a as R}from"./index-DKQ8F7GC.js";import{I as j,S as te}from"./ScrollList-DJyagTd9.js";import{I as oe}from"./ImagePreview-dRRztBTN.js";import{E as se}from"./index-CSXF3X1e.js";import{E as T}from"./index-1DvQjuZj.js";import{C as ae,N as ne}from"./NoTasks-CTLWrX9X.js";import{E as le}from"./index-BRW1meHI.js";import{a as re}from"./price-DX6_QWGs.js";import{C as ie}from"./CopyToClipboard-CIkwptVu.js";import{V as ce}from"./VideoPlayer-Cc0aqBXp.js";import{E as de}from"./index-BVPDEl6k.js";import{E as ue}from"./index-2amtGE73.js";import{E as pe}from"./index-Bd52b9MQ.js";import{B as me}from"./BotPlaceholder-X527oxpB.js";import{l as fe}from"./pagination-Bwva12lc.js";import"./use-form-item-CLxXgCpM.js";import"./index-r5W6hzzQ.js";import"./index-D4jtulwF.js";import"./typescript-D5kqm2pC.js";import"./index-C7z3Qnen.js";import"./strings-CE5wx3lU.js";import"./castArray-DhOK83j4.js";import"./isEqual-vZWfltqX.js";import"./_initCloneObject-B9BC83jE.js";import"./debounce-BUHPvvRx.js";import"./_baseIteratee-CPuZRdwJ.js";import"./index-CTL_q_Ls.js";import"./index-DW12D-0Y.js";import"./_baseClone-Ds-s3IuL.js";import"./index-CW8-s5uS.js";import"./vue-plyr-QZFBikSk.js";import"./index-DVU3OOIj.js";const _e=b({name:"LayoutSora",components:{ElDrawer:N,ElButton:L,FontAwesomeIcon:D},data(){return{drawer:!1}}}),he={class:"main flex flex-row flex-1"},$e={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ge={class:"result h-full p-[15px] flex-1 flex flex-col"};function ve(e,t,p,m,g,v){const c=s("font-awesome-icon"),d=s("el-button"),a=s("el-drawer");return n(),i("div",he,[r("div",$e,[U(e.$slots,"config",{},void 0,!0)]),r("div",ge,[U(e.$slots,"result",{},void 0,!0)]),o(d,{circle:"",class:"menu",onClick:t[0]||(t[0]=w=>e.drawer=!0)},{default:u(()=>[o(c,{icon:"fa-solid fa-magic"})]),_:1}),o(a,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=w=>e.drawer=w),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const be=k(_e,[["render",ve],["__scopeId","data-v-966c9b2c"]]),ke=b({name:"ModelSelector",components:{ElSelect:R,ElOption:C},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:q,label:"sora-2"},{value:Z,label:"sora-2-pro"}]}},computed:{value:{get(){return this.$store.state.sora?.config?.model},set(e){const t=this.$store.state.sora?.config||{},p=z[e]||[S],m=t.duration,g=m&&p.includes(m)?m:p.includes(S)?S:p[0],v={...t,model:e,duration:g,size:t.size||M};this.$store.commit("sora/setConfig",v)}}},mounted(){this.value||(this.value=G)}}),we={class:"field"},ye={class:"title font-bold"};function Se(e,t,p,m,g,v){const c=s("el-option"),d=s("el-select");return n(),i("div",we,[r("h2",ye,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:u(()=>[(n(!0),i(V,null,A(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 Ve=k(ke,[["render",Se],["__scopeId","data-v-3a7abba8"]]),Ee=b({name:"ActionSelector",components:{ElSelect:R,ElOption:C},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=J)}}),Te={class:"field"},Ie={class:"title font-bold"},Ae={class:"float-left"};function De(e,t,p,m,g,v){const c=s("el-option"),d=s("el-select");return n(),i("div",Te,[r("h2",Ie,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:u(()=>[(n(!0),i(V,null,A(e.options,a=>(n(),y(c,{key:a.value,label:a.label,value:a.value},{default:u(()=>[r("span",Ae,l(a.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Le=k(Ee,[["render",De],["__scopeId","data-v-7b82fa7f"]]),Ce=b({name:"DurationSelector",components:{ElSelect:R,ElOption:C},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)}}),Re={class:"field"},Oe={class:"control"},Ue={class:"title font-bold"};function Pe(e,t,p,m,g,v){const c=s("el-option"),d=s("el-select");return n(),i("div",Re,[r("div",Oe,[r("h2",Ue,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:u(()=>[(n(!0),i(V,null,A(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 Ge=k(Ce,[["render",Pe],["__scopeId","data-v-c2934598"]]),ze=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=W)}}),Me={class:"text-sm font-bold mb-2 block"},je={class:"items"},Be=["onClick"],Fe={class:"name"};function Ne(e,t,p,m,g,v){return n(),i("div",null,[r("span",Me,l(e.$t("sora.name.orientation")),1),r("div",je,[(n(!0),i(V,null,A(e.options,(c,d)=>(n(),i("div",{key:d,class:I({active:e.active===d,item:!0}),onClick:a=>e.value=c.value},[r("div",{class:I(["preview",c.value])},[r("div",{class:"rect",style:Y({width:c.width+"px",height:c.height+"px"})},null,4)],2),r("p",Fe,l(c.label),1)],10,Be))),128))])])}const qe=k(ze,[["render",Ne],["__scopeId","data-v-d6940af8"]]),Ze=b({name:"StartEndImage",components:{ElUpload:se,ElButton:L,InfoIcon:j,FontAwesomeIcon:D,ImagePreview:oe},emits:["change"],data(){return{fileList:[],uploadUrl:H()+"/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(){T.warning(this.$t("sora.message.uploadReferencesExceed"))},onError(){T.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()}}}),Je={class:"relative"},We={class:"flex justify-between"},Ye={class:"flex justify-start items-center"},He={class:"text-sm font-bold"};function Ke(e,t,p,m,g,v){const c=s("info-icon"),d=s("image-preview"),a=s("font-awesome-icon"),w=s("el-button"),_=s("el-upload");return n(),i("div",Je,[r("div",We,[r("div",Ye,[r("span",He,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:u(({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:u(()=>[o(w,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[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 Qe=k(Ze,[["render",Ke],["__scopeId","data-v-fd6e5c97"]]),Xe=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),xe=b({name:"SizeSelector",components:{ElSelect:R,ElOption:C},data(){return{options:K.map(e=>({value:e,label:Xe(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=M)}}),et={class:"field"},tt={class:"control"},ot={class:"title font-bold"};function st(e,t,p,m,g,v){const c=s("el-option"),d=s("el-select");return n(),i("div",et,[r("div",tt,[r("h2",ot,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:u(()=>[(n(!0),i(V,null,A(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 at=k(xe,[["render",st],["__scopeId","data-v-8c485f0f"]]),nt="",lt=b({name:"PromptInput",components:{ElInput:le,InfoIcon:j},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=nt)}}),rt={class:"field"},it={class:"box"},ct={class:"title font-bold"};function dt(e,t,p,m,g,v){const c=s("info-icon"),d=s("el-input");return n(),i("div",rt,[r("div",it,[r("h2",ct,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 ut=k(lt,[["render",dt],["__scopeId","data-v-cf3a1497"]]),pt=b({name:"ConfigPanel",components:{ElButton:L,Consumption:ae,FontAwesomeIcon:D,PromptInput:ut,ModelSelector:Ve,StartEndImage:Qe,SizeSelector:at,ActionSelector:Le,OrientationSelector:qe,DurationSelector:Ge},emits:["generate"],computed:{config(){return this.$store.state.sora?.config},consumption(){return re(this.config,this.service?.cost)},service(){return this.$store.state.sora?.service}},methods:{onGenerate(){this.$emit("generate")}}}),mt={class:"flex flex-col h-full"},ft={class:"flex-1 overflow-y-auto p-[15px]"},_t={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function ht(e,t,p,m,g,v){const c=s("model-selector"),d=s("action-selector"),a=s("duration-selector"),w=s("size-selector"),_=s("orientation-selector"),f=s("prompt-input"),E=s("start-end-image"),O=s("consumption"),B=s("font-awesome-icon"),F=s("el-button");return n(),i("div",mt,[r("div",ft,[o(c,{class:"mb-4"}),o(d,{class:"mb-4"}),o(a,{class:"mb-4"}),o(w,{class:"mb-4"}),o(_,{class:"mb-4"}),o(f,{class:"mb-4"}),Q(o(E,{class:"mb-2"},null,512),[[X,e.config?.action==="image2video"]])]),r("div",_t,[o(O,{value:e.consumption,service:e.service},null,8,["value","service"]),o(F,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[o(B,{icon:"fa-solid fa-magic",class:"mr-2"}),h(" "+l(e.$t("sora.button.generate")),1)]),_:1},8,["onClick"])])])}const $t=k(pt,[["render",ht]]),gt=b({name:"TaskPreview",components:{ElImage:pe,CopyToClipboard:ie,FontAwesomeIcon:D,ElAlert:ue,VideoPlayer:ce,ElTooltip:de,ElButton:L},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")}}}),vt={class:"preview"},bt={class:"left"},kt={class:"main"},wt={class:"bot"},yt={class:"datetime"},St={class:"info"},Vt={key:0,class:"prompt mt-2"},Et={key:0},Tt={key:1},It={key:0,class:I({content:!0,failed:!0})},At={key:0,class:"mb-4"},Dt={key:1,class:I({operations:!0,"mt-2":!0})},Lt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ct={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Rt={key:1,class:I({content:!0})},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ut={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Pt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Gt={key:2,class:I({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Mt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function jt(e,t,p,m,g,v){const c=s("el-image"),d=s("video-player"),a=s("el-button"),w=s("el-tooltip"),_=s("font-awesome-icon"),f=s("copy-to-clipboard"),E=s("el-alert");return n(),i("div",vt,[r("div",bt,[o(c,{src:"https://cdn.acedata.cloud/z5id1u.png",class:"avatar"})]),r("div",kt,[r("div",wt,[h(l(e.$t("sora.name.soraBot"))+" ",1),r("span",yt,l(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),r("div",St,[e.modelValue?.request?.prompt?(n(),i("p",Vt,[h(l(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),i("span",Et," - ("+l(e.$t("sora.status.pending"))+") ",1)),Array.isArray(e.modelValue?.response?.data)&&e.modelValue?.response?.data[0]?.state==="pending"?(n(),i("span",Tt," - ("+l(e.$t("sora.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0&&e.modelValue?.response?.data?(n(),i("div",It,[e.modelValue?.response?.data[0]?.video_url?(n(),i("div",At,[o(d,{src:e.modelValue?.response?.data[0]?.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),i("div",Dt,[o(w,{class:"box-item",effect:"dark",content:e.$t("sora.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response?.data[0]?.video_url?(n(),y(a,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=O=>e.onDownload(O,e.modelValue?.response?.data[0]?.video_url))},{default:u(()=>[h(l(e.$t("sora.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),o(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[r("p",Lt,[o(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),h(" "+l(e.$t("sora.name.model"))+": "+l(e.modelValue?.request?.model),1)]),r("p",Ct,[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(),i("div",Rt,[o(E,{closable:!1,class:"failure"},{template:u(()=>[o(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+l(e.$t("sora.name.failure")),1)]),default:u(()=>[r("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"])]),r("p",Ut,[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(),i("p",Pt,[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(),i("div",Gt,[o(E,{closable:!1,class:"info"},{template:u(()=>[o(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),h(" "+l(e.$t("sora.name.failure")),1)]),default:u(()=>[r("p",zt,[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(),i("p",Mt,[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 Bt=k(gt,[["render",jt],["__scopeId","data-v-183a4d07"]]),Ft=b({name:"RecentPanel",components:{TaskPreview:Bt,NoTasks:ne,BotPlaceholder:me,ScrollList:te},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.sora?.tasks,items:this.$store.state.sora?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nt={key:0},qt={key:2,class:"w-full h-full flex items-center justify-center"};function Zt(e,t,p,m,g,v){const c=s("bot-placeholder"),d=s("task-preview"),a=s("scroll-list"),w=s("no-tasks");return n(),i(V,null,[e.tasks?.items===void 0?(n(),i("div",Nt,[o(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),y(a,{key:1,ref:"scrollList",class:"tasks h-full w-full overflow-y-auto",loading:e.loading,onReachTop:t[0]||(t[0]=_=>e.$emit("reach-top"))},{default:u(()=>[(n(!0),i(V,null,A(e.tasks?.items,(_,f)=>(n(),y(d,{key:f,"model-value":_},null,8,["model-value"]))),128))]),_:1},8,["loading"])):$("",!0),e.tasks?.items?.length===0?(n(),i("div",qt,[o(w)])):$("",!0)],64)}const Jt=k(Ft,[["render",Zt]]),Wt="https://webhook.acedata.cloud/sora",Yt=b({name:"SoraIndex",components:{ConfigPanel:$t,Layout:be,RecentPanel:Jt},inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.sora?.status?.getApplications===P.Request},tasksLoading(){return this.$store.state.sora?.status?.getTasks===P.Request||this.fetchingTasks},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(){await fe({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("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(){await this.$nextTick();const e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:p,createdAtMax:m}=e||{};console.debug("limit",t,"createdAtMin",p,"createdAtMax",m),this.fetchingTasks=!0;try{await this.$store.dispatch("sora/getTasks",{limit:t,createdAtMin:p,createdAtMax:m})}finally{this.fetchingTasks=!1}},async onGenerate(){const e={...this.config,callback_url:Wt},t=this.credential?.token;if(!t){console.error("no token specified");return}T.info(this.$t("sora.message.startingTask")),x.generate(e,{token:t}).then(()=>{T.success(this.$t("sora.message.startTaskSuccess"))}).catch(p=>{p?.response?.data?.error?.code===ee?T.error(this.$t("sora.message.usedUp")):T.error(this.$t("sora.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ht(e,t,p,m,g,v){const c=s("config-panel"),d=s("recent-panel"),a=s("layout");return n(),y(a,null,{config:u(()=>[o(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[o(d,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Ro=k(Yt,[["render",Ht]]);export{Ro as default};