@acedatacloud/nexior 3.24.0 → 3.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/assets/{Auth-U3yYMWPb.js → Auth-DTWbVCp6.js} +1 -1
  2. package/dist/assets/{BotPlaceholder-DKPNFbIr.js → BotPlaceholder-BgP8q68w.js} +1 -1
  3. package/dist/assets/{Callback-CVMoquq2.js → Callback-Cb9A2lu5.js} +1 -1
  4. package/dist/assets/{Console-CTJZPHmF.js → Console-DKm795jt.js} +1 -1
  5. package/dist/assets/{Conversation-BS7L0VcC.js → Conversation-Dk0fhTtm.js} +2 -2
  6. package/dist/assets/{CopyToClipboard-CzE5Qyes.js → CopyToClipboard-C_xMmtDc.js} +1 -1
  7. package/dist/assets/{Detail-C3oYMO6J.js → Detail-DrLS-v5M.js} +1 -1
  8. package/dist/assets/{EditArray-C1bpV3sz.js → EditArray-ClJUMpk4.js} +1 -1
  9. package/dist/assets/{Extra-DbeIRzak.js → Extra-DIxRDCsF.js} +1 -1
  10. package/dist/assets/{FilePreview-CDzbEEK9.js → FilePreview-Br7iuVJu.js} +1 -1
  11. package/dist/assets/{History-CIxJTX4E.js → History-DCtkx2Uv.js} +1 -1
  12. package/dist/assets/{ImagePreview-VnpfW9Pj.js → ImagePreview-D_L90Mc7.js} +1 -1
  13. package/dist/assets/{ImageWrapper-C2PohC6W.js → ImageWrapper-Pritl6ia.js} +1 -1
  14. package/dist/assets/{Index-BkVsyXyu.js → Index--R6Mez1e.js} +1 -1
  15. package/dist/assets/{Index-BDLsUrH_.js → Index-3BrY7GTD.js} +1 -1
  16. package/dist/assets/{Index-CHJJxQZZ.js → Index-BGpRIRnJ.js} +1 -1
  17. package/dist/assets/{Index-BZdHsOL7.js → Index-BKRMsAnb.js} +1 -1
  18. package/dist/assets/{Index-DNUO_WLR.js → Index-BOd6hidv.js} +1 -1
  19. package/dist/assets/{Index-BfanYqxM.js → Index-C7oPQwl1.js} +1 -1
  20. package/dist/assets/Index-CByCCg-O.css +1 -0
  21. package/dist/assets/{Index-QhofBqyo.js → Index-CIQ_Kr5J.js} +1 -1
  22. package/dist/assets/{Index-DYEsXBUc.js → Index-CXaW3ysi.js} +1 -1
  23. package/dist/assets/{Index-c9YVJIU8.js → Index-CtvpUe3c.js} +1 -1
  24. package/dist/assets/{Index-DNxQOH2I.js → Index-CxLpwFuf.js} +1 -1
  25. package/dist/assets/{Index-BqnAzyak.js → Index-DGBKmiyr.js} +1 -1
  26. package/dist/assets/Index-DIoE-xqc.js +1 -0
  27. package/dist/assets/{Index-DxTCv_hq.js → Index-DY2ratY8.js} +1 -1
  28. package/dist/assets/Index-DkScbE8t.js +1 -0
  29. package/dist/assets/Index-H2tBAlzy.css +1 -0
  30. package/dist/assets/{Index-UvepuNe-.js → Index-Ky0a79So.js} +1 -1
  31. package/dist/assets/{Index-D-RFeTM-.js → Index-uEyIppRg.js} +1 -1
  32. package/dist/assets/{InfoIcon-htaT17q9.js → InfoIcon-cglftkH2.js} +1 -1
  33. package/dist/assets/{Invitees-BFsoobgF.js → Invitees-Bp3ntf_X.js} +1 -1
  34. package/dist/assets/{List-DX0aA1uB.js → List-DnT5KyyU.js} +1 -1
  35. package/dist/assets/{List-D3J3Rfhh.js → List-cBcRn9xk.js} +1 -1
  36. package/dist/assets/{List-X5PnY5tK.js → List-sD7bv3K1.js} +1 -1
  37. package/dist/assets/{Login-DSWYve0k.js → Login-Bqwz79l3.js} +1 -1
  38. package/dist/assets/{Main-DnQIo5_J.js → Main-CVFNdoBS.js} +1 -1
  39. package/dist/assets/{Navigator-CFx-t1E0.js → Navigator-DZb9560y.js} +1 -1
  40. package/dist/assets/{NoTasks-DHdI1Frr.js → NoTasks-B6hLJrko.js} +1 -1
  41. package/dist/assets/{Pagination-DcQVmu45.js → Pagination-BYFbwkF0.js} +1 -1
  42. package/dist/assets/{Status-C3EStxoL.js → Status-CsL--y5f.js} +1 -1
  43. package/dist/assets/{Subscribe-C7U8Yb7_.js → Subscribe-DIcCgCzT.js} +1 -1
  44. package/dist/assets/{VideoPlayer-DCap_X2q.js → VideoPlayer-CjCdW8Fe.js} +1 -1
  45. package/dist/assets/{_baseClone-B6o0klpv.js → _baseClone-DiKhUhxc.js} +1 -1
  46. package/dist/assets/{_baseIteratee-Bk7QROEW.js → _baseIteratee-7W3vde5j.js} +1 -1
  47. package/dist/assets/{_initCloneObject-iRvJrG7M.js → _initCloneObject-CwAtjxb1.js} +1 -1
  48. package/dist/assets/{castArray-CoJ3z4SB.js → castArray-7tYrhn6A.js} +1 -1
  49. package/dist/assets/{debounce-CEE_CsrA.js → debounce-09KXX3DN.js} +1 -1
  50. package/dist/assets/{distribution-pW96wtpU.js → distribution-tLpcb6Nq.js} +1 -1
  51. package/dist/assets/{dropdown-CfSu6_B-.js → dropdown-UbXA6R_N.js} +1 -1
  52. package/dist/assets/{index-BZHTBEqD.js → index-3k3mWDTk.js} +1 -1
  53. package/dist/assets/{index-Czog4o5z.js → index-7746Wyq5.js} +1 -1
  54. package/dist/assets/{index-DNzgGVij.js → index-B-7UQmSa.js} +1 -1
  55. package/dist/assets/{index-z-6wtqoM.js → index-BAMr6BWr.js} +1 -1
  56. package/dist/assets/{index-Colfa9sv.js → index-BCo-Le3_.js} +1 -1
  57. package/dist/assets/{index-DTBHHHz_.js → index-BQWF6H8D.js} +1 -1
  58. package/dist/assets/{index-CLOiWNZO.js → index-BX6sU3GX.js} +1 -1
  59. package/dist/assets/{index--xRF9A-K.js → index-BbDlaK5a.js} +1 -1
  60. package/dist/assets/{index-CLwJbfYs.js → index-BjMVMy9y.js} +33 -33
  61. package/dist/assets/{index-d2CvBCAu.js → index-Bk6FKSGz.js} +1 -1
  62. package/dist/assets/{index-AT7DtKgl.js → index-BzF_Ko5s.js} +1 -1
  63. package/dist/assets/{index-BU5-qzoD.js → index-CCO_ODiz.js} +1 -1
  64. package/dist/assets/{index-H2WJr-nr.js → index-CEhCMEW7.js} +1 -1
  65. package/dist/assets/{index-Cs65NgP9.js → index-CEpvbqDt.js} +1 -1
  66. package/dist/assets/{index-C1s2diPf.js → index-CQ2bsd-r.js} +1 -1
  67. package/dist/assets/{index-CGrkkZd-.js → index-CgDmoqKO.js} +1 -1
  68. package/dist/assets/{index-O2tEst1s.js → index-Ckr3Af0G.js} +1 -1
  69. package/dist/assets/{index-Dc0-osYE.js → index-D19A578F.js} +1 -1
  70. package/dist/assets/{index-BR8qEo0P.js → index-DURkl1eZ.js} +1 -1
  71. package/dist/assets/{index-B_qlJ-la.js → index-DXfYQh0Z.js} +1 -1
  72. package/dist/assets/{index-DNuWNnk-.js → index-Dagq6Y2s.js} +1 -1
  73. package/dist/assets/{index-DITqxnfk.js → index-DulF_7UO.js} +1 -1
  74. package/dist/assets/{index-Cg60JDEK.js → index-DvTCiu3P.js} +1 -1
  75. package/dist/assets/{index-DbY2GEPa.js → index-DxLDQU_A.js} +1 -1
  76. package/dist/assets/{index-DHn59BRx.js → index-OiDdq1JS.js} +1 -1
  77. package/dist/assets/{index-BkA1qQd3.js → index-SyQbsg8v.js} +1 -1
  78. package/dist/assets/{index-D3gVuWw7.js → index-WJgswFMW.js} +1 -1
  79. package/dist/assets/{index-MlWSSchD.js → index-bryRJW_X.js} +1 -1
  80. package/dist/assets/{index-CQvuK-4v.js → index-ifdCUgG7.js} +1 -1
  81. package/dist/assets/{index.es-BLCm9UT-.js → index.es-B6L7VFNr.js} +1 -1
  82. package/dist/assets/{isEqual-DQdO_K1-.js → isEqual-Df5ippj8.js} +1 -1
  83. package/dist/assets/{isPlainObject-BsyTgoxK.js → isPlainObject-BF8_keIM.js} +1 -1
  84. package/dist/assets/{order-CeKvimTq.js → order-DXkvQhpi.js} +1 -1
  85. package/dist/assets/{price-CZSDhLnN.js → price-CG10y7sa.js} +1 -1
  86. package/dist/assets/{strings-WMZYwrQD.js → strings-C0ATdFxF.js} +1 -1
  87. package/dist/assets/{typescript-CoKqfRJS.js → typescript-DXZhO2KE.js} +1 -1
  88. package/dist/assets/{use-form-item-CRDWzFx1.js → use-form-item-CZJno9cW.js} +1 -1
  89. package/dist/index.html +1 -1
  90. package/package.json +1 -1
  91. package/dist/assets/Index-Bqvjazj0.js +0 -1
  92. package/dist/assets/Index-DPQ747pA.css +0 -1
  93. package/dist/assets/Index-PQerfBmJ.css +0 -1
  94. package/dist/assets/Index-eWhLfJGA.js +0 -1
