@acedatacloud/nexior 3.323.2 → 3.323.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/assets/{ApiCodeButton-CT4kJONi.js → ApiCodeButton-DvrUGiTL.js} +1 -1
  2. package/dist/assets/{Artifacts-CkHX2Giz.js → Artifacts-CLIAJaAS.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-B8397sr9.js → AskUserQuestionCard-DN21Leak.js} +1 -1
  4. package/dist/assets/{Auth-q-hrPpGv.js → Auth-ClCzftQE.js} +1 -1
  5. package/dist/assets/{Bare-CePH_Mwb.js → Bare-C0Qd146S.js} +1 -1
  6. package/dist/assets/{BotPlaceholder-DMdy5ReV.js → BotPlaceholder-Dt69aobm.js} +1 -1
  7. package/dist/assets/{BottomFooter-BDDx0lVM.js → BottomFooter-Bq9L1xP7.js} +1 -1
  8. package/dist/assets/{Callback-Cx2l6vrC.js → Callback-OqET8oNf.js} +1 -1
  9. package/dist/assets/{CodeSnippet-bBsQKAWE.js → CodeSnippet-4ifduPUK.js} +1 -1
  10. package/dist/assets/{Console-C2vBceIy.js → Console-eyFp3Q4M.js} +1 -1
  11. package/dist/assets/{Consumption-DLQ-BcIF.js → Consumption-MRvsOx6V.js} +1 -1
  12. package/dist/assets/{Conversation-CnQBxaY2.js → Conversation-BjJOCt7W.js} +1 -1
  13. package/dist/assets/{Conversation-CVJJLcj4.js → Conversation-CYCZIWbq.js} +1 -1
  14. package/dist/assets/{CopyToClipboard-Ca8S-sqk.js → CopyToClipboard-cDfZUBnE.js} +1 -1
  15. package/dist/assets/{Detail-rohkawRI.js → Detail-BNgOMoiJ.js} +2 -2
  16. package/dist/assets/{Extra-Tnwm2yHf.js → Extra-Lv7OMJ4p.js} +1 -1
  17. package/dist/assets/{FilePreview-CjzvTPCT.js → FilePreview-C83tDRX7.js} +1 -1
  18. package/dist/assets/{Hailuo-BHu7HI8z.js → Hailuo--21FDUlt.js} +1 -1
  19. package/dist/assets/{History-DgcQFFIS.js → History-B5gFARni.js} +1 -1
  20. package/dist/assets/{ImagePreview-jaBLzHNB.js → ImagePreview-9oC3URyM.js} +1 -1
  21. package/dist/assets/{ImageWrapper-CnYKEGMu.js → ImageWrapper-DaMTHMuH.js} +1 -1
  22. package/dist/assets/{Index-DLBsjO7E.js → Index-B1CNBAW5.js} +1 -1
  23. package/dist/assets/{Index-u5xKnAIj.js → Index-B2fxjL8p.js} +1 -1
  24. package/dist/assets/{Index-IF6C76qw.js → Index-B6i2AHem.js} +1 -1
  25. package/dist/assets/{Index-CMCQBcI4.js → Index-B86ql_3K.js} +1 -1
  26. package/dist/assets/{Index-DeYJQKUx.js → Index-B8rTbYos.js} +1 -1
  27. package/dist/assets/{Index-DkNX-bJg.js → Index-BL_Npjam.js} +1 -1
  28. package/dist/assets/{Index-DKJN7hoE.js → Index-BM91yYfa.js} +1 -1
  29. package/dist/assets/{Index-BovvKC4K.js → Index-BnctUIUT.js} +1 -1
  30. package/dist/assets/{Index-DxlNHxkg.js → Index-BwDEdsuc.js} +1 -1
  31. package/dist/assets/{Index-D7vkcV81.js → Index-CeDm53Dk.js} +1 -1
  32. package/dist/assets/{Index-CvuSHzDq.js → Index-CnLR__Ey.js} +1 -1
  33. package/dist/assets/{Index-BkRNg0jg.js → Index-CsaAxmzE.js} +1 -1
  34. package/dist/assets/{Index-Bc_2tTo1.js → Index-Cvq8OBqL.js} +1 -1
  35. package/dist/assets/{Index-Dm7efSl_.js → Index-DO4AfBJ_.js} +1 -1
  36. package/dist/assets/{Index-DZWBUBWP.js → Index-DXKh4jpK.js} +1 -1
  37. package/dist/assets/{Index-f-Nn_mCf.js → Index-DY6DRgmr.js} +1 -1
  38. package/dist/assets/{Index-ChDaZs-l.js → Index-DdJ1x1B5.js} +1 -1
  39. package/dist/assets/{Index-D6apdctE.js → Index-DlK80kmB.js} +1 -1
  40. package/dist/assets/{Index-CPrvvx5Y.js → Index-Dp3wxVnJ.js} +1 -1
  41. package/dist/assets/{Index-Dd8C-po1.js → Index-DpNywXr8.js} +1 -1
  42. package/dist/assets/{Index-E2IycaH6.js → Index-Dpzuzzqc.js} +1 -1
  43. package/dist/assets/{Index-qLC-_CRT.js → Index-DuXAMhbi.js} +1 -1
  44. package/dist/assets/{Index-CE4TFtHT.js → Index-FasSpBR-.js} +1 -1
  45. package/dist/assets/{Index-BfJX5ffD.js → Index-Fl5Lbr1L.js} +1 -1
  46. package/dist/assets/{Index-Cn82xbL1.js → Index-OjcP2Wpp.js} +1 -1
  47. package/dist/assets/{Index-iwiHeprd.js → Index-v0P1qb2B.js} +1 -1
  48. package/dist/assets/{Index-BrMiAHZz.js → Index-xpQCJ8aF.js} +1 -1
  49. package/dist/assets/{Index-CbsG5qmx.js → Index-zaNAp-rr.js} +1 -1
  50. package/dist/assets/{Invitees-IBRaXpxi.js → Invitees-l9t2JimV.js} +1 -1
  51. package/dist/assets/{List-BOzb72dd.js → List-BLNWoZCQ.js} +1 -1
  52. package/dist/assets/{List-L9-m5COS.js → List-BNeOLDq4.js} +1 -1
  53. package/dist/assets/{List-BGoq9de8.js → List-BoeGYbj6.js} +1 -1
  54. package/dist/assets/{LocalTools-PmXUR4hr.js → LocalTools-BMIMaPQ_.js} +1 -1
  55. package/dist/assets/{LocalTools-Bye6rJp9.js → LocalTools-DsJ5JELl.js} +1 -1
  56. package/dist/assets/{Main-DCNT_HEl.js → Main-Bubbe_Mz.js} +1 -1
  57. package/dist/assets/{Message-DYyKieyF.js → Message-D8Bmgnh5.js} +1 -1
  58. package/dist/assets/{Model-DXb45oQm.js → Model-BITp4jnl.js} +1 -1
  59. package/dist/assets/{Navigator-1FhvYsqV.js → Navigator-jFgRCixo.js} +3 -3
  60. package/dist/assets/{NoTasks-TrlSu31_.js → NoTasks-DRIp5LO0.js} +1 -1
  61. package/dist/assets/{NotFound-Bxfa3I9B.js → NotFound-inLYSrrh.js} +1 -1
  62. package/dist/assets/{Pagination-C2Ip3oTl.js → Pagination-WUnXZ0-b.js} +1 -1
  63. package/dist/assets/{Pay-Ukv5CMu3.js → Pay-Cadpl48i.js} +1 -1
  64. package/dist/assets/{Player-Cn-f-JDk.js → Player-BXyPy0dR.js} +1 -1
  65. package/dist/assets/{PromptTextarea-CmibdYw8.js → PromptTextarea-DWq1L_Vc.js} +1 -1
  66. package/dist/assets/{RealtimeCall-DkKlDPZE.js → RealtimeCall-B91i1qjk.js} +1 -1
  67. package/dist/assets/{ScheduledTasks-Cf6r4107.js → ScheduledTasks-A4mAntfG.js} +1 -1
  68. package/dist/assets/{Status-B7xPxkCj.js → Status-IgAKj_fU.js} +1 -1
  69. package/dist/assets/{Subscribe-CuvIYi1W.js → Subscribe-DnFO_Z5y.js} +1 -1
  70. package/dist/assets/{TabSwitcher-DLkwk450.js → TabSwitcher-CstlkpfW.js} +1 -1
  71. package/dist/assets/{Tts-Pidpv_zC.js → Tts-DyuhtIYe.js} +1 -1
  72. package/dist/assets/{VideoPlayer-oKtmGvkU.js → VideoPlayer-Ca_Xz8CP.js} +1 -1
  73. package/dist/assets/{VideoPreview-Co0wZ2_B.js → VideoPreview-D_-7yVdF.js} +1 -1
  74. package/dist/assets/{alert-DVXIMt1v.js → alert-CqfK6I_P.js} +1 -1
  75. package/dist/assets/{avatar-BjT1c7Rc.js → avatar-2F_OYi0C.js} +1 -1
  76. package/dist/assets/{basic-BhruITPB.js → basic-B1kAalJJ.js} +1 -1
  77. package/dist/assets/{chat-Bs7b2NNj.js → chat-CmFyhITx.js} +1 -1
  78. package/dist/assets/{codingBridge-DoEdUnlo.js → codingBridge-Dxgx9Vga.js} +1 -1
  79. package/dist/assets/{codingBridgeNotify-Cf9re3qC.js → codingBridgeNotify-C0qoGSgz.js} +2 -2
  80. package/dist/assets/{collapse-D8X_GwSL.js → collapse-BxhB3a7f.js} +1 -1
  81. package/dist/assets/{createTaskActions-9rWoTkZj.js → createTaskActions-3dwQKIbN.js} +1 -1
  82. package/dist/assets/{date-picker-D25DTMq4.js → date-picker-CH_y62Jb.js} +1 -1
  83. package/dist/assets/{digitalhuman-DogPyN8g.js → digitalhuman-BpLdUGQo.js} +1 -1
  84. package/dist/assets/{drawer-DTrWPYS_.js → drawer-D8wfk1R6.js} +1 -1
  85. package/dist/assets/{dropdown-Bcktp4gY.js → dropdown-DjlvTJnF.js} +1 -1
  86. package/dist/assets/{dropdown-Be2-PXoF.js → dropdown-OBszSwrp.js} +1 -1
  87. package/dist/assets/{esm-Dl9j1ZuY.js → esm-AVUUpJa1.js} +1 -1
  88. package/dist/assets/{esm-BfMXjIMw.js → esm-BFUvW3u8.js} +1 -1
  89. package/dist/assets/{esm-DETryQIB.js → esm-Bixw4oFj.js} +3 -3
  90. package/dist/assets/esm-Btgkh-Se.js +1 -0
  91. package/dist/assets/{esm-D9dkxgp0.js → esm-C0oj3uJt.js} +1 -1
  92. package/dist/assets/{esm-DKbyQn8K.js → esm-f0o6eMOH.js} +2 -2
  93. package/dist/assets/{esm-KnLm7-gE.js → esm-tOBAhRYY.js} +2 -2
  94. package/dist/assets/{fish-WB-B8ZkE.js → fish-Ds3lNb45.js} +1 -1
  95. package/dist/assets/{flux-DWTq_shk.js → flux-Cf-MgwSZ.js} +1 -1
  96. package/dist/assets/{grokvideo-Ctu1F3cN.js → grokvideo-dxHR5jcZ.js} +1 -1
  97. package/dist/assets/{hailuo-CRsbrMG1.js → hailuo-BlfVe4h3.js} +1 -1
  98. package/dist/assets/{headshots-DfpS_8_7.js → headshots-CxxKrUBp.js} +1 -1
  99. package/dist/assets/{image-DxExU-Rq.js → image-CBjQluJz.js} +1 -1
  100. package/dist/assets/{index-BjernDcR.js → index-D9GtY1Yk.js} +3 -3
  101. package/dist/assets/{index-CteWW5ki.css → index-L1ngah6q.css} +1 -1
  102. package/dist/assets/{index.browser.esm-CWOHfuk_.js → index.browser.esm-C1yMbMnF.js} +1 -1
  103. package/dist/assets/{index.es-DlaJnBWw.js → index.es-B-37pVAR.js} +1 -1
  104. package/dist/assets/{input-number-qSJ-m6WQ.js → input-number-CqZtT6zo.js} +1 -1
  105. package/dist/assets/{kling-C4-CqDJp.js → kling-DTEgvHC9.js} +1 -1
  106. package/dist/assets/{luma-Cq92sJ8E.js → luma-C6Sks1Ul.js} +1 -1
  107. package/dist/assets/{maestro-CZmX70Zi.js → maestro-Dm_ADYWR.js} +1 -1
  108. package/dist/assets/{midjourney-D7PkmiHv.js → midjourney-CAwm_-ng.js} +1 -1
  109. package/dist/assets/{mobileLocalExec-BhwPilw0.js → mobileLocalExec-DFjaPAoe.js} +2 -2
  110. package/dist/assets/{nanobanana-CI586Luv.js → nanobanana-C_gg_SY8.js} +1 -1
  111. package/dist/assets/{openaiimage-CickhaSp.js → openaiimage-YezHWAB0.js} +1 -1
  112. package/dist/assets/{pagination-TdP7XO5o.js → pagination-CR-ztfxo.js} +1 -1
  113. package/dist/assets/{pika-C_39Fkqt.js → pika-BQbeZ_69.js} +1 -1
  114. package/dist/assets/{pixverse-BIaavzE9.js → pixverse-B9E01cBt.js} +1 -1
  115. package/dist/assets/{popover-B7XhqbmC.js → popover-D2_Ssw6w.js} +1 -1
  116. package/dist/assets/{producer-CrCvY0m0.js → producer-BqyqVj0r.js} +1 -1
  117. package/dist/assets/{qrart-jzQGBUAm.js → qrart-BqEvC6JC.js} +1 -1
  118. package/dist/assets/{realtime-D3KhRtFz.js → realtime-DyFuQdLh.js} +1 -1
  119. package/dist/assets/{row-IMhCeRXk.js → row-BhyUEvlS.js} +1 -1
  120. package/dist/assets/{seedance-GtkF0f2f.js → seedance-DydWL_ER.js} +1 -1
  121. package/dist/assets/{seedream-Dfhd3bBE.js → seedream-UM1U-Ce5.js} +1 -1
  122. package/dist/assets/{select-rpgD1mTp.js → select-HoauzLaT.js} +1 -1
  123. package/dist/assets/{serp-BFXUzUyR.js → serp-BpARpkkZ.js} +1 -1
  124. package/dist/assets/{slider-rfFJozAn.js → slider-C89Gn6Tq.js} +1 -1
  125. package/dist/assets/{solana-wallets-yRmFrmw0.js → solana-wallets-CULI7DlQ.js} +2 -2
  126. package/dist/assets/{solana-wallets-vue-DPdOJ1tb.js → solana-wallets-vue-BWqgVd0y.js} +1 -1
  127. package/dist/assets/{sora-k-SP8cbs.js → sora-BHv4Z0f0.js} +1 -1
  128. package/dist/assets/{suno-oBlqtdJ6.js → suno-DMBr0WpZ.js} +1 -1
  129. package/dist/assets/{switch-BZ17H-wR.js → switch-C_SQuBN-.js} +1 -1
  130. package/dist/assets/{table-DUuQb9DA.js → table-kvN2hNj_.js} +1 -1
  131. package/dist/assets/{tabs-BaISrstV.js → tabs-ChE9apJH.js} +1 -1
  132. package/dist/assets/{time-picker-BZiAMQyV.js → time-picker-C_FQxGWm.js} +1 -1
  133. package/dist/assets/{tooltip-D9nl8rAG.js → tooltip-vx_1Kj1D.js} +1 -1
  134. package/dist/assets/{upload-DoXD5sDs.js → upload-BczdKCgl.js} +1 -1
  135. package/dist/assets/{veo-DFG32cbX.js → veo-cWFLDLvi.js} +1 -1
  136. package/dist/assets/{wan-DG-SXte-.js → wan-C6fkiZ9X.js} +1 -1
  137. package/dist/assets/{web-DjLo4Tsu.js → web-BAo-E2wp.js} +1 -1
  138. package/dist/assets/{web-BuGc1yt0.js → web-BC7G7WYs.js} +1 -1
  139. package/dist/assets/{web-nXIrJf1R.js → web-BIPz22sU.js} +1 -1
  140. package/dist/assets/{web-BCjZoxa1.js → web-BvgLqM0B.js} +1 -1
  141. package/dist/assets/{web-D8ncroKr.js → web-C4DXgFoN.js} +1 -1
  142. package/dist/assets/{webextrator-CIdSYQ3h.js → webextrator-DVgQ3DrV.js} +1 -1
  143. package/dist/index.html +2 -2
  144. package/package.json +1 -1
  145. package/dist/assets/esm-MvQipz6f.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-rpgD1mTp.js";import{t as x}from"./upload-DoXD5sDs.js";import{t as S}from"./tooltip-D9nl8rAG.js";import{t as C}from"./image-DxExU-Rq.js";import{t as w}from"./alert-DVXIMt1v.js";import{t as T}from"./drawer-DTrWPYS_.js";import{t as E}from"./input-number-qSJ-m6WQ.js";import{t as D}from"./switch-BZ17H-wR.js";import{$t as O,Bt as k,Gt as A,Ht as j,Jt as ee,Kt as te,Lt as M,Qt as N,Rt as P,Ut as ne,Vt as re,Wt as ie,Xt as ae,Yt as oe,Zt as se,an as ce,en as le,nn as F,on as ue,qt as de,rn as I,sn as L,tn as R}from"./constants-CzGOanfS.js";import{$t as z,A as B,Bt as V,Gt as H,Ht as fe,Kr as U,Ur as W,Ut as G,Vt as K,mi as q,ri as J,rr as pe,vn as me}from"./index-BjernDcR.js";import{t as Y}from"./index.es-DlaJnBWw.js";import{t as he}from"./CopyToClipboard-Ca8S-sqk.js";import{t as X}from"./ImagePreview-jaBLzHNB.js";import{n as ge}from"./taskDrawerMixin-DyAUhFEq.js";import{t as _e}from"./Consumption-DLQ-BcIF.js";import{i as Z,n as ve,t as ye}from"./pagination-TdP7XO5o.js";import{t as be}from"./VideoPlayer-oKtmGvkU.js";import{t as xe}from"./ApiCodeButton-CT4kJONi.js";import{t as Se}from"./BotPlaceholder-DMdy5ReV.js";import{t as Ce}from"./NoTasks-TrlSu31_.js";import{t as we}from"./PromptTextarea-CmibdYw8.js";import{t as Te}from"./ImageWrapper-CnYKEGMu.js";import{n as Ee,t as De}from"./VideoPreview-Co0wZ2_B.js";var Oe=v({name:`LayoutSeedance`,components:{ElDrawer:T,ElButton:q,FontAwesomeIcon:Y},mixins:[ge]}),ke={class:`main flex flex-row flex-1`},Ae={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},je={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Me(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,ke,[e(`div`,Ae,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,je,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ne=B(Oe,[[`render`,Me],[`__scopeId`,`data-v-ec312952`]]),Pe=v({name:`SeedancePromptInput`,components:{PromptTextarea:we},computed:{prompt:{get(){return this.$store.state.seedance?.config?.prompt},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Fe(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedance.name.prompt`),info:e.$t(`seedance.description.prompt`),placeholder:e.$t(`seedance.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ie=B(Pe,[[`render`,Fe]]),Le=v({name:`SeedanceModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:de,label:this.$t(`seedance.model.seedance20`)},{value:ee,label:this.$t(`seedance.model.seedance20Fast`)},{value:oe,label:this.$t(`seedance.model.seedance20Mini`)},{value:te,label:this.$t(`seedance.model.seedance15pro`)},{value:ie,label:this.$t(`seedance.model.seedance10pro`)},{value:A,label:this.$t(`seedance.model.seedance10proFast`)},{value:ne,label:this.$t(`seedance.model.seedance10liteT2v`)},{value:j,label:this.$t(`seedance.model.seedance10liteI2v`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.model},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,model:e})}}},mounted(){this.value||=M}}),Re={class:`field`},ze={class:`label`},Be={class:`box`},Ve={class:`title font-bold`};function He(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`h2`,Ve,i(t.$t(`seedance.name.model`)),1),a(m,{content:t.$t(`seedance.description.model`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedance.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ue=B(Le,[[`render`,He],[`__scopeId`,`data-v-deb4c429`]]),We=v({name:`SeedanceDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},options(){let e=[];this.capability.supportsAutoDuration&&e.push({value:-1,label:`${this.$t(`seedance.placeholder.seed`)} (-1)`});for(let t=this.capability.minDuration;t<=this.capability.maxDuration;t++)e.push({value:t,label:`${t}s`});return e},value:{get(){return this.$store.state.seedance?.config?.duration},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,duration:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=5},methods:{clampValue(){let e=this.value;e!==void 0&&!(e===-1&&this.capability.supportsAutoDuration)&&(e<this.capability.minDuration||e>this.capability.maxDuration)&&(this.value=5)}}}),Ge={class:`field`},Ke={class:`label`},qe={class:`box`},Je={class:`title font-bold`};function Ye(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Ge,[e(`div`,Ke,[e(`div`,qe,[e(`h2`,Je,i(t.$t(`seedance.name.duration`)),1),a(m,{content:t.$t(`seedance.description.duration`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedance.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Xe=B(We,[[`render`,Ye],[`__scopeId`,`data-v-d61cc21b`]]),Q={[F]:0,[I]:1,[R]:2,"4k":3},Ze=v({name:`SeedanceResolutionSelector`,components:{InfoIcon:Z,ElTooltip:S},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},options(){let e=[{value:F,label:`480p`},{value:I,label:`720p`},{value:R,label:`1080p`},{value:`4k`,label:`4k`}],t=Q[this.capability.maxResolution]??Q[`1080p`];return e.map(e=>({...e,disabled:Q[e.value]>t}))},value:{get(){return this.$store.state.seedance?.config?.resolution},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,resolution:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=this.capability.defaultResolution||`720p`},methods:{onSelect(e){e.disabled||(this.value=e.value)},clampValue(){let e=this.value,t=this.options.find(t=>t.value===e);(!e||t&&t.disabled)&&(this.value=this.capability.defaultResolution||`720p`)}}}),Qe={class:`resolution`},$e={class:`header`},et={class:`title font-bold`},tt={class:`items`},nt=[`onClick`];function rt(t,r,o,u,d,m){let _=l(`info-icon`),v=l(`el-tooltip`);return g(),s(`div`,Qe,[e(`div`,$e,[e(`h2`,et,i(t.$t(`seedance.name.resolution`)),1),a(_,{content:t.$t(`seedance.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,tt,[(g(!0),s(c,null,h(t.options,r=>(g(),f(v,{key:r.value,content:t.$t(`seedance.message.resolutionNotSupported`),disabled:!r.disabled,placement:`top`},{default:p(()=>[e(`div`,{class:n([`item`,{active:t.value===r.value,disabled:r.disabled}]),onClick:e=>t.onSelect(r)},i(r.label),11,nt)]),_:2},1032,[`content`,`disabled`]))),128))])])}var it=B(Ze,[[`render`,rt],[`__scopeId`,`data-v-db7e8aff`]]),at=v({name:`SeedanceRatioSelector`,components:{InfoIcon:Z},computed:{options(){return[{value:se,label:`16:9`,w:32,h:18},{value:O,label:`9:16`,w:18,h:32},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`1:1`,label:`1:1`,w:24,h:24},{value:N,label:`21:9`,w:34,h:14},{value:le,label:this.$t(`seedance.ratio.adaptive`),w:0,h:0}]},value:{get(){return this.$store.state.seedance?.config?.ratio},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,ratio:e})}}},mounted(){this.value||=P}}),ot={class:`ratio`},st={class:`header`},ct={class:`title font-bold`},lt={class:`items`},ut=[`onClick`],dt={class:`preview`},ft={key:1,class:`rect rect-auto`},pt={class:`name`};function mt(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,ot,[e(`div`,st,[e(`h2`,ct,i(t.$t(`seedance.name.ratio`)),1),a(p,{content:t.$t(`seedance.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,lt,[(g(!0),s(c,null,h(t.options,r=>(g(),s(`div`,{key:r.value,class:n([`item`,{active:t.value===r.value}]),onClick:e=>t.value=r.value},[e(`div`,dt,[r.w&&r.h?(g(),s(`div`,{key:0,class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)):(g(),s(`div`,ft,`A`))]),e(`div`,pt,i(r.label),1)],10,ut))),128))])])}var ht=B(at,[[`render`,mt],[`__scopeId`,`data-v-8ddec2dd`]]),gt=v({name:`SeedanceGenerateAudioSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{isSupported(){let e=this.$store.state.seedance?.config?.model;return L(e).acceptsAudio},value:{get(){return this.$store.state.seedance?.config?.generate_audio??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,generate_audio:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),_t={key:0,class:`field`},vt={class:`label`},yt={class:`box`},bt={class:`title font-bold`},xt={class:`value`};function St(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-switch`);return t.isSupported?(g(),s(`div`,_t,[e(`div`,vt,[e(`div`,yt,[e(`h2`,bt,i(t.$t(`seedance.name.generateAudio`)),1),a(f,{content:t.$t(`seedance.description.generateAudio`),class:`info`},null,8,[`content`])])]),e(`div`,xt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):o(``,!0)}var Ct=B(gt,[[`render`,St],[`__scopeId`,`data-v-df51dfbd`]]),wt=v({name:`SeedanceCameraFixedSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{value:{get(){return this.$store.state.seedance?.config?.camerafixed??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,camerafixed:e})}}},mounted(){this.$store.state.seedance?.config?.camerafixed===void 0&&(this.value=!1)}}),Tt={class:`field`},Et={class:`label`},Dt={class:`box`},Ot={class:`title font-bold`},kt={class:`value`};function At(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,Tt,[e(`div`,Et,[e(`div`,Dt,[e(`h2`,Ot,i(t.$t(`seedance.name.cameraFixed`)),1),a(d,{content:t.$t(`seedance.description.cameraFixed`),class:`info`},null,8,[`content`])])]),e(`div`,kt,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])}var jt=B(wt,[[`render`,At],[`__scopeId`,`data-v-ae777d61`]]),Mt=v({name:`SeedanceFirstFrameImage`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y,ImagePreview:X},mixins:[G,K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsImage"(e){e||(this.fileList=[],this.onSetFirstFrameUrl())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetFirstFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`first_frame`);e&&t.push({url:e,role:`first_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetFirstFrameUrl()},async onRemove(){this.onSetFirstFrameUrl()}}}),Nt={key:0,class:`relative`},Pt={class:`flex justify-between`},Ft={class:`flex justify-start items-center`},It={class:`text-sm font-bold`},Lt={key:0,class:`required-badge`};function Rt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsImage?(g(),s(`div`,Nt,[e(`div`,Pt,[e(`div`,Ft,[e(`span`,It,i(t.$t(`seedance.name.firstFrame`)),1),t.capability.requiresImage?(g(),s(`span`,Lt,i(t.$t(`seedance.name.required`)),1)):o(``,!0),a(h,{content:t.$t(`seedance.description.firstFrame`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var zt=B(Mt,[[`render`,Rt],[`__scopeId`,`data-v-e2597f23`]]),Bt=v({name:`SeedanceLastFrameImage`,components:{ElUpload:x,ElButton:q,ImagePreview:X,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[G,K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsLastFrame"(e){e||(this.fileList=[],this.onSetLastFrameUrl())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetLastFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`last_frame`);e&&t.push({url:e,role:`last_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetLastFrameUrl()},async onRemove(){this.onSetLastFrameUrl()}}}),Vt={key:0,class:`relative`},Ht={class:`flex justify-between`},Ut={class:`flex justify-start items-center`},Wt={class:`text-sm font-bold`};function Gt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsLastFrame?(g(),s(`div`,Vt,[e(`div`,Ht,[e(`div`,Ut,[e(`span`,Wt,i(t.$t(`seedance.name.lastFrame`)),1),a(h,{content:t.$t(`seedance.description.lastFrame`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var Kt=B(Bt,[[`render`,Gt],[`__scopeId`,`data-v-3a191e51`]]),qt=v({name:`SeedanceReferenceImage`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y,ImagePreview:X},mixins:[G,K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceImage"(e){e||(this.fileList=[],this.onSetReferenceImageUrls())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetReferenceImageUrls(){let e=(this.urls||[]).filter(Boolean),t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`reference_image`);e.forEach(e=>t.push({url:e,role:`reference_image`})),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetReferenceImageUrls()},async onRemove(){this.onSetReferenceImageUrls()}}}),Jt={key:0,class:`relative`},Yt={class:`flex justify-between`},Xt={class:`flex justify-start items-center`},Zt={class:`text-sm font-bold`};function Qt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsReferenceImage?(g(),s(`div`,Jt,[e(`div`,Yt,[e(`div`,Xt,[e(`span`,Zt,i(t.$t(`seedance.name.referenceImage`)),1),a(h,{content:t.$t(`seedance.description.referenceImage`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var $t=B(qt,[[`render`,Qt],[`__scopeId`,`data-v-230a67f6`]]),en=v({name:`SeedanceReferenceAudio`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceAudio"(e){e||(this.fileList=[],this.onSetReferenceAudios())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetReferenceAudios(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,audios:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceAudios()},async onRemove(){this.onSetReferenceAudios()}}}),tn={key:0,class:`relative`},nn={class:`flex justify-between`},rn={class:`flex justify-start items-center`},an={class:`text-sm font-bold`};function on(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`);return t.capability.acceptsReferenceAudio?(g(),s(`div`,tn,[e(`div`,nn,[e(`div`,rn,[e(`span`,an,i(t.$t(`seedance.name.referenceAudio`)),1),a(m,{content:t.$t(`seedance.description.referenceAudio`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,.flac`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`text`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(h,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var sn=B(en,[[`render`,on],[`__scopeId`,`data-v-49515675`]]),cn=v({name:`SeedanceReferenceVideo`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceVideo"(e){e||(this.fileList=[],this.onSetReferenceVideos())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetReferenceVideos(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,videos:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceVideos()},async onRemove(){this.onSetReferenceVideos()}}}),ln={key:0,class:`relative`},un={class:`flex justify-between`},dn={class:`flex justify-start items-center`},fn={class:`text-sm font-bold`};function pn(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`);return t.capability.acceptsReferenceVideo?(g(),s(`div`,ln,[e(`div`,un,[e(`div`,dn,[e(`span`,fn,i(t.$t(`seedance.name.referenceVideo`)),1),a(m,{content:t.$t(`seedance.description.referenceVideo`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.mp4,.mov,.webm,.mkv,.avi`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`text`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(h,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var mn=B(cn,[[`render`,pn],[`__scopeId`,`data-v-b212c474`]]),hn=v({name:`SeedanceServiceTierSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:ce,label:this.$t(`seedance.serviceTier.default`)},{value:ue,label:this.$t(`seedance.serviceTier.flex`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.service_tier},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,service_tier:e})}}},mounted(){this.value||=k}}),gn={class:`field`},_n={class:`label`},vn={class:`box`},yn={class:`title font-bold`};function bn(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,gn,[e(`div`,_n,[e(`div`,vn,[e(`h2`,yn,i(t.$t(`seedance.name.serviceTier`)),1),a(m,{content:t.$t(`seedance.description.serviceTier`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedance.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var xn=B(hn,[[`render`,bn],[`__scopeId`,`data-v-cc938de2`]]),Sn=v({name:`SeedanceReturnLastFrameSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{model(){return this.$store.state.seedance?.config?.model},isSupported(){return L(this.model).acceptsReturnLastFrame},value:{get(){return this.$store.state.seedance?.config?.return_last_frame},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,return_last_frame:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),Cn={key:0,class:`field`},wn={class:`label`},Tn={class:`box`},En={class:`title font-bold`},Dn={class:`value`};function On(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-switch`);return t.isSupported?(g(),s(`div`,Cn,[e(`div`,wn,[e(`div`,Tn,[e(`h2`,En,i(t.$t(`seedance.name.returnLastFrame`)),1),a(f,{content:t.$t(`seedance.description.returnLastFrame`),class:`info`},null,8,[`content`])])]),e(`div`,Dn,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):o(``,!0)}var kn=B(Sn,[[`render`,On],[`__scopeId`,`data-v-edea5451`]]),An=v({name:`SeedanceSeedInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedance?.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.$store.state.seedance?.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedance/setConfig`,t)}}}}),jn={class:`field`},Mn={class:`label`},Nn={class:`box`},Pn={class:`title font-bold`},Fn={class:`value`};function In(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`);return g(),s(`div`,jn,[e(`div`,Mn,[e(`div`,Nn,[e(`h2`,Pn,i(t.$t(`seedance.name.seed`)),1),a(d,{content:t.$t(`seedance.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Fn,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])}var Ln=v({name:`SeedanceConfigPanel`,components:{ElButton:q,FontAwesomeIcon:Y,PromptInput:Ie,ModelSelector:Ue,DurationSelector:Xe,ResolutionSelector:it,RatioSelector:ht,GenerateAudioSwitch:Ct,CameraFixedSwitch:jt,ServiceTierSelector:xn,ReturnLastFrameSwitch:kn,SeedInput:B(An,[[`render`,In],[`__scopeId`,`data-v-685a9869`]]),FirstFrameImage:zt,LastFrameImage:Kt,ReferenceImage:$t,ReferenceAudio:sn,ReferenceVideo:mn,Consumption:_e},emits:[`generate`],computed:{config(){return this.$store.state.seedance?.config},consumption(){return H(this.config,this.service?.cost)},service(){return this.$store.state.seedance?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Rn={class:`flex flex-col h-full`},zn={class:`flex-1 overflow-y-auto p-5`},Bn={class:`flex flex-col items-center justify-center px-5 pb-5`};function Vn(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`model-selector`),h=l(`ratio-selector`),_=l(`resolution-selector`),v=l(`duration-selector`),y=l(`service-tier-selector`),b=l(`generate-audio-switch`),x=l(`camera-fixed-switch`),S=l(`return-last-frame-switch`),C=l(`seed-input`),w=l(`first-frame-image`),T=l(`last-frame-image`),E=l(`reference-image`),D=l(`reference-audio`),O=l(`reference-video`),k=l(`consumption`),A=l(`font-awesome-icon`),j=l(`el-button`);return g(),s(`div`,Rn,[e(`div`,zn,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`}),a(w,{class:`mb-2`}),a(T,{class:`mb-2`}),a(E,{class:`mb-2`}),a(D,{class:`mb-2`}),a(O,{class:`mb-2`})]),e(`div`,Bn,[a(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(j,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`seedance.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Hn=B(Ln,[[`render`,Vn]]),Un=v({name:`SeedanceTaskPreview`,components:{ElImage:C,CopyToClipboard:he,FontAwesomeIcon:Y,ElAlert:w,VideoPlayer:be,ElTooltip:S,ElButton:q,ImageWrapper:Te,ImagePreview:X,AudioPreview:Ee,VideoPreview:De,ApiCodeButton:xe},props:{modelValue:{type:Object,required:!0}},data(){return{seedanceLogo:re}},computed:{video(){return this.modelValue?.response?.data},promptText(){let e=this.modelValue?.request;if(e?.prompt)return e.prompt;let t=e?.content?.find(e=>e?.type===`text`&&e?.text);return t?.text?t.text:this.video?.prompt},referenceImages(){let e=this.collectImages();if(e.length===0)return[];let t=[],n=e.find(e=>e?.role===`first_frame`);n?.url&&t.push({url:n.url,name:`first-frame`});let r=e.find(e=>e?.role===`last_frame`);return r?.url&&t.push({url:r.url,name:`last-frame`}),e.forEach((e,n)=>{e?.url&&e.role!==`first_frame`&&e.role!==`last_frame`&&t.push({url:e.url,name:e.role||`image-${n}`})}),t},referenceAudios(){let e=this.modelValue?.request,t=(e?.audios??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`audio_url`&&e?.audio_url?.url&&t.push(e.audio_url.url)}),t},referenceVideos(){let e=this.modelValue?.request,t=(e?.videos??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`video_url`&&e?.video_url?.url&&t.push(e.video_url.url)}),t}},methods:{collectImages(){let e=this.modelValue?.request,t=Array.isArray(e?.images)?[...e.images]:[];return(e?.content??[]).forEach(e=>{e?.type===`image_url`&&e?.image_url?.url&&t.push({url:e.image_url.url,role:e.role})}),t},onDownload(e){window.open(e,`_blank`)}}}),Wn={class:`preview`},Gn={class:`left`},Kn={class:`main`},qn={class:`bot`},Jn={class:`datetime`},Yn={class:`info`},Xn={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Zn={key:1,class:`prompt mt-2`},Qn={key:0},$n={key:1},er={key:0,class:n({content:!0})},tr={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nr={key:1,class:n({content:!0})},rr={key:0,class:`mb-4`},ir={key:1,class:`mb-4`},ar={key:2,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},or={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cr={key:0},lr={key:1},ur={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fr={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pr={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},mr={key:2,class:n({content:!0})},hr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_r={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},yr={key:3,class:n({content:!0})},br={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Sr(n,u,d,m,_,v){let y=l(`el-image`),b=l(`image-preview`),x=l(`audio-preview`),S=l(`video-preview`),C=l(`font-awesome-icon`),w=l(`copy-to-clipboard`),T=l(`el-alert`),E=l(`video-player`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`el-tooltip`),A=l(`api-code-button`);return g(),s(`div`,Wn,[e(`div`,Gn,[a(y,{src:n.seedanceLogo,class:`avatar`},null,8,[`src`])]),e(`div`,Kn,[e(`div`,qn,[r(i(n.$t(`seedance.name.seedanceBot`))+` `,1),e(`span`,Jn,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Yn,[n.referenceImages.length>0||n.referenceAudios.length>0||n.referenceVideos.length>0?(g(),s(`div`,Xn,[(g(!0),s(c,null,h(n.referenceImages,(e,t)=>(g(),f(b,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceAudios,(e,t)=>(g(),f(x,{key:`audio-${t}`,url:e,name:`audio-${t+1}`},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceVideos,(e,t)=>(g(),f(S,{key:`video-${t}`,url:e,name:`video-${t+1}`},null,8,[`url`,`name`]))),128))])):o(``,!0),n.promptText?(g(),s(`p`,Zn,[r(i(n.promptText)+` `,1),n.modelValue?.response?n.video?.status===`processing`||n.video?.status===`pending`?(g(),s(`span`,$n,` - (`+i(n.$t(`seedance.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,Qn,` - (`+i(n.$t(`seedance.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,nr,[n.video?.video_url?(g(),s(`div`,rr,[a(E,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.last_frame_url?(g(),s(`div`,ir,[a(D,{src:n.video?.last_frame_url,"raw-src":n.video?.last_frame_url},null,8,[`src`,`raw-src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,ar,[a(k,{class:`box-item`,effect:`dark`,content:n.$t(`seedance.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`seedance.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(A,{path:`/seedance/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,or,[a(C,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.video?.duration?(g(),s(`p`,sr,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.duration`))+`: `+i(n.video?.duration)+`s `,1)])):o(``,!0),n.video?.resolution?(g(),s(`p`,$,[a(C,{icon:`fa-solid fa-expand`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.resolution`))+`: `+i(n.video?.resolution)+` `,1),n.video?.ratio?(g(),s(`span`,cr,` · `+i(n.video?.ratio),1)):o(``,!0),n.video?.framespersecond?(g(),s(`span`,lr,` · `+i(n.video?.framespersecond)+`fps`,1)):o(``,!0)])):o(``,!0),n.modelValue?.request?.generate_audio?(g(),s(`p`,ur,[a(C,{icon:`fa-solid fa-volume-up`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.generateAudio`))+`: `+i(n.$t(`seedance.button.on`)),1)])):o(``,!0),e(`p`,dr,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,fr,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,pr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(g(),s(`div`,mr,[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.failure`)),1)]),default:p(()=>[e(`p`,hr,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,gr,[a(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(w,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(g(),s(`p`,_r,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,vr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,yr,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.status`)),1)]),default:p(()=>[e(`p`,br,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,xr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,er,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(C,{icon:`fa-regular fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.status.pending`)),1)]),default:p(()=>[e(`p`,tr,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var Cr=v({name:`SeedanceRecentPanel`,components:{TaskPreview:B(Un,[[`render`,Sr],[`__scopeId`,`data-v-be65e8a9`]]),BotPlaceholder:Se,NoTasks:Ce,ScrollList:ve},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedance?.tasks,items:this.$store.state.seedance?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),wr={key:0},Tr={key:2,class:`w-full h-full flex items-center justify-center`};function Er(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,wr,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Tr,[a(v)])):o(``,!0)],64)}var Dr=v({name:`SeedanceIndex`,components:{ConfigPanel:Hn,Layout:Ne,RecentPanel:B(Cr,[[`render`,Er]])},mixins:[fe],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.seedance?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.seedance?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.seedance?.credential},config(){return this.$store.state.seedance?.config},tasks(){return this.$store.state.seedance?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ye({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`seedance/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`seedance/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!V(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.images)){e.images=e.images.filter(e=>!!e?.url);let t=e.images.some(e=>e?.role===`first_frame`),n=e.images.some(e=>e?.role===`last_frame`);!t&&n&&(e.images=e.images.map(e=>e?.role===`last_frame`?{...e,role:`first_frame`}:e))}let t=Array.isArray(e?.images)&&e.images.length>0;if(!t&&`images`in e&&delete e.images,e?.model&&!ae[e.model]){J.warning(this.$t(`seedance.message.modelUnsupported`));return}let n=L(e?.model);if(n.requiresImage&&!t){J.warning(this.$t(`seedance.message.modelRequiresImage`));return}if(!n.acceptsImage&&t){J.warning(this.$t(`seedance.message.modelRejectsImage`));return}if(!n.acceptsText&&!t){J.warning(this.$t(`seedance.message.modelRequiresImage`));return}!n.acceptsAudio&&e.generate_audio&&(e.generate_audio=!1),!n.acceptsReturnLastFrame&&e.return_last_frame&&(e.return_last_frame=!1),!n.acceptsLastFrame&&t&&(e.images=e.images.filter(e=>e?.role!==`last_frame`)),n.acceptsReferenceAudio&&Array.isArray(e?.audios)&&(e.audios=e.audios.filter(e=>e?.url)),(!n.acceptsReferenceAudio||!Array.isArray(e?.audios)||e.audios.length===0)&&delete e.audios,n.acceptsReferenceVideo&&Array.isArray(e?.videos)&&(e.videos=e.videos.filter(e=>e?.url)),(!n.acceptsReferenceVideo||!Array.isArray(e?.videos)||e.videos.length===0)&&delete e.videos,!n.acceptsReferenceImage&&Array.isArray(e?.images)&&(e.images=e.images.filter(e=>e?.role!==`reference_image`),e.images.length===0&&delete e.images);let r=Array.isArray(e?.images)&&e.images.some(e=>e?.role===`reference_image`);if(Array.isArray(e?.audios)&&e.audios.length>0&&!r){J.warning(this.$t(`seedance.message.audioRequiresReferenceImage`));return}let i={...e,async:!0};if(!z())return;let a=this.credential?.token;if(!a){console.error(`no token specified`);return}J.info(this.$t(`seedance.message.startingTask`)),pe(`seedance`,me.generate(i,{token:a})).then(()=>{J.success(this.$t(`seedance.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?J.error(this.$t(`seedance.message.usedUp`)):J.error(this.$t(`seedance.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Or(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var kr=B(Dr,[[`render`,Or]]);export{kr as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-HoauzLaT.js";import{t as x}from"./upload-BczdKCgl.js";import{t as S}from"./tooltip-vx_1Kj1D.js";import{t as C}from"./image-CBjQluJz.js";import{t as w}from"./alert-CqfK6I_P.js";import{t as T}from"./drawer-D8wfk1R6.js";import{t as E}from"./input-number-CqZtT6zo.js";import{t as D}from"./switch-C_SQuBN-.js";import{$t as O,Bt as k,Gt as A,Ht as j,Jt as ee,Kt as te,Lt as M,Qt as N,Rt as P,Ut as ne,Vt as re,Wt as ie,Xt as ae,Yt as oe,Zt as se,an as ce,en as le,nn as F,on as ue,qt as de,rn as I,sn as L,tn as R}from"./constants-CzGOanfS.js";import{$t as z,A as B,Bt as V,Gt as H,Ht as fe,Kr as U,Ur as W,Ut as G,Vt as K,mi as q,ri as J,rr as pe,vn as me}from"./index-D9GtY1Yk.js";import{t as Y}from"./index.es-B-37pVAR.js";import{t as he}from"./CopyToClipboard-cDfZUBnE.js";import{t as X}from"./ImagePreview-9oC3URyM.js";import{n as ge}from"./taskDrawerMixin-DyAUhFEq.js";import{t as _e}from"./Consumption-MRvsOx6V.js";import{i as Z,n as ve,t as ye}from"./pagination-CR-ztfxo.js";import{t as be}from"./VideoPlayer-Ca_Xz8CP.js";import{t as xe}from"./ApiCodeButton-DvrUGiTL.js";import{t as Se}from"./BotPlaceholder-Dt69aobm.js";import{t as Ce}from"./NoTasks-DRIp5LO0.js";import{t as we}from"./PromptTextarea-DWq1L_Vc.js";import{t as Te}from"./ImageWrapper-DaMTHMuH.js";import{n as Ee,t as De}from"./VideoPreview-D_-7yVdF.js";var Oe=v({name:`LayoutSeedance`,components:{ElDrawer:T,ElButton:q,FontAwesomeIcon:Y},mixins:[ge]}),ke={class:`main flex flex-row flex-1`},Ae={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},je={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Me(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,ke,[e(`div`,Ae,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,je,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{icon:`fa-solid fa-magic`})]),_:1},512),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Ne=B(Oe,[[`render`,Me],[`__scopeId`,`data-v-ec312952`]]),Pe=v({name:`SeedancePromptInput`,components:{PromptTextarea:we},computed:{prompt:{get(){return this.$store.state.seedance?.config?.prompt},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Fe(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedance.name.prompt`),info:e.$t(`seedance.description.prompt`),placeholder:e.$t(`seedance.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ie=B(Pe,[[`render`,Fe]]),Le=v({name:`SeedanceModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:de,label:this.$t(`seedance.model.seedance20`)},{value:ee,label:this.$t(`seedance.model.seedance20Fast`)},{value:oe,label:this.$t(`seedance.model.seedance20Mini`)},{value:te,label:this.$t(`seedance.model.seedance15pro`)},{value:ie,label:this.$t(`seedance.model.seedance10pro`)},{value:A,label:this.$t(`seedance.model.seedance10proFast`)},{value:ne,label:this.$t(`seedance.model.seedance10liteT2v`)},{value:j,label:this.$t(`seedance.model.seedance10liteI2v`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.model},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,model:e})}}},mounted(){this.value||=M}}),Re={class:`field`},ze={class:`label`},Be={class:`box`},Ve={class:`title font-bold`};function He(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`h2`,Ve,i(t.$t(`seedance.name.model`)),1),a(m,{content:t.$t(`seedance.description.model`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedance.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ue=B(Le,[[`render`,He],[`__scopeId`,`data-v-deb4c429`]]),We=v({name:`SeedanceDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},options(){let e=[];this.capability.supportsAutoDuration&&e.push({value:-1,label:`${this.$t(`seedance.placeholder.seed`)} (-1)`});for(let t=this.capability.minDuration;t<=this.capability.maxDuration;t++)e.push({value:t,label:`${t}s`});return e},value:{get(){return this.$store.state.seedance?.config?.duration},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,duration:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=5},methods:{clampValue(){let e=this.value;e!==void 0&&!(e===-1&&this.capability.supportsAutoDuration)&&(e<this.capability.minDuration||e>this.capability.maxDuration)&&(this.value=5)}}}),Ge={class:`field`},Ke={class:`label`},qe={class:`box`},Je={class:`title font-bold`};function Ye(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Ge,[e(`div`,Ke,[e(`div`,qe,[e(`h2`,Je,i(t.$t(`seedance.name.duration`)),1),a(m,{content:t.$t(`seedance.description.duration`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedance.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Xe=B(We,[[`render`,Ye],[`__scopeId`,`data-v-d61cc21b`]]),Q={[F]:0,[I]:1,[R]:2,"4k":3},Ze=v({name:`SeedanceResolutionSelector`,components:{InfoIcon:Z,ElTooltip:S},computed:{model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},options(){let e=[{value:F,label:`480p`},{value:I,label:`720p`},{value:R,label:`1080p`},{value:`4k`,label:`4k`}],t=Q[this.capability.maxResolution]??Q[`1080p`];return e.map(e=>({...e,disabled:Q[e.value]>t}))},value:{get(){return this.$store.state.seedance?.config?.resolution},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,resolution:e})}}},watch:{model(){this.clampValue()}},mounted(){this.value?this.clampValue():this.value=this.capability.defaultResolution||`720p`},methods:{onSelect(e){e.disabled||(this.value=e.value)},clampValue(){let e=this.value,t=this.options.find(t=>t.value===e);(!e||t&&t.disabled)&&(this.value=this.capability.defaultResolution||`720p`)}}}),Qe={class:`resolution`},$e={class:`header`},et={class:`title font-bold`},tt={class:`items`},nt=[`onClick`];function rt(t,r,o,u,d,m){let _=l(`info-icon`),v=l(`el-tooltip`);return g(),s(`div`,Qe,[e(`div`,$e,[e(`h2`,et,i(t.$t(`seedance.name.resolution`)),1),a(_,{content:t.$t(`seedance.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,tt,[(g(!0),s(c,null,h(t.options,r=>(g(),f(v,{key:r.value,content:t.$t(`seedance.message.resolutionNotSupported`),disabled:!r.disabled,placement:`top`},{default:p(()=>[e(`div`,{class:n([`item`,{active:t.value===r.value,disabled:r.disabled}]),onClick:e=>t.onSelect(r)},i(r.label),11,nt)]),_:2},1032,[`content`,`disabled`]))),128))])])}var it=B(Ze,[[`render`,rt],[`__scopeId`,`data-v-db7e8aff`]]),at=v({name:`SeedanceRatioSelector`,components:{InfoIcon:Z},computed:{options(){return[{value:se,label:`16:9`,w:32,h:18},{value:O,label:`9:16`,w:18,h:32},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`1:1`,label:`1:1`,w:24,h:24},{value:N,label:`21:9`,w:34,h:14},{value:le,label:this.$t(`seedance.ratio.adaptive`),w:0,h:0}]},value:{get(){return this.$store.state.seedance?.config?.ratio},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,ratio:e})}}},mounted(){this.value||=P}}),ot={class:`ratio`},st={class:`header`},ct={class:`title font-bold`},lt={class:`items`},ut=[`onClick`],dt={class:`preview`},ft={key:1,class:`rect rect-auto`},pt={class:`name`};function mt(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,ot,[e(`div`,st,[e(`h2`,ct,i(t.$t(`seedance.name.ratio`)),1),a(p,{content:t.$t(`seedance.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,lt,[(g(!0),s(c,null,h(t.options,r=>(g(),s(`div`,{key:r.value,class:n([`item`,{active:t.value===r.value}]),onClick:e=>t.value=r.value},[e(`div`,dt,[r.w&&r.h?(g(),s(`div`,{key:0,class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)):(g(),s(`div`,ft,`A`))]),e(`div`,pt,i(r.label),1)],10,ut))),128))])])}var ht=B(at,[[`render`,mt],[`__scopeId`,`data-v-8ddec2dd`]]),gt=v({name:`SeedanceGenerateAudioSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{isSupported(){let e=this.$store.state.seedance?.config?.model;return L(e).acceptsAudio},value:{get(){return this.$store.state.seedance?.config?.generate_audio??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,generate_audio:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),_t={key:0,class:`field`},vt={class:`label`},yt={class:`box`},bt={class:`title font-bold`},xt={class:`value`};function St(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-switch`);return t.isSupported?(g(),s(`div`,_t,[e(`div`,vt,[e(`div`,yt,[e(`h2`,bt,i(t.$t(`seedance.name.generateAudio`)),1),a(f,{content:t.$t(`seedance.description.generateAudio`),class:`info`},null,8,[`content`])])]),e(`div`,xt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):o(``,!0)}var Ct=B(gt,[[`render`,St],[`__scopeId`,`data-v-df51dfbd`]]),wt=v({name:`SeedanceCameraFixedSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{value:{get(){return this.$store.state.seedance?.config?.camerafixed??!1},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,camerafixed:e})}}},mounted(){this.$store.state.seedance?.config?.camerafixed===void 0&&(this.value=!1)}}),Tt={class:`field`},Et={class:`label`},Dt={class:`box`},Ot={class:`title font-bold`},kt={class:`value`};function At(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,Tt,[e(`div`,Et,[e(`div`,Dt,[e(`h2`,Ot,i(t.$t(`seedance.name.cameraFixed`)),1),a(d,{content:t.$t(`seedance.description.cameraFixed`),class:`info`},null,8,[`content`])])]),e(`div`,kt,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])}var jt=B(wt,[[`render`,At],[`__scopeId`,`data-v-ae777d61`]]),Mt=v({name:`SeedanceFirstFrameImage`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y,ImagePreview:X},mixins:[G,K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsImage"(e){e||(this.fileList=[],this.onSetFirstFrameUrl())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetFirstFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`first_frame`);e&&t.push({url:e,role:`first_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetFirstFrameUrl()},async onRemove(){this.onSetFirstFrameUrl()}}}),Nt={key:0,class:`relative`},Pt={class:`flex justify-between`},Ft={class:`flex justify-start items-center`},It={class:`text-sm font-bold`},Lt={key:0,class:`required-badge`};function Rt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsImage?(g(),s(`div`,Nt,[e(`div`,Pt,[e(`div`,Ft,[e(`span`,It,i(t.$t(`seedance.name.firstFrame`)),1),t.capability.requiresImage?(g(),s(`span`,Lt,i(t.$t(`seedance.name.required`)),1)):o(``,!0),a(h,{content:t.$t(`seedance.description.firstFrame`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var zt=B(Mt,[[`render`,Rt],[`__scopeId`,`data-v-e2597f23`]]),Bt=v({name:`SeedanceLastFrameImage`,components:{ElUpload:x,ElButton:q,ImagePreview:X,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[G,K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsLastFrame"(e){e||(this.fileList=[],this.onSetLastFrameUrl())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetLastFrameUrl(){let e=this.urls?.[0],t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`last_frame`);e&&t.push({url:e,role:`last_frame`}),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetLastFrameUrl()},async onRemove(){this.onSetLastFrameUrl()}}}),Vt={key:0,class:`relative`},Ht={class:`flex justify-between`},Ut={class:`flex justify-start items-center`},Wt={class:`text-sm font-bold`};function Gt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsLastFrame?(g(),s(`div`,Vt,[e(`div`,Ht,[e(`div`,Ut,[e(`span`,Wt,i(t.$t(`seedance.name.lastFrame`)),1),a(h,{content:t.$t(`seedance.description.lastFrame`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var Kt=B(Bt,[[`render`,Gt],[`__scopeId`,`data-v-3a191e51`]]),qt=v({name:`SeedanceReferenceImage`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y,ImagePreview:X},mixins:[G,K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceImage"(e){e||(this.fileList=[],this.onSetReferenceImageUrls())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetReferenceImageUrls(){let e=(this.urls||[]).filter(Boolean),t=(this.$store.state.seedance?.config?.images||[]).filter(e=>e?.role!==`reference_image`);e.forEach(e=>t.push({url:e,role:`reference_image`})),this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,images:t.length>0?t:void 0})},async onSuccess(){this.onSetReferenceImageUrls()},async onRemove(){this.onSetReferenceImageUrls()}}}),Jt={key:0,class:`relative`},Yt={class:`flex justify-between`},Xt={class:`flex justify-start items-center`},Zt={class:`text-sm font-bold`};function Qt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`el-button`),b=l(`el-upload`);return t.capability.acceptsReferenceImage?(g(),s(`div`,Jt,[e(`div`,Yt,[e(`div`,Xt,[e(`span`,Zt,i(t.$t(`seedance.name.referenceImage`)),1),a(h,{content:t.$t(`seedance.description.referenceImage`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var $t=B(qt,[[`render`,Qt],[`__scopeId`,`data-v-230a67f6`]]),en=v({name:`SeedanceReferenceAudio`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceAudio"(e){e||(this.fileList=[],this.onSetReferenceAudios())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetReferenceAudios(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,audios:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceAudios()},async onRemove(){this.onSetReferenceAudios()}}}),tn={key:0,class:`relative`},nn={class:`flex justify-between`},rn={class:`flex justify-start items-center`},an={class:`text-sm font-bold`};function on(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`);return t.capability.acceptsReferenceAudio?(g(),s(`div`,tn,[e(`div`,nn,[e(`div`,rn,[e(`span`,an,i(t.$t(`seedance.name.referenceAudio`)),1),a(m,{content:t.$t(`seedance.description.referenceAudio`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac,.ogg,.flac`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`text`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(h,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var sn=B(en,[[`render`,on],[`__scopeId`,`data-v-49515675`]]),cn=v({name:`SeedanceReferenceVideo`,components:{ElUpload:x,ElButton:q,InfoIcon:Z,FontAwesomeIcon:Y},mixins:[K],data(){return{fileList:[],uploadUrl:U()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},model(){return this.$store.state.seedance?.config?.model},capability(){return L(this.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{"capability.acceptsReferenceVideo"(e){e||(this.fileList=[],this.onSetReferenceVideos())}},methods:{onExceed(){J.warning(this.$t(`seedance.message.uploadExceed`))},onError(){J.error(this.$t(`seedance.message.uploadError`))},onSetReferenceVideos(){let e=(this.urls||[]).filter(Boolean);this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,videos:e.length>0?e.map(e=>({url:e})):void 0})},async onSuccess(){this.onSetReferenceVideos()},async onRemove(){this.onSetReferenceVideos()}}}),ln={key:0,class:`relative`},un={class:`flex justify-between`},dn={class:`flex justify-start items-center`},fn={class:`text-sm font-bold`};function pn(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`);return t.capability.acceptsReferenceVideo?(g(),s(`div`,ln,[e(`div`,un,[e(`div`,dn,[e(`span`,fn,i(t.$t(`seedance.name.referenceVideo`)),1),a(m,{content:t.$t(`seedance.description.referenceVideo`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.mp4,.mov,.webm,.mkv,.avi`,limit:1,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`text`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(h,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+i(t.$t(`seedance.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])):o(``,!0)}var mn=B(cn,[[`render`,pn],[`__scopeId`,`data-v-b212c474`]]),hn=v({name:`SeedanceServiceTierSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:ce,label:this.$t(`seedance.serviceTier.default`)},{value:ue,label:this.$t(`seedance.serviceTier.flex`)}]}},computed:{value:{get(){return this.$store.state.seedance?.config?.service_tier},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,service_tier:e})}}},mounted(){this.value||=k}}),gn={class:`field`},_n={class:`label`},vn={class:`box`},yn={class:`title font-bold`};function bn(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,gn,[e(`div`,_n,[e(`div`,vn,[e(`h2`,yn,i(t.$t(`seedance.name.serviceTier`)),1),a(m,{content:t.$t(`seedance.description.serviceTier`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedance.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var xn=B(hn,[[`render`,bn],[`__scopeId`,`data-v-cc938de2`]]),Sn=v({name:`SeedanceReturnLastFrameSwitch`,components:{ElSwitch:D,InfoIcon:Z},computed:{model(){return this.$store.state.seedance?.config?.model},isSupported(){return L(this.model).acceptsReturnLastFrame},value:{get(){return this.$store.state.seedance?.config?.return_last_frame},set(e){this.$store.commit(`seedance/setConfig`,{...this.$store.state.seedance?.config,return_last_frame:e})}}},watch:{isSupported(e){!e&&this.value&&(this.value=!1)}},mounted(){this.value===void 0&&(this.value=!1)}}),Cn={key:0,class:`field`},wn={class:`label`},Tn={class:`box`},En={class:`title font-bold`},Dn={class:`value`};function On(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-switch`);return t.isSupported?(g(),s(`div`,Cn,[e(`div`,wn,[e(`div`,Tn,[e(`h2`,En,i(t.$t(`seedance.name.returnLastFrame`)),1),a(f,{content:t.$t(`seedance.description.returnLastFrame`),class:`info`},null,8,[`content`])])]),e(`div`,Dn,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"inline-prompt":``,"active-text":t.$t(`seedance.button.on`),"inactive-text":t.$t(`seedance.button.off`)},null,8,[`modelValue`,`active-text`,`inactive-text`])])])):o(``,!0)}var kn=B(Sn,[[`render`,On],[`__scopeId`,`data-v-edea5451`]]),An=v({name:`SeedanceSeedInput`,components:{ElInputNumber:E,InfoIcon:Z},computed:{value:{get(){let e=this.$store.state.seedance?.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.$store.state.seedance?.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedance/setConfig`,t)}}}}),jn={class:`field`},Mn={class:`label`},Nn={class:`box`},Pn={class:`title font-bold`},Fn={class:`value`};function In(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`);return g(),s(`div`,jn,[e(`div`,Mn,[e(`div`,Nn,[e(`h2`,Pn,i(t.$t(`seedance.name.seed`)),1),a(d,{content:t.$t(`seedance.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Fn,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])}var Ln=v({name:`SeedanceConfigPanel`,components:{ElButton:q,FontAwesomeIcon:Y,PromptInput:Ie,ModelSelector:Ue,DurationSelector:Xe,ResolutionSelector:it,RatioSelector:ht,GenerateAudioSwitch:Ct,CameraFixedSwitch:jt,ServiceTierSelector:xn,ReturnLastFrameSwitch:kn,SeedInput:B(An,[[`render`,In],[`__scopeId`,`data-v-685a9869`]]),FirstFrameImage:zt,LastFrameImage:Kt,ReferenceImage:$t,ReferenceAudio:sn,ReferenceVideo:mn,Consumption:_e},emits:[`generate`],computed:{config(){return this.$store.state.seedance?.config},consumption(){return H(this.config,this.service?.cost)},service(){return this.$store.state.seedance?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Rn={class:`flex flex-col h-full`},zn={class:`flex-1 overflow-y-auto p-5`},Bn={class:`flex flex-col items-center justify-center px-5 pb-5`};function Vn(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`model-selector`),h=l(`ratio-selector`),_=l(`resolution-selector`),v=l(`duration-selector`),y=l(`service-tier-selector`),b=l(`generate-audio-switch`),x=l(`camera-fixed-switch`),S=l(`return-last-frame-switch`),C=l(`seed-input`),w=l(`first-frame-image`),T=l(`last-frame-image`),E=l(`reference-image`),D=l(`reference-audio`),O=l(`reference-video`),k=l(`consumption`),A=l(`font-awesome-icon`),j=l(`el-button`);return g(),s(`div`,Rn,[e(`div`,zn,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`}),a(w,{class:`mb-2`}),a(T,{class:`mb-2`}),a(E,{class:`mb-2`}),a(D,{class:`mb-2`}),a(O,{class:`mb-2`})]),e(`div`,Bn,[a(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(j,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`seedance.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Hn=B(Ln,[[`render`,Vn]]),Un=v({name:`SeedanceTaskPreview`,components:{ElImage:C,CopyToClipboard:he,FontAwesomeIcon:Y,ElAlert:w,VideoPlayer:be,ElTooltip:S,ElButton:q,ImageWrapper:Te,ImagePreview:X,AudioPreview:Ee,VideoPreview:De,ApiCodeButton:xe},props:{modelValue:{type:Object,required:!0}},data(){return{seedanceLogo:re}},computed:{video(){return this.modelValue?.response?.data},promptText(){let e=this.modelValue?.request;if(e?.prompt)return e.prompt;let t=e?.content?.find(e=>e?.type===`text`&&e?.text);return t?.text?t.text:this.video?.prompt},referenceImages(){let e=this.collectImages();if(e.length===0)return[];let t=[],n=e.find(e=>e?.role===`first_frame`);n?.url&&t.push({url:n.url,name:`first-frame`});let r=e.find(e=>e?.role===`last_frame`);return r?.url&&t.push({url:r.url,name:`last-frame`}),e.forEach((e,n)=>{e?.url&&e.role!==`first_frame`&&e.role!==`last_frame`&&t.push({url:e.url,name:e.role||`image-${n}`})}),t},referenceAudios(){let e=this.modelValue?.request,t=(e?.audios??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`audio_url`&&e?.audio_url?.url&&t.push(e.audio_url.url)}),t},referenceVideos(){let e=this.modelValue?.request,t=(e?.videos??[]).map(e=>e?.url).filter(Boolean);return(e?.content??[]).forEach(e=>{e?.type===`video_url`&&e?.video_url?.url&&t.push(e.video_url.url)}),t}},methods:{collectImages(){let e=this.modelValue?.request,t=Array.isArray(e?.images)?[...e.images]:[];return(e?.content??[]).forEach(e=>{e?.type===`image_url`&&e?.image_url?.url&&t.push({url:e.image_url.url,role:e.role})}),t},onDownload(e){window.open(e,`_blank`)}}}),Wn={class:`preview`},Gn={class:`left`},Kn={class:`main`},qn={class:`bot`},Jn={class:`datetime`},Yn={class:`info`},Xn={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Zn={key:1,class:`prompt mt-2`},Qn={key:0},$n={key:1},er={key:0,class:n({content:!0})},tr={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nr={key:1,class:n({content:!0})},rr={key:0,class:`mb-4`},ir={key:1,class:`mb-4`},ar={key:2,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},or={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sr={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cr={key:0},lr={key:1},ur={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fr={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pr={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},mr={key:2,class:n({content:!0})},hr={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_r={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vr={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},yr={key:3,class:n({content:!0})},br={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xr={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Sr(n,u,d,m,_,v){let y=l(`el-image`),b=l(`image-preview`),x=l(`audio-preview`),S=l(`video-preview`),C=l(`font-awesome-icon`),w=l(`copy-to-clipboard`),T=l(`el-alert`),E=l(`video-player`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`el-tooltip`),A=l(`api-code-button`);return g(),s(`div`,Wn,[e(`div`,Gn,[a(y,{src:n.seedanceLogo,class:`avatar`},null,8,[`src`])]),e(`div`,Kn,[e(`div`,qn,[r(i(n.$t(`seedance.name.seedanceBot`))+` `,1),e(`span`,Jn,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Yn,[n.referenceImages.length>0||n.referenceAudios.length>0||n.referenceVideos.length>0?(g(),s(`div`,Xn,[(g(!0),s(c,null,h(n.referenceImages,(e,t)=>(g(),f(b,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceAudios,(e,t)=>(g(),f(x,{key:`audio-${t}`,url:e,name:`audio-${t+1}`},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceVideos,(e,t)=>(g(),f(S,{key:`video-${t}`,url:e,name:`video-${t+1}`},null,8,[`url`,`name`]))),128))])):o(``,!0),n.promptText?(g(),s(`p`,Zn,[r(i(n.promptText)+` `,1),n.modelValue?.response?n.video?.status===`processing`||n.video?.status===`pending`?(g(),s(`span`,$n,` - (`+i(n.$t(`seedance.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,Qn,` - (`+i(n.$t(`seedance.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,nr,[n.video?.video_url?(g(),s(`div`,rr,[a(E,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.last_frame_url?(g(),s(`div`,ir,[a(D,{src:n.video?.last_frame_url,"raw-src":n.video?.last_frame_url},null,8,[`src`,`raw-src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,ar,[a(k,{class:`box-item`,effect:`dark`,content:n.$t(`seedance.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`seedance.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(A,{path:`/seedance/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,or,[a(C,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.video?.duration?(g(),s(`p`,sr,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.duration`))+`: `+i(n.video?.duration)+`s `,1)])):o(``,!0),n.video?.resolution?(g(),s(`p`,$,[a(C,{icon:`fa-solid fa-expand`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.resolution`))+`: `+i(n.video?.resolution)+` `,1),n.video?.ratio?(g(),s(`span`,cr,` · `+i(n.video?.ratio),1)):o(``,!0),n.video?.framespersecond?(g(),s(`span`,lr,` · `+i(n.video?.framespersecond)+`fps`,1)):o(``,!0)])):o(``,!0),n.modelValue?.request?.generate_audio?(g(),s(`p`,ur,[a(C,{icon:`fa-solid fa-volume-up`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.generateAudio`))+`: `+i(n.$t(`seedance.button.on`)),1)])):o(``,!0),e(`p`,dr,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,fr,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,pr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(g(),s(`div`,mr,[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.failure`)),1)]),default:p(()=>[e(`p`,hr,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,gr,[a(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(w,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(g(),s(`p`,_r,[a(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,vr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,yr,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.status`)),1)]),default:p(()=>[e(`p`,br,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,xr,[a(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,er,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(C,{icon:`fa-regular fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`seedance.status.pending`)),1)]),default:p(()=>[e(`p`,tr,[a(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`seedance.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var Cr=v({name:`SeedanceRecentPanel`,components:{TaskPreview:B(Un,[[`render`,Sr],[`__scopeId`,`data-v-be65e8a9`]]),BotPlaceholder:Se,NoTasks:Ce,ScrollList:ve},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedance?.tasks,items:this.$store.state.seedance?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),wr={key:0},Tr={key:2,class:`w-full h-full flex items-center justify-center`};function Er(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,wr,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Tr,[a(v)])):o(``,!0)],64)}var Dr=v({name:`SeedanceIndex`,components:{ConfigPanel:Hn,Layout:Ne,RecentPanel:B(Cr,[[`render`,Er]])},mixins:[fe],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.seedance?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.seedance?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.seedance?.credential},config(){return this.$store.state.seedance?.config},tasks(){return this.$store.state.seedance?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ye({tasks:this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`seedance/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`seedance/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!V(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.images)){e.images=e.images.filter(e=>!!e?.url);let t=e.images.some(e=>e?.role===`first_frame`),n=e.images.some(e=>e?.role===`last_frame`);!t&&n&&(e.images=e.images.map(e=>e?.role===`last_frame`?{...e,role:`first_frame`}:e))}let t=Array.isArray(e?.images)&&e.images.length>0;if(!t&&`images`in e&&delete e.images,e?.model&&!ae[e.model]){J.warning(this.$t(`seedance.message.modelUnsupported`));return}let n=L(e?.model);if(n.requiresImage&&!t){J.warning(this.$t(`seedance.message.modelRequiresImage`));return}if(!n.acceptsImage&&t){J.warning(this.$t(`seedance.message.modelRejectsImage`));return}if(!n.acceptsText&&!t){J.warning(this.$t(`seedance.message.modelRequiresImage`));return}!n.acceptsAudio&&e.generate_audio&&(e.generate_audio=!1),!n.acceptsReturnLastFrame&&e.return_last_frame&&(e.return_last_frame=!1),!n.acceptsLastFrame&&t&&(e.images=e.images.filter(e=>e?.role!==`last_frame`)),n.acceptsReferenceAudio&&Array.isArray(e?.audios)&&(e.audios=e.audios.filter(e=>e?.url)),(!n.acceptsReferenceAudio||!Array.isArray(e?.audios)||e.audios.length===0)&&delete e.audios,n.acceptsReferenceVideo&&Array.isArray(e?.videos)&&(e.videos=e.videos.filter(e=>e?.url)),(!n.acceptsReferenceVideo||!Array.isArray(e?.videos)||e.videos.length===0)&&delete e.videos,!n.acceptsReferenceImage&&Array.isArray(e?.images)&&(e.images=e.images.filter(e=>e?.role!==`reference_image`),e.images.length===0&&delete e.images);let r=Array.isArray(e?.images)&&e.images.some(e=>e?.role===`reference_image`);if(Array.isArray(e?.audios)&&e.audios.length>0&&!r){J.warning(this.$t(`seedance.message.audioRequiresReferenceImage`));return}let i={...e,async:!0};if(!z())return;let a=this.credential?.token;if(!a){console.error(`no token specified`);return}J.info(this.$t(`seedance.message.startingTask`)),pe(`seedance`,me.generate(i,{token:a})).then(()=>{J.success(this.$t(`seedance.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?J.error(this.$t(`seedance.message.usedUp`)):J.error(this.$t(`seedance.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Or(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var kr=B(Dr,[[`render`,Or]]);export{kr as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-rpgD1mTp.js";import{t as b}from"./upload-DoXD5sDs.js";import{t as x}from"./tooltip-D9nl8rAG.js";import{t as S}from"./image-DxExU-Rq.js";import{t as C}from"./alert-DVXIMt1v.js";import{t as w}from"./drawer-DTrWPYS_.js";import{t as T}from"./switch-BZ17H-wR.js";import{$r as E,Jr as D,Qr as O,Xr as k,Yr as A,Zr as j,ei as M,ii as N,ni as P}from"./constants-CzGOanfS.js";import{$t as F,A as I,Bt as L,Ci as R,Gt as z,Ht as ee,Kr as te,Pn as ne,Ur as B,Ut as V,Vt as H,mi as U,ri as W,rr as G}from"./index-BjernDcR.js";import{t as K}from"./index.es-DlaJnBWw.js";import{t as q}from"./CopyToClipboard-Ca8S-sqk.js";import{t as J}from"./ImagePreview-jaBLzHNB.js";import{n as Y}from"./taskDrawerMixin-DyAUhFEq.js";import{t as X}from"./Consumption-DLQ-BcIF.js";import{i as Z,n as re,t as ie}from"./pagination-TdP7XO5o.js";import{t as Q}from"./VideoPlayer-oKtmGvkU.js";import{t as ae}from"./ApiCodeButton-CT4kJONi.js";import{t as oe}from"./BotPlaceholder-DMdy5ReV.js";import{t as se}from"./NoTasks-TrlSu31_.js";import{t as ce}from"./PromptTextarea-CmibdYw8.js";var le=_({name:`LayoutVeo`,components:{ElDrawer:w,ElButton:U,FontAwesomeIcon:K},mixins:[Y]}),ue={class:`main flex flex-row flex-1`},de={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},fe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function pe(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,ue,[e(`div`,de,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,fe,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var me=I(le,[[`render`,pe],[`__scopeId`,`data-v-12b82bc3`]]),he=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`veo2`,label:`veo2`},{value:`veo2-fast`,label:`veo2-fast`},{value:`veo3`,label:`veo3`},{value:`veo3-fast`,label:`veo3-fast`},{value:`veo31-fast`,label:`veo31-fast`},{value:`veo31`,label:`veo31`},{value:`veo31-fast-ingredients`,label:`veo31-fast-ingredients`}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=j}}),ge={class:`field`},_e={class:`title font-bold`};function ve(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ge,[e(`h2`,_e,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ye=I(he,[[`render`,ve],[`__scopeId`,`data-v-a59d89c9`]]),be=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)},{value:`upsample`,label:this.$t(`veo.button.actionUpsample`)},{value:`extend`,label:this.$t(`veo.button.actionExtend`)},{value:`reshoot`,label:this.$t(`veo.button.actionReshoot`)},{value:`object_insert`,label:this.$t(`veo.button.actionObjectInsert`)},{value:`object_remove`,label:this.$t(`veo.button.actionObjectRemove`)}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||=D}}),xe={class:`field`},Se={class:`title font-bold`},Ce={class:`float-left`};function we(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,xe,[e(`h2`,Se,r(t.$t(`veo.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,Ce,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Te=I(be,[[`render`,we],[`__scopeId`,`data-v-f4d8785c`]]),Ee=_({name:`TranslationSelector`,components:{ElSwitch:T,InfoIcon:Z},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),De={class:`relative`},Oe={class:`flex justify-between`},ke={class:`flex justify-start items-center`},Ae={class:`text-sm font-bold`},je={class:`flex justify-end items-center`};function Me(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-switch`);return h(),o(`div`,De,[e(`div`,Oe,[e(`div`,ke,[e(`span`,Ae,r(t.$t(`veo.name.translation`)),1),i(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,je,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ne=I(Ee,[[`render`,Me]]),Pe=_({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=A}}),Fe={class:`text-sm font-bold mb-2 block`},Ie={class:`items`},Le=[`onClick`],Re={class:`name`};function ze(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Fe,r(n.$t(`veo.name.ratio`)),1),e(`div`,Ie,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.label])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,Re,r(i.label),1)],10,Le))),128))])])}var Be=I(Pe,[[`render`,ze],[`__scopeId`,`data-v-28c472c4`]]),Ve=_({name:`VideoFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.veo?.config}}}),He={class:`relative`},Ue={class:`flex mb-2`},We={class:`text-sm font-bold`};function Ge(t,n,i,s,l,u){let f=c(`video-player`);return h(),o(`div`,He,[e(`div`,Ue,[e(`span`,We,r(t.$t(`veo.name.action3`)),1)]),e(`div`,null,[t.config?.video_url?(h(),d(f,{key:0,src:t.config?.video_url},null,8,[`src`])):a(``,!0)])])}var Ke=I(Ve,[[`render`,Ge]]),qe=_({name:`VideoIdInput`,components:{ElInput:R},computed:{value:{get(){return this.$store.state.veo?.config?.video_id},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,video_id:e})}}}}),Je={class:`field`},Ye={class:`title font-bold`};function Xe(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,Je,[e(`h2`,Ye,r(t.$t(`veo.name.videoId`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.videoId`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var Ze=I(qe,[[`render`,Xe],[`__scopeId`,`data-v-6eba4026`]]),Qe=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:U,InfoIcon:Z,FontAwesomeIcon:K,ImagePreview:J},mixins:[V,H],emits:[`change`],data(){return{fileList:[],uploadUrl:te()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){W.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){W.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),$e={class:`relative`},et={class:`flex justify-between`},tt={class:`flex justify-start items-center`},nt={class:`text-sm font-bold`};function rt(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`span`,nt,r(t.$t(`veo.name.startEndImage`)),1),i(g,{content:t.$t(`veo.description.uploadStartEndImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var it=I(Qe,[[`render`,rt],[`__scopeId`,`data-v-f9a79b4a`]]),at=_({name:`UpsampleActionSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return N.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.upsample_action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,upsample_action:e})}}},mounted(){this.value||=E}}),ot={class:`field`},st={class:`title font-bold`};function ct(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ot,[e(`h2`,st,r(t.$t(`veo.name.upsampleAction`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var lt=I(at,[[`render`,ct],[`__scopeId`,`data-v-8b74a7ae`]]),ut=_({name:`ExtendModelSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return M.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){(!this.value||!M.includes(this.value))&&(this.value=k)}}),dt={class:`field`},ft={class:`title font-bold`};function pt(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,dt,[e(`h2`,ft,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var mt=I(ut,[[`render`,pt],[`__scopeId`,`data-v-cc3f9355`]]),ht=_({name:`MotionTypeSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return P.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.motion_type},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,motion_type:e})}}},mounted(){this.value||=O}}),gt={class:`field`},_t={class:`title font-bold`};function vt(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,gt,[e(`h2`,_t,r(t.$t(`veo.name.motionType`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),filterable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var yt=I(ht,[[`render`,vt],[`__scopeId`,`data-v-3affff3c`]]),bt=_({name:`ImageMaskInput`,components:{ElInput:R},computed:{value:{get(){return this.$store.state.veo?.config?.image_mask},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,image_mask:e})}}}}),xt={class:`field`},St={class:`title font-bold`};function Ct(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,xt,[e(`h2`,St,r(t.$t(`veo.name.imageMask`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.imageMask`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var wt=I(bt,[[`render`,Ct],[`__scopeId`,`data-v-6cc27c68`]]),Tt=_({name:`PromptInput`,components:{PromptTextarea:ce},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Et(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Dt=I(Tt,[[`render`,Et]]),Ot=[`upsample`,`extend`,`reshoot`,`object_insert`,`object_remove`,`get1080p`],kt=[`text2video`,`image2video`,`ingredients2video`],At=_({name:`ConfigPanel`,components:{ElButton:U,Consumption:X,FontAwesomeIcon:K,PromptInput:Dt,ModelSelector:ye,StartEndImage:it,ActionSelector:Te,VideoFromInput:Ke,VideoIdInput:Ze,UpsampleActionSelector:lt,ExtendModelSelector:mt,MotionTypeSelector:yt,ImageMaskInput:wt,TranslationSelector:Ne,AspectRatioSelector:Be},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},consumption(){return z(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service},isPostProcessing(){return Ot.includes(this.config?.action??``)},isGeneration(){return kt.includes(this.config?.action??``)}},methods:{onGenerate(){this.$emit(`generate`)}}}),jt={class:`flex flex-col h-full`},Mt={class:`flex-1 overflow-y-auto p-5`},Nt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pt(t,l,u,p,m,g){let _=c(`action-selector`),v=c(`video-from-input`),y=c(`video-id-input`),b=c(`upsample-action-selector`),x=c(`extend-model-selector`),S=c(`prompt-input`),C=c(`motion-type-selector`),w=c(`image-mask-input`),T=c(`translation-selector`),E=c(`aspect-ratio-selector`),D=c(`model-selector`),O=c(`start-end-image`),k=c(`consumption`),A=c(`font-awesome-icon`),j=c(`el-button`);return h(),o(`div`,jt,[e(`div`,Mt,[i(_,{class:`mb-4`}),t.isPostProcessing?(h(),o(s,{key:0},[t.config?.video_url?(h(),d(v,{key:0,class:`mb-4`})):a(``,!0),i(y,{class:`mb-4`})],64)):a(``,!0),t.config?.action===`upsample`?(h(),d(b,{key:1,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(x,{key:2,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(S,{key:3,class:`mb-4`})):a(``,!0),t.config?.action===`reshoot`?(h(),d(C,{key:4,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`?(h(),d(S,{key:5,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`||t.config?.action===`object_remove`?(h(),d(w,{key:6,class:`mb-4`})):a(``,!0),t.config?.action===`object_remove`?(h(),d(S,{key:7,class:`mb-4`})):a(``,!0),t.isGeneration?(h(),o(s,{key:8},[i(T,{class:`mb-4`}),i(E,{class:`mb-4`}),i(S,{class:`mb-4`}),t.config?.action===`ingredients2video`?a(``,!0):(h(),d(D,{key:0,class:`mb-4`})),t.config?.action===`image2video`||t.config?.action===`ingredients2video`?(h(),d(O,{key:1,class:`mb-2`})):a(``,!0)],64)):a(``,!0)]),e(`div`,Nt,[i(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(j,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ft=I(At,[[`render`,Pt]]),It=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:q,FontAwesomeIcon:K,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:U,ApiCodeButton:ae},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onPickAction(e,t,n,r){console.debug(`seed config from preview`,{action:n,upsampleAction:r,response:t}),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:n,video_id:t?.data?.[0]?.id,video_url:t?.data?.[0]?.video_url,...r?{upsample_action:r}:{}})},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Lt={class:`preview`},Rt={class:`left`},zt={class:`main`},Bt={class:`bot`},Vt={class:`datetime`},Ht={class:`info`},Ut={key:0,class:`prompt mt-2`},Wt={key:0},Gt={key:1},Kt={key:0,class:t({content:!0,failed:!0})},qt={key:0,class:`mb-4`},$={key:1,class:t({operations:!0,"mt-2":!0})},Jt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Zt={key:1,class:t({content:!0})},Qt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},en={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nn={key:2,class:t({content:!0})},rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function on(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,Lt,[e(`div`,Rt,[i(g,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),e(`div`,zt,[e(`div`,Bt,[n(r(t.$t(`veo.name.veoBot`))+` `,1),e(`span`,Vt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Ht,[t.modelValue?.request?.prompt?(h(),o(`p`,Ut,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,Wt,` - (`+r(t.$t(`veo.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`running`?(h(),o(`span`,Gt,` - (`+r(t.$t(`veo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,Kt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,qt,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,$,[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`1080p`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample1080p`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:1,type:`info`,size:`small`,class:`btn-action`,onClick:s[1]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`4k`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample4k`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:2,type:`info`,size:`small`,class:`btn-action`,onClick:s[2]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`gif`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsampleGif`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:3,type:`info`,size:`small`,class:`btn-action`,onClick:s[3]||=e=>t.onPickAction(e,t.modelValue?.response,`extend`)},{default:f(()=>[n(r(t.$t(`veo.button.actionExtend`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:4,type:`info`,size:`small`,class:`btn-action`,onClick:s[4]||=e=>t.onPickAction(e,t.modelValue?.response,`reshoot`)},{default:f(()=>[n(r(t.$t(`veo.button.actionReshoot`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:5,type:`info`,size:`small`,class:`btn-action`,onClick:s[5]||=e=>t.onPickAction(e,t.modelValue?.response,`object_insert`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectInsert`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:6,type:`info`,size:`small`,class:`btn-action`,onClick:s[6]||=e=>t.onPickAction(e,t.modelValue?.response,`object_remove`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectRemove`)),1)]),_:1})):a(``,!0),i(y,{class:`box-item`,effect:`dark`,content:t.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[7]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`veo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/veo/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,Jt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,Yt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,Xt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,Zt,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,Qt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,$t,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,en,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,tn,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===void 0?(h(),o(`div`,nn,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,rn,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,an,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var sn=_({name:`RecentPanel`,components:{TaskPreview:I(It,[[`render`,on],[`__scopeId`,`data-v-9698fe5f`]]),NoTasks:se,BotPlaceholder:oe,ScrollList:re},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),cn={key:0},ln={key:2,class:`w-full h-full flex items-center justify-center`};function un(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,cn,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,ln,[i(v)])):a(``,!0)],64)}var dn=_({name:`VeoIndex`,components:{ConfigPanel:Ft,Layout:me,RecentPanel:I(sn,[[`render`,un]])},mixins:[ee],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===B.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===B.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,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=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ie({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!L(this.uploadTracker,e=>this.$t(e),e=>W.warning(e)))return;let e={...this.config,async:!0};if(!F())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if(e.action===`image2video`&&!(e.image_urls&&e.image_urls.length>0)){W.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,W.info(this.$t(`veo.message.startingTask`)),G(`veo`,ne.generate(e,{token:t})).then(()=>{W.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?W.error(this.$t(`veo.message.usedUp`)):W.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function fn(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var pn=I(dn,[[`render`,fn]]);export{pn as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-HoauzLaT.js";import{t as b}from"./upload-BczdKCgl.js";import{t as x}from"./tooltip-vx_1Kj1D.js";import{t as S}from"./image-CBjQluJz.js";import{t as C}from"./alert-CqfK6I_P.js";import{t as w}from"./drawer-D8wfk1R6.js";import{t as T}from"./switch-C_SQuBN-.js";import{$r as E,Jr as D,Qr as O,Xr as k,Yr as A,Zr as j,ei as M,ii as N,ni as P}from"./constants-CzGOanfS.js";import{$t as F,A as I,Bt as L,Ci as R,Gt as z,Ht as ee,Kr as te,Pn as ne,Ur as B,Ut as V,Vt as H,mi as U,ri as W,rr as G}from"./index-D9GtY1Yk.js";import{t as K}from"./index.es-B-37pVAR.js";import{t as q}from"./CopyToClipboard-cDfZUBnE.js";import{t as J}from"./ImagePreview-9oC3URyM.js";import{n as Y}from"./taskDrawerMixin-DyAUhFEq.js";import{t as X}from"./Consumption-MRvsOx6V.js";import{i as Z,n as re,t as ie}from"./pagination-CR-ztfxo.js";import{t as Q}from"./VideoPlayer-Ca_Xz8CP.js";import{t as ae}from"./ApiCodeButton-DvrUGiTL.js";import{t as oe}from"./BotPlaceholder-Dt69aobm.js";import{t as se}from"./NoTasks-DRIp5LO0.js";import{t as ce}from"./PromptTextarea-DWq1L_Vc.js";var le=_({name:`LayoutVeo`,components:{ElDrawer:w,ElButton:U,FontAwesomeIcon:K},mixins:[Y]}),ue={class:`main flex flex-row flex-1`},de={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},fe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function pe(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,ue,[e(`div`,de,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,fe,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var me=I(le,[[`render`,pe],[`__scopeId`,`data-v-12b82bc3`]]),he=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`veo2`,label:`veo2`},{value:`veo2-fast`,label:`veo2-fast`},{value:`veo3`,label:`veo3`},{value:`veo3-fast`,label:`veo3-fast`},{value:`veo31-fast`,label:`veo31-fast`},{value:`veo31`,label:`veo31`},{value:`veo31-fast-ingredients`,label:`veo31-fast-ingredients`}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=j}}),ge={class:`field`},_e={class:`title font-bold`};function ve(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ge,[e(`h2`,_e,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ye=I(he,[[`render`,ve],[`__scopeId`,`data-v-a59d89c9`]]),be=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)},{value:`upsample`,label:this.$t(`veo.button.actionUpsample`)},{value:`extend`,label:this.$t(`veo.button.actionExtend`)},{value:`reshoot`,label:this.$t(`veo.button.actionReshoot`)},{value:`object_insert`,label:this.$t(`veo.button.actionObjectInsert`)},{value:`object_remove`,label:this.$t(`veo.button.actionObjectRemove`)}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||=D}}),xe={class:`field`},Se={class:`title font-bold`},Ce={class:`float-left`};function we(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,xe,[e(`h2`,Se,r(t.$t(`veo.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,Ce,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Te=I(be,[[`render`,we],[`__scopeId`,`data-v-f4d8785c`]]),Ee=_({name:`TranslationSelector`,components:{ElSwitch:T,InfoIcon:Z},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),De={class:`relative`},Oe={class:`flex justify-between`},ke={class:`flex justify-start items-center`},Ae={class:`text-sm font-bold`},je={class:`flex justify-end items-center`};function Me(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-switch`);return h(),o(`div`,De,[e(`div`,Oe,[e(`div`,ke,[e(`span`,Ae,r(t.$t(`veo.name.translation`)),1),i(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,je,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ne=I(Ee,[[`render`,Me]]),Pe=_({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=A}}),Fe={class:`text-sm font-bold mb-2 block`},Ie={class:`items`},Le=[`onClick`],Re={class:`name`};function ze(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Fe,r(n.$t(`veo.name.ratio`)),1),e(`div`,Ie,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.label])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,Re,r(i.label),1)],10,Le))),128))])])}var Be=I(Pe,[[`render`,ze],[`__scopeId`,`data-v-28c472c4`]]),Ve=_({name:`VideoFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.veo?.config}}}),He={class:`relative`},Ue={class:`flex mb-2`},We={class:`text-sm font-bold`};function Ge(t,n,i,s,l,u){let f=c(`video-player`);return h(),o(`div`,He,[e(`div`,Ue,[e(`span`,We,r(t.$t(`veo.name.action3`)),1)]),e(`div`,null,[t.config?.video_url?(h(),d(f,{key:0,src:t.config?.video_url},null,8,[`src`])):a(``,!0)])])}var Ke=I(Ve,[[`render`,Ge]]),qe=_({name:`VideoIdInput`,components:{ElInput:R},computed:{value:{get(){return this.$store.state.veo?.config?.video_id},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,video_id:e})}}}}),Je={class:`field`},Ye={class:`title font-bold`};function Xe(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,Je,[e(`h2`,Ye,r(t.$t(`veo.name.videoId`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.videoId`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var Ze=I(qe,[[`render`,Xe],[`__scopeId`,`data-v-6eba4026`]]),Qe=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:U,InfoIcon:Z,FontAwesomeIcon:K,ImagePreview:J},mixins:[V,H],emits:[`change`],data(){return{fileList:[],uploadUrl:te()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){W.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){W.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),$e={class:`relative`},et={class:`flex justify-between`},tt={class:`flex justify-start items-center`},nt={class:`text-sm font-bold`};function rt(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,$e,[e(`div`,et,[e(`div`,tt,[e(`span`,nt,r(t.$t(`veo.name.startEndImage`)),1),i(g,{content:t.$t(`veo.description.uploadStartEndImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var it=I(Qe,[[`render`,rt],[`__scopeId`,`data-v-f9a79b4a`]]),at=_({name:`UpsampleActionSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return N.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.upsample_action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,upsample_action:e})}}},mounted(){this.value||=E}}),ot={class:`field`},st={class:`title font-bold`};function ct(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ot,[e(`h2`,st,r(t.$t(`veo.name.upsampleAction`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var lt=I(at,[[`render`,ct],[`__scopeId`,`data-v-8b74a7ae`]]),ut=_({name:`ExtendModelSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return M.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){(!this.value||!M.includes(this.value))&&(this.value=k)}}),dt={class:`field`},ft={class:`title font-bold`};function pt(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,dt,[e(`h2`,ft,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var mt=I(ut,[[`render`,pt],[`__scopeId`,`data-v-cc3f9355`]]),ht=_({name:`MotionTypeSelector`,components:{ElSelect:v,ElOption:y},computed:{options(){return P.map(e=>({value:e,label:e}))},value:{get(){return this.$store.state.veo?.config?.motion_type},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,motion_type:e})}}},mounted(){this.value||=O}}),gt={class:`field`},_t={class:`title font-bold`};function vt(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,gt,[e(`h2`,_t,r(t.$t(`veo.name.motionType`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),filterable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var yt=I(ht,[[`render`,vt],[`__scopeId`,`data-v-3affff3c`]]),bt=_({name:`ImageMaskInput`,components:{ElInput:R},computed:{value:{get(){return this.$store.state.veo?.config?.image_mask},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,image_mask:e})}}}}),xt={class:`field`},St={class:`title font-bold`};function Ct(t,n,a,s,l,u){let d=c(`el-input`);return h(),o(`div`,xt,[e(`h2`,St,r(t.$t(`veo.name.imageMask`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,type:`text`,placeholder:t.$t(`veo.placeholder.imageMask`),clearable:``},null,8,[`modelValue`,`placeholder`])])}var wt=I(bt,[[`render`,Ct],[`__scopeId`,`data-v-6cc27c68`]]),Tt=_({name:`PromptInput`,components:{PromptTextarea:ce},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Et(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Dt=I(Tt,[[`render`,Et]]),Ot=[`upsample`,`extend`,`reshoot`,`object_insert`,`object_remove`,`get1080p`],kt=[`text2video`,`image2video`,`ingredients2video`],At=_({name:`ConfigPanel`,components:{ElButton:U,Consumption:X,FontAwesomeIcon:K,PromptInput:Dt,ModelSelector:ye,StartEndImage:it,ActionSelector:Te,VideoFromInput:Ke,VideoIdInput:Ze,UpsampleActionSelector:lt,ExtendModelSelector:mt,MotionTypeSelector:yt,ImageMaskInput:wt,TranslationSelector:Ne,AspectRatioSelector:Be},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},consumption(){return z(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service},isPostProcessing(){return Ot.includes(this.config?.action??``)},isGeneration(){return kt.includes(this.config?.action??``)}},methods:{onGenerate(){this.$emit(`generate`)}}}),jt={class:`flex flex-col h-full`},Mt={class:`flex-1 overflow-y-auto p-5`},Nt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pt(t,l,u,p,m,g){let _=c(`action-selector`),v=c(`video-from-input`),y=c(`video-id-input`),b=c(`upsample-action-selector`),x=c(`extend-model-selector`),S=c(`prompt-input`),C=c(`motion-type-selector`),w=c(`image-mask-input`),T=c(`translation-selector`),E=c(`aspect-ratio-selector`),D=c(`model-selector`),O=c(`start-end-image`),k=c(`consumption`),A=c(`font-awesome-icon`),j=c(`el-button`);return h(),o(`div`,jt,[e(`div`,Mt,[i(_,{class:`mb-4`}),t.isPostProcessing?(h(),o(s,{key:0},[t.config?.video_url?(h(),d(v,{key:0,class:`mb-4`})):a(``,!0),i(y,{class:`mb-4`})],64)):a(``,!0),t.config?.action===`upsample`?(h(),d(b,{key:1,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(x,{key:2,class:`mb-4`})):a(``,!0),t.config?.action===`extend`?(h(),d(S,{key:3,class:`mb-4`})):a(``,!0),t.config?.action===`reshoot`?(h(),d(C,{key:4,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`?(h(),d(S,{key:5,class:`mb-4`})):a(``,!0),t.config?.action===`object_insert`||t.config?.action===`object_remove`?(h(),d(w,{key:6,class:`mb-4`})):a(``,!0),t.config?.action===`object_remove`?(h(),d(S,{key:7,class:`mb-4`})):a(``,!0),t.isGeneration?(h(),o(s,{key:8},[i(T,{class:`mb-4`}),i(E,{class:`mb-4`}),i(S,{class:`mb-4`}),t.config?.action===`ingredients2video`?a(``,!0):(h(),d(D,{key:0,class:`mb-4`})),t.config?.action===`image2video`||t.config?.action===`ingredients2video`?(h(),d(O,{key:1,class:`mb-2`})):a(``,!0)],64)):a(``,!0)]),e(`div`,Nt,[i(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(j,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(A,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ft=I(At,[[`render`,Pt]]),It=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:q,FontAwesomeIcon:K,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:U,ApiCodeButton:ae},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onPickAction(e,t,n,r){console.debug(`seed config from preview`,{action:n,upsampleAction:r,response:t}),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:n,video_id:t?.data?.[0]?.id,video_url:t?.data?.[0]?.video_url,...r?{upsample_action:r}:{}})},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Lt={class:`preview`},Rt={class:`left`},zt={class:`main`},Bt={class:`bot`},Vt={class:`datetime`},Ht={class:`info`},Ut={key:0,class:`prompt mt-2`},Wt={key:0},Gt={key:1},Kt={key:0,class:t({content:!0,failed:!0})},qt={key:0,class:`mb-4`},$={key:1,class:t({operations:!0,"mt-2":!0})},Jt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Zt={key:1,class:t({content:!0})},Qt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},en={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},nn={key:2,class:t({content:!0})},rn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function on(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,Lt,[e(`div`,Rt,[i(g,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),e(`div`,zt,[e(`div`,Bt,[n(r(t.$t(`veo.name.veoBot`))+` `,1),e(`span`,Vt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Ht,[t.modelValue?.request?.prompt?(h(),o(`p`,Ut,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,Wt,` - (`+r(t.$t(`veo.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`running`?(h(),o(`span`,Gt,` - (`+r(t.$t(`veo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,Kt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,qt,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,$,[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`1080p`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample1080p`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:1,type:`info`,size:`small`,class:`btn-action`,onClick:s[1]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`4k`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsample4k`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:2,type:`info`,size:`small`,class:`btn-action`,onClick:s[2]||=e=>t.onPickAction(e,t.modelValue?.response,`upsample`,`gif`)},{default:f(()=>[n(r(t.$t(`veo.button.actionUpsampleGif`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:3,type:`info`,size:`small`,class:`btn-action`,onClick:s[3]||=e=>t.onPickAction(e,t.modelValue?.response,`extend`)},{default:f(()=>[n(r(t.$t(`veo.button.actionExtend`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:4,type:`info`,size:`small`,class:`btn-action`,onClick:s[4]||=e=>t.onPickAction(e,t.modelValue?.response,`reshoot`)},{default:f(()=>[n(r(t.$t(`veo.button.actionReshoot`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:5,type:`info`,size:`small`,class:`btn-action`,onClick:s[5]||=e=>t.onPickAction(e,t.modelValue?.response,`object_insert`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectInsert`)),1)]),_:1})):a(``,!0),t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:6,type:`info`,size:`small`,class:`btn-action`,onClick:s[6]||=e=>t.onPickAction(e,t.modelValue?.response,`object_remove`)},{default:f(()=>[n(r(t.$t(`veo.button.actionObjectRemove`)),1)]),_:1})):a(``,!0),i(y,{class:`box-item`,effect:`dark`,content:t.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[7]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`veo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/veo/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,Jt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,Yt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,Xt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,Zt,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,Qt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,$t,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,en,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,tn,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===void 0?(h(),o(`div`,nn,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,rn,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,an,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var sn=_({name:`RecentPanel`,components:{TaskPreview:I(It,[[`render`,on],[`__scopeId`,`data-v-9698fe5f`]]),NoTasks:se,BotPlaceholder:oe,ScrollList:re},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),cn={key:0},ln={key:2,class:`w-full h-full flex items-center justify-center`};function un(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,cn,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,ln,[i(v)])):a(``,!0)],64)}var dn=_({name:`VeoIndex`,components:{ConfigPanel:Ft,Layout:me,RecentPanel:I(sn,[[`render`,un]])},mixins:[ee],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===B.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===B.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,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=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ie({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!L(this.uploadTracker,e=>this.$t(e),e=>W.warning(e)))return;let e={...this.config,async:!0};if(!F())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if(e.action===`image2video`&&!(e.image_urls&&e.image_urls.length>0)){W.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,W.info(this.$t(`veo.message.startingTask`)),G(`veo`,ne.generate(e,{token:t})).then(()=>{W.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?W.error(this.$t(`veo.message.usedUp`)):W.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function fn(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var pn=I(dn,[[`render`,fn]]);export{pn as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-rpgD1mTp.js";import{t as b}from"./upload-DoXD5sDs.js";import{t as x}from"./tooltip-D9nl8rAG.js";import{t as S}from"./image-DxExU-Rq.js";import{t as C}from"./alert-DVXIMt1v.js";import{t as w}from"./drawer-DTrWPYS_.js";import{t as T}from"./input-number-qSJ-m6WQ.js";import{t as ee}from"./slider-rfFJozAn.js";import{ar as E,ir as D,or as O,sr as k}from"./constants-CzGOanfS.js";import{$t as A,A as j,An as te,Bt as M,Gt as N,Ht as P,Kr as F,Ur as I,Ut as L,Vt as R,mi as z,ri as B,rr as V}from"./index-BjernDcR.js";import{t as H}from"./index.es-DlaJnBWw.js";import{t as U}from"./CopyToClipboard-Ca8S-sqk.js";import{t as W}from"./ImagePreview-jaBLzHNB.js";import{n as G}from"./taskDrawerMixin-DyAUhFEq.js";import{t as K}from"./Consumption-DLQ-BcIF.js";import{i as q,n as J,t as Y}from"./pagination-TdP7XO5o.js";import{t as X}from"./VideoPlayer-oKtmGvkU.js";import{t as Z}from"./ApiCodeButton-CT4kJONi.js";import{t as Q}from"./BotPlaceholder-DMdy5ReV.js";import{t as ne}from"./NoTasks-TrlSu31_.js";import{t as re}from"./PromptTextarea-CmibdYw8.js";var ie=_({name:`LayoutPixverse`,components:{ElDrawer:w,ElButton:z,FontAwesomeIcon:H},mixins:[G]}),ae={class:`main flex flex-row flex-1`},oe={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},se={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ce(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,ae,[e(`div`,oe,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,se,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var le=j(ie,[[`render`,ce],[`__scopeId`,`data-v-e688a015`]]),ue=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`v3.5`,label:`v3.5`},{value:`v4`,label:`v4`},{value:`v4.5`,label:`v4.5`}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||=E}}),de={class:`field`},fe={class:`title font-bold`};function pe(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,de,[e(`h2`,fe,r(t.$t(`pixverse.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var me=j(ue,[[`render`,pe],[`__scopeId`,`data-v-e8f337ca`]]),he=_({name:`QualitySelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`360p`,label:`360p`},{value:`540p`,label:`540p`},{value:`720p`,label:`720p`},{value:`1080p`,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||=k}}),ge={class:`field`},_e={class:`title font-bold`};function ve(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ge,[e(`h2`,_e,r(t.$t(`pixverse.name.quality`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ye=j(he,[[`render`,ve],[`__scopeId`,`data-v-64aeaae9`]]),be=_({name:`MotionSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`normal`,label:this.$t(`pixverse.name.motion1`)},{value:`fast`,label:this.$t(`pixverse.name.motion2`)}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||=O}}),xe={class:`field`},Se={class:`title font-bold`};function Ce(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,xe,[e(`h2`,Se,r(t.$t(`pixverse.name.motion`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var we=j(be,[[`render`,Ce],[`__scopeId`,`data-v-94237408`]]),Te=_({name:`StyleSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`cyberpunk`,label:this.$t(`pixverse.name.style1`)},{value:`anime`,label:this.$t(`pixverse.name.style2`)},{value:`comic`,label:this.$t(`pixverse.name.style3`)},{value:`clay`,label:this.$t(`pixverse.name.style4`)},{value:`3d_animation`,label:this.$t(`pixverse.name.style5`)},{value:`realistic`,label:this.$t(`pixverse.name.style6`)}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||=``}}),Ee={class:`field`},De={class:`title font-bold`};function Oe(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,Ee,[e(`h2`,De,r(t.$t(`pixverse.name.style`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ke=j(Te,[[`render`,Oe],[`__scopeId`,`data-v-64e17b3c`]]),Ae=_({name:`SeedSelector`,components:{ElSlider:ee,InfoIcon:q,ElInputNumber:T},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug(`set seed`,e),this.$store.commit(`pixverse/setConfig`,{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||=void 0}}),je={class:`flex justify-between`},Me={class:`flex justify-start items-center`},Ne={class:`text-sm font-bold`},Pe={class:`flex justify-end items-center`},Fe={class:`w-full`};function Ie(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-input-number`),p=c(`el-slider`);return h(),o(`div`,null,[e(`div`,je,[e(`div`,Me,[e(`span`,Ne,r(t.$t(`pixverse.name.seed`)),1),i(d,{content:t.$t(`pixverse.description.seed`)},null,8,[`content`])]),e(`div`,Pe,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Fe,[i(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1e3,step:1},null,8,[`modelValue`])])])}var Le=j(Ae,[[`render`,Ie]]),Re=_({name:`DurationSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:5,label:`5s`},{value:8,label:`8s`}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||=5}}),ze={class:`field`},Be={class:`title font-bold`};function Ve(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ze,[e(`h2`,Be,r(t.$t(`pixverse.name.duration`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var He=j(Re,[[`render`,Ve],[`__scopeId`,`data-v-065c77ef`]]),Ue=_({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`4:3`,label:`4:3`,width:20,height:15},{value:`3:4`,label:`3:4`,width:15,height:20},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.pixverse.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||=D}}),We={class:`text-sm font-bold mb-2 block`},Ge={class:`items`},Ke=[`onClick`],qe={class:`name`};function Je(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,We,r(n.$t(`pixverse.name.aspectRatio`)),1),e(`div`,Ge,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.label])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,qe,r(i.label),1)],10,Ke))),128))])])}var Ye=j(Ue,[[`render`,Je],[`__scopeId`,`data-v-53038264`]]),Xe=_({name:`StartImage`,components:{ElUpload:b,ElButton:z,InfoIcon:q,FontAwesomeIcon:H,ImagePreview:W},mixins:[L,R],emits:[`change`],data(){return{fileList:[],uploadUrl:F()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){B.warning(this.$t(`pixverse.message.uploadReferencesExceed`))},onError(){B.error(this.$t(`pixverse.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`pixverse/setConfig`,{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ze={class:`relative`},Qe={class:`flex justify-between`},$e={class:`flex justify-start items-center`},et={class:`text-sm font-bold`};function tt(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,Ze,[e(`div`,Qe,[e(`div`,$e,[e(`span`,et,r(t.$t(`pixverse.name.startImage`)),1),i(g,{content:t.$t(`pixverse.description.uploadStartImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:5,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`pixverse.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var nt=j(Xe,[[`render`,tt],[`__scopeId`,`data-v-0d570ad7`]]),rt=_({name:`PromptInput`,components:{PromptTextarea:re},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||=``}});function it(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`pixverse.name.prompt`),info:e.$t(`pixverse.description.prompt`),placeholder:e.$t(`pixverse.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var at=_({name:`ConfigPanel`,components:{ElButton:z,FontAwesomeIcon:H,PromptInput:j(rt,[[`render`,it]]),ModelSelector:me,QualitySelector:ye,MotionSelector:we,StyleSelector:ke,DurationSelector:He,StartImage:nt,SeedSelector:Le,RatioSelector:Ye,Consumption:K},emits:[`generate`],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return N(this.config,this.service?.cost)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),ot={class:`flex flex-col h-full`},st={class:`flex-1 overflow-y-auto p-5`},ct={class:`flex flex-col items-center justify-center px-5 pb-5`};function lt(t,a,s,l,u,d){let p=c(`prompt-input`),m=c(`model-selector`),g=c(`style-selector`),_=c(`ratio-selector`),v=c(`motion-selector`),y=c(`quality-selector`),b=c(`start-image`),x=c(`seed-selector`),S=c(`duration-selector`),C=c(`consumption`),w=c(`font-awesome-icon`),T=c(`el-button`);return h(),o(`div`,ot,[e(`div`,st,[i(p,{class:`mb-4`}),i(m,{class:`mb-4`}),i(g,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),i(b,{class:`mb-2`}),i(x,{class:`mb-4`}),i(S,{class:`mb-4`})]),e(`div`,ct,[i(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`pixverse.button.generate`)),1)]),_:1},8,[`onClick`])])])}var ut=j(at,[[`render`,lt]]),dt=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:U,FontAwesomeIcon:H,ElAlert:C,VideoPlayer:X,ElTooltip:x,ElButton:z,ApiCodeButton:Z},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),ft={class:`preview`},pt={class:`left`},mt={class:`main`},ht={class:`bot`},gt={class:`datetime`},_t={class:`info`},vt={key:0,class:`prompt mt-2`},yt={key:0},bt={key:1},xt={key:0,class:t({content:!0,failed:!0})},St={key:0,class:`mb-4`},Ct={key:1,class:t({operations:!0,"mt-2":!0})},wt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:t({content:!0})},Dt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function jt(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,ft,[e(`div`,pt,[i(g,{src:`https://cdn.acedata.cloud/viy61r.jpg`,class:`avatar`})]),e(`div`,mt,[e(`div`,ht,[n(r(t.$t(`pixverse.name.pixverseBot`))+` `,1),e(`span`,gt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,_t,[t.modelValue?.request?.prompt?(h(),o(`p`,vt,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,yt,` - (`+r(t.$t(`pixverse.status.pending`))+`) `,1)),t.modelValue?.response?.data&&(t.modelValue?.response?.data[0]?.state===`processing`||t.modelValue?.response?.data[0]?.state===`pending`)?(h(),o(`span`,bt,` - (`+r(t.$t(`pixverse.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,xt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,St,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,Ct,[i(y,{class:`box-item`,effect:`dark`,content:t.$t(`pixverse.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`pixverse.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/pixverse/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,wt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,Tt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,Et,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,$,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.failure`)),1)]),default:f(()=>[e(`p`,Dt,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),e(`p`,Ot,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,kt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,At,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var Mt=_({name:`RecentPanel`,components:{TaskPreview:j(dt,[[`render`,jt],[`__scopeId`,`data-v-dd3037dc`]]),NoTasks:ne,BotPlaceholder:Q,ScrollList:J},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nt={key:0},Pt={key:2,class:`w-full h-full flex items-center justify-center`};function Ft(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,Nt,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,Pt,[i(v)])):a(``,!0)],64)}var It=_({name:`PixverseIndex`,components:{ConfigPanel:ut,Layout:le,RecentPanel:j(Mt,[[`render`,Ft]])},mixins:[P],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===I.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===I.Request||this.fetchingTasks},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await Y({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`pixverse/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`pixverse/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`pixverse/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!M(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config,async:!0};if(!A())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}B.info(this.$t(`pixverse.message.startingTask`)),V(`pixverse`,te.generate(e,{token:t})).then(()=>{B.success(this.$t(`pixverse.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?B.error(this.$t(`pixverse.message.usedUp`)):B.error(this.$t(`pixverse.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Lt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Rt=j(It,[[`render`,Lt]]);export{Rt as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-HoauzLaT.js";import{t as b}from"./upload-BczdKCgl.js";import{t as x}from"./tooltip-vx_1Kj1D.js";import{t as S}from"./image-CBjQluJz.js";import{t as C}from"./alert-CqfK6I_P.js";import{t as w}from"./drawer-D8wfk1R6.js";import{t as T}from"./input-number-CqZtT6zo.js";import{t as ee}from"./slider-C89Gn6Tq.js";import{ar as E,ir as D,or as O,sr as k}from"./constants-CzGOanfS.js";import{$t as A,A as j,An as te,Bt as M,Gt as N,Ht as P,Kr as F,Ur as I,Ut as L,Vt as R,mi as z,ri as B,rr as V}from"./index-D9GtY1Yk.js";import{t as H}from"./index.es-B-37pVAR.js";import{t as U}from"./CopyToClipboard-cDfZUBnE.js";import{t as W}from"./ImagePreview-9oC3URyM.js";import{n as G}from"./taskDrawerMixin-DyAUhFEq.js";import{t as K}from"./Consumption-MRvsOx6V.js";import{i as q,n as J,t as Y}from"./pagination-CR-ztfxo.js";import{t as X}from"./VideoPlayer-Ca_Xz8CP.js";import{t as Z}from"./ApiCodeButton-DvrUGiTL.js";import{t as Q}from"./BotPlaceholder-Dt69aobm.js";import{t as ne}from"./NoTasks-DRIp5LO0.js";import{t as re}from"./PromptTextarea-DWq1L_Vc.js";var ie=_({name:`LayoutPixverse`,components:{ElDrawer:w,ElButton:z,FontAwesomeIcon:H},mixins:[G]}),ae={class:`main flex flex-row flex-1`},oe={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},se={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ce(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,ae,[e(`div`,oe,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,se,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var le=j(ie,[[`render`,ce],[`__scopeId`,`data-v-e688a015`]]),ue=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`v3.5`,label:`v3.5`},{value:`v4`,label:`v4`},{value:`v4.5`,label:`v4.5`}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.model},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,model:e})}}},mounted(){this.value||=E}}),de={class:`field`},fe={class:`title font-bold`};function pe(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,de,[e(`h2`,fe,r(t.$t(`pixverse.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var me=j(ue,[[`render`,pe],[`__scopeId`,`data-v-e8f337ca`]]),he=_({name:`QualitySelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`360p`,label:`360p`},{value:`540p`,label:`540p`},{value:`720p`,label:`720p`},{value:`1080p`,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.quality},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,quality:e})}}},mounted(){this.value||=k}}),ge={class:`field`},_e={class:`title font-bold`};function ve(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ge,[e(`h2`,_e,r(t.$t(`pixverse.name.quality`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ye=j(he,[[`render`,ve],[`__scopeId`,`data-v-64aeaae9`]]),be=_({name:`MotionSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`normal`,label:this.$t(`pixverse.name.motion1`)},{value:`fast`,label:this.$t(`pixverse.name.motion2`)}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.motion},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,motion:e})}}},mounted(){this.value||=O}}),xe={class:`field`},Se={class:`title font-bold`};function Ce(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,xe,[e(`h2`,Se,r(t.$t(`pixverse.name.motion`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var we=j(be,[[`render`,Ce],[`__scopeId`,`data-v-94237408`]]),Te=_({name:`StyleSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`cyberpunk`,label:this.$t(`pixverse.name.style1`)},{value:`anime`,label:this.$t(`pixverse.name.style2`)},{value:`comic`,label:this.$t(`pixverse.name.style3`)},{value:`clay`,label:this.$t(`pixverse.name.style4`)},{value:`3d_animation`,label:this.$t(`pixverse.name.style5`)},{value:`realistic`,label:this.$t(`pixverse.name.style6`)}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.style},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,style:e})}}},mounted(){this.value||=``}}),Ee={class:`field`},De={class:`title font-bold`};function Oe(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,Ee,[e(`h2`,De,r(t.$t(`pixverse.name.style`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ke=j(Te,[[`render`,Oe],[`__scopeId`,`data-v-64e17b3c`]]),Ae=_({name:`SeedSelector`,components:{ElSlider:ee,InfoIcon:q,ElInputNumber:T},computed:{value:{get(){return this.$store.state?.pixverse?.config?.seed},set(e){console.debug(`set seed`,e),this.$store.commit(`pixverse/setConfig`,{...this.$store.state?.pixverse?.config,seed:e})}}},mounted(){this.value||=void 0}}),je={class:`flex justify-between`},Me={class:`flex justify-start items-center`},Ne={class:`text-sm font-bold`},Pe={class:`flex justify-end items-center`},Fe={class:`w-full`};function Ie(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-input-number`),p=c(`el-slider`);return h(),o(`div`,null,[e(`div`,je,[e(`div`,Me,[e(`span`,Ne,r(t.$t(`pixverse.name.seed`)),1),i(d,{content:t.$t(`pixverse.description.seed`)},null,8,[`content`])]),e(`div`,Pe,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Fe,[i(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1e3,step:1},null,8,[`modelValue`])])])}var Le=j(Ae,[[`render`,Ie]]),Re=_({name:`DurationSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:5,label:`5s`},{value:8,label:`8s`}]}},computed:{value:{get(){return this.$store.state.pixverse?.config?.duration},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,duration:e})}}},mounted(){this.value||=5}}),ze={class:`field`},Be={class:`title font-bold`};function Ve(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ze,[e(`h2`,Be,r(t.$t(`pixverse.name.duration`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pixverse.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var He=j(Re,[[`render`,Ve],[`__scopeId`,`data-v-065c77ef`]]),Ue=_({name:`RatioSelector`,data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`4:3`,label:`4:3`,width:20,height:15},{value:`3:4`,label:`3:4`,width:15,height:20},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.pixverse.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse.config,aspect_ratio:e})}}},mounted(){this.value||=D}}),We={class:`text-sm font-bold mb-2 block`},Ge={class:`items`},Ke=[`onClick`],qe={class:`name`};function Je(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,We,r(n.$t(`pixverse.name.aspectRatio`)),1),e(`div`,Ge,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.label])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,qe,r(i.label),1)],10,Ke))),128))])])}var Ye=j(Ue,[[`render`,Je],[`__scopeId`,`data-v-53038264`]]),Xe=_({name:`StartImage`,components:{ElUpload:b,ElButton:z,InfoIcon:q,FontAwesomeIcon:H,ImagePreview:W},mixins:[L,R],emits:[`change`],data(){return{fileList:[],uploadUrl:F()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){B.warning(this.$t(`pixverse.message.uploadReferencesExceed`))},onError(){B.error(this.$t(`pixverse.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`pixverse/setConfig`,{...this.$store.state?.pixverse?.config,image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ze={class:`relative`},Qe={class:`flex justify-between`},$e={class:`flex justify-start items-center`},et={class:`text-sm font-bold`};function tt(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,Ze,[e(`div`,Qe,[e(`div`,$e,[e(`span`,et,r(t.$t(`pixverse.name.startImage`)),1),i(g,{content:t.$t(`pixverse.description.uploadStartImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:5,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`pixverse.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var nt=j(Xe,[[`render`,tt],[`__scopeId`,`data-v-0d570ad7`]]),rt=_({name:`PromptInput`,components:{PromptTextarea:re},computed:{prompt:{get(){return this.$store.state.pixverse?.config?.prompt},set(e){this.$store.commit(`pixverse/setConfig`,{...this.$store.state.pixverse?.config,prompt:e})}}},mounted(){this.prompt||=``}});function it(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`pixverse.name.prompt`),info:e.$t(`pixverse.description.prompt`),placeholder:e.$t(`pixverse.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var at=_({name:`ConfigPanel`,components:{ElButton:z,FontAwesomeIcon:H,PromptInput:j(rt,[[`render`,it]]),ModelSelector:me,QualitySelector:ye,MotionSelector:we,StyleSelector:ke,DurationSelector:He,StartImage:nt,SeedSelector:Le,RatioSelector:Ye,Consumption:K},emits:[`generate`],computed:{config(){return this.$store.state.pixverse?.config},consumption(){return N(this.config,this.service?.cost)},service(){return this.$store.state.pixverse?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),ot={class:`flex flex-col h-full`},st={class:`flex-1 overflow-y-auto p-5`},ct={class:`flex flex-col items-center justify-center px-5 pb-5`};function lt(t,a,s,l,u,d){let p=c(`prompt-input`),m=c(`model-selector`),g=c(`style-selector`),_=c(`ratio-selector`),v=c(`motion-selector`),y=c(`quality-selector`),b=c(`start-image`),x=c(`seed-selector`),S=c(`duration-selector`),C=c(`consumption`),w=c(`font-awesome-icon`),T=c(`el-button`);return h(),o(`div`,ot,[e(`div`,st,[i(p,{class:`mb-4`}),i(m,{class:`mb-4`}),i(g,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),i(b,{class:`mb-2`}),i(x,{class:`mb-4`}),i(S,{class:`mb-4`})]),e(`div`,ct,[i(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`pixverse.button.generate`)),1)]),_:1},8,[`onClick`])])])}var ut=j(at,[[`render`,lt]]),dt=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:U,FontAwesomeIcon:H,ElAlert:C,VideoPlayer:X,ElTooltip:x,ElButton:z,ApiCodeButton:Z},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pixverse?.application},config(){return this.$store.state.pixverse?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),ft={class:`preview`},pt={class:`left`},mt={class:`main`},ht={class:`bot`},gt={class:`datetime`},_t={class:`info`},vt={key:0,class:`prompt mt-2`},yt={key:0},bt={key:1},xt={key:0,class:t({content:!0,failed:!0})},St={key:0,class:`mb-4`},Ct={key:1,class:t({operations:!0,"mt-2":!0})},wt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:t({content:!0})},Dt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function jt(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,ft,[e(`div`,pt,[i(g,{src:`https://cdn.acedata.cloud/viy61r.jpg`,class:`avatar`})]),e(`div`,mt,[e(`div`,ht,[n(r(t.$t(`pixverse.name.pixverseBot`))+` `,1),e(`span`,gt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,_t,[t.modelValue?.request?.prompt?(h(),o(`p`,vt,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,yt,` - (`+r(t.$t(`pixverse.status.pending`))+`) `,1)),t.modelValue?.response?.data&&(t.modelValue?.response?.data[0]?.state===`processing`||t.modelValue?.response?.data[0]?.state===`pending`)?(h(),o(`span`,bt,` - (`+r(t.$t(`pixverse.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,xt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,St,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,Ct,[i(y,{class:`box-item`,effect:`dark`,content:t.$t(`pixverse.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`pixverse.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/pixverse/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,wt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,Tt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,Et,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,$,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.failure`)),1)]),default:f(()=>[e(`p`,Dt,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),e(`p`,Ot,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,kt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,At,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`pixverse.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var Mt=_({name:`RecentPanel`,components:{TaskPreview:j(dt,[[`render`,jt],[`__scopeId`,`data-v-dd3037dc`]]),NoTasks:ne,BotPlaceholder:Q,ScrollList:J},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pixverse?.tasks,items:this.$store.state.pixverse?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Nt={key:0},Pt={key:2,class:`w-full h-full flex items-center justify-center`};function Ft(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,Nt,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,Pt,[i(v)])):a(``,!0)],64)}var It=_({name:`PixverseIndex`,components:{ConfigPanel:ut,Layout:le,RecentPanel:j(Mt,[[`render`,Ft]])},mixins:[P],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===I.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===I.Request||this.fetchingTasks},credential(){return this.$store.state.pixverse.credential},config(){return this.$store.state.pixverse.config},tasks(){return this.$store.state.pixverse.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await Y({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`pixverse/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`pixverse/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`pixverse/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!M(this.uploadTracker,e=>this.$t(e),e=>B.warning(e)))return;let e={...this.config,async:!0};if(!A())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}B.info(this.$t(`pixverse.message.startingTask`)),V(`pixverse`,te.generate(e,{token:t})).then(()=>{B.success(this.$t(`pixverse.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?B.error(this.$t(`pixverse.message.usedUp`)):B.error(this.$t(`pixverse.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Lt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Rt=j(It,[[`render`,Lt]]);export{Rt as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,it as l,j as u,k as d,mt as f,rt as p,tt as m,z as h}from"./vendor-chart-Dw-P17PN.js";import{n as g,t as _}from"./tabs-BaISrstV.js";import{t as v}from"./upload-DoXD5sDs.js";import{t as y}from"./image-DxExU-Rq.js";import{t as b}from"./alert-DVXIMt1v.js";import{n as ee,r as x}from"./radio-Bj0tEwH8.js";import{t as S}from"./drawer-DTrWPYS_.js";import{n as C,t as w}from"./skeleton-CoheJz5x.js";import"./constants-CzGOanfS.js";import{$t as te,A as T,Bt as E,Dn as D,Ht as O,Kr as k,Qn as A,Ur as j,Ut as M,Vt as N,mi as P,ri as F,rr as I}from"./index-BjernDcR.js";import{t as L}from"./index.es-DlaJnBWw.js";import{t as R}from"./CopyToClipboard-Ca8S-sqk.js";import{t as z}from"./Status-B7xPxkCj.js";import{t as B}from"./ImagePreview-jaBLzHNB.js";import{i as V,n as H,t as U}from"./pagination-TdP7XO5o.js";import{t as W}from"./ApiCodeButton-CT4kJONi.js";var G=h({name:`LayoutHeadshots`,components:{ElDrawer:S,ElButton:P,FontAwesomeIcon:L},data(){return{drawer:!1}}}),K={class:`main flex flex-row flex-1`},q={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},J={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Y(t,n,r,a,s,u){let d=c(`font-awesome-icon`),p=c(`el-button`),h=c(`el-drawer`);return m(),o(`div`,K,[e(`div`,q,[l(t.$slots,`config`,{},void 0,!0)]),e(`div`,J,[l(t.$slots,`result`,{},void 0,!0)]),i(p,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(d,{icon:`fa-solid fa-gear`})]),_:1}),i(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,"with-header":!1,size:`340px`,class:`drawer`},{default:f(()=>[l(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var X=T(G,[[`render`,Y],[`__scopeId`,`data-v-ada6b2d1`]]),Z=h({name:`ImageUrlsInput`,components:{ElUpload:v,ElButton:P,InfoIcon:V,ImagePreview:B,FontAwesomeIcon:L},mixins:[M,N],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){let e=this.urls;this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||=void 0,this.onSetImageUrls()},methods:{onExceed(){F.warning(this.$t(`headshots.message.uploadImageExceed`))},onError(){F.error(this.$t(`headshots.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),Q={class:`field`},ne={class:`title font-bold`},re={class:`upload-wrapper`};function ie(t,a,s,l,u,d){let p=c(`image-preview`),h=c(`font-awesome-icon`),g=c(`el-button`),_=c(`el-upload`),v=c(`info-icon`);return m(),o(`div`,Q,[e(`h2`,ne,r(t.$t(`headshots.name.endImageUrls`)),1),e(`div`,re,[i(_,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":a[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value upload-wrapper`,limit:2,multiple:!0,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[i(p,{url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])]),default:f(()=>[i(g,{size:`small`,type:`primary`,round:``},{default:f(()=>[i(h,{icon:`fa-solid fa-upload`,class:`mr-1`}),n(` `+r(t.$t(`headshots.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])]),i(v,{content:t.$t(`headshots.description.endImageUrls`),class:`info`},null,8,[`content`])])}var ae=T(Z,[[`render`,ie],[`__scopeId`,`data-v-d468812a`]]),oe=`fast`,se=h({name:`ModeSelector`,components:{ElRadioButton:ee,ElRadioGroup:x},data(){return{options:[{label:this.$t(`headshots.button.fast`),value:`fast`},{label:this.$t(`headshots.button.relax`),value:`relax`}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug(`set mode`,e),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||=oe}}),ce={class:`field`},le={class:`title font-bold`};function ue(t,a,l,d,h,g){let _=c(`el-radio-button`),v=c(`el-radio-group`);return m(),o(`div`,ce,[e(`h2`,le,r(t.$t(`headshots.name.mode`)),1),i(v,{modelValue:t.value,"onUpdate:modelValue":a[0]||=e=>t.value=e,class:`mode`},{default:f(()=>[(m(!0),o(s,null,p(t.options,e=>(m(),u(_,{key:e.value,label:e.value},{default:f(()=>[n(r(e.label),1)]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`])])}var de=T(se,[[`render`,ue],[`__scopeId`,`data-v-e7702494`]]),fe=h({name:`StylizeSelector`,components:{ElTabs:g,ElTabPane:_,ElImage:y},data(){return{tab:`styles`,value:``,elements:{styles:{displayName:this.$t(`headshots.styleCategory.styles`),items:[{image:`https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png`,label:this.$t(`headshots.styleTag.malePportrait`),value:`male_portrait`},{image:`https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png`,label:this.$t(`headshots.styleTag.malePportrait2`),value:`male_portrait2`},{image:`https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png`,label:this.$t(`headshots.styleTag.kindergarten`),value:`kindergarten`},{image:`https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp`,label:this.$t(`headshots.styleTag.logoTshirt`),value:`logo_tshirt`},{image:`https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg`,label:this.$t(`headshots.styleTag.wedding`),value:`wedding`},{image:`https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp`,label:this.$t(`headshots.styleTag.businessPphoto`),value:`business_photo`},{image:`https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg`,label:this.$t(`headshots.styleTag.bobSuit`),value:`bob_suit`},{image:`https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp`,label:this.$t(`headshots.styleTag.femalePortrait`),value:`female_portrait`}]}}}},watch:{value(e){console.debug(`set template`,e),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||=``,console.debug(`set template`,this.value),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value=``:this.value=e,console.debug(`set template`,this.value),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,template:this.value})}}}),pe={class:`field`},me=[`onClick`],he={class:`name`};function ge(n,a,l,d,h,g){let _=c(`el-image`),v=c(`el-tab-pane`),y=c(`el-tabs`);return m(),o(`div`,pe,[i(y,{modelValue:n.tab,"onUpdate:modelValue":a[0]||=e=>n.tab=e},{default:f(()=>[(m(!0),o(s,null,p(n.elements,(a,c)=>(m(),u(v,{key:c,label:a.displayName,name:c,class:`pane`},{default:f(()=>[(m(!0),o(s,null,p(a.items,(a,s)=>(m(),o(`div`,{key:s,class:t({item:!0,active:n.value===a.value}),onClick:e=>n.onToggle(a.value)},[i(_,{src:a.image,fit:`fill`,class:`preview`},null,8,[`src`]),e(`span`,he,r(a.label),1)],10,me))),128))]),_:2},1032,[`label`,`name`]))),128))]),_:1},8,[`modelValue`])])}var _e=h({name:`PresetPanel`,components:{ModeSelector:de,ImageUrlsInput:ae,ElButton:P,FontAwesomeIcon:L,ElementsSelector:T(fe,[[`render`,ge],[`__scopeId`,`data-v-be4bd25d`]])},emits:[`generate`],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit(`generate`)}}}),ve={class:`panel`},ye={class:`config`},be={class:`actions`};function xe(t,a,s,l,u,d){let p=c(`elements-selector`),h=c(`mode-selector`),g=c(`image-urls-input`),_=c(`font-awesome-icon`),v=c(`el-button`);return m(),o(`div`,ve,[e(`div`,ye,[i(p,{class:`mb-4`}),i(h,{class:`mb-4`}),i(g,{class:`mb-4`}),e(`div`,be,[i(v,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(_,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`headshots.button.generate`)),1)]),_:1},8,[`onClick`])])])])}var Se=T(_e,[[`render`,xe],[`__scopeId`,`data-v-848739f6`]]),Ce=h({name:`ImageGallery`,props:{modelValue:{type:Object,required:!0}},setup(e){return{images:d(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:e=>{window.open(e,`_blank`)}}}}),we={class:`image-gallery`},Te=[`src`],Ee=[`onClick`];function De(t,n,i,c,l,u){return m(),o(`div`,we,[(m(!0),o(s,null,p(t.images,(n,i)=>(m(),o(`div`,{key:i,class:`image-container`},[e(`img`,{src:n.image_url,alt:`Image`},null,8,Te),n.image_url?(m(),o(`button`,{key:0,class:`view-button`,onClick:e=>t.viewImage(n.image_url)},r(t.$t(`headshots.button.viewImage`)),9,Ee)):a(``,!0)]))),128))])}var Oe=h({name:`TaskPreview`,components:{ElImage:y,CopyToClipboard:R,FontAwesomeIcon:L,ElAlert:b,ImageGallery:T(Ce,[[`render`,De],[`__scopeId`,`data-v-42f0a7be`]]),ApiCodeButton:W},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onReload(e){let t=e.target,n=new URL(t.src),r=n.searchParams.get(`retry`);if(!r)n.searchParams.set(`retry`,`1`);else if(parseInt(r)<2)n.searchParams.set(`retry`,(parseInt(r)+1).toString());else return;t.src=n.toString()},onOpenVideo(e){window.open(e,`_blank`)}}}),ke={class:`preview`},Ae={class:`left`},je={class:`main`},Me={class:`bot`},Ne={class:`datetime`},Pe={class:`info`},Fe={key:0,class:`prompt mt-2`},Ie={key:0},Le={key:1},Re={key:0,class:t({content:!0,failed:!0})},ze={class:`image-wrapper`},Be={class:t({operations:!0,"mt-2":!0,"mb-2":!0})},Ve={class:`description`},He={key:0,class:`description`},Ue={key:1,class:t({content:!0})},We={class:`description`},Ge={class:`description`},Ke={key:0,class:`description`},qe={class:`description`},Je={key:2,class:t({content:!0})},$={class:`description`},Ye={key:3,class:t({content:!0})},Xe={class:`description`};function Ze(t,s,l,u,d,p){let h=c(`el-image`),g=c(`image-gallery`),_=c(`api-code-button`),v=c(`font-awesome-icon`),y=c(`copy-to-clipboard`),b=c(`el-alert`);return m(),o(`div`,ke,[e(`div`,Ae,[i(h,{src:`https://cdn.acedata.cloud/isxyfw.png`,class:`avatar`})]),e(`div`,je,[e(`div`,Me,[n(r(t.$t(`headshots.name.headshotsBot`))+` `,1),e(`span`,Ne,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Pe,[t.modelValue?.request?.template?(m(),o(`p`,Fe,[n(r(t.modelValue?.request?.template)+` `,1),t.modelValue?.response?a(``,!0):(m(),o(`span`,Ie,` - (`+r(t.$t(`headshots.status.pending`))+`) `,1)),t.modelValue?.response?.status===`unknown`?(m(),o(`span`,Le,` - (`+r(t.$t(`headshots.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0?(m(),o(`div`,Re,[e(`div`,ze,[i(g,{"model-value":t.modelValue},null,8,[`model-value`])]),e(`div`,Be,[i(_,{path:`/headshots/images`,body:t.modelValue?.request},null,8,[`body`])]),i(b,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,Ve,[i(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(y,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),t.modelValue?.elapsed?(m(),o(`p`,He,[i(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(m(),o(`div`,Ue,[i(b,{closable:!1,class:`failure`},{template:f(()=>[i(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.failure`)),1)]),default:f(()=>[e(`p`,We,[i(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(y,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,Ge,[i(v,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(y,{content:t.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),t.modelValue?.elapsed?(m(),o(`p`,Ke,[i(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),e(`p`,qe,[i(v,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(y,{content:t.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):a(``,!0),t.modelValue?.response?a(``,!0):(m(),o(`div`,Je,[i(b,{closable:!1,class:`info`},{template:f(()=>[i(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.failure`)),1)]),default:f(()=>[e(`p`,$,[i(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(y,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])),t.modelValue?.response?.status===`unknown`?(m(),o(`div`,Ye,[i(b,{closable:!1,class:`info`},{template:f(()=>[i(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.failure`)),1)]),default:f(()=>[e(`p`,Xe,[i(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(y,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):a(``,!0)])])}var Qe=h({name:`RecentPanel`,components:{TaskPreview:T(Oe,[[`render`,Ze],[`__scopeId`,`data-v-0e921c0c`]]),ElSkeleton:w,ElSkeletonItem:C,ScrollList:H},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),$e={key:0,class:`tasks`},et={class:`left`},tt={class:`main`},nt={key:1,class:`tasks`},rt={key:2,class:`description`};function it(t,n,l,d,h,g){let _=c(`el-skeleton-item`),v=c(`el-skeleton`),y=c(`task-preview`),b=c(`scroll-list`);return m(),u(b,{ref:`scrollList`,class:`panel recent`,loading:t.loading,onReachTop:n[0]||=e=>t.$emit(`reach-top`)},{default:f(()=>[t.tasks?.items===void 0?(m(),o(`div`,$e,[(m(),o(s,null,p(3,t=>e(`div`,{key:t,class:`task placeholder`},[e(`div`,et,[i(v,{animated:``},{template:f(()=>[i(_,{variant:`image`,class:`avatar`})]),_:1})]),e(`div`,tt,[i(v,{animated:``},{template:f(()=>[i(_,{variant:`p`,class:`title`}),i(_,{variant:`image`,class:`icon`})]),_:1})])])),64))])):t.tasks?.items?.length&&t.tasks?.items?.length>0?(m(),o(`div`,nt,[(m(!0),o(s,null,p(t.tasks?.items,(e,t)=>(m(),u(y,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))])):a(``,!0),t.tasks?.items?.length===0?(m(),o(`p`,rt,r(t.$t(`headshots.message.noTasks`)),1)):a(``,!0)]),_:1},8,[`loading`])}var at=h({name:`HeadshotsIndex`,components:{ConfigPanel:Se,Layout:X,ApplicationStatus:z,RecentPanel:T(Qe,[[`render`,it],[`__scopeId`,`data-v-ffd55c16`]])},mixins:[O],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.headshots?.status?.getApplications===j.Request},tasksLoading(){return this.$store.state.headshots?.status?.getTasks===j.Request||this.fetchingTasks},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===j.Request},needApply(){return this.$store.state.headshots.status.getApplications===j.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,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=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await U({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`headshots/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`headshots/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},onApply(){A.create({application:this.application}).then(({data:e})=>{this.application=e,F.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&F.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`headshots/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGeneratePicture(){if(!E(this.uploadTracker,e=>this.$t(e),e=>F.warning(e)))return;let e={...this.config,async:!0};if(!te())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}F.info(this.$t(`headshots.message.startingTask`)),I(`headshots`,D.generate(e,{token:t})).then(()=>{F.success(this.$t(`headshots.message.startTaskSuccess`)),this.$store.commit(`headshots/setConfig`,{config:void 0})}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?F.error(this.$t(`headshots.message.usedUp`)):F.error(this.$t(`headshots.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function ot(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`application-status`),d=c(`recent-panel`),p=c(`layout`);return m(),u(p,null,{config:f(()=>[i(s,{onGenerate:e.onGeneratePicture},null,8,[`onGenerate`])]),result:f(()=>[i(l,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:`mb-4`,onRefresh:e.onGetApplication,onSelect:t[0]||=t=>e.$store.dispatch(`headshots/setApplication`,t)},null,8,[`initializing`,`application`,`applications`,`service`,`need-apply`,`onRefresh`]),i(d,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var st=T(at,[[`render`,ot],[`__scopeId`,`data-v-9ea36b64`]]);export{st as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,it as l,j as u,k as d,mt as f,rt as p,tt as m,z as h}from"./vendor-chart-Dw-P17PN.js";import{n as g,t as _}from"./tabs-ChE9apJH.js";import{t as v}from"./upload-BczdKCgl.js";import{t as y}from"./image-CBjQluJz.js";import{t as b}from"./alert-CqfK6I_P.js";import{n as ee,r as x}from"./radio-Bj0tEwH8.js";import{t as S}from"./drawer-D8wfk1R6.js";import{n as C,t as w}from"./skeleton-CoheJz5x.js";import"./constants-CzGOanfS.js";import{$t as te,A as T,Bt as E,Dn as D,Ht as O,Kr as k,Qn as A,Ur as j,Ut as M,Vt as N,mi as P,ri as F,rr as I}from"./index-D9GtY1Yk.js";import{t as L}from"./index.es-B-37pVAR.js";import{t as R}from"./CopyToClipboard-cDfZUBnE.js";import{t as z}from"./Status-IgAKj_fU.js";import{t as B}from"./ImagePreview-9oC3URyM.js";import{i as V,n as H,t as U}from"./pagination-CR-ztfxo.js";import{t as W}from"./ApiCodeButton-DvrUGiTL.js";var G=h({name:`LayoutHeadshots`,components:{ElDrawer:S,ElButton:P,FontAwesomeIcon:L},data(){return{drawer:!1}}}),K={class:`main flex flex-row flex-1`},q={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},J={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Y(t,n,r,a,s,u){let d=c(`font-awesome-icon`),p=c(`el-button`),h=c(`el-drawer`);return m(),o(`div`,K,[e(`div`,q,[l(t.$slots,`config`,{},void 0,!0)]),e(`div`,J,[l(t.$slots,`result`,{},void 0,!0)]),i(p,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(d,{icon:`fa-solid fa-gear`})]),_:1}),i(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,"with-header":!1,size:`340px`,class:`drawer`},{default:f(()=>[l(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var X=T(G,[[`render`,Y],[`__scopeId`,`data-v-ada6b2d1`]]),Z=h({name:`ImageUrlsInput`,components:{ElUpload:v,ElButton:P,InfoIcon:V,ImagePreview:B,FontAwesomeIcon:L},mixins:[M,N],data(){return{fileList:[],uploadUrl:k()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.headshots?.config?.image_urls},set(){let e=this.urls;this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,image_urls:e})}}},mounted(){this.value||=void 0,this.onSetImageUrls()},methods:{onExceed(){F.warning(this.$t(`headshots.message.uploadImageExceed`))},onError(){F.error(this.$t(`headshots.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,image_urls:e})},async onSuccess(){this.onSetImageUrls()}}}),Q={class:`field`},ne={class:`title font-bold`},re={class:`upload-wrapper`};function ie(t,a,s,l,u,d){let p=c(`image-preview`),h=c(`font-awesome-icon`),g=c(`el-button`),_=c(`el-upload`),v=c(`info-icon`);return m(),o(`div`,Q,[e(`h2`,ne,r(t.$t(`headshots.name.endImageUrls`)),1),e(`div`,re,[i(_,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":a[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value upload-wrapper`,limit:2,multiple:!0,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[i(p,{url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])]),default:f(()=>[i(g,{size:`small`,type:`primary`,round:``},{default:f(()=>[i(h,{icon:`fa-solid fa-upload`,class:`mr-1`}),n(` `+r(t.$t(`headshots.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])]),i(v,{content:t.$t(`headshots.description.endImageUrls`),class:`info`},null,8,[`content`])])}var ae=T(Z,[[`render`,ie],[`__scopeId`,`data-v-d468812a`]]),oe=`fast`,se=h({name:`ModeSelector`,components:{ElRadioButton:ee,ElRadioGroup:x},data(){return{options:[{label:this.$t(`headshots.button.fast`),value:`fast`},{label:this.$t(`headshots.button.relax`),value:`relax`}]}},computed:{value:{get(){return this.$store.state.headshots.config?.mode},set(e){console.debug(`set mode`,e),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots.config,mode:e})}}},mounted(){this.value||=oe}}),ce={class:`field`},le={class:`title font-bold`};function ue(t,a,l,d,h,g){let _=c(`el-radio-button`),v=c(`el-radio-group`);return m(),o(`div`,ce,[e(`h2`,le,r(t.$t(`headshots.name.mode`)),1),i(v,{modelValue:t.value,"onUpdate:modelValue":a[0]||=e=>t.value=e,class:`mode`},{default:f(()=>[(m(!0),o(s,null,p(t.options,e=>(m(),u(_,{key:e.value,label:e.value},{default:f(()=>[n(r(e.label),1)]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`])])}var de=T(se,[[`render`,ue],[`__scopeId`,`data-v-e7702494`]]),fe=h({name:`StylizeSelector`,components:{ElTabs:g,ElTabPane:_,ElImage:y},data(){return{tab:`styles`,value:``,elements:{styles:{displayName:this.$t(`headshots.styleCategory.styles`),items:[{image:`https://static.aipedias.com/aicamera/common/20241008/20241008202314260779439.png`,label:this.$t(`headshots.styleTag.malePportrait`),value:`male_portrait`},{image:`https://static.aipedias.com/aicamera/common/20241008/202410082022241e9755548.png`,label:this.$t(`headshots.styleTag.malePportrait2`),value:`male_portrait2`},{image:`https://static.aipedias.com/aicamera/common/20241101/20241101170130d78f66521.png`,label:this.$t(`headshots.styleTag.kindergarten`),value:`kindergarten`},{image:`https://static.aipedias.com/aicamera/common/20240923/20240923123233accf60398.webp`,label:this.$t(`headshots.styleTag.logoTshirt`),value:`logo_tshirt`},{image:`https://static.aipedias.com/aicamera/common/20241025/202410252012329472d0656.jpg`,label:this.$t(`headshots.styleTag.wedding`),value:`wedding`},{image:`https://static.aipedias.com/aicamera/common/20240915/20240915145045254931400.webp`,label:this.$t(`headshots.styleTag.businessPphoto`),value:`business_photo`},{image:`https://static.aipedias.com/aicamera/common/20240810/20240810194526040341795.jpg`,label:this.$t(`headshots.styleTag.bobSuit`),value:`bob_suit`},{image:`https://static.aipedias.com/aicamera/common/20240717/20240717152654e0b348173.webp`,label:this.$t(`headshots.styleTag.femalePortrait`),value:`female_portrait`}]}}}},watch:{value(e){console.debug(`set template`,e),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,template:e})}},mounted(){this.value||=``,console.debug(`set template`,this.value),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,template:this.value})},methods:{onToggle(e){this.value===e?this.value=``:this.value=e,console.debug(`set template`,this.value),this.$store.commit(`headshots/setConfig`,{...this.$store.state.headshots?.config,template:this.value})}}}),pe={class:`field`},me=[`onClick`],he={class:`name`};function ge(n,a,l,d,h,g){let _=c(`el-image`),v=c(`el-tab-pane`),y=c(`el-tabs`);return m(),o(`div`,pe,[i(y,{modelValue:n.tab,"onUpdate:modelValue":a[0]||=e=>n.tab=e},{default:f(()=>[(m(!0),o(s,null,p(n.elements,(a,c)=>(m(),u(v,{key:c,label:a.displayName,name:c,class:`pane`},{default:f(()=>[(m(!0),o(s,null,p(a.items,(a,s)=>(m(),o(`div`,{key:s,class:t({item:!0,active:n.value===a.value}),onClick:e=>n.onToggle(a.value)},[i(_,{src:a.image,fit:`fill`,class:`preview`},null,8,[`src`]),e(`span`,he,r(a.label),1)],10,me))),128))]),_:2},1032,[`label`,`name`]))),128))]),_:1},8,[`modelValue`])])}var _e=h({name:`PresetPanel`,components:{ModeSelector:de,ImageUrlsInput:ae,ElButton:P,FontAwesomeIcon:L,ElementsSelector:T(fe,[[`render`,ge],[`__scopeId`,`data-v-be4bd25d`]])},emits:[`generate`],computed:{config(){return this.$store.state.headshots?.config}},methods:{onGenerate(){this.$emit(`generate`)}}}),ve={class:`panel`},ye={class:`config`},be={class:`actions`};function xe(t,a,s,l,u,d){let p=c(`elements-selector`),h=c(`mode-selector`),g=c(`image-urls-input`),_=c(`font-awesome-icon`),v=c(`el-button`);return m(),o(`div`,ve,[e(`div`,ye,[i(p,{class:`mb-4`}),i(h,{class:`mb-4`}),i(g,{class:`mb-4`}),e(`div`,be,[i(v,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(_,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`headshots.button.generate`)),1)]),_:1},8,[`onClick`])])])])}var Se=T(_e,[[`render`,xe],[`__scopeId`,`data-v-848739f6`]]),Ce=h({name:`ImageGallery`,props:{modelValue:{type:Object,required:!0}},setup(e){return{images:d(()=>e.modelValue?.response?.data?.slice(0,2)||[]),viewImage:e=>{window.open(e,`_blank`)}}}}),we={class:`image-gallery`},Te=[`src`],Ee=[`onClick`];function De(t,n,i,c,l,u){return m(),o(`div`,we,[(m(!0),o(s,null,p(t.images,(n,i)=>(m(),o(`div`,{key:i,class:`image-container`},[e(`img`,{src:n.image_url,alt:`Image`},null,8,Te),n.image_url?(m(),o(`button`,{key:0,class:`view-button`,onClick:e=>t.viewImage(n.image_url)},r(t.$t(`headshots.button.viewImage`)),9,Ee)):a(``,!0)]))),128))])}var Oe=h({name:`TaskPreview`,components:{ElImage:y,CopyToClipboard:R,FontAwesomeIcon:L,ElAlert:b,ImageGallery:T(Ce,[[`render`,De],[`__scopeId`,`data-v-42f0a7be`]]),ApiCodeButton:W},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.headshots?.application},config(){return this.$store.state.headshots?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onReload(e){let t=e.target,n=new URL(t.src),r=n.searchParams.get(`retry`);if(!r)n.searchParams.set(`retry`,`1`);else if(parseInt(r)<2)n.searchParams.set(`retry`,(parseInt(r)+1).toString());else return;t.src=n.toString()},onOpenVideo(e){window.open(e,`_blank`)}}}),ke={class:`preview`},Ae={class:`left`},je={class:`main`},Me={class:`bot`},Ne={class:`datetime`},Pe={class:`info`},Fe={key:0,class:`prompt mt-2`},Ie={key:0},Le={key:1},Re={key:0,class:t({content:!0,failed:!0})},ze={class:`image-wrapper`},Be={class:t({operations:!0,"mt-2":!0,"mb-2":!0})},Ve={class:`description`},He={key:0,class:`description`},Ue={key:1,class:t({content:!0})},We={class:`description`},Ge={class:`description`},Ke={key:0,class:`description`},qe={class:`description`},Je={key:2,class:t({content:!0})},$={class:`description`},Ye={key:3,class:t({content:!0})},Xe={class:`description`};function Ze(t,s,l,u,d,p){let h=c(`el-image`),g=c(`image-gallery`),_=c(`api-code-button`),v=c(`font-awesome-icon`),y=c(`copy-to-clipboard`),b=c(`el-alert`);return m(),o(`div`,ke,[e(`div`,Ae,[i(h,{src:`https://cdn.acedata.cloud/isxyfw.png`,class:`avatar`})]),e(`div`,je,[e(`div`,Me,[n(r(t.$t(`headshots.name.headshotsBot`))+` `,1),e(`span`,Ne,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Pe,[t.modelValue?.request?.template?(m(),o(`p`,Fe,[n(r(t.modelValue?.request?.template)+` `,1),t.modelValue?.response?a(``,!0):(m(),o(`span`,Ie,` - (`+r(t.$t(`headshots.status.pending`))+`) `,1)),t.modelValue?.response?.status===`unknown`?(m(),o(`span`,Le,` - (`+r(t.$t(`headshots.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0?(m(),o(`div`,Re,[e(`div`,ze,[i(g,{"model-value":t.modelValue},null,8,[`model-value`])]),e(`div`,Be,[i(_,{path:`/headshots/images`,body:t.modelValue?.request},null,8,[`body`])]),i(b,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,Ve,[i(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(y,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),t.modelValue?.elapsed?(m(),o(`p`,He,[i(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(m(),o(`div`,Ue,[i(b,{closable:!1,class:`failure`},{template:f(()=>[i(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.failure`)),1)]),default:f(()=>[e(`p`,We,[i(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(y,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,Ge,[i(v,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(y,{content:t.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),t.modelValue?.elapsed?(m(),o(`p`,Ke,[i(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),e(`p`,qe,[i(v,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(y,{content:t.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):a(``,!0),t.modelValue?.response?a(``,!0):(m(),o(`div`,Je,[i(b,{closable:!1,class:`info`},{template:f(()=>[i(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.failure`)),1)]),default:f(()=>[e(`p`,$,[i(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(y,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])),t.modelValue?.response?.status===`unknown`?(m(),o(`div`,Ye,[i(b,{closable:!1,class:`info`},{template:f(()=>[i(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.failure`)),1)]),default:f(()=>[e(`p`,Xe,[i(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`headshots.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(y,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):a(``,!0)])])}var Qe=h({name:`RecentPanel`,components:{TaskPreview:T(Oe,[[`render`,Ze],[`__scopeId`,`data-v-0e921c0c`]]),ElSkeleton:w,ElSkeletonItem:C,ScrollList:H},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.headshots?.tasks,items:this.$store.state.headshots?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),$e={key:0,class:`tasks`},et={class:`left`},tt={class:`main`},nt={key:1,class:`tasks`},rt={key:2,class:`description`};function it(t,n,l,d,h,g){let _=c(`el-skeleton-item`),v=c(`el-skeleton`),y=c(`task-preview`),b=c(`scroll-list`);return m(),u(b,{ref:`scrollList`,class:`panel recent`,loading:t.loading,onReachTop:n[0]||=e=>t.$emit(`reach-top`)},{default:f(()=>[t.tasks?.items===void 0?(m(),o(`div`,$e,[(m(),o(s,null,p(3,t=>e(`div`,{key:t,class:`task placeholder`},[e(`div`,et,[i(v,{animated:``},{template:f(()=>[i(_,{variant:`image`,class:`avatar`})]),_:1})]),e(`div`,tt,[i(v,{animated:``},{template:f(()=>[i(_,{variant:`p`,class:`title`}),i(_,{variant:`image`,class:`icon`})]),_:1})])])),64))])):t.tasks?.items?.length&&t.tasks?.items?.length>0?(m(),o(`div`,nt,[(m(!0),o(s,null,p(t.tasks?.items,(e,t)=>(m(),u(y,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))])):a(``,!0),t.tasks?.items?.length===0?(m(),o(`p`,rt,r(t.$t(`headshots.message.noTasks`)),1)):a(``,!0)]),_:1},8,[`loading`])}var at=h({name:`HeadshotsIndex`,components:{ConfigPanel:Se,Layout:X,ApplicationStatus:z,RecentPanel:T(Qe,[[`render`,it],[`__scopeId`,`data-v-ffd55c16`]])},mixins:[O],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.headshots?.status?.getApplications===j.Request},tasksLoading(){return this.$store.state.headshots?.status?.getTasks===j.Request||this.fetchingTasks},service(){return this.$store.state.headshots.service},credential(){return this.$store.state.headshots.credential},config(){return this.$store.state.headshots.config},initializing(){return this.$store.state.headshots.status.getApplications===j.Request},needApply(){return this.$store.state.headshots.status.getApplications===j.Success&&!this.application},application(){return this.$store.state.headshots.application},applications(){return this.$store.state.headshots.applications},tasks(){return this.$store.state.headshots.tasks}},watch:{tasks:{handler(e,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=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await U({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`headshots/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`headshots/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},onApply(){A.create({application:this.application}).then(({data:e})=>{this.application=e,F.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&F.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`headshots/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGeneratePicture(){if(!E(this.uploadTracker,e=>this.$t(e),e=>F.warning(e)))return;let e={...this.config,async:!0};if(!te())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}F.info(this.$t(`headshots.message.startingTask`)),I(`headshots`,D.generate(e,{token:t})).then(()=>{F.success(this.$t(`headshots.message.startTaskSuccess`)),this.$store.commit(`headshots/setConfig`,{config:void 0})}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?F.error(this.$t(`headshots.message.usedUp`)):F.error(this.$t(`headshots.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function ot(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`application-status`),d=c(`recent-panel`),p=c(`layout`);return m(),u(p,null,{config:f(()=>[i(s,{onGenerate:e.onGeneratePicture},null,8,[`onGenerate`])]),result:f(()=>[i(l,{initializing:e.initializing,application:e.application,applications:e.applications,service:e.service,"need-apply":e.needApply,class:`mb-4`,onRefresh:e.onGetApplication,onSelect:t[0]||=t=>e.$store.dispatch(`headshots/setApplication`,t)},null,8,[`initializing`,`application`,`applications`,`service`,`need-apply`,`onRefresh`]),i(d,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var st=T(at,[[`render`,ot],[`__scopeId`,`data-v-9ea36b64`]]);export{st as default};