@acedatacloud/nexior 3.339.1 → 3.340.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/dist/assets/{ApiCodeButton-CAEaiAmy.js → ApiCodeButton-C-xAzxv_.js} +1 -1
  2. package/dist/assets/{Artifacts-CeVvSDP0.js → Artifacts-zbwnCSpQ.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-sqSSzhJQ.js → AskUserQuestionCard-C75XbKgg.js} +1 -1
  4. package/dist/assets/{AudioPreview-1xWagc17.js → AudioPreview-B3vG3-Z8.js} +1 -1
  5. package/dist/assets/{Auth-CLpK0dD2.js → Auth-DKd-Q_Cr.js} +1 -1
  6. package/dist/assets/{Bare-DFxUDXRJ.js → Bare-38T0axZX.js} +1 -1
  7. package/dist/assets/{BotPlaceholder-DXtf3RgL.js → BotPlaceholder-DdR_2tLl.js} +1 -1
  8. package/dist/assets/{BottomFooter-BxPiN_gD.js → BottomFooter-DDNrKz9r.js} +1 -1
  9. package/dist/assets/{Callback-BFt24cX2.js → Callback-wWScM7yd.js} +1 -1
  10. package/dist/assets/{CodeSnippet-DcujJRBt.js → CodeSnippet-BY9wBdKE.js} +1 -1
  11. package/dist/assets/{Console-BZC8UQKM.js → Console-D6fHU-N4.js} +1 -1
  12. package/dist/assets/{Consumption-Bs5sLYKF.js → Consumption-LBlIroNB.js} +1 -1
  13. package/dist/assets/{Conversation-Bhxldky8.js → Conversation-Bne5eJ_V.js} +1 -1
  14. package/dist/assets/{Conversation-D9qb5eq1.js → Conversation-DU00z5ki.js} +1 -1
  15. package/dist/assets/{CopyToClipboard-BFAl8bTh.js → CopyToClipboard-BYSbcBiV.js} +1 -1
  16. package/dist/assets/{Detail-q90X9-iw.js → Detail-BBaCxPGd.js} +2 -2
  17. package/dist/assets/{Extra-DnncYWOv.js → Extra-DpzDHIzt.js} +1 -1
  18. package/dist/assets/{FilePreview-DVrtLCDd.js → FilePreview-CYQ4qHpB.js} +1 -1
  19. package/dist/assets/{Hailuo-DwVVCFc6.js → Hailuo-BTk7CcjH.js} +1 -1
  20. package/dist/assets/{History-VhXVT5Ri.js → History-C4KtLaWO.js} +1 -1
  21. package/dist/assets/{ImagePreview-B-8-QHLl.js → ImagePreview-CLg15kJw.js} +1 -1
  22. package/dist/assets/{ImageWrapper-Cq0Rze0S.js → ImageWrapper-oBMaRLkF.js} +1 -1
  23. package/dist/assets/{Index-iBBq5b-H.js → Index-ASeMO2Cy.js} +1 -1
  24. package/dist/assets/{Index-CNh5lpT0.js → Index-B5WZYm1-.js} +1 -1
  25. package/dist/assets/{Index-BU_N6hdf.js → Index-BLRP4RC6.js} +1 -1
  26. package/dist/assets/{Index-C2yvSL-m.js → Index-BPj1jCbF.js} +1 -1
  27. package/dist/assets/{Index-Dr9FCZry.js → Index-Bl6VXzdp.js} +1 -1
  28. package/dist/assets/{Index-BtoxRrBW.js → Index-BluTv072.js} +1 -1
  29. package/dist/assets/{Index-C7HQAQx0.js → Index-C2dO5CVq.js} +1 -1
  30. package/dist/assets/{Index-D4qAH6tv.js → Index-C9cnMc0m.js} +1 -1
  31. package/dist/assets/{Index-CsxKo59u.js → Index-CCQwsDNL.js} +1 -1
  32. package/dist/assets/{Index-D0Qw7CsR.js → Index-CGUnz6Zm.js} +1 -1
  33. package/dist/assets/{Index-Db5l5p0C.js → Index-CNq1oV1W.js} +1 -1
  34. package/dist/assets/{Index-Prk7aDf62.js → Index-C_hk867L2.js} +1 -1
  35. package/dist/assets/{Index-CouYazwY.js → Index-CbIISmv7.js} +1 -1
  36. package/dist/assets/{Index-dKZ_1Vmy.js → Index-CuiLMivz.js} +1 -1
  37. package/dist/assets/{Index-DQnLquzr.js → Index-CxD9NlTB.js} +1 -1
  38. package/dist/assets/{Index-GVl10MPM.js → Index-D9h0Lpvf.js} +1 -1
  39. package/dist/assets/{Index-DahCxYIA.js → Index-DDcEPNbi.js} +1 -1
  40. package/dist/assets/{Index-DvJHaMxs2.js → Index-DGWJZC2i2.js} +1 -1
  41. package/dist/assets/{Index-B-5DTYT02.js → Index-DOxF4wUj2.js} +1 -1
  42. package/dist/assets/{Index-XqdJjRSF2.js → Index-DUrhQzK02.js} +1 -1
  43. package/dist/assets/{Index-AAuFdEo42.js → Index-Dfas8_v_2.js} +1 -1
  44. package/dist/assets/{Index-HpoTrcNt.js → Index-DnkczVtp.js} +1 -1
  45. package/dist/assets/{Index-ldNsfsdX2.js → Index-Dr-qCoe92.js} +1 -1
  46. package/dist/assets/{Index-AmPwb7AD.js → Index-IbA9pejI.js} +1 -1
  47. package/dist/assets/{Index-BNZxCGhx.js → Index-WTqKsnHZ.js} +1 -1
  48. package/dist/assets/{Index-BfvunBfB2.js → Index-cHi1LAv02.js} +1 -1
  49. package/dist/assets/{Index-DAljqxPY.js → Index-iRgpt4sx.js} +1 -1
  50. package/dist/assets/{Index-D6XL14d6.js → Index-majW19A_.js} +1 -1
  51. package/dist/assets/{Index-D1qOmPM_.js → Index-yKC8liVU.js} +1 -1
  52. package/dist/assets/{Index-vfJNspAE.js → Index-yVNp0Ynh.js} +1 -1
  53. package/dist/assets/{Invitees-665TM0s5.js → Invitees-D37d1ZHA.js} +1 -1
  54. package/dist/assets/{List-KHroAUTw.js → List-BMl2NgDu.js} +1 -1
  55. package/dist/assets/{List-BgjB0xKY.js → List-Dolu6n7f.js} +1 -1
  56. package/dist/assets/{List-DqTl_adN.js → List-f5XU0oCw.js} +1 -1
  57. package/dist/assets/{LocalTools-CNHhBmR2.js → LocalTools-BdlUq-Uq.js} +1 -1
  58. package/dist/assets/{LocalTools-BxPWrX_o.js → LocalTools-BvOBRQh_.js} +1 -1
  59. package/dist/assets/{Main-ESJ9wxSs.js → Main-B8LgzyTC.js} +1 -1
  60. package/dist/assets/{Message-CQ4uC-nx.js → Message-DsiEh50q.js} +1 -1
  61. package/dist/assets/{Model-CF0gOH8z.js → Model-DqABi50P.js} +1 -1
  62. package/dist/assets/{Navigator-CrJK0CV9.js → Navigator-B4PUStBf.js} +3 -3
  63. package/dist/assets/{NotFound-Dm41sIhy.js → NotFound-C1DfMBqD.js} +1 -1
  64. package/dist/assets/{Pay-CRlg9_El.js → Pay-Do7oT5fm.js} +1 -1
  65. package/dist/assets/{Player-Dve4fEFr.js → Player-BTRfcm3L.js} +1 -1
  66. package/dist/assets/{Poivelle-CcB370rv.js → Poivelle-BqAjRjx0.js} +1 -1
  67. package/dist/assets/{PromptTextarea-BZPxXkv4.js → PromptTextarea-D7mWl00Q.js} +1 -1
  68. package/dist/assets/{RealtimeCall-DYokaOQl.js → RealtimeCall-DF2DTERC.js} +1 -1
  69. package/dist/assets/ScheduledTasks-BVCs-z53.js +2 -0
  70. package/dist/assets/ScheduledTasks-tXV5krzi.css +1 -0
  71. package/dist/assets/{Status-C998QLVQ.js → Status-B0Fpw_vV.js} +1 -1
  72. package/dist/assets/{Subscribe-9t8WPpLA.js → Subscribe-B1uiO3rA.js} +1 -1
  73. package/dist/assets/{TabSwitcher-BpSBQKoT.js → TabSwitcher-C78UTwZ9.js} +1 -1
  74. package/dist/assets/{Tts--8DgXoy1.js → Tts-BUAwf2Gi.js} +1 -1
  75. package/dist/assets/{VideoPlayer-A-jVFZal.js → VideoPlayer-oWU2aWMp.js} +1 -1
  76. package/dist/assets/{alert-5xgq51kW.js → alert-C2k9KG3u.js} +1 -1
  77. package/dist/assets/arrow-down-CdMejUmH.js +1 -0
  78. package/dist/assets/{arrow-down-wide-narrow-txkr0d3M.js → arrow-down-wide-narrow-DRLVd4QH.js} +1 -1
  79. package/dist/assets/arrow-left-DdecP7BI.js +1 -0
  80. package/dist/assets/arrow-right-Dq4EYTck.js +1 -0
  81. package/dist/assets/arrow-up-DroHsvlO.js +1 -0
  82. package/dist/assets/{avatar-B1xUOIgl.js → avatar-CSk5fBf7.js} +1 -1
  83. package/dist/assets/{basic-CtX5zW9Q.js → basic-Diz-2wGS.js} +1 -1
  84. package/dist/assets/{box-Dld38dHN.js → box-CXe_r3Gb.js} +1 -1
  85. package/dist/assets/{boxes-C_9jShyH.js → boxes-DtxbNw9r.js} +1 -1
  86. package/dist/assets/{brain-s1r2tuHs.js → brain-yiM-nCmP.js} +1 -1
  87. package/dist/assets/{chart-no-axes-combined-B9t0POMf.js → chart-no-axes-combined-QLUrfplP.js} +1 -1
  88. package/dist/assets/{chat-B5ZWBMJd.js → chat-BKDUzUHK.js} +1 -1
  89. package/dist/assets/{chat-DziWSTCE.js → chat-BYtcpf0F.js} +1 -1
  90. package/dist/assets/{chat-cjvZr8ex.js → chat-Ba2cNuX2.js} +1 -1
  91. package/dist/assets/{chat-BoB027w0.js → chat-BeDLUBt_.js} +1 -1
  92. package/dist/assets/{chat-B7t8Llwu.js → chat-BgfQwQ8d.js} +1 -1
  93. package/dist/assets/{chat-CbjBTBYd.js → chat-BkCNOp8r.js} +1 -1
  94. package/dist/assets/{chat-DZ-gkHzH.js → chat-Buggwc0w.js} +1 -1
  95. package/dist/assets/{chat-DRexpyfS.js → chat-CNEjj4_y.js} +1 -1
  96. package/dist/assets/{chat-ByqmdJEv.js → chat-CpYZ_bQs.js} +1 -1
  97. package/dist/assets/{chat-C4H7V9Nj.js → chat-CqPGhtVC.js} +1 -1
  98. package/dist/assets/{chat-CPFSYEhP.js → chat-D-WtNkx0.js} +1 -1
  99. package/dist/assets/{chat-DR85LVyU.js → chat-DClyl9bx.js} +1 -1
  100. package/dist/assets/{chat-CRNp9Aw-.js → chat-DSOenbOC.js} +1 -1
  101. package/dist/assets/{chat-C37WqESr.js → chat-Djv-9amT.js} +1 -1
  102. package/dist/assets/{chat-CY5idqsd.js → chat-Dk34jsJx.js} +1 -1
  103. package/dist/assets/{chat-aXB6hm9c.js → chat-Sd2ZBGRP.js} +1 -1
  104. package/dist/assets/{chat-D-xVBNhf.js → chat-_ztwiNQ2.js} +1 -1
  105. package/dist/assets/{chat--QU1zv14.js → chat-tDREYcpe.js} +1 -1
  106. package/dist/assets/{chat-DudhYvNh.js → chat-vquaXBBf.js} +1 -1
  107. package/dist/assets/check-D4g2oE6W.js +1 -0
  108. package/dist/assets/chevron-down-t7Zl8MGd.js +1 -0
  109. package/dist/assets/chevron-right-D0pREU0Q.js +1 -0
  110. package/dist/assets/circle-check-Y6b41tjh.js +1 -0
  111. package/dist/assets/clock-Dvb0weei.js +1 -0
  112. package/dist/assets/{codingBridge-BzlNlbAd.js → codingBridge-xxkcfo_E.js} +1 -1
  113. package/dist/assets/{codingBridgeNotify-DXBOXjnB.js → codingBridgeNotify-BrIPXQKA.js} +2 -2
  114. package/dist/assets/{coins-CD-JmYh_.js → coins-DxI7rK1f.js} +1 -1
  115. package/dist/assets/{collapse-C1O30hMQ.js → collapse-xr65xFet.js} +1 -1
  116. package/dist/assets/{constants-BhyBTGQP.js → constants-ChRYidMs.js} +1 -1
  117. package/dist/assets/{copy-CKWKfWRS.js → copy-CcicSm1C.js} +1 -1
  118. package/dist/assets/{createTaskActions-BrAJQ2Ac.js → createTaskActions-Jy5gArl5.js} +1 -1
  119. package/dist/assets/{digitalhuman-dwBoCzG8.js → digitalhuman-D5eDW6WB.js} +1 -1
  120. package/dist/assets/{dollar-sign-DcOwXgvQ.js → dollar-sign-DNPVLXPL.js} +1 -1
  121. package/dist/assets/{download-DMkUvndU.js → download-DY7lrJao.js} +1 -1
  122. package/dist/assets/{drawer-BTvzjggP.js → drawer-CO9biQiP.js} +1 -1
  123. package/dist/assets/{dropdown-DvBID9_9.js → dropdown-Bs21Wm4l.js} +1 -1
  124. package/dist/assets/{dropdown-UjLkG66o.js → dropdown-CXDURjXw.js} +1 -1
  125. package/dist/assets/{ellipsis-DGsG9r55.js → ellipsis-BX08Ubn8.js} +1 -1
  126. package/dist/assets/{esm-167DB-e6.js → esm-B1eINLYT.js} +2 -2
  127. package/dist/assets/esm-BkhzdFGe.js +1 -0
  128. package/dist/assets/{esm-BiM0ukD9.js → esm-CQKAbMol.js} +3 -3
  129. package/dist/assets/{esm-BRm8Ju8w.js → esm-CYpD6s8u.js} +1 -1
  130. package/dist/assets/{esm-CnZU-Nqb.js → esm-Cfsh72Ix.js} +1 -1
  131. package/dist/assets/{esm-aI_tufZB.js → esm-DKvV-epZ.js} +1 -1
  132. package/dist/assets/{esm-DdtQayRE.js → esm-XSdrhTqX.js} +2 -2
  133. package/dist/assets/{external-link-BVclx-1M.js → external-link-D1R5Htf7.js} +1 -1
  134. package/dist/assets/{eye-D2V5CJn0.js → eye-DTFxFkuD.js} +1 -1
  135. package/dist/assets/{file-output-Bt2pSePq.js → file-output-D1cwhatj.js} +1 -1
  136. package/dist/assets/{file-text-C-03J4Hu.js → file-text-gUyzU9QO.js} +1 -1
  137. package/dist/assets/{fish-BQX8BrHH.js → fish-CoePoU5i.js} +1 -1
  138. package/dist/assets/{flux-C3I9LXtR.js → flux-CHDSvUH6.js} +1 -1
  139. package/dist/assets/{folder-rgCZ2_lu.js → folder-_LsVrFuo.js} +1 -1
  140. package/dist/assets/gauge-BFScQvHE.js +1 -0
  141. package/dist/assets/{globe-CTXysuj1.js → globe-DWtf--DZ.js} +1 -1
  142. package/dist/assets/{grokvideo-CuKX2nb-.js → grokvideo-CN8XjUeO.js} +1 -1
  143. package/dist/assets/{hailuo-B6OSiOHC.js → hailuo-BW92PckL.js} +1 -1
  144. package/dist/assets/{headphones-uflWihfZ.js → headphones-DpQXBxp_.js} +1 -1
  145. package/dist/assets/{history-DFDYPVx3.js → history-CeiPxcuA.js} +1 -1
  146. package/dist/assets/{house-DNuHIGnW.js → house-DxMy2mwT.js} +1 -1
  147. package/dist/assets/{i18n-BDF7RW_7.js → i18n-CBsCcxss.js} +1 -1
  148. package/dist/assets/{image-BeAfiyLe.js → image-DD6v12ZV.js} +1 -1
  149. package/dist/assets/{index-CdwgDSbo.js → index-UTshJlN_.js} +4 -4
  150. package/dist/assets/{index.browser.esm-DPD-61nl.js → index.browser.esm-fPZFaDKs.js} +1 -1
  151. package/dist/assets/{index.es-DbF3ZMbu.js → index.es-Y1lq03Wg.js} +1 -1
  152. package/dist/assets/{info-D3YlGBe6.js → info-itWy-wlR.js} +1 -1
  153. package/dist/assets/{input-number-B2gDrKO-.js → input-number-B3DaETfk.js} +1 -1
  154. package/dist/assets/{key-round-Cqz1cHtt.js → key-round-BoKEzmCH.js} +1 -1
  155. package/dist/assets/{kling-Cv8AvVQf.js → kling-BuvemJlx.js} +1 -1
  156. package/dist/assets/{languages-bZVtkOgB.js → languages-DNQkQaEu.js} +1 -1
  157. package/dist/assets/{laptop-DnVQYcTw.js → laptop-CX1cQBjR.js} +1 -1
  158. package/dist/assets/{lightbulb-s2wXOBah.js → lightbulb-CnLFoQK1.js} +1 -1
  159. package/dist/assets/{link-BDohPZD9.js → link-BYg_fN0_.js} +1 -1
  160. package/dist/assets/loader-circle-BPu48p9G.js +1 -0
  161. package/dist/assets/{luma-DP3xlz6w.js → luma-D_lZuyXx.js} +1 -1
  162. package/dist/assets/{maestro-gUmFxiAT.js → maestro-CHc2bCDT.js} +1 -1
  163. package/dist/assets/{maestro-BeTt4NYS.js → maestro-DW068IOv.js} +1 -1
  164. package/dist/assets/{mail-Bn-OVCrN.js → mail-DQ33soL2.js} +1 -1
  165. package/dist/assets/{message-circle-CY8TfhiD.js → message-circle-BA3W6Ihb.js} +1 -1
  166. package/dist/assets/{mic-BbGWd7qF.js → mic-qWwQi2sV.js} +1 -1
  167. package/dist/assets/{midjourney-BANZRKGU.js → midjourney-DtDiHkmf.js} +1 -1
  168. package/dist/assets/{mobileLocalExec-D91XakIY.js → mobileLocalExec-Dia6-lHl.js} +2 -2
  169. package/dist/assets/{mouse-pointer-2-BkcsUzFd.js → mouse-pointer-2-DoU2RkTC.js} +1 -1
  170. package/dist/assets/music-2-CMq_pa5F.js +1 -0
  171. package/dist/assets/{nanobanana-BwhofajI.js → nanobanana-BPcW99dG.js} +1 -1
  172. package/dist/assets/{omni-rzSYXqjd.js → omni-D_hpoIHX.js} +1 -1
  173. package/dist/assets/{openaiimage-DGJhQmTY.js → openaiimage-BBaUa7t8.js} +1 -1
  174. package/dist/assets/{pagination-D3UxAz4H.js → pagination-DNAQQH5X.js} +1 -1
  175. package/dist/assets/{pagination-nJ5-cNtZ.js → pagination-DgHqjd1Q.js} +1 -1
  176. package/dist/assets/{palette-DNVgxlFS.js → palette-rnSbcXIK.js} +1 -1
  177. package/dist/assets/{paperclip-COBsGIOS.js → paperclip-B8wOX_AJ.js} +1 -1
  178. package/dist/assets/{pause-BfdduGMw.js → pause-B2NTr5jC.js} +1 -1
  179. package/dist/assets/{pencil-D65OLO6b.js → pencil-BX9WTBdD.js} +1 -1
  180. package/dist/assets/{pika-eF74JuGK.js → pika-DXqAV3Eh.js} +1 -1
  181. package/dist/assets/{pixverse-BHQCTnvk.js → pixverse-DBANHUli.js} +1 -1
  182. package/dist/assets/play-D7vmY69X.js +1 -0
  183. package/dist/assets/plus-yzUN9lSf.js +1 -0
  184. package/dist/assets/{poivelle-BquKmC2B.js → poivelle-2MKkCrwQ.js} +1 -1
  185. package/dist/assets/{popover-n41EUDXi.js → popover-BN2spHu1.js} +1 -1
  186. package/dist/assets/{producer-CKHbMjAe.js → producer-CC-7E4Jl.js} +1 -1
  187. package/dist/assets/{qrart-BkRyODXx.js → qrart-BuMCSWPh.js} +1 -1
  188. package/dist/assets/{realtime-CWtC9rYd.js → realtime-BywqtRQd.js} +1 -1
  189. package/dist/assets/{refresh-cw-4HOHg9yD.js → refresh-cw-BCygLxe5.js} +1 -1
  190. package/dist/assets/rotate-ccw-erPkLH-9.js +1 -0
  191. package/dist/assets/rotate-cw-Cpx0U_3e.js +1 -0
  192. package/dist/assets/{row-BnNE_GQJ.js → row-Dh7IaRUO.js} +1 -1
  193. package/dist/assets/search-DwECGKvF.js +1 -0
  194. package/dist/assets/{seedance-Be2y6-O1.js → seedance-D9kXcrw_.js} +1 -1
  195. package/dist/assets/{seedream-CeAb-ujk.js → seedream-Cx8pOoEz.js} +1 -1
  196. package/dist/assets/{select-B_wrrcy_.js → select-CdcJAtHh.js} +1 -1
  197. package/dist/assets/{serp-BMaO4eWZ.js → serp-CNuv1YcL.js} +1 -1
  198. package/dist/assets/{shield-xQjox8qL.js → shield-DzMt43CY.js} +1 -1
  199. package/dist/assets/{shuffle-xph8NEEv.js → shuffle-DSdMh3J6.js} +1 -1
  200. package/dist/assets/{slider-bdvUdBPo.js → slider-6SnO3LqD.js} +1 -1
  201. package/dist/assets/{sliders-horizontal-DkYdB_zn.js → sliders-horizontal-Bcoz4J3B.js} +1 -1
  202. package/dist/assets/{solana-wallets-C-itU3vQ.js → solana-wallets-CN1_vErr.js} +2 -2
  203. package/dist/assets/{solana-wallets-vue-DoSfkbAW.js → solana-wallets-vue-BwQv7Qjo.js} +1 -1
  204. package/dist/assets/{sora-fzvm3Y0O.js → sora-3HZ63Vny.js} +1 -1
  205. package/dist/assets/{sparkles-DObz_CRM.js → sparkles-ZFe1iVCz.js} +1 -1
  206. package/dist/assets/square-BiiUNxhO.js +1 -0
  207. package/dist/assets/{suno-C09u8kbF.js → suno-BtCIHDqb.js} +1 -1
  208. package/dist/assets/{switch-8tD8sFwP.js → switch-D6eD8ufY.js} +1 -1
  209. package/dist/assets/{table-BKVx3YpK.js → table-B-LKLpPh.js} +1 -1
  210. package/dist/assets/{tabs-CXdMDWKG.js → tabs-D_L4QB7D.js} +1 -1
  211. package/dist/assets/{tag-B_fZJjGW.js → tag-CuqRoQAt.js} +1 -1
  212. package/dist/assets/{taskDrawerMixin-_P2cdhwz.js → taskDrawerMixin-Brfmzrs4.js} +1 -1
  213. package/dist/assets/terminal-Dhq8mkWS.js +1 -0
  214. package/dist/assets/{time-picker-BWvgHtJ7.js → time-picker-Blm0-B4y.js} +1 -1
  215. package/dist/assets/{tooltip-DHCemFsN.js → tooltip-DiVzh1Gl.js} +1 -1
  216. package/dist/assets/{trash-2-eHkcay3n.js → trash-2-Dg3Af9lM.js} +1 -1
  217. package/dist/assets/{triangle-alert-BX-Sd8Yl.js → triangle-alert-uPbdNKT7.js} +1 -1
  218. package/dist/assets/{upload-DF_BDuGz.js → upload-BUi4Qlhm.js} +1 -1
  219. package/dist/assets/{upload-CMfumvdd.js → upload-DsZRTIWs.js} +1 -1
  220. package/dist/assets/user-DpzHGFlK.js +1 -0
  221. package/dist/assets/{veo-CQGUAe9n.js → veo-BOpYJU4S.js} +1 -1
  222. package/dist/assets/{video-C_ZDjfGA.js → video-DBVjf-QQ.js} +1 -1
  223. package/dist/assets/{volume-2-CjeJoGPc.js → volume-2-CCUckHEB.js} +1 -1
  224. package/dist/assets/{wallet-Dofafzdv.js → wallet-B0RpkMPF.js} +1 -1
  225. package/dist/assets/{wan-Cc35oiPS.js → wan-DT1vgati.js} +1 -1
  226. package/dist/assets/{wand-sparkles-DQT17NWq.js → wand-sparkles-BWwUTBQt.js} +1 -1
  227. package/dist/assets/{web-CYRoQe3O.js → web-BKyu003b.js} +1 -1
  228. package/dist/assets/{web-DVHjVc3O.js → web-BuK2nCfu.js} +1 -1
  229. package/dist/assets/{web-BG5EtEAn.js → web-HHB0_L5E.js} +1 -1
  230. package/dist/assets/{web-GoT6bg5o.js → web-MpMgVi4u.js} +1 -1
  231. package/dist/assets/{web-DN6HIjWE.js → web-p3chRKzh.js} +1 -1
  232. package/dist/assets/{webextrator-DYJjEepW.js → webextrator-CZCTJbjF.js} +1 -1
  233. package/dist/assets/{zap-ByYDLt1v.js → zap-PHJPG_Ms.js} +1 -1
  234. package/dist/index.html +3 -3
  235. package/package.json +1 -1
  236. package/dist/assets/ScheduledTasks-BLYsSIDU.css +0 -1
  237. package/dist/assets/ScheduledTasks-C-MFKurh.js +0 -2
  238. package/dist/assets/arrow-down-C9RI8cGF.js +0 -1
  239. package/dist/assets/arrow-left-OMrvSHVK.js +0 -1
  240. package/dist/assets/arrow-right-m7m_F480.js +0 -1
  241. package/dist/assets/arrow-up-B8tflSi-.js +0 -1
  242. package/dist/assets/check-D5IdKb0R.js +0 -1
  243. package/dist/assets/chevron-down-ClALm8SL.js +0 -1
  244. package/dist/assets/chevron-right-byERPHd-.js +0 -1
  245. package/dist/assets/circle-check-DST4oFAV.js +0 -1
  246. package/dist/assets/clock-DWErYX-e.js +0 -1
  247. package/dist/assets/esm-BrBO1ZOR.js +0 -1
  248. package/dist/assets/gauge-DRwA_Li-.js +0 -1
  249. package/dist/assets/loader-circle-BJg89qfO.js +0 -1
  250. package/dist/assets/music-2-C_N-ULfp.js +0 -1
  251. package/dist/assets/play-BBwTRDiY.js +0 -1
  252. package/dist/assets/plus-Bi1QtlvT.js +0 -1
  253. package/dist/assets/rotate-ccw-C5ouPpCf.js +0 -1
  254. package/dist/assets/rotate-cw-B5gyUJNC.js +0 -1
  255. package/dist/assets/search-DSfabf7k.js +0 -1
  256. package/dist/assets/square-Bw_IHic1.js +0 -1
  257. package/dist/assets/terminal-D-WWGeva.js +0 -1
  258. package/dist/assets/user-CoaGeK8D.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-B_wrrcy_.js";import{t as x}from"./upload-CMfumvdd.js";import{t as S}from"./tooltip-DHCemFsN.js";import{t as C}from"./alert-5xgq51kW.js";import{t as w}from"./drawer-BTvzjggP.js";import{t as T}from"./input-number-B2gDrKO-.js";import{n as E}from"./taskDrawerMixin-_P2cdhwz.js";import{t as D}from"./box-Dld38dHN.js";import{t as O}from"./clock-DWErYX-e.js";import{r as k,t as A}from"./PromptTextarea-BZPxXkv4.js";import{t as j}from"./image-BeAfiyLe.js";import{t as M}from"./info-D3YlGBe6.js";import{t as N}from"./trash-2-eHkcay3n.js";import{t as P}from"./triangle-alert-BX-Sd8Yl.js";import{t as F}from"./upload-DF_BDuGz.js";import{t as I}from"./wand-sparkles-DQT17NWq.js";import{t as ee}from"./zap-ByYDLt1v.js";import{An as L,Cn as R,Dn as te,En as ne,Sn as z,Tn as B,_n as re,bn as V,kn as ie,vn as H,wn as U,xn as W}from"./constants-BhyBTGQP.js";import{Bt as ae,E as G,En as oe,Fi as K,Ht as se,Kt as ce,Ut as le,Vt as ue,Wt as de,ai as q,bi as J,ci as fe,tn as pe,xi as Y,yr as me}from"./index-CdwgDSbo.js";import{t as he}from"./CopyToClipboard-BFAl8bTh.js";import{t as X}from"./ImagePreview-B-8-QHLl.js";import{t as ge}from"./Consumption-Bs5sLYKF.js";import{a as Z,n as _e,r as ve,t as ye}from"./pagination-nJ5-cNtZ.js";import{t as be}from"./ApiCodeButton-CAEaiAmy.js";import{t as xe}from"./BotPlaceholder-DXtf3RgL.js";import{t as Se}from"./ImageWrapper-Cq0Rze0S.js";var Ce=_({name:`LayoutSeedream`,components:{MagicIcon:I,ElDrawer:w,ElButton:K},mixins:[E]}),we={class:`main flex flex-row flex-1`},Te={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ee={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function De(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,we,[e(`div`,Te,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ee,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Oe=G(Ce,[[`render`,De],[`__scopeId`,`data-v-c10167d0`]]),ke=_({name:`SeedreamPromptInput`,components:{PromptTextarea:A},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ae(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var je=G(ke,[[`render`,Ae]]),Me={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case U:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case R:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case z:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case W:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case V:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:H[V],outputFormat:!1,tools:!1};case B:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:H[B],outputFormat:!1,tools:!1};default:return Me}}function Ne(e,t){let n=Q(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Pe=[`1K`,`2K`,`3K`,`4K`];function Fe(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(Pe.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function Ie(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var Le=_({name:`SeedreamImageInput`,components:{UploadIcon:F,ElUpload:x,ElButton:K,InfoIcon:Z,ImagePreview:X},mixins:[de,le,ue],data(){return{fileList:[],uploadUrl:fe()+`/api/v1/files/`,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.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},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.onSetImages()},onExceed(){Y.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){Y.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},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.onSetImages()}}}),Re={key:0},ze={class:`field`},Be={class:`label`},Ve={class:`box`},He={class:`title font-bold`},Ue={class:`value`},We={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ge(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ue,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,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(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,We,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{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))])])):o(``,!0)}var Ke=G(Le,[[`render`,Ge],[`__scopeId`,`data-v-fef518c4`]]),qe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0,options:[{value:U,label:this.$t(`seedream.model.seedream50pro`)},{value:R,label:this.$t(`seedream.model.seedream50`)},{value:z,label:this.$t(`seedream.model.seedream45`)},{value:W,label:this.$t(`seedream.model.seedream40`)},{value:V,label:this.$t(`seedream.model.seedream30t2i`)},{value:B,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(re)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Fe(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await J.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=Ie({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),Y.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Je={class:`field`},Ye={class:`label`},Xe={class:`box`},Ze={class:`title font-bold`};function Qe(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var $e=G(qe,[[`render`,Qe],[`__scopeId`,`data-v-6413c179`]]),et=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:ie,pixelOptions:te}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),tt={class:`field`},nt={class:`label`},rt={class:`box`},it={class:`title font-bold`};function at(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`h2`,it,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var ot=G(et,[[`render`,at],[`__scopeId`,`data-v-dd7bd021`]]),st=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),ct={key:0,class:`field`},lt={class:`label`},ut={class:`box`},dt={class:`title font-bold`},ft={class:`value`};function pt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,ct,[e(`div`,lt,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var mt=G(st,[[`render`,pt],[`__scopeId`,`data-v-f079fd20`]]),ht=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[...ne]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`};function bt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,gt,[e(`div`,_t,[e(`div`,vt,[e(`h2`,yt,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var xt=G(ht,[[`render`,bt],[`__scopeId`,`data-v-69ea4c07`]]),St=_({name:`SeedreamSeedInput`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),Ct={key:0,class:`field`},wt={class:`label`},Tt={class:`box`},Et={class:`title font-bold`},Dt={class:`value`};function Ot(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Ct,[e(`div`,wt,[e(`div`,Tt,[e(`h2`,Et,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Dt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var kt=G(St,[[`render`,Ot],[`__scopeId`,`data-v-10cdc1e0`]]),At=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),jt={key:0,class:`field`},Mt={class:`label`},Nt={class:`box`},Pt={class:`title font-bold`},Ft={class:`value`};function It(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`h2`,Pt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Lt=G(At,[[`render`,It],[`__scopeId`,`data-v-7386f064`]]),$=e=>{let t={...e||{}},n=Ne(t.model,t.image);return delete t.action,t.watermark=!1,(n!==`edit`||!t.image?.length)&&delete t.image,t.size||delete t.size,t.sequential_image_generation!==`auto`&&delete t.sequential_image_generation_options,{...t,async:!0}},Rt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:I,ElButton:K,PromptInput:je,Consumption:ge,ImageInput:Ke,ModelSelector:$e,SizeSelector:ot,MaxImagesSelector:mt,OutputFormatSelector:xt,SeedInput:kt,GuidanceScaleInput:Lt},emits:[`generate`],computed:{action(){return Ne(this.config?.model,this.config?.image)},capabilities(){return Q(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=$(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return ce({...e,action:this.action,model:L(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),zt={class:`flex flex-col h-full`},Bt={class:`flex-1 overflow-y-auto p-5`},Vt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ht(t,n,c,u,d,m){let g=l(`model-selector`),_=l(`size-selector`),v=l(`max-images-selector`),y=l(`output-format-selector`),b=l(`seed-input`),x=l(`guidance-scale-input`),S=l(`prompt-input`),C=l(`image-input`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,zt,[e(`div`,Bt,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),t.capabilities.image?(h(),f(C,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,Vt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(E,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ut=G(Rt,[[`render`,Ht]]),Wt=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:N,ApplicationIcon:D,ChannelIcon:k,ImageIcon:j,InfoIcon:M,LightningIcon:ee,MagicIcon:I,TimeIcon:O,WarningIcon:P,CopyToClipboard:he,ElAlert:C,ImageWrapper:Se,ElButton:K,ElTooltip:S,ImagePreview:X,ApiCodeButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return $(this.modelValue?.request)},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await J.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`seedream/deleteTask`,{id:e}),Y.success(this.$t(`common.message.deleteTaskSuccess`))}catch{Y.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return L(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Gt={class:`preview`},Kt={class:`left`},qt={class:`main`},Jt={class:`bot`},Yt={class:`datetime`},Xt=[`aria-label`],Zt={class:`info`},Qt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},$t={key:1,class:`prompt mt-2`},en={key:0},tn={key:0,class:n({content:!0})},nn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},rn={key:1,class:n({content:!0,failed:!0})},an={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},on={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},pn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bn={key:3,class:n({content:!0})},xn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Cn(u,d,g,_,v,y){let b=l(`capability-presentation`),x=l(`delete-icon`),S=l(`el-tooltip`),C=l(`image-preview`),w=l(`time-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`el-alert`),O=l(`image-wrapper`),k=l(`el-button`),A=l(`api-code-button`),j=l(`application-icon`),M=l(`image-icon`),N=l(`lightning-icon`),P=l(`channel-icon`),F=l(`warning-icon`),I=l(`info-icon`);return h(),s(`div`,Gt,[e(`div`,Kt,[a(b,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,qt,[e(`div`,Jt,[a(b,{capability:`seedream`,part:`name`}),e(`span`,Yt,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1),a(S,{effect:`dark`,content:u.$t(`common.button.delete`),placement:`top`},{default:p(()=>[u.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":u.$t(`common.button.delete`),onClick:d[0]||=t((...e)=>u.onDelete&&u.onDelete(...e),[`stop`])},[a(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Xt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Zt,[Array.isArray(u.modelValue?.request?.image)&&u.modelValue?.request?.image.length>0?(h(),s(`div`,Qt,[(h(!0),s(c,null,m(u.modelValue?.request?.image,(e,t)=>(h(),f(C,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(h(),s(`p`,$t,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(h(),s(`span`,en,` - (`+i(u.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),u.modelValue?.response?u.modelValue?.response?.success===!0?(h(),s(`div`,rn,[e(`div`,an,[(h(!0),s(c,null,m(u.images,(e,t)=>(h(),f(O,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,on,[a(S,{class:`box-item`,effect:`dark`,content:u.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(k,{type:`info`,size:`small`,class:`btn-action`,onClick:d[1]||=t(e=>u.onEdit(u.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(u.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(A,{path:`/seedream/images`,body:u.apiRequest},null,8,[`body`])]),a(D,{closable:!1,class:`mt-2 success`},{default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,sn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,cn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,un,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(h(),s(`p`,dn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,fn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):u.modelValue?.response?.success===!1?(h(),s(`div`,{key:2,class:n({content:!0,"mt-[15px]":!u.modelValue?.request?.prompt})},[a(D,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failure`)),1)]),default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,pn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,mn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,hn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,gn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.error?.message?(h(),s(`p`,_n,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(E,{content:u.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),u.modelValue?.elapsed?(h(),s(`p`,vn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})],2)):(h(),s(`div`,bn,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,xn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,tn,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,nn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var wn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Wt,[[`render`,Cn],[`__scopeId`,`data-v-394e4796`]]),BotPlaceholder:xe,NoTasks:ve,ScrollList:_e},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Tn={key:0},En={key:2,class:`w-full h-full flex items-center justify-center`};function Dn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Tn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{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:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,En,[a(v)])):o(``,!0)],64)}var On=_({name:`SeedreamIndex`,components:{ConfigPanel:Ut,Layout:Oe,RecentPanel:G(wn,[[`render`,Dn]])},mixins:[se],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===q.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.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 ye({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/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.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ae(this.uploadTracker,e=>this.$t(e),e=>Y.warning(e)))return;if(Q(this.config?.model).imageRequired&&!this.config?.image?.length){Y.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=$(this.config);if(!pe())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}Y.info(this.$t(`seedream.message.startingTask`)),me(`seedream`,oe.generate(e,{token:t})).then(()=>{Y.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?Y.error(this.$t(`seedream.message.usedUp`)):Y.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function kn(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var An=G(On,[[`render`,kn]]);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,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-CdcJAtHh.js";import{t as x}from"./upload-DsZRTIWs.js";import{t as S}from"./tooltip-DiVzh1Gl.js";import{t as C}from"./alert-C2k9KG3u.js";import{t as w}from"./drawer-CO9biQiP.js";import{t as T}from"./input-number-B3DaETfk.js";import{n as E}from"./taskDrawerMixin-Brfmzrs4.js";import{t as D}from"./box-CXe_r3Gb.js";import{t as O}from"./clock-Dvb0weei.js";import{r as k,t as A}from"./PromptTextarea-D7mWl00Q.js";import{t as j}from"./image-DD6v12ZV.js";import{t as M}from"./info-itWy-wlR.js";import{t as N}from"./trash-2-Dg3Af9lM.js";import{t as P}from"./triangle-alert-uPbdNKT7.js";import{t as F}from"./upload-BUi4Qlhm.js";import{t as I}from"./wand-sparkles-BWwUTBQt.js";import{t as ee}from"./zap-PHJPG_Ms.js";import{An as L,Cn as R,Dn as te,En as ne,Sn as z,Tn as B,_n as re,bn as V,kn as ie,vn as H,wn as U,xn as W}from"./constants-ChRYidMs.js";import{Bt as ae,E as G,En as oe,Fi as K,Ht as se,Kt as ce,Ut as le,Vt as ue,Wt as de,ai as q,bi as J,ci as fe,tn as pe,xi as Y,yr as me}from"./index-UTshJlN_.js";import{t as he}from"./CopyToClipboard-BYSbcBiV.js";import{t as X}from"./ImagePreview-CLg15kJw.js";import{t as ge}from"./Consumption-LBlIroNB.js";import{a as Z,n as _e,r as ve,t as ye}from"./pagination-DgHqjd1Q.js";import{t as be}from"./ApiCodeButton-C-xAzxv_.js";import{t as xe}from"./BotPlaceholder-DdR_2tLl.js";import{t as Se}from"./ImageWrapper-oBMaRLkF.js";var Ce=_({name:`LayoutSeedream`,components:{MagicIcon:I,ElDrawer:w,ElButton:K},mixins:[E]}),we={class:`main flex flex-row flex-1`},Te={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ee={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function De(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,we,[e(`div`,Te,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ee,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Oe=G(Ce,[[`render`,De],[`__scopeId`,`data-v-c10167d0`]]),ke=_({name:`SeedreamPromptInput`,components:{PromptTextarea:A},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ae(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var je=G(ke,[[`render`,Ae]]),Me={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case U:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case R:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case z:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case W:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case V:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:H[V],outputFormat:!1,tools:!1};case B:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:H[B],outputFormat:!1,tools:!1};default:return Me}}function Ne(e,t){let n=Q(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Pe=[`1K`,`2K`,`3K`,`4K`];function Fe(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(Pe.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function Ie(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var Le=_({name:`SeedreamImageInput`,components:{UploadIcon:F,ElUpload:x,ElButton:K,InfoIcon:Z,ImagePreview:X},mixins:[de,le,ue],data(){return{fileList:[],uploadUrl:fe()+`/api/v1/files/`,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.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},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.onSetImages()},onExceed(){Y.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){Y.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},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.onSetImages()}}}),Re={key:0},ze={class:`field`},Be={class:`label`},Ve={class:`box`},He={class:`title font-bold`},Ue={class:`value`},We={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ge(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ue,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,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(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,We,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{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))])])):o(``,!0)}var Ke=G(Le,[[`render`,Ge],[`__scopeId`,`data-v-fef518c4`]]),qe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0,options:[{value:U,label:this.$t(`seedream.model.seedream50pro`)},{value:R,label:this.$t(`seedream.model.seedream50`)},{value:z,label:this.$t(`seedream.model.seedream45`)},{value:W,label:this.$t(`seedream.model.seedream40`)},{value:V,label:this.$t(`seedream.model.seedream30t2i`)},{value:B,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(re)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Fe(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await J.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=Ie({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),Y.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Je={class:`field`},Ye={class:`label`},Xe={class:`box`},Ze={class:`title font-bold`};function Qe(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var $e=G(qe,[[`render`,Qe],[`__scopeId`,`data-v-6413c179`]]),et=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:ie,pixelOptions:te}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),tt={class:`field`},nt={class:`label`},rt={class:`box`},it={class:`title font-bold`};function at(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`h2`,it,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var ot=G(et,[[`render`,at],[`__scopeId`,`data-v-dd7bd021`]]),st=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),ct={key:0,class:`field`},lt={class:`label`},ut={class:`box`},dt={class:`title font-bold`},ft={class:`value`};function pt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,ct,[e(`div`,lt,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var mt=G(st,[[`render`,pt],[`__scopeId`,`data-v-f079fd20`]]),ht=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[...ne]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`};function bt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,gt,[e(`div`,_t,[e(`div`,vt,[e(`h2`,yt,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var xt=G(ht,[[`render`,bt],[`__scopeId`,`data-v-69ea4c07`]]),St=_({name:`SeedreamSeedInput`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),Ct={key:0,class:`field`},wt={class:`label`},Tt={class:`box`},Et={class:`title font-bold`},Dt={class:`value`};function Ot(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Ct,[e(`div`,wt,[e(`div`,Tt,[e(`h2`,Et,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Dt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var kt=G(St,[[`render`,Ot],[`__scopeId`,`data-v-10cdc1e0`]]),At=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),jt={key:0,class:`field`},Mt={class:`label`},Nt={class:`box`},Pt={class:`title font-bold`},Ft={class:`value`};function It(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`h2`,Pt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Lt=G(At,[[`render`,It],[`__scopeId`,`data-v-7386f064`]]),$=e=>{let t={...e||{}},n=Ne(t.model,t.image);return delete t.action,t.watermark=!1,(n!==`edit`||!t.image?.length)&&delete t.image,t.size||delete t.size,t.sequential_image_generation!==`auto`&&delete t.sequential_image_generation_options,{...t,async:!0}},Rt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:I,ElButton:K,PromptInput:je,Consumption:ge,ImageInput:Ke,ModelSelector:$e,SizeSelector:ot,MaxImagesSelector:mt,OutputFormatSelector:xt,SeedInput:kt,GuidanceScaleInput:Lt},emits:[`generate`],computed:{action(){return Ne(this.config?.model,this.config?.image)},capabilities(){return Q(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=$(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return ce({...e,action:this.action,model:L(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),zt={class:`flex flex-col h-full`},Bt={class:`flex-1 overflow-y-auto p-5`},Vt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ht(t,n,c,u,d,m){let g=l(`model-selector`),_=l(`size-selector`),v=l(`max-images-selector`),y=l(`output-format-selector`),b=l(`seed-input`),x=l(`guidance-scale-input`),S=l(`prompt-input`),C=l(`image-input`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,zt,[e(`div`,Bt,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),t.capabilities.image?(h(),f(C,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,Vt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(E,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ut=G(Rt,[[`render`,Ht]]),Wt=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:N,ApplicationIcon:D,ChannelIcon:k,ImageIcon:j,InfoIcon:M,LightningIcon:ee,MagicIcon:I,TimeIcon:O,WarningIcon:P,CopyToClipboard:he,ElAlert:C,ImageWrapper:Se,ElButton:K,ElTooltip:S,ImagePreview:X,ApiCodeButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return $(this.modelValue?.request)},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await J.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`seedream/deleteTask`,{id:e}),Y.success(this.$t(`common.message.deleteTaskSuccess`))}catch{Y.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return L(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Gt={class:`preview`},Kt={class:`left`},qt={class:`main`},Jt={class:`bot`},Yt={class:`datetime`},Xt=[`aria-label`],Zt={class:`info`},Qt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},$t={key:1,class:`prompt mt-2`},en={key:0},tn={key:0,class:n({content:!0})},nn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},rn={key:1,class:n({content:!0,failed:!0})},an={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},on={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},pn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bn={key:3,class:n({content:!0})},xn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Cn(u,d,g,_,v,y){let b=l(`capability-presentation`),x=l(`delete-icon`),S=l(`el-tooltip`),C=l(`image-preview`),w=l(`time-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`el-alert`),O=l(`image-wrapper`),k=l(`el-button`),A=l(`api-code-button`),j=l(`application-icon`),M=l(`image-icon`),N=l(`lightning-icon`),P=l(`channel-icon`),F=l(`warning-icon`),I=l(`info-icon`);return h(),s(`div`,Gt,[e(`div`,Kt,[a(b,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,qt,[e(`div`,Jt,[a(b,{capability:`seedream`,part:`name`}),e(`span`,Yt,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1),a(S,{effect:`dark`,content:u.$t(`common.button.delete`),placement:`top`},{default:p(()=>[u.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":u.$t(`common.button.delete`),onClick:d[0]||=t((...e)=>u.onDelete&&u.onDelete(...e),[`stop`])},[a(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Xt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Zt,[Array.isArray(u.modelValue?.request?.image)&&u.modelValue?.request?.image.length>0?(h(),s(`div`,Qt,[(h(!0),s(c,null,m(u.modelValue?.request?.image,(e,t)=>(h(),f(C,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(h(),s(`p`,$t,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(h(),s(`span`,en,` - (`+i(u.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),u.modelValue?.response?u.modelValue?.response?.success===!0?(h(),s(`div`,rn,[e(`div`,an,[(h(!0),s(c,null,m(u.images,(e,t)=>(h(),f(O,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,on,[a(S,{class:`box-item`,effect:`dark`,content:u.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(k,{type:`info`,size:`small`,class:`btn-action`,onClick:d[1]||=t(e=>u.onEdit(u.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(u.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(A,{path:`/seedream/images`,body:u.apiRequest},null,8,[`body`])]),a(D,{closable:!1,class:`mt-2 success`},{default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,sn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,cn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,un,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(h(),s(`p`,dn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,fn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):u.modelValue?.response?.success===!1?(h(),s(`div`,{key:2,class:n({content:!0,"mt-[15px]":!u.modelValue?.request?.prompt})},[a(D,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failure`)),1)]),default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,pn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,mn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,hn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,gn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.error?.message?(h(),s(`p`,_n,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(E,{content:u.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),u.modelValue?.elapsed?(h(),s(`p`,vn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})],2)):(h(),s(`div`,bn,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,xn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,tn,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,nn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var wn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Wt,[[`render`,Cn],[`__scopeId`,`data-v-394e4796`]]),BotPlaceholder:xe,NoTasks:ve,ScrollList:_e},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Tn={key:0},En={key:2,class:`w-full h-full flex items-center justify-center`};function Dn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Tn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{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:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,En,[a(v)])):o(``,!0)],64)}var On=_({name:`SeedreamIndex`,components:{ConfigPanel:Ut,Layout:Oe,RecentPanel:G(wn,[[`render`,Dn]])},mixins:[se],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===q.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.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 ye({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/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.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ae(this.uploadTracker,e=>this.$t(e),e=>Y.warning(e)))return;if(Q(this.config?.model).imageRequired&&!this.config?.image?.length){Y.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=$(this.config);if(!pe())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}Y.info(this.$t(`seedream.message.startingTask`)),me(`seedream`,oe.generate(e,{token:t})).then(()=>{Y.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?Y.error(this.$t(`seedream.message.usedUp`)):Y.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function kn(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var An=G(On,[[`render`,kn]]);export{An 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,j as u,mt as d,rt as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{r as h,t as g}from"./select-B_wrrcy_.js";import{t as _}from"./upload-CMfumvdd.js";import{t as v}from"./tooltip-DHCemFsN.js";import{t as y}from"./alert-5xgq51kW.js";import{t as b}from"./clock-DWErYX-e.js";import{r as x,t as S}from"./PromptTextarea-BZPxXkv4.js";import{t as C}from"./info-D3YlGBe6.js";import{t as w}from"./trash-2-eHkcay3n.js";import{t as T}from"./triangle-alert-BX-Sd8Yl.js";import{t as E}from"./wand-sparkles-DQT17NWq.js";import{ir as D}from"./constants-BhyBTGQP.js";import{Bt as O,E as k,Fi as A,Ht as j,Kt as M,Ln as ee,Ut as te,Vt as N,Wt as P,ai as F,bi as I,ci as L,tn as R,xi as z,yr as B}from"./index-CdwgDSbo.js";import{t as V}from"./CopyToClipboard-BFAl8bTh.js";import{t as H}from"./ImagePreview-B-8-QHLl.js";import{t as U}from"./Consumption-Bs5sLYKF.js";import{a as W,n as G,r as K,t as q}from"./pagination-nJ5-cNtZ.js";import{t as J}from"./VideoPlayer-A-jVFZal.js";import{t as Y}from"./ApiCodeButton-CAEaiAmy.js";import{t as X}from"./BotPlaceholder-DXtf3RgL.js";import{t as Z}from"./Hailuo-DwVVCFc6.js";var Q=m({name:`ModelSelector`,components:{ElSelect:h,ElOption:g},data(){return{}},computed:{options(){return[{value:`minimax-t2v`,label:this.$t(`hailuo.button.model1`)},{value:`minimax-i2v`,label:this.$t(`hailuo.button.model2`)},{value:`minimax-i2v-director`,label:this.$t(`hailuo.button.model3`)}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||=D}}),ne={class:`field`},re={class:`title font-bold`},ie={class:`float-left`};function ae(t,n,r,o,m,h){let g=l(`el-option`),_=l(`el-select`);return p(),s(`div`,ne,[e(`h2`,re,i(t.$t(`hailuo.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`hailuo.placeholder.select`),clearable:``},{default:d(()=>[(p(!0),s(c,null,f(t.options,t=>(p(),u(g,{key:t.value,label:t.label,value:t.value},{default:d(()=>[e(`span`,ie,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var oe=k(Q,[[`render`,ae],[`__scopeId`,`data-v-a768fbd9`]]),se=m({name:`StartImageUrlInput`,components:{ElUpload:_,ElButton:A,InfoIcon:W,ImagePreview:H},mixins:[P,te,N],data(){return{fileList:[],uploadUrl:L()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){z.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){z.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){z.error(this.$t(`hailuo.message.uploadStartImageError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ce={class:`relative`},le={class:`flex justify-between`},ue={class:`flex justify-start items-center`},de={class:`text-sm font-bold`};function fe(t,n,c,f,m,h){let g=l(`info-icon`),_=l(`image-preview`),v=l(`el-button`),y=l(`el-upload`);return p(),s(`div`,ce,[e(`div`,le,[e(`div`,ue,[e(`span`,de,i(t.$t(`hailuo.name.startImageUrl`)),1),a(g,{content:t.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),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`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{file:d(({file:e})=>[e.url&&e.percentage!==void 0?(p(),u(_,{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:d(()=>[a(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:d(()=>[r(i(t.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var pe=k(se,[[`render`,fe],[`__scopeId`,`data-v-11c1de4e`]]),me=m({name:`PromptInput`,components:{PromptTextarea:S},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function he(e,t,n,r,i,a){let o=l(`prompt-textarea`);return p(),u(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`hailuo.name.prompt`),info:e.$t(`hailuo.description.prompt`),placeholder:e.$t(`hailuo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ge=m({name:`PresetPanel`,components:{MagicIcon:E,ElButton:A,PromptInput:k(me,[[`render`,he]]),StartImageUrlInput:pe,ModelSelector:oe,Consumption:U},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return M(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),_e={class:`flex flex-col h-full`},ve={class:`flex-1 overflow-y-auto p-5`},ye={class:`flex flex-col items-center justify-center px-5 pb-5`};function be(t,n,c,f,m,h){let g=l(`prompt-input`),_=l(`model-selector`),v=l(`start-image-url-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return p(),s(`div`,_e,[e(`div`,ve,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.config?.model===`minimax-i2v`?(p(),u(v,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,ye,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(p(),u(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(p(),u(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var xe=k(ge,[[`render`,be]]),Se=m({name:`TaskPreview`,components:{DeleteIcon:w,ChannelIcon:x,InfoIcon:C,MagicIcon:E,TimeIcon:b,WarningIcon:T,CopyToClipboard:V,ElAlert:y,VideoPlayer:J,ElTooltip:v,ElButton:A,ApiCodeButton:Y},props:{modelValue:{type:Object,required:!0}},computed:{isFailure(){let e=this.modelValue?.response;return e?.success===!1||!!e?.error||this.video?.state===`failed`||this.video?.state===`cancelled`},isWaiting(){return!this.modelValue?.response||!this.isFailure&&[`queued`,`pending`,`processing`,`running`].includes(this.video?.state||``)},application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await I.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`hailuo/deleteTask`,{id:e}),z.success(this.$t(`common.message.deleteTaskSuccess`))}catch{z.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e){console.debug(`on download hailuo video`,e),window.open(e,`_blank`)}}}),Ce={class:`preview`},we={class:`left`},Te={class:`main`},Ee={class:`bot`},De={class:`datetime`},Oe=[`aria-label`],ke={class:`info`},Ae={key:0,class:`prompt mt-2`},je={key:0},Me={key:1},Ne={key:0,class:n({content:!0,failed:!0})},Pe={key:0,class:`mb-4`},Fe={key:1,class:n({operations:!0,"mt-2":!0})},Ie={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Le={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Re={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ze={key:1,class:n({content:!0})},Be={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ve={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},He={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ue={key:2,class:n({content:!0})},We={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ge(n,c,f,m,h,g){let _=l(`capability-presentation`),v=l(`delete-icon`),y=l(`el-tooltip`),b=l(`video-player`),x=l(`el-button`),S=l(`api-code-button`),C=l(`channel-icon`),w=l(`copy-to-clipboard`),T=l(`magic-icon`),E=l(`time-icon`),D=l(`el-alert`),O=l(`warning-icon`),k=l(`info-icon`);return p(),s(`div`,Ce,[e(`div`,we,[a(_,{capability:`hailuo`,part:`avatar`,class:`avatar`})]),e(`div`,Te,[e(`div`,Ee,[a(_,{capability:`hailuo`,part:`name`}),e(`span`,De,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(y,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:d(()=>[n.modelValue?.id?(p(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(v,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Oe)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,ke,[n.modelValue?.request?.prompt?(p(),s(`p`,Ae,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(p(),s(`span`,je,` - (`+i(n.$t(`hailuo.status.pending`))+`) `,1)),n.modelValue?.response&&n.isWaiting?(p(),s(`span`,Me,` - (`+i(n.$t(`hailuo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0&&!n.isFailure&&!n.isWaiting?(p(),s(`div`,Ne,[n.video?.video_url?(p(),s(`div`,Pe,[a(b,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?(p(),s(`div`,Fe,[a(y,{class:`box-item`,effect:`dark`,content:n.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:d(()=>[n.video?.video_url?(p(),u(x,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:c[1]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:d(()=>[r(i(n.$t(`hailuo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(S,{path:`/hailuo/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(D,{closable:!1,class:`mt-2 success`},{default:d(()=>[n.modelValue?.request?.model?(p(),s(`p`,Ie,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.model`))+`: `+i(n.modelValue?.request?.model)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])])):o(``,!0),e(`p`,Le,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,Re,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(p(),s(`div`,ze,[a(D,{closable:!1,class:`failure`},{template:d(()=>[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failure`)),1)]),default:d(()=>[e(`p`,Be,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Ve,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(w,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,$,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,He,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),n.isWaiting?(p(),s(`div`,Ue,[a(D,{closable:!1,class:`info`},{template:d(()=>[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`hailuo.status.processing`:`hailuo.status.pending`)),1)]),default:d(()=>[e(`p`,We,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var Ke=m({name:`RecentPanel`,components:{TaskPreview:k(Se,[[`render`,Ge],[`__scopeId`,`data-v-fa307ccb`]]),BotPlaceholder:X,NoTasks:K,ScrollList:G},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),qe={key:0},Je={key:2,class:`w-full h-full flex items-center justify-center`};function Ye(e,t,n,r,i,m){let h=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return p(),s(c,null,[e.tasks?.items===void 0?(p(),s(`div`,qe,[a(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(p(),u(_,{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:d(()=>[(p(!0),s(c,null,f(e.tasks?.items,e=>(p(),u(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(p(),s(`div`,Je,[a(v)])):o(``,!0)],64)}var Xe=m({name:`HailuoIndex`,components:{ConfigPanel:xe,Layout:Z,RecentPanel:k(Ke,[[`render`,Ye]])},mixins:[j],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.hailuo?.status?.getApplications===F.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===F.Request||this.fetchingTasks},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.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 q({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(`hailuo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`hailuo/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(`hailuo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!O(this.uploadTracker,e=>this.$t(e),e=>z.warning(e)))return;let e={...this.config,async:!0};if(!R())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}z.info(this.$t(`hailuo.message.startingTask`)),B(`hailuo`,ee.generate(e,{token:t})).then(()=>{z.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?z.error(this.$t(`hailuo.message.usedUp`)):z.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ze(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),f=l(`layout`);return p(),u(f,null,{config:d(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:d(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Qe=k(Xe,[[`render`,Ze]]);export{Qe 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,j as u,mt as d,rt as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{r as h,t as g}from"./select-CdcJAtHh.js";import{t as _}from"./upload-DsZRTIWs.js";import{t as v}from"./tooltip-DiVzh1Gl.js";import{t as y}from"./alert-C2k9KG3u.js";import{t as b}from"./clock-Dvb0weei.js";import{r as x,t as S}from"./PromptTextarea-D7mWl00Q.js";import{t as C}from"./info-itWy-wlR.js";import{t as w}from"./trash-2-Dg3Af9lM.js";import{t as T}from"./triangle-alert-uPbdNKT7.js";import{t as E}from"./wand-sparkles-BWwUTBQt.js";import{ir as D}from"./constants-ChRYidMs.js";import{Bt as O,E as k,Fi as A,Ht as j,Kt as M,Ln as ee,Ut as te,Vt as N,Wt as P,ai as F,bi as I,ci as L,tn as R,xi as z,yr as B}from"./index-UTshJlN_.js";import{t as V}from"./CopyToClipboard-BYSbcBiV.js";import{t as H}from"./ImagePreview-CLg15kJw.js";import{t as U}from"./Consumption-LBlIroNB.js";import{a as W,n as G,r as K,t as q}from"./pagination-DgHqjd1Q.js";import{t as J}from"./VideoPlayer-oWU2aWMp.js";import{t as Y}from"./ApiCodeButton-C-xAzxv_.js";import{t as X}from"./BotPlaceholder-DdR_2tLl.js";import{t as Z}from"./Hailuo-BTk7CcjH.js";var Q=m({name:`ModelSelector`,components:{ElSelect:h,ElOption:g},data(){return{}},computed:{options(){return[{value:`minimax-t2v`,label:this.$t(`hailuo.button.model1`)},{value:`minimax-i2v`,label:this.$t(`hailuo.button.model2`)},{value:`minimax-i2v-director`,label:this.$t(`hailuo.button.model3`)}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||=D}}),ne={class:`field`},re={class:`title font-bold`},ie={class:`float-left`};function ae(t,n,r,o,m,h){let g=l(`el-option`),_=l(`el-select`);return p(),s(`div`,ne,[e(`h2`,re,i(t.$t(`hailuo.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`hailuo.placeholder.select`),clearable:``},{default:d(()=>[(p(!0),s(c,null,f(t.options,t=>(p(),u(g,{key:t.value,label:t.label,value:t.value},{default:d(()=>[e(`span`,ie,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var oe=k(Q,[[`render`,ae],[`__scopeId`,`data-v-a768fbd9`]]),se=m({name:`StartImageUrlInput`,components:{ElUpload:_,ElButton:A,InfoIcon:W,ImagePreview:H},mixins:[P,te,N],data(){return{fileList:[],uploadUrl:L()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){z.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){z.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){z.error(this.$t(`hailuo.message.uploadStartImageError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ce={class:`relative`},le={class:`flex justify-between`},ue={class:`flex justify-start items-center`},de={class:`text-sm font-bold`};function fe(t,n,c,f,m,h){let g=l(`info-icon`),_=l(`image-preview`),v=l(`el-button`),y=l(`el-upload`);return p(),s(`div`,ce,[e(`div`,le,[e(`div`,ue,[e(`span`,de,i(t.$t(`hailuo.name.startImageUrl`)),1),a(g,{content:t.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),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`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{file:d(({file:e})=>[e.url&&e.percentage!==void 0?(p(),u(_,{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:d(()=>[a(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:d(()=>[r(i(t.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var pe=k(se,[[`render`,fe],[`__scopeId`,`data-v-11c1de4e`]]),me=m({name:`PromptInput`,components:{PromptTextarea:S},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function he(e,t,n,r,i,a){let o=l(`prompt-textarea`);return p(),u(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`hailuo.name.prompt`),info:e.$t(`hailuo.description.prompt`),placeholder:e.$t(`hailuo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ge=m({name:`PresetPanel`,components:{MagicIcon:E,ElButton:A,PromptInput:k(me,[[`render`,he]]),StartImageUrlInput:pe,ModelSelector:oe,Consumption:U},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return M(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),_e={class:`flex flex-col h-full`},ve={class:`flex-1 overflow-y-auto p-5`},ye={class:`flex flex-col items-center justify-center px-5 pb-5`};function be(t,n,c,f,m,h){let g=l(`prompt-input`),_=l(`model-selector`),v=l(`start-image-url-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return p(),s(`div`,_e,[e(`div`,ve,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.config?.model===`minimax-i2v`?(p(),u(v,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,ye,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(p(),u(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(p(),u(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var xe=k(ge,[[`render`,be]]),Se=m({name:`TaskPreview`,components:{DeleteIcon:w,ChannelIcon:x,InfoIcon:C,MagicIcon:E,TimeIcon:b,WarningIcon:T,CopyToClipboard:V,ElAlert:y,VideoPlayer:J,ElTooltip:v,ElButton:A,ApiCodeButton:Y},props:{modelValue:{type:Object,required:!0}},computed:{isFailure(){let e=this.modelValue?.response;return e?.success===!1||!!e?.error||this.video?.state===`failed`||this.video?.state===`cancelled`},isWaiting(){return!this.modelValue?.response||!this.isFailure&&[`queued`,`pending`,`processing`,`running`].includes(this.video?.state||``)},application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await I.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`hailuo/deleteTask`,{id:e}),z.success(this.$t(`common.message.deleteTaskSuccess`))}catch{z.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e){console.debug(`on download hailuo video`,e),window.open(e,`_blank`)}}}),Ce={class:`preview`},we={class:`left`},Te={class:`main`},Ee={class:`bot`},De={class:`datetime`},Oe=[`aria-label`],ke={class:`info`},Ae={key:0,class:`prompt mt-2`},je={key:0},Me={key:1},Ne={key:0,class:n({content:!0,failed:!0})},Pe={key:0,class:`mb-4`},Fe={key:1,class:n({operations:!0,"mt-2":!0})},Ie={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Le={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Re={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ze={key:1,class:n({content:!0})},Be={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ve={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},He={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ue={key:2,class:n({content:!0})},We={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ge(n,c,f,m,h,g){let _=l(`capability-presentation`),v=l(`delete-icon`),y=l(`el-tooltip`),b=l(`video-player`),x=l(`el-button`),S=l(`api-code-button`),C=l(`channel-icon`),w=l(`copy-to-clipboard`),T=l(`magic-icon`),E=l(`time-icon`),D=l(`el-alert`),O=l(`warning-icon`),k=l(`info-icon`);return p(),s(`div`,Ce,[e(`div`,we,[a(_,{capability:`hailuo`,part:`avatar`,class:`avatar`})]),e(`div`,Te,[e(`div`,Ee,[a(_,{capability:`hailuo`,part:`name`}),e(`span`,De,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(y,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:d(()=>[n.modelValue?.id?(p(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(v,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Oe)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,ke,[n.modelValue?.request?.prompt?(p(),s(`p`,Ae,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(p(),s(`span`,je,` - (`+i(n.$t(`hailuo.status.pending`))+`) `,1)),n.modelValue?.response&&n.isWaiting?(p(),s(`span`,Me,` - (`+i(n.$t(`hailuo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0&&!n.isFailure&&!n.isWaiting?(p(),s(`div`,Ne,[n.video?.video_url?(p(),s(`div`,Pe,[a(b,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?(p(),s(`div`,Fe,[a(y,{class:`box-item`,effect:`dark`,content:n.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:d(()=>[n.video?.video_url?(p(),u(x,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:c[1]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:d(()=>[r(i(n.$t(`hailuo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(S,{path:`/hailuo/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(D,{closable:!1,class:`mt-2 success`},{default:d(()=>[n.modelValue?.request?.model?(p(),s(`p`,Ie,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.model`))+`: `+i(n.modelValue?.request?.model)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])])):o(``,!0),e(`p`,Le,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,Re,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(p(),s(`div`,ze,[a(D,{closable:!1,class:`failure`},{template:d(()=>[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failure`)),1)]),default:d(()=>[e(`p`,Be,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Ve,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(w,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,$,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,He,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),n.isWaiting?(p(),s(`div`,Ue,[a(D,{closable:!1,class:`info`},{template:d(()=>[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`hailuo.status.processing`:`hailuo.status.pending`)),1)]),default:d(()=>[e(`p`,We,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var Ke=m({name:`RecentPanel`,components:{TaskPreview:k(Se,[[`render`,Ge],[`__scopeId`,`data-v-fa307ccb`]]),BotPlaceholder:X,NoTasks:K,ScrollList:G},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),qe={key:0},Je={key:2,class:`w-full h-full flex items-center justify-center`};function Ye(e,t,n,r,i,m){let h=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return p(),s(c,null,[e.tasks?.items===void 0?(p(),s(`div`,qe,[a(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(p(),u(_,{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:d(()=>[(p(!0),s(c,null,f(e.tasks?.items,e=>(p(),u(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(p(),s(`div`,Je,[a(v)])):o(``,!0)],64)}var Xe=m({name:`HailuoIndex`,components:{ConfigPanel:xe,Layout:Z,RecentPanel:k(Ke,[[`render`,Ye]])},mixins:[j],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.hailuo?.status?.getApplications===F.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===F.Request||this.fetchingTasks},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.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 q({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(`hailuo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`hailuo/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(`hailuo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!O(this.uploadTracker,e=>this.$t(e),e=>z.warning(e)))return;let e={...this.config,async:!0};if(!R())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}z.info(this.$t(`hailuo.message.startingTask`)),B(`hailuo`,ee.generate(e,{token:t})).then(()=>{z.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?z.error(this.$t(`hailuo.message.usedUp`)):z.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ze(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),f=l(`layout`);return p(),u(f,null,{config:d(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:d(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Qe=k(Xe,[[`render`,Ze]]);export{Qe 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,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{t as v}from"./upload-CMfumvdd.js";import{t as y}from"./tooltip-DHCemFsN.js";import{t as b}from"./alert-5xgq51kW.js";import{t as x}from"./drawer-BTvzjggP.js";import{t as S}from"./switch-8tD8sFwP.js";import{n as C}from"./taskDrawerMixin-_P2cdhwz.js";import{t as w}from"./clock-DWErYX-e.js";import{r as T,t as E}from"./PromptTextarea-BZPxXkv4.js";import{t as D}from"./info-D3YlGBe6.js";import{t as O}from"./trash-2-eHkcay3n.js";import{t as ee}from"./triangle-alert-BX-Sd8Yl.js";import{t as k}from"./upload-DF_BDuGz.js";import{t as A}from"./wand-sparkles-DQT17NWq.js";import"./constants-BhyBTGQP.js";import{Bt as j,E as M,Fi as N,Ht as P,Kt as F,Ut as I,Vt as L,Wt as R,ai as z,bi as te,ci as B,qn as ne,tn as V,xi as H,yr as U}from"./index-CdwgDSbo.js";import{t as W}from"./CopyToClipboard-BFAl8bTh.js";import{t as G}from"./FilePreview-DVrtLCDd.js";import{t as K}from"./ImagePreview-B-8-QHLl.js";import{t as q}from"./Consumption-Bs5sLYKF.js";import{a as J,n as Y,r as X,t as Z}from"./pagination-nJ5-cNtZ.js";import{t as Q}from"./VideoPlayer-A-jVFZal.js";import{t as re}from"./ApiCodeButton-CAEaiAmy.js";import{t as ie}from"./BotPlaceholder-DXtf3RgL.js";var ae=_({name:`LayoutLuma`,components:{MagicIcon:A,ElDrawer:x,ElButton:N},mixins:[C]}),oe={class:`main flex flex-row flex-1`},se={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ce={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function le(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,oe,[e(`div`,se,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ce,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ue=M(ae,[[`render`,le],[`__scopeId`,`data-v-d13d43a9`]]),de=_({name:`EnhancementSelector`,components:{ElSwitch:S,InfoIcon:J},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug(`set enhancement`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=!0)}}),fe={class:`relative`},pe={class:`flex justify-between`},me={class:`flex justify-start items-center`},he={class:`text-sm font-bold`},ge={class:`flex justify-end items-center`};function _e(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,fe,[e(`div`,pe,[e(`div`,me,[e(`span`,he,i(t.$t(`luma.name.enhancement`)),1),a(d,{content:t.$t(`luma.description.enhancement`)},null,8,[`content`])]),e(`div`,ge,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var ve=M(de,[[`render`,_e]]),ye=_({name:`CustomSelector`,components:{ElSwitch:S,InfoIcon:J},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug(`set custom`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),be={class:`relative`},xe={class:`flex justify-between`},Se={class:`flex justify-start items-center`},Ce={class:`text-sm font-bold`},we={class:`flex justify-end items-center`};function Te(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,be,[e(`div`,xe,[e(`div`,Se,[e(`span`,Ce,i(t.$t(`luma.name.custom`)),1),a(d,{content:t.$t(`luma.description.custom`)},null,8,[`content`])]),e(`div`,we,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ee=M(ye,[[`render`,Te]]),De=_({name:`LoopSelector`,components:{ElSwitch:S,InfoIcon:J},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug(`set loop`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),Oe={class:`relative`},ke={class:`flex justify-between`},Ae={class:`flex justify-start items-center`},je={class:`text-sm font-bold`},Me={class:`flex justify-end items-center`};function Ne(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,Oe,[e(`div`,ke,[e(`div`,Ae,[e(`span`,je,i(t.$t(`luma.name.loop`)),1),a(d,{content:t.$t(`luma.description.loop`)},null,8,[`content`])]),e(`div`,Me,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Pe=M(De,[[`render`,Ne]]),Fe=_({name:`EndImage`,components:{UploadIcon:k,ElUpload:v,ElButton:N,ImagePreview:K,InfoIcon:J},mixins:[R,I,L],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onExceed(){H.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){H.error(this.$t(`luma.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Ie={class:`relative`},Le={class:`flex justify-between`},Re={class:`flex justify-start items-center`},ze={class:`text-sm font-bold`};function Be(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ie,[e(`div`,Le,[e(`div`,Re,[e(`span`,ze,i(t.$t(`luma.name.endImageUrl`)),1),a(g,{content:t.$t(`luma.description.endImageUrl`)},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: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:p(({file:e})=>[e.url&&e.percentage!==void 0?(h(),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,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.uploadEndImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Ve=M(Fe,[[`render`,Be],[`__scopeId`,`data-v-b8b121be`]]),He=_({name:`StartImage`,components:{UploadIcon:k,ElUpload:v,ElButton:N,ImagePreview:K,InfoIcon:J},mixins:[R,I,L],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){H.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){H.error(this.$t(`luma.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ue={class:`relative`},We={class:`flex justify-between`},Ge={class:`flex justify-start items-center`},Ke={class:`text-sm font-bold`};function qe(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ue,[e(`div`,We,[e(`div`,Ge,[e(`span`,Ke,i(t.$t(`luma.name.startImageUrl`)),1),a(g,{content:t.$t(`luma.description.startImageUrl`)},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: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:p(({file:e})=>[e.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Je=M(He,[[`render`,qe],[`__scopeId`,`data-v-5bb7722a`]]),Ye=_({name:`UploadVideo`,components:{UploadIcon:k,ElUpload:v,ElButton:N,InfoIcon:J,FilePreview:G},mixins:[I,L],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.luma?.config?.video_url},set(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||=void 0},methods:{onExceed(){H.warning(this.$t(`luma.message.uploadVideoExceed`))},onError(){H.error(this.$t(`luma.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`,n=e.size/1024/1024<10;return t?n?!0:(H.error(this.$t(`luma.message.uploadVideoSizeExceed`)),!1):(H.error(this.$t(`luma.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e,action:`extend`})},async onSuccess(){this.onSetVideoUrl()}}}),Xe={class:`relative`},Ze={class:`flex justify-between`},Qe={class:`flex justify-start items-center`},$e={class:`text-sm font-bold`};function et(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Xe,[e(`div`,Ze,[e(`div`,Qe,[e(`span`,$e,i(t.$t(`luma.name.videoUrl`)),1),a(g,{content:t.$t(`luma.description.videoUrl`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var tt=M(Ye,[[`render`,et],[`__scopeId`,`data-v-2189fc52`]]),nt=_({name:`PromptInput`,components:{PromptTextarea:E},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||=``}});function rt(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`luma.name.prompt`),info:e.$t(`luma.description.prompt`),placeholder:e.$t(`luma.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var it=M(nt,[[`render`,rt]]),at=_({name:`ExtendFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.luma?.config}}}),ot={class:`relative`},st={class:`flex mb-2`},ct={class:`text-sm font-bold`};function lt(t,n,r,a,c,u){let d=l(`video-player`);return h(),s(`div`,ot,[e(`div`,st,[e(`span`,ct,i(t.$t(`luma.name.extend`)),1)]),e(`div`,null,[t.config?.video_url?(h(),f(d,{key:0,src:t.config?.video_url},null,8,[`src`])):o(``,!0)])])}var ut=_({name:`ConfigPanel`,components:{MagicIcon:A,LoopSelector:Pe,StartImageInput:Je,EndImageInput:Ve,EnhancementSelector:ve,ElButton:N,PromptInput:it,ExtendFromInput:M(at,[[`render`,lt]]),CustomSelector:Ee,UploadVideo:tt,Consumption:q},emits:[`generate`],computed:{config(){return this.$store.state.luma?.config},consumption(){return F(this.config,this.service?.cost)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),dt={class:`flex flex-col h-full`},ft={class:`flex-1 overflow-y-auto p-5`},pt={class:`flex flex-col items-center justify-center px-5 pb-5`};function mt(t,n,c,u,d,m){let g=l(`extend-from-input`),_=l(`prompt-input`),v=l(`custom-selector`),y=l(`upload-video`),b=l(`start-image-input`),x=l(`end-image-input`),S=l(`enhancement-selector`),C=l(`loop-selector`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,dt,[e(`div`,ft,[t.config?.video_id||t.config?.video_url?(h(),f(g,{key:0,class:`mb-4`})):o(``,!0),a(_,{class:`mb-4`}),t.config?.video_id?o(``,!0):(h(),f(v,{key:1,class:`mb-4`})),t.config?.custom?(h(),f(y,{key:2,class:`mb-4`})):o(``,!0),!(t.config?.video_id||t.config?.video_url)&&!t.config?.custom?(h(),f(b,{key:3,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`})]),e(`div`,pt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(h(),f(E,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.extend`)),1)]),_:1},8,[`onClick`])):(h(),f(E,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var ht=M(ut,[[`render`,mt]]),gt=_({name:`TaskPreview`,components:{DeleteIcon:O,ChannelIcon:T,InfoIcon:D,MagicIcon:A,TimeIcon:w,WarningIcon:ee,CopyToClipboard:W,ElAlert:b,VideoPlayer:Q,ElTooltip:y,ElButton:N,ApiCodeButton:re},props:{modelValue:{type:Object,required:!0}},emits:[`extend`],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await te.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`luma/deleteTask`,{id:e}),H.success(this.$t(`common.message.deleteTaskSuccess`))}catch{H.error(this.$t(`common.message.deleteTaskFailed`))}}},onExtend(e,t){console.debug(`set config`,t),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_id:t.video_id,prompt:t.prompt,action:`extend`,thumbnail_url:t.thumbnail_url,video_url:t.video_url}),this.$emit(`extend`)},onDownload(e){window.open(e,`_blank`)}}}),_t={class:`preview`},vt={class:`left`},yt={class:`main`},bt={class:`bot`},xt={class:`datetime`},St=[`aria-label`],Ct={class:`info`},wt={key:0,class:`prompt mt-2`},Tt={key:0},Et={key:1},Dt={key:0,class:n({content:!0,failed:!0})},Ot={key:0,class:`mb-4`},kt={key:1,class:n({operations:!0,"mt-2":!0,"mb-4":!0})},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Mt={key:1,class:n({content:!0})},Nt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},It={key:2,class:n({content:!0})},Lt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Rt(n,c,u,d,f,m){let g=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`video-player`),b=l(`el-button`),x=l(`api-code-button`),S=l(`magic-icon`),C=l(`copy-to-clipboard`),w=l(`time-icon`),T=l(`el-alert`),E=l(`warning-icon`),D=l(`info-icon`),O=l(`channel-icon`);return h(),s(`div`,_t,[e(`div`,vt,[a(g,{capability:`luma`,part:`avatar`,class:`avatar`})]),e(`div`,yt,[e(`div`,bt,[a(g,{capability:`luma`,part:`name`}),e(`span`,xt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,St)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Ct,[n.modelValue?.request?.prompt?(h(),s(`p`,wt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Tt,` - (`+i(n.$t(`luma.status.pending`))+`) `,1)),n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`span`,Et,` - (`+i(n.$t(`luma.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,Dt,[n.modelValue.response.video_url?(h(),s(`div`,Ot,[a(y,{src:n.modelValue.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response&&!n.config?.custom?(h(),s(`div`,kt,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.extendVideo`),placement:`top-start`},{default:p(()=>[a(b,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onExtend(e,n.modelValue?.response),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.extend`)),1)]),_:1})]),_:1},8,[`content`]),a(v,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(b,{type:`info`,size:`small`,class:`btn-action`,onClick:c[2]||=t(e=>n.onDownload(n.modelValue?.response?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(x,{path:`/luma/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,At,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,jt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.state===`failed`||n.modelValue?.response?.success===!1?(h(),s(`div`,Mt,[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.failure`)),1)]),default:p(()=>[e(`p`,Nt,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,$,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(C,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Pt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Ft,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.traceId`))+`: `+i(n.modelValue?.trace_id)+` `,1),a(C,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),!n.modelValue?.response||n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`div`,It,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`luma.status.processing`:`luma.status.pending`)),1)]),default:p(()=>[e(`p`,Lt,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var zt=_({name:`RecentPanel`,components:{BotPlaceholder:ie,TaskPreview:M(gt,[[`render`,Rt],[`__scopeId`,`data-v-6411e1a8`]]),NoTasks:X,ScrollList:Y},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`,`extend`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Bt={key:0},Vt={key:2,class:`w-full h-full flex items-center justify-center`};function Ht(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Bt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[1]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,n=>(h(),f(g,{key:n.id,"model-value":n,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Vt,[a(v)])):o(``,!0)],64)}var Ut=_({name:`LumaIndex`,components:{ConfigPanel:ht,Layout:ue,RecentPanel:M(zt,[[`render`,Ht]])},mixins:[P],inject:[`initialized`],emits:[`extend`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.luma?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.luma?.status?.getTasks===z.Request||this.fetchingTasks},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,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 Z({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(`luma/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`luma/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){console.debug(`scrolling down`),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(`luma/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!j(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e={...this.config,async:!0};if(!this.hasText(e.prompt)){H.error(this.$t(`luma.message.promptRequired`));return}if(e.prompt=e.prompt?.trim(),!V())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}H.info(this.$t(`luma.message.startingTask`)),U(`luma`,ne.generate(e,{token:t})).then(()=>{H.success(this.$t(`luma.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`luma.message.usedUp`)):H.error(this.$t(`luma.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function Wt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),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,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`loading`,`onReachTop`])]),_:1})}var Gt=M(Ut,[[`render`,Wt]]);export{Gt 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,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{t as v}from"./upload-DsZRTIWs.js";import{t as y}from"./tooltip-DiVzh1Gl.js";import{t as b}from"./alert-C2k9KG3u.js";import{t as x}from"./drawer-CO9biQiP.js";import{t as S}from"./switch-D6eD8ufY.js";import{n as C}from"./taskDrawerMixin-Brfmzrs4.js";import{t as w}from"./clock-Dvb0weei.js";import{r as T,t as E}from"./PromptTextarea-D7mWl00Q.js";import{t as D}from"./info-itWy-wlR.js";import{t as O}from"./trash-2-Dg3Af9lM.js";import{t as ee}from"./triangle-alert-uPbdNKT7.js";import{t as k}from"./upload-BUi4Qlhm.js";import{t as A}from"./wand-sparkles-BWwUTBQt.js";import"./constants-ChRYidMs.js";import{Bt as j,E as M,Fi as N,Ht as P,Kt as F,Ut as I,Vt as L,Wt as R,ai as z,bi as te,ci as B,qn as ne,tn as V,xi as H,yr as U}from"./index-UTshJlN_.js";import{t as W}from"./CopyToClipboard-BYSbcBiV.js";import{t as G}from"./FilePreview-CYQ4qHpB.js";import{t as K}from"./ImagePreview-CLg15kJw.js";import{t as q}from"./Consumption-LBlIroNB.js";import{a as J,n as Y,r as X,t as Z}from"./pagination-DgHqjd1Q.js";import{t as Q}from"./VideoPlayer-oWU2aWMp.js";import{t as re}from"./ApiCodeButton-C-xAzxv_.js";import{t as ie}from"./BotPlaceholder-DdR_2tLl.js";var ae=_({name:`LayoutLuma`,components:{MagicIcon:A,ElDrawer:x,ElButton:N},mixins:[C]}),oe={class:`main flex flex-row flex-1`},se={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ce={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function le(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,oe,[e(`div`,se,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ce,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ue=M(ae,[[`render`,le],[`__scopeId`,`data-v-d13d43a9`]]),de=_({name:`EnhancementSelector`,components:{ElSwitch:S,InfoIcon:J},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug(`set enhancement`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=!0)}}),fe={class:`relative`},pe={class:`flex justify-between`},me={class:`flex justify-start items-center`},he={class:`text-sm font-bold`},ge={class:`flex justify-end items-center`};function _e(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,fe,[e(`div`,pe,[e(`div`,me,[e(`span`,he,i(t.$t(`luma.name.enhancement`)),1),a(d,{content:t.$t(`luma.description.enhancement`)},null,8,[`content`])]),e(`div`,ge,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var ve=M(de,[[`render`,_e]]),ye=_({name:`CustomSelector`,components:{ElSwitch:S,InfoIcon:J},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug(`set custom`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),be={class:`relative`},xe={class:`flex justify-between`},Se={class:`flex justify-start items-center`},Ce={class:`text-sm font-bold`},we={class:`flex justify-end items-center`};function Te(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,be,[e(`div`,xe,[e(`div`,Se,[e(`span`,Ce,i(t.$t(`luma.name.custom`)),1),a(d,{content:t.$t(`luma.description.custom`)},null,8,[`content`])]),e(`div`,we,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ee=M(ye,[[`render`,Te]]),De=_({name:`LoopSelector`,components:{ElSwitch:S,InfoIcon:J},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug(`set loop`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),Oe={class:`relative`},ke={class:`flex justify-between`},Ae={class:`flex justify-start items-center`},je={class:`text-sm font-bold`},Me={class:`flex justify-end items-center`};function Ne(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,Oe,[e(`div`,ke,[e(`div`,Ae,[e(`span`,je,i(t.$t(`luma.name.loop`)),1),a(d,{content:t.$t(`luma.description.loop`)},null,8,[`content`])]),e(`div`,Me,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Pe=M(De,[[`render`,Ne]]),Fe=_({name:`EndImage`,components:{UploadIcon:k,ElUpload:v,ElButton:N,ImagePreview:K,InfoIcon:J},mixins:[R,I,L],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onExceed(){H.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){H.error(this.$t(`luma.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Ie={class:`relative`},Le={class:`flex justify-between`},Re={class:`flex justify-start items-center`},ze={class:`text-sm font-bold`};function Be(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ie,[e(`div`,Le,[e(`div`,Re,[e(`span`,ze,i(t.$t(`luma.name.endImageUrl`)),1),a(g,{content:t.$t(`luma.description.endImageUrl`)},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: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:p(({file:e})=>[e.url&&e.percentage!==void 0?(h(),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,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.uploadEndImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Ve=M(Fe,[[`render`,Be],[`__scopeId`,`data-v-b8b121be`]]),He=_({name:`StartImage`,components:{UploadIcon:k,ElUpload:v,ElButton:N,ImagePreview:K,InfoIcon:J},mixins:[R,I,L],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){H.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){H.error(this.$t(`luma.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ue={class:`relative`},We={class:`flex justify-between`},Ge={class:`flex justify-start items-center`},Ke={class:`text-sm font-bold`};function qe(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ue,[e(`div`,We,[e(`div`,Ge,[e(`span`,Ke,i(t.$t(`luma.name.startImageUrl`)),1),a(g,{content:t.$t(`luma.description.startImageUrl`)},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: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:p(({file:e})=>[e.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Je=M(He,[[`render`,qe],[`__scopeId`,`data-v-5bb7722a`]]),Ye=_({name:`UploadVideo`,components:{UploadIcon:k,ElUpload:v,ElButton:N,InfoIcon:J,FilePreview:G},mixins:[I,L],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.luma?.config?.video_url},set(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||=void 0},methods:{onExceed(){H.warning(this.$t(`luma.message.uploadVideoExceed`))},onError(){H.error(this.$t(`luma.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`,n=e.size/1024/1024<10;return t?n?!0:(H.error(this.$t(`luma.message.uploadVideoSizeExceed`)),!1):(H.error(this.$t(`luma.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e,action:`extend`})},async onSuccess(){this.onSetVideoUrl()}}}),Xe={class:`relative`},Ze={class:`flex justify-between`},Qe={class:`flex justify-start items-center`},$e={class:`text-sm font-bold`};function et(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Xe,[e(`div`,Ze,[e(`div`,Qe,[e(`span`,$e,i(t.$t(`luma.name.videoUrl`)),1),a(g,{content:t.$t(`luma.description.videoUrl`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var tt=M(Ye,[[`render`,et],[`__scopeId`,`data-v-2189fc52`]]),nt=_({name:`PromptInput`,components:{PromptTextarea:E},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||=``}});function rt(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`luma.name.prompt`),info:e.$t(`luma.description.prompt`),placeholder:e.$t(`luma.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var it=M(nt,[[`render`,rt]]),at=_({name:`ExtendFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.luma?.config}}}),ot={class:`relative`},st={class:`flex mb-2`},ct={class:`text-sm font-bold`};function lt(t,n,r,a,c,u){let d=l(`video-player`);return h(),s(`div`,ot,[e(`div`,st,[e(`span`,ct,i(t.$t(`luma.name.extend`)),1)]),e(`div`,null,[t.config?.video_url?(h(),f(d,{key:0,src:t.config?.video_url},null,8,[`src`])):o(``,!0)])])}var ut=_({name:`ConfigPanel`,components:{MagicIcon:A,LoopSelector:Pe,StartImageInput:Je,EndImageInput:Ve,EnhancementSelector:ve,ElButton:N,PromptInput:it,ExtendFromInput:M(at,[[`render`,lt]]),CustomSelector:Ee,UploadVideo:tt,Consumption:q},emits:[`generate`],computed:{config(){return this.$store.state.luma?.config},consumption(){return F(this.config,this.service?.cost)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),dt={class:`flex flex-col h-full`},ft={class:`flex-1 overflow-y-auto p-5`},pt={class:`flex flex-col items-center justify-center px-5 pb-5`};function mt(t,n,c,u,d,m){let g=l(`extend-from-input`),_=l(`prompt-input`),v=l(`custom-selector`),y=l(`upload-video`),b=l(`start-image-input`),x=l(`end-image-input`),S=l(`enhancement-selector`),C=l(`loop-selector`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,dt,[e(`div`,ft,[t.config?.video_id||t.config?.video_url?(h(),f(g,{key:0,class:`mb-4`})):o(``,!0),a(_,{class:`mb-4`}),t.config?.video_id?o(``,!0):(h(),f(v,{key:1,class:`mb-4`})),t.config?.custom?(h(),f(y,{key:2,class:`mb-4`})):o(``,!0),!(t.config?.video_id||t.config?.video_url)&&!t.config?.custom?(h(),f(b,{key:3,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`})]),e(`div`,pt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(h(),f(E,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.extend`)),1)]),_:1},8,[`onClick`])):(h(),f(E,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var ht=M(ut,[[`render`,mt]]),gt=_({name:`TaskPreview`,components:{DeleteIcon:O,ChannelIcon:T,InfoIcon:D,MagicIcon:A,TimeIcon:w,WarningIcon:ee,CopyToClipboard:W,ElAlert:b,VideoPlayer:Q,ElTooltip:y,ElButton:N,ApiCodeButton:re},props:{modelValue:{type:Object,required:!0}},emits:[`extend`],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await te.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`luma/deleteTask`,{id:e}),H.success(this.$t(`common.message.deleteTaskSuccess`))}catch{H.error(this.$t(`common.message.deleteTaskFailed`))}}},onExtend(e,t){console.debug(`set config`,t),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_id:t.video_id,prompt:t.prompt,action:`extend`,thumbnail_url:t.thumbnail_url,video_url:t.video_url}),this.$emit(`extend`)},onDownload(e){window.open(e,`_blank`)}}}),_t={class:`preview`},vt={class:`left`},yt={class:`main`},bt={class:`bot`},xt={class:`datetime`},St=[`aria-label`],Ct={class:`info`},wt={key:0,class:`prompt mt-2`},Tt={key:0},Et={key:1},Dt={key:0,class:n({content:!0,failed:!0})},Ot={key:0,class:`mb-4`},kt={key:1,class:n({operations:!0,"mt-2":!0,"mb-4":!0})},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Mt={key:1,class:n({content:!0})},Nt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},It={key:2,class:n({content:!0})},Lt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Rt(n,c,u,d,f,m){let g=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`video-player`),b=l(`el-button`),x=l(`api-code-button`),S=l(`magic-icon`),C=l(`copy-to-clipboard`),w=l(`time-icon`),T=l(`el-alert`),E=l(`warning-icon`),D=l(`info-icon`),O=l(`channel-icon`);return h(),s(`div`,_t,[e(`div`,vt,[a(g,{capability:`luma`,part:`avatar`,class:`avatar`})]),e(`div`,yt,[e(`div`,bt,[a(g,{capability:`luma`,part:`name`}),e(`span`,xt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,St)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Ct,[n.modelValue?.request?.prompt?(h(),s(`p`,wt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Tt,` - (`+i(n.$t(`luma.status.pending`))+`) `,1)),n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`span`,Et,` - (`+i(n.$t(`luma.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,Dt,[n.modelValue.response.video_url?(h(),s(`div`,Ot,[a(y,{src:n.modelValue.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response&&!n.config?.custom?(h(),s(`div`,kt,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.extendVideo`),placement:`top-start`},{default:p(()=>[a(b,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onExtend(e,n.modelValue?.response),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.extend`)),1)]),_:1})]),_:1},8,[`content`]),a(v,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(b,{type:`info`,size:`small`,class:`btn-action`,onClick:c[2]||=t(e=>n.onDownload(n.modelValue?.response?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(x,{path:`/luma/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,At,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,jt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.state===`failed`||n.modelValue?.response?.success===!1?(h(),s(`div`,Mt,[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.failure`)),1)]),default:p(()=>[e(`p`,Nt,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,$,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(C,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Pt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Ft,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.traceId`))+`: `+i(n.modelValue?.trace_id)+` `,1),a(C,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),!n.modelValue?.response||n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`div`,It,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`luma.status.processing`:`luma.status.pending`)),1)]),default:p(()=>[e(`p`,Lt,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var zt=_({name:`RecentPanel`,components:{BotPlaceholder:ie,TaskPreview:M(gt,[[`render`,Rt],[`__scopeId`,`data-v-6411e1a8`]]),NoTasks:X,ScrollList:Y},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`,`extend`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Bt={key:0},Vt={key:2,class:`w-full h-full flex items-center justify-center`};function Ht(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Bt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[1]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,n=>(h(),f(g,{key:n.id,"model-value":n,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Vt,[a(v)])):o(``,!0)],64)}var Ut=_({name:`LumaIndex`,components:{ConfigPanel:ht,Layout:ue,RecentPanel:M(zt,[[`render`,Ht]])},mixins:[P],inject:[`initialized`],emits:[`extend`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.luma?.status?.getApplications===z.Request},tasksLoading(){return this.$store.state.luma?.status?.getTasks===z.Request||this.fetchingTasks},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,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 Z({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(`luma/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`luma/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){console.debug(`scrolling down`),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(`luma/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!j(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e={...this.config,async:!0};if(!this.hasText(e.prompt)){H.error(this.$t(`luma.message.promptRequired`));return}if(e.prompt=e.prompt?.trim(),!V())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}H.info(this.$t(`luma.message.startingTask`)),U(`luma`,ne.generate(e,{token:t})).then(()=>{H.success(this.$t(`luma.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`luma.message.usedUp`)):H.error(this.$t(`luma.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function Wt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),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,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`loading`,`onReachTop`])]),_:1})}var Gt=M(Ut,[[`render`,Wt]]);export{Gt 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,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-B_wrrcy_.js";import{t as b}from"./upload-CMfumvdd.js";import{t as x}from"./tooltip-DHCemFsN.js";import{t as S}from"./alert-5xgq51kW.js";import{t as C}from"./drawer-BTvzjggP.js";import{t as w}from"./input-number-B2gDrKO-.js";import{t as T}from"./slider-bdvUdBPo.js";import{n as E}from"./taskDrawerMixin-_P2cdhwz.js";import{t as D}from"./clock-DWErYX-e.js";import{r as O,t as k}from"./PromptTextarea-BZPxXkv4.js";import{t as A}from"./info-D3YlGBe6.js";import{t as j}from"./trash-2-eHkcay3n.js";import{t as M}from"./triangle-alert-BX-Sd8Yl.js";import{t as N}from"./upload-DF_BDuGz.js";import{t as P}from"./wand-sparkles-DQT17NWq.js";import{cr as F,lr as ee,sr as te}from"./constants-BhyBTGQP.js";import{Bt as ne,E as I,Fi as L,Ht as R,Kt as z,Rn as B,Ut as V,Vt as H,Wt as U,ai as W,bi as G,ci as K,tn as q,xi as J,yr as Y}from"./index-CdwgDSbo.js";import{t as X}from"./CopyToClipboard-BFAl8bTh.js";import{t as Z}from"./ImagePreview-B-8-QHLl.js";import{t as re}from"./Consumption-Bs5sLYKF.js";import{a as Q,n as ie,r as ae,t as oe}from"./pagination-nJ5-cNtZ.js";import{t as se}from"./ApiCodeButton-CAEaiAmy.js";import{t as ce}from"./BotPlaceholder-DXtf3RgL.js";import{t as le}from"./ImageWrapper-Cq0Rze0S.js";var ue=_({name:`LayoutFlux`,components:{MagicIcon:P,ElDrawer:C,ElButton:L},mixins:[E]}),de={class:`main flex flex-row flex-1`},fe={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},pe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function me(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,de,[e(`div`,fe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,pe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var he=I(ue,[[`render`,me],[`__scopeId`,`data-v-72e82d52`]]),ge=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`flux-dev`,label:`flux-dev`},{value:`flux-pro`,label:`flux-pro`},{value:`flux-kontext-pro`,label:`flux-kontext-pro`},{value:`flux-kontext-max`,label:`flux-kontext-max`},{value:`flux-2-flex`,label:`flux-2-flex`},{value:`flux-2-pro`,label:`flux-2-pro`},{value:`flux-2-max`,label:`flux-2-max`}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||=ee}}),_e={class:`field`},ve={class:`title font-bold`};function ye(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,_e,[e(`h2`,ve,i(t.$t(`flux.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var be=I(ge,[[`render`,ye],[`__scopeId`,`data-v-e9b17945`]]),xe=_({name:`CountSelector`,components:{ElSlider:T,InfoIcon:Q,ElInputNumber:w},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug(`set count`,e),this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||=1}}),Se={class:`flex justify-between`},Ce={class:`flex justify-start items-center`},we={class:`text-sm font-bold`},Te={class:`flex justify-end items-center`},Ee={class:`w-full`};function De(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return h(),s(`div`,null,[e(`div`,Se,[e(`div`,Ce,[e(`span`,we,i(t.$t(`flux.name.numbers`)),1),a(d,{content:t.$t(`flux.description.numbers`)},null,8,[`content`])]),e(`div`,Te,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Ee,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:1,max:4,step:1},null,8,[`modelValue`])])])}var Oe=I(xe,[[`render`,De]]),ke=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`generate`,label:this.$t(`flux.name.generate`)},{value:`edits`,label:this.$t(`flux.name.edits`)}]}},computed:{value:{get(){return this.$store.state.flux?.config?.action},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,action:e})}}},mounted(){this.value||=F}}),Ae={class:`field`},je={class:`title font-bold`};function Me(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ae,[e(`h2`,je,i(t.$t(`flux.name.task`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ne=I(ke,[[`render`,Me],[`__scopeId`,`data-v-81fd05e5`]]),Pe=_({name:`ImageUrlInput`,components:{UploadIcon:N,ElUpload:b,ElButton:L,InfoIcon:Q,ImagePreview:Z},mixins:[U,V,H],emits:[`change`],data(){return{fileList:[],uploadUrl:K()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{urls:{handler(e){console.debug(`URLs changed:`,e),this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,image_url:e[0]})}}},methods:{onExceed(){J.warning(this.$t(`flux.message.uploadStartImageExceed`))},onError(){J.error(this.$t(`flux.message.uploadStartImageError`))}}}),Fe={class:`relative`},Ie={class:`flex justify-between`},Le={class:`flex justify-start items-center`},Re={class:`text-sm font-bold`};function ze(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`image-preview`),g=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`);return h(),s(`div`,Fe,[e(`div`,Ie,[e(`div`,Le,[e(`span`,Re,i(t.$t(`flux.name.imageUrl`)),1),a(f,{content:t.$t(`flux.description.imageUrl`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,limit:5,class:`upload-wrapper`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,multiple:!0,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,headers:t.headers},{file:p(({file:e})=>[a(m,{url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])]),default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(g,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`flux.button.uploadImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`headers`])])}var Be=I(Pe,[[`render`,ze],[`__scopeId`,`data-v-2e7e6966`]]),Ve=_({name:`PromptInput`,components:{PromptTextarea:k},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||=``}});function He(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`flux.name.prompt`),info:e.$t(`flux.description.prompt`),placeholder:e.$t(`flux.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ue=I(Ve,[[`render`,He]]),We=_({name:`SizeSelector`,components:{ElSelect:v,ElOption:y},data(){return{options:te}},computed:{value:{get(){return this.$store.state.flux?.config?.size},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,size:e})}}},mounted(){this.value||=`1:1`}}),Ge={class:`field`},Ke={class:`title font-bold`};function qe(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ge,[e(`h2`,Ke,i(t.$t(`flux.name.ratio`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Je=_({name:`PresetPanel`,components:{MagicIcon:P,ElButton:L,PromptInput:Ue,ModelSelector:be,CountSelector:Oe,Consumption:re,ActionSelector:Ne,ImageUrlInput:Be,SizeSelector:I(We,[[`render`,qe],[`__scopeId`,`data-v-8c58dc91`]])},emits:[`generate`],computed:{config(){return this.$store.state.flux?.config},consumption(){return z(this.config,this.service?.cost)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ye={class:`flex flex-col h-full`},Xe={class:`flex-1 overflow-y-auto p-5`},Ze={class:`flex flex-col items-center justify-center px-5 pb-5`};function Qe(t,n,c,u,d,m){let g=l(`action-selector`),_=l(`prompt-input`),v=l(`image-url-input`),y=l(`model-selector`),b=l(`size-selector`),x=l(`count-selector`),S=l(`consumption`),C=l(`magic-icon`),w=l(`el-button`);return h(),s(`div`,Ye,[e(`div`,Xe,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.config?.action===`edits`?(h(),f(v,{key:0,class:`mb-4`})):o(``,!0),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`})]),e(`div`,Ze,[a(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(C,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`flux.button.generate`)),1)]),_:1},8,[`onClick`])])])}var $e=I(Je,[[`render`,Qe]]),et=_({name:`TaskPreview`,components:{DeleteIcon:j,ElTooltip:x,ChannelIcon:O,InfoIcon:A,MagicIcon:P,TimeIcon:D,WarningIcon:M,CopyToClipboard:X,ElAlert:S,ImageWrapper:le,ApiCodeButton:se},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[],t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(n=>{let r=n;t&&(r.action=t),e.push(r)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await G.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`flux/deleteTask`,{id:e}),J.success(this.$t(`common.message.deleteTaskSuccess`))}catch{J.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenImage(e){window.open(e,`_blank`)}}}),tt={class:`preview`},nt={class:`left`},rt={class:`main`},it={class:`bot`},at={class:`datetime`},ot=[`aria-label`],st={class:`info`},ct={key:0,class:`prompt mt-2`},lt={key:0},ut={key:0,class:n({content:!0,failed:!0})},dt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},ft={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ht={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},gt={key:1,class:n({content:!0})},_t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bt={key:2,class:n({content:!0})},xt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function St(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-wrapper`),C=l(`api-code-button`),w=l(`channel-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`time-icon`),O=l(`el-alert`),k=l(`warning-icon`),A=l(`info-icon`);return h(),s(`div`,tt,[e(`div`,nt,[a(y,{capability:`flux`,part:`avatar`,class:`avatar`})]),e(`div`,rt,[e(`div`,it,[a(y,{capability:`flux`,part:`name`}),e(`span`,at,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ot)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,st,[n.modelValue?.request?.prompt?(h(),s(`p`,ct,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,lt,` - (`+i(n.$t(`flux.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,ut,[e(`div`,dt,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(S,{key:t,src:e?.image_url,"raw-src":e?.image_url,"model-value":e},null,8,[`src`,`raw-src`,`model-value`]))),128))]),e(`div`,ft,[a(C,{path:`/flux/images`,body:n.modelValue?.request},null,8,[`body`])]),a(O,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,pt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.model`))+`: `+i(n.modelValue?.request?.model),1)]),e(`p`,mt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,ht,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===!1?(h(),s(`div`,gt,[a(O,{closable:!1,class:`failure`},{template:p(()=>[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.failure`)),1)]),default:p(()=>[e(`p`,_t,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,vt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(E,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,yt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,$,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0),n.modelValue?.response?o(``,!0):(h(),s(`div`,bt,[a(O,{closable:!1,class:`info`},{template:p(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.status.pending`)),1)]),default:p(()=>[e(`p`,xt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Ct=_({name:`RecentPanel`,components:{TaskPreview:I(et,[[`render`,St],[`__scopeId`,`data-v-6df6d58d`]]),BotPlaceholder:ce,NoTasks:ae,ScrollList:ie},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),wt={key:0},Tt={key:2,class:`w-full h-full flex items-center justify-center`};function Et(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,wt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{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:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Tt,[a(v)])):o(``,!0)],64)}var Dt=_({name:`FluxIndex`,components:{ConfigPanel:$e,Layout:he,RecentPanel:I(Ct,[[`render`,Et]])},mixins:[R],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.flux?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.flux?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.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 oe({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(`flux/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`flux/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(`flux/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ne(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;let e={...this.config,async:!0};if(!q())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}J.info(this.$t(`flux.message.startingTask`)),Y(`flux`,B.generate(e,{token:t})).then(()=>{J.success(this.$t(`flux.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?J.error(this.$t(`flux.message.usedUp`)):J.error(this.$t(`flux.message.startTaskFailed`)+t?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ot(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),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 kt=I(Dt,[[`render`,Ot]]);export{kt 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,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-CdcJAtHh.js";import{t as b}from"./upload-DsZRTIWs.js";import{t as x}from"./tooltip-DiVzh1Gl.js";import{t as S}from"./alert-C2k9KG3u.js";import{t as C}from"./drawer-CO9biQiP.js";import{t as w}from"./input-number-B3DaETfk.js";import{t as T}from"./slider-6SnO3LqD.js";import{n as E}from"./taskDrawerMixin-Brfmzrs4.js";import{t as D}from"./clock-Dvb0weei.js";import{r as O,t as k}from"./PromptTextarea-D7mWl00Q.js";import{t as A}from"./info-itWy-wlR.js";import{t as j}from"./trash-2-Dg3Af9lM.js";import{t as M}from"./triangle-alert-uPbdNKT7.js";import{t as N}from"./upload-BUi4Qlhm.js";import{t as P}from"./wand-sparkles-BWwUTBQt.js";import{cr as F,lr as ee,sr as te}from"./constants-ChRYidMs.js";import{Bt as ne,E as I,Fi as L,Ht as R,Kt as z,Rn as B,Ut as V,Vt as H,Wt as U,ai as W,bi as G,ci as K,tn as q,xi as J,yr as Y}from"./index-UTshJlN_.js";import{t as X}from"./CopyToClipboard-BYSbcBiV.js";import{t as Z}from"./ImagePreview-CLg15kJw.js";import{t as re}from"./Consumption-LBlIroNB.js";import{a as Q,n as ie,r as ae,t as oe}from"./pagination-DgHqjd1Q.js";import{t as se}from"./ApiCodeButton-C-xAzxv_.js";import{t as ce}from"./BotPlaceholder-DdR_2tLl.js";import{t as le}from"./ImageWrapper-oBMaRLkF.js";var ue=_({name:`LayoutFlux`,components:{MagicIcon:P,ElDrawer:C,ElButton:L},mixins:[E]}),de={class:`main flex flex-row flex-1`},fe={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},pe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function me(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,de,[e(`div`,fe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,pe,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var he=I(ue,[[`render`,me],[`__scopeId`,`data-v-72e82d52`]]),ge=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`flux-dev`,label:`flux-dev`},{value:`flux-pro`,label:`flux-pro`},{value:`flux-kontext-pro`,label:`flux-kontext-pro`},{value:`flux-kontext-max`,label:`flux-kontext-max`},{value:`flux-2-flex`,label:`flux-2-flex`},{value:`flux-2-pro`,label:`flux-2-pro`},{value:`flux-2-max`,label:`flux-2-max`}]}},computed:{value:{get(){return this.$store.state.flux?.config?.model},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,model:e})}}},mounted(){this.value||=ee}}),_e={class:`field`},ve={class:`title font-bold`};function ye(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,_e,[e(`h2`,ve,i(t.$t(`flux.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var be=I(ge,[[`render`,ye],[`__scopeId`,`data-v-e9b17945`]]),xe=_({name:`CountSelector`,components:{ElSlider:T,InfoIcon:Q,ElInputNumber:w},computed:{value:{get(){return this.$store.state.flux?.config?.count},set(e){console.debug(`set count`,e),this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,count:e})}}},mounted(){this.value||=1}}),Se={class:`flex justify-between`},Ce={class:`flex justify-start items-center`},we={class:`text-sm font-bold`},Te={class:`flex justify-end items-center`},Ee={class:`w-full`};function De(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return h(),s(`div`,null,[e(`div`,Se,[e(`div`,Ce,[e(`span`,we,i(t.$t(`flux.name.numbers`)),1),a(d,{content:t.$t(`flux.description.numbers`)},null,8,[`content`])]),e(`div`,Te,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Ee,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:1,max:4,step:1},null,8,[`modelValue`])])])}var Oe=I(xe,[[`render`,De]]),ke=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`generate`,label:this.$t(`flux.name.generate`)},{value:`edits`,label:this.$t(`flux.name.edits`)}]}},computed:{value:{get(){return this.$store.state.flux?.config?.action},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,action:e})}}},mounted(){this.value||=F}}),Ae={class:`field`},je={class:`title font-bold`};function Me(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ae,[e(`h2`,je,i(t.$t(`flux.name.task`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ne=I(ke,[[`render`,Me],[`__scopeId`,`data-v-81fd05e5`]]),Pe=_({name:`ImageUrlInput`,components:{UploadIcon:N,ElUpload:b,ElButton:L,InfoIcon:Q,ImagePreview:Z},mixins:[U,V,H],emits:[`change`],data(){return{fileList:[],uploadUrl:K()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},watch:{urls:{handler(e){console.debug(`URLs changed:`,e),this.$store.commit(`flux/setConfig`,{...this.$store.state.flux.config,image_url:e[0]})}}},methods:{onExceed(){J.warning(this.$t(`flux.message.uploadStartImageExceed`))},onError(){J.error(this.$t(`flux.message.uploadStartImageError`))}}}),Fe={class:`relative`},Ie={class:`flex justify-between`},Le={class:`flex justify-start items-center`},Re={class:`text-sm font-bold`};function ze(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`image-preview`),g=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`);return h(),s(`div`,Fe,[e(`div`,Ie,[e(`div`,Le,[e(`span`,Re,i(t.$t(`flux.name.imageUrl`)),1),a(f,{content:t.$t(`flux.description.imageUrl`)},null,8,[`content`])])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,limit:5,class:`upload-wrapper`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,multiple:!0,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,headers:t.headers},{file:p(({file:e})=>[a(m,{url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])]),default:p(()=>[a(_,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(g,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`flux.button.uploadImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`headers`])])}var Be=I(Pe,[[`render`,ze],[`__scopeId`,`data-v-2e7e6966`]]),Ve=_({name:`PromptInput`,components:{PromptTextarea:k},computed:{prompt:{get(){return this.$store.state.flux?.config?.prompt},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,prompt:e})}}},mounted(){this.prompt||=``}});function He(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`flux.name.prompt`),info:e.$t(`flux.description.prompt`),placeholder:e.$t(`flux.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ue=I(Ve,[[`render`,He]]),We=_({name:`SizeSelector`,components:{ElSelect:v,ElOption:y},data(){return{options:te}},computed:{value:{get(){return this.$store.state.flux?.config?.size},set(e){this.$store.commit(`flux/setConfig`,{...this.$store.state.flux?.config,size:e})}}},mounted(){this.value||=`1:1`}}),Ge={class:`field`},Ke={class:`title font-bold`};function qe(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Ge,[e(`h2`,Ke,i(t.$t(`flux.name.ratio`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`flux.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(g,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Je=_({name:`PresetPanel`,components:{MagicIcon:P,ElButton:L,PromptInput:Ue,ModelSelector:be,CountSelector:Oe,Consumption:re,ActionSelector:Ne,ImageUrlInput:Be,SizeSelector:I(We,[[`render`,qe],[`__scopeId`,`data-v-8c58dc91`]])},emits:[`generate`],computed:{config(){return this.$store.state.flux?.config},consumption(){return z(this.config,this.service?.cost)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ye={class:`flex flex-col h-full`},Xe={class:`flex-1 overflow-y-auto p-5`},Ze={class:`flex flex-col items-center justify-center px-5 pb-5`};function Qe(t,n,c,u,d,m){let g=l(`action-selector`),_=l(`prompt-input`),v=l(`image-url-input`),y=l(`model-selector`),b=l(`size-selector`),x=l(`count-selector`),S=l(`consumption`),C=l(`magic-icon`),w=l(`el-button`);return h(),s(`div`,Ye,[e(`div`,Xe,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.config?.action===`edits`?(h(),f(v,{key:0,class:`mb-4`})):o(``,!0),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`})]),e(`div`,Ze,[a(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(C,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`flux.button.generate`)),1)]),_:1},8,[`onClick`])])])}var $e=I(Je,[[`render`,Qe]]),et=_({name:`TaskPreview`,components:{DeleteIcon:j,ElTooltip:x,ChannelIcon:O,InfoIcon:A,MagicIcon:P,TimeIcon:D,WarningIcon:M,CopyToClipboard:X,ElAlert:S,ImageWrapper:le,ApiCodeButton:se},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.flux?.application},config(){return this.$store.state.flux?.config},images(){let e=[],t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(n=>{let r=n;t&&(r.action=t),e.push(r)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await G.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`flux/deleteTask`,{id:e}),J.success(this.$t(`common.message.deleteTaskSuccess`))}catch{J.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenImage(e){window.open(e,`_blank`)}}}),tt={class:`preview`},nt={class:`left`},rt={class:`main`},it={class:`bot`},at={class:`datetime`},ot=[`aria-label`],st={class:`info`},ct={key:0,class:`prompt mt-2`},lt={key:0},ut={key:0,class:n({content:!0,failed:!0})},dt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},ft={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ht={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},gt={key:1,class:n({content:!0})},_t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bt={key:2,class:n({content:!0})},xt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function St(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-wrapper`),C=l(`api-code-button`),w=l(`channel-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`time-icon`),O=l(`el-alert`),k=l(`warning-icon`),A=l(`info-icon`);return h(),s(`div`,tt,[e(`div`,nt,[a(y,{capability:`flux`,part:`avatar`,class:`avatar`})]),e(`div`,rt,[e(`div`,it,[a(y,{capability:`flux`,part:`name`}),e(`span`,at,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ot)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,st,[n.modelValue?.request?.prompt?(h(),s(`p`,ct,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,lt,` - (`+i(n.$t(`flux.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,ut,[e(`div`,dt,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(S,{key:t,src:e?.image_url,"raw-src":e?.image_url,"model-value":e},null,8,[`src`,`raw-src`,`model-value`]))),128))]),e(`div`,ft,[a(C,{path:`/flux/images`,body:n.modelValue?.request},null,8,[`body`])]),a(O,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,pt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.model`))+`: `+i(n.modelValue?.request?.model),1)]),e(`p`,mt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,ht,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===!1?(h(),s(`div`,gt,[a(O,{closable:!1,class:`failure`},{template:p(()=>[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.failure`)),1)]),default:p(()=>[e(`p`,_t,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,vt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(E,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,yt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,$,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0),n.modelValue?.response?o(``,!0):(h(),s(`div`,bt,[a(O,{closable:!1,class:`info`},{template:p(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.status.pending`)),1)]),default:p(()=>[e(`p`,xt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Ct=_({name:`RecentPanel`,components:{TaskPreview:I(et,[[`render`,St],[`__scopeId`,`data-v-6df6d58d`]]),BotPlaceholder:ce,NoTasks:ae,ScrollList:ie},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.flux?.tasks,items:this.$store.state.flux?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),wt={key:0},Tt={key:2,class:`w-full h-full flex items-center justify-center`};function Et(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,wt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{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:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Tt,[a(v)])):o(``,!0)],64)}var Dt=_({name:`FluxIndex`,components:{ConfigPanel:$e,Layout:he,RecentPanel:I(Ct,[[`render`,Et]])},mixins:[R],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.flux?.status?.getApplications===W.Request},tasksLoading(){return this.$store.state.flux?.status?.getTasks===W.Request||this.fetchingTasks},credential(){return this.$store.state.flux?.credential},config(){return this.$store.state.flux?.config},application(){return this.$store.state.flux?.application},tasks(){return this.$store.state.flux?.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 oe({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(`flux/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`flux/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(`flux/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ne(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;let e={...this.config,async:!0};if(!q())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}J.info(this.$t(`flux.message.startingTask`)),Y(`flux`,B.generate(e,{token:t})).then(()=>{J.success(this.$t(`flux.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?J.error(this.$t(`flux.message.usedUp`)):J.error(this.$t(`flux.message.startTaskFailed`)+t?.error?.message)}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ot(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),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 kt=I(Dt,[[`render`,Ot]]);export{kt as default};