@acedatacloud/nexior 3.329.12 → 3.329.13

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 (146) hide show
  1. package/dist/assets/{ApiCodeButton-mADYjD5b.js → ApiCodeButton-QA7sAoU5.js} +1 -1
  2. package/dist/assets/{Artifacts-CMIWKObf.js → Artifacts-DTRKuUCx.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-Ci7eFT1J.js → AskUserQuestionCard-C0LCAxbe.js} +1 -1
  4. package/dist/assets/{AudioPreview-C3ubVhoE.js → AudioPreview-BFrOwlWN.js} +1 -1
  5. package/dist/assets/{Auth-DpI8_46T.js → Auth-BGuBrrPM.js} +1 -1
  6. package/dist/assets/{Bare-C2tJrBqH.js → Bare-DGKtdCYd.js} +1 -1
  7. package/dist/assets/{BotPlaceholder-D6oZRzf4.js → BotPlaceholder-CKfXLBVh.js} +1 -1
  8. package/dist/assets/{BottomFooter-BvxkR60D.js → BottomFooter-DKVeucQI.js} +1 -1
  9. package/dist/assets/{Callback-BgIfSgEU.js → Callback-kpUHn53m.js} +1 -1
  10. package/dist/assets/{CodeSnippet-CouSzmMJ.js → CodeSnippet-D_d1CiPO.js} +1 -1
  11. package/dist/assets/{Console-DHnaVR1i.js → Console-BGilv5go.js} +1 -1
  12. package/dist/assets/{Consumption-DoSivvh_.js → Consumption-DZ2G5VjX.js} +1 -1
  13. package/dist/assets/{Conversation-BvlfaCwi.js → Conversation-B3dZSSOg.js} +1 -1
  14. package/dist/assets/{Conversation-Dy13Ov5w.js → Conversation-BzvGO2oq.js} +1 -1
  15. package/dist/assets/{CopyToClipboard-DbdtulPr.js → CopyToClipboard-CRx3WmAz.js} +1 -1
  16. package/dist/assets/{Detail-UI6l9mYK.js → Detail-DdyUNHCq.js} +2 -2
  17. package/dist/assets/{Extra-DTwItNXj.js → Extra-WKw2uC-7.js} +1 -1
  18. package/dist/assets/{FilePreview-BnlrifuU.js → FilePreview-Drl8gICO.js} +1 -1
  19. package/dist/assets/{Hailuo-xUugzWSc.js → Hailuo-CfIptCG3.js} +1 -1
  20. package/dist/assets/{History-jIUqRidl.js → History-DYcFT8AB.js} +1 -1
  21. package/dist/assets/{ImagePreview-K_WaZ_Rh.js → ImagePreview-BA-2TVGQ.js} +1 -1
  22. package/dist/assets/{ImageWrapper-Cg7GMVBO.js → ImageWrapper-BaJW62Yy.js} +1 -1
  23. package/dist/assets/{Index-ZRGIST1q.js → Index-9TOes4T5.js} +1 -1
  24. package/dist/assets/{Index-BxBsRPVJ.js → Index-B65l7k8B.js} +1 -1
  25. package/dist/assets/{Index-BGufRSsQ.js → Index-B6j7rFA5.js} +1 -1
  26. package/dist/assets/{Index-D8yQZPPV.js → Index-BAhOyHnt.js} +1 -1
  27. package/dist/assets/{Index-CtsT91dy.js → Index-BB5R1Se3.js} +1 -1
  28. package/dist/assets/{Index-Dtu8KZ_m.js → Index-BShSnqKW.js} +1 -1
  29. package/dist/assets/{Index-CTXtrARt.js → Index-BbiCHhym.js} +1 -1
  30. package/dist/assets/Index-BwTugAev.css +1 -0
  31. package/dist/assets/{Index-CqaxibjS.js → Index-Byv0vdYy.js} +1 -1
  32. package/dist/assets/{Index-CF8WBz22.js → Index-C4rCKKj4.js} +1 -1
  33. package/dist/assets/{Index-CV1aqlfO.js → Index-C6FdjnI1.js} +1 -1
  34. package/dist/assets/{Index-B8jjrNeI.js → Index-CEaSsSy8.js} +1 -1
  35. package/dist/assets/{Index-0hY7UI07.js → Index-CK9UMYfF.js} +1 -1
  36. package/dist/assets/{Index-Csy7ilqL.js → Index-C_U5cF_y.js} +1 -1
  37. package/dist/assets/{Index-C1SEa8qo.js → Index-CnCAJVBU.js} +1 -1
  38. package/dist/assets/{Index-BNGsbSUM.js → Index-CtNZhZRy.js} +1 -1
  39. package/dist/assets/{Index-BdmGpjDO.js → Index-CwJJN0Rf.js} +1 -1
  40. package/dist/assets/{Index-aE23w_3c.js → Index-CyYHBoau.js} +1 -1
  41. package/dist/assets/{Index-DIeu3wPi.js → Index-CzXVTWnz.js} +1 -1
  42. package/dist/assets/{Index-Ccgqn_o0.js → Index-D9B6JASi.js} +1 -1
  43. package/dist/assets/{Index-Dg1d2cu1.js → Index-DBRuhTIN.js} +1 -1
  44. package/dist/assets/{Index-D0NVLz4o.js → Index-DcJN4zL5.js} +1 -1
  45. package/dist/assets/{Index-Bj8qi7kE.js → Index-DnASNFfW.js} +1 -1
  46. package/dist/assets/{Index-DxBPvWCW.js → Index-G_YkozFK.js} +1 -1
  47. package/dist/assets/{Index-fFtGfqQa.js → Index-LHCpq7CC.js} +1 -1
  48. package/dist/assets/{Index-BSLY2kzH.js → Index-YEqGwdT1.js} +1 -1
  49. package/dist/assets/{Index-GurPfc--.js → Index-YjWrfY5Z.js} +1 -1
  50. package/dist/assets/{Index-DW9Cq5Vq.js → Index-chv8mZzH.js} +1 -1
  51. package/dist/assets/{Index-U-LEzSmq.js → Index-q_xgdrtj.js} +1 -1
  52. package/dist/assets/{Index-TYOgD0wv.js → Index-xo0Agcgj.js} +1 -1
  53. package/dist/assets/{Invitees-DUf8YkIS.js → Invitees-xj0IsPSI.js} +1 -1
  54. package/dist/assets/{List-DT3Ufg1f.js → List-Crm-ynJg.js} +1 -1
  55. package/dist/assets/{List-DnBYnG0o.js → List-DSpxcxaM.js} +1 -1
  56. package/dist/assets/{List-CAnoarVV.js → List-Dk8z4pd1.js} +1 -1
  57. package/dist/assets/{LocalTools-mJz8_0IB.js → LocalTools-DjKoHaDh.js} +1 -1
  58. package/dist/assets/{LocalTools-B4y92k1Y.js → LocalTools-DpK9GjcT.js} +1 -1
  59. package/dist/assets/{Main-DS-0Cb6U.js → Main-kl3UYsko.js} +1 -1
  60. package/dist/assets/{Message-DC058yIO.js → Message-CeQk3oHn.js} +1 -1
  61. package/dist/assets/{Model-BYW1oqEy.js → Model-Cl7NmYH6.js} +1 -1
  62. package/dist/assets/{Navigator-IomaZcL9.js → Navigator-BAIwNUTZ.js} +3 -3
  63. package/dist/assets/{NotFound-BBq0de34.js → NotFound-B5ABubI7.js} +1 -1
  64. package/dist/assets/{Pay-D2JPvy3r.js → Pay-BotJB2ZN.js} +1 -1
  65. package/dist/assets/{Player-Bfa9BTnC.js → Player-Bb1UjqmE.js} +1 -1
  66. package/dist/assets/{PromptTextarea-nY94k6uT.js → PromptTextarea-DfytCmfP.js} +1 -1
  67. package/dist/assets/{RealtimeCall-CPjxnFlv.js → RealtimeCall-CjBy5yWE.js} +1 -1
  68. package/dist/assets/{ScheduledTasks-BfX-rZtB.js → ScheduledTasks-CA0tB2dV.js} +1 -1
  69. package/dist/assets/{Status-2D39-JBu.js → Status-CLittBF8.js} +1 -1
  70. package/dist/assets/{Subscribe-CXvxhYuM.js → Subscribe-B92Bh7HC.js} +1 -1
  71. package/dist/assets/{TabSwitcher-xSb7nKDo.js → TabSwitcher-DJll3_dK.js} +1 -1
  72. package/dist/assets/{Tts-B9DfF_N1.js → Tts-D0SQLFFy.js} +1 -1
  73. package/dist/assets/{VideoPlayer-B0FgVrbH.js → VideoPlayer-DJv7Is_7.js} +1 -1
  74. package/dist/assets/{alert-C0fuFz2o.js → alert-MxWa3YPt.js} +1 -1
  75. package/dist/assets/{avatar-jbB9EGqo.js → avatar-Dz10CQ2H.js} +1 -1
  76. package/dist/assets/{basic-y36AC5NB.js → basic-D3hfLeYz.js} +1 -1
  77. package/dist/assets/{chat-DI7y0KzY.js → chat-BH1evLat.js} +1 -1
  78. package/dist/assets/{codingBridge-Bdfb8M9Y.js → codingBridge-DPZCZ9Jp.js} +1 -1
  79. package/dist/assets/{codingBridgeNotify-Cig1hTLM.js → codingBridgeNotify-DZHkzxzn.js} +2 -2
  80. package/dist/assets/{collapse-BWVPPZn4.js → collapse-BtyCO2fS.js} +1 -1
  81. package/dist/assets/{createTaskActions-CwZVvZUi.js → createTaskActions-B5xJ-nXz.js} +1 -1
  82. package/dist/assets/{date-picker-__oTuNzH.js → date-picker-hmNtifbU.js} +1 -1
  83. package/dist/assets/{digitalhuman-BXtnGTwd.js → digitalhuman-DpQD-xcS.js} +1 -1
  84. package/dist/assets/{drawer-BQJOy8jC.js → drawer-Ch5GZZ3O.js} +1 -1
  85. package/dist/assets/{dropdown-56Us_BBU.js → dropdown-BtOXrgeZ.js} +1 -1
  86. package/dist/assets/{dropdown-DXWGzCgV.js → dropdown-CT0dOzyC.js} +1 -1
  87. package/dist/assets/{esm-Uz-1fz_G.js → esm-B8xSvjvP.js} +3 -3
  88. package/dist/assets/{esm-BSQvfvbR.js → esm-BaTScqky.js} +1 -1
  89. package/dist/assets/{esm-OyzdWiTb.js → esm-BxN-PSYd.js} +1 -1
  90. package/dist/assets/{esm-BjaSuln2.js → esm-C3WcbAJa.js} +2 -2
  91. package/dist/assets/{esm-CaLwhe7O.js → esm-CHK8ek8m.js} +2 -2
  92. package/dist/assets/esm-Di7USauG.js +1 -0
  93. package/dist/assets/{esm-Wc8MZsoD.js → esm-RXM5d8TN.js} +1 -1
  94. package/dist/assets/{fish-Bke1ZSTz.js → fish-CvZnLgUG.js} +1 -1
  95. package/dist/assets/{flux-ByqFpW95.js → flux-DWpZXUmG.js} +1 -1
  96. package/dist/assets/{grokvideo-BXcvHh-d.js → grokvideo-DBv8xIKg.js} +1 -1
  97. package/dist/assets/{hailuo-BWb_M9h7.js → hailuo-DnTNK4jA.js} +1 -1
  98. package/dist/assets/{image-CnOusUI9.js → image-DXnc07fB.js} +1 -1
  99. package/dist/assets/{index-RwM70L92.js → index-hUqJzTZs.js} +3 -3
  100. package/dist/assets/{index.browser.esm-CswuMNVV.js → index.browser.esm-DEP_HAeX.js} +1 -1
  101. package/dist/assets/{index.es-DZYx0kkW.js → index.es-C9USprIb.js} +1 -1
  102. package/dist/assets/{input-number-D7ub5HL-.js → input-number-CNwWqY98.js} +1 -1
  103. package/dist/assets/{kling-C73XSKjV.js → kling-CFkovUPy.js} +1 -1
  104. package/dist/assets/{luma-CxuRivJs.js → luma-CbrahH3c.js} +1 -1
  105. package/dist/assets/{maestro-ByFUqOGl.js → maestro-CCe4mnaA.js} +1 -1
  106. package/dist/assets/{midjourney-B4YtncWZ.js → midjourney-CIk7gltT.js} +1 -1
  107. package/dist/assets/{mobileLocalExec-CYP92NOw.js → mobileLocalExec-Dq-AQcnz.js} +2 -2
  108. package/dist/assets/{nanobanana-DJgU5z3z.js → nanobanana-imevpm6B.js} +1 -1
  109. package/dist/assets/{omni-Bv0N9Rf3.js → omni-Bhc7DMwy.js} +1 -1
  110. package/dist/assets/{openaiimage-Clg1H0mQ.js → openaiimage-jABlWywS.js} +1 -1
  111. package/dist/assets/{pagination-CzG0g5eL.js → pagination-BOXCETql.js} +1 -1
  112. package/dist/assets/{pagination-CQE4a_fG.js → pagination-CYLX-yRi.js} +1 -1
  113. package/dist/assets/{pika-D5fh18oY.js → pika-CJRJV5QN.js} +1 -1
  114. package/dist/assets/{pixverse-CJ-5Kev5.js → pixverse-BVhv7DTf.js} +1 -1
  115. package/dist/assets/{popover-CdDFA6E8.js → popover-DNtC3yAT.js} +1 -1
  116. package/dist/assets/{producer-OKlM6N2w.js → producer-DLDCnphH.js} +1 -1
  117. package/dist/assets/{qrart-bRNgXuqH.js → qrart-DGkwThH4.js} +1 -1
  118. package/dist/assets/{realtime-BHOMccPV.js → realtime-cERwfjpX.js} +1 -1
  119. package/dist/assets/{row-BngEQTNI.js → row-nF6EaJnc.js} +1 -1
  120. package/dist/assets/{seedance-b-ePOtN9.js → seedance-BWPux7Sv.js} +1 -1
  121. package/dist/assets/{seedream-BaaF6_nZ.js → seedream-nd0DUN5v.js} +1 -1
  122. package/dist/assets/{select-DC7S5Jnc.js → select-5RrKVJWv.js} +1 -1
  123. package/dist/assets/{serp-Ctv5Zo6P.js → serp-DLSMe9lr.js} +1 -1
  124. package/dist/assets/{slider-BwuIArRC.js → slider-BSnxFgoX.js} +1 -1
  125. package/dist/assets/{solana-wallets-DM6SLseK.js → solana-wallets-X6szdKRQ.js} +2 -2
  126. package/dist/assets/{solana-wallets-vue-BIrF1bAc.js → solana-wallets-vue-BpPlIm9f.js} +1 -1
  127. package/dist/assets/{sora-DLJCAaE_.js → sora-DBtkJZDT.js} +1 -1
  128. package/dist/assets/{suno-BQavU_WG.js → suno-nchyKgxc.js} +1 -1
  129. package/dist/assets/{switch-Bm7Qvmc8.js → switch-Cx5c7gi6.js} +1 -1
  130. package/dist/assets/{table-BBVaH0rF.js → table-CzoGnPpk.js} +1 -1
  131. package/dist/assets/{tabs-B1tsE3l8.js → tabs-CtkBu9RO.js} +1 -1
  132. package/dist/assets/{time-picker-B6lo5Saa.js → time-picker-C2xUCmot.js} +1 -1
  133. package/dist/assets/{tooltip-DNVwZYm2.js → tooltip-DqZhkwOE.js} +1 -1
  134. package/dist/assets/{upload-kOgU3Xy2.js → upload-DOtR0Rsx.js} +1 -1
  135. package/dist/assets/{veo-zHNpQZx-.js → veo-B5vpkxdm.js} +1 -1
  136. package/dist/assets/{wan-DAGnEQpB.js → wan-DJ8D8cQr.js} +1 -1
  137. package/dist/assets/{web-B3btv0ks.js → web-1YdsIAFE.js} +1 -1
  138. package/dist/assets/{web-9Zs8rdSM.js → web-BOjcHUnE.js} +1 -1
  139. package/dist/assets/{web-DSFDSjVA.js → web-C2JOnsWe.js} +1 -1
  140. package/dist/assets/{web-DDiiCjDl.js → web-DR8R1LMT.js} +1 -1
  141. package/dist/assets/{web-BNUxUzl9.js → web-DuhRedM3.js} +1 -1
  142. package/dist/assets/{webextrator-BzKBNn-r.js → webextrator-C-SBhZav.js} +1 -1
  143. package/dist/index.html +1 -1
  144. package/package.json +1 -1
  145. package/dist/assets/Index-0xuoJN6j.css +0 -1
  146. package/dist/assets/esm-DzI6h11F.js +0 -1
