@acedatacloud/nexior 3.12.1 → 3.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/assets/{Auth-C9Ps3qGU.js → Auth-CZC32Lgj.js} +1 -1
  2. package/dist/assets/{BotPlaceholder-BpvmBkXD.js → BotPlaceholder-BqPNZtMa.js} +1 -1
  3. package/dist/assets/{Callback-DdJe01FG.js → Callback-v6kH_hEP.js} +1 -1
  4. package/dist/assets/{Console-CQ-9fAMy.js → Console-D431xRcS.js} +1 -1
  5. package/dist/assets/{Conversation-Dr7b-i1i.js → Conversation-D564tA0e.js} +2 -2
  6. package/dist/assets/{CopyToClipboard-DyMPPewz.js → CopyToClipboard-C40SuTlf.js} +1 -1
  7. package/dist/assets/{Detail-DDW1H9ni.js → Detail-BuFmWrAY.js} +1 -1
  8. package/dist/assets/{EditArray-q4hekPI_.js → EditArray-ZgW3U6ZT.js} +1 -1
  9. package/dist/assets/{Extra-gxCS-7lk.js → Extra-DaVc5MAC.js} +1 -1
  10. package/dist/assets/{FilePreview-CCZrN5UK.js → FilePreview-CuQqNs8S.js} +1 -1
  11. package/dist/assets/{History-WkVpGKjF.js → History-DGl8NP_Z.js} +1 -1
  12. package/dist/assets/{ImagePreview-BPc3RF_H.js → ImagePreview-DK1w_9L9.js} +1 -1
  13. package/dist/assets/{ImageWrapper-Dgt0Q2FT.js → ImageWrapper-CFWME_Al.js} +1 -1
  14. package/dist/assets/{Index-MQwg8wpz.js → Index-1PdXHVA7.js} +1 -1
  15. package/dist/assets/{Index-CaEXc-YO.css → Index-65jtB0lw.css} +1 -1
  16. package/dist/assets/{Index-ClPqK1Bg.css → Index-B9tMv8WK.css} +1 -1
  17. package/dist/assets/{Index-DmxdMnbK.css → Index-BAhAF_7z.css} +1 -1
  18. package/dist/assets/{Index-BzWb9Rn3.js → Index-BdHY5Uv0.js} +1 -1
  19. package/dist/assets/{Index-BuxwizQ1.js → Index-Bgq3xAN5.js} +1 -1
  20. package/dist/assets/{Index-MiFGGOXD.js → Index-C7YU0-aw.js} +1 -1
  21. package/dist/assets/Index-CNLYJNWh.js +1 -0
  22. package/dist/assets/{Index-Cy_3QGWJ.js → Index-CO_O6Loh.js} +1 -1
  23. package/dist/assets/{Index-COVVy8ss.js → Index-CdI9Q89J.js} +1 -1
  24. package/dist/assets/Index-CdPqrmcY.css +1 -0
  25. package/dist/assets/{Index-DCMOSofU.js → Index-D1LvOztI.js} +1 -1
  26. package/dist/assets/{Index-CWsDiQU1.js → Index-DCd65nRP.js} +1 -1
  27. package/dist/assets/{Index-BMW0Yq1F.js → Index-DNX-StYM.js} +1 -1
  28. package/dist/assets/{Index-2YL8GdWf.js → Index-DOPRyswO.js} +1 -1
  29. package/dist/assets/{Index-jUXJgRLP.js → Index-Dyk-9Y9p.js} +1 -1
  30. package/dist/assets/Index-E9CBbwWt.js +1 -0
  31. package/dist/assets/{Index-BoUiV7dx.css → Index-M_XMk9YM.css} +1 -1
  32. package/dist/assets/{InfoIcon-_PcwxxEr.js → InfoIcon-0d7gDLJ0.js} +1 -1
  33. package/dist/assets/{Invitees-BTuoGEYx.js → Invitees-DNLQgY5n.js} +1 -1
  34. package/dist/assets/{List-DzO9HutF.js → List-CMDaGu6G.js} +1 -1
  35. package/dist/assets/{List-B0lNnkcL.js → List-DGgWNH_e.js} +1 -1
  36. package/dist/assets/{List-JroVtBC8.js → List-LCKpZB8-.js} +1 -1
  37. package/dist/assets/{Login--w2DTyjR.js → Login-Dgrk7zxX.js} +1 -1
  38. package/dist/assets/Main-DiJnbnzH.js +1 -0
  39. package/dist/assets/{Main-BSwVBPid.css → Main-ciuyHaq3.css} +1 -1
  40. package/dist/assets/{Navigator-B1zOZEZQ.js → Navigator-BshKXfHp.js} +1 -1
  41. package/dist/assets/{NoTasks-DHmfFJrK.js → NoTasks-FZyPIaNr.js} +1 -1
  42. package/dist/assets/{Pagination-_ELMMcj2.js → Pagination-DJg9ixZI.js} +1 -1
  43. package/dist/assets/{Status-DkLyOGsk.js → Status-QJUFiSuy.js} +1 -1
  44. package/dist/assets/{Subscribe-CX73FZwD.js → Subscribe-DUo5Osuv.js} +1 -1
  45. package/dist/assets/{VideoPlayer-B8-Tg95m.js → VideoPlayer-BdHLFiQV.js} +1 -1
  46. package/dist/assets/{_Uint8Array-BVA9I_fE.js → _Uint8Array-DvZicHme.js} +1 -1
  47. package/dist/assets/{_baseClone-_p75hPey.js → _baseClone-up_YH3aT.js} +1 -1
  48. package/dist/assets/{_baseIteratee-BnprkGcU.js → _baseIteratee-Bjn9Xjg-.js} +1 -1
  49. package/dist/assets/{_initCloneObject-CEFMBT5z.js → _initCloneObject-CbKHQFZX.js} +1 -1
  50. package/dist/assets/{castArray-4BvTHi4D.js → castArray-CI1BQ6-I.js} +1 -1
  51. package/dist/assets/{debounce-BQhVlwAs.js → debounce-BU0MXMaL.js} +1 -1
  52. package/dist/assets/{distribution-BDziq4nz.js → distribution-CJd80roB.js} +1 -1
  53. package/dist/assets/{dropdown-D5lWh2oc.js → dropdown-DrVs6SP5.js} +1 -1
  54. package/dist/assets/{index-D4I3evL9.js → index-53Nnxk4N.js} +1 -1
  55. package/dist/assets/{index-D2dszUUm.js → index-7bhqrFZ4.js} +1 -1
  56. package/dist/assets/{index-DmnSh2xh.js → index-B2s5F2Tx.js} +1 -1
  57. package/dist/assets/{index-BehSG88T.js → index-BC3SQhnJ.js} +1 -1
  58. package/dist/assets/{index-DjE06kE9.js → index-BIodD0b6.js} +1 -1
  59. package/dist/assets/{index-Yl4965oF.js → index-BJ9zZLVQ.js} +1 -1
  60. package/dist/assets/{index-BXVcZgxw.js → index-C2BNqZFy.js} +1 -1
  61. package/dist/assets/{index-DSHqbIyQ.js → index-CL10eK8V.js} +1 -1
  62. package/dist/assets/{index-bAaD18S5.js → index-CM7w86w8.js} +1 -1
  63. package/dist/assets/{index-BWKYfhQJ.js → index-CNvtlz9J.js} +1 -1
  64. package/dist/assets/{index-DBssH7pX.js → index-CTJc5RN5.js} +1 -1
  65. package/dist/assets/{index-DLmsZMpM.js → index-CZMtA_vS.js} +1 -1
  66. package/dist/assets/{index-PzuQTcb2.js → index-CiKCfyf3.js} +14 -14
  67. package/dist/assets/{index-DnYBmGDX.js → index-Cq49YzTu.js} +1 -1
  68. package/dist/assets/{index-uHnIvF0e.js → index-CxyHkpEQ.js} +1 -1
  69. package/dist/assets/{index-CrJlOJBH.js → index-DCCuTE-3.js} +1 -1
  70. package/dist/assets/{index-CpFwyPVo.js → index-DEFz9Wow.js} +1 -1
  71. package/dist/assets/{index-DqR4HY--.js → index-DFa_fZ2n.js} +1 -1
  72. package/dist/assets/{index-BY4IcCmQ.js → index-DNK0vmjT.js} +1 -1
  73. package/dist/assets/{index-DuvQfdS5.js → index-Da46tI_Z.js} +1 -1
  74. package/dist/assets/{index-CPSVYQzh.js → index-Ddc5MDdZ.js} +1 -1
  75. package/dist/assets/{index-CKMtc4ic.js → index-Dl9GrwQ4.js} +1 -1
  76. package/dist/assets/{index-B3ZkmbIo.js → index-Dpzs9o6b.js} +1 -1
  77. package/dist/assets/{index-DOSbWYIy.js → index-Dq8CiIfs.js} +1 -1
  78. package/dist/assets/{index-CdPm0FKF.js → index-Dr-J0rUK.js} +1 -1
  79. package/dist/assets/{index-DagREoh2.js → index-Dr5emkEa.js} +1 -1
  80. package/dist/assets/{index-wcGfTy7F.js → index-DvzAv5C6.js} +1 -1
  81. package/dist/assets/{index-DPUHufUs.js → index-XDZ1lCPN.js} +1 -1
  82. package/dist/assets/{index-C-IFZVH5.js → index-qEoC6TPp.js} +1 -1
  83. package/dist/assets/{index.es-JfM5t2Sf.js → index.es-BaEF-yCd.js} +1 -1
  84. package/dist/assets/{isEqual-fTEz49hG.js → isEqual-DHEz5PGP.js} +1 -1
  85. package/dist/assets/{isPlainObject-Brlhjumy.js → isPlainObject-ClWS5-H4.js} +1 -1
  86. package/dist/assets/midjourney-8dbl06WU.js +1 -0
  87. package/dist/assets/midjourney-8f3J9bhU.js +1 -0
  88. package/dist/assets/midjourney-BN10jSwh.js +1 -0
  89. package/dist/assets/midjourney-BUxwE3F9.js +1 -0
  90. package/dist/assets/midjourney-CBocYF0B.js +1 -0
  91. package/dist/assets/midjourney-CeriAk6B.js +1 -0
  92. package/dist/assets/midjourney-ClhQVRIK.js +1 -0
  93. package/dist/assets/midjourney-Cp6qfauG.js +1 -0
  94. package/dist/assets/midjourney-Cx5KEAE9.js +1 -0
  95. package/dist/assets/midjourney-D8k7Y7vV.js +1 -0
  96. package/dist/assets/midjourney-DEISXjPJ.js +1 -0
  97. package/dist/assets/midjourney-DtfbTn0W.js +1 -0
  98. package/dist/assets/midjourney-G8qopR2N.js +1 -0
  99. package/dist/assets/midjourney-Nvbqh73g.js +1 -0
  100. package/dist/assets/midjourney-XRLicaes.js +1 -0
  101. package/dist/assets/midjourney-f98eMyz2.js +1 -0
  102. package/dist/assets/{midjourney-DuSNrZjx.js → midjourney-kzhxkDbQ.js} +1 -1
  103. package/dist/assets/midjourney-nPq846ge.js +1 -0
  104. package/dist/assets/{order-D204BkAu.js → order-DDazIjCr.js} +1 -1
  105. package/dist/assets/{price-CckLdzJV.js → price-Bj_oJ8c5.js} +1 -1
  106. package/dist/assets/{strings-UgWiDXyr.js → strings-CzUgnw_H.js} +1 -1
  107. package/dist/assets/{typescript-DjoIxu2M.js → typescript-DurtlR9E.js} +1 -1
  108. package/dist/assets/{use-form-item-DK5EyE2z.js → use-form-item-Bi9Opk2t.js} +1 -1
  109. package/dist/index.html +1 -1
  110. package/package.json +1 -1
  111. package/dist/assets/Index-BAMjKi-z.js +0 -1
  112. package/dist/assets/Index-CV4m0aU7.css +0 -1
  113. package/dist/assets/Index-D9WMEzWT.js +0 -1
  114. package/dist/assets/Main-B8iraP71.js +0 -1
  115. package/dist/assets/midjourney-83NOka_N.js +0 -1
  116. package/dist/assets/midjourney-B4GYwwm3.js +0 -1
  117. package/dist/assets/midjourney-BCW14TZj.js +0 -1
  118. package/dist/assets/midjourney-BFTlLtFL.js +0 -1
  119. package/dist/assets/midjourney-BcNzX-j5.js +0 -1
  120. package/dist/assets/midjourney-Bh97gMp-.js +0 -1
  121. package/dist/assets/midjourney-C0GFWKwi.js +0 -1
  122. package/dist/assets/midjourney-C0R_BDrw.js +0 -1
  123. package/dist/assets/midjourney-CKdIQoxg.js +0 -1
  124. package/dist/assets/midjourney-CrDuoCFJ.js +0 -1
  125. package/dist/assets/midjourney-DKPCpMFD.js +0 -1
  126. package/dist/assets/midjourney-DKlPNcv_.js +0 -1
  127. package/dist/assets/midjourney-UNlG0jDv.js +0 -1
  128. package/dist/assets/midjourney-YQfPk4EJ.js +0 -1
  129. package/dist/assets/midjourney-_LLWs-r3.js +0 -1
  130. package/dist/assets/midjourney-iRKTW8UE.js +0 -1
  131. package/dist/assets/midjourney-xmGN_FnS.js +0 -1