@@ -1 +1 @@
1
- import{F as S}from"./index.es-BLCm9UT-.js";import{E as I}from"./index-Czog4o5z.js";import{E as O}from"./index-Cs65NgP9.js";import{d as v,h as b,b as m,t as n,k as t,r as T,j as u,l as s,o as a,ev as q,x as i,ew as N,ex as H,cf as j,D as g,i as k,y as f,n as C,aq as z,F as D,v as K,ey as x,dA as J,dw as Q}from"./index-CLwJbfYs.js";import{I as U}from"./InfoIcon-htaT17q9.js";import{E as A}from"./index-BU5-qzoD.js";import{I as F}from"./ImagePreview-VnpfW9Pj.js";import{E as R}from"./index-Colfa9sv.js";import{E}from"./index-CQvuK-4v.js";import{F as W}from"./FilePreview-CDzbEEK9.js";import{E as X}from"./index-DHn59BRx.js";import{V as M}from"./VideoPlayer-DCap_X2q.js";import{C as Y,N as Z}from"./NoTasks-DHdI1Frr.js";import{a as ee}from"./price-CZSDhLnN.js";import{C as te}from"./CopyToClipboard-CzE5Qyes.js";import{E as oe}from"./index-DITqxnfk.js";import{E as se}from"./index-DNuWNnk-.js";import{E as ne}from"./index-O2tEst1s.js";import{B as ae}from"./BotPlaceholder-DKPNFbIr.js";import"./use-form-item-CRDWzFx1.js";import"./index-r5W6hzzQ.js";import"./index-AT7DtKgl.js";import"./index-D3gVuWw7.js";import"./typescript-CoKqfRJS.js";import"./_baseClone-B6o0klpv.js";import"./_initCloneObject-iRvJrG7M.js";import"./isEqual-DQdO_K1-.js";import"./index-C1s2diPf.js";import"./vue-plyr-QZFBikSk.js";import"./debounce-CEE_CsrA.js";import"./index-MlWSSchD.js";const le=v({name:"LayoutLuma",components:{ElDrawer:O,ElButton:I,FontAwesomeIcon:S},data(){return{drawer:!1}}}),ie={class:"main flex flex-row flex-1"},re={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ce={class:"result h-full p-[15px] flex-1 flex flex-col"};function me(e,o,p,h,w,y){const r=s("font-awesome-icon"),d=s("el-button"),c=s("el-drawer");return a(),m("div",ie,[n("div",re,[T(e.$slots,"config",{},void 0,!0)]),n("div",ce,[T(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=_=>e.drawer=!0)},{default:u(()=>[t(r,{icon:"fa-solid fa-magic"})]),_:1}),t(c,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px",class:"drawer"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ue=b(le,[["render",me],["__scopeId","data-v-11a53e0c"]]),de=v({name:"EnhancementSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug("set enhancement",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=q)}}),pe={class:"relative"},fe={class:"flex justify-between"},_e={class:"flex justify-start items-center"},he={class:"text-sm font-bold"},$e={class:"flex justify-end items-center"};function ge(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",pe,[n("div",fe,[n("div",_e,[n("span",he,i(e.$t("luma.name.enhancement")),1),t(r,{content:e.$t("luma.description.enhancement")},null,8,["content"])]),n("div",$e,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const ve=b(de,[["render",ge]]),be=v({name:"CustomSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),we={class:"relative"},ye={class:"flex justify-between"},ke={class:"flex justify-start items-center"},Ee={class:"text-sm font-bold"},Ve={class:"flex justify-end items-center"};function Ue(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",we,[n("div",ye,[n("div",ke,[n("span",Ee,i(e.$t("luma.name.custom")),1),t(r,{content:e.$t("luma.description.custom")},null,8,["content"])]),n("div",Ve,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Se=b(be,[["render",Ue]]),Ie=v({name:"LoopSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug("set loop",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=H)}}),Le={class:"relative"},Ce={class:"flex justify-between"},Te={class:"flex justify-start items-center"},je={class:"text-sm font-bold"},Ae={class:"flex justify-end items-center"};function Re(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",Le,[n("div",Ce,[n("div",Te,[n("span",je,i(e.$t("luma.name.loop")),1),t(r,{content:e.$t("luma.description.loop")},null,8,["content"])]),n("div",Ae,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Ge=b(Ie,[["render",Re]]),Pe=v({name:"EndImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ze={class:"relative"},De={class:"flex justify-between"},Fe={class:"flex justify-start items-center"},Me={class:"text-sm font-bold"};function Be(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",ze,[n("div",De,[n("div",Fe,[n("span",Me,i(e.$t("luma.name.endImageUrl")),1),t(r,{content:e.$t("luma.description.endImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.url&&l.percentage!==void 0?(a(),k(d,{key:0,url:l.url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadEndImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Oe=b(Pe,[["render",Be],["__scopeId","data-v-7ab78c3e"]]),qe=v({name:"StartImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ne={class:"relative"},He={class:"flex justify-between"},Ke={class:"flex justify-start items-center"},xe={class:"text-sm font-bold"};function Je(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",Ne,[n("div",He,[n("div",Ke,[n("span",xe,i(e.$t("luma.name.startImageUrl")),1),t(r,{content:e.$t("luma.description.startImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Qe=b(qe,[["render",Je],["__scopeId","data-v-425a8cec"]]),We=v({name:"UploadVideo",components:{ElUpload:R,ElButton:I,InfoIcon:U,FilePreview:W,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.luma?.config?.video_url},set(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||(this.value=void 0)},methods:{onExceed(){E.warning(this.$t("luma.message.uploadVideoExceed"))},onError(){E.error(this.$t("luma.message.uploadVideoError"))},beforeUpload(e){const o=e.type==="video/mp4",p=e.size/1024/1024<10;return o?p?!0:(E.error(this.$t("luma.message.uploadVideoSizeExceed")),!1):(E.error(this.$t("luma.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e,action:"extend"})},async onSuccess(){this.onSetVideoUrl()}}}),Xe={class:"relative"},Ye={class:"flex justify-between"},Ze={class:"flex justify-start items-center"},et={class:"text-sm font-bold"};function tt(e,o,p,h,w,y){const r=s("info-icon"),d=s("file-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",Xe,[n("div",Ye,[n("div",Ze,[n("span",et,i(e.$t("luma.name.videoUrl")),1),t(r,{content:e.$t("luma.description.videoUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),accept:".mp4",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response?.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const ot=b(We,[["render",tt],["__scopeId","data-v-74e51526"]]),st="",nt=v({name:"PromptInput",components:{ElInput:X,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=st)}}),at={class:"field"},lt={class:"box"},it={class:"title font-bold"};function rt(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-input");return a(),m("div",at,[n("div",lt,[n("h2",it,i(e.$t("luma.name.prompt")),1),t(r,{content:e.$t("luma.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=c=>e.prompt=c),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("luma.placeholder.prompt"),maxlength:2e3,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ct=b(nt,[["render",rt],["__scopeId","data-v-e8284075"]]),mt=v({name:"ExtendFromInput",components:{VideoPlayer:M},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.luma?.config}}}),ut={class:"relative"},dt={class:"flex mb-2"},pt={class:"text-sm font-bold"};function ft(e,o,p,h,w,y){const r=s("video-player");return a(),m("div",ut,[n("div",dt,[n("span",pt,i(e.$t("luma.name.extend")),1)]),n("div",null,[e.config?.video_url?(a(),k(r,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const _t=b(mt,[["render",ft]]),ht=v({name:"ConfigPanel",components:{LoopSelector:Ge,StartImageInput:Qe,EndImageInput:Oe,EnhancementSelector:ve,ElButton:I,FontAwesomeIcon:S,PromptInput:ct,ExtendFromInput:_t,CustomSelector:Se,UploadVideo:ot,Consumption:Y},emits:["generate"],computed:{config(){return this.$store.state.luma?.config},consumption(){return ee(this.config,this.service?.metadata?.price)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$t={class:"flex flex-col h-full"},gt={class:"flex-1 overflow-y-auto p-[15px]"},vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function bt(e,o,p,h,w,y){const r=s("extend-from-input"),d=s("prompt-input"),c=s("custom-selector"),_=s("upload-video"),$=s("start-image-input"),l=s("end-image-input"),V=s("enhancement-selector"),L=s("loop-selector"),B=s("consumption"),G=s("font-awesome-icon"),P=s("el-button");return a(),m("div",$t,[n("div",gt,[e.config?.video_id||e.config?.video_url?(a(),k(r,{key:0,class:"mb-4"})):f("",!0),t(d,{class:"mb-4"}),e.config?.video_id?f("",!0):(a(),k(c,{key:1,class:"mb-4"})),e.config?.custom?(a(),k(_,{key:2,class:"mb-4"})):f("",!0),!(e.config?.video_id||e.config?.video_url)&&!e.config?.custom?(a(),k($,{key:3,class:"mb-4"})):f("",!0),t(l,{class:"mb-4"}),t(V,{class:"mb-4"}),t(L,{class:"mb-4"})]),n("div",vt,[t(B,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),k(P,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.extend")),1)]),_:1},8,["onClick"])):(a(),k(P,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.generate")),1)]),_:1},8,["onClick"]))])])}const wt=b(ht,[["render",bt]]),yt=v({name:"TaskPreview",components:{ElImage:ne,CopyToClipboard:te,FontAwesomeIcon:S,ElAlert:se,VideoPlayer:M,ElTooltip:oe,ElButton:I},props:{modelValue:{type:Object,required:!0}},emits:["extend"],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,o){console.debug("set config",o),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_id:o.video_id,prompt:o.prompt,action:"extend",thumbnail_url:o.thumbnail_url,video_url:o.video_url}),this.$emit("extend")},onDownload(e){window.open(e,"_blank")}}}),kt={class:"preview"},Et={class:"left"},Vt={class:"main"},Ut={class:"bot"},St={class:"datetime"},It={class:"info"},Lt={key:0,class:"prompt mt-2"},Ct={key:0},Tt={key:1},jt={key:0,class:C({content:!0,failed:!0})},At={key:0,class:"mb-4"},Rt={key:1,class:C({operations:!0,"mt-2":!0,"mb-4":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Pt={key:1,class:C({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Dt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Mt={key:2,class:C({content:!0})},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Ot(e,o,p,h,w,y){const r=s("el-image"),d=s("video-player"),c=s("el-button"),_=s("el-tooltip"),$=s("font-awesome-icon"),l=s("copy-to-clipboard"),V=s("el-alert");return a(),m("div",kt,[n("div",Et,[t(r,{src:"https://cdn.acedata.cloud/ahjfwi.png",class:"avatar"})]),n("div",Vt,[n("div",Ut,[g(i(e.$t("luma.name.lumaBot"))+" ",1),n("span",St,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),n("div",It,[e.modelValue?.request?.prompt?(a(),m("p",Lt,[g(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(a(),m("span",Ct," - ("+i(e.$t("luma.status.pending"))+") ",1)),e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("span",Tt," - ("+i(e.$t("luma.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0?(a(),m("div",jt,[e.modelValue.response.video_url?(a(),m("div",At,[t(d,{src:e.modelValue.response.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response&&!e.config?.custom?(a(),m("div",Rt,[t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.extendVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=z(L=>e.onExtend(L,e.modelValue?.response),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.extend")),1)]),_:1})]),_:1},8,["content"]),t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.downloadVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=z(L=>e.onDownload(e.modelValue?.response?.video_url),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.download")),1)]),_:1})]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[n("p",Gt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.state==="failed"||e.modelValue?.response?.success===!1?(a(),m("div",Pt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",zt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])]),n("p",Dt,[t($,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+i(e.$t("luma.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(l,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),n("p",Ft,[t($,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+i(e.$t("luma.name.traceId"))+": "+i(e.modelValue?.trace_id)+" ",1),t(l,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):f("",!0),!e.modelValue?.response||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("div",Mt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",Bt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0)])])}const qt=b(yt,[["render",Ot],["__scopeId","data-v-1b4a59bc"]]),Nt=v({name:"RecentPanel",components:{BotPlaceholder:ae,TaskPreview:qt,NoTasks:Z},emits:["reach-top","extend"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ht={key:0},Kt={key:1,class:"tasks w-full h-full overflow-y-auto"},xt={key:2,class:"w-full h-full flex items-center justify-center"};function Jt(e,o,p,h,w,y){const r=s("bot-placeholder"),d=s("task-preview"),c=s("no-tasks");return a(),m(D,null,[e.tasks?.items===void 0?(a(),m("div",Ht,[t(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),m("div",Kt,[(a(!0),m(D,null,K(e.tasks?.items,_=>(a(),k(d,{key:_.id,"model-value":_,onExtend:o[0]||(o[0]=$=>e.$emit("extend"))},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(a(),m("div",xt,[t(c)])):f("",!0)],64)}const Qt=b(Nt,[["render",Jt]]),Wt="https://webhook.acedata.cloud/luma",Xt=v({name:"LumaIndex",components:{ConfigPanel:wt,Layout:ue,RecentPanel:Qt},inject:["initialized"],emits:["extend"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.luma?.status?.getApplications===Q.Request},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("luma/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("luma/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){console.debug("scrolling down"),setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:h}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",h),await this.$store.dispatch("luma/getTasks",{limit:o,createdAtMin:p,createdAtMax:h})},async onGenerate(){const e={...this.config,callback_url:Wt},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("luma.message.startingTask")),x.generate(e,{token:o}).then(()=>{E.success(this.$t("luma.message.startTaskSuccess"))}).catch(p=>{p?.response?.data?.error?.code===J?E.error(this.$t("luma.message.usedUp")):E.error(this.$t("luma.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Yt(e,o,p,h,w,y){const r=s("config-panel"),d=s("recent-panel"),c=s("layout");return a(),k(c,null,{config:u(()=>[t(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop,onExtend:o[0]||(o[0]=_=>e.$emit("extend"))},null,8,["onReachTop"])]),_:1})}const To=b(Xt,[["render",Yt]]);export{To as default};
1
+ import{F as S}from"./index.es-B6L7VFNr.js";import{E as I}from"./index-7746Wyq5.js";import{E as O}from"./index-CEpvbqDt.js";import{d as v,h as b,b as m,t as n,k as t,r as T,j as u,l as s,o as a,ev as q,x as i,ew as N,ex as H,cf as j,D as g,i as k,y as f,n as C,aq as z,F as D,v as K,ey as x,dA as J,dw as Q}from"./index-BjMVMy9y.js";import{I as U}from"./InfoIcon-cglftkH2.js";import{E as A}from"./index-CCO_ODiz.js";import{I as F}from"./ImagePreview-D_L90Mc7.js";import{E as R}from"./index-BCo-Le3_.js";import{E}from"./index-ifdCUgG7.js";import{F as W}from"./FilePreview-Br7iuVJu.js";import{E as X}from"./index-OiDdq1JS.js";import{V as M}from"./VideoPlayer-CjCdW8Fe.js";import{C as Y,N as Z}from"./NoTasks-B6hLJrko.js";import{a as ee}from"./price-CG10y7sa.js";import{C as te}from"./CopyToClipboard-C_xMmtDc.js";import{E as oe}from"./index-DulF_7UO.js";import{E as se}from"./index-Dagq6Y2s.js";import{E as ne}from"./index-Ckr3Af0G.js";import{B as ae}from"./BotPlaceholder-BgP8q68w.js";import"./use-form-item-CZJno9cW.js";import"./index-r5W6hzzQ.js";import"./index-BzF_Ko5s.js";import"./index-WJgswFMW.js";import"./typescript-DXZhO2KE.js";import"./_baseClone-DiKhUhxc.js";import"./_initCloneObject-CwAtjxb1.js";import"./isEqual-Df5ippj8.js";import"./index-CQ2bsd-r.js";import"./vue-plyr-QZFBikSk.js";import"./debounce-09KXX3DN.js";import"./index-bryRJW_X.js";const le=v({name:"LayoutLuma",components:{ElDrawer:O,ElButton:I,FontAwesomeIcon:S},data(){return{drawer:!1}}}),ie={class:"main flex flex-row flex-1"},re={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},ce={class:"result h-full p-[15px] flex-1 flex flex-col"};function me(e,o,p,h,w,y){const r=s("font-awesome-icon"),d=s("el-button"),c=s("el-drawer");return a(),m("div",ie,[n("div",re,[T(e.$slots,"config",{},void 0,!0)]),n("div",ce,[T(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:o[0]||(o[0]=_=>e.drawer=!0)},{default:u(()=>[t(r,{icon:"fa-solid fa-magic"})]),_:1}),t(c,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=_=>e.drawer=_),direction:"ltr","with-header":!1,size:"350px",class:"drawer"},{default:u(()=>[T(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ue=b(le,[["render",me],["__scopeId","data-v-11a53e0c"]]),de=v({name:"EnhancementSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug("set enhancement",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=q)}}),pe={class:"relative"},fe={class:"flex justify-between"},_e={class:"flex justify-start items-center"},he={class:"text-sm font-bold"},$e={class:"flex justify-end items-center"};function ge(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",pe,[n("div",fe,[n("div",_e,[n("span",he,i(e.$t("luma.name.enhancement")),1),t(r,{content:e.$t("luma.description.enhancement")},null,8,["content"])]),n("div",$e,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const ve=b(de,[["render",ge]]),be=v({name:"CustomSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=N)}}),we={class:"relative"},ye={class:"flex justify-between"},ke={class:"flex justify-start items-center"},Ee={class:"text-sm font-bold"},Ve={class:"flex justify-end items-center"};function Ue(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",we,[n("div",ye,[n("div",ke,[n("span",Ee,i(e.$t("luma.name.custom")),1),t(r,{content:e.$t("luma.description.custom")},null,8,["content"])]),n("div",Ve,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Se=b(be,[["render",Ue]]),Ie=v({name:"LoopSelector",components:{ElSwitch:A,InfoIcon:U},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug("set loop",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=H)}}),Le={class:"relative"},Ce={class:"flex justify-between"},Te={class:"flex justify-start items-center"},je={class:"text-sm font-bold"},Ae={class:"flex justify-end items-center"};function Re(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-switch");return a(),m("div",Le,[n("div",Ce,[n("div",Te,[n("span",je,i(e.$t("luma.name.loop")),1),t(r,{content:e.$t("luma.description.loop")},null,8,["content"])]),n("div",Ae,[t(d,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=c=>e.value=c),class:"value"},null,8,["modelValue"])])])])}const Ge=b(Ie,[["render",Re]]),Pe=v({name:"EndImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),ze={class:"relative"},De={class:"flex justify-between"},Fe={class:"flex justify-start items-center"},Me={class:"text-sm font-bold"};function Be(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",ze,[n("div",De,[n("div",Fe,[n("span",Me,i(e.$t("luma.name.endImageUrl")),1),t(r,{content:e.$t("luma.description.endImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.url&&l.percentage!==void 0?(a(),k(d,{key:0,url:l.url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadEndImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Oe=b(Pe,[["render",Be],["__scopeId","data-v-7ab78c3e"]]),qe=v({name:"StartImage",components:{ElUpload:R,ElButton:I,ImagePreview:F,InfoIcon:U,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){E.warning(this.$t("luma.message.uploadReferencesExceed"))},onError(){E.error(this.$t("luma.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ne={class:"relative"},He={class:"flex justify-between"},Ke={class:"flex justify-start items-center"},xe={class:"text-sm font-bold"};function Je(e,o,p,h,w,y){const r=s("info-icon"),d=s("image-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",Ne,[n("div",He,[n("div",Ke,[n("span",xe,i(e.$t("luma.name.startImageUrl")),1),t(r,{content:e.$t("luma.description.startImageUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadStartImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Qe=b(qe,[["render",Je],["__scopeId","data-v-425a8cec"]]),We=v({name:"UploadVideo",components:{ElUpload:R,ElButton:I,InfoIcon:U,FilePreview:W,FontAwesomeIcon:S},data(){return{fileList:[],uploadUrl:j()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.luma?.config?.video_url},set(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||(this.value=void 0)},methods:{onExceed(){E.warning(this.$t("luma.message.uploadVideoExceed"))},onError(){E.error(this.$t("luma.message.uploadVideoError"))},beforeUpload(e){const o=e.type==="video/mp4",p=e.size/1024/1024<10;return o?p?!0:(E.error(this.$t("luma.message.uploadVideoSizeExceed")),!1):(E.error(this.$t("luma.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_url:e,action:"extend"})},async onSuccess(){this.onSetVideoUrl()}}}),Xe={class:"relative"},Ye={class:"flex justify-between"},Ze={class:"flex justify-start items-center"},et={class:"text-sm font-bold"};function tt(e,o,p,h,w,y){const r=s("info-icon"),d=s("file-preview"),c=s("font-awesome-icon"),_=s("el-button"),$=s("el-upload");return a(),m("div",Xe,[n("div",Ye,[n("div",Ze,[n("span",et,i(e.$t("luma.name.videoUrl")),1),t(r,{content:e.$t("luma.description.videoUrl")},null,8,["content"])])]),t($,{"file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=l=>e.fileList=l),accept:".mp4",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:l})=>[l.percentage!=null?(a(),k(d,{key:0,url:l.url||l.response?.file_url,name:l.name,percentage:l.percentage,onRemove:V=>e.fileList.splice(e.fileList.indexOf(l),1)},null,8,["url","name","percentage","onRemove"])):f("",!0)]),default:u(()=>[t(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(c,{icon:"fa-solid fa-upload",class:"icon mr-1"}),g(" "+i(e.$t("luma.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const ot=b(We,[["render",tt],["__scopeId","data-v-74e51526"]]),st="",nt=v({name:"PromptInput",components:{ElInput:X,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=st)}}),at={class:"field"},lt={class:"box"},it={class:"title font-bold"};function rt(e,o,p,h,w,y){const r=s("info-icon"),d=s("el-input");return a(),m("div",at,[n("div",lt,[n("h2",it,i(e.$t("luma.name.prompt")),1),t(r,{content:e.$t("luma.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=c=>e.prompt=c),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("luma.placeholder.prompt"),maxlength:2e3,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const ct=b(nt,[["render",rt],["__scopeId","data-v-e8284075"]]),mt=v({name:"ExtendFromInput",components:{VideoPlayer:M},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:"1080p"}}}},computed:{config(){return this.$store.state.luma?.config}}}),ut={class:"relative"},dt={class:"flex mb-2"},pt={class:"text-sm font-bold"};function ft(e,o,p,h,w,y){const r=s("video-player");return a(),m("div",ut,[n("div",dt,[n("span",pt,i(e.$t("luma.name.extend")),1)]),n("div",null,[e.config?.video_url?(a(),k(r,{key:0,src:e.config?.video_url},null,8,["src"])):f("",!0)])])}const _t=b(mt,[["render",ft]]),ht=v({name:"ConfigPanel",components:{LoopSelector:Ge,StartImageInput:Qe,EndImageInput:Oe,EnhancementSelector:ve,ElButton:I,FontAwesomeIcon:S,PromptInput:ct,ExtendFromInput:_t,CustomSelector:Se,UploadVideo:ot,Consumption:Y},emits:["generate"],computed:{config(){return this.$store.state.luma?.config},consumption(){return ee(this.config,this.service?.metadata?.price)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$t={class:"flex flex-col h-full"},gt={class:"flex-1 overflow-y-auto p-[15px]"},vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function bt(e,o,p,h,w,y){const r=s("extend-from-input"),d=s("prompt-input"),c=s("custom-selector"),_=s("upload-video"),$=s("start-image-input"),l=s("end-image-input"),V=s("enhancement-selector"),L=s("loop-selector"),B=s("consumption"),G=s("font-awesome-icon"),P=s("el-button");return a(),m("div",$t,[n("div",gt,[e.config?.video_id||e.config?.video_url?(a(),k(r,{key:0,class:"mb-4"})):f("",!0),t(d,{class:"mb-4"}),e.config?.video_id?f("",!0):(a(),k(c,{key:1,class:"mb-4"})),e.config?.custom?(a(),k(_,{key:2,class:"mb-4"})):f("",!0),!(e.config?.video_id||e.config?.video_url)&&!e.config?.custom?(a(),k($,{key:3,class:"mb-4"})):f("",!0),t(l,{class:"mb-4"}),t(V,{class:"mb-4"}),t(L,{class:"mb-4"})]),n("div",vt,[t(B,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),k(P,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.extend")),1)]),_:1},8,["onClick"])):(a(),k(P,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(G,{icon:"fa-solid fa-magic",class:"mr-2"}),g(" "+i(e.$t("luma.button.generate")),1)]),_:1},8,["onClick"]))])])}const wt=b(ht,[["render",bt]]),yt=v({name:"TaskPreview",components:{ElImage:ne,CopyToClipboard:te,FontAwesomeIcon:S,ElAlert:se,VideoPlayer:M,ElTooltip:oe,ElButton:I},props:{modelValue:{type:Object,required:!0}},emits:["extend"],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{onExtend(e,o){console.debug("set config",o),this.$store.commit("luma/setConfig",{...this.$store.state.luma?.config,video_id:o.video_id,prompt:o.prompt,action:"extend",thumbnail_url:o.thumbnail_url,video_url:o.video_url}),this.$emit("extend")},onDownload(e){window.open(e,"_blank")}}}),kt={class:"preview"},Et={class:"left"},Vt={class:"main"},Ut={class:"bot"},St={class:"datetime"},It={class:"info"},Lt={key:0,class:"prompt mt-2"},Ct={key:0},Tt={key:1},jt={key:0,class:C({content:!0,failed:!0})},At={key:0,class:"mb-4"},Rt={key:1,class:C({operations:!0,"mt-2":!0,"mb-4":!0})},Gt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Pt={key:1,class:C({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Dt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Mt={key:2,class:C({content:!0})},Bt={class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Ot(e,o,p,h,w,y){const r=s("el-image"),d=s("video-player"),c=s("el-button"),_=s("el-tooltip"),$=s("font-awesome-icon"),l=s("copy-to-clipboard"),V=s("el-alert");return a(),m("div",kt,[n("div",Et,[t(r,{src:"https://cdn.acedata.cloud/ahjfwi.png",class:"avatar"})]),n("div",Vt,[n("div",Ut,[g(i(e.$t("luma.name.lumaBot"))+" ",1),n("span",St,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),n("div",It,[e.modelValue?.request?.prompt?(a(),m("p",Lt,[g(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?f("",!0):(a(),m("span",Ct," - ("+i(e.$t("luma.status.pending"))+") ",1)),e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("span",Tt," - ("+i(e.$t("luma.status.processing"))+") ",1)):f("",!0)])):f("",!0)]),e.modelValue?.response?.success===!0?(a(),m("div",jt,[e.modelValue.response.video_url?(a(),m("div",At,[t(d,{src:e.modelValue.response.video_url},null,8,["src"])])):f("",!0),e.modelValue?.response&&!e.config?.custom?(a(),m("div",Rt,[t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.extendVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[0]||(o[0]=z(L=>e.onExtend(L,e.modelValue?.response),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.extend")),1)]),_:1})]),_:1},8,["content"]),t(_,{class:"box-item",effect:"dark",content:e.$t("luma.message.downloadVideo"),placement:"top-start"},{default:u(()=>[t(c,{type:"info",size:"small",class:"btn-action",onClick:o[1]||(o[1]=z(L=>e.onDownload(e.modelValue?.response?.video_url),["stop"]))},{default:u(()=>[g(i(e.$t("luma.button.download")),1)]),_:1})]),_:1},8,["content"])])):f("",!0),t(V,{closable:!1,class:"mt-2 success"},{default:u(()=>[n("p",Gt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0),e.modelValue?.response?.state==="failed"||e.modelValue?.response?.success===!1?(a(),m("div",Pt,[t(V,{closable:!1,class:"failure"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",zt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])]),n("p",Dt,[t($,{icon:"fa-solid fa-circle-info",class:"mr-1"}),g(" "+i(e.$t("luma.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(l,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),n("p",Ft,[t($,{icon:"fa-solid fa-hashtag",class:"mr-1"}),g(" "+i(e.$t("luma.name.traceId"))+": "+i(e.modelValue?.trace_id)+" ",1),t(l,{content:e.modelValue?.response?.trace_id},null,8,["content"])])]),_:1})])):f("",!0),!e.modelValue?.response||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"?(a(),m("div",Mt,[t(V,{closable:!1,class:"info"},{template:u(()=>[t($,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),g(" "+i(e.$t("luma.name.failure")),1)]),default:u(()=>[n("p",Bt,[t($,{icon:"fa-solid fa-magic",class:"mr-1"}),g(" "+i(e.$t("luma.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(l,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):f("",!0)])])}const qt=b(yt,[["render",Ot],["__scopeId","data-v-1b4a59bc"]]),Nt=v({name:"RecentPanel",components:{BotPlaceholder:ae,TaskPreview:qt,NoTasks:Z},emits:["reach-top","extend"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Ht={key:0},Kt={key:1,class:"tasks w-full h-full overflow-y-auto"},xt={key:2,class:"w-full h-full flex items-center justify-center"};function Jt(e,o,p,h,w,y){const r=s("bot-placeholder"),d=s("task-preview"),c=s("no-tasks");return a(),m(D,null,[e.tasks?.items===void 0?(a(),m("div",Ht,[t(r)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),m("div",Kt,[(a(!0),m(D,null,K(e.tasks?.items,_=>(a(),k(d,{key:_.id,"model-value":_,onExtend:o[0]||(o[0]=$=>e.$emit("extend"))},null,8,["model-value"]))),128))])):f("",!0),e.tasks?.items?.length===0?(a(),m("div",xt,[t(c)])):f("",!0)],64)}const Qt=b(Nt,[["render",Jt]]),Wt="https://webhook.acedata.cloud/luma",Xt=v({name:"LumaIndex",components:{ConfigPanel:wt,Layout:ue,RecentPanel:Qt},inject:["initialized"],emits:["extend"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.luma?.status?.getApplications===Q.Request},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("luma/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("luma/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){console.debug("scrolling down"),setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:o=5,createdAtMin:p,createdAtMax:h}=e||{};console.debug("limit",o,"createdAtMin",p,"createdAtMax",h),await this.$store.dispatch("luma/getTasks",{limit:o,createdAtMin:p,createdAtMax:h})},async onGenerate(){const e={...this.config,callback_url:Wt},o=this.credential?.token;if(!o){console.error("no token specified");return}E.info(this.$t("luma.message.startingTask")),x.generate(e,{token:o}).then(()=>{E.success(this.$t("luma.message.startTaskSuccess"))}).catch(p=>{p?.response?.data?.error?.code===J?E.error(this.$t("luma.message.usedUp")):E.error(this.$t("luma.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Yt(e,o,p,h,w,y){const r=s("config-panel"),d=s("recent-panel"),c=s("layout");return a(),k(c,null,{config:u(()=>[t(r,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop,onExtend:o[0]||(o[0]=_=>e.$emit("extend"))},null,8,["onReachTop"])]),_:1})}const To=b(Xt,[["render",Yt]]);export{To as default};
@@ -1 +1 @@
1
- import{F as C}from"./index.es-BLCm9UT-.js";import{E as T}from"./index-Czog4o5z.js";import{E as q}from"./index-Cs65NgP9.js";import{d as v,h as k,b as r,t as a,k as t,r as G,j as u,l as o,o as n,eD as K,x as i,F as I,v as L,i as y,eE as H,eF as J,eG as Q,n as S,f as W,cf as M,D as _,y as $,eH as X,eI as Y,dA as Z,dw as x}from"./index-CLwJbfYs.js";import{E as R,a as P}from"./index-CLOiWNZO.js";import{I as U}from"./InfoIcon-htaT17q9.js";import{I as N}from"./ImagePreview-VnpfW9Pj.js";import{E as F}from"./index-Colfa9sv.js";import{E as V}from"./index-CQvuK-4v.js";import{C as ee,N as te}from"./NoTasks-DHdI1Frr.js";import{E as oe,a as se}from"./index-Cg60JDEK.js";import{E as O}from"./index-DHn59BRx.js";import{a as ne}from"./price-CZSDhLnN.js";import{C as le}from"./CopyToClipboard-CzE5Qyes.js";import{V as ae}from"./VideoPlayer-DCap_X2q.js";import{E as ie}from"./index-DITqxnfk.js";import{E as re}from"./index-DNuWNnk-.js";import{E as ce}from"./index-O2tEst1s.js";import{B as de}from"./BotPlaceholder-DKPNFbIr.js";import"./use-form-item-CRDWzFx1.js";import"./index-r5W6hzzQ.js";import"./index-DNzgGVij.js";import"./typescript-CoKqfRJS.js";import"./index-AT7DtKgl.js";import"./strings-WMZYwrQD.js";import"./castArray-CoJ3z4SB.js";import"./isEqual-DQdO_K1-.js";import"./_initCloneObject-iRvJrG7M.js";import"./debounce-CEE_CsrA.js";import"./_baseIteratee-Bk7QROEW.js";import"./index-Dc0-osYE.js";import"./index-D3gVuWw7.js";import"./_baseClone-B6o0klpv.js";import"./index-C1s2diPf.js";import"./vue-plyr-QZFBikSk.js";import"./index-MlWSSchD.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main flex flex-row flex-1"},me={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},fe={class:"result h-full p-[15px] flex-1 flex flex-col"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),l=o("el-drawer");return n(),r("div",ue,[a("div",me,[G(e.$slots,"config",{},void 0,!0)]),a("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=g=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(l,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=k(pe,[["render",ge],["__scopeId","data-v-fae64b48"]]),he=v({name:"ModelSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-5",label:"v1.5"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1",label:"v2.1"},{value:"kling-v2-1-master",label:"v2.1-Master"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=K)}}),$e={class:"field"},ve={class:"title font-bold"};function ke(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",$e,[a("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ke],["__scopeId","data-v-4a40b66a"]]),we=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]}},computed:{value:{get(){return this.$store.state.kling?.config?.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=H)}}),ye={class:"field"},Ve={class:"title font-bold"};function Ee(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ye,[a("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=k(we,[["render",Ee],["__scopeId","data-v-daa57765"]]),Se=v({name:"DurationSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5秒"},{value:10,label:"10秒"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=J)}}),Ce={class:"field"},Te={class:"title font-bold"};function Le(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ce,[a("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Le],["__scopeId","data-v-02112e2c"]]),Ae=v({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Q)}}),Ge={class:"text-sm font-bold mb-2 block"},Re={class:"items"},Pe=["onClick"],De={class:"name"};function je(e,s,m,f,b,w){return n(),r("div",null,[a("span",Ge,i(e.$t("kling.name.ratio")),1),a("div",Re,[(n(!0),r(I,null,L(e.options,(c,d)=>(n(),r("div",{key:d,class:S({active:e.active===d,item:!0}),onClick:l=>e.value=c.value},[a("div",{class:S(["preview",c.label])},[a("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),a("p",De,i(c.label),1)],10,Pe))),128))])])}const Me=k(Ae,[["render",je],["__scopeId","data-v-2601284f"]]),Ne=v({name:"StartImage",components:{ElUpload:F,ElButton:T,InfoIcon:U,FontAwesomeIcon:C,ImagePreview:N},emits:["change"],data(){return{fileList:[],uploadUrl:M()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Fe={class:"relative"},Oe={class:"flex justify-between"},Be={class:"flex justify-start items-center"},ze={class:"text-sm font-bold"};function qe(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Fe,[a("div",Oe,[a("div",Be,[a("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ke=k(Ne,[["render",qe],["__scopeId","data-v-e2205d5b"]]),He=v({name:"EndImage",components:{ElUpload:F,ElButton:T,ImagePreview:N,InfoIcon:U,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:M()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Je={class:"relative"},Qe={class:"flex justify-between"},We={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"};function Ye(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Je,[a("div",Qe,[a("div",We,[a("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ze=k(He,[["render",Ye],["__scopeId","data-v-caf87d80"]]),xe=v({name:"CfgScaleSelector",components:{ElSlider:se,InfoIcon:U,ElInputNumber:oe},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=X)}}),et={class:"flex justify-between"},tt={class:"flex justify-start items-center"},ot={class:"text-sm font-bold"},st={class:"flex justify-end items-center"},nt={class:"w-full"};function lt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),l=o("el-slider");return n(),r("div",null,[a("div",et,[a("div",tt,[a("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),a("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=g=>e.value=g),"controls-position":"right"},null,8,["modelValue"])])]),a("div",nt,[t(l,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=g=>e.value=g),min:0,max:1,step:.1},null,8,["modelValue"])])])}const at=k(xe,[["render",lt]]),it="",rt=v({name:"PromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=it)}}),ct={class:"field"},dt={class:"box"},pt={class:"title font-bold"};function ut(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ct,[a("div",dt,[a("h2",pt,i(e.$t("kling.name.prompt")),1),t(c,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const mt=k(rt,[["render",ut],["__scopeId","data-v-0e95dea6"]]),ft="",gt=v({name:"NegativePromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),_t={class:"field"},ht={class:"box"},$t={class:"title font-bold"};function vt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",_t,[a("div",ht,[a("h2",$t,i(e.$t("kling.name.negativePrompt")),1),t(c,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const kt=k(gt,[["render",vt],["__scopeId","data-v-dfc5338b"]]),bt=v({name:"ConfigPanel",components:{ElButton:T,Consumption:ee,FontAwesomeIcon:C,PromptInput:mt,NegativePromptInput:kt,ModelSelector:be,ModeSelector:Ie,DurationSelector:Ue,RatioSelector:Me,StartImage:Ke,CfgScaleSelector:at,EndImage:Ze},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return ne(this.config,this.service?.metadata?.price)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),wt={class:"flex flex-col h-full"},yt={class:"flex-1 overflow-y-auto p-[15px]"},Vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Et(e,s,m,f,b,w){const c=o("prompt-input"),d=o("model-selector"),l=o("ratio-selector"),g=o("start-image"),h=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),z=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",wt,[a("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(l,{class:"mb-4"}),t(g,{class:"mb-2"}),t(h,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),a("div",Vt,[t(z,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(n(),y(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(n(),y(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:ce,CopyToClipboard:le,FontAwesomeIcon:C,ElAlert:re,VideoPlayer:ae,ElTooltip:ie,ElButton:T},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Ct={class:"preview"},Tt={class:"left"},Lt={class:"main"},Ut={class:"bot"},At={class:"datetime"},Gt={class:"info"},Rt={key:0,class:"prompt mt-2"},Pt={key:0},Dt={key:1},jt={key:0,class:S({content:!0,failed:!0})},Mt={key:0,class:"mb-4"},Nt={key:1,class:S({operations:!0,"mt-2":!0})},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Bt={key:1,class:S({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Kt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ht={key:2,class:S({content:!0})},Jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Wt(e,s,m,f,b,w){const c=o("el-image"),d=o("video-player"),l=o("el-button"),g=o("el-tooltip"),h=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[a("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),a("div",Lt,[a("div",Ut,[_(i(e.$t("kling.name.klingBot"))+" ",1),a("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",Pt," - ("+i(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(n(),r("span",Dt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",jt,[e.modelValue?.response.video_url?(n(),r("div",Mt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Nt,[t(g,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(l,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response.video_url))},{default:u(()=>[_(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[a("p",Ft,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),a("p",Ot,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Bt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",zt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),a("p",qt,[t(h,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("kling.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Kt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Ht,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",Jt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Qt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Xt=k(St,[["render",Wt],["__scopeId","data-v-c0a171a2"]]),Yt=v({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:te,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Zt={key:0},xt={key:1,class:"h-full w-full overflow-y-auto tasks"},eo={key:2,class:"w-full h-full flex items-center justify-center"};function to(e,s,m,f,b,w){const c=o("bot-placeholder"),d=o("task-preview"),l=o("no-tasks");return n(),r(I,null,[e.tasks?.items===void 0?(n(),r("div",Zt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",xt,[(n(!0),r(I,null,L(e.tasks?.items,g=>(n(),y(d,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(l)])):$("",!0)],64)}const oo=k(Yt,[["render",to]]),so="https://webhook.acedata.cloud/kling",no=v({name:"KlingIndex",components:{ConfigPanel:It,Layout:_e,RecentPanel:oo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===x.Request},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:f}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",f),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:m,createdAtMax:f})},async onGenerate(){const e={...this.config,callback_url:so},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Y.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Z?V.error(this.$t("kling.message.usedUp")):V.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function lo(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),l=o("layout");return n(),y(l,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const zo=k(no,[["render",lo]]);export{zo as default};
1
+ import{F as C}from"./index.es-B6L7VFNr.js";import{E as T}from"./index-7746Wyq5.js";import{E as q}from"./index-CEpvbqDt.js";import{d as v,h as k,b as r,t as a,k as t,r as G,j as u,l as o,o as n,eD as K,x as i,F as I,v as L,i as y,eE as H,eF as J,eG as Q,n as S,f as W,cf as M,D as _,y as $,eH as X,eI as Y,dA as Z,dw as x}from"./index-BjMVMy9y.js";import{E as R,a as P}from"./index-BX6sU3GX.js";import{I as U}from"./InfoIcon-cglftkH2.js";import{I as N}from"./ImagePreview-D_L90Mc7.js";import{E as F}from"./index-BCo-Le3_.js";import{E as V}from"./index-ifdCUgG7.js";import{C as ee,N as te}from"./NoTasks-B6hLJrko.js";import{E as oe,a as se}from"./index-DvTCiu3P.js";import{E as O}from"./index-OiDdq1JS.js";import{a as ne}from"./price-CG10y7sa.js";import{C as le}from"./CopyToClipboard-C_xMmtDc.js";import{V as ae}from"./VideoPlayer-CjCdW8Fe.js";import{E as ie}from"./index-DulF_7UO.js";import{E as re}from"./index-Dagq6Y2s.js";import{E as ce}from"./index-Ckr3Af0G.js";import{B as de}from"./BotPlaceholder-BgP8q68w.js";import"./use-form-item-CZJno9cW.js";import"./index-r5W6hzzQ.js";import"./index-B-7UQmSa.js";import"./typescript-DXZhO2KE.js";import"./index-BzF_Ko5s.js";import"./strings-C0ATdFxF.js";import"./castArray-7tYrhn6A.js";import"./isEqual-Df5ippj8.js";import"./_initCloneObject-CwAtjxb1.js";import"./debounce-09KXX3DN.js";import"./_baseIteratee-7W3vde5j.js";import"./index-D19A578F.js";import"./index-WJgswFMW.js";import"./_baseClone-DiKhUhxc.js";import"./index-CQ2bsd-r.js";import"./vue-plyr-QZFBikSk.js";import"./index-bryRJW_X.js";const pe=v({name:"LayoutKling",components:{ElDrawer:q,ElButton:T,FontAwesomeIcon:C},data(){return{drawer:!1}}}),ue={class:"main flex flex-row flex-1"},me={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},fe={class:"result h-full p-[15px] flex-1 flex flex-col"};function ge(e,s,m,f,b,w){const c=o("font-awesome-icon"),d=o("el-button"),l=o("el-drawer");return n(),r("div",ue,[a("div",me,[G(e.$slots,"config",{},void 0,!0)]),a("div",fe,[G(e.$slots,"result",{},void 0,!0)]),t(d,{circle:"",class:"menu",onClick:s[0]||(s[0]=g=>e.drawer=!0)},{default:u(()=>[t(c,{icon:"fa-solid fa-magic"})]),_:1}),t(l,{modelValue:e.drawer,"onUpdate:modelValue":s[1]||(s[1]=g=>e.drawer=g),direction:"ltr","with-header":!1,size:"350px"},{default:u(()=>[G(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const _e=k(pe,[["render",ge],["__scopeId","data-v-fae64b48"]]),he=v({name:"ModelSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"kling-v1",label:"v1"},{value:"kling-v1-5",label:"v1.5"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v2-1",label:"v2.1"},{value:"kling-v2-1-master",label:"v2.1-Master"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.model},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}},mounted(){this.value||(this.value=K)}}),$e={class:"field"},ve={class:"title font-bold"};function ke(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",$e,[a("h2",ve,i(e.$t("pika.name.model")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const be=k(he,[["render",ke],["__scopeId","data-v-4a40b66a"]]),we=v({name:"ModeSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]}},computed:{value:{get(){return this.$store.state.kling?.config?.mode},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}},mounted(){this.value||(this.value=H)}}),ye={class:"field"},Ve={class:"title font-bold"};function Ee(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",ye,[a("h2",Ve,i(e.$t("kling.name.mode")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ie=k(we,[["render",Ee],["__scopeId","data-v-daa57765"]]),Se=v({name:"DurationSelector",components:{ElSelect:P,ElOption:R},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:5,label:"5秒"},{value:10,label:"10秒"}]}},computed:{value:{get(){return this.$store.state.kling?.config?.duration},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}},mounted(){this.value||(this.value=J)}}),Ce={class:"field"},Te={class:"title font-bold"};function Le(e,s,m,f,b,w){const c=o("el-option"),d=o("el-select");return n(),r("div",Ce,[a("h2",Te,i(e.$t("kling.name.duration")),1),t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=l=>e.value=l),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:u(()=>[(n(!0),r(I,null,L(e.options,l=>(n(),y(c,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Ue=k(Se,[["render",Le],["__scopeId","data-v-02112e2c"]]),Ae=v({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Q)}}),Ge={class:"text-sm font-bold mb-2 block"},Re={class:"items"},Pe=["onClick"],De={class:"name"};function je(e,s,m,f,b,w){return n(),r("div",null,[a("span",Ge,i(e.$t("kling.name.ratio")),1),a("div",Re,[(n(!0),r(I,null,L(e.options,(c,d)=>(n(),r("div",{key:d,class:S({active:e.active===d,item:!0}),onClick:l=>e.value=c.value},[a("div",{class:S(["preview",c.label])},[a("div",{class:"rect",style:W({width:c.width+"px",height:c.height+"px"})},null,4)],2),a("p",De,i(c.label),1)],10,Pe))),128))])])}const Me=k(Ae,[["render",je],["__scopeId","data-v-2601284f"]]),Ne=v({name:"StartImage",components:{ElUpload:F,ElButton:T,InfoIcon:U,FontAwesomeIcon:C,ImagePreview:N},emits:["change"],data(){return{fileList:[],uploadUrl:M()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Fe={class:"relative"},Oe={class:"flex justify-between"},Be={class:"flex justify-start items-center"},ze={class:"text-sm font-bold"};function qe(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Fe,[a("div",Oe,[a("div",Be,[a("span",ze,i(e.$t("kling.name.startImage")),1),t(c,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ke=k(Ne,[["render",qe],["__scopeId","data-v-e2205d5b"]]),He=v({name:"EndImage",components:{ElUpload:F,ElButton:T,ImagePreview:N,InfoIcon:U,FontAwesomeIcon:C},data(){return{fileList:[],uploadUrl:M()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onExceed(){V.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){V.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Je={class:"relative"},Qe={class:"flex justify-between"},We={class:"flex justify-start items-center"},Xe={class:"text-sm font-bold"};function Ye(e,s,m,f,b,w){const c=o("info-icon"),d=o("image-preview"),l=o("font-awesome-icon"),g=o("el-button"),h=o("el-upload");return n(),r("div",Je,[a("div",Qe,[a("div",We,[a("span",Xe,i(e.$t("kling.name.endImage")),1),t(c,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),t(h,{"file-list":e.fileList,"onUpdate:fileList":s[0]||(s[0]=p=>e.fileList=p),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:5,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:u(({file:p})=>[p.url&&p.percentage!==void 0?(n(),y(d,{key:0,url:p.url,name:p.name,percentage:p.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(p),1)},null,8,["url","name","percentage","onRemove"])):$("",!0)]),default:u(()=>[t(g,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:u(()=>[t(l,{icon:"fa-solid fa-upload",class:"icon mr-1"}),_(" "+i(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const Ze=k(He,[["render",Ye],["__scopeId","data-v-caf87d80"]]),xe=v({name:"CfgScaleSelector",components:{ElSlider:se,InfoIcon:U,ElInputNumber:oe},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=X)}}),et={class:"flex justify-between"},tt={class:"flex justify-start items-center"},ot={class:"text-sm font-bold"},st={class:"flex justify-end items-center"},nt={class:"w-full"};function lt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input-number"),l=o("el-slider");return n(),r("div",null,[a("div",et,[a("div",tt,[a("span",ot,i(e.$t("kling.name.cfgScale")),1),t(c,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),a("div",st,[t(d,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=g=>e.value=g),"controls-position":"right"},null,8,["modelValue"])])]),a("div",nt,[t(l,{modelValue:e.value,"onUpdate:modelValue":s[1]||(s[1]=g=>e.value=g),min:0,max:1,step:.1},null,8,["modelValue"])])])}const at=k(xe,[["render",lt]]),it="",rt=v({name:"PromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=it)}}),ct={class:"field"},dt={class:"box"},pt={class:"title font-bold"};function ut(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",ct,[a("div",dt,[a("h2",pt,i(e.$t("kling.name.prompt")),1),t(c,{content:e.$t("kling.description.prompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.prompt"),maxlength:500,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const mt=k(rt,[["render",ut],["__scopeId","data-v-0e95dea6"]]),ft="",gt=v({name:"NegativePromptInput",components:{ElInput:O,InfoIcon:U},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=ft)}}),_t={class:"field"},ht={class:"box"},$t={class:"title font-bold"};function vt(e,s,m,f,b,w){const c=o("info-icon"),d=o("el-input");return n(),r("div",_t,[a("div",ht,[a("h2",$t,i(e.$t("kling.name.negativePrompt")),1),t(c,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),t(d,{modelValue:e.prompt,"onUpdate:modelValue":s[0]||(s[0]=l=>e.prompt=l),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const kt=k(gt,[["render",vt],["__scopeId","data-v-dfc5338b"]]),bt=v({name:"ConfigPanel",components:{ElButton:T,Consumption:ee,FontAwesomeIcon:C,PromptInput:mt,NegativePromptInput:kt,ModelSelector:be,ModeSelector:Ie,DurationSelector:Ue,RatioSelector:Me,StartImage:Ke,CfgScaleSelector:at,EndImage:Ze},emits:["generate"],computed:{config(){return this.$store.state.kling?.config},consumption(){return ne(this.config,this.service?.metadata?.price)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),wt={class:"flex flex-col h-full"},yt={class:"flex-1 overflow-y-auto p-[15px]"},Vt={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function Et(e,s,m,f,b,w){const c=o("prompt-input"),d=o("model-selector"),l=o("ratio-selector"),g=o("start-image"),h=o("end-image"),p=o("duration-selector"),E=o("mode-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),z=o("consumption"),D=o("font-awesome-icon"),j=o("el-button");return n(),r("div",wt,[a("div",yt,[t(c,{class:"mb-4"}),t(d,{class:"mb-4"}),t(l,{class:"mb-4"}),t(g,{class:"mb-2"}),t(h,{class:"mb-2"}),t(p,{class:"mb-4"}),t(E,{class:"mb-4"}),t(A,{class:"mb-4"}),t(B,{class:"mb-4"})]),a("div",Vt,[t(z,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(n(),y(j,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(n(),y(j,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:u(()=>[t(D,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+i(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))])])}const It=k(bt,[["render",Et]]),St=v({name:"TaskPreview",components:{ElImage:ce,CopyToClipboard:le,FontAwesomeIcon:C,ElAlert:re,VideoPlayer:ae,ElTooltip:ie,ElButton:T},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config}},methods:{onDownload(e,s){e.stopPropagation(),console.log("on download"),window.open(s,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),Ct={class:"preview"},Tt={class:"left"},Lt={class:"main"},Ut={class:"bot"},At={class:"datetime"},Gt={class:"info"},Rt={key:0,class:"prompt mt-2"},Pt={key:0},Dt={key:1},jt={key:0,class:S({content:!0,failed:!0})},Mt={key:0,class:"mb-4"},Nt={key:1,class:S({operations:!0,"mt-2":!0})},Ft={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ot={class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Bt={key:1,class:S({content:!0})},zt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},qt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Kt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ht={key:2,class:S({content:!0})},Jt={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Qt={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Wt(e,s,m,f,b,w){const c=o("el-image"),d=o("video-player"),l=o("el-button"),g=o("el-tooltip"),h=o("font-awesome-icon"),p=o("copy-to-clipboard"),E=o("el-alert");return n(),r("div",Ct,[a("div",Tt,[t(c,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),a("div",Lt,[a("div",Ut,[_(i(e.$t("kling.name.klingBot"))+" ",1),a("span",At,i(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),a("div",Gt,[e.modelValue?.request?.prompt?(n(),r("p",Rt,[_(i(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?$("",!0):(n(),r("span",Pt," - ("+i(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(n(),r("span",Dt," - ("+i(e.$t("kling.status.processing"))+") ",1)):$("",!0)])):$("",!0)]),e.modelValue?.response?.success===!0?(n(),r("div",jt,[e.modelValue?.response.video_url?(n(),r("div",Mt,[t(d,{src:e.modelValue?.response.video_url},null,8,["src"])])):$("",!0),e.modelValue?.response.success?(n(),r("div",Nt,[t(g,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:u(()=>[e.modelValue?.response.video_url?(n(),y(l,{key:0,type:"info",size:"small",class:"btn-action",onClick:s[0]||(s[0]=A=>e.onDownload(A,e.modelValue?.response.video_url))},{default:u(()=>[_(i(e.$t("kling.button.download")),1)]),_:1})):$("",!0)]),_:1},8,["content"])])):$("",!0),t(E,{closable:!1,class:"mt-2 success"},{default:u(()=>[a("p",Ft,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.model"))+": "+i(e.modelValue?.request?.model),1)]),a("p",Ot,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])])]),_:1})])):$("",!0),e.modelValue?.response?.success===!1?(n(),r("div",Bt,[t(E,{closable:!1,class:"failure"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",zt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),a("p",qt,[t(h,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+i(e.$t("kling.name.failureReason"))+": "+i(e.modelValue?.response?.error?.message)+" ",1),t(p,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Kt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0),e.modelValue?.response?.success===void 0?(n(),r("div",Ht,[t(E,{closable:!1,class:"info"},{template:u(()=>[t(h,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+i(e.$t("kling.name.failure")),1)]),default:u(()=>[a("p",Jt,[t(h,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+i(e.$t("kling.name.taskId"))+": "+i(e.modelValue?.id)+" ",1),t(p,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(n(),r("p",Qt,[t(h,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+i(e.$t("kling.name.traceId"))+": "+i(e.modelValue?.response?.trace_id)+" ",1),t(p,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):$("",!0)]),_:1})])):$("",!0)])])}const Xt=k(St,[["render",Wt],["__scopeId","data-v-c0a171a2"]]),Yt=v({name:"RecentPanel",components:{TaskPreview:Xt,NoTasks:te,BotPlaceholder:de},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top reach-top reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),Zt={key:0},xt={key:1,class:"h-full w-full overflow-y-auto tasks"},eo={key:2,class:"w-full h-full flex items-center justify-center"};function to(e,s,m,f,b,w){const c=o("bot-placeholder"),d=o("task-preview"),l=o("no-tasks");return n(),r(I,null,[e.tasks?.items===void 0?(n(),r("div",Zt,[t(c)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(n(),r("div",xt,[(n(!0),r(I,null,L(e.tasks?.items,g=>(n(),y(d,{key:g.id,"model-value":g},null,8,["model-value"]))),128))])):$("",!0),e.tasks?.items?.length===0?(n(),r("div",eo,[t(l)])):$("",!0)],64)}const oo=k(Yt,[["render",to]]),so="https://webhook.acedata.cloud/kling",no=v({name:"KlingIndex",components:{ConfigPanel:It,Layout:_e,RecentPanel:oo},inject:["initialized"],data(){return{task:void 0,job:0}},computed:{loading(){return this.$store.state.kling?.status?.getApplications===x.Request},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},tasks(){return this.$store.state.kling.tasks}},watch:{tasks:{handler(e,s){e?.items?.length>s?.items?.length&&console.debug("new tasks detected")},deep:!0},initialized:{async handler(e){e&&(console.debug("layout initialized"),await this.onGetTasks(),await this.onScrollDown(),this.job=setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){clearInterval(this.job)},methods:{async onReachTop(){console.debug("reached top"),await this.onGetTasks({createdAtMax:this.tasks?.items?.[0]?.created_at})},async onGetService(){console.debug("start onGetService"),await this.$store.dispatch("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},500)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:s=5,createdAtMin:m,createdAtMax:f}=e||{};console.debug("limit",s,"createdAtMin",m,"createdAtMax",f),await this.$store.dispatch("kling/getTasks",{limit:s,createdAtMin:m,createdAtMax:f})},async onGenerate(){const e={...this.config,callback_url:so},s=this.credential?.token;if(!s){console.error("no token specified");return}V.info(this.$t("kling.message.startingTask")),Y.generate(e,{token:s}).then(()=>{V.success(this.$t("kling.message.startTaskSuccess"))}).catch(m=>{m?.response?.data?.error?.code===Z?V.error(this.$t("kling.message.usedUp")):V.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function lo(e,s,m,f,b,w){const c=o("config-panel"),d=o("recent-panel"),l=o("layout");return n(),y(l,null,{config:u(()=>[t(c,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:u(()=>[t(d,{onReachTop:e.onReachTop},null,8,["onReachTop"])]),_:1})}const zo=k(no,[["render",lo]]);export{zo as default};
@@ -1 +1 @@
1
- import{C}from"./CopyToClipboard-CzE5Qyes.js";import{d as I,dk as F,ed as T,ee as N,ef 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-CLwJbfYs.js";import{d as O,a as w,s as M}from"./distribution-pW96wtpU.js";import{g as q}from"./price-CZSDhLnN.js";import{F as R}from"./index.es-BLCm9UT-.js";import{E as z}from"./index-MlWSSchD.js";import{E as U,a as V}from"./index--xRF9A-K.js";import{E as A}from"./index-DITqxnfk.js";import{E as H,a as G,b as Q}from"./index-B_qlJ-la.js";import{E as j}from"./index-d2CvBCAu.js";import{E as W}from"./index-Czog4o5z.js";import{E as Y}from"./index-D3gVuWw7.js";import"./index-DNzgGVij.js";import"./typescript-CoKqfRJS.js";import"./index-AT7DtKgl.js";import"./_initCloneObject-iRvJrG7M.js";import"./isPlainObject-BsyTgoxK.js";import"./_baseIteratee-Bk7QROEW.js";import"./isEqual-DQdO_K1-.js";import"./castArray-CoJ3z4SB.js";import"./debounce-CEE_CsrA.js";import"./index-CGrkkZd-.js";import"./use-form-item-CRDWzFx1.js";import"./index-Dc0-osYE.js";import"./index-r5W6hzzQ.js";const J=I({name:"ConsoleDistributionList",components:{CopyToClipboard:C,FontAwesomeIcon:R,QrCode:F,ElProgress:Y,ElRow:Q,ElCol:G,ElButton:W,ElDivider:j,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}}}),K={class:"title"},X={key:1},Z={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",K,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",X,[e("div",Z,[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 de=B(J,[["render",Bt],["__scopeId","data-v-a8befdf2"]]);export{de as default};
1
+ import{C}from"./CopyToClipboard-C_xMmtDc.js";import{d as I,dk as F,ed as T,ee as N,ef 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-BjMVMy9y.js";import{d as O,a as w,s as M}from"./distribution-tLpcb6Nq.js";import{g as q}from"./price-CG10y7sa.js";import{F as R}from"./index.es-B6L7VFNr.js";import{E as z}from"./index-bryRJW_X.js";import{E as U,a as V}from"./index-BbDlaK5a.js";import{E as A}from"./index-DulF_7UO.js";import{E as H,a as G,b as Q}from"./index-DXfYQh0Z.js";import{E as j}from"./index-Bk6FKSGz.js";import{E as W}from"./index-7746Wyq5.js";import{E as Y}from"./index-WJgswFMW.js";import"./index-B-7UQmSa.js";import"./typescript-DXZhO2KE.js";import"./index-BzF_Ko5s.js";import"./_initCloneObject-CwAtjxb1.js";import"./isPlainObject-BF8_keIM.js";import"./_baseIteratee-7W3vde5j.js";import"./isEqual-Df5ippj8.js";import"./castArray-7tYrhn6A.js";import"./debounce-09KXX3DN.js";import"./index-CgDmoqKO.js";import"./use-form-item-CZJno9cW.js";import"./index-D19A578F.js";import"./index-r5W6hzzQ.js";const J=I({name:"ConsoleDistributionList",components:{CopyToClipboard:C,FontAwesomeIcon:R,QrCode:F,ElProgress:Y,ElRow:Q,ElCol:G,ElButton:W,ElDivider:j,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}}}),K={class:"title"},X={key:1},Z={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",K,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",X,[e("div",Z,[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 de=B(J,[["render",Bt],["__scopeId","data-v-a8befdf2"]]);export{de as default};
@@ -1 +1 @@
1
- import{F as K}from"./index.es-BLCm9UT-.js";import{E as Z}from"./index-Czog4o5z.js";import{E as de}from"./index-Cs65NgP9.js";import{as as pe,ay as me,bR as fe,at as ae,ci as he,_ as _e,d as b,a as $e,au as ve,c as F,bq as ge,bw as ye,aF as le,b as h,o as l,i as w,r as U,f as oe,e as V,j as $,bh as re,E as D,n as ke,g as we,h as E,t as r,k as s,l as c,fa as se,x as v,F as z,v as N,fb as H,cf as be,D as I,fc as Y,fd as Q,y as k,J as x,cW as ee,fe as B,b_ as Ce,dw as W,aq as P,ff as G,aw as Se,K as Ae,fg as Le,dn as Ee,dv as Ve}from"./index-CLwJbfYs.js";import{E as ce}from"./index-BU5-qzoD.js";import{E as je,a as Fe}from"./index-CLOiWNZO.js";import{I as M}from"./InfoIcon-htaT17q9.js";import{E as Te}from"./index-Colfa9sv.js";import{E as L}from"./index-CQvuK-4v.js";import{E as X}from"./index-DHn59BRx.js";import{E as Pe,a as ue}from"./index-Cg60JDEK.js";import{E as J}from"./index-O2tEst1s.js";import{C as Ie,N as Ue}from"./NoTasks-DHdI1Frr.js";import{a as ze}from"./price-CZSDhLnN.js";import{E as Re,a as De,b as Ge}from"./index-DTBHHHz_.js";import{E as Me}from"./index-DITqxnfk.js";import{E as Oe}from"./index-z-6wtqoM.js";import{E as Be,a as We}from"./index-MlWSSchD.js";import"./use-form-item-CRDWzFx1.js";import"./index-r5W6hzzQ.js";import"./index-AT7DtKgl.js";import"./index-DNzgGVij.js";import"./typescript-CoKqfRJS.js";import"./strings-WMZYwrQD.js";import"./castArray-CoJ3z4SB.js";import"./isEqual-DQdO_K1-.js";import"./_initCloneObject-iRvJrG7M.js";import"./debounce-CEE_CsrA.js";import"./_baseIteratee-Bk7QROEW.js";import"./index-Dc0-osYE.js";import"./index-D3gVuWw7.js";import"./_baseClone-B6o0klpv.js";import"./index-C1s2diPf.js";import"./dropdown-CfSu6_B-.js";const qe=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Ne={error:e=>e instanceof Event},He=b({name:"ElAvatar"}),Ke=b({...He,props:qe,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ve(!1),u=F(()=>{const{size:n,icon:m,shape:y}=i,f=[o.b()];return ge(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),y&&f.push(o.m(y)),f}),d=F(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ye(n)||""}):void 0}),p=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function _(n){a.value=!0,t("error",n)}return(n,m)=>(l(),h("span",{class:ke(V(u)),style:oe(V(d))},[(n.src||n.srcSet)&&!a.value?(l(),h("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(V(p)),onError:_},null,44,["src","alt","srcset"])):n.icon?(l(),w(V(D),{key:1},{default:$(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ze=_e(Ke,[["__file","avatar.vue"]]);const xe=we(Ze),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:Z,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main flex flex-row flex-1"},Ye={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},Qe={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},et={class:"preview h-full w-[300px] flex flex-col"};function tt(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),_=c("el-drawer");return l(),h("div",Je,[r("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),r("div",Qe,[U(e.$slots,"result",{},void 0,!0)]),r("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=E(Xe,[["render",tt],["__scopeId","data-v-6cc632e5"]]),st=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"},{label:this.$t("suno.model.model45plus"),value:"chirp-v4-5-plus"},{label:this.$t("suno.model.model5"),value:"chirp-v5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,a,u){const d=c("el-switch"),p=c("el-option"),_=c("el-select");return l(),h("div",nt,[r("h2",it,v(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(l(!0),h(z,null,N(e.options,n=>(l(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=E(st,[["render",at],["__scopeId","data-v-5ebe40d6"]]),rt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:Z,InfoIcon:M,FontAwesomeIcon:K},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),H.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),_=c("el-button"),n=c("el-upload");return l(),h("div",ct,[r("div",ut,[r("div",dt,[r("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=E(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ht="",_t=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:M},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},yt={class:"title font-bold"},kt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),_=c("el-input");return l(),h("div",$t,[r("div",vt,[r("div",gt,[r("h2",yt,v(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",kt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(_,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=E(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",At=b({name:"LyricInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),Lt={class:"field"},Et={class:"box"},Vt={class:"title font-bold"};function jt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Lt,[r("div",Et,[r("h2",Vt,v(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Ft=E(At,[["render",jt],["__scopeId","data-v-99dfded8"]]),Tt=b({name:"StyleInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},It={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Pt,[r("div",It,[r("h2",Ut,v(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Rt=E(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Dt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Mt={class:"title-container"},Ot={class:"title font-bold"};function Bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Gt,[r("div",Mt,[r("h2",Ot,v(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Wt=E(Dt,[["render",Bt],["__scopeId","data-v-ce70fe34"]]);function R(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const qt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:D,ElInputNumber:Pe,VideoPlay:Q,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Nt={class:"field"},Ht={class:"box"},Kt={class:"title font-bold"},Zt={class:"input-wrapper"},xt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Yt={class:"info"},Qt={class:"title"},eo={class:"style"};function to(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),_=c("video-pause"),n=c("el-icon"),m=c("video-play"),y=ee("loading");return l(),h("div",Nt,[r("div",Ht,[r("h2",Kt,v(e.$t("suno.name.extend")),1),r("div",Zt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",xt,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[x((l(),h("div",Xt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(_)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",Jt,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[y,!e.audio?.audio_url]]),r("div",Yt,[r("h2",Qt,v(e.audio?.title),1),r("p",eo,v(e.audio?.style),1)])])):k("",!0)])])}const oo=E(qt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:D,VideoPlay:Q,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function fo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),h("div",no,[r("div",io,[r("h2",ao,v(e.$t("suno.name.cover")),1)]),r("div",lo,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[x((l(),h("div",ro,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[s(_,null,{default:$(()=>[s(p)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[s(_,null,{default:$(()=>[s(n)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[m,!e.audio?.audio_url]]),r("div",uo,[r("h2",po,v(e.audio?.title),1),r("p",mo,v(e.audio?.style),1)])])):k("",!0)])])}const ho=E(so,[["render",fo],["__scopeId","data-v-06640216"]]),_o=b({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:Ft,StyleInput:Rt,TitleInput:Wt,ExtendFromInput:oo,CoverFromInput:ho,UploadAudio:ft,FontAwesomeIcon:K,ElButton:Z,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return ze(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function yo(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),_=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),y=c("title-input"),f=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),h("div",$o,[r("div",vo,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?k("",!0):(l(),w(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(m,{key:2,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(y,{key:3,class:"mb-4"})):k("",!0),e.config?.action==="extend"?(l(),w(f,{key:4,class:"mb-4"})):k("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):k("",!0)]),r("div",go,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const ko=E(_o,[["render",yo],["__scopeId","data-v-b9fab929"]]);var q={exports:{}},wo=q.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,y){var f=new XMLHttpRequest;f.open("GET",n),f.responseType="blob",f.onload=function(){_(f.response,m,y)},f.onerror=function(){console.error("could not download file")},f.send()}function a(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function u(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof B=="object"&&B.global===B?B:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),_=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,y){var f=d.URL||d.webkitURL,C=document.createElement("a");m=m||n.name||"download",C.download=m,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,m,y):u(C,C.target="_blank")):(C.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,y){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,y),m);else if(a(n))o(n,m,y);else{var f=document.createElement("a");f.href=n,f.target="_blank",setTimeout(function(){u(f)})}}:function(n,m,y,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,y);var C=n.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},A.readAsDataURL(n)}else{var O=d.URL||d.webkitURL,g=O.createObjectURL(n);f?f.location=g:location.href=g,f=null,setTimeout(function(){O.revokeObjectURL(g)},4e4)}});d.saveAs=_.saveAs=_,e.exports=_})}(q)),q.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:J,ElIcon:D,ElTooltip:Me,ElButton:Z,FontAwesomeIcon:K,VideoPlay:Q,VideoPause:Y,ElDropdown:Ge,ElDropdownMenu:De,ElDropdownItem:Re,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},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(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{Co.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Lo={class:"task"},Eo=["onClick"],Vo={class:"left"},jo=["onClick"],Fo=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Io={class:"title"},Uo={class:"style"},zo={class:"right"},Ro={class:"el-dropdown-link"},Do={class:"flex items-center min-w-[120px]"},Go={class:"el-dropdown-link"};function Mo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=c("el-button"),y=c("font-awesome-icon"),f=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),O=ee("loading");return l(),h("div",Lo,[(l(!0),h(z,null,N(e.audios,g=>(l(),h("div",{key:g.id,class:"audio",onClick:P(S=>e.onClick(g),["stop"])},[x((l(),h("div",Vo,[s(d,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(g),["stop"])},[s(_,null,{default:$(()=>[s(p)]),_:1})],8,jo)):k("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(g),["stop"])},[s(_,null,{default:$(()=>[s(n)]),_:1})],8,Fo)):k("",!0),g?.duration?(l(),h("div",To,v(e.useFormatDuring(g?.duration)),1)):k("",!0)])),[[O,!g?.audio_url]]),r("div",Po,[r("h2",Io,v(g?.title),1),r("p",Uo,v(g?.style),1)]),r("div",zo,[g?.audio_url?(l(),w(m,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):k("",!0),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[s(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(g)},{default:$(()=>[r("div",Do,[e.isFetchingVideoUrl?(l(),w(_,{key:0,class:"is-loading mr-2"},{default:$(()=>[s(C)]),_:1})):k("",!0),r("span",null,v(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,g?.audio_url),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Ro,[s(f,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(g.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):k("",!0),s(j,{onClick:P(S=>e.onCover(g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(g?.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Go,[s(f,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Eo))),128))])}const Oo=E(Ao,[["render",Mo]]),Bo={class:"player-slider"},Wo=b({__name:"PlayerSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,p)=>(l(),h("div",Bo,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=_=>i.value=_),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),qo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},Ho=["src"],Ko={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},xo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),h("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(qo)},null,8,Ho),r("div",Ko,[r("div",Zo,[r("div",xo,[r("span",null,v(i.value?.title||"Music"),1),r("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Yo={class:"flex justify-end items-center gap-x-2.5"},Qo={class:"text-xs"},es=b({__name:"PlayerAction",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),h("div",Yo,[r("span",Qo,v(V(R)(i.value))+" / "+v(V(R)(o.value)),1)]))}});var ts={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function os(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function ss(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var ns=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=os(),p=Se(ns,ts);return function(){var _=u.size,n=u.strokeWidth,m=u.strokeLinecap,y=u.strokeLinejoin,f=u.theme,C=u.fill,j=u.spin,T=ss(d,{size:_,strokeWidth:n,strokeLinecap:m,strokeLinejoin:y,theme:f,fill:C},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),j&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(T)])}}};return o}const is=te("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),as=te("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ls=te("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),rs={class:"player-volume flex flex-col items-center pt-2"},cs={class:"text-sm mt-3"},us=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),h("div",rs,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=p=>i.value=p),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",cs,v(i.value),1)]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=b({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),h("div",ds,[s(ie,{icon:o.value?.state==="playing"?V(is):V(as),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(V(Oe),{placement:"top",width:"50px",trigger:"click"},{reference:$(()=>[s(ie,{icon:V(ls),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},fs={class:"flex grow px-5 items-center"},hs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=b({__name:"Player",setup(e){return(t,i)=>(l(),h("div",ms,[s(Wo),r("div",fs,[r("div",hs,[s(Jo)]),r("div",_s,[s(ps)]),r("div",$s,[s(es)])])]))}}),gs=b({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:Be,TaskPreview:Oo,Player:vs,NoTasks:Ue},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),ys={key:0,class:"tasks"},ks={class:"left w-[70px] p-[10px] flex items-center"},ws={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},bs={key:2,class:"w-full flex-1 flex items-center justify-center"},Cs={class:"h-20"};function Ss(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),_=c("task-preview"),n=c("no-tasks"),m=c("player");return l(),h(z,null,[e.tasks?.items===void 0?(l(),h("div",ys,[(l(),h(z,null,N(3,y=>r("div",{key:y,class:"flex"},[r("div",ks,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",ws,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),h("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...y)=>e.onHandleScroll&&e.onHandleScroll(...y))},[(l(!0),h(z,null,N(e.tasks?.items,(y,f)=>(l(),w(_,{key:f,"model-value":y,class:"preview"},null,8,["model-value"]))),128))],32)):k("",!0),e.tasks?.items?.length===0?(l(),h("div",bs,[s(n)])):k("",!0),x(r("div",Cs,[s(m)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(gs,[["render",Ss]]),Ls=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:xe,ElIcon:D},computed:{audio(){return this.$store.state.suno?.audio}}}),Es={key:0,class:"size-full overflow-hidden"},Vs={class:"relative h-[300px]"},js={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Fs={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Ts={class:"p-4"},Ps={class:"flex items-center font-bold mb-2"},Is={class:"text-[var(--el-text-color-regular)] mb-2"},Us={class:"text-xs text-[var(--el-text-color-regular)]"},zs={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Rs={key:1,class:"w-full h-full"};function Ds(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),_=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),h("div",Es,[r("div",Vs,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:$(()=>[r("div",js,[s(p,{class:"text-3xl"},{default:$(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Fs,v(e.audio?.title),1)]),r("div",Ts,[r("div",Ps,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,v(e.audio?.title),1)]),r("p",Is,v(e.audio?.style),1),r("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),r("div",zs,[r("p",null,v(e.audio?.lyric),1)])])])):(l(),h("div",Rs))}const Gs=E(Ls,[["render",Ds]]),Ms="https://webhook.acedata.cloud/suno",Os=b({name:"SunoIndex",components:{Layout:ot,ConfigPanel:ko,RecentPanel:As,PreviewPanel:Gs},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(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ms},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Bs(e,t,i,o,a,u){const d=c("config-panel"),p=c("recent-panel"),_=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:$(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(_)]),_:1})}const Cn=E(Os,[["render",Bs],["__scopeId","data-v-f5721d95"]]);export{Cn as default};
1
+ import{F as K}from"./index.es-B6L7VFNr.js";import{E as Z}from"./index-7746Wyq5.js";import{E as de}from"./index-CEpvbqDt.js";import{as as pe,ay as me,bR as fe,at as ae,ci as he,_ as _e,d as b,a as $e,au as ve,c as F,bq as ge,bw as ye,aF as le,b as h,o as l,i as w,r as U,f as oe,e as V,j as $,bh as re,E as D,n as ke,g as we,h as E,t as r,k as s,l as c,fa as se,x as v,F as z,v as N,fb as H,cf as be,D as I,fc as Y,fd as Q,y as k,J as x,cW as ee,fe as B,b_ as Ce,dw as W,aq as P,ff as G,aw as Se,K as Ae,fg as Le,dn as Ee,dv as Ve}from"./index-BjMVMy9y.js";import{E as ce}from"./index-CCO_ODiz.js";import{E as je,a as Fe}from"./index-BX6sU3GX.js";import{I as M}from"./InfoIcon-cglftkH2.js";import{E as Te}from"./index-BCo-Le3_.js";import{E as L}from"./index-ifdCUgG7.js";import{E as X}from"./index-OiDdq1JS.js";import{E as Pe,a as ue}from"./index-DvTCiu3P.js";import{E as J}from"./index-Ckr3Af0G.js";import{C as Ie,N as Ue}from"./NoTasks-B6hLJrko.js";import{a as ze}from"./price-CG10y7sa.js";import{E as Re,a as De,b as Ge}from"./index-BQWF6H8D.js";import{E as Me}from"./index-DulF_7UO.js";import{E as Oe}from"./index-BAMr6BWr.js";import{E as Be,a as We}from"./index-bryRJW_X.js";import"./use-form-item-CZJno9cW.js";import"./index-r5W6hzzQ.js";import"./index-BzF_Ko5s.js";import"./index-B-7UQmSa.js";import"./typescript-DXZhO2KE.js";import"./strings-C0ATdFxF.js";import"./castArray-7tYrhn6A.js";import"./isEqual-Df5ippj8.js";import"./_initCloneObject-CwAtjxb1.js";import"./debounce-09KXX3DN.js";import"./_baseIteratee-7W3vde5j.js";import"./index-D19A578F.js";import"./index-WJgswFMW.js";import"./_baseClone-DiKhUhxc.js";import"./index-CQ2bsd-r.js";import"./dropdown-UbXA6R_N.js";const qe=pe({size:{type:[Number,String],values:he,default:"",validator:e=>ae(e)},shape:{type:String,values:["circle","square"],default:"circle"},icon:{type:fe},src:{type:String,default:""},alt:String,srcSet:String,fit:{type:me(String),default:"cover"}}),Ne={error:e=>e instanceof Event},He=b({name:"ElAvatar"}),Ke=b({...He,props:qe,emits:Ne,setup(e,{emit:t}){const i=e,o=$e("avatar"),a=ve(!1),u=F(()=>{const{size:n,icon:m,shape:y}=i,f=[o.b()];return ge(n)&&f.push(o.m(n)),m&&f.push(o.m("icon")),y&&f.push(o.m(y)),f}),d=F(()=>{const{size:n}=i;return ae(n)?o.cssVarBlock({size:ye(n)||""}):void 0}),p=F(()=>({objectFit:i.fit}));le(()=>i.src,()=>a.value=!1);function _(n){a.value=!0,t("error",n)}return(n,m)=>(l(),h("span",{class:ke(V(u)),style:oe(V(d))},[(n.src||n.srcSet)&&!a.value?(l(),h("img",{key:0,src:n.src,alt:n.alt,srcset:n.srcSet,style:oe(V(p)),onError:_},null,44,["src","alt","srcset"])):n.icon?(l(),w(V(D),{key:1},{default:$(()=>[(l(),w(re(n.icon)))]),_:1})):U(n.$slots,"default",{key:2})],6))}});var Ze=_e(Ke,[["__file","avatar.vue"]]);const xe=we(Ze),Xe=b({name:"LayoutSuno",components:{ElDrawer:de,ElButton:Z,FontAwesomeIcon:K},data(){return{drawer:!1,preview:!1}},computed:{}}),Je={class:"main flex flex-row flex-1"},Ye={class:"config w-[300px] h-full overflow-y-scroll border-r border-[var(--el-border-color)]"},Qe={class:"result h-full flex flex-col flex-1 border-r border-[var(--el-border-color)]"},et={class:"preview h-full w-[300px] flex flex-col"};function tt(e,t,i,o,a,u){const d=c("font-awesome-icon"),p=c("el-button"),_=c("el-drawer");return l(),h("div",Je,[r("div",Ye,[U(e.$slots,"config",{},void 0,!0)]),r("div",Qe,[U(e.$slots,"result",{},void 0,!0)]),r("div",et,[U(e.$slots,"preview",{},void 0,!0)]),s(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=n=>e.drawer=!0)},{default:$(()=>[s(d,{icon:"fa-solid fa-magic"})]),_:1}),s(_,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=n=>e.drawer=n),direction:"ltr","with-header":!1,size:"340px",class:"drawer"},{default:$(()=>[U(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const ot=E(Xe,[["render",tt],["__scopeId","data-v-6cc632e5"]]),st=b({name:"VersionSelector",components:{ElSelect:Fe,ElOption:je,ElSwitch:ce},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{label:this.$t("suno.model.model1"),value:"chirp-v2-xxl-alpha"},{label:this.$t("suno.model.model2"),value:"chirp-v3-0"},{label:this.$t("suno.model.model3"),value:"chirp-v3-5"},{label:this.$t("suno.model.model4"),value:"chirp-v4"},{label:this.$t("suno.model.model45"),value:"chirp-v4-5"},{label:this.$t("suno.model.model45plus"),value:"chirp-v4-5-plus"},{label:this.$t("suno.model.model5"),value:"chirp-v5"}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom},set(e){console.debug("set custom",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,custom:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){console.debug("set model",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||(console.debug("set default type",se),this.model=se)}}),nt={class:"field"},it={class:"title font-bold"};function at(e,t,i,o,a,u){const d=c("el-switch"),p=c("el-option"),_=c("el-select");return l(),h("div",nt,[r("h2",it,v(e.$t("suno.name.type")),1),s(d,{modelValue:e.custom,"onUpdate:modelValue":t[0]||(t[0]=n=>e.custom=n),class:"value"},null,8,["modelValue"]),s(_,{modelValue:e.model,"onUpdate:modelValue":t[1]||(t[1]=n=>e.model=n),class:"value",placeholder:e.$t("suno.placeholder.select")},{default:$(()=>[(l(!0),h(z,null,N(e.options,n=>(l(),w(p,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const lt=E(st,[["render",at],["__scopeId","data-v-5ebe40d6"]]),rt=b({name:"UploadAudio",components:{ElUpload:Te,ElButton:Z,InfoIcon:M,FontAwesomeIcon:K},emits:["change"],data(){return{fileList:[],uploadUrl:be()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}}},watch:{urls:{handler(e){this.$emit("change",e)}}},mounted(){this.value||(this.value=void 0),this.onSetAudio()},methods:{onExceed(){L.warning(this.$t("suno.message.uploadReferencesExceed"))},onError(){L.error(this.$t("suno.message.uploadReferencesError"))},async onSuccess(){const e=this.urls?.[0];await this.onGenerateAudioId(e)},async onGenerateAudioId(e){const t={audio_url:e},i=this.credential?.token;if(!i){console.error("no token specified");return}L.info(this.$t("suno.message.startingUploadAudio")),H.upload(t,{token:i}).then(o=>{console.debug("get upload music success",o.data);const a=o.data?.data.audio_id;this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,audio_id:a,action:"upload_extend"}),L.success(this.$t("suno.message.startUploadAudioSuccess"))}).catch(o=>{L.error(o?.response?.data?.error?.message||this.$t("suno.message.startUploadAudioFailed"))})},onSetAudio(){}}}),ct={class:"relative"},ut={class:"flex justify-between"},dt={class:"flex justify-start items-center"},pt={class:"text-sm font-bold"};function mt(e,t,i,o,a,u){const d=c("info-icon"),p=c("font-awesome-icon"),_=c("el-button"),n=c("el-upload");return l(),h("div",ct,[r("div",ut,[r("div",dt,[r("span",pt,v(e.$t("suno.name.referenceAudios")),1),s(d,{content:e.$t("suno.description.uploadAudios")},null,8,["content"])])]),s(n,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=m=>e.fileList=m),name:"file",limit:1,class:"upload-wrapper",action:e.uploadUrl,accept:".mp3","show-file-list":!0,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{default:$(()=>[s(_,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:$(()=>[s(p,{icon:"fa-solid fa-upload",class:"icon mr-1"}),I(" "+v(e.$t("suno.button.uploadAudios")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const ft=E(rt,[["render",mt],["__scopeId","data-v-6236152c"]]),ht="",_t=b({name:"PromptInput",components:{ElInput:X,ElSwitch:ce,InfoIcon:M},data(){return{}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){console.debug("set prompt",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,prompt:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}},mounted(){this.prompt||(this.prompt=ht)}}),$t={class:"field"},vt={class:"box"},gt={class:"title-info"},yt={class:"title font-bold"},kt={class:"instrumental"},wt={class:"title inline-block"};function bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-switch"),_=c("el-input");return l(),h("div",$t,[r("div",vt,[r("div",gt,[r("h2",yt,v(e.$t("suno.name.prompt")),1),s(d,{content:e.$t("suno.description.prompt"),class:"info"},null,8,["content"])]),r("div",kt,[s(p,{modelValue:e.instrumental,"onUpdate:modelValue":t[0]||(t[0]=n=>e.instrumental=n),class:"value mr-2"},null,8,["modelValue"]),r("h2",wt,v(e.$t("suno.name.instrumental")),1)])]),s(_,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=n=>e.prompt=n),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("suno.placeholder.prompt"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Ct=E(_t,[["render",bt],["__scopeId","data-v-d7004a7c"]]),St="",At=b({name:"LyricInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){console.debug("set lyric",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config}},mounted(){this.lyric||(this.lyric=St)}}),Lt={class:"field"},Et={class:"box"},Vt={class:"title font-bold"};function jt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Lt,[r("div",Et,[r("h2",Vt,v(e.$t("suno.name.lyrics")),1),s(d,{content:e.$t("suno.description.lyrics"),class:"info"},null,8,["content"])]),e.config?.action!=="extend"?(l(),w(p,{key:0,modelValue:e.lyric,"onUpdate:modelValue":t[0]||(t[0]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"])):(l(),w(p,{key:1,modelValue:e.lyric,"onUpdate:modelValue":t[1]||(t[1]=_=>e.lyric=_),rows:3,type:"textarea",class:"lyrics",placeholder:e.$t("suno.placeholder.extend.lyrics"),maxlength:3e3,"show-word-limit":""},null,8,["modelValue","placeholder"]))])}const Ft=E(At,[["render",jt],["__scopeId","data-v-99dfded8"]]),Tt=b({name:"StyleInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){console.debug("set style",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,style:e})}},config(){return this.$store.state.suno?.config}}}),Pt={class:"field"},It={class:"title-container"},Ut={class:"titlefont-bold"};function zt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Pt,[r("div",It,[r("h2",Ut,v(e.$t("suno.name.style")),1),s(d,{content:e.$t("suno.description.style"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.style,"onUpdate:modelValue":t[0]||(t[0]=_=>e.style=_),rows:3,type:"textarea",class:"style",placeholder:e.$t("suno.placeholder.style"),maxlength:200,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Rt=E(Tt,[["render",zt],["__scopeId","data-v-85bbfcaa"]]),Dt=b({name:"TitleInput",components:{ElInput:X,InfoIcon:M},data(){return{}},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){console.debug("set title",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,title:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental},set(e){console.debug("set instrumental",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,instrumental:e})}}}}),Gt={class:"field"},Mt={class:"title-container"},Ot={class:"title font-bold"};function Bt(e,t,i,o,a,u){const d=c("info-icon"),p=c("el-input");return l(),h("div",Gt,[r("div",Mt,[r("h2",Ot,v(e.$t("suno.name.title")),1),s(d,{content:e.$t("suno.description.title"),class:"info"},null,8,["content"])]),s(p,{modelValue:e.title,"onUpdate:modelValue":t[0]||(t[0]=_=>e.title=_),rows:3,type:"textarea",class:"title",placeholder:e.$t("suno.placeholder.title"),maxlength:80,"show-word-limit":""},null,8,["modelValue","placeholder"])])}const Wt=E(Dt,[["render",Bt],["__scopeId","data-v-ce70fe34"]]);function R(e){const t=Math.floor(e)%60;e=Math.floor(e/60);const i=e%60,o=i<10?`0${i}`:i,a=t<10?`0${t}`:t;return o+":"+a}const qt=b({name:"ExtendFromInput",components:{ElImage:J,ElIcon:D,ElInputNumber:Pe,VideoPlay:Q,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),Nt={class:"field"},Ht={class:"box"},Kt={class:"title font-bold"},Zt={class:"input-wrapper"},xt={class:"task"},Xt={class:"left"},Jt={key:2,class:"duration"},Yt={class:"info"},Qt={class:"title"},eo={class:"style"};function to(e,t,i,o,a,u){const d=c("el-input-number"),p=c("el-image"),_=c("video-pause"),n=c("el-icon"),m=c("video-play"),y=ee("loading");return l(),h("div",Nt,[r("div",Ht,[r("h2",Kt,v(e.$t("suno.name.extend")),1),r("div",Zt,[s(d,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value=f),class:"value",min:0,max:e.audio?.duration,controls:!1,placeholder:e.$t("suno.placeholder.extend.continue_at"),onChange:e.handleChange},null,8,["modelValue","max","placeholder","onChange"])])]),r("div",xt,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[3]||(t[3]=f=>e.onClick(e.audio))},[x((l(),h("div",Xt,[s(p,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[1]||(t[1]=f=>e.onPause(e.audio))},[s(n,null,{default:$(()=>[s(_)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:t[2]||(t[2]=f=>e.onPlay(e.audio))},[s(n,null,{default:$(()=>[s(m)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",Jt,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[y,!e.audio?.audio_url]]),r("div",Yt,[r("h2",Qt,v(e.audio?.title),1),r("p",eo,v(e.audio?.style),1)])])):k("",!0)])])}const oo=E(qt,[["render",to],["__scopeId","data-v-bcce4821"]]),so=b({name:"CoverFromInput",components:{ElImage:J,ElIcon:D,VideoPlay:Q,VideoPause:Y},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug("set continue_at",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||(this.value=void 0)},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),no={class:"field"},io={class:"box"},ao={class:"title font-bold"},lo={class:"task"},ro={class:"left"},co={key:2,class:"duration"},uo={class:"info"},po={class:"title"},mo={class:"style"};function fo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=ee("loading");return l(),h("div",no,[r("div",io,[r("h2",ao,v(e.$t("suno.name.cover")),1)]),r("div",lo,[e.audio?(l(),h("div",{key:0,class:"audio",onClick:t[2]||(t[2]=y=>e.onClick(e.audio))},[x((l(),h("div",ro,[s(d,{src:e.audio?.image_url,class:"cover",fit:"cover"},null,8,["src"]),e.audio?.audio_url&&e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:t[0]||(t[0]=y=>e.onPause(e.audio))},[s(_,null,{default:$(()=>[s(p)]),_:1})])):k("",!0),e.audio?.audio_url&&(e.$store.state?.suno?.audio?.id!==e.audio.id||e.$store.state?.suno?.audio?.id===e.audio.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:t[1]||(t[1]=y=>e.onPlay(e.audio))},[s(_,null,{default:$(()=>[s(n)]),_:1})])):k("",!0),e.audio?.duration?(l(),h("div",co,v(e.useFormatDuring(e.audio?.duration)),1)):k("",!0)])),[[m,!e.audio?.audio_url]]),r("div",uo,[r("h2",po,v(e.audio?.title),1),r("p",mo,v(e.audio?.style),1)])])):k("",!0)])])}const ho=E(so,[["render",fo],["__scopeId","data-v-06640216"]]),_o=b({name:"PresetPanel",components:{TypeSelector:lt,PromptInput:Ct,LyricInput:Ft,StyleInput:Rt,TitleInput:Wt,ExtendFromInput:oo,CoverFromInput:ho,UploadAudio:ft,FontAwesomeIcon:K,ElButton:Z,Consumption:Ie},emits:["generate"],computed:{config(){return this.$store.state.suno?.config},consumption(){return ze(this.config,this.service?.metadata?.price)},service(){return this.$store.state.suno?.service}},methods:{onGenerate(){this.$emit("generate")}}}),$o={class:"flex flex-col h-full"},vo={class:"flex-1 overflow-y-auto p-[15px]"},go={class:"flex flex-col items-center justify-center px-[15px] pb-[15px]"};function yo(e,t,i,o,a,u){const d=c("type-selector"),p=c("upload-audio"),_=c("prompt-input"),n=c("lyric-input"),m=c("style-input"),y=c("title-input"),f=c("extend-from-input"),C=c("cover-from-input"),j=c("consumption"),T=c("font-awesome-icon"),A=c("el-button");return l(),h("div",$o,[r("div",vo,[s(d,{class:"mb-4"}),s(p,{class:"mb-4"}),e.config?.custom?k("",!0):(l(),w(_,{key:0,class:"mb-4"})),e.config?.custom&&!e.config.instrumental?(l(),w(n,{key:1,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(m,{key:2,class:"mb-4"})):k("",!0),e.config?.custom?(l(),w(y,{key:3,class:"mb-4"})):k("",!0),e.config?.action==="extend"?(l(),w(f,{key:4,class:"mb-4"})):k("",!0),e.config?.action==="cover"?(l(),w(C,{key:5,class:"mb-4"})):k("",!0)]),r("div",go,[s(j,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.action!=="extend"?(l(),w(A,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.generate")),1)]),_:1},8,["onClick"])):(l(),w(A,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:$(()=>[s(T,{icon:"fa-solid fa-magic",class:"mr-2"}),I(" "+v(e.$t("suno.button.extend")),1)]),_:1},8,["onClick"]))])])}const ko=E(_o,[["render",yo],["__scopeId","data-v-b9fab929"]]);var q={exports:{}},wo=q.exports,ne;function bo(){return ne||(ne=1,function(e,t){(function(i,o){o()})(wo,function(){function i(n,m){return typeof m>"u"?m={autoBom:!1}:typeof m!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),m={autoBom:!m}),m.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n}function o(n,m,y){var f=new XMLHttpRequest;f.open("GET",n),f.responseType="blob",f.onload=function(){_(f.response,m,y)},f.onerror=function(){console.error("could not download file")},f.send()}function a(n){var m=new XMLHttpRequest;m.open("HEAD",n,!1);try{m.send()}catch{}return 200<=m.status&&299>=m.status}function u(n){try{n.dispatchEvent(new MouseEvent("click"))}catch{var m=document.createEvent("MouseEvents");m.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),n.dispatchEvent(m)}}var d=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof B=="object"&&B.global===B?B:void 0,p=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),_=d.saveAs||(typeof window!="object"||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!p?function(n,m,y){var f=d.URL||d.webkitURL,C=document.createElement("a");m=m||n.name||"download",C.download=m,C.rel="noopener",typeof n=="string"?(C.href=n,C.origin===location.origin?u(C):a(C.href)?o(n,m,y):u(C,C.target="_blank")):(C.href=f.createObjectURL(n),setTimeout(function(){f.revokeObjectURL(C.href)},4e4),setTimeout(function(){u(C)},0))}:"msSaveOrOpenBlob"in navigator?function(n,m,y){if(m=m||n.name||"download",typeof n!="string")navigator.msSaveOrOpenBlob(i(n,y),m);else if(a(n))o(n,m,y);else{var f=document.createElement("a");f.href=n,f.target="_blank",setTimeout(function(){u(f)})}}:function(n,m,y,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof n=="string")return o(n,m,y);var C=n.type==="application/octet-stream",j=/constructor/i.test(d.HTMLElement)||d.safari,T=/CriOS\/[\d]+/.test(navigator.userAgent);if((T||C&&j||p)&&typeof FileReader<"u"){var A=new FileReader;A.onloadend=function(){var S=A.result;S=T?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=S:location=S,f=null},A.readAsDataURL(n)}else{var O=d.URL||d.webkitURL,g=O.createObjectURL(n);f?f.location=g:location.href=g,f=null,setTimeout(function(){O.revokeObjectURL(g)},4e4)}});d.saveAs=_.saveAs=_,e.exports=_})}(q)),q.exports}var Co=bo();const So="https://webhook.acedata.cloud/suno",Ao=b({name:"TaskPreview",components:{ElImage:J,ElIcon:D,ElTooltip:Me,ElButton:Z,FontAwesomeIcon:K,VideoPlay:Q,VideoPause:Y,ElDropdown:Ge,ElDropdownMenu:De,ElDropdownItem:Re,Loading:Ce},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1}},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(){const e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(i=>({...i,action:t})):e},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active}},methods:{useFormatDuring:R,onPlay(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"playing"}),console.log("on play")},onPause(e){this.$store.dispatch("suno/setAudio",{...this.$store.state.suno.audio,...e,state:"paused"}),console.log("on pause")},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e.stopPropagation(),console.log("on extend"),console.debug("set config",t),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:"extend",audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e.stopPropagation(),console.log("on download",t);const o=new URL(t).pathname,a=o.substring(o.lastIndexOf("/")+1);console.log("on preview",a),fetch(t).then(u=>u.blob()).then(u=>{Co.saveAs(u,a)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;const t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(t){console.error("get videoUrl failed:",t),L.error(this.$t("suno.message.getVideoUrlFailed"))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,i)=>{const o={audio_id:e},a=this.credential?.token;if(!a){console.error("no token specified"),i(new Error("No token specified"));return}H.mp4(o,{token:a}).then(u=>{const d=u.data?.data?.video_url;d?t(d):i(new Error("Video URL not found in response"))}).catch(u=>{i(u)})})},onPreview(e,t){e.stopPropagation(),console.log("on preview",t),window.open(t,"_blank")},async onGetStems(e){await this.onGenerateAudioUrl("stems",e)},onCover(e){console.log("on cover"),console.debug("set config",e),this.$store.commit("suno/setConfig",{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:"cover",audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl("concat",e)},async onGenerateAudioUrl(e,t){const i={action:e,audio_id:t,callback_url:So},o=this.credential?.token;if(!o){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(i,{token:o}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(a=>{L.error(a?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".tasks");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug("loading");return}await this.$store.dispatch("suno/getTasks",{limit:30,offset:0})}}}),Lo={class:"task"},Eo=["onClick"],Vo={class:"left"},jo=["onClick"],Fo=["onClick"],To={key:2,class:"duration"},Po={class:"info"},Io={class:"title"},Uo={class:"style"},zo={class:"right"},Ro={class:"el-dropdown-link"},Do={class:"flex items-center min-w-[120px]"},Go={class:"el-dropdown-link"};function Mo(e,t,i,o,a,u){const d=c("el-image"),p=c("video-pause"),_=c("el-icon"),n=c("video-play"),m=c("el-button"),y=c("font-awesome-icon"),f=c("el-tooltip"),C=c("Loading"),j=c("el-dropdown-item"),T=c("el-dropdown-menu"),A=c("el-dropdown"),O=ee("loading");return l(),h("div",Lo,[(l(!0),h(z,null,N(e.audios,g=>(l(),h("div",{key:g.id,class:"audio",onClick:P(S=>e.onClick(g),["stop"])},[x((l(),h("div",Vo,[s(d,{src:g?.image_url,class:"cover",fit:"cover",lazy:""},null,8,["src"]),g?.audio_url&&e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="playing"?(l(),h("div",{key:0,class:"overlay",onClick:P(S=>e.onPause(g),["stop"])},[s(_,null,{default:$(()=>[s(p)]),_:1})],8,jo)):k("",!0),g?.audio_url&&(e.$store.state?.suno?.audio?.id!==g.id||e.$store.state?.suno?.audio?.id===g.id&&e.$store.state?.suno?.audio?.state==="paused")?(l(),h("div",{key:1,class:"overlay",onClick:P(S=>e.onPlay(g),["stop"])},[s(_,null,{default:$(()=>[s(n)]),_:1})],8,Fo)):k("",!0),g?.duration?(l(),h("div",To,v(e.useFormatDuring(g?.duration)),1)):k("",!0)])),[[O,!g?.audio_url]]),r("div",Po,[r("h2",Io,v(g?.title),1),r("p",Uo,v(g?.style),1)]),r("div",zo,[g?.audio_url?(l(),w(m,{key:0,size:"small",round:"",onClick:P(S=>e.onExtend(S,g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.extend")),1)]),_:2},1032,["onClick"])):k("",!0),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[s(j,{disabled:e.isFetchingVideoUrl,onClick:S=>e.handleVideoDownload(g)},{default:$(()=>[r("div",Do,[e.isFetchingVideoUrl?(l(),w(_,{key:0,class:"is-loading mr-2"},{default:$(()=>[s(C)]),_:1})):k("",!0),r("span",null,v(e.$t("suno.button.download_video")),1)])]),_:2},1032,["disabled","onClick"]),g?.audio_url?(l(),w(j,{key:0,onClick:P(S=>e.onDownload(S,g?.audio_url),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.download_audio")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Ro,[s(f,{effect:"dark",content:e.$t("suno.button.download"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-download",class:"icon icon-download"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024),s(A,null,{dropdown:$(()=>[s(T,null,{default:$(()=>[g.id?(l(),w(j,{key:0,onClick:P(S=>e.onGetStems(g.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.get_stems")),1)]),_:2},1032,["onClick"])):k("",!0),s(j,{onClick:P(S=>e.onCover(g),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.cover_music")),1)]),_:2},1032,["onClick"]),g?.id&&g?.action==="extend"?(l(),w(j,{key:1,onClick:P(S=>e.onConcatMusic(g?.id),["stop"])},{default:$(()=>[I(v(e.$t("suno.button.concat_music")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:2},1024)]),default:$(()=>[r("span",Go,[s(f,{effect:"dark",content:e.$t("suno.button.more"),placement:"top"},{default:$(()=>[g?.audio_url||g?.video_url?(l(),w(y,{key:0,icon:"fa-solid fa-ellipsis",class:"icon icon-ellipsis"})):k("",!0)]),_:2},1032,["content"])])]),_:2},1024)])],8,Eo))),128))])}const Oo=E(Ao,[["render",Mo]]),Bo={class:"player-slider"},Wo=b({__name:"PlayerSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:d})}),o=F({get:()=>t.state.suno?.audio?.duration,set:d=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:d})}),a=()=>{},u=d=>t.dispatch("suno/setAudio",{...t.state.suno.audio,progress:d});return(d,p)=>(l(),h("div",Bo,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=_=>i.value=_),"show-tooltip":!1,min:0,max:o.value,onChange:u,onInput:a},null,8,["modelValue","max"])]))}}),qo="/assets/disk-XFRmVAfp.png",No={class:"flex player-song"},Ho=["src"],Ko={class:"ml-2 text-xs flex flex-col justify-between"},Zo={class:"w-52 2xl:w-96 cursor-pointer truncate"},xo={class:"flex"},Xo={class:"ml-2 text-dc"},Jo=b({__name:"PlayerSong",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio,set:o=>t.commit("suno/setAudio",o)});return le(i,(o,a)=>{if(o?.audio_url!==a?.audio_url){console.log("audio changed",o),o.object&&(console.log("111",o.object),o.object.pause(),delete o.object);const u=new Audio(o.audio_url);o.state==="playing"?u.play():u.pause(),u.addEventListener("loadedmetadata",()=>{u.currentTime=0,u.addEventListener("timeupdate",()=>{t.commit("suno/setAudio",{...t.state.suno.audio,progress:u.currentTime})})}),t.commit("suno/setAudio",{...t.state.suno.audio,object:u})}else if(o?.progress!==a?.progress&&Math.abs(o.progress-o.object.currentTime)>2){console.log("progress changed",o.progress);const u=t.state.suno.audio;u.object&&(u.object.currentTime=u.progress)}else o?.state!==a?.state&&(console.log("state changed",o.state),o.object&&(o.state==="playing"?o.object.play():o.object.pause()));o?.volume!==a?.volume&&(console.log("volume changed",o.volume),o.object&&(o.object.volume=o.volume/100))}),(o,a)=>(l(),h("div",No,[r("img",{alt:"",class:"w-11 h-11 rounded",src:i.value?.image_url||V(qo)},null,8,Ho),r("div",Ko,[r("div",Zo,[r("div",xo,[r("span",null,v(i.value?.title||"Music"),1),r("span",Xo,"- "+v(i.value?.style||"SmallRuralDog"),1)])])])]))}}),Yo={class:"flex justify-end items-center gap-x-2.5"},Qo={class:"text-xs"},es=b({__name:"PlayerAction",setup(e){const t=G(),i=F({get:()=>t.state.suno?.audio?.progress,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,progress:a})}),o=F({get:()=>t.state.suno?.audio?.duration,set:a=>t.commit("suno/setAudio",{...t.state.suno.audio,duration:a})});return(a,u)=>(l(),h("div",Yo,[r("span",Qo,v(V(R)(i.value))+" / "+v(V(R)(o.value)),1)]))}});var ts={size:"1em",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round",rtl:!1,theme:"outline",colors:{outline:{fill:"#333",background:"transparent"},filled:{fill:"#333",background:"#FFF"},twoTone:{fill:"#333",twoTone:"#2F88FF"},multiColor:{outStrokeColor:"#333",outFillColor:"#2F88FF",innerStrokeColor:"#FFF",innerFillColor:"#43CCF8"}},prefix:"i"};function os(){return"icon-"+((1+Math.random())*4294967296|0).toString(16).substring(1)}function ss(e,t,i){var o=typeof t.fill=="string"?[t.fill]:t.fill||[],a=[],u=t.theme||i.theme;switch(u){case"outline":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("none");break;case"filled":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push("#FFF"),a.push("#FFF");break;case"two-tone":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone),a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.twoTone.twoTone);break;case"multi-color":a.push(typeof o[0]=="string"?o[0]:"currentColor"),a.push(typeof o[1]=="string"?o[1]:i.colors.multiColor.outFillColor),a.push(typeof o[2]=="string"?o[2]:i.colors.multiColor.innerStrokeColor),a.push(typeof o[3]=="string"?o[3]:i.colors.multiColor.innerFillColor);break}return{size:t.size||i.size,strokeWidth:t.strokeWidth||i.strokeWidth,strokeLinecap:t.strokeLinecap||i.strokeLinecap,strokeLinejoin:t.strokeLinejoin||i.strokeLinejoin,colors:a,id:e}}var ns=Symbol("icon-context");function te(e,t,i){var o={name:"icon-"+e,props:["size","strokeWidth","strokeLinecap","strokeLinejoin","theme","fill","spin"],setup:function(u){var d=os(),p=Se(ns,ts);return function(){var _=u.size,n=u.strokeWidth,m=u.strokeLinecap,y=u.strokeLinejoin,f=u.theme,C=u.fill,j=u.spin,T=ss(d,{size:_,strokeWidth:n,strokeLinecap:m,strokeLinejoin:y,theme:f,fill:C},p),A=[p.prefix+"-icon"];return A.push(p.prefix+"-icon-"+e),t&&p.rtl&&A.push(p.prefix+"-icon-rtl"),j&&A.push(p.prefix+"-icon-spin"),s("span",{class:A.join(" ")},[i(T)])}}};return o}const is=te("pause-one",!1,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M19 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M29 18V30",stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),as=te("play",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M20 24V17.0718L26 20.5359L32 24L26 27.4641L20 30.9282V24Z",fill:e.colors[3],stroke:e.colors[2],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null)])}),ls=te("volume-small",!0,function(e){return s("svg",{width:e.size,height:e.size,viewBox:"0 0 48 48",fill:"none"},[s("path",{d:"M24 6V42C17 42 11.7985 32.8391 11.7985 32.8391H6C4.89543 32.8391 4 31.9437 4 30.8391V17.0108C4 15.9062 4.89543 15.0108 6 15.0108H11.7985C11.7985 15.0108 17 6 24 6Z",fill:e.colors[1],stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linejoin":e.strokeLinejoin},null),s("path",{d:"M32 15L32 15C32.6232 15.5565 33.1881 16.1797 33.6841 16.8588C35.1387 18.8504 36 21.3223 36 24C36 26.6545 35.1535 29.1067 33.7218 31.0893C33.2168 31.7885 32.6391 32.4293 32 33",stroke:e.colors[0],"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin},null)])}),ie=b({__name:"IconPark",props:{icon:{},theme:{},size:{},spin:{type:Boolean},fill:{},strokeLinecap:{},strokeLinejoin:{},strokeWidth:{}},setup(e){return(t,i)=>(l(),w(re(t.icon),{theme:t.theme,size:t.size,spin:t.spin,fill:t.fill,"stroke-linecap":t.strokeLinecap,"stroke-linejoin":t.strokeLinejoin,"stroke-width":t.strokeWidth},null,8,["theme","size","spin","fill","stroke-linecap","stroke-linejoin","stroke-width"]))}}),rs={class:"player-volume flex flex-col items-center pt-2"},cs={class:"text-sm mt-3"},us=b({__name:"PlayerVolumeSlider",setup(e){const t=G(),i=F({get:()=>t.state.suno.audio?.volume,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,volume:u})}),o=F({get:()=>t.state.suno.audio?.muted,set:u=>t.commit("suno/setAudio",{...t.state.suno.audio,muted:u})}),a=u=>t.dispatch("suno/setVolume",u);return(u,d)=>(l(),h("div",rs,[s(V(ue),{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=p=>i.value=p),vertical:"",height:"100px","show-tooltip":!1,max:100,min:0,size:"small",disabled:o.value,onInput:a},null,8,["modelValue","disabled"]),r("div",cs,v(i.value),1)]))}}),ds={class:"flex items-center justify-center gap-x-3"},ps=b({__name:"PlayerController",setup(e){const t=G(),i=()=>t.dispatch("suno/setAudio",{...t.state.suno.audio,state:t.state.suno.audio.state==="playing"?"paused":"playing"}),o=F(()=>t.state.suno.audio);return(a,u)=>(l(),h("div",ds,[s(ie,{icon:o.value?.state==="playing"?V(is):V(as),size:"45",theme:"filled",class:"text-[var(--el-color-primary)] cursor-pointer",onClick:i},null,8,["icon"]),s(V(Oe),{placement:"top",width:"50px",trigger:"click"},{reference:$(()=>[s(ie,{icon:V(ls),size:"20","stroke-width":2,class:"cursor-pointer"},null,8,["icon"])]),default:$(()=>[s(us)]),_:1})]))}}),ms={class:"flex flex-col items-stretch h-20"},fs={class:"flex grow px-5 items-center"},hs={class:"flex-1"},_s={class:"flex-1"},$s={class:"flex-1"},vs=b({__name:"Player",setup(e){return(t,i)=>(l(),h("div",ms,[s(Wo),r("div",fs,[r("div",hs,[s(Jo)]),r("div",_s,[s(ps)]),r("div",$s,[s(es)])])]))}}),gs=b({name:"RecentPanel",components:{ElSkeletonItem:We,ElSkeleton:Be,TaskPreview:Oo,Player:vs,NoTasks:Ue},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}}},methods:{onHandleScroll(){const e=this.$refs.panel;console.log("reach-top"),e.scrollTop===0&&this.$emit("reach-top")}}}),ys={key:0,class:"tasks"},ks={class:"left w-[70px] p-[10px] flex items-center"},ws={class:"main w-[calc(100%-70px)] flex-1 p-[10px]"},bs={key:2,class:"w-full flex-1 flex items-center justify-center"},Cs={class:"h-20"};function Ss(e,t,i,o,a,u){const d=c("el-skeleton-item"),p=c("el-skeleton"),_=c("task-preview"),n=c("no-tasks"),m=c("player");return l(),h(z,null,[e.tasks?.items===void 0?(l(),h("div",ys,[(l(),h(z,null,N(3,y=>r("div",{key:y,class:"flex"},[r("div",ks,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"image",class:"avatar w-[50px] h-[50px]"})]),_:1})]),r("div",ws,[s(p,{animated:""},{template:$(()=>[s(d,{variant:"p",class:"w-[200px] h-[15px] mb-[5px] mt-[10px]"}),s(d,{variant:"text"})]),_:1})])])),64))])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(l(),h("div",{key:1,class:"flex-1 w-full overflow-y-auto tasks p-2",onScroll:t[0]||(t[0]=(...y)=>e.onHandleScroll&&e.onHandleScroll(...y))},[(l(!0),h(z,null,N(e.tasks?.items,(y,f)=>(l(),w(_,{key:f,"model-value":y,class:"preview"},null,8,["model-value"]))),128))],32)):k("",!0),e.tasks?.items?.length===0?(l(),h("div",bs,[s(n)])):k("",!0),x(r("div",Cs,[s(m)],512),[[Ae,!!e.$store?.state?.suno?.audio?.object]])],64)}const As=E(gs,[["render",Ss]]),Ls=b({name:"TaskPreview",components:{IconPicture:Le,ElImage:J,ElAvatar:xe,ElIcon:D},computed:{audio(){return this.$store.state.suno?.audio}}}),Es={key:0,class:"size-full overflow-hidden"},Vs={class:"relative h-[300px]"},js={class:"flex items-center justify-center size-full bg-[var(--el-bg-color)]"},Fs={class:"absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent"},Ts={class:"p-4"},Ps={class:"flex items-center font-bold mb-2"},Is={class:"text-[var(--el-text-color-regular)] mb-2"},Us={class:"text-xs text-[var(--el-text-color-regular)]"},zs={class:"mt-4 text-sm leading-[25px] whitespace-pre-wrap"},Rs={key:1,class:"w-full h-full"};function Ds(e,t,i,o,a,u){const d=c("icon-picture"),p=c("el-icon"),_=c("el-image"),n=c("el-avatar");return e.audio?.object?(l(),h("div",Es,[r("div",Vs,[s(_,{src:e.audio.image_url,fit:"cover",class:"size-full"},{error:$(()=>[r("div",js,[s(p,{class:"text-3xl"},{default:$(()=>[s(d)]),_:1})])]),_:1},8,["src"]),r("h2",Fs,v(e.audio?.title),1)]),r("div",Ts,[r("div",Ps,[s(n,{size:30,src:e.audio?.image_url,class:"mr-2"},null,8,["src"]),r("span",null,v(e.audio?.title),1)]),r("p",Is,v(e.audio?.style),1),r("p",Us,v(e.$dayjs.format(e.audio?.created_at)),1),r("div",zs,[r("p",null,v(e.audio?.lyric),1)])])])):(l(),h("div",Rs))}const Gs=E(Ls,[["render",Ds]]),Ms="https://webhook.acedata.cloud/suno",Os=b({name:"SunoIndex",components:{Layout:ot,ConfigPanel:ko,RecentPanel:As,PreviewPanel:Gs},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(){Ee.create({application:this.application}).then(({data:e})=>{this.application=e,L.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===Ve&&L.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){setTimeout(()=>{const e=document.querySelector(".recent");e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(e){if(this.loading){console.debug("loading");return}console.debug("start onGetTasks",e);const{limit:t=5,createdAtMin:i,createdAtMax:o}=e||{};console.debug("limit",t,"createdAtMin",i,"createdAtMax",o),await this.$store.dispatch("suno/getTasks",{limit:t,createdAtMin:i,createdAtMax:o})},async onGenerateAudio(){const e={...this.config,callback_url:Ms},t=this.credential?.token;if(!t){console.error("no token specified");return}L.info(this.$t("suno.message.startingTask")),H.audio(e,{token:t}).then(()=>{L.success(this.$t("suno.message.startTaskSuccess"))}).catch(i=>{L.error(i?.response?.data?.error?.message||this.$t("suno.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}});function Bs(e,t,i,o,a,u){const d=c("config-panel"),p=c("recent-panel"),_=c("preview-panel"),n=c("layout");return l(),w(n,null,{config:$(()=>[s(d,{onGenerate:e.onGenerateAudio},null,8,["onGenerate"])]),result:$(()=>[s(p,{class:"panel recent",onReachTop:e.onReachTop},null,8,["onReachTop"])]),preview:$(()=>[s(_)]),_:1})}const Cn=E(Os,[["render",Bs],["__scopeId","data-v-f5721d95"]]);export{Cn as default};