@@ -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-DC7S5Jnc.js";import{t as b}from"./upload-kOgU3Xy2.js";import{t as x}from"./tooltip-DNVwZYm2.js";import{t as S}from"./image-CnOusUI9.js";import{t as C}from"./alert-C0fuFz2o.js";import{t as w}from"./drawer-BQJOy8jC.js";import{t as T}from"./input-number-D7ub5HL-.js";import{t as E}from"./slider-BwuIArRC.js";import{cr as ee,dr as D,lr as O,ur as k}from"./constants-DTWXEulJ.js";import{G as A,Ni as j,Nr as te,Si as M,Wi as N,an as P,in as F,ln as I,on as L,sn as R,tr as z,vn as B,yi as V}from"./index-RwM70L92.js";import{t as H}from"./index.es-DZYx0kkW.js";import{t as U}from"./CopyToClipboard-DbdtulPr.js";import{t as W}from"./ImagePreview-K_WaZ_Rh.js";import{n as G}from"./taskDrawerMixin-DyAUhFEq.js";import{t as K}from"./Consumption-DoSivvh_.js";import{a as q,n as J,r as Y,t as X}from"./pagination-CQE4a_fG.js";import{t as Z}from"./VideoPlayer-B0FgVrbH.js";import{t as Q}from"./ApiCodeButton-mADYjD5b.js";import{t as ne}from"./BotPlaceholder-D6oZRzf4.js";import{t as re}from"./PromptTextarea-nY94k6uT.js";var ie=_({name:`LayoutPixverse`,components:{ElDrawer:w,ElButton:N,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=A(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||=O}}),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=A(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||=D}}),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=A(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||=k}}),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=A(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=A(Te,[[`render`,Oe],[`__scopeId`,`data-v-64e17b3c`]]),Ae=_({name:`SeedSelector`,components:{ElSlider:E,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=A(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=A(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||=ee}}),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=A(Ue,[[`render`,Je],[`__scopeId`,`data-v-53038264`]]),Xe=_({name:`StartImage`,components:{ElUpload:b,ElButton:N,InfoIcon:q,FontAwesomeIcon:H,ImagePreview:W},mixins:[R,P],emits:[`change`],data(){return{fileList:[],uploadUrl:M()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){j.warning(this.$t(`pixverse.message.uploadReferencesExceed`))},onError(){j.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=A(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:N,FontAwesomeIcon:H,PromptInput:A(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 I(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=A(at,[[`render`,lt]]),dt=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:U,FontAwesomeIcon:H,ElAlert:C,VideoPlayer:Z,ElTooltip:x,ElButton:N,ApiCodeButton:Q},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:A(dt,[[`render`,jt],[`__scopeId`,`data-v-dd3037dc`]]),NoTasks:Y,BotPlaceholder:ne,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:A(Mt,[[`render`,Ft]])},mixins:[L],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===V.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===V.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 X({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(!F(this.uploadTracker,e=>this.$t(e),e=>j.warning(e)))return;let e={...this.config,async:!0};if(!B())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}j.info(this.$t(`pixverse.message.startingTask`)),te(`pixverse`,z.generate(e,{token:t})).then(()=>{j.success(this.$t(`pixverse.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?j.error(this.$t(`pixverse.message.usedUp`)):j.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=A(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-5RrKVJWv.js";import{t as b}from"./upload-DOtR0Rsx.js";import{t as x}from"./tooltip-DqZhkwOE.js";import{t as S}from"./image-DXnc07fB.js";import{t as C}from"./alert-MxWa3YPt.js";import{t as w}from"./drawer-Ch5GZZ3O.js";import{t as T}from"./input-number-CNwWqY98.js";import{t as E}from"./slider-BSnxFgoX.js";import{cr as ee,dr as D,lr as O,ur as k}from"./constants-DTWXEulJ.js";import{G as A,Ni as j,Nr as te,Si as M,Wi as N,an as P,in as F,ln as I,on as L,sn as R,tr as z,vn as B,yi as V}from"./index-hUqJzTZs.js";import{t as H}from"./index.es-C9USprIb.js";import{t as U}from"./CopyToClipboard-CRx3WmAz.js";import{t as W}from"./ImagePreview-BA-2TVGQ.js";import{n as G}from"./taskDrawerMixin-DyAUhFEq.js";import{t as K}from"./Consumption-DZ2G5VjX.js";import{a as q,n as J,r as Y,t as X}from"./pagination-CYLX-yRi.js";import{t as Z}from"./VideoPlayer-DJv7Is_7.js";import{t as Q}from"./ApiCodeButton-QA7sAoU5.js";import{t as ne}from"./BotPlaceholder-CKfXLBVh.js";import{t as re}from"./PromptTextarea-DfytCmfP.js";var ie=_({name:`LayoutPixverse`,components:{ElDrawer:w,ElButton:N,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=A(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||=O}}),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=A(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||=D}}),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=A(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||=k}}),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=A(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=A(Te,[[`render`,Oe],[`__scopeId`,`data-v-64e17b3c`]]),Ae=_({name:`SeedSelector`,components:{ElSlider:E,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=A(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=A(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||=ee}}),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=A(Ue,[[`render`,Je],[`__scopeId`,`data-v-53038264`]]),Xe=_({name:`StartImage`,components:{ElUpload:b,ElButton:N,InfoIcon:q,FontAwesomeIcon:H,ImagePreview:W},mixins:[R,P],emits:[`change`],data(){return{fileList:[],uploadUrl:M()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.pixverse?.config?.image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){j.warning(this.$t(`pixverse.message.uploadReferencesExceed`))},onError(){j.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=A(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:N,FontAwesomeIcon:H,PromptInput:A(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 I(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=A(at,[[`render`,lt]]),dt=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:U,FontAwesomeIcon:H,ElAlert:C,VideoPlayer:Z,ElTooltip:x,ElButton:N,ApiCodeButton:Q},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:A(dt,[[`render`,jt],[`__scopeId`,`data-v-dd3037dc`]]),NoTasks:Y,BotPlaceholder:ne,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:A(Mt,[[`render`,Ft]])},mixins:[L],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pixverse?.status?.getApplications===V.Request},tasksLoading(){return this.$store.state.pixverse?.status?.getTasks===V.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 X({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(!F(this.uploadTracker,e=>this.$t(e),e=>j.warning(e)))return;let e={...this.config,async:!0};if(!B())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}j.info(this.$t(`pixverse.message.startingTask`)),te(`pixverse`,z.generate(e,{token:t})).then(()=>{j.success(this.$t(`pixverse.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?j.error(this.$t(`pixverse.message.usedUp`)):j.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=A(It,[[`render`,Lt]]);export{Rt as default};
@@ -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-DC7S5Jnc.js";import{t as x}from"./upload-kOgU3Xy2.js";import{t as S}from"./tooltip-DNVwZYm2.js";import{t as C}from"./image-CnOusUI9.js";import{t as w}from"./alert-C0fuFz2o.js";import{t as T}from"./drawer-BQJOy8jC.js";import{At as ee,Bt as E,Ft as D,Ht as O,It as k,Lt as A,Mt as j,Nt as M,Pt as N,Rt as te,Ut as P,jt as ne,kt as re,zt as F}from"./constants-DTWXEulJ.js";import{Bn as I,G as L,Ni as R,Nr as z,Si as B,Wi as V,an as H,in as U,ln as W,on as G,sn as K,vn as q,yi as J}from"./index-RwM70L92.js";import{t as Y}from"./index.es-DZYx0kkW.js";import{t as X}from"./CopyToClipboard-DbdtulPr.js";import{t as Z}from"./ImagePreview-K_WaZ_Rh.js";import{n as ie}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ae}from"./Consumption-DoSivvh_.js";import{a as Q,n as oe,r as se,t as ce}from"./pagination-CQE4a_fG.js";import{t as le}from"./VideoPlayer-B0FgVrbH.js";import{t as ue}from"./ApiCodeButton-mADYjD5b.js";import{t as de}from"./BotPlaceholder-D6oZRzf4.js";import{t as fe}from"./PromptTextarea-nY94k6uT.js";var pe=v({name:`LayoutGrokVideo`,components:{ElDrawer:T,ElButton:V,FontAwesomeIcon:Y},mixins:[ie]}),me={class:`main flex flex-row flex-1`},he={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ge={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function _e(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,me,[e(`div`,he,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ge,[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 ve=L(pe,[[`render`,_e],[`__scopeId`,`data-v-76ddc288`]]),ye=v({name:`GrokVideoPromptInput`,components:{PromptTextarea:fe},computed:{prompt:{get(){return this.$store.state.grokvideo?.config?.prompt},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function be(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(`grokvideo.name.prompt`),info:e.$t(`grokvideo.description.prompt`),placeholder:e.$t(`grokvideo.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var xe=L(ye,[[`render`,be]]),Se=v({name:`GrokVideoModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Q},data(){return{options:[{value:D,label:this.$t(`grokvideo.model.default`)},{value:N,label:this.$t(`grokvideo.model.preview15`)}]}},computed:{value:{get(){return this.$store.state.grokvideo?.config?.model},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,model:e})}}},mounted(){this.value||=re}}),Ce={class:`field`},we={class:`label`},Te={class:`box`},Ee={class:`title font-bold`};function De(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Ce,[e(`div`,we,[e(`div`,Te,[e(`h2`,Ee,i(t.$t(`grokvideo.name.model`)),1),a(m,{content:t.$t(`grokvideo.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(`grokvideo.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 Oe=L(Se,[[`render`,De],[`__scopeId`,`data-v-291d93fb`]]),ke=v({name:`GrokVideoDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Q},computed:{model(){return this.$store.state.grokvideo?.config?.model},maxDuration(){return O(this.model)},options(){return j.filter(e=>e<=this.maxDuration).map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.grokvideo?.config?.duration},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,duration:e})}}},watch:{maxDuration(e){this.value&&this.value>e&&(this.value=e)}},mounted(){this.value||=8}}),Ae={class:`field`},je={class:`label`},Me={class:`box`},Ne={class:`title font-bold`};function Pe(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Ae,[e(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(t.$t(`grokvideo.name.duration`)),1),a(m,{content:t.$t(`grokvideo.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(`grokvideo.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 Fe=L(ke,[[`render`,Pe],[`__scopeId`,`data-v-9c711686`]]),Ie=v({name:`GrokVideoResolutionSelector`,components:{InfoIcon:Q},data(){return{options:[{value:F,label:`480p`},{value:E,label:`720p`},{value:te,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.grokvideo?.config?.resolution},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,resolution:e})}}},mounted(){this.value||=ne}}),Le={class:`resolution`},Re={class:`header`},ze={class:`title font-bold`},Be={class:`items`},Ve=[`onClick`];function He(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Le,[e(`div`,Re,[e(`h2`,ze,i(t.$t(`grokvideo.name.resolution`)),1),a(p,{content:t.$t(`grokvideo.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,Be,[(g(!0),s(c,null,h(t.options,e=>(g(),s(`div`,{key:e.value,class:n([`item`,{active:t.value===e.value}]),onClick:n=>t.value=e.value},i(e.label),11,Ve))),128))])])}var Ue=L(Ie,[[`render`,He],[`__scopeId`,`data-v-54f22a22`]]),We=v({name:`GrokVideoRatioSelector`,components:{InfoIcon:Q},computed:{options(){return[{value:k,label:`16:9`,w:32,h:18},{value:A,label:`9:16`,w:18,h:32},{value:`1:1`,label:`1:1`,w:24,h:24},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`3:2`,label:`3:2`,w:30,h:20},{value:`2:3`,label:`2:3`,w:20,h:30}]},value:{get(){return this.$store.state.grokvideo?.config?.aspect_ratio},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,aspect_ratio:e})}}},mounted(){this.value||=ee}}),Ge={class:`ratio`},Ke={class:`header`},qe={class:`title font-bold`},Je={class:`items`},Ye=[`onClick`],Xe={class:`preview`},Ze={class:`name`};function Qe(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ge,[e(`div`,Ke,[e(`h2`,qe,i(t.$t(`grokvideo.name.ratio`)),1),a(p,{content:t.$t(`grokvideo.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,Je,[(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`,Xe,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,Ze,i(r.label),1)],10,Ye))),128))])])}var $e=L(We,[[`render`,Qe],[`__scopeId`,`data-v-70115284`]]),et=v({name:`GrokVideoImageInput`,components:{ElUpload:x,ElButton:V,InfoIcon:Q,FontAwesomeIcon:Y,ImagePreview:Z},mixins:[K,H],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},required(){return P(this.$store.state.grokvideo?.config?.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},methods:{onExceed(){R.warning(this.$t(`grokvideo.message.uploadExceed`))},onError(){R.error(this.$t(`grokvideo.message.uploadError`))},onSetImageUrl(){let e=this.urls?.[0];this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,image_url:e||void 0})},async onSuccess(){this.onSetImageUrl()},async onRemove(){this.onSetImageUrl()}}}),tt={class:`relative`},nt={class:`flex justify-between`},rt={class:`flex justify-start items-center`},it={class:`text-sm font-bold`},at={key:0,class:`required-badge`};function ot(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 g(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`span`,it,i(t.$t(`grokvideo.name.image`)),1),t.required?(g(),s(`span`,at,i(t.$t(`grokvideo.name.required`)),1)):o(``,!0),a(h,{content:t.$t(`grokvideo.description.image`)},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(`grokvideo.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])}var st=L(et,[[`render`,ot],[`__scopeId`,`data-v-164e5a1d`]]),ct=4,lt=v({name:`GrokVideoReferenceImagesInput`,components:{ElUpload:x,ElButton:V,InfoIcon:Q,ImagePreview:Z,FontAwesomeIcon:Y},mixins:[K,H],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`,limit:ct,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)||[]},value(){return this.$store.state.grokvideo?.config?.reference_image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetReferenceImages()},onExceed(){R.warning(this.$t(`grokvideo.message.uploadReferenceExceed`))},onError(){R.error(this.$t(`grokvideo.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,reference_image_urls:e.length?e:void 0}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetReferenceImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetReferenceImages()}}}),ut={class:`field flex items-center justify-between`},dt={class:`title font-bold text-[14px] mb-[10px]`},ft={class:`upload-wrapper flex flex-col items-start gap-[8px]`},pt={class:`controls flex items-center`},mt={class:`file-list flex flex-wrap gap-[10px]`};function ht(t,n,o,u,d,m){let _=l(`font-awesome-icon`),v=l(`el-button`),y=l(`el-upload`),b=l(`info-icon`),x=l(`image-preview`);return g(),s(c,null,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`grokvideo.name.referenceImages`)),1),e(`div`,ft,[e(`div`,pt,[a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value`,limit:t.limit,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(v,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(_,{icon:`fa-solid fa-upload`,class:`mr-1`}),r(` `+i(t.$t(`grokvideo.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`]),a(b,{content:t.$t(`grokvideo.description.referenceImages`),class:`ml-2`},null,8,[`content`])])])]),e(`div`,mt,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])],64)}var gt=v({name:`GrokVideoConfigPanel`,components:{ElButton:V,FontAwesomeIcon:Y,PromptInput:xe,ModelSelector:Oe,DurationSelector:Fe,ResolutionSelector:Ue,RatioSelector:$e,ImageInput:st,ReferenceImagesInput:L(lt,[[`render`,ht]]),Consumption:ae},emits:[`generate`],computed:{config(){return this.$store.state.grokvideo?.config},supportsReferenceImages(){return!P(this.$store.state.grokvideo?.config?.model)},consumption(){return W(this.config,this.service?.cost)},service(){return this.$store.state.grokvideo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),_t={class:`flex flex-col h-full`},vt={class:`flex-1 overflow-y-auto p-5`},yt={class:`flex flex-col items-center justify-center px-5 pb-5`};function bt(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`model-selector`),v=l(`ratio-selector`),y=l(`resolution-selector`),b=l(`duration-selector`),x=l(`image-input`),S=l(`reference-images-input`),C=l(`consumption`),w=l(`font-awesome-icon`),T=l(`el-button`);return g(),s(`div`,_t,[e(`div`,vt,[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-2`}),t.supportsReferenceImages?(g(),f(S,{key:0,class:`mb-2`})):o(``,!0)]),e(`div`,yt,[a(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`grokvideo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var xt=L(gt,[[`render`,bt]]),St=v({name:`GrokVideoTaskPreview`,components:{ElImage:C,CopyToClipboard:X,FontAwesomeIcon:Y,ElAlert:w,VideoPlayer:le,ElTooltip:S,ElButton:V,ImagePreview:Z,ApiCodeButton:ue},props:{modelValue:{type:Object,required:!0}},data(){return{grokVideoLogo:M,nowTs:Date.now(),timer:0}},computed:{video(){return this.modelValue?.response?.data?.[0]},inputImage(){return this.modelValue?.request?.image_url},pendingElapsed(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(e)return Math.max(0,Math.floor(this.nowTs/1e3-e))}},watch:{"modelValue.response":{handler(e){e&&this.stopTimer()}}},mounted(){this.modelValue?.response||(this.timer=window.setInterval(()=>{this.nowTs=Date.now()},1e3))},beforeUnmount(){this.stopTimer()},methods:{stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),Ct={class:`preview`},wt={class:`left`},Tt={class:`main`},Et={class:`bot`},Dt={class:`datetime`},Ot={class:`info`},kt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},At={key:1,class:`prompt mt-2`},jt={key:0},Mt={key:1},Nt={key:0,class:n({content:!0})},Pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},It={key:1,class:n({content:!0})},Lt={key:0,class:`mb-4`},Rt={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},zt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Bt={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`},Vt={key:0},Ht={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ut={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Gt={key:2,class:n({content:!0})},Kt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Yt={key:3,class:n({content:!0})},Xt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Zt(n,c,u,d,f,m){let h=l(`el-image`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`copy-to-clipboard`),b=l(`el-alert`),x=l(`video-player`),S=l(`el-button`),C=l(`el-tooltip`),w=l(`api-code-button`);return g(),s(`div`,Ct,[e(`div`,wt,[a(h,{src:n.grokVideoLogo,class:`avatar`},null,8,[`src`])]),e(`div`,Tt,[e(`div`,Et,[r(i(n.$t(`grokvideo.name.bot`))+` `,1),e(`span`,Dt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Ot,[n.inputImage?(g(),s(`div`,kt,[a(_,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,At,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,Mt,` - (`+i(n.$t(`grokvideo.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,jt,` - (`+i(n.$t(`grokvideo.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,It,[n.video?.video_url?(g(),s(`div`,Lt,[a(x,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Rt,[a(C,{class:`box-item`,effect:`dark`,content:n.$t(`grokvideo.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(S,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`grokvideo.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(w,{path:`/grok/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(b,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,zt,[a(v,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.video?.duration?(g(),s(`p`,Bt,[a(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.duration`))+`: `+i(n.video?.duration)+`s `,1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,$,[a(v,{icon:`fa-solid fa-expand`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,Vt,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,Ht,[a(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(y,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,Ut,[a(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Wt,[a(v,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(y,{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`,Gt,[a(b,{closable:!1,class:`failure`},{template:p(()=>[a(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.failure`)),1)]),default:p(()=>[e(`p`,Kt,[a(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(y,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,qt,[a(v,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(y,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Jt,[a(v,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(y,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Yt,[a(b,{closable:!1,class:`info`},{template:p(()=>[a(v,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.status`)),1)]),default:p(()=>[e(`p`,Xt,[a(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(y,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})])):(g(),s(`div`,Nt,[a(b,{closable:!1,class:`info`},{template:p(()=>[a(v,{icon:`fa-regular fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.status.pending`)),1)]),default:p(()=>[e(`p`,Pt,[a(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(y,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.pendingElapsed===void 0?o(``,!0):(g(),s(`p`,Ft,[a(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var Qt=v({name:`GrokVideoRecentPanel`,components:{TaskPreview:L(St,[[`render`,Zt],[`__scopeId`,`data-v-48f65a64`]]),BotPlaceholder:de,NoTasks:se,ScrollList:oe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.grokvideo?.tasks,items:this.$store.state.grokvideo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),$t={key:0},en={key:2,class:`w-full h-full flex items-center justify-center`};function tn(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`,$t,[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`,en,[a(v)])):o(``,!0)],64)}var nn=v({name:`GrokVideoIndex`,components:{ConfigPanel:xt,Layout:ve,RecentPanel:L(Qt,[[`render`,tn]])},mixins:[G],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.grokvideo?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.grokvideo?.status?.getTasks===J.Request||this.fetchingTasks},credential(){return this.$store.state.grokvideo?.credential},config(){return this.$store.state.grokvideo?.config},tasks(){return this.$store.state.grokvideo?.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 ce({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(`grokvideo/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(`grokvideo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!U(this.uploadTracker,e=>this.$t(e),e=>R.warning(e)))return;let e={...this.config||{}};typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),typeof e?.image_url==`string`&&!e.image_url.trim()&&delete e.image_url,(P(e?.model)||!(Array.isArray(e?.reference_image_urls)&&e.reference_image_urls.length))&&delete e.reference_image_urls;let t=!!e?.image_url;if(P(e?.model)&&!t){R.warning(this.$t(`grokvideo.message.modelRequiresImage`));return}if(!t&&!e?.prompt){R.warning(this.$t(`grokvideo.message.promptOrImageRequired`));return}let n={...e,async:!0};if(!q())return;let r=this.credential?.token;if(!r){console.error(`no token specified`);return}R.info(this.$t(`grokvideo.message.startingTask`)),z(`grokvideo`,I.generate(n,{token:r})).then(()=>{R.success(this.$t(`grokvideo.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?R.error(this.$t(`grokvideo.message.usedUp`)):R.error(this.$t(`grokvideo.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function rn(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 an=L(nn,[[`render`,rn]]);export{an 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-5RrKVJWv.js";import{t as x}from"./upload-DOtR0Rsx.js";import{t as S}from"./tooltip-DqZhkwOE.js";import{t as C}from"./image-DXnc07fB.js";import{t as w}from"./alert-MxWa3YPt.js";import{t as T}from"./drawer-Ch5GZZ3O.js";import{At as ee,Bt as E,Ft as D,Ht as O,It as k,Lt as A,Mt as j,Nt as M,Pt as N,Rt as te,Ut as P,jt as ne,kt as re,zt as F}from"./constants-DTWXEulJ.js";import{Bn as I,G as L,Ni as R,Nr as z,Si as B,Wi as V,an as H,in as U,ln as W,on as G,sn as K,vn as q,yi as J}from"./index-hUqJzTZs.js";import{t as Y}from"./index.es-C9USprIb.js";import{t as X}from"./CopyToClipboard-CRx3WmAz.js";import{t as Z}from"./ImagePreview-BA-2TVGQ.js";import{n as ie}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ae}from"./Consumption-DZ2G5VjX.js";import{a as Q,n as oe,r as se,t as ce}from"./pagination-CYLX-yRi.js";import{t as le}from"./VideoPlayer-DJv7Is_7.js";import{t as ue}from"./ApiCodeButton-QA7sAoU5.js";import{t as de}from"./BotPlaceholder-CKfXLBVh.js";import{t as fe}from"./PromptTextarea-DfytCmfP.js";var pe=v({name:`LayoutGrokVideo`,components:{ElDrawer:T,ElButton:V,FontAwesomeIcon:Y},mixins:[ie]}),me={class:`main flex flex-row flex-1`},he={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ge={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function _e(t,n,r,i,o,c){let f=l(`font-awesome-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,me,[e(`div`,he,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ge,[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 ve=L(pe,[[`render`,_e],[`__scopeId`,`data-v-76ddc288`]]),ye=v({name:`GrokVideoPromptInput`,components:{PromptTextarea:fe},computed:{prompt:{get(){return this.$store.state.grokvideo?.config?.prompt},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function be(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(`grokvideo.name.prompt`),info:e.$t(`grokvideo.description.prompt`),placeholder:e.$t(`grokvideo.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var xe=L(ye,[[`render`,be]]),Se=v({name:`GrokVideoModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Q},data(){return{options:[{value:D,label:this.$t(`grokvideo.model.default`)},{value:N,label:this.$t(`grokvideo.model.preview15`)}]}},computed:{value:{get(){return this.$store.state.grokvideo?.config?.model},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,model:e})}}},mounted(){this.value||=re}}),Ce={class:`field`},we={class:`label`},Te={class:`box`},Ee={class:`title font-bold`};function De(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Ce,[e(`div`,we,[e(`div`,Te,[e(`h2`,Ee,i(t.$t(`grokvideo.name.model`)),1),a(m,{content:t.$t(`grokvideo.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(`grokvideo.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 Oe=L(Se,[[`render`,De],[`__scopeId`,`data-v-291d93fb`]]),ke=v({name:`GrokVideoDurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Q},computed:{model(){return this.$store.state.grokvideo?.config?.model},maxDuration(){return O(this.model)},options(){return j.filter(e=>e<=this.maxDuration).map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.grokvideo?.config?.duration},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,duration:e})}}},watch:{maxDuration(e){this.value&&this.value>e&&(this.value=e)}},mounted(){this.value||=8}}),Ae={class:`field`},je={class:`label`},Me={class:`box`},Ne={class:`title font-bold`};function Pe(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,Ae,[e(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(t.$t(`grokvideo.name.duration`)),1),a(m,{content:t.$t(`grokvideo.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(`grokvideo.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 Fe=L(ke,[[`render`,Pe],[`__scopeId`,`data-v-9c711686`]]),Ie=v({name:`GrokVideoResolutionSelector`,components:{InfoIcon:Q},data(){return{options:[{value:F,label:`480p`},{value:E,label:`720p`},{value:te,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.grokvideo?.config?.resolution},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,resolution:e})}}},mounted(){this.value||=ne}}),Le={class:`resolution`},Re={class:`header`},ze={class:`title font-bold`},Be={class:`items`},Ve=[`onClick`];function He(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Le,[e(`div`,Re,[e(`h2`,ze,i(t.$t(`grokvideo.name.resolution`)),1),a(p,{content:t.$t(`grokvideo.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,Be,[(g(!0),s(c,null,h(t.options,e=>(g(),s(`div`,{key:e.value,class:n([`item`,{active:t.value===e.value}]),onClick:n=>t.value=e.value},i(e.label),11,Ve))),128))])])}var Ue=L(Ie,[[`render`,He],[`__scopeId`,`data-v-54f22a22`]]),We=v({name:`GrokVideoRatioSelector`,components:{InfoIcon:Q},computed:{options(){return[{value:k,label:`16:9`,w:32,h:18},{value:A,label:`9:16`,w:18,h:32},{value:`1:1`,label:`1:1`,w:24,h:24},{value:`4:3`,label:`4:3`,w:28,h:21},{value:`3:4`,label:`3:4`,w:21,h:28},{value:`3:2`,label:`3:2`,w:30,h:20},{value:`2:3`,label:`2:3`,w:20,h:30}]},value:{get(){return this.$store.state.grokvideo?.config?.aspect_ratio},set(e){this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,aspect_ratio:e})}}},mounted(){this.value||=ee}}),Ge={class:`ratio`},Ke={class:`header`},qe={class:`title font-bold`},Je={class:`items`},Ye=[`onClick`],Xe={class:`preview`},Ze={class:`name`};function Qe(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ge,[e(`div`,Ke,[e(`h2`,qe,i(t.$t(`grokvideo.name.ratio`)),1),a(p,{content:t.$t(`grokvideo.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,Je,[(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`,Xe,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,Ze,i(r.label),1)],10,Ye))),128))])])}var $e=L(We,[[`render`,Qe],[`__scopeId`,`data-v-70115284`]]),et=v({name:`GrokVideoImageInput`,components:{ElUpload:x,ElButton:V,InfoIcon:Q,FontAwesomeIcon:Y,ImagePreview:Z},mixins:[K,H],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},required(){return P(this.$store.state.grokvideo?.config?.model)},urls(){return this.fileList.map(e=>e?.response?.file_url)}},methods:{onExceed(){R.warning(this.$t(`grokvideo.message.uploadExceed`))},onError(){R.error(this.$t(`grokvideo.message.uploadError`))},onSetImageUrl(){let e=this.urls?.[0];this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,image_url:e||void 0})},async onSuccess(){this.onSetImageUrl()},async onRemove(){this.onSetImageUrl()}}}),tt={class:`relative`},nt={class:`flex justify-between`},rt={class:`flex justify-start items-center`},it={class:`text-sm font-bold`},at={key:0,class:`required-badge`};function ot(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 g(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`span`,it,i(t.$t(`grokvideo.name.image`)),1),t.required?(g(),s(`span`,at,i(t.$t(`grokvideo.name.required`)),1)):o(``,!0),a(h,{content:t.$t(`grokvideo.description.image`)},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(`grokvideo.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-remove`,`headers`])])}var st=L(et,[[`render`,ot],[`__scopeId`,`data-v-164e5a1d`]]),ct=4,lt=v({name:`GrokVideoReferenceImagesInput`,components:{ElUpload:x,ElButton:V,InfoIcon:Q,ImagePreview:Z,FontAwesomeIcon:Y},mixins:[K,H],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`,limit:ct,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)||[]},value(){return this.$store.state.grokvideo?.config?.reference_image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetReferenceImages()},onExceed(){R.warning(this.$t(`grokvideo.message.uploadReferenceExceed`))},onError(){R.error(this.$t(`grokvideo.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`grokvideo/setConfig`,{...this.$store.state.grokvideo?.config,reference_image_urls:e.length?e:void 0}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetReferenceImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetReferenceImages()}}}),ut={class:`field flex items-center justify-between`},dt={class:`title font-bold text-[14px] mb-[10px]`},ft={class:`upload-wrapper flex flex-col items-start gap-[8px]`},pt={class:`controls flex items-center`},mt={class:`file-list flex flex-wrap gap-[10px]`};function ht(t,n,o,u,d,m){let _=l(`font-awesome-icon`),v=l(`el-button`),y=l(`el-upload`),b=l(`info-icon`),x=l(`image-preview`);return g(),s(c,null,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`grokvideo.name.referenceImages`)),1),e(`div`,ft,[e(`div`,pt,[a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value`,limit:t.limit,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(v,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(_,{icon:`fa-solid fa-upload`,class:`mr-1`}),r(` `+i(t.$t(`grokvideo.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`]),a(b,{content:t.$t(`grokvideo.description.referenceImages`),class:`ml-2`},null,8,[`content`])])])]),e(`div`,mt,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])],64)}var gt=v({name:`GrokVideoConfigPanel`,components:{ElButton:V,FontAwesomeIcon:Y,PromptInput:xe,ModelSelector:Oe,DurationSelector:Fe,ResolutionSelector:Ue,RatioSelector:$e,ImageInput:st,ReferenceImagesInput:L(lt,[[`render`,ht]]),Consumption:ae},emits:[`generate`],computed:{config(){return this.$store.state.grokvideo?.config},supportsReferenceImages(){return!P(this.$store.state.grokvideo?.config?.model)},consumption(){return W(this.config,this.service?.cost)},service(){return this.$store.state.grokvideo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),_t={class:`flex flex-col h-full`},vt={class:`flex-1 overflow-y-auto p-5`},yt={class:`flex flex-col items-center justify-center px-5 pb-5`};function bt(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`model-selector`),v=l(`ratio-selector`),y=l(`resolution-selector`),b=l(`duration-selector`),x=l(`image-input`),S=l(`reference-images-input`),C=l(`consumption`),w=l(`font-awesome-icon`),T=l(`el-button`);return g(),s(`div`,_t,[e(`div`,vt,[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-2`}),t.supportsReferenceImages?(g(),f(S,{key:0,class:`mb-2`})):o(``,!0)]),e(`div`,yt,[a(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(t.$t(`grokvideo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var xt=L(gt,[[`render`,bt]]),St=v({name:`GrokVideoTaskPreview`,components:{ElImage:C,CopyToClipboard:X,FontAwesomeIcon:Y,ElAlert:w,VideoPlayer:le,ElTooltip:S,ElButton:V,ImagePreview:Z,ApiCodeButton:ue},props:{modelValue:{type:Object,required:!0}},data(){return{grokVideoLogo:M,nowTs:Date.now(),timer:0}},computed:{video(){return this.modelValue?.response?.data?.[0]},inputImage(){return this.modelValue?.request?.image_url},pendingElapsed(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(e)return Math.max(0,Math.floor(this.nowTs/1e3-e))}},watch:{"modelValue.response":{handler(e){e&&this.stopTimer()}}},mounted(){this.modelValue?.response||(this.timer=window.setInterval(()=>{this.nowTs=Date.now()},1e3))},beforeUnmount(){this.stopTimer()},methods:{stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),Ct={class:`preview`},wt={class:`left`},Tt={class:`main`},Et={class:`bot`},Dt={class:`datetime`},Ot={class:`info`},kt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},At={key:1,class:`prompt mt-2`},jt={key:0},Mt={key:1},Nt={key:0,class:n({content:!0})},Pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},It={key:1,class:n({content:!0})},Lt={key:0,class:`mb-4`},Rt={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},zt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Bt={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`},Vt={key:0},Ht={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ut={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Gt={key:2,class:n({content:!0})},Kt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Yt={key:3,class:n({content:!0})},Xt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Zt(n,c,u,d,f,m){let h=l(`el-image`),_=l(`image-preview`),v=l(`font-awesome-icon`),y=l(`copy-to-clipboard`),b=l(`el-alert`),x=l(`video-player`),S=l(`el-button`),C=l(`el-tooltip`),w=l(`api-code-button`);return g(),s(`div`,Ct,[e(`div`,wt,[a(h,{src:n.grokVideoLogo,class:`avatar`},null,8,[`src`])]),e(`div`,Tt,[e(`div`,Et,[r(i(n.$t(`grokvideo.name.bot`))+` `,1),e(`span`,Dt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Ot,[n.inputImage?(g(),s(`div`,kt,[a(_,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,At,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,Mt,` - (`+i(n.$t(`grokvideo.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,jt,` - (`+i(n.$t(`grokvideo.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,It,[n.video?.video_url?(g(),s(`div`,Lt,[a(x,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Rt,[a(C,{class:`box-item`,effect:`dark`,content:n.$t(`grokvideo.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(S,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`grokvideo.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(w,{path:`/grok/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(b,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,zt,[a(v,{icon:`fa-solid fa-cube`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.video?.duration?(g(),s(`p`,Bt,[a(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.duration`))+`: `+i(n.video?.duration)+`s `,1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,$,[a(v,{icon:`fa-solid fa-expand`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,Vt,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,Ht,[a(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(y,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,Ut,[a(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Wt,[a(v,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(y,{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`,Gt,[a(b,{closable:!1,class:`failure`},{template:p(()=>[a(v,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.failure`)),1)]),default:p(()=>[e(`p`,Kt,[a(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(y,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,qt,[a(v,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(y,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Jt,[a(v,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(y,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Yt,[a(b,{closable:!1,class:`info`},{template:p(()=>[a(v,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.status`)),1)]),default:p(()=>[e(`p`,Xt,[a(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(y,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})])):(g(),s(`div`,Nt,[a(b,{closable:!1,class:`info`},{template:p(()=>[a(v,{icon:`fa-regular fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.status.pending`)),1)]),default:p(()=>[e(`p`,Pt,[a(v,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(y,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.pendingElapsed===void 0?o(``,!0):(g(),s(`p`,Ft,[a(v,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(n.$t(`grokvideo.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var Qt=v({name:`GrokVideoRecentPanel`,components:{TaskPreview:L(St,[[`render`,Zt],[`__scopeId`,`data-v-48f65a64`]]),BotPlaceholder:de,NoTasks:se,ScrollList:oe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.grokvideo?.tasks,items:this.$store.state.grokvideo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),$t={key:0},en={key:2,class:`w-full h-full flex items-center justify-center`};function tn(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`,$t,[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`,en,[a(v)])):o(``,!0)],64)}var nn=v({name:`GrokVideoIndex`,components:{ConfigPanel:xt,Layout:ve,RecentPanel:L(Qt,[[`render`,tn]])},mixins:[G],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.grokvideo?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.grokvideo?.status?.getTasks===J.Request||this.fetchingTasks},credential(){return this.$store.state.grokvideo?.credential},config(){return this.$store.state.grokvideo?.config},tasks(){return this.$store.state.grokvideo?.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 ce({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(`grokvideo/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(`grokvideo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!U(this.uploadTracker,e=>this.$t(e),e=>R.warning(e)))return;let e={...this.config||{}};typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),typeof e?.image_url==`string`&&!e.image_url.trim()&&delete e.image_url,(P(e?.model)||!(Array.isArray(e?.reference_image_urls)&&e.reference_image_urls.length))&&delete e.reference_image_urls;let t=!!e?.image_url;if(P(e?.model)&&!t){R.warning(this.$t(`grokvideo.message.modelRequiresImage`));return}if(!t&&!e?.prompt){R.warning(this.$t(`grokvideo.message.promptOrImageRequired`));return}let n={...e,async:!0};if(!q())return;let r=this.credential?.token;if(!r){console.error(`no token specified`);return}R.info(this.$t(`grokvideo.message.startingTask`)),z(`grokvideo`,I.generate(n,{token:r})).then(()=>{R.success(this.$t(`grokvideo.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?R.error(this.$t(`grokvideo.message.usedUp`)):R.error(this.$t(`grokvideo.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function rn(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 an=L(nn,[[`render`,rn]]);export{an 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-DC7S5Jnc.js";import{n as b,t as x}from"./tabs-B1tsE3l8.js";import{t as S}from"./upload-kOgU3Xy2.js";import{t as C}from"./tooltip-DNVwZYm2.js";import{t as w}from"./image-CnOusUI9.js";import{t as T}from"./alert-C0fuFz2o.js";import{t as E}from"./drawer-BQJOy8jC.js";import{t as D}from"./switch-Bm7Qvmc8.js";import{$r as O,ei as k,ti as A}from"./constants-DTWXEulJ.js";import{G as j,Ni as M,Nr as N,Si as P,Wi as F,an as ee,ar as te,in as ne,ln as re,on as I,sn as L,vn as R,yi as z}from"./index-RwM70L92.js";import{t as B}from"./index.es-DZYx0kkW.js";import{t as V}from"./CopyToClipboard-DbdtulPr.js";import{t as H}from"./ImagePreview-K_WaZ_Rh.js";import{n as U}from"./taskDrawerMixin-DyAUhFEq.js";import{t as W}from"./Consumption-DoSivvh_.js";import{a as G,n as K,r as q,t as J}from"./pagination-CQE4a_fG.js";import{t as Y}from"./VideoPlayer-B0FgVrbH.js";import{t as X}from"./ApiCodeButton-mADYjD5b.js";import{t as ie}from"./BotPlaceholder-D6oZRzf4.js";import{t as ae}from"./PromptTextarea-nY94k6uT.js";var oe=_({name:`LayoutVeo`,components:{ElDrawer:E,ElButton:F,FontAwesomeIcon:B},mixins:[U]}),se={class:`main flex flex-row flex-1`},ce={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},le={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ue(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,se,[e(`div`,ce,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,le,[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 de=j(oe,[[`render`,ue],[`__scopeId`,`data-v-12b82bc3`]]),Z=`veo31-fast-ingredients`,fe=[{value:`veo31-fast`,label:`Veo 3.1 Fast`},{value:`veo3-fast`,label:`Veo 3 Fast`},{value:`veo31`,label:`Veo 3.1`},{value:`veo3`,label:`Veo 3`}],Q=(e,t)=>{let n=!!(e?.action&&e.action!==t),r={...e,action:t};return t===`text2video`?(r.model=r.model===`veo31-fast-ingredients`?A:r.model||`veo31-fast`,delete r.image_urls,r):t===`ingredients2video`?(r.model=Z,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,3),r):(r.model=r.model===`veo31-fast-ingredients`?A:r.model||`veo31-fast`,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,2),r)},pe=e=>{let t={...Q(e,e?.action||`text2video`),async:!0};return t.image_urls?.length||delete t.image_urls,t},me=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},computed:{isModelLocked(){return this.$store.state.veo?.config?.action===`ingredients2video`},options(){return this.isModelLocked?[{value:Z,label:`Veo 3.1 Fast`}]:fe},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||=A}}),he={class:`field`},ge={class:`title font-bold`};function _e(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,he,[e(`h2`,ge,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`),disabled:t.isModelLocked},{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`,`disabled`])])}var ve=j(me,[[`render`,_e],[`__scopeId`,`data-v-90ed8cff`]]),ye=_({name:`ActionSelector`,components:{ElTabs:b,ElTabPane:x},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(){return this.$store.state.veo?.config?.action||`text2video`}},mounted(){this.$store.state.veo?.config?.action||this.onUpdate(O)},methods:{onUpdate(e){this.$store.commit(`veo/setConfig`,Q(this.$store.state.veo?.config,e))}}});function be(e,t,n,r,i,a){let l=c(`el-tab-pane`),u=c(`el-tabs`);return h(),d(u,{"model-value":e.value,class:`action-tabs`,stretch:``,"onUpdate:modelValue":e.onUpdate},{default:f(()=>[(h(!0),o(s,null,m(e.options,e=>(h(),d(l,{key:e.value,name:e.value,label:e.label},null,8,[`name`,`label`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var xe=j(ye,[[`render`,be],[`__scopeId`,`data-v-349937fd`]]),Se=_({name:`TranslationSelector`,components:{ElSwitch:D,InfoIcon:G},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)}}),Ce={class:`relative`},we={class:`flex justify-between`},Te={class:`flex justify-start items-center`},Ee={class:`text-sm font-bold`},De={class:`flex justify-end items-center`};function Oe(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-switch`);return h(),o(`div`,Ce,[e(`div`,we,[e(`div`,Te,[e(`span`,Ee,r(t.$t(`veo.name.translation`)),1),i(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,De,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var ke=j(Se,[[`render`,Oe]]),Ae=_({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||=k}}),je={class:`text-sm font-bold mb-2 block`},Me={class:`items`},Ne=[`onClick`],Pe={class:`name`};function Fe(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,je,r(n.$t(`veo.name.ratio`)),1),e(`div`,Me,[(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`,Pe,r(i.label),1)],10,Ne))),128))])])}var Ie=j(Ae,[[`render`,Fe],[`__scopeId`,`data-v-28c472c4`]]),Le=_({name:`StartEndImage`,components:{ElUpload:S,ElButton:F,InfoIcon:G,FontAwesomeIcon:B,ImagePreview:H},mixins:[L,ee],props:{limit:{type:Number,default:2},ingredients:{type:Boolean,default:!1}},emits:[`change`],data(){return{fileList:[],uploadUrl:P()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},title(){return this.ingredients?this.$t(`veo.button.actionIngredients`):this.$t(`veo.name.startEndImage`)},description(){return this.ingredients?this.$t(`veo.description.imageUrl`):this.$t(`veo.description.uploadStartEndImage`)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(e=>!!e)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},watch:{limit(){this.fileList.length>this.limit&&(this.fileList=this.fileList.slice(0,this.limit),this.onSetStartEndImageUrl())}},mounted(){this.fileList=(this.value||[]).map((e,t)=>({name:`reference-${t+1}`,percentage:100,response:{file_url:e},status:`success`,uid:Date.now()+t,url:e}))},methods:{onExceed(){M.warning(this.$t(`veo.message.uploadReferencesLimit`,{limit:this.limit}))},onError(){M.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()},onRemove(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),this.onSetStartEndImageUrl()}}}),Re={class:`relative`},ze={class:`flex justify-between`},Be={class:`flex justify-start items-center`},Ve={class:`text-sm font-bold`};function He(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`,Re,[e(`div`,ze,[e(`div`,Be,[e(`span`,Ve,r(t.title),1),i(g,{content:t.description},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:t.limit,class:`upload-wrapper`,multiple:!0,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.onRemove(e)},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`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Ue=j(Le,[[`render`,He],[`__scopeId`,`data-v-4f7ed755`]]),We=_({name:`PromptInput`,components:{PromptTextarea:ae},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 Ge(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 Ke=_({name:`ConfigPanel`,components:{ElButton:F,Consumption:W,FontAwesomeIcon:B,PromptInput:j(We,[[`render`,Ge]]),ModelSelector:ve,StartEndImage:Ue,ActionSelector:xe,TranslationSelector:ke,AspectRatioSelector:Ie},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},showsImages(){return this.config?.action===`image2video`||this.config?.action===`ingredients2video`},imageLimit(){return this.config?.action===`ingredients2video`?3:2},consumption(){return re(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),qe={class:`flex flex-col h-full`},Je={class:`flex-1 overflow-y-auto p-5`},Ye={class:`flex flex-col items-center justify-center px-5 pb-5`};function Xe(t,s,l,u,p,m){let g=c(`action-selector`),_=c(`model-selector`),v=c(`start-end-image`),y=c(`prompt-input`),b=c(`aspect-ratio-selector`),x=c(`translation-selector`),S=c(`consumption`),C=c(`font-awesome-icon`),w=c(`el-button`);return h(),o(`div`,qe,[e(`div`,Je,[i(g,{class:`mb-5`}),i(_,{class:`mb-4`}),t.showsImages?(h(),d(v,{key:t.config?.action,class:`mb-4`,limit:t.imageLimit,ingredients:t.config?.action===`ingredients2video`},null,8,[`limit`,`ingredients`])):a(``,!0),i(y,{class:`mb-4`}),i(b,{class:`mb-4`}),i(x,{class:`mb-2`})]),e(`div`,Ye,[i(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(C,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ze=j(Ke,[[`render`,Xe]]),Qe=_({name:`TaskPreview`,components:{ElImage:w,CopyToClipboard:V,FontAwesomeIcon:B,ElAlert:T,VideoPlayer:Y,ImagePreview:H,ElTooltip:C,ElButton:F,ApiCodeButton:X},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{referenceImages(){let e=this.modelValue?.request?.image_urls;return Array.isArray(e)?e.filter(e=>typeof e==`string`&&!!e):[]},actionLabel(){let e=this.modelValue?.request,t=e?.model===`veo31-fast-ingredients`||this.referenceImages.length>2?`ingredients2video`:this.referenceImages.length>0?`image2video`:`text2video`,n=e?.action||t;return this.$t({text2video:`veo.button.action1`,image2video:`veo.button.action2`,ingredients2video:`veo.button.actionIngredients`}[n]||`veo.name.action`)},traceId(){return this.modelValue?.response?.trace_id||this.modelValue?.trace_id},taskInfoClass(){return this.modelValue?.response?.success===!0?`success`:this.modelValue?.response?.success===!1?`failure`:`info`}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),$e={class:`preview`},et={class:`left`},tt={class:`main`},nt={class:`bot`},rt={class:`datetime`},it={class:`info`},at={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},ot={key:1,class:`prompt mt-2`},st={key:0},ct={key:1},lt={key:0,class:t({content:!0,failed:!0})},ut={key:0,class:`mb-4`},dt={key:1,class:t({operations:!0,"mt-2":!0})},ft={key:1,class:t({content:!0})},pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mt={class:t({content:!0})},ht={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_t={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function xt(l,u,p,g,_,v){let y=c(`el-image`),b=c(`image-preview`),x=c(`video-player`),S=c(`el-button`),C=c(`el-tooltip`),w=c(`api-code-button`),T=c(`font-awesome-icon`),E=c(`copy-to-clipboard`),D=c(`el-alert`);return h(),o(`div`,$e,[e(`div`,et,[i(y,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),e(`div`,tt,[e(`div`,nt,[n(r(l.$t(`veo.name.veoBot`))+` `,1),e(`span`,rt,r(l.$dayjs.format(``+new Date(parseFloat((l.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,it,[l.referenceImages.length>0?(h(),o(`div`,at,[(h(!0),o(s,null,m(l.referenceImages,(e,t)=>(h(),d(b,{key:`${t}-${e}`,url:e,name:`reference-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):a(``,!0),l.modelValue?.request?.prompt?(h(),o(`p`,ot,[n(r(l.modelValue?.request?.prompt)+` `,1),l.modelValue?.response?a(``,!0):(h(),o(`span`,st,` - (`+r(l.$t(`veo.status.pending`))+`) `,1)),Array.isArray(l.modelValue?.response?.data)&&l.modelValue?.response?.data[0]?.state===`running`?(h(),o(`span`,ct,` - (`+r(l.$t(`veo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),l.modelValue?.response?.success===!0&&l.modelValue?.response?.data?(h(),o(`div`,lt,[l.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,ut,[i(x,{src:l.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),l.modelValue?.response.success?(h(),o(`div`,dt,[i(C,{class:`box-item`,effect:`dark`,content:l.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:f(()=>[l.modelValue?.response?.data[0]?.video_url?(h(),d(S,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=e=>l.onDownload(e,l.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(l.$t(`veo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(w,{path:`/veo/videos`,body:l.modelValue?.request},null,8,[`body`])])):a(``,!0)])):a(``,!0),l.modelValue?.response?.success===!1?(h(),o(`div`,ft,[i(D,{closable:!1,class:`failure`},{template:f(()=>[i(T,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,pt,[i(T,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.failureReason`))+`: `+r(l.modelValue?.response?.error?.message)+` `,1),i(E,{content:l.modelValue?.response?.error?.message},null,8,[`content`])])]),_:1})])):a(``,!0),e(`div`,mt,[i(D,{closable:!1,class:t([`mt-2`,`task-metadata`,l.taskInfoClass])},{default:f(()=>[l.modelValue?.request?.model?(h(),o(`p`,ht,[i(T,{icon:`fa-solid fa-cube`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.model`))+`: `+r(l.modelValue?.request?.model),1)])):a(``,!0),e(`p`,gt,[i(T,{icon:`fa-solid fa-bolt`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.action`))+`: `+r(l.actionLabel),1)]),l.modelValue?.request?.aspect_ratio?(h(),o(`p`,_t,[i(T,{icon:`fa-solid fa-up-right-from-square`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.ratio`))+`: `+r(l.modelValue?.request?.aspect_ratio),1)])):a(``,!0),l.modelValue?.request?.translation===void 0?a(``,!0):(h(),o(`p`,vt,[i(T,{icon:`fa-solid fa-language`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.translation`))+`: `+r(l.$t(l.modelValue?.request?.translation?`seedance.button.on`:`seedance.button.off`)),1)])),e(`p`,yt,[i(T,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.taskId`))+`: `+r(l.modelValue?.id)+` `,1),i(E,{content:l.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),l.modelValue?.elapsed?(h(),o(`p`,$,[i(T,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.elapsed`))+`: `+r(l.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),l.traceId?(h(),o(`p`,bt,[i(T,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.traceId`))+`: `+r(l.traceId)+` `,1),i(E,{content:l.traceId,class:`btn-copy inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`class`])])])])}var St=_({name:`RecentPanel`,components:{TaskPreview:j(Qe,[[`render`,xt],[`__scopeId`,`data-v-83725cd2`]]),NoTasks:q,BotPlaceholder:ie,ScrollList:K},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?.()}}}),Ct={key:0},wt={key:2,class:`w-full h-full flex items-center justify-center`};function Tt(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`,Ct,[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`,wt,[i(v)])):a(``,!0)],64)}var Et=_({name:`VeoIndex`,components:{ConfigPanel:Ze,Layout:de,RecentPanel:j(St,[[`render`,Tt]])},mixins:[I],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===z.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 J({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(!ne(this.uploadTracker,e=>this.$t(e),e=>M.warning(e)))return;let e=pe(this.config);if(!R())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if((e.action===`image2video`||e.action===`ingredients2video`)&&!(e.image_urls&&e.image_urls.length>0)){M.warning(this.$t(`veo.message.imageRequired`));return}M.info(this.$t(`veo.message.startingTask`)),N(`veo`,te.generate(e,{token:t})).then(()=>{M.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?M.error(this.$t(`veo.message.usedUp`)):M.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Dt(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 Ot=j(Et,[[`render`,Dt]]);export{Ot 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-5RrKVJWv.js";import{n as b,t as x}from"./tabs-CtkBu9RO.js";import{t as S}from"./upload-DOtR0Rsx.js";import{t as C}from"./tooltip-DqZhkwOE.js";import{t as w}from"./image-DXnc07fB.js";import{t as T}from"./alert-MxWa3YPt.js";import{t as E}from"./drawer-Ch5GZZ3O.js";import{t as D}from"./switch-Cx5c7gi6.js";import{$r as O,ei as k,ti as A}from"./constants-DTWXEulJ.js";import{G as j,Ni as M,Nr as N,Si as P,Wi as F,an as ee,ar as te,in as ne,ln as re,on as I,sn as L,vn as R,yi as z}from"./index-hUqJzTZs.js";import{t as B}from"./index.es-C9USprIb.js";import{t as V}from"./CopyToClipboard-CRx3WmAz.js";import{t as H}from"./ImagePreview-BA-2TVGQ.js";import{n as U}from"./taskDrawerMixin-DyAUhFEq.js";import{t as W}from"./Consumption-DZ2G5VjX.js";import{a as G,n as K,r as q,t as J}from"./pagination-CYLX-yRi.js";import{t as Y}from"./VideoPlayer-DJv7Is_7.js";import{t as X}from"./ApiCodeButton-QA7sAoU5.js";import{t as ie}from"./BotPlaceholder-CKfXLBVh.js";import{t as ae}from"./PromptTextarea-DfytCmfP.js";var oe=_({name:`LayoutVeo`,components:{ElDrawer:E,ElButton:F,FontAwesomeIcon:B},mixins:[U]}),se={class:`main flex flex-row flex-1`},ce={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},le={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ue(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,se,[e(`div`,ce,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,le,[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 de=j(oe,[[`render`,ue],[`__scopeId`,`data-v-12b82bc3`]]),Z=`veo31-fast-ingredients`,fe=[{value:`veo31-fast`,label:`Veo 3.1 Fast`},{value:`veo3-fast`,label:`Veo 3 Fast`},{value:`veo31`,label:`Veo 3.1`},{value:`veo3`,label:`Veo 3`}],Q=(e,t)=>{let n=!!(e?.action&&e.action!==t),r={...e,action:t};return t===`text2video`?(r.model=r.model===`veo31-fast-ingredients`?A:r.model||`veo31-fast`,delete r.image_urls,r):t===`ingredients2video`?(r.model=Z,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,3),r):(r.model=r.model===`veo31-fast-ingredients`?A:r.model||`veo31-fast`,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,2),r)},pe=e=>{let t={...Q(e,e?.action||`text2video`),async:!0};return t.image_urls?.length||delete t.image_urls,t},me=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},computed:{isModelLocked(){return this.$store.state.veo?.config?.action===`ingredients2video`},options(){return this.isModelLocked?[{value:Z,label:`Veo 3.1 Fast`}]:fe},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||=A}}),he={class:`field`},ge={class:`title font-bold`};function _e(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,he,[e(`h2`,ge,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`),disabled:t.isModelLocked},{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`,`disabled`])])}var ve=j(me,[[`render`,_e],[`__scopeId`,`data-v-90ed8cff`]]),ye=_({name:`ActionSelector`,components:{ElTabs:b,ElTabPane:x},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(){return this.$store.state.veo?.config?.action||`text2video`}},mounted(){this.$store.state.veo?.config?.action||this.onUpdate(O)},methods:{onUpdate(e){this.$store.commit(`veo/setConfig`,Q(this.$store.state.veo?.config,e))}}});function be(e,t,n,r,i,a){let l=c(`el-tab-pane`),u=c(`el-tabs`);return h(),d(u,{"model-value":e.value,class:`action-tabs`,stretch:``,"onUpdate:modelValue":e.onUpdate},{default:f(()=>[(h(!0),o(s,null,m(e.options,e=>(h(),d(l,{key:e.value,name:e.value,label:e.label},null,8,[`name`,`label`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var xe=j(ye,[[`render`,be],[`__scopeId`,`data-v-349937fd`]]),Se=_({name:`TranslationSelector`,components:{ElSwitch:D,InfoIcon:G},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)}}),Ce={class:`relative`},we={class:`flex justify-between`},Te={class:`flex justify-start items-center`},Ee={class:`text-sm font-bold`},De={class:`flex justify-end items-center`};function Oe(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-switch`);return h(),o(`div`,Ce,[e(`div`,we,[e(`div`,Te,[e(`span`,Ee,r(t.$t(`veo.name.translation`)),1),i(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,De,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var ke=j(Se,[[`render`,Oe]]),Ae=_({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||=k}}),je={class:`text-sm font-bold mb-2 block`},Me={class:`items`},Ne=[`onClick`],Pe={class:`name`};function Fe(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,je,r(n.$t(`veo.name.ratio`)),1),e(`div`,Me,[(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`,Pe,r(i.label),1)],10,Ne))),128))])])}var Ie=j(Ae,[[`render`,Fe],[`__scopeId`,`data-v-28c472c4`]]),Le=_({name:`StartEndImage`,components:{ElUpload:S,ElButton:F,InfoIcon:G,FontAwesomeIcon:B,ImagePreview:H},mixins:[L,ee],props:{limit:{type:Number,default:2},ingredients:{type:Boolean,default:!1}},emits:[`change`],data(){return{fileList:[],uploadUrl:P()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},title(){return this.ingredients?this.$t(`veo.button.actionIngredients`):this.$t(`veo.name.startEndImage`)},description(){return this.ingredients?this.$t(`veo.description.imageUrl`):this.$t(`veo.description.uploadStartEndImage`)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(e=>!!e)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},watch:{limit(){this.fileList.length>this.limit&&(this.fileList=this.fileList.slice(0,this.limit),this.onSetStartEndImageUrl())}},mounted(){this.fileList=(this.value||[]).map((e,t)=>({name:`reference-${t+1}`,percentage:100,response:{file_url:e},status:`success`,uid:Date.now()+t,url:e}))},methods:{onExceed(){M.warning(this.$t(`veo.message.uploadReferencesLimit`,{limit:this.limit}))},onError(){M.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()},onRemove(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),this.onSetStartEndImageUrl()}}}),Re={class:`relative`},ze={class:`flex justify-between`},Be={class:`flex justify-start items-center`},Ve={class:`text-sm font-bold`};function He(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`,Re,[e(`div`,ze,[e(`div`,Be,[e(`span`,Ve,r(t.title),1),i(g,{content:t.description},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:t.limit,class:`upload-wrapper`,multiple:!0,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.onRemove(e)},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`,`limit`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Ue=j(Le,[[`render`,He],[`__scopeId`,`data-v-4f7ed755`]]),We=_({name:`PromptInput`,components:{PromptTextarea:ae},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 Ge(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 Ke=_({name:`ConfigPanel`,components:{ElButton:F,Consumption:W,FontAwesomeIcon:B,PromptInput:j(We,[[`render`,Ge]]),ModelSelector:ve,StartEndImage:Ue,ActionSelector:xe,TranslationSelector:ke,AspectRatioSelector:Ie},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},showsImages(){return this.config?.action===`image2video`||this.config?.action===`ingredients2video`},imageLimit(){return this.config?.action===`ingredients2video`?3:2},consumption(){return re(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),qe={class:`flex flex-col h-full`},Je={class:`flex-1 overflow-y-auto p-5`},Ye={class:`flex flex-col items-center justify-center px-5 pb-5`};function Xe(t,s,l,u,p,m){let g=c(`action-selector`),_=c(`model-selector`),v=c(`start-end-image`),y=c(`prompt-input`),b=c(`aspect-ratio-selector`),x=c(`translation-selector`),S=c(`consumption`),C=c(`font-awesome-icon`),w=c(`el-button`);return h(),o(`div`,qe,[e(`div`,Je,[i(g,{class:`mb-5`}),i(_,{class:`mb-4`}),t.showsImages?(h(),d(v,{key:t.config?.action,class:`mb-4`,limit:t.imageLimit,ingredients:t.config?.action===`ingredients2video`},null,8,[`limit`,`ingredients`])):a(``,!0),i(y,{class:`mb-4`}),i(b,{class:`mb-4`}),i(x,{class:`mb-2`})]),e(`div`,Ye,[i(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(C,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ze=j(Ke,[[`render`,Xe]]),Qe=_({name:`TaskPreview`,components:{ElImage:w,CopyToClipboard:V,FontAwesomeIcon:B,ElAlert:T,VideoPlayer:Y,ImagePreview:H,ElTooltip:C,ElButton:F,ApiCodeButton:X},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{referenceImages(){let e=this.modelValue?.request?.image_urls;return Array.isArray(e)?e.filter(e=>typeof e==`string`&&!!e):[]},actionLabel(){let e=this.modelValue?.request,t=e?.model===`veo31-fast-ingredients`||this.referenceImages.length>2?`ingredients2video`:this.referenceImages.length>0?`image2video`:`text2video`,n=e?.action||t;return this.$t({text2video:`veo.button.action1`,image2video:`veo.button.action2`,ingredients2video:`veo.button.actionIngredients`}[n]||`veo.name.action`)},traceId(){return this.modelValue?.response?.trace_id||this.modelValue?.trace_id},taskInfoClass(){return this.modelValue?.response?.success===!0?`success`:this.modelValue?.response?.success===!1?`failure`:`info`}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),$e={class:`preview`},et={class:`left`},tt={class:`main`},nt={class:`bot`},rt={class:`datetime`},it={class:`info`},at={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},ot={key:1,class:`prompt mt-2`},st={key:0},ct={key:1},lt={key:0,class:t({content:!0,failed:!0})},ut={key:0,class:`mb-4`},dt={key:1,class:t({operations:!0,"mt-2":!0})},ft={key:1,class:t({content:!0})},pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mt={class:t({content:!0})},ht={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_t={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function xt(l,u,p,g,_,v){let y=c(`el-image`),b=c(`image-preview`),x=c(`video-player`),S=c(`el-button`),C=c(`el-tooltip`),w=c(`api-code-button`),T=c(`font-awesome-icon`),E=c(`copy-to-clipboard`),D=c(`el-alert`);return h(),o(`div`,$e,[e(`div`,et,[i(y,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),e(`div`,tt,[e(`div`,nt,[n(r(l.$t(`veo.name.veoBot`))+` `,1),e(`span`,rt,r(l.$dayjs.format(``+new Date(parseFloat((l.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,it,[l.referenceImages.length>0?(h(),o(`div`,at,[(h(!0),o(s,null,m(l.referenceImages,(e,t)=>(h(),d(b,{key:`${t}-${e}`,url:e,name:`reference-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):a(``,!0),l.modelValue?.request?.prompt?(h(),o(`p`,ot,[n(r(l.modelValue?.request?.prompt)+` `,1),l.modelValue?.response?a(``,!0):(h(),o(`span`,st,` - (`+r(l.$t(`veo.status.pending`))+`) `,1)),Array.isArray(l.modelValue?.response?.data)&&l.modelValue?.response?.data[0]?.state===`running`?(h(),o(`span`,ct,` - (`+r(l.$t(`veo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),l.modelValue?.response?.success===!0&&l.modelValue?.response?.data?(h(),o(`div`,lt,[l.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,ut,[i(x,{src:l.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),l.modelValue?.response.success?(h(),o(`div`,dt,[i(C,{class:`box-item`,effect:`dark`,content:l.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:f(()=>[l.modelValue?.response?.data[0]?.video_url?(h(),d(S,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=e=>l.onDownload(e,l.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(l.$t(`veo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(w,{path:`/veo/videos`,body:l.modelValue?.request},null,8,[`body`])])):a(``,!0)])):a(``,!0),l.modelValue?.response?.success===!1?(h(),o(`div`,ft,[i(D,{closable:!1,class:`failure`},{template:f(()=>[i(T,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,pt,[i(T,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.failureReason`))+`: `+r(l.modelValue?.response?.error?.message)+` `,1),i(E,{content:l.modelValue?.response?.error?.message},null,8,[`content`])])]),_:1})])):a(``,!0),e(`div`,mt,[i(D,{closable:!1,class:t([`mt-2`,`task-metadata`,l.taskInfoClass])},{default:f(()=>[l.modelValue?.request?.model?(h(),o(`p`,ht,[i(T,{icon:`fa-solid fa-cube`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.model`))+`: `+r(l.modelValue?.request?.model),1)])):a(``,!0),e(`p`,gt,[i(T,{icon:`fa-solid fa-bolt`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.action`))+`: `+r(l.actionLabel),1)]),l.modelValue?.request?.aspect_ratio?(h(),o(`p`,_t,[i(T,{icon:`fa-solid fa-up-right-from-square`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.ratio`))+`: `+r(l.modelValue?.request?.aspect_ratio),1)])):a(``,!0),l.modelValue?.request?.translation===void 0?a(``,!0):(h(),o(`p`,vt,[i(T,{icon:`fa-solid fa-language`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.translation`))+`: `+r(l.$t(l.modelValue?.request?.translation?`seedance.button.on`:`seedance.button.off`)),1)])),e(`p`,yt,[i(T,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.taskId`))+`: `+r(l.modelValue?.id)+` `,1),i(E,{content:l.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),l.modelValue?.elapsed?(h(),o(`p`,$,[i(T,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.elapsed`))+`: `+r(l.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),l.traceId?(h(),o(`p`,bt,[i(T,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(l.$t(`veo.name.traceId`))+`: `+r(l.traceId)+` `,1),i(E,{content:l.traceId,class:`btn-copy inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`class`])])])])}var St=_({name:`RecentPanel`,components:{TaskPreview:j(Qe,[[`render`,xt],[`__scopeId`,`data-v-83725cd2`]]),NoTasks:q,BotPlaceholder:ie,ScrollList:K},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?.()}}}),Ct={key:0},wt={key:2,class:`w-full h-full flex items-center justify-center`};function Tt(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`,Ct,[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`,wt,[i(v)])):a(``,!0)],64)}var Et=_({name:`VeoIndex`,components:{ConfigPanel:Ze,Layout:de,RecentPanel:j(St,[[`render`,Tt]])},mixins:[I],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===z.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 J({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(!ne(this.uploadTracker,e=>this.$t(e),e=>M.warning(e)))return;let e=pe(this.config);if(!R())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if((e.action===`image2video`||e.action===`ingredients2video`)&&!(e.image_urls&&e.image_urls.length>0)){M.warning(this.$t(`veo.message.imageRequired`));return}M.info(this.$t(`veo.message.startingTask`)),N(`veo`,te.generate(e,{token:t})).then(()=>{M.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?M.error(this.$t(`veo.message.usedUp`)):M.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Dt(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 Ot=j(Et,[[`render`,Dt]]);export{Ot as default};