@@ -1 +1 @@
1
- import{F as q}from"./index.es-JfM5t2Sf.js";import{E as H}from"./index-BehSG88T.js";import{E as de}from"./index-DnYBmGDX.js";import{ah as pe,an as me,bG as he,ai as ie,c7 as fe,_ as _e,d as C,a as $e,aj as ve,c as j,bf as ge,bl as ke,au as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b6 as le,E as M,n as ye,g as we,h as A,t as l,k as s,l as c,eC as se,x as v,F as z,v as N,eD as Q,c4 as be,D as P,eE as x,eF as ee,y,J as Z,cL as te,eG as O,dj as W,eH as R,al as Ce,K as Se,eI as Le,db as Ae,di as Ee}from"./index-PzuQTcb2.js";import{E as re}from"./index-DBssH7pX.js";import{E as je,a as Ie}from"./index-DjE06kE9.js";import{I as D}from"./InfoIcon-_PcwxxEr.js";import{E as Ve}from"./index-DOSbWYIy.js";import{E}from"./index-Yl4965oF.js";import{E as K}from"./index-DqR4HY--.js";import{E as Te,a as ce}from"./index-BY4IcCmQ.js";import{E as X}from"./index-BXVcZgxw.js";import{E as Pe,a as Fe,b as Ue}from"./index-B3ZkmbIo.js";import{E as ze}from"./index-DmnSh2xh.js";import{E as Ge}from"./index-CKMtc4ic.js";import{N as Me}from"./NoTasks-DHmfFJrK.js";import{a as Re,E as De}from"./index-DSHqbIyQ.js";import{E as Oe}from"./index-DagREoh2.js";import"./use-form-item-DK5EyE2z.js";import"./index-r5W6hzzQ.js";import"./index-D4I3evL9.js";import"./strings-UgWiDXyr.js";import"./castArray-4BvTHi4D.js";import"./isEqual-fTEz49hG.js";import"./_Uint8Array-BVA9I_fE.js";import"./typescript-DjoIxu2M.js";import"./debounce-BQhVlwAs.js";import"./_baseIteratee-BnprkGcU.js";import"./index-CdPm0FKF.js";import"./index-wcGfTy7F.js";import"./_baseClone-_p75hPey.js";import"./_initCloneObject-CEFMBT5z.js";import"./index-uHnIvF0e.js";import"./dropdown-D5lWh2oc.js";const We=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Be={error:e=>e instanceof Event},Ne=C({name:"ElAvatar"}),qe=C({...Ne,props:We,emits:Be,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=j(()=>{const{size:n,icon:m,shape:k}=i,h=[o.b()];return ge(n)&&h.push(o.m(n)),m&&h.push(o.m("icon")),k&&h.push(o.m(k)),h}),u=j(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=j(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function f(n){r.value=!0,t("error",n)}return(n,m)=>(a(),_("span",{class:ye(L(d)),style:oe(L(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(L(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(L(M),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var He=_e(qe,[["__file","avatar.vue"]]);const Ze=we(He),Ke=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Xe={class:"main"},Je={class:"config"},Ye={class:"result"},Qe={class:"preview"};function xe(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Xe,[l("div",Je,[U(e.$slots,"config",{},void 0,!0)]),l("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),l("div",Qe,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),"with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const et=A(Ke,[["render",xe],["__scopeId","data-v-230fd591"]]),tt=C({name:"VersionSelector",components:{ElSelect:Ie,ElOption:je,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),ot={class:"field"},st={class:"title font-bold"};function nt(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",ot,[l("h2",st,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(f,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),_(z,null,N(e.options,n=>(a(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const it=A(tt,[["render",nt],["__scopeId","data-v-5a66a01f"]]),at=C({name:"UploadAudio",components:{ElUpload:Ve,ElButton:H,InfoIcon:D,FontAwesomeIcon:q},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Q.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),lt={class:"relative"},rt={class:"flex justify-between"},ct={class:"flex justify-start items-center"},ut={class:"text-sm font-bold"};function dt(e,t,i,o,r,d){const u=c("info-icon"),p=c("font-awesome-icon"),f=c("el-button"),n=c("el-upload");return a(),_("div",lt,[l("div",rt,[l("div",ct,[l("span",ut,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),P(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const pt=A(at,[["render",dt],["__scopeId","data-v-6236152c"]]),mt="",ht=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=mt)}}),ft={class:"field"},_t={class:"box"},$t={class:"title-info"},vt={class:"title font-bold"},gt={class:"instrumental"},kt={class:"title inline-block"};function yt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",ft,[l("div",_t,[l("div",$t,[l("h2",vt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",gt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",kt,v(e.$t("suno.name.instrumental")),1)])]),s(f,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const wt=A(ht,[["render",yt],["__scopeId","data-v-d7004a7c"]]),bt="",Ct=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=bt)}}),St={class:"field"},Lt={class:"box"},At={class:"title font-bold"};function Et(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",St,[l("div",Lt,[l("h2",At,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const jt=A(Ct,[["render",Et],["__scopeId","data-v-99dfded8"]]),It=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Vt={class:"field"},Tt={class:"title-container"},Pt={class:"titlefont-bold"};function Ft(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Vt,[l("div",Tt,[l("h2",Pt,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=f=>e.style=f),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ut=A(It,[["render",Ft],["__scopeId","data-v-85bbfcaa"]]),zt=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Mt={class:"title-container"},Rt={class:"title font-bold"};function Dt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Gt,[l("div",Mt,[l("h2",Rt,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=f=>e.title=f),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ot=A(zt,[["render",Dt],["__scopeId","data-v-ce70fe34"]]);function G(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Wt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:M,ElInputNumber:Te,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:G,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})}}}),Bt={class:"field"},Nt={class:"box"},qt={class:"title font-bold"},Ht={class:"input-wrapper"},Zt={class:"task"},Kt={class:"left"},Xt={key:2,class:"duration"},Jt={class:"info"},Yt={class:"title"},Qt={class:"style"};function xt(e,t,i,o,r,d){const u=c("el-input-number"),p=c("el-image"),f=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=te("loading");return a(),_("div",Bt,[l("div",Nt,[l("h2",qt,v(e.$t("suno.name.extend")),1),l("div",Ht,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=h=>e.value=h),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",Zt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Kt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=h=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(f)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=h=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",Xt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Jt,[l("h2",Yt,v(e.audio?.title),1),l("p",Qt,v(e.audio?.style),1)])])):y("",!0)])])}const eo=A(Wt,[["render",xt],["__scopeId","data-v-bcce4821"]]),to=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:M,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:G,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})}}}),oo={class:"field"},so={class:"box"},no={class:"title font-bold"},io={class:"task"},ao={class:"left"},lo={key:2,class:"duration"},ro={class:"info"},co={class:"title"},uo={class:"style"};function po(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=te("loading");return a(),_("div",oo,[l("div",so,[l("h2",no,v(e.$t("suno.name.cover")),1)]),l("div",io,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ao,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(f,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(f,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",lo,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",ro,[l("h2",co,v(e.audio?.title),1),l("p",uo,v(e.audio?.style),1)])])):y("",!0)])])}const mo=A(to,[["render",po],["__scopeId","data-v-06640216"]]),ho=C({name:"PresetPanel",components:{TypeSelector:it,PromptInput:wt,LyricInput:jt,StyleInput:Ut,TitleInput:Ot,ExtendFromInput:eo,CoverFromInput:mo,UploadAudio:pt,FontAwesomeIcon:q,ElButton:H},emits:["generate"],computed:{config(){return this.$store.state.suno?.config}},methods:{onGenerate(){this.$emit("generate")}}}),fo={class:"panel"},_o={class:"config"},$o={class:"actions"};function vo(e,t,i,o,r,d){const u=c("type-selector"),p=c("upload-audio"),f=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),h=c("extend-from-input"),b=c("cover-from-input"),T=c("font-awesome-icon"),I=c("el-button");return a(),_("div",fo,[l("div",_o,[s(u,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(f,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(h,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0),l("div",$o,[e.config?.action!=="extend"?(a(),w(I,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(I,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}const go=A(ho,[["render",vo],["__scopeId","data-v-dc0dc608"]]);var B={exports:{}},ko=B.exports,ne;function yo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(ko,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var h=new XMLHttpRequest;h.open("GET",n),h.responseType="blob",h.onload=function(){f(h.response,m,k)},h.onerror=function(){console.error("could not download file")},h.send()}function r(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,p=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var h=u.URL||u.webkitURL,b=document.createElement("a");m=m||n.name||"download",b.download=m,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,m,k):d(b,b.target="_blank")):(b.href=h.createObjectURL(n),setTimeout(function(){h.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(r(n))o(n,m,k);else{var h=document.createElement("a");h.href=n,h.target="_blank",setTimeout(function(){d(h)})}}:function(n,m,k,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var b=n.type==="application/octet-stream",T=/constructor/i.test(u.HTMLElement)||u.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||b&&T||p)&&typeof FileReader<"u"){var V=new FileReader;V.onloadend=function(){var S=V.result;S=I?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},V.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);h?h.location=F:location.href=F,h=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=f.saveAs=f,e.exports=f})}(B)),B.exports}var wo=yo();const bo="https://webhook.acedata.cloud/suno",Co=C({name:"TaskPreview",components:{ElImage:X,ElIcon:M,ElTooltip:ze,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Ue,ElDropdownMenu:Fe,ElDropdownItem:Pe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:G,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{wo.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:bo},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),So={class:"task"},Lo=["onClick"],Ao={class:"left"},Eo=["onClick"],jo=["onClick"],Io={key:2,class:"duration"},Vo={class:"info"},To={class:"title"},Po={class:"style"},Fo={class:"right"},Uo={class:"el-dropdown-link"},zo={class:"el-dropdown-link"};function Go(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),h=c("el-tooltip"),b=c("el-dropdown-item"),T=c("el-dropdown-menu"),I=c("el-dropdown"),V=te("loading");return a(),_("div",So,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Ao,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(f,null,{default:$(()=>[s(p)]),_:1})],8,Eo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(f,null,{default:$(()=>[s(n)]),_:1})],8,jo)):y("",!0),g?.duration?(a(),_("div",Io,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[V,!g?.audio_url]]),l("div",Vo,[l("h2",To,v(g?.title),1),l("p",Po,v(g?.style),1)]),l("div",Fo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[P(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(h,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(I,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[P(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[P(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Uo,[s(h,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(I,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[P(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[P(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[P(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",zo,[s(h,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Lo))),128))])}const Mo=A(Co,[["render",Go]]),Ro={class:"player-slider"},Do=C({__name:"PlayerSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=j({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,p)=>(a(),_("div",Ro,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Oo="/assets/disk-XFRmVAfp.png",Wo={class:"flex player-song"},Bo=["src"],No={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ho={class:"flex"},Zo={class:"ml-2 text-dc"},Ko=C({__name:"PlayerSong",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),_("div",Wo,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Oo)},null,8,Bo),l("div",No,[l("div",qo,[l("div",Ho,[l("span",null,v(i.value?.title||"Music"),1),l("span",Zo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Xo={class:"flex justify-end items-center gap-x-2.5"},Jo={class:"text-xs"},Yo=C({__name:"PlayerAction",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=j({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Xo,[l("span",Jo,v(L(G)(i.value))+" / "+v(L(G)(o.value)),1)]))}});var Qo={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 xo(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function es(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var ts=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=xo(),p=Ce(ts,Qo);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,T=d.spin,I=es(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),V=[p.prefix+"-icon"];return V.push(p.prefix+"-icon-"+e),t&&p.rtl&&V.push(p.prefix+"-icon-rtl"),T&&V.push(p.prefix+"-icon-spin"),s("span",{class:V.join(" ")},[i(I)])}}};return o}const os=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ss=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ns=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Y=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),is={class:"player-volume flex flex-col items-center pt-2"},as={class:"text-sm mt-3"},ls={class:"mt-2"},rs=C({__name:"PlayerVolumeSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=j({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,p)=>(a(),_("div",is,[l("div",null,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",as,v(i.value),1),l("div",ls,[s(Y,{icon:o.value?L(ns):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),cs={class:"flex items-center justify-center gap-x-3"},us=C({__name:"PlayerController",setup(e){const t=R(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=j(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",cs,[s(Y,{icon:o.value?.state==="playing"?L(os):L(ss),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(Ge),{placement:"top",width:"50px"},{reference:$(()=>[s(Y,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(rs)]),_:1})]))}}),ds={class:"flex flex-col items-stretch h-20"},ps={class:"flex grow px-5 items-center"},ms={class:"flex-1"},hs={class:"flex-1"},fs={class:"flex-1"},_s=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ds,[s(Do),l("div",ps,[l("div",ms,[s(Ko)]),l("div",hs,[s(us)]),l("div",fs,[s(Yo)])])]))}}),$s=C({name:"RecentPanel",components:{TaskPreview:Mo,ElSkeleton:De,ElSkeletonItem:Re,Player:_s,NoTasks:Me},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),vs={key:0,class:"tasks"},gs={class:"left"},ks={class:"main"},ys={key:1,class:"tasks"},ws={key:2,class:"w-full h-full flex items-center justify-center"},bs={class:"flex-1 flex flex-col"},Cs={class:"h-20"};function Ss(e,t,i,o,r,d){const u=c("el-skeleton-item"),p=c("el-skeleton"),f=c("task-preview"),n=c("no-tasks"),m=c("player");return a(),_(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[e.tasks?.items===void 0?(a(),_("div",vs,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",gs,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ks,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),_("div",ys,[(a(!0),_(z,null,N(e.tasks?.items,(k,h)=>(a(),w(f,{key:h,"model-value":k,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),_("div",ws,[s(n)])):y("",!0)],544),Z(l("div",bs,[l("div",Cs,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const Ls=A($s,[["render",Ss],["__scopeId","data-v-959f8920"]]),As=C({name:"TaskPreview",components:{ElScrollbar:Oe,IconPicture:Le,ElImage:X,ElAvatar:Ze,ElIcon:M},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Es={key:0,class:"card"},js={class:"image-container"},Is={class:"image-slot"},Vs={class:"title"},Ts={class:"content"},Ps={class:"artist"},Fs={class:"style"},Us={class:"time"},zs={class:"lyrics"},Gs={key:1,class:"gradient-background"};function Ms(e,t,i,o,r,d){const u=c("icon-picture"),p=c("el-icon"),f=c("el-image"),n=c("el-avatar"),m=c("el-scrollbar");return a(),w(m,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),_("div",Es,[l("div",js,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Is,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Vs,v(e.audio?.title),1)]),l("div",Ts,[l("div",Ps,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",Fs,v(e.audio?.style),1),l("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",zs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Gs))]),_:1})}const Rs=A(As,[["render",Ms],["__scopeId","data-v-9b29e9f9"]]),Ds="https://webhook.acedata.cloud/suno",Os=C({name:"SunoIndex",components:{Layout:et,ConfigPanel:go,RecentPanel:Ls,PreviewPanel:Rs},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===W.Request},needApply(){return this.$store.state.suno.status.getApplications===W.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ee&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ds},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ws(e,t,i,o,r,d){const u=c("config-panel"),p=c("recent-panel"),f=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(f)]),_:1})}const Cn=A(Os,[["render",Ws],["__scopeId","data-v-69332928"]]);export{Cn as default};
1
+ import{F as q}from"./index.es-BaEF-yCd.js";import{E as H}from"./index-BC3SQhnJ.js";import{E as de}from"./index-Cq49YzTu.js";import{ah as pe,an as me,bG as he,ai as ie,c7 as fe,_ as _e,d as C,a as $e,aj as ve,c as j,bf as ge,bl as ke,au as ae,b as _,o as a,i as w,r as U,f as oe,e as L,j as $,b6 as le,E as G,n as ye,g as we,h as A,t as l,k as s,l as c,eC as se,x as v,F as z,v as N,eD as Q,c4 as be,D as P,eE as x,eF as ee,y,J as Z,cL as te,eG as O,dj as W,eH as R,al as Ce,K as Se,eI as Le,db as Ae,di as Ee}from"./index-CiKCfyf3.js";import{E as re}from"./index-CTJc5RN5.js";import{E as je,a as Ve}from"./index-BIodD0b6.js";import{I as D}from"./InfoIcon-0d7gDLJ0.js";import{E as Ie}from"./index-Dq8CiIfs.js";import{E}from"./index-BJ9zZLVQ.js";import{E as K}from"./index-DFa_fZ2n.js";import{E as Te,a as ce}from"./index-DNK0vmjT.js";import{E as X}from"./index-C2BNqZFy.js";import{E as Pe,a as Fe,b as Ue}from"./index-Dpzs9o6b.js";import{E as ze}from"./index-B2s5F2Tx.js";import{E as Me}from"./index-Dl9GrwQ4.js";import{N as Ge}from"./NoTasks-FZyPIaNr.js";import{a as Re,E as De}from"./index-CL10eK8V.js";import{E as Oe}from"./index-Dr5emkEa.js";import"./use-form-item-Bi9Opk2t.js";import"./index-r5W6hzzQ.js";import"./index-53Nnxk4N.js";import"./strings-CzUgnw_H.js";import"./castArray-CI1BQ6-I.js";import"./isEqual-DHEz5PGP.js";import"./_Uint8Array-DvZicHme.js";import"./typescript-DurtlR9E.js";import"./debounce-BU0MXMaL.js";import"./_baseIteratee-Bjn9Xjg-.js";import"./index-Dr-J0rUK.js";import"./index-DvzAv5C6.js";import"./_baseClone-up_YH3aT.js";import"./_initCloneObject-CbKHQFZX.js";import"./index-CxyHkpEQ.js";import"./dropdown-DrVs6SP5.js";const We=pe({size:{type:[Number,String],values:fe,default:"",validator:e=>ie(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:he},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Be={error:e=>e instanceof Event},Ne=C({name:"ElAvatar"}),qe=C({...Ne,props:We,emits:Be,setup(e,{emit:t}){const i=e,o=$e("avatar"),r=ve(!1),d=j(()=>{const{size:n,icon:m,shape:k}=i,h=[o.b()];return ge(n)&&h.push(o.m(n)),m&&h.push(o.m("icon")),k&&h.push(o.m(k)),h}),u=j(()=>{const{size:n}=i;return ie(n)?o.cssVarBlock({size:ke(n)||""}):void 0}),p=j(()=>({objectFit:i.fit}));ae(()=>i.src,()=>r.value=!1);function f(n){r.value=!0,t("error",n)}return(n,m)=>(a(),_("span",{class:ye(L(d)),style:oe(L(u))},[(n.src||n.srcSet)&&!r.value?(a(),_("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(L(p)),onError:f},null,44,["src","alt","srcset"])):n.icon?(a(),w(L(G),{key:1},{default:$(()=>[(a(),w(le(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var He=_e(qe,[["__file","avatar.vue"]]);const Ze=we(He),Ke=C({name:"LayoutSuno",components:{ElDrawer:de,ElButton:H,FontAwesomeIcon:q},data(){return{drawer:!1,preview:!1}},computed:{}}),Xe={class:"main"},Je={class:"config"},Ye={class:"result"},Qe={class:"preview"};function xe(e,t,i,o,r,d){const u=c("font-awesome-icon"),p=c("el-button"),f=c("el-drawer");return a(),_("div",Xe,[l("div",Je,[U(e.$slots,"config",{},void 0,!0)]),l("div",Ye,[U(e.$slots,"result",{},void 0,!0)]),l("div",Qe,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{round:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(u,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),s(f,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),"with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const et=A(Ke,[["render",xe],["__scopeId","data-v-230fd591"]]),tt=C({name:"VersionSelector",components:{ElSelect:Ve,ElOption:je,ElSwitch:re},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),ot={class:"field"},st={class:"title font-bold"};function nt(e,t,i,o,r,d){const u=c("el-switch"),p=c("el-option"),f=c("el-select");return a(),_("div",ot,[l("h2",st,v(e.$t("suno.name.type")),1),s(u,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(f,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(a(!0),_(z,null,N(e.options,n=>(a(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const it=A(tt,[["render",nt],["__scopeId","data-v-5a66a01f"]]),at=C({name:"UploadAudio",components:{ElUpload:Ie,ElButton:H,InfoIcon:D,FontAwesomeIcon:q},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){E.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){E.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}E.info(this.$t("suno.message.startingUploadAudio")),Q.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const r=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:r,action:"upload_extend"}),E.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{E.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),lt={class:"relative"},rt={class:"flex justify-between"},ct={class:"flex justify-start items-center"},ut={class:"text-sm font-bold"};function dt(e,t,i,o,r,d){const u=c("info-icon"),p=c("font-awesome-icon"),f=c("el-button"),n=c("el-upload");return a(),_("div",lt,[l("div",rt,[l("div",ct,[l("span",ut,v(e.$t("suno.name.referenceAudios")),1),s(u,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(f,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),P(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const pt=A(at,[["render",dt],["__scopeId","data-v-6236152c"]]),mt="",ht=C({name:"PromptInput",components:{ElInput:K,ElSwitch:re,InfoIcon:D},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=mt)}}),ft={class:"field"},_t={class:"box"},$t={class:"title-info"},vt={class:"title font-bold"},gt={class:"instrumental"},kt={class:"title inline-block"};function yt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-switch"),f=c("el-input");return a(),_("div",ft,[l("div",_t,[l("div",$t,[l("h2",vt,v(e.$t("suno.name.prompt")),1),s(u,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),l("div",gt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),l("h2",kt,v(e.$t("suno.name.instrumental")),1)])]),s(f,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const wt=A(ht,[["render",yt],["__scopeId","data-v-d7004a7c"]]),bt="",Ct=C({name:"LyricInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=bt)}}),St={class:"field"},Lt={class:"box"},At={class:"title font-bold"};function Et(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",St,[l("div",Lt,[l("h2",At,v(e.$t("suno.name.lyrics")),1),s(u,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(a(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(a(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=f=>e.lyric=f),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const jt=A(Ct,[["render",Et],["__scopeId","data-v-99dfded8"]]),Vt=C({name:"StyleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),It={class:"field"},Tt={class:"title-container"},Pt={class:"titlefont-bold"};function Ft(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",It,[l("div",Tt,[l("h2",Pt,v(e.$t("suno.name.style")),1),s(u,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=f=>e.style=f),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ut=A(Vt,[["render",Ft],["__scopeId","data-v-85bbfcaa"]]),zt=C({name:"TitleInput",components:{ElInput:K,InfoIcon:D},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Mt={class:"field"},Gt={class:"title-container"},Rt={class:"title font-bold"};function Dt(e,t,i,o,r,d){const u=c("info-icon"),p=c("el-input");return a(),_("div",Mt,[l("div",Gt,[l("h2",Rt,v(e.$t("suno.name.title")),1),s(u,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=f=>e.title=f),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ot=A(zt,[["render",Dt],["__scopeId","data-v-ce70fe34"]]);function M(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,r=t<10?`0${t}`:t;return o+":"+r}const Wt=C({name:"ExtendFromInput",components:{ElImage:X,ElIcon:G,ElInputNumber:Te,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Bt={class:"field"},Nt={class:"box"},qt={class:"title font-bold"},Ht={class:"input-wrapper"},Zt={class:"task"},Kt={class:"left"},Xt={key:2,class:"duration"},Jt={class:"info"},Yt={class:"title"},Qt={class:"style"};function xt(e,t,i,o,r,d){const u=c("el-input-number"),p=c("el-image"),f=c("video-pause"),n=c("el-icon"),m=c("video-play"),k=te("loading");return a(),_("div",Bt,[l("div",Nt,[l("h2",qt,v(e.$t("suno.name.extend")),1),l("div",Ht,[s(u,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=h=>e.value=h),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),l("div",Zt,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[3]||(t[3]=h=>e.onClick(e.audio))},[Z((a(),_("div",Kt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=h=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(f)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=h=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",Xt,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[k,!e.audio?.audio_url]]),l("div",Jt,[l("h2",Yt,v(e.audio?.title),1),l("p",Qt,v(e.audio?.style),1)])])):y("",!0)])])}const eo=A(Wt,[["render",xt],["__scopeId","data-v-bcce4821"]]),to=C({name:"CoverFromInput",components:{ElImage:X,ElIcon:G,VideoPlay:ee,VideoPause:x},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),oo={class:"field"},so={class:"box"},no={class:"title font-bold"},io={class:"task"},ao={class:"left"},lo={key:2,class:"duration"},ro={class:"info"},co={class:"title"},uo={class:"style"};function po(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=te("loading");return a(),_("div",oo,[l("div",so,[l("h2",no,v(e.$t("suno.name.cover")),1)]),l("div",io,[e.audio?(a(),_("div",{key:0,class:"audio",onClick:t[2]||(t[2]=k=>e.onClick(e.audio))},[Z((a(),_("div",ao,[s(u,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=k=>e.onPause(e.audio))},[s(f,null,{default:$(()=>[s(p)]),_:1})])):y("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=k=>e.onPlay(e.audio))},[s(f,null,{default:$(()=>[s(n)]),_:1})])):y("",!0),e.audio?.duration?(a(),_("div",lo,v(e.useFormatDuring(e.audio?.duration)),1)):y("",!0)])),[[m,!e.audio?.audio_url]]),l("div",ro,[l("h2",co,v(e.audio?.title),1),l("p",uo,v(e.audio?.style),1)])])):y("",!0)])])}const mo=A(to,[["render",po],["__scopeId","data-v-06640216"]]),ho=C({name:"PresetPanel",components:{TypeSelector:it,PromptInput:wt,LyricInput:jt,StyleInput:Ut,TitleInput:Ot,ExtendFromInput:eo,CoverFromInput:mo,UploadAudio:pt,FontAwesomeIcon:q,ElButton:H},emits:["generate"],computed:{config(){return this.$store.state.suno?.config}},methods:{onGenerate(){this.$emit("generate")}}}),fo={class:"panel"},_o={class:"config"},$o={class:"actions"};function vo(e,t,i,o,r,d){const u=c("type-selector"),p=c("upload-audio"),f=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),k=c("title-input"),h=c("extend-from-input"),b=c("cover-from-input"),T=c("font-awesome-icon"),V=c("el-button");return a(),_("div",fo,[l("div",_o,[s(u,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?y("",!0):(a(),w(f,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(a(),w(n,{key:1,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(m,{key:2,class:"mb-4"})):y("",!0),e.config?.custom?(a(),w(k,{key:3,class:"mb-4"})):y("",!0),e.config?.action==="extend"?(a(),w(h,{key:4,class:"mb-4"})):y("",!0),e.config?.action==="cover"?(a(),w(b,{key:5,class:"mb-4"})):y("",!0),l("div",$o,[e.config?.action!=="extend"?(a(),w(V,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(a(),w(V,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),P(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])])}const go=A(ho,[["render",vo],["__scopeId","data-v-dc0dc608"]]);var B={exports:{}},ko=B.exports,ne;function yo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(ko,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,k){var h=new XMLHttpRequest;h.open("GET",n),h.responseType="blob",h.onload=function(){f(h.response,m,k)},h.onerror=function(){console.error("could not download file")},h.send()}function r(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function d(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof O=="object"&&O.global===O?O:void 0,p=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,k){var h=u.URL||u.webkitURL,b=document.createElement("a");m=m||n.name||"download",b.download=m,b.rel="noopener",typeof n=="string"?(b.href=n,b.origin===location.origin?d(b):r(b.href)?o(n,m,k):d(b,b.target="_blank")):(b.href=h.createObjectURL(n),setTimeout(function(){h.revokeObjectURL(b.href)},4e4),setTimeout(function(){d(b)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,k){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,k),m);else if(r(n))o(n,m,k);else{var h=document.createElement("a");h.href=n,h.target="_blank",setTimeout(function(){d(h)})}}:function(n,m,k,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,k);var b=n.type==="application/octet-stream",T=/constructor/i.test(u.HTMLElement)||u.safari,V=/CriOS\/[\d]+/.test(navigator.userAgent);if((V||b&&T||p)&&typeof FileReader<"u"){var I=new FileReader;I.onloadend=function(){var S=I.result;S=V?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=S:location=S,h=null},I.readAsDataURL(n)}else{var g=u.URL||u.webkitURL,F=g.createObjectURL(n);h?h.location=F:location.href=F,h=null,setTimeout(function(){g.revokeObjectURL(F)},4e4)}});u.saveAs=f.saveAs=f,e.exports=f})}(B)),B.exports}var wo=yo();const bo="https://webhook.acedata.cloud/suno",Co=C({name:"TaskPreview",components:{ElImage:X,ElIcon:G,ElTooltip:ze,ElButton:H,FontAwesomeIcon:q,VideoPlay:ee,VideoPause:x,ElDropdown:Ue,ElDropdownMenu:Fe,ElDropdownItem:Pe},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=[];const t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(i=>{let o=i;t&&(o.action=t),e.push(o)}),e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:M,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,r=o.substring(o.lastIndexOf("/")+1);console.log("on preview",r),fetch(t).then(d=>d.blob()).then(d=>{wo.saveAs(d,r)})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:bo},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(i,{token:o}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(r=>{E.error(r?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),So={class:"task"},Lo=["onClick"],Ao={class:"left"},Eo=["onClick"],jo=["onClick"],Vo={key:2,class:"duration"},Io={class:"info"},To={class:"title"},Po={class:"style"},Fo={class:"right"},Uo={class:"el-dropdown-link"},zo={class:"el-dropdown-link"};function Mo(e,t,i,o,r,d){const u=c("el-image"),p=c("video-pause"),f=c("el-icon"),n=c("video-play"),m=c("el-button"),k=c("font-awesome-icon"),h=c("el-tooltip"),b=c("el-dropdown-item"),T=c("el-dropdown-menu"),V=c("el-dropdown"),I=te("loading");return a(),_("div",So,[(a(!0),_(z,null,N(e.audios,(g,F)=>(a(),_("div",{key:F,class:"audio",onClick:S=>e.onClick(g)},[Z((a(),_("div",Ao,[s(u,{src:g?.image_url,class:"cover",fit:"cover"},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(a(),_("div",{key:0,class:"overlay",onClick:S=>e.onPause(g)},[s(f,null,{default:$(()=>[s(p)]),_:1})],8,Eo)):y("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(a(),_("div",{key:1,class:"overlay",onClick:S=>e.onPlay(g)},[s(f,null,{default:$(()=>[s(n)]),_:1})],8,jo)):y("",!0),g?.duration?(a(),_("div",Vo,v(e.useFormatDuring(g?.duration)),1)):y("",!0)])),[[I,!g?.audio_url]]),l("div",Io,[l("h2",To,v(g?.title),1),l("p",Po,v(g?.style),1)]),l("div",Fo,[g?.audio_url?(a(),w(m,{key:0,size:"small",round:"",onClick:S=>e.onExtend(S,g)},{default:$(()=>[P(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):y("",!0),s(h,{effect:"dark",content:e.$t("suno.button.video"),placement:"top"},{default:$(()=>[g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-clapperboard",class:"icon icon-preview",onClick:S=>e.onPreview(S,g?.video_url)},null,8,["onClick"])):y("",!0)]),_:2},1032,["content"]),s(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g?.video_url?(a(),w(b,{key:0,onClick:S=>e.onDownload(S,g?.video_url)},{default:$(()=>[P(v(e.$t("suno.button.download_video")),1)]),_:2},1032,["onClick"])):y("",!0),g?.audio_url?(a(),w(b,{key:1,onClick:S=>e.onDownload(S,g?.audio_url)},{default:$(()=>[P(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",Uo,[s(h,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(V,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(a(),w(b,{key:0,onClick:S=>e.onGetStems(g.id)},{default:$(()=>[P(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):y("",!0),s(b,{onClick:S=>e.onCover(g)},{default:$(()=>[P(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(a(),w(b,{key:1,onClick:S=>e.onConcatMusic(g?.id)},{default:$(()=>[P(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):y("",!0)]),_:2},1024)]),default:$(()=>[l("span",zo,[s(h,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(a(),w(k,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):y("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Lo))),128))])}const Go=A(Co,[["render",Mo]]),Ro={class:"player-slider"},Do=C({__name:"PlayerSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:u})}),o=j({get:()=>t.state.suno?.audio?.duration,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:u})}),r=()=>{},d=u=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:u});return(u,p)=>(a(),_("div",Ro,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),"show-tooltip":!1,min:0,max:o.value,onChange:d,onInput:r},null,8,["modelValue","max"])]))}}),Oo="/assets/disk-XFRmVAfp.png",Wo={class:"flex player-song"},Bo=["src"],No={class:"ml-2 text-xs flex flex-col justify-between"},qo={class:"w-52 2xl:w-96 cursor-pointer truncate"},Ho={class:"flex"},Zo={class:"ml-2 text-dc"},Ko=C({__name:"PlayerSong",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return ae(i,(o,r)=>{if(o?.audio_url!==r?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const d=new Audio(o.audio_url);o.state==="playing"?d.play():d.pause(),d.addEventListener("loadedmetadata",()=>{d.currentTime=0,d.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:d.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:d})}else if(o?.progress!==r?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const d=t.state.suno.audio;d.object&&(d.object.currentTime=d.progress)}else o?.state!==r?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==r?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,r)=>(a(),_("div",Wo,[l("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||L(Oo)},null,8,Bo),l("div",No,[l("div",qo,[l("div",Ho,[l("span",null,v(i.value?.title||"Music"),1),l("span",Zo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Xo={class:"flex justify-end items-center gap-x-2.5"},Jo={class:"text-xs"},Yo=C({__name:"PlayerAction",setup(e){const t=R(),i=j({get:()=>t.state.suno?.audio?.progress,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:r})}),o=j({get:()=>t.state.suno?.audio?.duration,set:r=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:r})});return(r,d)=>(a(),_("div",Xo,[l("span",Jo,v(L(M)(i.value))+" / "+v(L(M)(o.value)),1)]))}});var Qo={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 xo(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function es(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],r=[],d=t.theme||i.theme;switch(d){case"outline":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("none");break;case"filled":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push("#FFF"),r.push("#FFF");break;case"two-tone":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":r.push(typeof o[0]=="string"?o[0]:"currentColor"),r.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),r.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),r.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:r,id:e}}var ts=Symbol("icon-context");function J(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(d){var u=xo(),p=Ce(ts,Qo);return function(){var f=d.size,n=d.strokeWidth,m=d.strokeLinecap,k=d.strokeLinejoin,h=d.theme,b=d.fill,T=d.spin,V=es(u,{size:f,strokeWidth:n,strokeLinecap:m,strokeLinejoin:k,theme:h,fill:b},p),I=[p.prefix+"-icon"];return I.push(p.prefix+"-icon-"+e),t&&p.rtl&&I.push(p.prefix+"-icon-rtl"),T&&I.push(p.prefix+"-icon-spin"),s("span",{class:I.join(" ")},[i(V)])}}};return o}const os=J("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ss=J("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ns=J("volume-mute",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("rect",{opacity:"0.01",x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null),s("mask",{id:e.id+"603476ab",maskUnits:"userSpaceOnUse",x:"30",y:"18",width:"13",height:"13",style:{maskType:"alpha"}},[s("rect",{x:"30",y:"18",width:"13",height:"13",fill:e.colors[2]},null)]),s("g",{mask:"url(#"+e.id+"603476ab)"},[s("path",{d:"M40.7348 20.2858L32.2495 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32.2496 20.2858L40.7349 28.7711",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)]),s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ue=J("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),Y=C({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(a(),w(le(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),is={class:"player-volume flex flex-col items-center pt-2"},as={class:"text-sm mt-3"},ls={class:"mt-2"},rs=C({__name:"PlayerVolumeSlider",setup(e){const t=R(),i=j({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=j({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),r=()=>t.dispatch("suno/toggleMuted"),d=u=>t.dispatch("suno/setVolume",u);return(u,p)=>(a(),_("div",is,[l("div",null,[s(L(ce),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:d},null,8,["modelValue","disabled"])]),l("div",as,v(i.value),1),l("div",ls,[s(Y,{icon:o.value?L(ns):L(ue),size:"16",theme:"filled",class:"hover-text",onClick:r},null,8,["icon"])])]))}}),cs={class:"flex items-center justify-center gap-x-3"},us=C({__name:"PlayerController",setup(e){const t=R(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=j(()=>t.state.suno.audio);return(r,d)=>(a(),_("div",cs,[s(Y,{icon:o.value?.state==="playing"?L(os):L(ss),size:"45",theme:"filled",class:"control",onClick:i},null,8,["icon"]),s(L(Me),{placement:"top",width:"50px"},{reference:$(()=>[s(Y,{icon:L(ue),size:"20","stroke-width":3,class:"hover-text"},null,8,["icon"])]),default:$(()=>[s(rs)]),_:1})]))}}),ds={class:"flex flex-col items-stretch h-20"},ps={class:"flex grow px-5 items-center"},ms={class:"flex-1"},hs={class:"flex-1"},fs={class:"flex-1"},_s=C({__name:"Player",setup(e){return(t,i)=>(a(),_("div",ds,[s(Do),l("div",ps,[l("div",ms,[s(Ko)]),l("div",hs,[s(us)]),l("div",fs,[s(Yo)])])]))}}),$s=C({name:"RecentPanel",components:{TaskPreview:Go,ElSkeleton:De,ElSkeletonItem:Re,Player:_s,NoTasks:Ge},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),vs={key:0,class:"tasks"},gs={class:"left"},ks={class:"main"},ys={key:1,class:"tasks"},ws={key:2,class:"w-full h-full flex items-center justify-center"},bs={class:"flex-1 flex flex-col"},Cs={class:"h-20"};function Ss(e,t,i,o,r,d){const u=c("el-skeleton-item"),p=c("el-skeleton"),f=c("task-preview"),n=c("no-tasks"),m=c("player");return a(),_(z,null,[l("div",{ref:"panel",class:"panel recent",onScroll:t[0]||(t[0]=(...k)=>e.onHandleScroll&&e.onHandleScroll(...k))},[e.tasks?.items===void 0?(a(),_("div",vs,[(a(),_(z,null,N(3,k=>l("div",{key:k,class:"task placeholder"},[l("div",gs,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"image",class:"avatar"})]),_:1})]),l("div",ks,[s(p,{animated:""},{template:$(()=>[s(u,{variant:"p",class:"title"}),s(u,{variant:"text",style:{"margin-right":"16px"}}),s(u,{variant:"text",style:{width:"80%"}})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),_("div",ys,[(a(!0),_(z,null,N(e.tasks?.items,(k,h)=>(a(),w(f,{key:h,"model-value":k,class:"preview"},null,8,["model-value"]))),128))])):y("",!0),e.tasks?.items?.length===0?(a(),_("div",ws,[s(n)])):y("",!0)],544),Z(l("div",bs,[l("div",Cs,[s(m)])],512),[[Se,!!e.$store?.state?.suno?.audio?.object]])],64)}const Ls=A($s,[["render",Ss],["__scopeId","data-v-959f8920"]]),As=C({name:"TaskPreview",components:{ElScrollbar:Oe,IconPicture:Le,ElImage:X,ElAvatar:Ze,ElIcon:G},data(){return{showCloseIcon:!0}},computed:{audio(){return this.$store.state.suno?.audio}},methods:{closeCard(){this.showCloseIcon=!this.showCloseIcon}}}),Es={key:0,class:"card"},js={class:"image-container"},Vs={class:"image-slot"},Is={class:"title"},Ts={class:"content"},Ps={class:"artist"},Fs={class:"style"},Us={class:"time"},zs={class:"lyrics"},Ms={key:1,class:"gradient-background"};function Gs(e,t,i,o,r,d){const u=c("icon-picture"),p=c("el-icon"),f=c("el-image"),n=c("el-avatar"),m=c("el-scrollbar");return a(),w(m,{class:"right-panel"},{default:$(()=>[e.audio?.object?(a(),_("div",Es,[l("div",js,[s(f,{src:e.audio.image_url,fit:"cover"},{error:$(()=>[l("div",Vs,[s(p,null,{default:$(()=>[s(u)]),_:1})])]),_:1},8,["src"]),l("h2",Is,v(e.audio?.title),1)]),l("div",Ts,[l("div",Ps,[s(n,{size:30,src:e.audio?.image_url},null,8,["src"]),l("span",null,v(e.audio?.prompt),1)]),l("p",Fs,v(e.audio?.style),1),l("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),l("div",zs,[l("p",null,v(e.audio?.lyric),1)])])])):(a(),_("div",Ms))]),_:1})}const Rs=A(As,[["render",Gs],["__scopeId","data-v-9b29e9f9"]]),Ds="https://webhook.acedata.cloud/suno",Os=C({name:"SunoIndex",components:{Layout:et,ConfigPanel:go,RecentPanel:Ls,PreviewPanel:Rs},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===W.Request},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===W.Request},needApply(){return this.$store.state.suno.status.getApplications===W.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("suno/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplications"),await this.$store.dispatch("suno/getApplications"),console.debug("end onGetApplications"),await this.onGetTasks()},onApply(){Ae.create({application:this.application}).then(({data:e})=>{this.application=e,E.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ee&&E.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ds},t=this.credential?.token;if(!t){console.error("no token specified");return}E.info(this.$t("suno.message.startingTask")),Q.audio(e,{token:t}).then(()=>{E.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{E.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Ws(e,t,i,o,r,d){const u=c("config-panel"),p=c("recent-panel"),f=c("preview-panel"),n=c("layout");return a(),w(n,null,{config:$(()=>[s(u,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(f)]),_:1})}const Cn=A(Os,[["render",Ws],["__scopeId","data-v-f5721d95"]]);export{Cn as default};
@@ -0,0 +1 @@
1
+ .drawer2 .el-drawer__header{margin-bottom:0}.drawer2 .el-drawer__body .tasks{padding-top:0}.main[data-v-5e6a73eb]{flex:1;height:100%;display:flex;flex-direction:row}.main .menu[data-v-5e6a73eb],.main .menu2[data-v-5e6a73eb]{display:none}.main .config[data-v-5e6a73eb]{width:300px;height:100%;display:flex;flex-direction:column}.main .results[data-v-5e6a73eb]{flex:1;height:100%;display:flex;flex-direction:column}@media screen and (min-width: 768px) and (max-width: 1060px){.main[data-v-5e6a73eb]{position:relative}.main .config[data-v-5e6a73eb]{display:none}.main .menu[data-v-5e6a73eb]{display:block;position:absolute;left:20px;top:20px;z-index:1000}}@media (max-width: 767px){.main[data-v-5e6a73eb]{position:relative}.main .config[data-v-5e6a73eb],.main .results[data-v-5e6a73eb]{display:none}.main .menu[data-v-5e6a73eb]{display:block;position:absolute;left:15px;top:15px;z-index:1000}}.title[data-v-4437810f]{font-size:14px;margin-bottom:10px}.items[data-v-4437810f]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.items .item[data-v-4437810f]{width:48px;height:65px;border:1px solid var(--el-border-color);display:flex;flex-direction:column;align-items:center;cursor:pointer;border-radius:var(--el-border-radius-base)}.items .item .preview[data-v-4437810f]{margin-top:5px;margin-bottom:3px;width:30px;height:30px;display:flex;flex-direction:row;align-items:center;justify-content:center}.items .item .preview .rect[data-v-4437810f]{border:1px solid var(--el-border-color);width:20px;height:20px;border-radius:2px}.items .item .name[data-v-4437810f]{display:block;font-size:12px;color:var(--el-text-color-primary)}.items .item.active[data-v-4437810f],.items .item.active .rect[data-v-4437810f]{border-color:var(--el-color-primary)}.field[data-v-2d55fce2]{display:flex;flex-direction:row;align-items:center}.field .title[data-v-2d55fce2]{font-size:14px;margin:0;width:30%}.field .value[data-v-2d55fce2]{flex:1}.field .info[data-v-2d55fce2]{width:20px}.field[data-v-34eb10fd]{display:flex;flex-direction:row;align-items:center}.field .title[data-v-34eb10fd]{font-size:14px;margin:0;width:30%}.field .value[data-v-34eb10fd]{flex:1}.field .info[data-v-34eb10fd]{width:20px}.field[data-v-3dd8fbb4]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .title[data-v-3dd8fbb4]{font-size:14px;margin:0;width:30%}.field .value[data-v-3dd8fbb4]{width:80px}.title[data-v-6bfd9eb5]{font-size:14px;margin-bottom:0;width:30%}.btn.btn-upload[data-v-6bfd9eb5]{position:absolute;top:5px;right:0}.field[data-v-8e0b87c9]{display:flex;flex-direction:row;align-items:center}.field .title[data-v-8e0b87c9]{font-size:14px;margin:0;width:30%}.field .value[data-v-8e0b87c9]{flex:1}.title[data-v-e26f2508]{font-size:14px;margin-bottom:10px}.items[data-v-e26f2508]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.items .item[data-v-e26f2508]{width:130px;height:60px;border:1px solid var(--el-border-color);display:flex;flex-direction:column;align-items:center;cursor:pointer;overflow:hidden;border-radius:var(--el-border-radius-base);position:relative}.items .item .image[data-v-e26f2508]{width:100%;height:100%}.items .item .name[data-v-e26f2508]{display:block;font-size:18px;color:#fff;position:absolute;text-align:center;top:12px}.items .item.active[data-v-e26f2508],.items .item.active .rect[data-v-e26f2508]{border-color:var(--el-color-primary)}.field[data-v-cd835960]{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.field .title[data-v-cd835960]{font-size:14px;margin:0;width:30%}.field .value[data-v-cd835960]{flex:1}.quality .el-radio-button--small .el-radio-button__inner{padding:8px 11px}.field[data-v-f23fda53]{display:flex;flex-direction:row;align-items:center}.field .title[data-v-f23fda53]{font-size:14px;margin:0;width:30%}.field .value[data-v-f23fda53]{flex:1}.field[data-v-00d50831]{display:flex;flex-direction:row;align-items:center}.field .title[data-v-00d50831]{font-size:14px;margin:0;width:30%}.field .value[data-v-00d50831]{flex:1}.title[data-v-6c713fc6]{font-size:14px;margin-bottom:10px}.pane[data-v-6c713fc6]{display:flex;flex-direction:row;justify-content:left;align-items:flex-start;height:auto;flex-wrap:wrap;height:230px;overflow-y:auto;gap:10px}.pane .item[data-v-6c713fc6]{position:relative;width:100px;height:100px;border-width:1px;border-style:solid;border-color:var(--el-border-color);border-radius:10px;overflow:hidden;cursor:pointer}.pane .item .icon[data-v-6c713fc6]{position:absolute;visibility:hidden;top:50%;left:50%;transform:translate(-50%,-50%);z-index:100;color:var(--el-color-white);font-size:20px;background-color:var(--el-color-primary);border-radius:50%;padding:5px}.pane .item.hidden[data-v-6c713fc6]{display:none}.pane .item.active[data-v-6c713fc6]{border-color:var(--el-color-primary)}.pane .item.active .icon[data-v-6c713fc6]{visibility:visible}.pane .item .preview[data-v-6c713fc6]{width:100px;height:100px}.pane .item .name[data-v-6c713fc6]{position:absolute;bottom:0;left:0;right:0;width:100px;text-overflow:ellipsis;background-color:#000c;color:#fff;font-size:10px;text-align:center;padding:0 5px}.field[data-v-defbf635]{display:flex;flex-direction:row;align-items:center}.field .title[data-v-defbf635]{font-size:14px;margin:0;width:30%}.field .value[data-v-defbf635]{flex:1}.mode .el-radio-button--small .el-radio-button__inner{padding:8px 11px}.field .box[data-v-024e04af]{display:flex;flex-direction:row;align-items:center;position:relative}.field .box .title[data-v-024e04af]{font-size:14px}.title[data-v-5800229a]{font-size:14px;margin-bottom:0;width:30%}.btn.btn-upload[data-v-5800229a]{position:absolute;top:5px;right:0}.upload-wrapper{height:auto;display:flex}.upload-wrapper .el-upload-list{margin:0;width:100%}.panel[data-v-eaeb6c79]{border-right:1px solid var(--el-border-color);flex:1;height:calc(100% - 40px)}.item[data-v-7a31b866]{display:flex;flex-direction:row}.item .left[data-v-7a31b866]{width:70px}.item .left .avatar[data-v-7a31b866]{width:50px;height:50px;margin:10px;border-radius:50%;border:1px solid var(--el-border-color)}.item .preview[data-v-7a31b866]{flex:1;width:calc(100% - 70px);padding:10px 10px 0;display:flex;flex-direction:column}.item .preview .bot[data-v-7a31b866]{font-size:16px;font-weight:700;color:#2ecc71;margin-bottom:0;margin-top:0}.item .preview .bot .datetime[data-v-7a31b866]{font-size:12px;font-weight:400;color:var(--el-text-color-secondary);margin-left:10px}.item .preview .description[data-v-7a31b866]{font-size:12px;color:var(--el-text-color-regular);margin-bottom:10px;text-align:left}.item .preview .info[data-v-7a31b866]{display:flex;flex-direction:row;width:100%}.item .preview .info .prompt[data-v-7a31b866]{font-size:14px;font-weight:700;color:var(--el-text-color-regular);margin-bottom:10px}.item .preview .info .mode .icon[data-v-7a31b866]{display:inline-block;margin-right:2px}.item .preview .info .mode .icon.turbo[data-v-7a31b866]{color:#f90}.item .preview .info .mode .icon.fast[data-v-7a31b866]{color:#2dc49c}.item .preview .info .mode .icon.relax[data-v-7a31b866]{color:#ce65e6}.item .preview .content[data-v-7a31b866]{width:100%;position:relative;margin-bottom:10px}.item .preview .content.full[data-v-7a31b866]{height:220px;display:flex;align-items:center}.item .preview .content.full .image[data-v-7a31b866]{min-height:200px}.item .preview .content .progress[data-v-7a31b866]{position:absolute;top:49%;left:50%;transform:translate(-50%,-50%);font-size:20px;font-weight:700;color:#fff;text-shadow:0 0 5px black}.item .preview .el-alert[data-v-7a31b866]{border-left-width:2px;border-left-style:solid}.item .preview .el-alert.failure[data-v-7a31b866]{border-color:var(--el-color-danger)}.item .preview .el-alert.success[data-v-7a31b866]{border-color:var(--el-color-success)}.item .preview .el-alert.info[data-v-7a31b866]{border-color:var(--el-color-info)}.item .preview .operations[data-v-7a31b866]{display:flex;justify-content:left;flex-direction:row;width:100%;align-items:baseline;flex-wrap:wrap;margin-bottom:15px;overflow:hidden;text-align:center;color:var(--el-text-color-regular);font-size:14px;overflow-y:scroll;gap:10px}.item .preview .operations.full[data-v-7a31b866]{height:70px}.item .preview .operations .btn-action[data-v-7a31b866]{margin-left:0}
@@ -1 +1 @@
1
- import{F as A}from"./index.es-JfM5t2Sf.js";import{E as G}from"./index-BehSG88T.js";import{E as P}from"./index-DnYBmGDX.js";import{d as $,h as v,b as l,t as c,k as t,r as E,j as p,l as i,o,c4 as D,x as n,D as _,F as w,v as I,i as V,n as T,c as L,y as g,eB as j,dn as B,db as O,di as z,dj as C}from"./index-PzuQTcb2.js";import{I as M}from"./InfoIcon-_PcwxxEr.js";import{E as q}from"./index-DOSbWYIy.js";import{E as y}from"./index-Yl4965oF.js";import{a as F,E as N}from"./index-BWKYfhQJ.js";import{E as U}from"./index-BXVcZgxw.js";import{E as H,a as J}from"./index-C-IFZVH5.js";import{A as K}from"./Status-DkLyOGsk.js";import{C as Q}from"./CopyToClipboard-DyMPPewz.js";import{E as W}from"./index-CPSVYQzh.js";import{a as X,E as Y}from"./index-DSHqbIyQ.js";import"./use-form-item-DK5EyE2z.js";import"./index-r5W6hzzQ.js";import"./index-DmnSh2xh.js";import"./index-D4I3evL9.js";import"./typescript-DjoIxu2M.js";import"./index-wcGfTy7F.js";import"./_baseClone-_p75hPey.js";import"./_Uint8Array-BVA9I_fE.js";import"./_initCloneObject-CEFMBT5z.js";import"./isEqual-fTEz49hG.js";import"./debounce-BQhVlwAs.js";import"./index-uHnIvF0e.js";import"./strings-UgWiDXyr.js";import"./isPlainObject-Brlhjumy.js";const Z=$({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),x={class:"main"},ee={class:"config"},te={class:"result"};function se(e,s,m,h,b,k){const d=i("font-awesome-icon"),u=i("el-button"),a=i("el-drawer");return o(),l("div",x,[c("div",ee,[E(e.$slots,"config",{},void 0,!0)]),c("div",te,[E(e.$slots,"result",{},void 0,!0)]),t(u,{round:"",class:"menu",onClick:s[0]||(s[0]=r=>e.drawer=!0)},{default:p(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=r=>e.drawer=r),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const oe=v(Z,[["render",se],["__scopeId","data-v-38abce67"]]),ae=$({name:"ImageUrlsInput",components:{ElUpload:q,ElButton:G,InfoIcon:M},data(){return{fileList:[],uploadUrl:D()+"/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.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){y.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){y.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),ne={class:"field"},ie={class:"title font-bold"},le={class:"upload-wrapper"};function re(e,s,m,h,b,k){const d=i("el-button"),u=i("el-upload"),a=i("info-icon");return o(),l("div",ne,[c("h2",ie,n(e.$t("headshots.name.endImageUrls")),1),c("div",le,[t(u,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=r=>e.fileList=r),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:p(()=>[t(d,{size:"small",type:"primary",round:""},{default:p(()=>[_(n(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(a,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ce=v(ae,[["render",re],["__scopeId","data-v-a6bd8c31"]]),de="fast",pe=$({name:"ModeSelector",components:{ElRadioButton:N,ElRadioGroup:F},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=de)}}),me={class:"field"},he={class:"title font-bold"};function ue(e,s,m,h,b,k){const d=i("el-radio-button"),u=i("el-radio-group");return o(),l("div",me,[c("h2",he,n(e.$t("headshots.name.mode")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),size:"small",class:"mode"},{default:p(()=>[(o(!0),l(w,null,I(e.options,a=>(o(),V(d,{key:a.value,label:a.value},{default:p(()=>[_(n(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const _e=v(pe,[["render",ue],["__scopeId","data-v-a2a0d5fa"]]),fe=$({name:"StylizeSelector",components:{ElTabs:J,ElTabPane:H,ElImage:U},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),ge={class:"field"},$e=["onClick"],ve={class:"name"};function be(e,s,m,h,b,k){const d=i("el-image"),u=i("el-tab-pane"),a=i("el-tabs");return o(),l("div",ge,[t(a,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=r=>e.tab=r)},{default:p(()=>[(o(!0),l(w,null,I(e.elements,(r,f)=>(o(),V(u,{key:f,label:r.displayName,name:f,class:"pane"},{default:p(()=>[(o(!0),l(w,null,I(r.items,(S,R)=>(o(),l("div",{key:R,class:T({item:!0,active:e.value===S.value}),onClick:ut=>e.onToggle(S.value)},[t(d,{src:S.image,fit:"fill",class:"preview"},null,8,["src"]),c("span",ve,n(S.label),1)],10,$e))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const ke=v(fe,[["render",be],["__scopeId","data-v-be4bd25d"]]),ye=$({name:"PresetPanel",components:{ModeSelector:_e,ImageUrlsInput:ce,ElButton:G,FontAwesomeIcon:A,ElementsSelector:ke},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},Ie={class:"config"},Te={class:"actions"};function Se(e,s,m,h,b,k){const d=i("elements-selector"),u=i("mode-selector"),a=i("image-urls-input"),r=i("font-awesome-icon"),f=i("el-button");return o(),l("div",we,[c("div",Ie,[t(d,{class:"mb-4"}),t(u,{class:"mb-4"}),t(a,{class:"mb-4"}),c("div",Te,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(r,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ve=v(ye,[["render",Se],["__scopeId","data-v-78172a54"]]),Ee=$({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:L(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:h=>{window.open(h,"_blank")}}}}),Ce={class:"image-gallery"},Ae=["src"],Ge=["onClick"];function Ue(e,s,m,h,b,k){return o(),l("div",Ce,[(o(!0),l(w,null,I(e.images,(d,u)=>(o(),l("div",{key:u,class:"image-container"},[c("img",{src:d.image_url,alt:"Image"},null,8,Ae),d.image_url?(o(),l("button",{key:0,class:"view-button",onClick:a=>e.viewImage(d.image_url)},n(e.$t("headshots.button.viewImage")),9,Ge)):g("",!0)]))),128))])}const Re=v(Ee,[["render",Ue],["__scopeId","data-v-03641510"]]),Pe=$({name:"TaskPreview",components:{ElImage:U,CopyToClipboard:Q,FontAwesomeIcon:A,ElAlert:W,ImageGallery:Re},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,m=new URL(s.src),h=m.searchParams.get("retry");if(!h)m.searchParams.set("retry","1");else if(parseInt(h)<2)m.searchParams.set("retry",(parseInt(h)+1).toString());else return;s.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),De={class:"preview"},Le={class:"left"},je={class:"main"},Be={class:"bot"},Oe={class:"datetime"},ze={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Fe={key:1},Ne={key:0,class:T({content:!0,failed:!0})},He={class:"image-wrapper"},Je={class:"description"},Ke={key:1,class:T({content:!0})},Qe={class:"description"},We={class:"description"},Xe={class:"description"},Ye={key:2,class:T({content:!0})},Ze={class:"description"},xe={key:3,class:T({content:!0})},et={class:"description"};function tt(e,s,m,h,b,k){const d=i("el-image"),u=i("image-gallery"),a=i("font-awesome-icon"),r=i("copy-to-clipboard"),f=i("el-alert");return o(),l("div",De,[c("div",Le,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),c("div",je,[c("div",Be,[_(n(e.$t("headshots.name.headshotsBot"))+" ",1),c("span",Oe,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",ze,[e.modelValue?.request?.template?(o(),l("p",Me,[_(n(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?g("",!0):(o(),l("span",qe," - ("+n(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Fe," - ("+n(e.$t("headshots.status.processing"))+") ",1)):g("",!0)])):g("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Ne,[c("div",He,[t(u,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:p(()=>[c("p",Je,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?.success===!1?(o(),l("div",Ke,[t(f,{closable:!1,class:"failure"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Qe,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",We,[t(a,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(r,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),c("p",Xe,[t(a,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("headshots.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(r,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?g("",!0):(o(),l("div",Ye,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ze,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",xe,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",et,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0)])])}const st=v(Pe,[["render",tt],["__scopeId","data-v-77229910"]]),ot=$({name:"RecentPanel",components:{TaskPreview:st,ElSkeleton:Y,ElSkeletonItem:X},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),at={key:0,class:"tasks"},nt={class:"left"},it={class:"main"},lt={key:1,class:"tasks"},rt={key:2,class:"description"};function ct(e,s,m,h,b,k){const d=i("el-skeleton-item"),u=i("el-skeleton"),a=i("task-preview");return o(),l("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...r)=>e.onHandleScroll&&e.onHandleScroll(...r))},[e.tasks?.items===void 0?(o(),l("div",at,[(o(),l(w,null,I(3,r=>c("div",{key:r,class:"task placeholder"},[c("div",nt,[t(u,{animated:""},{template:p(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),c("div",it,[t(u,{animated:""},{template:p(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",lt,[(o(!0),l(w,null,I(e.tasks?.items,(r,f)=>(o(),V(a,{key:f,"model-value":r,class:"preview"},null,8,["model-value"]))),128))])):g("",!0),e.tasks?.items?.length===0?(o(),l("p",rt,n(e.$t("headshots.message.noTasks")),1)):g("",!0)],544)}const dt=v(ot,[["render",ct],["__scopeId","data-v-d79bcb1f"]]),pt="https://webhook.acedata.cloud/headshots",mt=$({name:"HeadshotsIndex",components:{ConfigPanel:Ve,Layout:oe,ApplicationStatus:K,RecentPanel:dt},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.headshots?.status?.getApplications===C.Request},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===C.Request},needApply(){return this.$store.state.headshots.status.getApplications===C.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){O.create({application:this.application}).then(({data:e})=>{this.application=e,y.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===z&&y.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:h}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",h),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:m,createdAtMax:h})},async onGeneratePicture(){const e={...this.config,callback_url:pt},s=this.credential?.token;if(!s){console.error("no token specified");return}y.info(this.$t("headshots.message.startingTask")),j.generate(e,{token:s}).then(()=>{y.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===B?y.error(this.$t("headshots.message.usedUp")):y.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ht(e,s,m,h,b,k){const d=i("config-panel"),u=i("application-status"),a=i("recent-panel"),r=i("layout");return o(),V(r,null,{config:p(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:p(()=>[t(u,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ft=v(mt,[["render",ht],["__scopeId","data-v-7db61db3"]]);export{Ft as default};
1
+ import{F as A}from"./index.es-BaEF-yCd.js";import{E as G}from"./index-BC3SQhnJ.js";import{E as P}from"./index-Cq49YzTu.js";import{d as $,h as v,b as l,t as c,k as t,r as E,j as p,l as i,o,c4 as j,x as n,D as _,F as w,v as I,i as V,n as T,c as D,y as g,eB as L,dn as z,db as B,di as O,dj as C}from"./index-CiKCfyf3.js";import{I as M}from"./InfoIcon-0d7gDLJ0.js";import{E as q}from"./index-Dq8CiIfs.js";import{E as k}from"./index-BJ9zZLVQ.js";import{a as F,E as N}from"./index-CNvtlz9J.js";import{E as U}from"./index-C2BNqZFy.js";import{E as H,a as J}from"./index-qEoC6TPp.js";import{A as K}from"./Status-QJUFiSuy.js";import{C as Q}from"./CopyToClipboard-C40SuTlf.js";import{E as W}from"./index-Ddc5MDdZ.js";import{a as X,E as Y}from"./index-CL10eK8V.js";import"./use-form-item-Bi9Opk2t.js";import"./index-r5W6hzzQ.js";import"./index-B2s5F2Tx.js";import"./index-53Nnxk4N.js";import"./typescript-DurtlR9E.js";import"./index-DvzAv5C6.js";import"./_baseClone-up_YH3aT.js";import"./_Uint8Array-DvZicHme.js";import"./_initCloneObject-CbKHQFZX.js";import"./isEqual-DHEz5PGP.js";import"./debounce-BU0MXMaL.js";import"./index-CxyHkpEQ.js";import"./strings-CzUgnw_H.js";import"./isPlainObject-ClWS5-H4.js";const Z=$({name:"LayoutHeadshots",components:{ElDrawer:P,ElButton:G,FontAwesomeIcon:A},data(){return{drawer:!1}}}),x={class:"main"},ee={class:"config"},te={class:"result"};function se(e,s,m,u,b,y){const d=i("font-awesome-icon"),h=i("el-button"),a=i("el-drawer");return o(),l("div",x,[c("div",ee,[E(e.$slots,"config",{},void 0,!0)]),c("div",te,[E(e.$slots,"result",{},void 0,!0)]),t(h,{round:"",class:"menu",onClick:s[0]||(s[0]=r=>e.drawer=!0)},{default:p(()=>[t(d,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(a,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=r=>e.drawer=r),"with-header":!1,size:"340px",class:"drawer"},{default:p(()=>[E(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const oe=v(Z,[["render",se],["__scopeId","data-v-38abce67"]]),ae=$({name:"ImageUrlsInput",components:{ElUpload:q,ElButton:G,InfoIcon:M},data(){return{fileList:[],uploadUrl:j()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||(this.value=void 0),this.onSetImageUrls()},methods:{onExceed(){k.warning(this.$t("headshots.message.uploadImageExceed"))},onError(){k.error(this.$t("headshots.message.uploadImageError"))},onSetImageUrls(){const e=this.urls;this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),ne={class:"field"},ie={class:"title font-bold"},le={class:"upload-wrapper"};function re(e,s,m,u,b,y){const d=i("el-button"),h=i("el-upload"),a=i("info-icon");return o(),l("div",ne,[c("h2",ie,n(e.$t("headshots.name.endImageUrls")),1),c("div",le,[t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=r=>e.fileList=r),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:2,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:p(()=>[t(d,{size:"small",type:"primary",round:""},{default:p(()=>[_(n(e.$t("headshots.button.uploadImageUrls")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])]),t(a,{content:e.$t("headshots.description.endImageUrls"),class:"info"},null,8,["content"])])}const ce=v(ae,[["render",re],["__scopeId","data-v-a6bd8c31"]]),de="fast",pe=$({name:"ModeSelector",components:{ElRadioButton:N,ElRadioGroup:F},data(){return{options:[{label:this.$t("headshots.button.fast"),value:"fast"},{label:this.$t("headshots.button.relax"),value:"relax"}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug("set mode",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||(this.value=de)}}),me={class:"field"},ue={class:"title font-bold"};function he(e,s,m,u,b,y){const d=i("el-radio-button"),h=i("el-radio-group");return o(),l("div",me,[c("h2",ue,n(e.$t("headshots.name.mode")),1),t(h,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=a=>e.value=a),size:"small",class:"mode"},{default:p(()=>[(o(!0),l(w,null,I(e.options,a=>(o(),V(d,{key:a.value,label:a.value},{default:p(()=>[_(n(a.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const _e=v(pe,[["render",he],["__scopeId","data-v-a2a0d5fa"]]),fe=$({name:"StylizeSelector",components:{ElTabs:J,ElTabPane:H,ElImage:U},data(){return{tab:"styles",value:"",elements:{styles:{displayName:this.$t("headshots.styleCategory.styles"),items:[{image:"https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png",label:this.$t("headshots.styleTag.malePportrait"),value:"male_portrait"},{image:"https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png",label:this.$t("headshots.styleTag.malePportrait2"),value:"male_portrait2"},{image:"https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png",label:this.$t("headshots.styleTag.kindergarten"),value:"kindergarten"},{image:"https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp",label:this.$t("headshots.styleTag.logoTshirt"),value:"logo_tshirt"},{image:"https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg",label:this.$t("headshots.styleTag.wedding"),value:"wedding"},{image:"https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp",label:this.$t("headshots.styleTag.businessPphoto"),value:"business_photo"},{image:"https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg",label:this.$t("headshots.styleTag.bobSuit"),value:"bob_suit"},{image:"https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp",label:this.$t("headshots.styleTag.femalePortrait"),value:"female_portrait"}]}}}},watch:{value(e){console.debug("set template",e),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||(this.value=""),console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value="":this.value=e,console.debug("set template",this.value),this.$store.commit("headshots/setConfig",{...this.$store.state.headshots?.config,template:this.value})}}}),ge={class:"field"},$e=["onClick"],ve={class:"name"};function be(e,s,m,u,b,y){const d=i("el-image"),h=i("el-tab-pane"),a=i("el-tabs");return o(),l("div",ge,[t(a,{modelValue:e.tab,"onUpdate:modelValue":s[0]||(s[0]=r=>e.tab=r)},{default:p(()=>[(o(!0),l(w,null,I(e.elements,(r,f)=>(o(),V(h,{key:f,label:r.displayName,name:f,class:"pane"},{default:p(()=>[(o(!0),l(w,null,I(r.items,(S,R)=>(o(),l("div",{key:R,class:T({item:!0,active:e.value===S.value}),onClick:ht=>e.onToggle(S.value)},[t(d,{src:S.image,fit:"fill",class:"preview"},null,8,["src"]),c("span",ve,n(S.label),1)],10,$e))),128))]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])}const ye=v(fe,[["render",be],["__scopeId","data-v-be4bd25d"]]),ke=$({name:"PresetPanel",components:{ModeSelector:_e,ImageUrlsInput:ce,ElButton:G,FontAwesomeIcon:A,ElementsSelector:ye},emits:["generate"],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit("generate")}}}),we={class:"panel"},Ie={class:"config"},Te={class:"actions"};function Se(e,s,m,u,b,y){const d=i("elements-selector"),h=i("mode-selector"),a=i("image-urls-input"),r=i("font-awesome-icon"),f=i("el-button");return o(),l("div",we,[c("div",Ie,[t(d,{class:"mb-4"}),t(h,{class:"mb-4"}),t(a,{class:"mb-4"}),c("div",Te,[t(f,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:p(()=>[t(r,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("headshots.button.generate")),1)]),_:1},8,["onClick"])])])])}const Ve=v(ke,[["render",Se],["__scopeId","data-v-78172a54"]]),Ee=$({name:"ImageGallery",props:{modelValue:{type:Object,required:!0}},setup(e){return{images:D(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:u=>{window.open(u,"_blank")}}}}),Ce={class:"image-gallery"},Ae=["src"],Ge=["onClick"];function Ue(e,s,m,u,b,y){return o(),l("div",Ce,[(o(!0),l(w,null,I(e.images,(d,h)=>(o(),l("div",{key:h,class:"image-container"},[c("img",{src:d.image_url,alt:"Image"},null,8,Ae),d.image_url?(o(),l("button",{key:0,class:"view-button",onClick:a=>e.viewImage(d.image_url)},n(e.$t("headshots.button.viewImage")),9,Ge)):g("",!0)]))),128))])}const Re=v(Ee,[["render",Ue],["__scopeId","data-v-03641510"]]),Pe=$({name:"TaskPreview",components:{ElImage:U,CopyToClipboard:Q,FontAwesomeIcon:A,ElAlert:W,ImageGallery:Re},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onReload(e){const s=e.target,m=new URL(s.src),u=m.searchParams.get("retry");if(!u)m.searchParams.set("retry","1");else if(parseInt(u)<2)m.searchParams.set("retry",(parseInt(u)+1).toString());else return;s.src=m.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),je={class:"preview"},De={class:"left"},Le={class:"main"},ze={class:"bot"},Be={class:"datetime"},Oe={class:"info"},Me={key:0,class:"prompt mt-2"},qe={key:0},Fe={key:1},Ne={key:0,class:T({content:!0,failed:!0})},He={class:"image-wrapper"},Je={class:"description"},Ke={key:1,class:T({content:!0})},Qe={class:"description"},We={class:"description"},Xe={class:"description"},Ye={key:2,class:T({content:!0})},Ze={class:"description"},xe={key:3,class:T({content:!0})},et={class:"description"};function tt(e,s,m,u,b,y){const d=i("el-image"),h=i("image-gallery"),a=i("font-awesome-icon"),r=i("copy-to-clipboard"),f=i("el-alert");return o(),l("div",je,[c("div",De,[t(d,{src:"https://cdn.acedata.cloud/isxyfw.png",class:"avatar"})]),c("div",Le,[c("div",ze,[_(n(e.$t("headshots.name.headshotsBot"))+" ",1),c("span",Be,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",Oe,[e.modelValue?.request?.template?(o(),l("p",Me,[_(n(e.modelValue?.request?.template)+" ",1),e.modelValue?.response?g("",!0):(o(),l("span",qe," - ("+n(e.$t("headshots.status.pending"))+") ",1)),e.modelValue?.response?.status==="unknown"?(o(),l("span",Fe," - ("+n(e.$t("headshots.status.processing"))+") ",1)):g("",!0)])):g("",!0)]),e.modelValue?.response?.success===!0?(o(),l("div",Ne,[c("div",He,[t(h,{"model-value":e.modelValue},null,8,["model-value"])]),t(f,{closable:!1,class:"mt-2 success"},{default:p(()=>[c("p",Je,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?.success===!1?(o(),l("div",Ke,[t(f,{closable:!1,class:"failure"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Qe,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",We,[t(a,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(r,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),c("p",Xe,[t(a,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("headshots.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(r,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0),e.modelValue?.response?g("",!0):(o(),l("div",Ye,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",Ze,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])),e.modelValue?.response?.status==="unknown"?(o(),l("div",xe,[t(f,{closable:!1,class:"info"},{template:p(()=>[t(a,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("headshots.name.failure")),1)]),default:p(()=>[c("p",et,[t(a,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("headshots.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(r,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):g("",!0)])])}const st=v(Pe,[["render",tt],["__scopeId","data-v-77229910"]]),ot=$({name:"RecentPanel",components:{TaskPreview:st,ElSkeleton:Y,ElSkeletonItem:X},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),at={key:0,class:"tasks"},nt={class:"left"},it={class:"main"},lt={key:1,class:"tasks"},rt={key:2,class:"description"};function ct(e,s,m,u,b,y){const d=i("el-skeleton-item"),h=i("el-skeleton"),a=i("task-preview");return o(),l("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...r)=>e.onHandleScroll&&e.onHandleScroll(...r))},[e.tasks?.items===void 0?(o(),l("div",at,[(o(),l(w,null,I(3,r=>c("div",{key:r,class:"task placeholder"},[c("div",nt,[t(h,{animated:""},{template:p(()=>[t(d,{variant:"image",class:"avatar"})]),_:1})]),c("div",it,[t(h,{animated:""},{template:p(()=>[t(d,{variant:"p",class:"title"}),t(d,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(o(),l("div",lt,[(o(!0),l(w,null,I(e.tasks?.items,(r,f)=>(o(),V(a,{key:f,"model-value":r,class:"preview"},null,8,["model-value"]))),128))])):g("",!0),e.tasks?.items?.length===0?(o(),l("p",rt,n(e.$t("headshots.message.noTasks")),1)):g("",!0)],544)}const dt=v(ot,[["render",ct],["__scopeId","data-v-d79bcb1f"]]),pt="https://webhook.acedata.cloud/headshots",mt=$({name:"HeadshotsIndex",components:{ConfigPanel:Ve,Layout:oe,ApplicationStatus:K,RecentPanel:dt},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.headshots?.status?.getApplications===C.Request},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===C.Request},needApply(){return this.$store.state.headshots.status.getApplications===C.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("headshots/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("headshots/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){B.create({application:this.application}).then(({data:e})=>{this.application=e,k.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===O&&k.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:u}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",u),await this.$store.dispatch("headshots/getTasks",{limit:s,createdAtMin:m,createdAtMax:u})},async onGeneratePicture(){const e={...this.config,callback_url:pt},s=this.credential?.token;if(!s){console.error("no token specified");return}k.info(this.$t("headshots.message.startingTask")),L.generate(e,{token:s}).then(()=>{k.success(this.$t("headshots.message.startTaskSuccess")),this.$store.commit("headshots/setConfig",{config:void 0})}).catch(m=>{m?.response?.data?.error?.code===z?k.error(this.$t("headshots.message.usedUp")):k.error(this.$t("headshots.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function ut(e,s,m,u,b,y){const d=i("config-panel"),h=i("application-status"),a=i("recent-panel"),r=i("layout");return o(),V(r,null,{config:p(()=>[t(d,{onGenerate:e.onGeneratePicture},null,8,["onGenerate"])]),result:p(()=>[t(h,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:"mb-4",onRefresh:e.onGetApplication,onSelect:s[0]||(s[0]=f=>e.$store.dispatch("headshots/setApplication",f))},null,8,["initializing","application","applications","service","need-apply","onRefresh"]),t(a,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const Ft=v(mt,[["render",ut],["__scopeId","data-v-19d3c623"]]);export{Ft as default};
@@ -1 +1 @@
1
- import{C}from"./CopyToClipboard-DyMPPewz.js";import{d as I,d8 as F,dY as T,dZ as N,d_ as P,h as B,i as r,j as o,k as i,l,t as e,x as s,b as p,D as m,y as k,o as n}from"./index-PzuQTcb2.js";import{d as O,a as w,s as M}from"./distribution-BDziq4nz.js";import{g as q}from"./price-CckLdzJV.js";import{F as R}from"./index.es-JfM5t2Sf.js";import{E as z}from"./index-DSHqbIyQ.js";import{E as U,a as V}from"./index-CrJlOJBH.js";import{E as A}from"./index-DmnSh2xh.js";import{E as H,a as G,b as Q}from"./index-DLmsZMpM.js";import{E as Y}from"./index-DPUHufUs.js";import{E as j}from"./index-BehSG88T.js";import{E as W}from"./index-wcGfTy7F.js";import"./index-DagREoh2.js";import"./typescript-DjoIxu2M.js";import"./index-D4I3evL9.js";import"./_Uint8Array-BVA9I_fE.js";import"./_initCloneObject-CEFMBT5z.js";import"./isPlainObject-Brlhjumy.js";import"./_baseIteratee-BnprkGcU.js";import"./isEqual-fTEz49hG.js";import"./castArray-4BvTHi4D.js";import"./debounce-BQhVlwAs.js";import"./index-bAaD18S5.js";import"./use-form-item-DK5EyE2z.js";import"./index-CdPm0FKF.js";import"./index-r5W6hzzQ.js";const Z=I({name:"ConsoleDistributionList",components:{CopyToClipboard:C,FontAwesomeIcon:R,QrCode:F,ElProgress:W,ElRow:Q,ElCol:G,ElButton:j,ElDivider:Y,ElCard:H,ElTooltip:A,ElTable:V,ElTableColumn:U,ElSkeleton:z},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||"1")},distributionLevelMap(){let t={};return this.distributionLevels.forEach(a=>{t[a.level]=a}),t}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:q,goHistory(){this.$router.push({name:P})},goInvitees(){this.$router.push({name:N})},onPageChange(t){this.$router.push({name:this.$route.name?.toString(),query:{page:t}})},getPercentageForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,a=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-t)/(a-t)*100)},getDeltaForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(t-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await w.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){const a=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{const v=(await M.create(a))?.data?.data?.url;this.distributionLink=(v||a).replace("surl.id","share.acedata.cloud")}catch{this.distributionLink=a}},async onFetchDistributionStatus(){const{data:t}=await w.getAll({user_id:this.$store.getters.user.id});t.items&&t.items.length>0&&(this.distributionStatus=t.items[0])},async onFetchDistributionLevels(){const{data:t}=await O.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=t.items},async onFetchInvitees(){const{data:t}=await T.getInvitees({});this.invitees=t.items,this.inviteesCount=t.count}}}),J={class:"title"},K={key:1},X={class:"icon-wrapper"},x={class:"text-left"},tt={class:"description"},et={class:"value"},it={key:1},st={class:"icon-wrapper"},ot={class:"text-left"},nt={class:"description"},lt={class:"value"},at={key:1},rt={class:"icon-wrapper"},dt={class:"text-left"},ct={class:"description"},ut={class:"value"},pt={key:1},ht={class:"icon-wrapper"},mt={class:"text-left"},_t={class:"description"},bt={class:"value"},vt={key:1},ft={class:"title"},gt={class:"clear-both overflow-hidden"},kt={class:"float-left description"},yt={class:"float-right description"},$t={class:"description"},wt={class:"level"},Lt={class:"level"},St={class:"level"},Et={key:1},Dt={class:"title"},Ct={class:"link-wrapper text-center"},It=["href"],Ft={class:"qr-wrapper ml-auto mr-auto"},Tt={class:"mt-0"},Nt={class:"description"},Pt={class:"more"};function Bt(t,a,v,Ot,Mt,qt){const d=l("el-col"),_=l("el-row"),c=l("el-skeleton"),b=l("font-awesome-icon"),f=l("el-button"),u=l("el-card"),y=l("el-tooltip"),L=l("el-progress"),$=l("el-divider"),g=l("el-table-column"),S=l("el-table"),E=l("copy-to-clipboard"),D=l("qr-code");return n(),r(_,{class:"panel"},{default:o(()=>[i(d,{span:24},{default:o(()=>[i(_,null,{default:o(()=>[i(d,{span:24},{default:o(()=>[e("h2",J,s(t.$t("common.title.distribution")),1)]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",K,[e("div",X,[i(b,{icon:"fa-solid fa-wallet",class:"icon"})]),e("div",x,[e("p",tt,s(t.$t("distribution.title.price")),1),e("p",et,s(t.getPriceString({value:t.distributionStatus?.price})),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goHistory},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",it,[e("div",st,[i(b,{icon:"fa-solid fa-coins",class:"icon"})]),e("div",ot,[e("p",nt,s(t.$t("distribution.title.reward")),1),e("p",lt,s(t.getPriceString({value:t.distributionStatus?.reward})),1)]),i(y,{effect:"dark",content:t.$t("distribution.message.developingWithDrawal"),placement:"top"},{default:o(()=>[i(f,{type:"primary",round:"",size:"small",class:"btn"},{default:o(()=>[m(s(t.$t("distribution.button.withdrawal")),1)]),_:1})]),_:1},8,["content"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",at,[e("div",rt,[i(b,{icon:"fa-solid fa-percent",class:"icon"})]),e("div",dt,[e("p",ct,s(t.$t("distribution.title.percentage")),1),e("p",ut,s(t.distributionStatus?.level?.percentage)+"%",1)])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",pt,[e("div",ht,[i(b,{icon:"fa-regular fa-user",class:"icon"})]),e("div",mt,[e("p",_t,s(t.$t("distribution.title.inviteesCount")),1),e("p",bt,s(t.inviteesCount),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goInvitees},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"level-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",vt,[e("h4",ft,s(t.$t("distribution.title.levelInfo")),1),e("div",gt,[e("div",kt,[e("p",null,s(t.$t("distribution.title.currentLevel"))+": L"+s(t.distributionStatus?.level?.level),1),e("p",null,s(t.$t("distribution.title.currentPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level]?.percentage)+"% ",1)]),e("div",yt,[e("p",null,s(t.$t("distribution.title.nextLevel"))+": L"+s(t.distributionStatus?.level?.level+1),1),e("p",null,s(t.$t("distribution.title.nextPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level+1]?.percentage)+"% ",1)])]),i(L,{"text-inside":!0,"stroke-width":20,percentage:t.getPercentageForNextLevel(),class:"mb-2"},null,8,["percentage"]),e("p",$t,s(t.$t("distribution.message.deltaPriceForNextLevel"))+": $"+s(t.getDeltaForNextLevel()),1),i($),t.distributionLevels?(n(),r(S,{key:0,data:t.distributionLevels,stripe:""},{default:o(()=>[i(g,{label:t.$t("distribution.field.level")},{default:o(h=>[e("span",wt,"L"+s(h.row?.level),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.threshold")},{default:o(h=>[e("span",Lt,"$"+s(h.row?.threshold),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.percentage")},{default:o(h=>[e("span",St,s(h.row?.percentage)+"%",1)]),_:1},8,["label"])]),_:1},8,["data"])):k("",!0)]))]),_:1})]),_:1}),i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"distribution-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",Et,[e("h4",Dt,s(t.$t("distribution.title.distributionLink")),1),i($),e("div",Ct,[k("",!0),e("a",{href:t.distributionLink,class:"link"},s(t.distributionLink),9,It),i(E,{content:t.distributionLink},null,8,["content"])]),e("div",Ft,[t.distributionLink?(n(),r(D,{key:0,value:t.distributionLink,size:180,margin:2,class:"block mb-2 ml-auto mr-auto",type:"image/png",color:{dark:"#000000",light:"#ffffff"}},null,8,["value"])):k("",!0),e("p",Tt,s(t.$t("distribution.message.distributionQrDescription")),1)]),e("p",Nt,[m(s(t.$t("distribution.message.distributionLinkDescription"))+" ",1),e("span",Pt,[i(y,{effect:"dark",content:t.$t("distribution.message.distributionLinkDescription2"),placement:"top"},{default:o(()=>[m(s(t.$t("distribution.message.technicalDetail")),1)]),_:1},8,["content"])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const ce=B(Z,[["render",Bt],["__scopeId","data-v-a8befdf2"]]);export{ce as default};
1
+ import{C}from"./CopyToClipboard-C40SuTlf.js";import{d as I,d8 as F,dY as T,dZ as N,d_ as P,h as B,i as r,j as o,k as i,l,t as e,x as s,b as p,D as m,y as k,o as n}from"./index-CiKCfyf3.js";import{d as O,a as w,s as M}from"./distribution-CJd80roB.js";import{g as q}from"./price-Bj_oJ8c5.js";import{F as R}from"./index.es-BaEF-yCd.js";import{E as z}from"./index-CL10eK8V.js";import{E as U,a as V}from"./index-DCCuTE-3.js";import{E as A}from"./index-B2s5F2Tx.js";import{E as H,a as G,b as Q}from"./index-CZMtA_vS.js";import{E as Y}from"./index-XDZ1lCPN.js";import{E as j}from"./index-BC3SQhnJ.js";import{E as W}from"./index-DvzAv5C6.js";import"./index-Dr5emkEa.js";import"./typescript-DurtlR9E.js";import"./index-53Nnxk4N.js";import"./_Uint8Array-DvZicHme.js";import"./_initCloneObject-CbKHQFZX.js";import"./isPlainObject-ClWS5-H4.js";import"./_baseIteratee-Bjn9Xjg-.js";import"./isEqual-DHEz5PGP.js";import"./castArray-CI1BQ6-I.js";import"./debounce-BU0MXMaL.js";import"./index-CM7w86w8.js";import"./use-form-item-Bi9Opk2t.js";import"./index-Dr-J0rUK.js";import"./index-r5W6hzzQ.js";const Z=I({name:"ConsoleDistributionList",components:{CopyToClipboard:C,FontAwesomeIcon:R,QrCode:F,ElProgress:W,ElRow:Q,ElCol:G,ElButton:j,ElDivider:Y,ElCard:H,ElTooltip:A,ElTable:V,ElTableColumn:U,ElSkeleton:z},data(){return{invitees:[],inviteesCount:void 0,distributionLevels:[],distributionLink:void 0,distributionStatus:void 0,loading:!1}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||"1")},distributionLevelMap(){let t={};return this.distributionLevels.forEach(a=>{t[a.level]=a}),t}},watch:{page:{handler(){this.onFetchData()}}},async mounted(){this.onFetchData(),this.onGenerateDistributionLink()},methods:{getPriceString:q,goHistory(){this.$router.push({name:P})},goInvitees(){this.$router.push({name:N})},onPageChange(t){this.$router.push({name:this.$route.name?.toString(),query:{page:t}})},getPercentageForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level]?.threshold,a=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor((this.distributionStatus?.price-t)/(a-t)*100)},getDeltaForNextLevel(){const t=this.distributionLevelMap[this.distributionStatus?.level?.level+1]?.threshold;return Math.floor(t-this.distributionStatus?.price)},async onFetchData(){this.loading=!0,await w.initialize(),Promise.all([this.onFetchDistributionStatus(),this.onFetchDistributionLevels(),this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onGenerateDistributionLink(){const a=`${window.location.origin}?inviter_id=${this.$store.getters.user.id}`;try{const v=(await M.create(a))?.data?.data?.url;this.distributionLink=(v||a).replace("surl.id","share.acedata.cloud")}catch{this.distributionLink=a}},async onFetchDistributionStatus(){const{data:t}=await w.getAll({user_id:this.$store.getters.user.id});t.items&&t.items.length>0&&(this.distributionStatus=t.items[0])},async onFetchDistributionLevels(){const{data:t}=await O.getAll({limit:20,user_id:this.$store.getters.user.id});this.distributionLevels=t.items},async onFetchInvitees(){const{data:t}=await T.getInvitees({});this.invitees=t.items,this.inviteesCount=t.count}}}),J={class:"title"},K={key:1},X={class:"icon-wrapper"},x={class:"text-left"},tt={class:"description"},et={class:"value"},it={key:1},st={class:"icon-wrapper"},ot={class:"text-left"},nt={class:"description"},lt={class:"value"},at={key:1},rt={class:"icon-wrapper"},dt={class:"text-left"},ct={class:"description"},ut={class:"value"},pt={key:1},ht={class:"icon-wrapper"},mt={class:"text-left"},_t={class:"description"},bt={class:"value"},vt={key:1},ft={class:"title"},gt={class:"clear-both overflow-hidden"},kt={class:"float-left description"},yt={class:"float-right description"},$t={class:"description"},wt={class:"level"},Lt={class:"level"},St={class:"level"},Et={key:1},Dt={class:"title"},Ct={class:"link-wrapper text-center"},It=["href"],Ft={class:"qr-wrapper ml-auto mr-auto"},Tt={class:"mt-0"},Nt={class:"description"},Pt={class:"more"};function Bt(t,a,v,Ot,Mt,qt){const d=l("el-col"),_=l("el-row"),c=l("el-skeleton"),b=l("font-awesome-icon"),f=l("el-button"),u=l("el-card"),y=l("el-tooltip"),L=l("el-progress"),$=l("el-divider"),g=l("el-table-column"),S=l("el-table"),E=l("copy-to-clipboard"),D=l("qr-code");return n(),r(_,{class:"panel"},{default:o(()=>[i(d,{span:24},{default:o(()=>[i(_,null,{default:o(()=>[i(d,{span:24},{default:o(()=>[e("h2",J,s(t.$t("common.title.distribution")),1)]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",K,[e("div",X,[i(b,{icon:"fa-solid fa-wallet",class:"icon"})]),e("div",x,[e("p",tt,s(t.$t("distribution.title.price")),1),e("p",et,s(t.getPriceString({value:t.distributionStatus?.price})),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goHistory},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",it,[e("div",st,[i(b,{icon:"fa-solid fa-coins",class:"icon"})]),e("div",ot,[e("p",nt,s(t.$t("distribution.title.reward")),1),e("p",lt,s(t.getPriceString({value:t.distributionStatus?.reward})),1)]),i(y,{effect:"dark",content:t.$t("distribution.message.developingWithDrawal"),placement:"top"},{default:o(()=>[i(f,{type:"primary",round:"",size:"small",class:"btn"},{default:o(()=>[m(s(t.$t("distribution.button.withdrawal")),1)]),_:1})]),_:1},8,["content"])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",at,[e("div",rt,[i(b,{icon:"fa-solid fa-percent",class:"icon"})]),e("div",dt,[e("p",ct,s(t.$t("distribution.title.percentage")),1),e("p",ut,s(t.distributionStatus?.level?.percentage)+"%",1)])]))]),_:1})]),_:1}),i(d,{md:6,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"item-mini mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",pt,[e("div",ht,[i(b,{icon:"fa-regular fa-user",class:"icon"})]),e("div",mt,[e("p",_t,s(t.$t("distribution.title.inviteesCount")),1),e("p",bt,s(t.inviteesCount),1)]),i(f,{type:"primary",round:"",size:"small",class:"btn",onClick:t.goInvitees},{default:o(()=>[m(s(t.$t("distribution.button.detail")),1)]),_:1},8,["onClick"])]))]),_:1})]),_:1})]),_:1}),i(_,{gutter:15},{default:o(()=>[i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"level-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",vt,[e("h4",ft,s(t.$t("distribution.title.levelInfo")),1),e("div",gt,[e("div",kt,[e("p",null,s(t.$t("distribution.title.currentLevel"))+": L"+s(t.distributionStatus?.level?.level),1),e("p",null,s(t.$t("distribution.title.currentPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level]?.percentage)+"% ",1)]),e("div",yt,[e("p",null,s(t.$t("distribution.title.nextLevel"))+": L"+s(t.distributionStatus?.level?.level+1),1),e("p",null,s(t.$t("distribution.title.nextPercentage"))+": "+s(t.distributionLevelMap[t.distributionStatus?.level?.level+1]?.percentage)+"% ",1)])]),i(L,{"text-inside":!0,"stroke-width":20,percentage:t.getPercentageForNextLevel(),class:"mb-2"},null,8,["percentage"]),e("p",$t,s(t.$t("distribution.message.deltaPriceForNextLevel"))+": $"+s(t.getDeltaForNextLevel()),1),i($),t.distributionLevels?(n(),r(S,{key:0,data:t.distributionLevels,stripe:""},{default:o(()=>[i(g,{label:t.$t("distribution.field.level")},{default:o(h=>[e("span",wt,"L"+s(h.row?.level),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.threshold")},{default:o(h=>[e("span",Lt,"$"+s(h.row?.threshold),1)]),_:1},8,["label"]),i(g,{label:t.$t("distribution.field.percentage")},{default:o(h=>[e("span",St,s(h.row?.percentage)+"%",1)]),_:1},8,["label"])]),_:1},8,["data"])):k("",!0)]))]),_:1})]),_:1}),i(d,{md:12,xs:24},{default:o(()=>[i(u,{shadow:"hover",class:"distribution-info mb-4"},{default:o(()=>[t.loading?(n(),r(c,{key:0})):(n(),p("div",Et,[e("h4",Dt,s(t.$t("distribution.title.distributionLink")),1),i($),e("div",Ct,[k("",!0),e("a",{href:t.distributionLink,class:"link"},s(t.distributionLink),9,It),i(E,{content:t.distributionLink},null,8,["content"])]),e("div",Ft,[t.distributionLink?(n(),r(D,{key:0,value:t.distributionLink,size:180,margin:2,class:"block mb-2 ml-auto mr-auto",type:"image/png",color:{dark:"#000000",light:"#ffffff"}},null,8,["value"])):k("",!0),e("p",Tt,s(t.$t("distribution.message.distributionQrDescription")),1)]),e("p",Nt,[m(s(t.$t("distribution.message.distributionLinkDescription"))+" ",1),e("span",Pt,[i(y,{effect:"dark",content:t.$t("distribution.message.distributionLinkDescription2"),placement:"top"},{default:o(()=>[m(s(t.$t("distribution.message.technicalDetail")),1)]),_:1},8,["content"])])])]))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}const ce=B(Z,[["render",Bt],["__scopeId","data-v-a8befdf2"]]);export{ce as default};
@@ -1 +1 @@
1
- import{F as R}from"./index.es-JfM5t2Sf.js";import{E as A}from"./index-BehSG88T.js";import{E as O}from"./index-DnYBmGDX.js";import{d as $,h as k,b as r,t as l,k as t,r as U,j as m,l as o,o as a,ei as j,x as i,F as V,v as S,i as I,ej as q,D as _,ek as B,c4 as F,y as h,n as C,el as N,dn as z,db as H,di as K,dj as P}from"./index-PzuQTcb2.js";import{I as D}from"./InfoIcon-_PcwxxEr.js";import{E as J}from"./index-DBssH7pX.js";import{E as G,a as L}from"./index-DjE06kE9.js";import{a as Q,E as W}from"./index-BWKYfhQJ.js";import{E as X}from"./index-DOSbWYIy.js";import{E as w}from"./index-Yl4965oF.js";import{E as Y}from"./index-DqR4HY--.js";import{C as Z}from"./CopyToClipboard-DyMPPewz.js";import{s as x}from"./vue-plyr-QZFBikSk.js";import{E as ee}from"./index-DmnSh2xh.js";import{E as te}from"./index-CPSVYQzh.js";import{E as se}from"./index-BXVcZgxw.js";import{a as oe,E as ae}from"./index-DSHqbIyQ.js";import"./use-form-item-DK5EyE2z.js";import"./index-r5W6hzzQ.js";import"./index-D4I3evL9.js";import"./index-DagREoh2.js";import"./typescript-DjoIxu2M.js";import"./strings-UgWiDXyr.js";import"./castArray-4BvTHi4D.js";import"./isEqual-fTEz49hG.js";import"./_Uint8Array-BVA9I_fE.js";import"./debounce-BQhVlwAs.js";import"./_baseIteratee-BnprkGcU.js";import"./index-CdPm0FKF.js";import"./index-wcGfTy7F.js";import"./_baseClone-_p75hPey.js";import"./_initCloneObject-CEFMBT5z.js";import"./index-uHnIvF0e.js";const ne=$({name:"LayoutPika",components:{ElDrawer:O,ElButton:A,FontAwesomeIcon:R},data(){return{drawer:!1}}}),ie={class:"main"},le={class:"config"},re={class:"result"};function ce(e,s,p,d,g,v){const c=o("font-awesome-icon"),u=o("el-button"),n=o("el-drawer");return a(),r("div",ie,[l("div",le,[U(e.$slots,"config",{},void 0,!0)]),l("div",re,[U(e.$slots,"result",{},void 0,!0)]),t(u,{round:"",class:"menu",onClick:s[0]||(s[0]=f=>e.drawer=!0)},{default:m(()=>[t(c,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=f=>e.drawer=f),"with-header":!1,size:"340px",class:"drawer"},{default:m(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const pe=k(ne,[["render",ce],["__scopeId","data-v-d0a34fc4"]]),de=$({name:"IngredientsSelector",components:{ElSwitch:J,InfoIcon:D},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug("set ingredients",e),e||this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,model:"2.0"})}}},mounted(){this.value===void 0&&(this.value=j)}}),ue={class:"field"},me={class:"title font-bold"};function fe(e,s,p,d,g,v){const c=o("el-switch"),u=o("info-icon");return a(),r("div",ue,[l("h2",me,i(e.$t("pika.name.ingredients")),1),t(c,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value"},null,8,["modelValue"]),t(u,{content:e.$t("pika.description.ingredients"),class:"info"},null,8,["content"])])}const _e=k(de,[["render",fe],["__scopeId","data-v-17c0af5c"]]),he=$({name:"EffectSelector",components:{ElSelect:L,ElOption:G},data(){return{}},computed:{options(){return[{value:"Levitate",label:this.$t("pika.style.effect1")},{value:"Decapitate",label:this.$t("pika.style.effect2")},{value:"Eye-pop",label:this.$t("pika.style.effect3")},{value:"Ta-da",label:this.$t("pika.style.effect4")},{value:"Deflate",label:this.$t("pika.style.effect5")},{value:"Crumble",label:this.$t("pika.style.effect6")},{value:"Dissolve",label:this.$t("pika.style.effect7")},{value:"Squish",label:this.$t("pika.style.effect8")},{value:"Inflate",label:this.$t("pika.style.effect9")},{value:"Melt",label:this.$t("pika.style.effect10")},{value:"Cake-ify",label:this.$t("pika.style.effect11")},{value:"Crush",label:this.$t("pika.style.effect12")},{value:"Explode",label:this.$t("pika.style.effect13")}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,effect:e})}}}}),$e={class:"field"},ke={class:"title font-bold"},ge={class:"float-left"};function ve(e,s,p,d,g,v){const c=o("el-option"),u=o("el-select");return a(),r("div",$e,[l("h2",ke,i(e.$t("pika.name.effect")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select"),clearable:""},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.label,value:n.value},{default:m(()=>[l("span",ge,i(n.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ve],["__scopeId","data-v-d1c54475"]]),ye=$({name:"IngredientsModelSelector",components:{ElRadioButton:W,ElRadioGroup:Q},data(){return{options:[{label:this.$t("pika.button.precise"),value:"precise"},{label:this.$t("pika.button.creative"),value:"creative"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||(this.value=q)}}),we={class:"field"},Ie={class:"title font-bold"};function Ee(e,s,p,d,g,v){const c=o("el-radio-button"),u=o("el-radio-group");return a(),r("div",we,[l("h2",Ie,i(e.$t("pika.name.ingredientsModel")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),size:"small",class:"quality"},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.value},{default:m(()=>[_(i(n.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const Ve=k(ye,[["render",Ee],["__scopeId","data-v-b948551f"]]),Se=$({name:"ModelSelector",components:{ElSelect:L,ElOption:G},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"2.0",label:"2.0"},{value:"1.5",label:"1.5"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||(this.value=B)}}),Te={class:"field"},Ae={class:"title font-bold"};function Ce(e,s,p,d,g,v){const c=o("el-option"),u=o("el-select");return a(),r("div",Te,[l("h2",Ae,i(e.$t("pika.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Ce],["__scopeId","data-v-7b2e870a"]]),Pe=$({name:"ImageUrlInput",components:{ElUpload:X,ElButton:A,InfoIcon:D},data(){return{fileList:[],uploadUrl:F()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.pika?.config?.image_url},set(){const e=this.urls?.[0];this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){w.warning(this.$t("pika.message.uploadStartImageExceed"))},onError(){w.error(this.$t("pika.message.uploadStartImageError"))},async onRemove(){w.error(this.$t("pika.message.uploadStartImageError"))},onSetStartImageUrl(){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),Re={class:"field"},De={class:"title font-bold"},Ge={class:"upload-wrapper"};function Le(e,s,p,d,g,v){const c=o("el-button"),u=o("el-upload"),n=o("info-icon");return a(),r("div",Re,[l("h2",De,i(e.$t("pika.name.imageUrl")),1),l("div",Ge,[t(u,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=f=>e.fileList=f),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:3,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{default:m(()=>[t(c,{size:"small",type:"primary",round:""},{default:m(()=>[_(i(e.$t("pika.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])]),t(n,{content:e.$t("pika.description.imageUrl"),class:"info"},null,8,["content"])])}const Me=k(Pe,[["render",Le],["__scopeId","data-v-55a9552e"]]),Oe="",je=$({name:"PromptInput",components:{ElInput:Y,InfoIcon:D},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Oe)}}),qe={class:"field"},Be={class:"box"},Fe={class:"title font-bold"};function Ne(e,s,p,d,g,v){const c=o("info-icon"),u=o("el-input");return a(),r("div",qe,[l("div",Be,[l("h2",Fe,i(e.$t("pika.name.prompt")),1),t(c,{content:e.$t("pika.description.prompt"),class:"info"},null,8,["content"])]),t(u,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pika.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ze=k(je,[["render",Ne],["__scopeId","data-v-b94e7a3e"]]),He=$({name:"PresetPanel",components:{ImageUrlInput:Me,ElButton:A,FontAwesomeIcon:R,PromptInput:ze,IngredientsSelector:_e,IngredientsModelSelector:Ve,ModelSelector:Ue,EffectSelector:be},emits:["generate"],computed:{config(){return this.$store.state.pika?.config}},methods:{onGenerate(){this.$emit("generate")}}}),Ke={class:"panel"},Je={class:"config"},Qe={class:"actions"};function We(e,s,p,d,g,v){const c=o("prompt-input"),u=o("model-selector"),n=o("ingredients-selector"),f=o("effect-selector"),b=o("image-url-input"),E=o("ingredients-model-selector"),T=o("font-awesome-icon"),y=o("el-button");return a(),r("div",Ke,[l("div",Je,[t(c,{class:"mb-4"}),t(u,{class:"mb-4"}),t(n,{class:"mb-4"}),t(f,{class:"mb-4"}),e.config?.ingredients?(a(),I(b,{key:0,class:"mb-4"})):h("",!0),e.config?.ingredients?(a(),I(E,{key:1,class:"mb-4"})):h("",!0),l("div",Qe,[t(y,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[t(T,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("pika.button.generate")),1)]),_:1},8,["onClick"])])])])}const Xe=k(He,[["render",We],["__scopeId","data-v-53b25bc4"]]),Ye=$({name:"VideoPlayer",components:{VuePlyr:x},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),Ze=["data-poster"],xe=["src"];function et(e,s,p,d,g,v){const c=o("vue-plyr");return a(),r("div",null,[t(c,{options:e.options,class:"video"},{default:m(()=>[l("video",{controls:"",crossorigin:"",playsinline:"","data-poster":e.modelValue?.image_url},[l("source",{size:"1080",src:e.modelValue?.video_url,type:"video/mp4"},null,8,xe)],8,Ze)]),_:1},8,["options"])])}const tt=k(Ye,[["render",et],["__scopeId","data-v-fc420430"]]),st=$({name:"TaskPreview",components:{ElImage:se,CopyToClipboard:Z,FontAwesomeIcon:R,ElAlert:te,VideoPlayer:tt,ElTooltip:ee,ElButton:A},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[];const s=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(p=>{let d=p;s&&(d.action=s),e.push(d)}),e}},methods:{onDownload(e){console.log("on download"),window.open(e,"_blank")},onReload(e){const s=e.target,p=new URL(s.src),d=p.searchParams.get("retry");if(!d)p.searchParams.set("retry","1");else if(parseInt(d)<2)p.searchParams.set("retry",(parseInt(d)+1).toString());else return;s.src=p.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),ot={class:"left"},at={class:"main"},nt={class:"bot"},it={class:"datetime"},lt={class:"info"},rt={key:0,class:"prompt mt-2"},ct={key:0},pt={key:1},dt={key:0,class:C({content:!0,failed:!0})},ut={class:"image-wrapper"},mt={key:0,class:C({operations:!0,"mt-2":!0})},ft={class:"description"},_t={key:1,class:C({content:!0})},ht={class:"description"},$t={class:"description"},kt={class:"description"},gt={key:2,class:C({content:!0})},vt={class:"description"};function bt(e,s,p,d,g,v){const c=o("el-image"),u=o("VideoPlayer"),n=o("el-button"),f=o("el-tooltip"),b=o("font-awesome-icon"),E=o("copy-to-clipboard"),T=o("el-alert");return a(!0),r(V,null,S(e.videos,(y,M)=>(a(),r("div",{key:M,class:"preview"},[l("div",ot,[t(c,{src:"https://cdn.acedata.cloud/i80tgn.png",class:"avatar"})]),l("div",at,[l("div",nt,[_(i(e.$t("pika.name.pikaBot"))+" ",1),l("span",it,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",lt,[e.modelValue?.request?.prompt?(a(),r("p",rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(a(),r("span",ct," - ("+i(e.$t("pika.status.pending"))+") ",1)),y?.state==="processing"||y?.state==="pending"||y?.state==="completed"?(a(),r("span",pt," - ("+i(e.$t("pika.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(a(),r("div",dt,[l("div",ut,[t(u,{"model-value":y},null,8,["model-value"])]),y?(a(),r("div",mt,[t(f,{class:"box-item",effect:"dark",content:e.$t("pika.message.downloadVideo"),placement:"top-start"},{default:m(()=>[y?.video_url?(a(),I(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:Dt=>e.onDownload(y?.video_url)},{default:m(()=>[_(i(e.$t("pika.button.download")),1)]),_:2},1032,["onClick"])):h("",!0)]),_:2},1032,["content"])])):h("",!0),t(T,{closable:!1,class:"mt-2 success"},{default:m(()=>[l("p",ft,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(a(),r("div",_t,[t(T,{closable:!1,class:"failure"},{template:m(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[l("p",ht,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),l("p",$t,[t(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("pika.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(E,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),l("p",kt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("pika.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(E,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0),!e.modelValue?.response||y?.state==="processing"||y?.state==="pending"?(a(),r("div",gt,[t(T,{closable:!1,class:"info"},{template:m(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[l("p",vt,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0)])]))),128)}const yt=k(st,[["render",bt],["__scopeId","data-v-052d49ba"]]),wt=$({name:"RecentPanel",components:{TaskPreview:yt,ElSkeleton:ae,ElSkeletonItem:oe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),It={key:0,class:"tasks"},Et={class:"left"},Vt={class:"main"},St={key:1,class:"tasks"},Tt={key:2,class:"w-full h-full flex items-center justify-center"};function At(e,s,p,d,g,v){const c=o("el-skeleton-item"),u=o("el-skeleton"),n=o("task-preview");return a(),r("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...f)=>e.onHandleScroll&&e.onHandleScroll(...f))},[e.tasks?.items===void 0?(a(),r("div",It,[(a(),r(V,null,S(3,f=>l("div",{key:f,class:"task placeholder"},[l("div",Et,[t(u,{animated:""},{template:m(()=>[t(c,{variant:"image",class:"avatar"})]),_:1})]),l("div",Vt,[t(u,{animated:""},{template:m(()=>[t(c,{variant:"p",class:"title"}),t(c,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),r("div",St,[(a(!0),r(V,null,S(e.tasks?.items,(f,b)=>(a(),I(n,{key:b,"model-value":f,class:"preview"},null,8,["model-value"]))),128))])):h("",!0),e.tasks?.items?.length===0?(a(),r("p",Tt,i(e.$t("pika.message.noTasks")),1)):h("",!0)],544)}const Ct=k(wt,[["render",At],["__scopeId","data-v-1f6b602e"]]),Ut="https://webhook.acedata.cloud/pika",Pt=$({name:"PikaIndex",components:{ConfigPanel:Xe,Layout:pe,RecentPanel:Ct},data(){return{task:void 0,job:0,timer:void 0}},computed:{loading(){return this.$store.state.pika?.status?.getApplications===P.Request},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===P.Request},needApply(){return this.$store.state.pika.status.getApplications===P.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0}},async mounted(){await this.onGetService(),await this.onGetApplication(),await this.onScrollDown(),await this.onGetTasks(),this.job=setInterval(()=>{this.onGetTasks()},5e3)},async unmounted(){clearInterval(this.job),clearInterval(this.timer)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("pika/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pika/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){H.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===K&&w.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:p,createdAtMax:d}=e||{};console.debug("limit",s,"createdAtMin",p,"createdAtMax",d),await this.$store.dispatch("pika/getTasks",{limit:s,createdAtMin:p,createdAtMax:d})},async onGenerate(){const e={...this.config,callback_url:Ut},s=this.credential?.token;if(!s){console.error("no token specified");return}w.info(this.$t("pika.message.startingTask")),N.generate(e,{token:s}).then(()=>{w.success(this.$t("pika.message.startTaskSuccess")),this.$store.commit("pika/setConfig",{config:void 0})}).catch(p=>{p?.response?.data?.error?.code===z?w.error(this.$t("pika.message.usedUp")):w.error(this.$t("pika.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Rt(e,s,p,d,g,v){const c=o("config-panel"),u=o("recent-panel"),n=o("layout");return a(),I(n,null,{config:m(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[t(u,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const fs=k(Pt,[["render",Rt],["__scopeId","data-v-f27a6245"]]);export{fs as default};
1
+ import{F as R}from"./index.es-BaEF-yCd.js";import{E as C}from"./index-BC3SQhnJ.js";import{E as j}from"./index-Cq49YzTu.js";import{d as $,h as g,b as r,t as l,k as t,r as U,j as m,l as o,o as a,ei as O,x as i,F as V,v as S,i as I,ej as q,D as _,ek as z,c4 as B,y as h,n as A,el as F,dn as N,db as H,di as K,dj as P}from"./index-CiKCfyf3.js";import{I as D}from"./InfoIcon-0d7gDLJ0.js";import{E as J}from"./index-CTJc5RN5.js";import{E as G,a as L}from"./index-BIodD0b6.js";import{a as Q,E as W}from"./index-CNvtlz9J.js";import{E as X}from"./index-Dq8CiIfs.js";import{E as w}from"./index-BJ9zZLVQ.js";import{E as Y}from"./index-DFa_fZ2n.js";import{C as Z}from"./CopyToClipboard-C40SuTlf.js";import{s as x}from"./vue-plyr-QZFBikSk.js";import{E as ee}from"./index-B2s5F2Tx.js";import{E as te}from"./index-Ddc5MDdZ.js";import{E as se}from"./index-C2BNqZFy.js";import{a as oe,E as ae}from"./index-CL10eK8V.js";import"./use-form-item-Bi9Opk2t.js";import"./index-r5W6hzzQ.js";import"./index-53Nnxk4N.js";import"./index-Dr5emkEa.js";import"./typescript-DurtlR9E.js";import"./strings-CzUgnw_H.js";import"./castArray-CI1BQ6-I.js";import"./isEqual-DHEz5PGP.js";import"./_Uint8Array-DvZicHme.js";import"./debounce-BU0MXMaL.js";import"./_baseIteratee-Bjn9Xjg-.js";import"./index-Dr-J0rUK.js";import"./index-DvzAv5C6.js";import"./_baseClone-up_YH3aT.js";import"./_initCloneObject-CbKHQFZX.js";import"./index-CxyHkpEQ.js";const ne=$({name:"LayoutPika",components:{ElDrawer:j,ElButton:C,FontAwesomeIcon:R},data(){return{drawer:!1}}}),ie={class:"main"},le={class:"config"},re={class:"result"};function ce(e,s,p,d,k,v){const c=o("font-awesome-icon"),u=o("el-button"),n=o("el-drawer");return a(),r("div",ie,[l("div",le,[U(e.$slots,"config",{},void 0,!0)]),l("div",re,[U(e.$slots,"result",{},void 0,!0)]),t(u,{round:"",class:"menu",onClick:s[0]||(s[0]=f=>e.drawer=!0)},{default:m(()=>[t(c,{icon:"fa-solid fa-gear",class:"icon-menu"})]),_:1}),t(n,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=f=>e.drawer=f),"with-header":!1,size:"340px",class:"drawer"},{default:m(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const pe=g(ne,[["render",ce],["__scopeId","data-v-d0a34fc4"]]),de=$({name:"IngredientsSelector",components:{ElSwitch:J,InfoIcon:D},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug("set ingredients",e),e||this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,model:"2.0"})}}},mounted(){this.value===void 0&&(this.value=O)}}),ue={class:"field"},me={class:"title font-bold"};function fe(e,s,p,d,k,v){const c=o("el-switch"),u=o("info-icon");return a(),r("div",ue,[l("h2",me,i(e.$t("pika.name.ingredients")),1),t(c,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value"},null,8,["modelValue"]),t(u,{content:e.$t("pika.description.ingredients"),class:"info"},null,8,["content"])])}const _e=g(de,[["render",fe],["__scopeId","data-v-17c0af5c"]]),he=$({name:"EffectSelector",components:{ElSelect:L,ElOption:G},data(){return{}},computed:{options(){return[{value:"Levitate",label:this.$t("pika.style.effect1")},{value:"Decapitate",label:this.$t("pika.style.effect2")},{value:"Eye-pop",label:this.$t("pika.style.effect3")},{value:"Ta-da",label:this.$t("pika.style.effect4")},{value:"Deflate",label:this.$t("pika.style.effect5")},{value:"Crumble",label:this.$t("pika.style.effect6")},{value:"Dissolve",label:this.$t("pika.style.effect7")},{value:"Squish",label:this.$t("pika.style.effect8")},{value:"Inflate",label:this.$t("pika.style.effect9")},{value:"Melt",label:this.$t("pika.style.effect10")},{value:"Cake-ify",label:this.$t("pika.style.effect11")},{value:"Crush",label:this.$t("pika.style.effect12")},{value:"Explode",label:this.$t("pika.style.effect13")}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,effect:e})}}}}),$e={class:"field"},ge={class:"title font-bold"},ke={class:"float-left"};function ve(e,s,p,d,k,v){const c=o("el-option"),u=o("el-select");return a(),r("div",$e,[l("h2",ge,i(e.$t("pika.name.effect")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select"),clearable:""},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.label,value:n.value},{default:m(()=>[l("span",ke,i(n.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=g(he,[["render",ve],["__scopeId","data-v-d1c54475"]]),ye=$({name:"IngredientsModelSelector",components:{ElRadioButton:W,ElRadioGroup:Q},data(){return{options:[{label:this.$t("pika.button.precise"),value:"precise"},{label:this.$t("pika.button.creative"),value:"creative"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||(this.value=q)}}),we={class:"field"},Ie={class:"title font-bold"};function Ee(e,s,p,d,k,v){const c=o("el-radio-button"),u=o("el-radio-group");return a(),r("div",we,[l("h2",Ie,i(e.$t("pika.name.ingredientsModel")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),size:"small",class:"quality"},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.value},{default:m(()=>[_(i(n.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const Ve=g(ye,[["render",Ee],["__scopeId","data-v-b948551f"]]),Se=$({name:"ModelSelector",components:{ElSelect:L,ElOption:G},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"2.0",label:"2.0"},{value:"1.5",label:"1.5"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||(this.value=z)}}),Te={class:"field"},Ce={class:"title font-bold"};function Ae(e,s,p,d,k,v){const c=o("el-option"),u=o("el-select");return a(),r("div",Te,[l("h2",Ce,i(e.$t("pika.name.model")),1),t(u,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:m(()=>[(a(!0),r(V,null,S(e.options,n=>(a(),I(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=g(Se,[["render",Ae],["__scopeId","data-v-7b2e870a"]]),Pe=$({name:"ImageUrlInput",components:{ElUpload:X,ElButton:C,InfoIcon:D},data(){return{fileList:[],uploadUrl:B()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.pika?.config?.image_url},set(){const e=this.urls?.[0];this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){w.warning(this.$t("pika.message.uploadStartImageExceed"))},onError(){w.error(this.$t("pika.message.uploadStartImageError"))},async onRemove(){w.error(this.$t("pika.message.uploadStartImageError"))},onSetStartImageUrl(){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),Re={class:"field"},De={class:"title font-bold"},Ge={class:"upload-wrapper"};function Le(e,s,p,d,k,v){const c=o("el-button"),u=o("el-upload"),n=o("info-icon");return a(),r("div",Re,[l("h2",De,i(e.$t("pika.name.imageUrl")),1),l("div",Ge,[t(u,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=f=>e.fileList=f),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value","show-file-list":!0,limit:3,multiple:!0,action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{default:m(()=>[t(c,{size:"small",type:"primary",round:""},{default:m(()=>[_(i(e.$t("pika.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])]),t(n,{content:e.$t("pika.description.imageUrl"),class:"info"},null,8,["content"])])}const Me=g(Pe,[["render",Le],["__scopeId","data-v-55a9552e"]]),je="",Oe=$({name:"PromptInput",components:{ElInput:Y,InfoIcon:D},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=je)}}),qe={class:"field"},ze={class:"box"},Be={class:"title font-bold"};function Fe(e,s,p,d,k,v){const c=o("info-icon"),u=o("el-input");return a(),r("div",qe,[l("div",ze,[l("h2",Be,i(e.$t("pika.name.prompt")),1),t(c,{content:e.$t("pika.description.prompt"),class:"info"},null,8,["content"])]),t(u,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("pika.placeholder.prompt"),maxlength:300,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ne=g(Oe,[["render",Fe],["__scopeId","data-v-b94e7a3e"]]),He=$({name:"PresetPanel",components:{ImageUrlInput:Me,ElButton:C,FontAwesomeIcon:R,PromptInput:Ne,IngredientsSelector:_e,IngredientsModelSelector:Ve,ModelSelector:Ue,EffectSelector:be},emits:["generate"],computed:{config(){return this.$store.state.pika?.config}},methods:{onGenerate(){this.$emit("generate")}}}),Ke={class:"panel"},Je={class:"config"},Qe={class:"actions"};function We(e,s,p,d,k,v){const c=o("prompt-input"),u=o("model-selector"),n=o("ingredients-selector"),f=o("effect-selector"),b=o("image-url-input"),E=o("ingredients-model-selector"),T=o("font-awesome-icon"),y=o("el-button");return a(),r("div",Ke,[l("div",Je,[t(c,{class:"mb-4"}),t(u,{class:"mb-4"}),t(n,{class:"mb-4"}),t(f,{class:"mb-4"}),e.config?.ingredients?(a(),I(b,{key:0,class:"mb-4"})):h("",!0),e.config?.ingredients?(a(),I(E,{key:1,class:"mb-4"})):h("",!0),l("div",Qe,[t(y,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[t(T,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("pika.button.generate")),1)]),_:1},8,["onClick"])])])])}const Xe=g(He,[["render",We],["__scopeId","data-v-53b25bc4"]]),Ye=$({name:"VideoPlayer",components:{VuePlyr:x},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:"1080p"}}}}}),Ze=["data-poster"],xe=["src"];function et(e,s,p,d,k,v){const c=o("vue-plyr");return a(),r("div",null,[t(c,{options:e.options,class:"video"},{default:m(()=>[l("video",{controls:"",crossorigin:"",playsinline:"","data-poster":e.modelValue?.image_url},[l("source",{size:"1080",src:e.modelValue?.video_url,type:"video/mp4"},null,8,xe)],8,Ze)]),_:1},8,["options"])])}const tt=g(Ye,[["render",et],["__scopeId","data-v-fc420430"]]),st=$({name:"TaskPreview",components:{ElImage:se,CopyToClipboard:Z,FontAwesomeIcon:R,ElAlert:te,VideoPlayer:tt,ElTooltip:ee,ElButton:C},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[];const s=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(p=>{let d=p;s&&(d.action=s),e.push(d)}),e}},methods:{onDownload(e){console.log("on download"),window.open(e,"_blank")},onReload(e){const s=e.target,p=new URL(s.src),d=p.searchParams.get("retry");if(!d)p.searchParams.set("retry","1");else if(parseInt(d)<2)p.searchParams.set("retry",(parseInt(d)+1).toString());else return;s.src=p.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),ot={class:"left"},at={class:"main"},nt={class:"bot"},it={class:"datetime"},lt={class:"info"},rt={key:0,class:"prompt mt-2"},ct={key:0},pt={key:1},dt={key:0,class:A({content:!0,failed:!0})},ut={class:"image-wrapper"},mt={key:0,class:A({operations:!0,"mt-2":!0})},ft={class:"description"},_t={key:1,class:A({content:!0})},ht={class:"description"},$t={class:"description"},gt={class:"description"},kt={key:2,class:A({content:!0})},vt={class:"description"};function bt(e,s,p,d,k,v){const c=o("el-image"),u=o("VideoPlayer"),n=o("el-button"),f=o("el-tooltip"),b=o("font-awesome-icon"),E=o("copy-to-clipboard"),T=o("el-alert");return a(!0),r(V,null,S(e.videos,(y,M)=>(a(),r("div",{key:M,class:"preview"},[l("div",ot,[t(c,{src:"https://cdn.acedata.cloud/i80tgn.png",class:"avatar"})]),l("div",at,[l("div",nt,[_(i(e.$t("pika.name.pikaBot"))+" ",1),l("span",it,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),l("div",lt,[e.modelValue?.request?.prompt?(a(),r("p",rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(a(),r("span",ct," - ("+i(e.$t("pika.status.pending"))+") ",1)),y?.state==="processing"||y?.state==="pending"||y?.state==="completed"?(a(),r("span",pt," - ("+i(e.$t("pika.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(a(),r("div",dt,[l("div",ut,[t(u,{"model-value":y},null,8,["model-value"])]),y?(a(),r("div",mt,[t(f,{class:"box-item",effect:"dark",content:e.$t("pika.message.downloadVideo"),placement:"top-start"},{default:m(()=>[y?.video_url?(a(),I(n,{key:0,type:"info",size:"small",class:"btn-action",onClick:Dt=>e.onDownload(y?.video_url)},{default:m(()=>[_(i(e.$t("pika.button.download")),1)]),_:2},1032,["onClick"])):h("",!0)]),_:2},1032,["content"])])):h("",!0),t(T,{closable:!1,class:"mt-2 success"},{default:m(()=>[l("p",ft,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(a(),r("div",_t,[t(T,{closable:!1,class:"failure"},{template:m(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[l("p",ht,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),l("p",$t,[t(b,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("pika.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(E,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),l("p",gt,[t(b,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("pika.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(E,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0),!e.modelValue?.response||y?.state==="processing"||y?.state==="pending"?(a(),r("div",kt,[t(T,{closable:!1,class:"info"},{template:m(()=>[t(b,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("pika.name.failure")),1)]),default:m(()=>[l("p",vt,[t(b,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("pika.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(E,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0)])]))),128)}const yt=g(st,[["render",bt],["__scopeId","data-v-052d49ba"]]),wt=$({name:"RecentPanel",components:{TaskPreview:yt,ElSkeleton:ae,ElSkeletonItem:oe},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),It={key:0,class:"tasks"},Et={class:"left"},Vt={class:"main"},St={key:1,class:"tasks"},Tt={key:2,class:"w-full h-full flex items-center justify-center"};function Ct(e,s,p,d,k,v){const c=o("el-skeleton-item"),u=o("el-skeleton"),n=o("task-preview");return a(),r("div",{ref:"panel",class:"panel recent",onScroll:s[0]||(s[0]=(...f)=>e.onHandleScroll&&e.onHandleScroll(...f))},[e.tasks?.items===void 0?(a(),r("div",It,[(a(),r(V,null,S(3,f=>l("div",{key:f,class:"task placeholder"},[l("div",Et,[t(u,{animated:""},{template:m(()=>[t(c,{variant:"image",class:"avatar"})]),_:1})]),l("div",Vt,[t(u,{animated:""},{template:m(()=>[t(c,{variant:"p",class:"title"}),t(c,{variant:"image",class:"icon"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),r("div",St,[(a(!0),r(V,null,S(e.tasks?.items,(f,b)=>(a(),I(n,{key:b,"model-value":f,class:"preview"},null,8,["model-value"]))),128))])):h("",!0),e.tasks?.items?.length===0?(a(),r("p",Tt,i(e.$t("pika.message.noTasks")),1)):h("",!0)],544)}const At=g(wt,[["render",Ct],["__scopeId","data-v-1f6b602e"]]),Ut="https://webhook.acedata.cloud/pika",Pt=$({name:"PikaIndex",components:{ConfigPanel:Xe,Layout:pe,RecentPanel:At},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.pika?.status?.getApplications===P.Request},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===P.Request},needApply(){return this.$store.state.pika.status.getApplications===P.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("pika/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pika/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){H.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===K&&w.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:p,createdAtMax:d}=e||{};console.debug("limit",s,"createdAtMin",p,"createdAtMax",d),await this.$store.dispatch("pika/getTasks",{limit:s,createdAtMin:p,createdAtMax:d})},async onGenerate(){const e={...this.config,callback_url:Ut},s=this.credential?.token;if(!s){console.error("no token specified");return}w.info(this.$t("pika.message.startingTask")),F.generate(e,{token:s}).then(()=>{w.success(this.$t("pika.message.startTaskSuccess")),this.$store.commit("pika/setConfig",{config:void 0})}).catch(p=>{p?.response?.data?.error?.code===N?w.error(this.$t("pika.message.usedUp")):w.error(this.$t("pika.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Rt(e,s,p,d,k,v){const c=o("config-panel"),u=o("recent-panel"),n=o("layout");return a(),I(n,null,{config:m(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[t(u,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const fs=g(Pt,[["render",Rt],["__scopeId","data-v-bc973743"]]);export{fs as default};