@acedatacloud/nexior 3.354.2 → 3.354.3

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 (249) hide show
  1. package/dist/assets/{ApiCodeButton-DBpwradV.js → ApiCodeButton-CqlibmjN.js} +1 -1
  2. package/dist/assets/{Artifacts-BN_I8OIm.js → Artifacts-Yqto-4_W.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-moYmREED.js → AskUserQuestionCard-BMHaeS3D.js} +1 -1
  4. package/dist/assets/{Auth-DHO4Fgq0.js → Auth-zvAsz1He.js} +1 -1
  5. package/dist/assets/{Bare-SEMJLEE8.js → Bare-ZFbwkAYG.js} +1 -1
  6. package/dist/assets/{BotPlaceholder-CQECCUDa.js → BotPlaceholder-99Dh87EM.js} +1 -1
  7. package/dist/assets/{BottomFooter-DcTiKMfz.js → BottomFooter-Br0sQb6w.js} +1 -1
  8. package/dist/assets/{BrowserPairingDialog-DFSh0f4m.js → BrowserPairingDialog-BaeAKWjm.js} +1 -1
  9. package/dist/assets/{Callback-GCKN6zfe.js → Callback-BzL9oC23.js} +1 -1
  10. package/dist/assets/{CodeSnippet-B6UdB6--.js → CodeSnippet-B9_RpeXE.js} +1 -1
  11. package/dist/assets/{Console-MkUwQDTb.js → Console-NLyonTjG.js} +1 -1
  12. package/dist/assets/{Consumption-DSV6Ajvn.js → Consumption-Bt_7Xwm9.js} +1 -1
  13. package/dist/assets/Conversation-CA6VWzAh.css +1 -0
  14. package/dist/assets/{Conversation-B9K8CpD1.js → Conversation-bIPSS8mW.js} +1 -1
  15. package/dist/assets/Conversation-vsVi8Cn1.js +1 -0
  16. package/dist/assets/{CopyToClipboard-8zEkaydk.js → CopyToClipboard-DJUH_cOj.js} +1 -1
  17. package/dist/assets/{Detail-D_Vgrzzb.js → Detail-DXkcd5yA.js} +2 -2
  18. package/dist/assets/{Extra-B3HE0lFN.js → Extra-CgEwzhB4.js} +1 -1
  19. package/dist/assets/{FilePreview-XQJwBnH1.js → FilePreview-BCgkMmld.js} +1 -1
  20. package/dist/assets/{Hailuo-CJ5BqX3W.js → Hailuo-DeOr6CUH.js} +1 -1
  21. package/dist/assets/{History-zzpBPNFv.js → History-COaocpoC.js} +1 -1
  22. package/dist/assets/{ImagePreview-aup3tBhe.js → ImagePreview-SnY13jKc.js} +1 -1
  23. package/dist/assets/{ImageWrapper-lBDb2gpG.js → ImageWrapper-DQUTRMZA.js} +1 -1
  24. package/dist/assets/{Index-BQeqty8C.js → Index-1i0wGbtq.js} +1 -1
  25. package/dist/assets/{Index-lBq0FPfV.js → Index-5AFwKI0O.js} +1 -1
  26. package/dist/assets/{Index-QNsw1suM.js → Index-AShSKSla.js} +1 -1
  27. package/dist/assets/{Index-DqavUCop2.js → Index-BBaHrNaf2.js} +1 -1
  28. package/dist/assets/{Index-BAHXzE6V.js → Index-BDQfjVbx.js} +1 -1
  29. package/dist/assets/{Index-BFgrfMUR2.js → Index-BQygSZ2b2.js} +1 -1
  30. package/dist/assets/{Index-CKeXp3JD.js → Index-BWB6aYVl.js} +1 -1
  31. package/dist/assets/{Index-1q3HSySk.js → Index-BZ4Wh6v1.js} +1 -1
  32. package/dist/assets/{Index-ByCto-YM.js → Index-BZ5iO5Ws.js} +1 -1
  33. package/dist/assets/{Index-Cxrt2zTY.js → Index-BdEojQxN.js} +1 -1
  34. package/dist/assets/{Index-BEQoyg5t.js → Index-BkJEh_Yi.js} +1 -1
  35. package/dist/assets/{Index-Dw5Um8hH.js → Index-C1Ym22M2.js} +1 -1
  36. package/dist/assets/{Index-BWVbtNcz.js → Index-CMxTrbZZ.js} +1 -1
  37. package/dist/assets/{Index-DkzOiEX3.js → Index-CTsuEkG4.js} +1 -1
  38. package/dist/assets/{Index-BPisd00-.js → Index-Cc-wkG9q.js} +1 -1
  39. package/dist/assets/{Index-iiw719ES.js → Index-CnQXs58y.js} +1 -1
  40. package/dist/assets/{Index-C5HKZtXA.js → Index-Co2xVQyg.js} +1 -1
  41. package/dist/assets/{Index-Bf_HiDMM2.js → Index-CoSIj7pk2.js} +1 -1
  42. package/dist/assets/{Index-kujvSctT.js → Index-D7JmMaXJ.js} +1 -1
  43. package/dist/assets/{Index-BFBeTRXW2.js → Index-D7tNasWK2.js} +1 -1
  44. package/dist/assets/{Index-DpSQWaZW.js → Index-DDQKwJX5.js} +1 -1
  45. package/dist/assets/{Index-BzoULQtA.js → Index-DGOs8QnF.js} +1 -1
  46. package/dist/assets/{Index-DNVDr6SG.js → Index-DKeJJI5g.js} +1 -1
  47. package/dist/assets/{Index-Bf6OokPe.js → Index-DQcVVDyq.js} +1 -1
  48. package/dist/assets/{Index-BJbm7W352.js → Index-D_uhlE6g2.js} +1 -1
  49. package/dist/assets/{Index-B0dEo-WG.js → Index-Dmg3mFOZ.js} +1 -1
  50. package/dist/assets/{Index-DClahNrz.js → Index-DpmDR1Hz.js} +1 -1
  51. package/dist/assets/{Index-DV8RTz9K.js → Index-U2OJSixM.js} +1 -1
  52. package/dist/assets/{Index-OfG3Mawj.js → Index-XOsLY8bF.js} +1 -1
  53. package/dist/assets/{Index-B-qMnpn9.js → Index-mH9zvnQ2.js} +1 -1
  54. package/dist/assets/{Index-BOuS0HUe.js → Index-nruxnvmG.js} +1 -1
  55. package/dist/assets/{Index-RRZPUSGm.js → Index-pxx98I2R.js} +1 -1
  56. package/dist/assets/{Index-D8Lr46U-.js → Index-tGKFuIou.js} +1 -1
  57. package/dist/assets/{Invitees-BBE2lDHm.js → Invitees-Byt99HyB.js} +1 -1
  58. package/dist/assets/{List-DB7iEz8C.js → List-B0kF9asy.js} +1 -1
  59. package/dist/assets/{List-DE3JH75Q.js → List-D-SnLtzb.js} +1 -1
  60. package/dist/assets/{List-BzRjQ5o6.js → List-KVKcaEjY.js} +1 -1
  61. package/dist/assets/{LocalTools-CSIlXNlX.js → LocalTools-BcZbuVOX.js} +1 -1
  62. package/dist/assets/{LocalTools-Ci5PheIe.js → LocalTools-CUacRpxP.js} +1 -1
  63. package/dist/assets/{Logo-BhHIOuGz.js → Logo-BupzFzhb.js} +1 -1
  64. package/dist/assets/{Main-EGVifQsz.js → Main-WOQK5Kw8.js} +1 -1
  65. package/dist/assets/{Message-CpEOXmPy.js → Message-DpeKhyLL.js} +1 -1
  66. package/dist/assets/{Model-DAGzQdc2.js → Model-CeiYbxPj.js} +1 -1
  67. package/dist/assets/{Navigator-G9f3sEX4.js → Navigator-Bw2ijcI7.js} +3 -3
  68. package/dist/assets/{NotFound-9myRRWpx.js → NotFound-kkR8KlrK.js} +1 -1
  69. package/dist/assets/{PageHeader-S4BgUVFm.js → PageHeader-BWDEe6fA.js} +1 -1
  70. package/dist/assets/{Pay-wiJbt9p8.js → Pay-B6SKV_Jg.js} +1 -1
  71. package/dist/assets/{Player-CE8xtvx0.js → Player-B8ZOjF3a.js} +1 -1
  72. package/dist/assets/{Poivelle-DT0tFnbx.js → Poivelle-BlUnvVAl.js} +1 -1
  73. package/dist/assets/{RealtimeCall-DN5mC30I.js → RealtimeCall-CUu3qJow.js} +1 -1
  74. package/dist/assets/{ReportButton-C3Kjfp0k.js → ReportButton-_V9tUFQF.js} +1 -1
  75. package/dist/assets/{ReportDialog-Ckf1pn-Y.js → ReportDialog-Q7vBTAWc.js} +1 -1
  76. package/dist/assets/{ScheduledTasks-Bwjnd1wA.js → ScheduledTasks-Bo6yqfUk.js} +1 -1
  77. package/dist/assets/{Status-CK1tpfO3.js → Status-8lkiP5lh.js} +1 -1
  78. package/dist/assets/{Subscribe-BkwcAuOR.js → Subscribe-D63D5NBG.js} +1 -1
  79. package/dist/assets/{TabSwitcher-nppNBwGO.js → TabSwitcher-D79yicp2.js} +1 -1
  80. package/dist/assets/{Tts-7cf4QX5b.js → Tts-CMDvvQA9.js} +1 -1
  81. package/dist/assets/{VideoPlayer-DOF-WUP8.js → VideoPlayer-DmVZVRbd.js} +1 -1
  82. package/dist/assets/{VideoPreview-o1E0AjIB.js → VideoPreview-DOCg7hus.js} +1 -1
  83. package/dist/assets/arrow-down-BckRObNS.js +1 -0
  84. package/dist/assets/{arrow-down-wide-narrow-Cg4SkNzC.js → arrow-down-wide-narrow-C4zSYY9O.js} +1 -1
  85. package/dist/assets/arrow-left--b-lvFMl.js +1 -0
  86. package/dist/assets/arrow-right-AL7wQatT.js +1 -0
  87. package/dist/assets/arrow-up-CvvD18wV.js +1 -0
  88. package/dist/assets/{authorizeFlow-RI7CiShm.js → authorizeFlow-DaFbo5WX.js} +1 -1
  89. package/dist/assets/{avatar-CmIuXslT.js → avatar-tX6mrN3k.js} +1 -1
  90. package/dist/assets/{basic-D5BElZrc.js → basic-BRXqi7D9.js} +1 -1
  91. package/dist/assets/{book-open-0F9XtSTW.js → book-open-CRcAbnX9.js} +1 -1
  92. package/dist/assets/{box-CyVbYdiI.js → box-DHRJ9mGk.js} +1 -1
  93. package/dist/assets/{boxes-JDvIW6mk.js → boxes-DFqEth2N.js} +1 -1
  94. package/dist/assets/{brain-C6tI4QPB.js → brain-eMue03DX.js} +1 -1
  95. package/dist/assets/{chart-no-axes-combined-CQUiQ2q5.js → chart-no-axes-combined-Dt4CivZy.js} +1 -1
  96. package/dist/assets/{chat-BbykEPzO.js → chat-Cm5ct_sf.js} +1 -1
  97. package/dist/assets/check-BcbZxwvp.js +1 -0
  98. package/dist/assets/chevron-down-0b7gbE33.js +1 -0
  99. package/dist/assets/chevron-right-C2NP_En7.js +1 -0
  100. package/dist/assets/circle-check-BaQd9ySi.js +1 -0
  101. package/dist/assets/{circle-question-mark-DQX5fqor.js → circle-question-mark-CAG5ToFx.js} +1 -1
  102. package/dist/assets/{clipboard-list-sEzrqgvT.js → clipboard-list-C7G9q5pZ.js} +1 -1
  103. package/dist/assets/clock-B1CCVLmO.js +1 -0
  104. package/dist/assets/code-CxpYZUUI.js +1 -0
  105. package/dist/assets/{codingBridge-DZVa4JcA.js → codingBridge-Bc_fEEHc.js} +1 -1
  106. package/dist/assets/{codingBridgeNotify-BCzK-U4r.js → codingBridgeNotify-B-lI_C9K.js} +2 -2
  107. package/dist/assets/{coins-BWfK9pwK.js → coins-BLPidTVH.js} +1 -1
  108. package/dist/assets/{copy-D6HjVrQb.js → copy-LurMPPHR.js} +1 -1
  109. package/dist/assets/{createTaskActions-BQjWPsBy.js → createTaskActions-BA2pp_7_.js} +1 -1
  110. package/dist/assets/{digitalhuman-CzgLityC.js → digitalhuman-BkXvifcL.js} +1 -1
  111. package/dist/assets/{dollar-sign-D1JlE3Qq.js → dollar-sign-CIOB_P1_.js} +1 -1
  112. package/dist/assets/{download-DmuXVNjZ.js → download-CvhqvkVu.js} +1 -1
  113. package/dist/assets/{drawer-lPnIZOSX.js → drawer-CA6SUQCX.js} +1 -1
  114. package/dist/assets/{dropdown-Bl565zff.js → dropdown-DHCxtky3.js} +1 -1
  115. package/dist/assets/{dropdown-YWpfH9NS.js → dropdown-D_BJG-Rl.js} +1 -1
  116. package/dist/assets/{ellipsis-Ds5fAlBh.js → ellipsis-Ds1gKJkv.js} +1 -1
  117. package/dist/assets/{esm-s6Q4Fsqb.js → esm-B9QSHyKv.js} +2 -2
  118. package/dist/assets/{esm-_IKhn2RN.js → esm-BIdS-q8V.js} +2 -2
  119. package/dist/assets/{esm-DsSMUZQE.js → esm-BJTzZlDP.js} +1 -1
  120. package/dist/assets/{esm-DZQIB2ED.js → esm-Bhlly4NJ.js} +1 -1
  121. package/dist/assets/{esm-F1MFI31N.js → esm-DQuvXi2i.js} +3 -3
  122. package/dist/assets/{esm-BY1usF5z.js → esm-DUSRbYcN.js} +1 -1
  123. package/dist/assets/esm-DdI7aQQ_.js +1 -0
  124. package/dist/assets/{external-link-CZOcI9lI.js → external-link-C0EEtrom.js} +1 -1
  125. package/dist/assets/{eye-X_hS-zdv.js → eye-D7s55HUE.js} +1 -1
  126. package/dist/assets/{file-mZlNw7h5.js → file-QiZjwdHY.js} +1 -1
  127. package/dist/assets/{file-output-B4aemGYW.js → file-output-D93zHJXf.js} +1 -1
  128. package/dist/assets/{file-text-Dp5lZCAJ.js → file-text-nNeWua93.js} +1 -1
  129. package/dist/assets/{fish-DQzwNL-Y.js → fish-CLpUB_NQ.js} +1 -1
  130. package/dist/assets/{flux-BLyxBt2W.js → flux-CdNsebzZ.js} +1 -1
  131. package/dist/assets/{folder-CuxMjFwu.js → folder-Bz13cyIq.js} +1 -1
  132. package/dist/assets/gauge-DF9zFhZF.js +1 -0
  133. package/dist/assets/{globe-DOdwzYJs.js → globe-C2DK-V7Q.js} +1 -1
  134. package/dist/assets/{grokvideo-CtoPgRi4.js → grokvideo-CAXGhprQ.js} +1 -1
  135. package/dist/assets/{hailuo-D2UCJY9S.js → hailuo-CsXe_ndS.js} +1 -1
  136. package/dist/assets/{headphones-DQHuPAyA.js → headphones-Cq3J3vwI.js} +1 -1
  137. package/dist/assets/{history-FXb0xIZR.js → history-Dx2TZgxn.js} +1 -1
  138. package/dist/assets/{house-DXAfxZCY.js → house-C4rNChgN.js} +1 -1
  139. package/dist/assets/{image-BHmbUsfT.js → image-CQw24VOX.js} +1 -1
  140. package/dist/assets/{index-BK4q_lZQ.js → index-Dd6xXz4I.js} +3 -3
  141. package/dist/assets/{index.browser.esm-DM8NX0Dm.js → index.browser.esm-DTjFRxVj.js} +1 -1
  142. package/dist/assets/{index.es-DRwIzmE1.js → index.es-BUx50Sm_.js} +1 -1
  143. package/dist/assets/{info-DhXkijI-.js → info-W0vYXBmL.js} +1 -1
  144. package/dist/assets/{input-number-CScClEsg.js → input-number-DdR-1uzl.js} +1 -1
  145. package/dist/assets/{key-round-wWLIvvNM.js → key-round-BV_3iMlW.js} +1 -1
  146. package/dist/assets/{kling-DZ8XDc5h.js → kling-B1nsjSrx.js} +1 -1
  147. package/dist/assets/{languages-Br0TDzki.js → languages-CmUnR-ub.js} +1 -1
  148. package/dist/assets/{laptop-DRl7pRb5.js → laptop-C3BQ3pJo.js} +1 -1
  149. package/dist/assets/{lightbulb-dMQ7ZJnq.js → lightbulb-BejdHXRI.js} +1 -1
  150. package/dist/assets/{link-h42r0KnC.js → link-Dg2r6K-C.js} +1 -1
  151. package/dist/assets/loader-circle-DBK8Ua5P.js +1 -0
  152. package/dist/assets/{lock-DTu0VRQg.js → lock-Djy_MSbK.js} +1 -1
  153. package/dist/assets/{luma-GWUkrFn7.js → luma-rEJKOEit.js} +1 -1
  154. package/dist/assets/{maestro-CisZBKPm.js → maestro-CPYlu0Wr.js} +1 -1
  155. package/dist/assets/{mail-RDgekmEs.js → mail-Bz7oZFLl.js} +1 -1
  156. package/dist/assets/{message-circle-BgmozKQL.js → message-circle-p9rDVK4V.js} +1 -1
  157. package/dist/assets/{mic-Si6D9wJ_.js → mic-SRt1-rL_.js} +1 -1
  158. package/dist/assets/{midjourney-kjpxc7op.js → midjourney-bLBNBjDd.js} +1 -1
  159. package/dist/assets/{mobileLocalExec-BTedJ09h.js → mobileLocalExec-ktBUwC-Z.js} +2 -2
  160. package/dist/assets/{monitor-CrEzv_XE.js → monitor-dV7UdPOA.js} +1 -1
  161. package/dist/assets/{mouse-pointer-2-DWAoXtpI.js → mouse-pointer-2-mrPhDd5u.js} +1 -1
  162. package/dist/assets/music-2-BNpx2g_L.js +1 -0
  163. package/dist/assets/{nanobanana-u2thuBZn.js → nanobanana-1B3G_3dP.js} +1 -1
  164. package/dist/assets/{omni-BeThKoIu.js → omni-Cqe6b2Ng.js} +1 -1
  165. package/dist/assets/{openaiimage-pFPtYvSK.js → openaiimage-28JUpO6J.js} +1 -1
  166. package/dist/assets/{pagination-ChtTmjw8.js → pagination-00UiqqPR.js} +1 -1
  167. package/dist/assets/{pagination-51ny6Oso.js → pagination-BnPTXcYn.js} +1 -1
  168. package/dist/assets/{pagination-C1Q3vk_A.js → pagination-Djw1UVAU.js} +1 -1
  169. package/dist/assets/{palette--Tp-cxFq.js → palette-9wJF0IB8.js} +1 -1
  170. package/dist/assets/{paperclip-CPmK5M-O.js → paperclip-BTouxXjG.js} +1 -1
  171. package/dist/assets/{pause-CZeGJIbt.js → pause-CDBia8Kv.js} +1 -1
  172. package/dist/assets/{pencil-CqtTzaRB.js → pencil-vAVeLpQW.js} +1 -1
  173. package/dist/assets/{pika-Czq407Fa.js → pika-CMExDBJW.js} +1 -1
  174. package/dist/assets/{pixverse-CxSwkfLM.js → pixverse-BpaUxcWW.js} +1 -1
  175. package/dist/assets/play-C5rBj3Jj.js +1 -0
  176. package/dist/assets/{plug-CKuTH8OG.js → plug-A1jYGsZm.js} +1 -1
  177. package/dist/assets/plus-DsRg1BTf.js +1 -0
  178. package/dist/assets/{poivelle-BkgbEjTt.js → poivelle-CVNeQwLT.js} +1 -1
  179. package/dist/assets/{popover-DcrsilIG.js → popover-CBet3DUP.js} +1 -1
  180. package/dist/assets/{producer-BxnN289B.js → producer-BPU9Jce2.js} +1 -1
  181. package/dist/assets/{qrart-C26DH78a.js → qrart-C1hppke6.js} +1 -1
  182. package/dist/assets/{realtime-DMPbZaWw.js → realtime-D2-XMelO.js} +1 -1
  183. package/dist/assets/{refresh-cw-B7Vr1bVU.js → refresh-cw-CfJJyz3I.js} +1 -1
  184. package/dist/assets/rotate-ccw-B3FifZlW.js +1 -0
  185. package/dist/assets/rotate-cw-C-a_lHeB.js +1 -0
  186. package/dist/assets/search-C431M-Ha.js +1 -0
  187. package/dist/assets/{seedance-B9StqJ65.js → seedance-xFpA9eoY.js} +1 -1
  188. package/dist/assets/{seedream-Bu8x6TRS.js → seedream-D8W0TFv_.js} +1 -1
  189. package/dist/assets/{select-B_LIRKEc.js → select-C_fIfZ2e.js} +1 -1
  190. package/dist/assets/{serp-Dk5xO8yr.js → serp-DlJxqrf4.js} +1 -1
  191. package/dist/assets/{shield-D69Ez7Kl.js → shield-CTmBJ3xD.js} +1 -1
  192. package/dist/assets/{shuffle-vhNhC6mn.js → shuffle-ea9MFFXt.js} +1 -1
  193. package/dist/assets/{slider-Dpo1vqOi.js → slider-DN9H320Q.js} +1 -1
  194. package/dist/assets/{solana-wallets-CtUb9y_w.js → solana-wallets-BKfYBTKF.js} +2 -2
  195. package/dist/assets/{solana-wallets-vue-e6DxMnsM.js → solana-wallets-vue-lJGaxnhx.js} +1 -1
  196. package/dist/assets/{sora-BVihmrda.js → sora-CXNwG9c9.js} +1 -1
  197. package/dist/assets/{sparkles-DhgToXFt.js → sparkles-nOUL6Js5.js} +1 -1
  198. package/dist/assets/square-BvM0pF3K.js +1 -0
  199. package/dist/assets/{store-bEf6tJnJ.js → store-DUc9wlG9.js} +1 -1
  200. package/dist/assets/{suno-qL_h54v3.js → suno-i3fdnqme.js} +1 -1
  201. package/dist/assets/{switch-BvCHyQIT.js → switch-f4qApZxt.js} +1 -1
  202. package/dist/assets/{table-fep0GPeI.js → table-Dr31J_DQ.js} +1 -1
  203. package/dist/assets/{tag-DnNFA4Xh.js → tag-v_4Ee1Rq.js} +1 -1
  204. package/dist/assets/terminal-Brb8WOO5.js +1 -0
  205. package/dist/assets/{time-picker-a5yCdCkb.js → time-picker-CKNqq9uN.js} +1 -1
  206. package/dist/assets/{tooltip-65yx4tvR.js → tooltip-BUacpHBv.js} +1 -1
  207. package/dist/assets/{trash-2-DtPyMpc8.js → trash-2-07x8oBrr.js} +1 -1
  208. package/dist/assets/{triangle-alert-DpLecGNq.js → triangle-alert-tdzQQL0N.js} +1 -1
  209. package/dist/assets/{upload-D2oHJ14J.js → upload-DGU-Zk4A.js} +1 -1
  210. package/dist/assets/user-CBWvPeJ5.js +1 -0
  211. package/dist/assets/{veo-DsLwa0nx.js → veo-CmpJbsOM.js} +1 -1
  212. package/dist/assets/{video-dRiFJtAJ.js → video-B6eldtMR.js} +1 -1
  213. package/dist/assets/{volume-2-CpXlGv3K.js → volume-2-YxcOCGbf.js} +1 -1
  214. package/dist/assets/{wallet-CVamGQFb.js → wallet-PNBGtsYd.js} +1 -1
  215. package/dist/assets/{wan-r52MPUS4.js → wan-CbJnPOkg.js} +1 -1
  216. package/dist/assets/{wand-sparkles--swdHIwq.js → wand-sparkles-DbvGGoZ2.js} +1 -1
  217. package/dist/assets/{web-CJOWch65.js → web-BgW7KPcH.js} +1 -1
  218. package/dist/assets/{web-BGdWZbCD.js → web-CcEtTQjj.js} +1 -1
  219. package/dist/assets/{web-D1hl5Srj.js → web-DaZ93D0w.js} +1 -1
  220. package/dist/assets/{web-p_Y_Ew7O.js → web-DzJgRlOd.js} +1 -1
  221. package/dist/assets/{web-BdbUUE4E.js → web-OYgR-ShM.js} +1 -1
  222. package/dist/assets/{webextrator-C2EwxgBt.js → webextrator-BGwKtYN8.js} +1 -1
  223. package/dist/assets/{zap-BxCVvy5i.js → zap-C1Tbanxu.js} +1 -1
  224. package/dist/index.html +1 -1
  225. package/package.json +1 -1
  226. package/dist/assets/Conversation-AiY5xqke.js +0 -1
  227. package/dist/assets/Conversation-CP1PCEGM.css +0 -1
  228. package/dist/assets/arrow-down-d6UvZwzn.js +0 -1
  229. package/dist/assets/arrow-left-CaNiYnHR.js +0 -1
  230. package/dist/assets/arrow-right-dMuTaNmA.js +0 -1
  231. package/dist/assets/arrow-up-h3Nh1oT3.js +0 -1
  232. package/dist/assets/check-DB_JQiwz.js +0 -1
  233. package/dist/assets/chevron-down-pztrXtC9.js +0 -1
  234. package/dist/assets/chevron-right-BkVpkAp9.js +0 -1
  235. package/dist/assets/circle-check-BDOvHQrP.js +0 -1
  236. package/dist/assets/clock-picb7ciF.js +0 -1
  237. package/dist/assets/code-BUN-R9JK.js +0 -1
  238. package/dist/assets/esm-DTb60onT.js +0 -1
  239. package/dist/assets/gauge-DcU14DH7.js +0 -1
  240. package/dist/assets/loader-circle-F3rw-TI6.js +0 -1
  241. package/dist/assets/music-2-RQoAbcm8.js +0 -1
  242. package/dist/assets/play-B6COElhC.js +0 -1
  243. package/dist/assets/plus-DBkMhDy5.js +0 -1
  244. package/dist/assets/rotate-ccw-DSBoIYol.js +0 -1
  245. package/dist/assets/rotate-cw-4wUH2d0j.js +0 -1
  246. package/dist/assets/search-oq_kx0AC.js +0 -1
  247. package/dist/assets/square-CPAkPKMI.js +0 -1
  248. package/dist/assets/terminal-DWcIA9cX.js +0 -1
  249. package/dist/assets/user-3uEbZ00a.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,P as c,T as l,at as u,ht as d,it as f,j as p,mt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-B_LIRKEc.js";import{t as x}from"./upload-CVDRsxmb.js";import{t as S}from"./tooltip-65yx4tvR.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-BKPWGzi5.js";import{n as E,r as D}from"./radio-BNhFzeBO.js";import{n as O,t as k}from"./collapse-Cn7VV0Rq.js";import{t as A}from"./drawer-lPnIZOSX.js";import{t as j}from"./input-number-CScClEsg.js";import{t as M}from"./progress-BuyYfFZn.js";import{t as N}from"./clock-picb7ciF.js";import{a as P,c as F,n as ee,o as te,r as ne,s as I,t as re}from"./pagination-51ny6Oso.js";import{t as ie}from"./info-DhXkijI-.js";import{t as ae}from"./music-2-RQoAbcm8.js";import{t as oe}from"./plus-DBkMhDy5.js";import{t as L}from"./trash-2-DtPyMpc8.js";import{t as R}from"./triangle-alert-DpLecGNq.js";import{t as se}from"./upload-D2oHJ14J.js";import{t as ce}from"./user-3uEbZ00a.js";import{t as le}from"./video-dRiFJtAJ.js";import{t as z}from"./wand-sparkles--swdHIwq.js";import{Cr as ue,Dr as de,Or as fe,Sr as B,wr as V,xr as pe}from"./constants-u1eIRuNz.js";import{$n as H,$t as me,Ei as he,Fi as U,Jt as ge,Mr as _e,O as W,Qt as ve,Ui as ye,en as be,in as xe,nn as Se,pn as Ce,si as we,tn as Te,xi as Ee,yi as De}from"./index-BK4q_lZQ.js";import{t as Oe}from"./CopyToClipboard-8zEkaydk.js";import{t as ke}from"./ReportButton-C3Kjfp0k.js";import{t as G}from"./ImagePreview-aup3tBhe.js";import{n as Ae}from"./taskDrawerMixin-DyAUhFEq.js";import{t as K}from"./Consumption-DSV6Ajvn.js";import{n as q,t as J}from"./VideoPreview-o1E0AjIB.js";import{t as je}from"./VideoPlayer-DOF-WUP8.js";import{t as Me}from"./ApiCodeButton-DBpwradV.js";import{t as Ne}from"./BotPlaceholder-CQECCUDa.js";var Pe=v({name:`LayoutDigitalHuman`,components:{UserIcon:ce,ElDrawer:A,ElButton:U},mixins:[Ae]}),Fe={class:`main flex flex-row flex-1`},Ie={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)]`},Le={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Re(t,n,r,i,o,c){let l=u(`user-icon`),p=u(`el-button`),h=u(`el-drawer`);return g(),s(`div`,Fe,[e(`div`,Ie,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,Le,[f(t.$slots,`result`,{},void 0,!0)]),d(a(p,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:m(()=>[f(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ze=W(Pe,[[`render`,Re],[`__scopeId`,`data-v-e912fd04`]]),Be=v({name:`DigitalHumanMediaInput`,components:{AudioPreview:q,CloseIcon:De,ElButton:U,ElProgress:M,ElUpload:x,ImagePreview:G,MusicIcon:ae,UploadIcon:se,VideoIcon:le,VideoPreview:J},mixins:[Se,Te,me,ge],props:{kind:{type:String,required:!0},accept:{type:String,default:``},buttonText:{type:String,default:``},hint:{type:String,default:``}},emits:[`change`],data(){return{fileList:[],uploadUrl:we()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},hasFile(){return this.fileList.length>0}},methods:{uploadedUrl(e){return e?.response?.file_url},isPending(e){return e.status===`ready`||e.status===`uploading`},onExceed(e){let t=this.$refs.uploader;t?.clearFiles();let n=e[0];n&&(t?.handleStart?.(n),t?.submit?.())},onError(){T.error(this.$t(`digitalhuman.message.uploadError`))},onRemoveFile(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),this.onChange()},onChange(){let e=this.fileList?.[0];this.$emit(`change`,e?this.uploadedUrl(e):void 0)}}}),Ve={class:`thumb`},He={key:2,class:`placeholder`},Ue=[`title`],We=[`aria-label`,`title`,`onClick`],Ge={key:0,class:`hint`};function Ke(c,d,f,h,_,v){let y=u(`image-preview`),b=u(`video-preview`),x=u(`audio-preview`),S=u(`el-progress`),C=u(`video-icon`),w=u(`music-icon`),T=u(`close-icon`),E=u(`upload-icon`),D=u(`el-button`),O=u(`el-upload`);return g(),p(O,{ref:`uploader`,"file-list":c.fileList,"onUpdate:fileList":d[0]||=e=>c.fileList=e,accept:c.accept,name:`file`,class:`media-input`,limit:1,multiple:!1,"before-upload":c.beforeUploadSizeGuard,action:c.uploadUrl,headers:c.headers,"on-exceed":c.onExceed,"on-error":c.onError,"on-success":c.onChange,"on-remove":c.onChange},{file:m(({file:r})=>[e(`div`,{class:n([`slot`,{pending:c.isPending(r)}])},[c.kind===`image`&&r.url?(g(),p(y,{key:0,url:r.url,name:r.name,percentage:r.percentage,onRemove:e=>c.onRemoveFile(r)},null,8,[`url`,`name`,`percentage`,`onRemove`])):(g(),s(l,{key:1},[e(`div`,Ve,[c.kind===`video`&&c.uploadedUrl(r)?(g(),p(b,{key:0,url:c.uploadedUrl(r)},null,8,[`url`])):c.kind===`audio`&&c.uploadedUrl(r)?(g(),p(x,{key:1,url:c.uploadedUrl(r)},null,8,[`url`])):(g(),s(`div`,He,[c.isPending(r)?(g(),p(S,{key:0,type:`circle`,"stroke-width":4,percentage:Math.round(r.percentage||0),width:34},null,8,[`percentage`])):c.kind===`video`?(g(),p(C,{key:1,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(g(),p(w,{key:2,size:`1em`,"aria-hidden":`true`,focusable:`false`}))]))]),e(`span`,{class:`filename`,title:r.name},i(r.name),9,Ue),e(`button`,{type:`button`,class:`remove`,"aria-label":c.$t(`common.button.close`),title:c.$t(`common.button.close`),onClick:t(e=>c.onRemoveFile(r),[`stop`])},[a(T,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,We)],64))],2)]),default:m(()=>[a(D,{round:``,type:`primary`,size:`small`,class:`btn`},{default:m(()=>[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(c.hasFile?c.$t(`digitalhuman.button.replace`):c.buttonText),1)]),_:1}),c.hint?(g(),s(`p`,Ge,i(c.hint),1)):o(``,!0)]),_:1},8,[`file-list`,`accept`,`before-upload`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`])}var Y=W(Be,[[`render`,Ke],[`__scopeId`,`data-v-db0590a9`]]),qe=20,X=e=>{let t=e;return!!t&&typeof t.voice_id==`string`&&!!t.voice_id&&typeof t.name==`string`},Z=()=>{try{let e=JSON.parse(localStorage.getItem(`digitalhuman.voices`)||`[]`);return Array.isArray(e)?e.filter(X).map(e=>({voice_id:e.voice_id,name:e.name,lang:typeof e.lang==`string`?e.lang:`zh`,created_at:typeof e.created_at==`number`?e.created_at:0})):[]}catch{return[]}},Q=e=>{try{localStorage.setItem(fe,JSON.stringify(e))}catch{}return e},Je=e=>X(e)?Q([e,...Z().filter(t=>t.voice_id!==e.voice_id)].slice(0,qe)):Z(),Ye=e=>Q(Z().filter(t=>t.voice_id!==e)),Xe=e=>`${e} ${Z().length+1}`,Ze=3e3,Qe=60,$e=v({name:`DigitalHumanVoiceCloneDialog`,components:{Consumption:K,ElAlert:C,ElButton:U,ElDialog:he,ElInput:ye,ElRadioButton:E,ElRadioGroup:D,MediaInput:Y},props:{visible:{type:Boolean,default:!1}},emits:[`update:visible`,`cloned`],data(){return{sampleUrl:void 0,name:``,lang:`zh`,cloning:!1,destroyed:!1,runId:0,DIGITALHUMAN_AUDIO_ACCEPT:B,DIGITALHUMAN_VOICE_CLONE_CONSUMPTION:2}},computed:{service(){return this.$store.state.digitalhuman?.service},credentialToken(){return this.$store.state.digitalhuman?.credential?.token},langOptions(){return pe.map(e=>({value:e,label:this.$t(`digitalhuman.name.lang_${e}`)}))}},watch:{visible(e){e?(this.sampleUrl=void 0,this.name=Xe(this.$t(`digitalhuman.name.myVoice`)),this.lang=`zh`):(this.runId++,this.cloning=!1)}},beforeUnmount(){this.destroyed=!0,this.runId++},methods:{onVisible(e){this.cloning&&!e||this.$emit(`update:visible`,e)},onSampleChange(e){this.sampleUrl=e},isStale(e){return this.destroyed||e!==this.runId},sleep(e){return new Promise(t=>setTimeout(t,e))},async onClone(){let e=this.credentialToken;if(!this.sampleUrl||!e)return;let t=++this.runId;this.cloning=!0;try{let{data:n}=await H.cloneVoice({audio_url:this.sampleUrl,lang:this.lang,name:this.name||void 0},{token:e});if(this.isStale(t))return;if(n?.voice_id){this.onCloned(n.voice_id);return}if(n?.task_id)await this.pollVoice(n.task_id,e,t);else throw Error(`no task`)}catch{this.isStale(t)||T.error(this.$t(`digitalhuman.message.voiceCloneFailed`))}finally{this.isStale(t)||(this.cloning=!1)}},async pollVoice(e,t,n){for(let r=0;r<Qe;r++){if(this.isStale(n)||(await this.sleep(Ze),this.isStale(n)))return;let{data:r}=await H.pollTask(e,{token:t});if(this.isStale(n))return;if(r?.voice_id){this.onCloned(r.voice_id);return}if(r?.state===`failed`)throw Error(`clone failed`)}throw Error(`timeout`)},onCloned(e){Je({voice_id:e,name:this.name||this.$t(`digitalhuman.name.myVoice`),lang:this.lang,created_at:Date.now()/1e3}),T.success(this.$t(`digitalhuman.message.voiceCloneSuccess`)),this.cloning=!1,this.$emit(`cloned`,e),this.$emit(`update:visible`,!1)}}}),et={class:`text-xs text-[var(--el-text-color-secondary)] mb-3`},tt={class:`field mb-3`},nt={class:`label`},rt={class:`field`},it={class:`label`},at={class:`text-xs mb-0`},ot={key:1,class:`mt-4 text-xs text-[var(--el-text-color-secondary)]`},st={class:`footer`};function ct(t,n,o,c,d,f){let _=u(`media-input`),v=u(`el-input`),y=u(`el-radio-button`),b=u(`el-radio-group`),x=u(`el-alert`),S=u(`consumption`),C=u(`el-button`),w=u(`el-dialog`);return g(),p(w,{"model-value":t.visible,title:t.$t(`digitalhuman.name.cloneVoice`),width:`440`,"align-center":``,"append-to-body":``,"close-on-click-modal":!t.cloning,"close-on-press-escape":!t.cloning,"onUpdate:modelValue":t.onVisible},{footer:m(()=>[e(`div`,st,[a(S,{value:t.DIGITALHUMAN_VOICE_CLONE_CONSUMPTION,service:t.service,class:`cost`},null,8,[`value`,`service`]),e(`div`,null,[a(C,{disabled:t.cloning,onClick:n[2]||=e=>t.onVisible(!1)},{default:m(()=>[r(i(t.$t(`common.button.cancel`)),1)]),_:1},8,[`disabled`]),a(C,{type:`primary`,loading:t.cloning,disabled:!t.sampleUrl||t.cloning,onClick:t.onClone},{default:m(()=>[r(i(t.$t(`digitalhuman.button.startClone`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])])])]),default:m(()=>[e(`p`,et,i(t.$t(`digitalhuman.message.voiceCloneHint`)),1),a(_,{kind:`audio`,accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadSample`),hint:t.$t(`digitalhuman.message.audioHint`),class:`mb-4`,onChange:t.onSampleChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]),e(`div`,tt,[e(`span`,nt,i(t.$t(`digitalhuman.name.voiceName`)),1),a(v,{modelValue:t.name,"onUpdate:modelValue":n[0]||=e=>t.name=e,class:`control`,placeholder:t.$t(`digitalhuman.placeholder.voiceName`)},null,8,[`modelValue`,`placeholder`])]),e(`div`,rt,[e(`span`,it,i(t.$t(`digitalhuman.name.voiceLang`)),1),a(b,{modelValue:t.lang,"onUpdate:modelValue":n[1]||=e=>t.lang=e,class:`control`},{default:m(()=>[(g(!0),s(l,null,h(t.langOptions,e=>(g(),p(y,{key:e.value,value:e.value},{default:m(()=>[r(i(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])]),t.cloning?(g(),p(x,{key:0,closable:!1,type:`info`,class:`mt-4`},{default:m(()=>[e(`p`,at,i(t.$t(`digitalhuman.message.voiceCloneRunning`)),1)]),_:1})):(g(),s(`p`,ot,i(t.$t(`digitalhuman.message.voiceStoredLocally`)),1))]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`onUpdate:modelValue`])}var lt=v({name:`DigitalHumanTimbreSelector`,components:{AddIcon:oe,DeleteIcon:L,ElButton:U,ElOption:b,ElSelect:y,VoiceCloneDialog:W($e,[[`render`,ct],[`__scopeId`,`data-v-ba35b653`]])},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{voices:Z(),dialogVisible:!1}},mounted(){this.modelValue&&!this.voices.some(e=>e.voice_id===this.modelValue)&&this.$emit(`update:modelValue`,void 0)},methods:{labelFor(e){let t=this.$t(`digitalhuman.name.lang_${e.lang}`);return t.startsWith(`digitalhuman.`)?e.name:`${e.name} · ${t}`},onCloned(e){this.voices=Z(),this.$emit(`update:modelValue`,e)},onRemove(e){this.voices=Ye(e),this.modelValue===e&&this.$emit(`update:modelValue`,void 0)}}}),ut={class:`row`},dt={class:`label`},ft={class:`option`},pt={class:`option-name`},mt=[`aria-label`,`title`,`onClick`],ht={class:`empty`};function gt(n,o,d,f,_,v){let y=u(`delete-icon`),b=u(`el-option`),x=u(`el-select`),S=u(`add-icon`),C=u(`el-button`),w=u(`voice-clone-dialog`);return g(),s(`div`,null,[e(`div`,ut,[e(`span`,dt,i(n.$t(`digitalhuman.name.timbre`)),1),a(x,{"model-value":n.modelValue,class:`control`,placeholder:n.$t(`digitalhuman.placeholder.pickTimbre`),"onUpdate:modelValue":o[0]||=e=>n.$emit(`update:modelValue`,e)},c({default:m(()=>[(g(!0),s(l,null,h(n.voices,r=>(g(),p(b,{key:r.voice_id,label:n.labelFor(r),value:r.voice_id},{default:m(()=>[e(`span`,ft,[e(`span`,pt,i(n.labelFor(r)),1),e(`button`,{type:`button`,class:`option-remove`,"aria-label":n.$t(`common.button.delete`),title:n.$t(`common.button.delete`),onClick:t(e=>n.onRemove(r.voice_id),[`stop`])},[a(y,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,mt)])]),_:2},1032,[`label`,`value`]))),128))]),_:2},[n.voices.length===0?{name:`empty`,fn:m(()=>[e(`p`,ht,i(n.$t(`digitalhuman.message.noVoiceYet`)),1)]),key:`0`}:void 0]),1032,[`model-value`,`placeholder`])]),a(C,{size:`small`,text:``,type:`primary`,class:`clone`,onClick:o[1]||=e=>n.dialogVisible=!0},{default:m(()=>[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.button.cloneNewVoice`)),1)]),_:1}),a(w,{visible:n.dialogVisible,"onUpdate:visible":o[2]||=e=>n.dialogVisible=e,onCloned:n.onCloned},null,8,[`visible`,`onCloned`])])}var _t=v({name:`ConfigPanel`,components:{Consumption:K,ElButton:U,ElCollapse:k,ElCollapseItem:O,ElInputNumber:j,ElRadioButton:E,ElRadioGroup:D,InfoIcon:te,MagicIcon:z,MediaInput:Y,PromptTextarea:P,TimbreSelector:W(lt,[[`render`,gt],[`__scopeId`,`data-v-e191cc56`]]),WarningIcon:R},emits:[`generate`],data(){return{faceMode:`video`,voiceMode:`text`,advancedOpen:[],DIGITALHUMAN_VIDEO_ACCEPT:de,DIGITALHUMAN_IMAGE_ACCEPT:V,DIGITALHUMAN_AUDIO_ACCEPT:B}},computed:{config(){return this.$store.state.digitalhuman?.config},service(){return this.$store.state.digitalhuman?.service},consumption(){return xe(this.config,this.service?.cost)},missing(){let e=[];return(this.faceMode===`video`?this.config?.video_url:this.config?.image_url)||e.push({key:`face`,message:this.$t(`digitalhuman.message.missingFace`)}),this.voiceMode===`text`?(this.config?.text?.trim()||e.push({key:`text`,message:this.$t(`digitalhuman.message.missingText`)}),this.config?.voice_id||e.push({key:`timbre`,message:this.$t(`digitalhuman.message.missingTimbre`)})):this.config?.audio_url||e.push({key:`audio`,message:this.$t(`digitalhuman.message.missingAudio`)}),e},text:{get(){return this.config?.text},set(e){this.update({text:e})}},voiceId:{get(){return this.config?.voice_id},set(e){this.update({voice_id:e})}},speed:{get(){return this.config?.speed??1},set(e){this.update({speed:e})}}},mounted(){this.config?.image_url&&!this.config?.video_url&&(this.faceMode=`photo`),this.config?.audio_url&&(this.voiceMode=`audio`)},methods:{isMissing(e){return this.missing.some(t=>t.key===e)},update(e){this.$store.commit(`digitalhuman/setConfig`,{...this.config,...e})},onFaceModeChange(e){this.update(e===`video`?{image_url:void 0}:{video_url:void 0})},onVoiceModeChange(e){this.update(e===`audio`?{text:void 0,voice_id:void 0}:{audio_url:void 0})},onFaceVideoChange(e){this.update({video_url:e})},onFacePhotoChange(e){this.update({image_url:e})},onAudioChange(e){this.update({audio_url:e})},onGenerate(){let e=this.missing[0];if(e){T.warning(e.message);let t=e.key===`face`?`face`:`voice`;this.$refs[t]?.scrollIntoView?.({behavior:`smooth`,block:`center`});return}let t=this.config||{},n={video_url:this.faceMode===`video`?t.video_url:t.image_url};this.voiceMode===`audio`?n.audio_url=t.audio_url:(n.text=t.text,n.voice_id=t.voice_id),t.speed&&t.speed!==1&&(n.speed=t.speed),this.$emit(`generate`,n)}}}),vt={class:`flex flex-col h-full`},yt={class:`flex-1 overflow-y-auto p-5`},bt={ref:`face`,class:`field-block mb-6`},xt={class:`field-head`},St={class:`field-title font-bold`},Ct={key:0,class:`required-badge`},wt={ref:`voice`,class:`field-block mb-6`},Tt={class:`field-head`},Et={class:`field-title font-bold`},Dt={key:0,class:`required-badge`},Ot={class:`field-row`},kt={class:`field-head`},At={class:`field-title font-bold`},jt={class:`flex flex-col items-center justify-center px-5 pb-5`},Mt={key:0,class:`hint-missing`},Nt={class:`hint-eta`};function Pt(t,n,c,d,f,h){let _=u(`info-icon`),v=u(`el-radio-button`),y=u(`el-radio-group`),b=u(`media-input`),x=u(`prompt-textarea`),S=u(`timbre-selector`),C=u(`el-input-number`),w=u(`el-collapse-item`),T=u(`el-collapse`),E=u(`warning-icon`),D=u(`consumption`),O=u(`magic-icon`),k=u(`el-button`);return g(),s(`div`,vt,[e(`div`,yt,[e(`section`,bt,[e(`div`,xt,[e(`h2`,St,i(t.$t(`digitalhuman.name.step1`)),1),t.isMissing(`face`)?(g(),s(`span`,Ct,i(t.$t(`digitalhuman.name.required`)),1)):o(``,!0),a(_,{content:t.$t(`digitalhuman.description.step1`),class:`ml-1`},null,8,[`content`])]),a(y,{modelValue:t.faceMode,"onUpdate:modelValue":n[0]||=e=>t.faceMode=e,class:`mode-switch mb-3`,onChange:t.onFaceModeChange},{default:m(()=>[a(v,{value:`video`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.faceModeVideo`)),1)]),_:1}),a(v,{value:`photo`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.faceModePhoto`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.faceMode===`video`?(g(),p(b,{key:0,kind:`video`,accept:t.DIGITALHUMAN_VIDEO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadFaceVideo`),hint:t.$t(`digitalhuman.message.faceVideoHint`),onChange:t.onFaceVideoChange},null,8,[`accept`,`button-text`,`hint`,`onChange`])):(g(),p(b,{key:1,kind:`image`,accept:t.DIGITALHUMAN_IMAGE_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadFacePhoto`),hint:t.$t(`digitalhuman.message.facePhotoHint`),onChange:t.onFacePhotoChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]))],512),e(`section`,wt,[e(`div`,Tt,[e(`h2`,Et,i(t.$t(`digitalhuman.name.step2`)),1),t.isMissing(`text`)||t.isMissing(`timbre`)||t.isMissing(`audio`)?(g(),s(`span`,Dt,i(t.$t(`digitalhuman.name.required`)),1)):o(``,!0),a(_,{content:t.$t(`digitalhuman.description.step2`),class:`ml-1`},null,8,[`content`])]),a(y,{modelValue:t.voiceMode,"onUpdate:modelValue":n[1]||=e=>t.voiceMode=e,class:`mode-switch mb-3`,onChange:t.onVoiceModeChange},{default:m(()=>[a(v,{value:`text`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.voiceModeText`)),1)]),_:1}),a(v,{value:`audio`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.voiceModeAudio`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.voiceMode===`text`?(g(),s(l,{key:0},[a(x,{modelValue:t.text,"onUpdate:modelValue":n[2]||=e=>t.text=e,class:`mb-3`,title:t.$t(`digitalhuman.name.speech`),placeholder:t.$t(`digitalhuman.placeholder.speech`),"min-rows":5,"max-rows":14},null,8,[`modelValue`,`title`,`placeholder`]),a(S,{modelValue:t.voiceId,"onUpdate:modelValue":n[3]||=e=>t.voiceId=e},null,8,[`modelValue`])],64)):(g(),p(b,{key:1,kind:`audio`,accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadSpeechAudio`),hint:t.$t(`digitalhuman.message.audioHint`),onChange:t.onAudioChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]))],512),a(T,{modelValue:t.advancedOpen,"onUpdate:modelValue":n[5]||=e=>t.advancedOpen=e,class:`advanced`},{default:m(()=>[a(w,{name:`advanced`,title:t.$t(`digitalhuman.name.advanced`)},{default:m(()=>[e(`div`,Ot,[e(`div`,kt,[e(`h2`,At,i(t.$t(`digitalhuman.name.speed`)),1),a(_,{content:t.$t(`digitalhuman.description.speed`),class:`ml-1`},null,8,[`content`])]),a(C,{modelValue:t.speed,"onUpdate:modelValue":n[4]||=e=>t.speed=e,class:`field-control`,min:.5,max:2,step:.1,precision:1,"controls-position":`right`},null,8,[`modelValue`])])]),_:1},8,[`title`])]),_:1},8,[`modelValue`])]),e(`div`,jt,[t.missing.length>0?(g(),s(`p`,Mt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.missing[0].message),1)])):o(``,!0),a(D,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(k,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:m(()=>[a(O,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`digitalhuman.button.generateVideo`)),1)]),_:1},8,[`onClick`]),e(`p`,Nt,i(t.$t(`digitalhuman.message.eta`)),1)])])}var Ft=W(_t,[[`render`,Pt],[`__scopeId`,`data-v-7c935d33`]]),It=[`.jpg`,`.jpeg`,`.png`,`.webp`,`.bmp`,`.gif`],Lt=v({name:`TaskPreview`,components:{ApiCodeButton:Me,AudioPreview:q,ChannelIcon:F,CopyToClipboard:Oe,DeleteIcon:L,ElAlert:C,ElButton:U,ElProgress:M,ElTooltip:S,FullscreenIcon:I,ImagePreview:G,InfoIcon:ie,MagicIcon:z,ReportButton:ke,TimeIcon:N,VideoPlayer:je,VideoPreview:J,WarningIcon:R},props:{modelValue:{type:Object,required:!0}},computed:{status(){return this.modelValue?.status||this.modelValue?.response?.state||`pending`},isSuccess(){return[`succeed`,`succeeded`].includes(this.status)||!!this.modelValue?.response?.video_url},isFailure(){return[`failed`,`dead`].includes(this.status)||this.modelValue?.response?.success===!1},isTerminal(){return this.isSuccess||this.isFailure},videoUrl(){return this.modelValue?.response?.video_url},progressPct(){let e=this.modelValue?.response?.progress;return typeof e==`number`?e:0},voiceLabel(){return this.modelValue?.request?.audio_url?this.$t(`digitalhuman.name.audioDriven`):this.$t(`digitalhuman.name.textDriven`)},faceUrl(){return this.modelValue?.request?.video_url||this.modelValue?.request?.image_url},isPhotoFace(){if(this.modelValue?.request?.image_url)return!0;let e=(this.faceUrl||``).split(`?`)[0].toLowerCase();return It.some(t=>e.endsWith(t))},audioUrl(){return this.modelValue?.request?.audio_url},outputSize(){let{width:e,height:t}=this.modelValue?.response||{};return e&&t?`${e}×${t}`:void 0},etaText(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(!e)return;let t=ue-(Date.now()/1e3-e);return t<=60?this.$t(`digitalhuman.message.etaAlmostDone`):this.$t(`digitalhuman.message.etaRemaining`,{minutes:Math.ceil(t/60)})},statusLabel(){let e=`digitalhuman.status.${this.status}`,t=this.$t(e);return t===e?this.$t(`digitalhuman.status.processing`):t},failureReason(){let e=this.modelValue?.response?.error;if(e)return typeof e==`string`?e:e?.message}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await Ee.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(`digitalhuman/deleteTask`,{id:e}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),window.open(t,`_blank`)}}}),Rt={class:`preview`},zt={class:`left`},Bt={class:`main`},Vt={class:`bot`},Ht={class:`datetime`},Ut=[`aria-label`],Wt={class:`info`},Gt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Kt={class:`prompt mt-2`},qt={key:0},Jt={key:0,class:`content`},Yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Qt={key:1,class:`content`},$t={class:`operations mt-2`},en={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},nn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},rn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},an={key:2,class:`content`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},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={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function un(n,c,l,d,f,h){let _=u(`capability-presentation`),v=u(`delete-icon`),y=u(`el-tooltip`),b=u(`image-preview`),x=u(`video-preview`),S=u(`audio-preview`),C=u(`time-icon`),w=u(`el-progress`),T=u(`magic-icon`),E=u(`copy-to-clipboard`),D=u(`el-alert`),O=u(`video-player`),k=u(`el-button`),A=u(`api-code-button`),j=u(`report-button`),M=u(`fullscreen-icon`),N=u(`channel-icon`),P=u(`warning-icon`),F=u(`info-icon`);return g(),s(`div`,Rt,[e(`div`,zt,[a(_,{capability:`digitalhuman`,part:`avatar`,class:`avatar`})]),e(`div`,Bt,[e(`div`,Vt,[a(_,{capability:`digitalhuman`,part:`name`}),e(`span`,Ht,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:m(()=>[n.modelValue?.id?(g(),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,Ut)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Wt,[n.faceUrl||n.audioUrl?(g(),s(`div`,Gt,[n.faceUrl&&n.isPhotoFace?(g(),p(b,{key:0,url:n.faceUrl,name:`face`,closable:!1},null,8,[`url`])):n.faceUrl?(g(),p(x,{key:1,url:n.faceUrl,name:`face`},null,8,[`url`])):o(``,!0),n.audioUrl?(g(),p(S,{key:2,url:n.audioUrl,name:`audio`},null,8,[`url`])):o(``,!0)])):o(``,!0),e(`p`,Kt,[r(i(n.modelValue?.request?.text||n.voiceLabel)+` `,1),n.isTerminal?o(``,!0):(g(),s(`span`,qt,` - (`+i(n.statusLabel)+`) `,1))])]),n.isTerminal?o(``,!0):(g(),s(`div`,Jt,[a(D,{closable:!1,class:`info-state`},{default:m(()=>[e(`p`,Yt,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.statusLabel),1)]),a(w,{percentage:n.progressPct,"stroke-width":6,class:`mb-2`},null,8,[`percentage`]),n.etaText?(g(),s(`p`,Xt,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.etaLabel`))+`: `+i(n.etaText),1)])):o(``,!0),e(`p`,Zt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])),n.isSuccess?(g(),s(`div`,Qt,[n.videoUrl?(g(),p(O,{key:0,src:n.videoUrl},null,8,[`src`])):o(``,!0),e(`div`,$t,[n.videoUrl?(g(),p(k,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=e=>n.onDownload(e,n.videoUrl)},{default:m(()=>[r(i(n.$t(`digitalhuman.button.download`)),1)]),_:1})):o(``,!0),a(A,{path:`/digital-human/videos`,body:n.modelValue?.request},null,8,[`body`]),a(j,{service:`digitalhuman`,"target-id":n.modelValue?.id,snapshot:{text:n.modelValue?.request?.text}},null,8,[`target-id`,`snapshot`])]),a(D,{closable:!1,class:`mt-2 success`},{default:m(()=>[n.modelValue?.response?.duration?(g(),s(`p`,en,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.duration`))+`: `+i(n.modelValue?.response?.duration?.toFixed(1))+`s `,1)])):o(``,!0),n.outputSize?(g(),s(`p`,$,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.outputSize`))+`: `+i(n.outputSize),1)])):o(``,!0),e(`p`,tn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,nn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,rn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(g(),s(`div`,an,[a(D,{closable:!1,class:`failure`},{template:m(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.failure`)),1)]),default:m(()=>[e(`p`,on,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.failureReason?(g(),s(`p`,sn,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.failureReason`))+`: `+i(n.failureReason)+` `,1),a(E,{content:n.failureReason},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(g(),s(`p`,cn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var dn=v({name:`RecentPanel`,components:{TaskPreview:W(Lt,[[`render`,un],[`__scopeId`,`data-v-342f1d6d`]]),NoTasks:ne,BotPlaceholder:Ne,ScrollList:ee},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.digitalhuman?.tasks,items:this.$store.state.digitalhuman?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),fn={key:0},pn={key:2,class:`w-full h-full flex items-center justify-center`};function mn(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),_=u(`scroll-list`),v=u(`no-tasks`);return g(),s(l,null,[e.tasks?.items===void 0?(g(),s(`div`,fn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),p(_,{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:m(()=>[(g(!0),s(l,null,h(e.tasks?.items,(e,t)=>(g(),p(f,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,pn,[a(v)])):o(``,!0)],64)}var hn=v({name:`DigitalHumanIndex`,components:{ConfigPanel:Ft,Layout:ze,RecentPanel:W(dn,[[`render`,mn]])},mixins:[be],inject:[`initialized`],data(){return{job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.digitalhuman?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.digitalhuman?.status?.getTasks===w.Request||this.fetchingTasks},credential(){return this.$store.state.digitalhuman.credential},config(){return this.$store.state.digitalhuman.config},tasks(){return this.$store.state.digitalhuman.tasks}},watch:{initialized:{async handler(e){window.clearInterval(this.job),e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await re({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(){await this.$store.dispatch(`digitalhuman/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`digitalhuman/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(e){if(!ve(this.uploadTracker,e=>this.$t(e),e=>T.warning(e))||!Ce())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}T.info(this.$t(`digitalhuman.message.startingTask`)),_e(`digitalhuman`,H.generate(e,{token:t})).then(()=>{T.success(this.$t(`digitalhuman.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?T.error(this.$t(`digitalhuman.message.usedUp`)):T.error(this.$t(`digitalhuman.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function gn(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return g(),p(l,null,{config:m(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var _n=W(hn,[[`render`,gn]]);export{_n 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,P as c,T as l,at as u,ht as d,it as f,j as p,mt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-C_fIfZ2e.js";import{t as x}from"./upload-CVDRsxmb.js";import{t as S}from"./tooltip-BUacpHBv.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-BKPWGzi5.js";import{n as E,r as D}from"./radio-BNhFzeBO.js";import{n as O,t as k}from"./collapse-Cn7VV0Rq.js";import{t as A}from"./drawer-CA6SUQCX.js";import{t as j}from"./input-number-DdR-1uzl.js";import{t as M}from"./progress-BuyYfFZn.js";import{t as N}from"./clock-B1CCVLmO.js";import{a as P,c as F,n as ee,o as te,r as ne,s as I,t as re}from"./pagination-BnPTXcYn.js";import{t as ie}from"./info-W0vYXBmL.js";import{t as ae}from"./music-2-BNpx2g_L.js";import{t as oe}from"./plus-DsRg1BTf.js";import{t as L}from"./trash-2-07x8oBrr.js";import{t as R}from"./triangle-alert-tdzQQL0N.js";import{t as se}from"./upload-DGU-Zk4A.js";import{t as ce}from"./user-CBWvPeJ5.js";import{t as le}from"./video-B6eldtMR.js";import{t as z}from"./wand-sparkles-DbvGGoZ2.js";import{Cr as ue,Dr as de,Or as fe,Sr as B,wr as V,xr as pe}from"./constants-u1eIRuNz.js";import{$n as H,$t as me,Ei as he,Fi as U,Jt as ge,Mr as _e,O as W,Qt as ve,Ui as ye,en as be,in as xe,nn as Se,pn as Ce,si as we,tn as Te,xi as Ee,yi as De}from"./index-Dd6xXz4I.js";import{t as Oe}from"./CopyToClipboard-DJUH_cOj.js";import{t as ke}from"./ReportButton-_V9tUFQF.js";import{t as G}from"./ImagePreview-SnY13jKc.js";import{n as Ae}from"./taskDrawerMixin-DyAUhFEq.js";import{t as K}from"./Consumption-Bt_7Xwm9.js";import{n as q,t as J}from"./VideoPreview-DOCg7hus.js";import{t as je}from"./VideoPlayer-DmVZVRbd.js";import{t as Me}from"./ApiCodeButton-CqlibmjN.js";import{t as Ne}from"./BotPlaceholder-99Dh87EM.js";var Pe=v({name:`LayoutDigitalHuman`,components:{UserIcon:ce,ElDrawer:A,ElButton:U},mixins:[Ae]}),Fe={class:`main flex flex-row flex-1`},Ie={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)]`},Le={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Re(t,n,r,i,o,c){let l=u(`user-icon`),p=u(`el-button`),h=u(`el-drawer`);return g(),s(`div`,Fe,[e(`div`,Ie,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,Le,[f(t.$slots,`result`,{},void 0,!0)]),d(a(p,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:m(()=>[a(l,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:m(()=>[f(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ze=W(Pe,[[`render`,Re],[`__scopeId`,`data-v-e912fd04`]]),Be=v({name:`DigitalHumanMediaInput`,components:{AudioPreview:q,CloseIcon:De,ElButton:U,ElProgress:M,ElUpload:x,ImagePreview:G,MusicIcon:ae,UploadIcon:se,VideoIcon:le,VideoPreview:J},mixins:[Se,Te,me,ge],props:{kind:{type:String,required:!0},accept:{type:String,default:``},buttonText:{type:String,default:``},hint:{type:String,default:``}},emits:[`change`],data(){return{fileList:[],uploadUrl:we()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},hasFile(){return this.fileList.length>0}},methods:{uploadedUrl(e){return e?.response?.file_url},isPending(e){return e.status===`ready`||e.status===`uploading`},onExceed(e){let t=this.$refs.uploader;t?.clearFiles();let n=e[0];n&&(t?.handleStart?.(n),t?.submit?.())},onError(){T.error(this.$t(`digitalhuman.message.uploadError`))},onRemoveFile(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),this.onChange()},onChange(){let e=this.fileList?.[0];this.$emit(`change`,e?this.uploadedUrl(e):void 0)}}}),Ve={class:`thumb`},He={key:2,class:`placeholder`},Ue=[`title`],We=[`aria-label`,`title`,`onClick`],Ge={key:0,class:`hint`};function Ke(c,d,f,h,_,v){let y=u(`image-preview`),b=u(`video-preview`),x=u(`audio-preview`),S=u(`el-progress`),C=u(`video-icon`),w=u(`music-icon`),T=u(`close-icon`),E=u(`upload-icon`),D=u(`el-button`),O=u(`el-upload`);return g(),p(O,{ref:`uploader`,"file-list":c.fileList,"onUpdate:fileList":d[0]||=e=>c.fileList=e,accept:c.accept,name:`file`,class:`media-input`,limit:1,multiple:!1,"before-upload":c.beforeUploadSizeGuard,action:c.uploadUrl,headers:c.headers,"on-exceed":c.onExceed,"on-error":c.onError,"on-success":c.onChange,"on-remove":c.onChange},{file:m(({file:r})=>[e(`div`,{class:n([`slot`,{pending:c.isPending(r)}])},[c.kind===`image`&&r.url?(g(),p(y,{key:0,url:r.url,name:r.name,percentage:r.percentage,onRemove:e=>c.onRemoveFile(r)},null,8,[`url`,`name`,`percentage`,`onRemove`])):(g(),s(l,{key:1},[e(`div`,Ve,[c.kind===`video`&&c.uploadedUrl(r)?(g(),p(b,{key:0,url:c.uploadedUrl(r)},null,8,[`url`])):c.kind===`audio`&&c.uploadedUrl(r)?(g(),p(x,{key:1,url:c.uploadedUrl(r)},null,8,[`url`])):(g(),s(`div`,He,[c.isPending(r)?(g(),p(S,{key:0,type:`circle`,"stroke-width":4,percentage:Math.round(r.percentage||0),width:34},null,8,[`percentage`])):c.kind===`video`?(g(),p(C,{key:1,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(g(),p(w,{key:2,size:`1em`,"aria-hidden":`true`,focusable:`false`}))]))]),e(`span`,{class:`filename`,title:r.name},i(r.name),9,Ue),e(`button`,{type:`button`,class:`remove`,"aria-label":c.$t(`common.button.close`),title:c.$t(`common.button.close`),onClick:t(e=>c.onRemoveFile(r),[`stop`])},[a(T,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,We)],64))],2)]),default:m(()=>[a(D,{round:``,type:`primary`,size:`small`,class:`btn`},{default:m(()=>[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(c.hasFile?c.$t(`digitalhuman.button.replace`):c.buttonText),1)]),_:1}),c.hint?(g(),s(`p`,Ge,i(c.hint),1)):o(``,!0)]),_:1},8,[`file-list`,`accept`,`before-upload`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`])}var Y=W(Be,[[`render`,Ke],[`__scopeId`,`data-v-db0590a9`]]),qe=20,X=e=>{let t=e;return!!t&&typeof t.voice_id==`string`&&!!t.voice_id&&typeof t.name==`string`},Z=()=>{try{let e=JSON.parse(localStorage.getItem(`digitalhuman.voices`)||`[]`);return Array.isArray(e)?e.filter(X).map(e=>({voice_id:e.voice_id,name:e.name,lang:typeof e.lang==`string`?e.lang:`zh`,created_at:typeof e.created_at==`number`?e.created_at:0})):[]}catch{return[]}},Q=e=>{try{localStorage.setItem(fe,JSON.stringify(e))}catch{}return e},Je=e=>X(e)?Q([e,...Z().filter(t=>t.voice_id!==e.voice_id)].slice(0,qe)):Z(),Ye=e=>Q(Z().filter(t=>t.voice_id!==e)),Xe=e=>`${e} ${Z().length+1}`,Ze=3e3,Qe=60,$e=v({name:`DigitalHumanVoiceCloneDialog`,components:{Consumption:K,ElAlert:C,ElButton:U,ElDialog:he,ElInput:ye,ElRadioButton:E,ElRadioGroup:D,MediaInput:Y},props:{visible:{type:Boolean,default:!1}},emits:[`update:visible`,`cloned`],data(){return{sampleUrl:void 0,name:``,lang:`zh`,cloning:!1,destroyed:!1,runId:0,DIGITALHUMAN_AUDIO_ACCEPT:B,DIGITALHUMAN_VOICE_CLONE_CONSUMPTION:2}},computed:{service(){return this.$store.state.digitalhuman?.service},credentialToken(){return this.$store.state.digitalhuman?.credential?.token},langOptions(){return pe.map(e=>({value:e,label:this.$t(`digitalhuman.name.lang_${e}`)}))}},watch:{visible(e){e?(this.sampleUrl=void 0,this.name=Xe(this.$t(`digitalhuman.name.myVoice`)),this.lang=`zh`):(this.runId++,this.cloning=!1)}},beforeUnmount(){this.destroyed=!0,this.runId++},methods:{onVisible(e){this.cloning&&!e||this.$emit(`update:visible`,e)},onSampleChange(e){this.sampleUrl=e},isStale(e){return this.destroyed||e!==this.runId},sleep(e){return new Promise(t=>setTimeout(t,e))},async onClone(){let e=this.credentialToken;if(!this.sampleUrl||!e)return;let t=++this.runId;this.cloning=!0;try{let{data:n}=await H.cloneVoice({audio_url:this.sampleUrl,lang:this.lang,name:this.name||void 0},{token:e});if(this.isStale(t))return;if(n?.voice_id){this.onCloned(n.voice_id);return}if(n?.task_id)await this.pollVoice(n.task_id,e,t);else throw Error(`no task`)}catch{this.isStale(t)||T.error(this.$t(`digitalhuman.message.voiceCloneFailed`))}finally{this.isStale(t)||(this.cloning=!1)}},async pollVoice(e,t,n){for(let r=0;r<Qe;r++){if(this.isStale(n)||(await this.sleep(Ze),this.isStale(n)))return;let{data:r}=await H.pollTask(e,{token:t});if(this.isStale(n))return;if(r?.voice_id){this.onCloned(r.voice_id);return}if(r?.state===`failed`)throw Error(`clone failed`)}throw Error(`timeout`)},onCloned(e){Je({voice_id:e,name:this.name||this.$t(`digitalhuman.name.myVoice`),lang:this.lang,created_at:Date.now()/1e3}),T.success(this.$t(`digitalhuman.message.voiceCloneSuccess`)),this.cloning=!1,this.$emit(`cloned`,e),this.$emit(`update:visible`,!1)}}}),et={class:`text-xs text-[var(--el-text-color-secondary)] mb-3`},tt={class:`field mb-3`},nt={class:`label`},rt={class:`field`},it={class:`label`},at={class:`text-xs mb-0`},ot={key:1,class:`mt-4 text-xs text-[var(--el-text-color-secondary)]`},st={class:`footer`};function ct(t,n,o,c,d,f){let _=u(`media-input`),v=u(`el-input`),y=u(`el-radio-button`),b=u(`el-radio-group`),x=u(`el-alert`),S=u(`consumption`),C=u(`el-button`),w=u(`el-dialog`);return g(),p(w,{"model-value":t.visible,title:t.$t(`digitalhuman.name.cloneVoice`),width:`440`,"align-center":``,"append-to-body":``,"close-on-click-modal":!t.cloning,"close-on-press-escape":!t.cloning,"onUpdate:modelValue":t.onVisible},{footer:m(()=>[e(`div`,st,[a(S,{value:t.DIGITALHUMAN_VOICE_CLONE_CONSUMPTION,service:t.service,class:`cost`},null,8,[`value`,`service`]),e(`div`,null,[a(C,{disabled:t.cloning,onClick:n[2]||=e=>t.onVisible(!1)},{default:m(()=>[r(i(t.$t(`common.button.cancel`)),1)]),_:1},8,[`disabled`]),a(C,{type:`primary`,loading:t.cloning,disabled:!t.sampleUrl||t.cloning,onClick:t.onClone},{default:m(()=>[r(i(t.$t(`digitalhuman.button.startClone`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])])])]),default:m(()=>[e(`p`,et,i(t.$t(`digitalhuman.message.voiceCloneHint`)),1),a(_,{kind:`audio`,accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadSample`),hint:t.$t(`digitalhuman.message.audioHint`),class:`mb-4`,onChange:t.onSampleChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]),e(`div`,tt,[e(`span`,nt,i(t.$t(`digitalhuman.name.voiceName`)),1),a(v,{modelValue:t.name,"onUpdate:modelValue":n[0]||=e=>t.name=e,class:`control`,placeholder:t.$t(`digitalhuman.placeholder.voiceName`)},null,8,[`modelValue`,`placeholder`])]),e(`div`,rt,[e(`span`,it,i(t.$t(`digitalhuman.name.voiceLang`)),1),a(b,{modelValue:t.lang,"onUpdate:modelValue":n[1]||=e=>t.lang=e,class:`control`},{default:m(()=>[(g(!0),s(l,null,h(t.langOptions,e=>(g(),p(y,{key:e.value,value:e.value},{default:m(()=>[r(i(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])]),t.cloning?(g(),p(x,{key:0,closable:!1,type:`info`,class:`mt-4`},{default:m(()=>[e(`p`,at,i(t.$t(`digitalhuman.message.voiceCloneRunning`)),1)]),_:1})):(g(),s(`p`,ot,i(t.$t(`digitalhuman.message.voiceStoredLocally`)),1))]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`onUpdate:modelValue`])}var lt=v({name:`DigitalHumanTimbreSelector`,components:{AddIcon:oe,DeleteIcon:L,ElButton:U,ElOption:b,ElSelect:y,VoiceCloneDialog:W($e,[[`render`,ct],[`__scopeId`,`data-v-ba35b653`]])},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{voices:Z(),dialogVisible:!1}},mounted(){this.modelValue&&!this.voices.some(e=>e.voice_id===this.modelValue)&&this.$emit(`update:modelValue`,void 0)},methods:{labelFor(e){let t=this.$t(`digitalhuman.name.lang_${e.lang}`);return t.startsWith(`digitalhuman.`)?e.name:`${e.name} · ${t}`},onCloned(e){this.voices=Z(),this.$emit(`update:modelValue`,e)},onRemove(e){this.voices=Ye(e),this.modelValue===e&&this.$emit(`update:modelValue`,void 0)}}}),ut={class:`row`},dt={class:`label`},ft={class:`option`},pt={class:`option-name`},mt=[`aria-label`,`title`,`onClick`],ht={class:`empty`};function gt(n,o,d,f,_,v){let y=u(`delete-icon`),b=u(`el-option`),x=u(`el-select`),S=u(`add-icon`),C=u(`el-button`),w=u(`voice-clone-dialog`);return g(),s(`div`,null,[e(`div`,ut,[e(`span`,dt,i(n.$t(`digitalhuman.name.timbre`)),1),a(x,{"model-value":n.modelValue,class:`control`,placeholder:n.$t(`digitalhuman.placeholder.pickTimbre`),"onUpdate:modelValue":o[0]||=e=>n.$emit(`update:modelValue`,e)},c({default:m(()=>[(g(!0),s(l,null,h(n.voices,r=>(g(),p(b,{key:r.voice_id,label:n.labelFor(r),value:r.voice_id},{default:m(()=>[e(`span`,ft,[e(`span`,pt,i(n.labelFor(r)),1),e(`button`,{type:`button`,class:`option-remove`,"aria-label":n.$t(`common.button.delete`),title:n.$t(`common.button.delete`),onClick:t(e=>n.onRemove(r.voice_id),[`stop`])},[a(y,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,mt)])]),_:2},1032,[`label`,`value`]))),128))]),_:2},[n.voices.length===0?{name:`empty`,fn:m(()=>[e(`p`,ht,i(n.$t(`digitalhuman.message.noVoiceYet`)),1)]),key:`0`}:void 0]),1032,[`model-value`,`placeholder`])]),a(C,{size:`small`,text:``,type:`primary`,class:`clone`,onClick:o[1]||=e=>n.dialogVisible=!0},{default:m(()=>[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.button.cloneNewVoice`)),1)]),_:1}),a(w,{visible:n.dialogVisible,"onUpdate:visible":o[2]||=e=>n.dialogVisible=e,onCloned:n.onCloned},null,8,[`visible`,`onCloned`])])}var _t=v({name:`ConfigPanel`,components:{Consumption:K,ElButton:U,ElCollapse:k,ElCollapseItem:O,ElInputNumber:j,ElRadioButton:E,ElRadioGroup:D,InfoIcon:te,MagicIcon:z,MediaInput:Y,PromptTextarea:P,TimbreSelector:W(lt,[[`render`,gt],[`__scopeId`,`data-v-e191cc56`]]),WarningIcon:R},emits:[`generate`],data(){return{faceMode:`video`,voiceMode:`text`,advancedOpen:[],DIGITALHUMAN_VIDEO_ACCEPT:de,DIGITALHUMAN_IMAGE_ACCEPT:V,DIGITALHUMAN_AUDIO_ACCEPT:B}},computed:{config(){return this.$store.state.digitalhuman?.config},service(){return this.$store.state.digitalhuman?.service},consumption(){return xe(this.config,this.service?.cost)},missing(){let e=[];return(this.faceMode===`video`?this.config?.video_url:this.config?.image_url)||e.push({key:`face`,message:this.$t(`digitalhuman.message.missingFace`)}),this.voiceMode===`text`?(this.config?.text?.trim()||e.push({key:`text`,message:this.$t(`digitalhuman.message.missingText`)}),this.config?.voice_id||e.push({key:`timbre`,message:this.$t(`digitalhuman.message.missingTimbre`)})):this.config?.audio_url||e.push({key:`audio`,message:this.$t(`digitalhuman.message.missingAudio`)}),e},text:{get(){return this.config?.text},set(e){this.update({text:e})}},voiceId:{get(){return this.config?.voice_id},set(e){this.update({voice_id:e})}},speed:{get(){return this.config?.speed??1},set(e){this.update({speed:e})}}},mounted(){this.config?.image_url&&!this.config?.video_url&&(this.faceMode=`photo`),this.config?.audio_url&&(this.voiceMode=`audio`)},methods:{isMissing(e){return this.missing.some(t=>t.key===e)},update(e){this.$store.commit(`digitalhuman/setConfig`,{...this.config,...e})},onFaceModeChange(e){this.update(e===`video`?{image_url:void 0}:{video_url:void 0})},onVoiceModeChange(e){this.update(e===`audio`?{text:void 0,voice_id:void 0}:{audio_url:void 0})},onFaceVideoChange(e){this.update({video_url:e})},onFacePhotoChange(e){this.update({image_url:e})},onAudioChange(e){this.update({audio_url:e})},onGenerate(){let e=this.missing[0];if(e){T.warning(e.message);let t=e.key===`face`?`face`:`voice`;this.$refs[t]?.scrollIntoView?.({behavior:`smooth`,block:`center`});return}let t=this.config||{},n={video_url:this.faceMode===`video`?t.video_url:t.image_url};this.voiceMode===`audio`?n.audio_url=t.audio_url:(n.text=t.text,n.voice_id=t.voice_id),t.speed&&t.speed!==1&&(n.speed=t.speed),this.$emit(`generate`,n)}}}),vt={class:`flex flex-col h-full`},yt={class:`flex-1 overflow-y-auto p-5`},bt={ref:`face`,class:`field-block mb-6`},xt={class:`field-head`},St={class:`field-title font-bold`},Ct={key:0,class:`required-badge`},wt={ref:`voice`,class:`field-block mb-6`},Tt={class:`field-head`},Et={class:`field-title font-bold`},Dt={key:0,class:`required-badge`},Ot={class:`field-row`},kt={class:`field-head`},At={class:`field-title font-bold`},jt={class:`flex flex-col items-center justify-center px-5 pb-5`},Mt={key:0,class:`hint-missing`},Nt={class:`hint-eta`};function Pt(t,n,c,d,f,h){let _=u(`info-icon`),v=u(`el-radio-button`),y=u(`el-radio-group`),b=u(`media-input`),x=u(`prompt-textarea`),S=u(`timbre-selector`),C=u(`el-input-number`),w=u(`el-collapse-item`),T=u(`el-collapse`),E=u(`warning-icon`),D=u(`consumption`),O=u(`magic-icon`),k=u(`el-button`);return g(),s(`div`,vt,[e(`div`,yt,[e(`section`,bt,[e(`div`,xt,[e(`h2`,St,i(t.$t(`digitalhuman.name.step1`)),1),t.isMissing(`face`)?(g(),s(`span`,Ct,i(t.$t(`digitalhuman.name.required`)),1)):o(``,!0),a(_,{content:t.$t(`digitalhuman.description.step1`),class:`ml-1`},null,8,[`content`])]),a(y,{modelValue:t.faceMode,"onUpdate:modelValue":n[0]||=e=>t.faceMode=e,class:`mode-switch mb-3`,onChange:t.onFaceModeChange},{default:m(()=>[a(v,{value:`video`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.faceModeVideo`)),1)]),_:1}),a(v,{value:`photo`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.faceModePhoto`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.faceMode===`video`?(g(),p(b,{key:0,kind:`video`,accept:t.DIGITALHUMAN_VIDEO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadFaceVideo`),hint:t.$t(`digitalhuman.message.faceVideoHint`),onChange:t.onFaceVideoChange},null,8,[`accept`,`button-text`,`hint`,`onChange`])):(g(),p(b,{key:1,kind:`image`,accept:t.DIGITALHUMAN_IMAGE_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadFacePhoto`),hint:t.$t(`digitalhuman.message.facePhotoHint`),onChange:t.onFacePhotoChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]))],512),e(`section`,wt,[e(`div`,Tt,[e(`h2`,Et,i(t.$t(`digitalhuman.name.step2`)),1),t.isMissing(`text`)||t.isMissing(`timbre`)||t.isMissing(`audio`)?(g(),s(`span`,Dt,i(t.$t(`digitalhuman.name.required`)),1)):o(``,!0),a(_,{content:t.$t(`digitalhuman.description.step2`),class:`ml-1`},null,8,[`content`])]),a(y,{modelValue:t.voiceMode,"onUpdate:modelValue":n[1]||=e=>t.voiceMode=e,class:`mode-switch mb-3`,onChange:t.onVoiceModeChange},{default:m(()=>[a(v,{value:`text`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.voiceModeText`)),1)]),_:1}),a(v,{value:`audio`},{default:m(()=>[r(i(t.$t(`digitalhuman.name.voiceModeAudio`)),1)]),_:1})]),_:1},8,[`modelValue`,`onChange`]),t.voiceMode===`text`?(g(),s(l,{key:0},[a(x,{modelValue:t.text,"onUpdate:modelValue":n[2]||=e=>t.text=e,class:`mb-3`,title:t.$t(`digitalhuman.name.speech`),placeholder:t.$t(`digitalhuman.placeholder.speech`),"min-rows":5,"max-rows":14},null,8,[`modelValue`,`title`,`placeholder`]),a(S,{modelValue:t.voiceId,"onUpdate:modelValue":n[3]||=e=>t.voiceId=e},null,8,[`modelValue`])],64)):(g(),p(b,{key:1,kind:`audio`,accept:t.DIGITALHUMAN_AUDIO_ACCEPT,"button-text":t.$t(`digitalhuman.button.uploadSpeechAudio`),hint:t.$t(`digitalhuman.message.audioHint`),onChange:t.onAudioChange},null,8,[`accept`,`button-text`,`hint`,`onChange`]))],512),a(T,{modelValue:t.advancedOpen,"onUpdate:modelValue":n[5]||=e=>t.advancedOpen=e,class:`advanced`},{default:m(()=>[a(w,{name:`advanced`,title:t.$t(`digitalhuman.name.advanced`)},{default:m(()=>[e(`div`,Ot,[e(`div`,kt,[e(`h2`,At,i(t.$t(`digitalhuman.name.speed`)),1),a(_,{content:t.$t(`digitalhuman.description.speed`),class:`ml-1`},null,8,[`content`])]),a(C,{modelValue:t.speed,"onUpdate:modelValue":n[4]||=e=>t.speed=e,class:`field-control`,min:.5,max:2,step:.1,precision:1,"controls-position":`right`},null,8,[`modelValue`])])]),_:1},8,[`title`])]),_:1},8,[`modelValue`])]),e(`div`,jt,[t.missing.length>0?(g(),s(`p`,Mt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.missing[0].message),1)])):o(``,!0),a(D,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(k,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:m(()=>[a(O,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`digitalhuman.button.generateVideo`)),1)]),_:1},8,[`onClick`]),e(`p`,Nt,i(t.$t(`digitalhuman.message.eta`)),1)])])}var Ft=W(_t,[[`render`,Pt],[`__scopeId`,`data-v-7c935d33`]]),It=[`.jpg`,`.jpeg`,`.png`,`.webp`,`.bmp`,`.gif`],Lt=v({name:`TaskPreview`,components:{ApiCodeButton:Me,AudioPreview:q,ChannelIcon:F,CopyToClipboard:Oe,DeleteIcon:L,ElAlert:C,ElButton:U,ElProgress:M,ElTooltip:S,FullscreenIcon:I,ImagePreview:G,InfoIcon:ie,MagicIcon:z,ReportButton:ke,TimeIcon:N,VideoPlayer:je,VideoPreview:J,WarningIcon:R},props:{modelValue:{type:Object,required:!0}},computed:{status(){return this.modelValue?.status||this.modelValue?.response?.state||`pending`},isSuccess(){return[`succeed`,`succeeded`].includes(this.status)||!!this.modelValue?.response?.video_url},isFailure(){return[`failed`,`dead`].includes(this.status)||this.modelValue?.response?.success===!1},isTerminal(){return this.isSuccess||this.isFailure},videoUrl(){return this.modelValue?.response?.video_url},progressPct(){let e=this.modelValue?.response?.progress;return typeof e==`number`?e:0},voiceLabel(){return this.modelValue?.request?.audio_url?this.$t(`digitalhuman.name.audioDriven`):this.$t(`digitalhuman.name.textDriven`)},faceUrl(){return this.modelValue?.request?.video_url||this.modelValue?.request?.image_url},isPhotoFace(){if(this.modelValue?.request?.image_url)return!0;let e=(this.faceUrl||``).split(`?`)[0].toLowerCase();return It.some(t=>e.endsWith(t))},audioUrl(){return this.modelValue?.request?.audio_url},outputSize(){let{width:e,height:t}=this.modelValue?.response||{};return e&&t?`${e}×${t}`:void 0},etaText(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(!e)return;let t=ue-(Date.now()/1e3-e);return t<=60?this.$t(`digitalhuman.message.etaAlmostDone`):this.$t(`digitalhuman.message.etaRemaining`,{minutes:Math.ceil(t/60)})},statusLabel(){let e=`digitalhuman.status.${this.status}`,t=this.$t(e);return t===e?this.$t(`digitalhuman.status.processing`):t},failureReason(){let e=this.modelValue?.response?.error;if(e)return typeof e==`string`?e:e?.message}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await Ee.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(`digitalhuman/deleteTask`,{id:e}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),window.open(t,`_blank`)}}}),Rt={class:`preview`},zt={class:`left`},Bt={class:`main`},Vt={class:`bot`},Ht={class:`datetime`},Ut=[`aria-label`],Wt={class:`info`},Gt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Kt={class:`prompt mt-2`},qt={key:0},Jt={key:0,class:`content`},Yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Zt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Qt={key:1,class:`content`},$t={class:`operations mt-2`},en={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},tn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},nn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},rn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},an={key:2,class:`content`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},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={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function un(n,c,l,d,f,h){let _=u(`capability-presentation`),v=u(`delete-icon`),y=u(`el-tooltip`),b=u(`image-preview`),x=u(`video-preview`),S=u(`audio-preview`),C=u(`time-icon`),w=u(`el-progress`),T=u(`magic-icon`),E=u(`copy-to-clipboard`),D=u(`el-alert`),O=u(`video-player`),k=u(`el-button`),A=u(`api-code-button`),j=u(`report-button`),M=u(`fullscreen-icon`),N=u(`channel-icon`),P=u(`warning-icon`),F=u(`info-icon`);return g(),s(`div`,Rt,[e(`div`,zt,[a(_,{capability:`digitalhuman`,part:`avatar`,class:`avatar`})]),e(`div`,Bt,[e(`div`,Vt,[a(_,{capability:`digitalhuman`,part:`name`}),e(`span`,Ht,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:m(()=>[n.modelValue?.id?(g(),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,Ut)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Wt,[n.faceUrl||n.audioUrl?(g(),s(`div`,Gt,[n.faceUrl&&n.isPhotoFace?(g(),p(b,{key:0,url:n.faceUrl,name:`face`,closable:!1},null,8,[`url`])):n.faceUrl?(g(),p(x,{key:1,url:n.faceUrl,name:`face`},null,8,[`url`])):o(``,!0),n.audioUrl?(g(),p(S,{key:2,url:n.audioUrl,name:`audio`},null,8,[`url`])):o(``,!0)])):o(``,!0),e(`p`,Kt,[r(i(n.modelValue?.request?.text||n.voiceLabel)+` `,1),n.isTerminal?o(``,!0):(g(),s(`span`,qt,` - (`+i(n.statusLabel)+`) `,1))])]),n.isTerminal?o(``,!0):(g(),s(`div`,Jt,[a(D,{closable:!1,class:`info-state`},{default:m(()=>[e(`p`,Yt,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.statusLabel),1)]),a(w,{percentage:n.progressPct,"stroke-width":6,class:`mb-2`},null,8,[`percentage`]),n.etaText?(g(),s(`p`,Xt,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.etaLabel`))+`: `+i(n.etaText),1)])):o(``,!0),e(`p`,Zt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])),n.isSuccess?(g(),s(`div`,Qt,[n.videoUrl?(g(),p(O,{key:0,src:n.videoUrl},null,8,[`src`])):o(``,!0),e(`div`,$t,[n.videoUrl?(g(),p(k,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=e=>n.onDownload(e,n.videoUrl)},{default:m(()=>[r(i(n.$t(`digitalhuman.button.download`)),1)]),_:1})):o(``,!0),a(A,{path:`/digital-human/videos`,body:n.modelValue?.request},null,8,[`body`]),a(j,{service:`digitalhuman`,"target-id":n.modelValue?.id,snapshot:{text:n.modelValue?.request?.text}},null,8,[`target-id`,`snapshot`])]),a(D,{closable:!1,class:`mt-2 success`},{default:m(()=>[n.modelValue?.response?.duration?(g(),s(`p`,en,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.duration`))+`: `+i(n.modelValue?.response?.duration?.toFixed(1))+`s `,1)])):o(``,!0),n.outputSize?(g(),s(`p`,$,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.outputSize`))+`: `+i(n.outputSize),1)])):o(``,!0),e(`p`,tn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,nn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,rn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(g(),s(`div`,an,[a(D,{closable:!1,class:`failure`},{template:m(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.failure`)),1)]),default:m(()=>[e(`p`,on,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.failureReason?(g(),s(`p`,sn,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.failureReason`))+`: `+i(n.failureReason)+` `,1),a(E,{content:n.failureReason},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(g(),s(`p`,cn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`digitalhuman.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var dn=v({name:`RecentPanel`,components:{TaskPreview:W(Lt,[[`render`,un],[`__scopeId`,`data-v-342f1d6d`]]),NoTasks:ne,BotPlaceholder:Ne,ScrollList:ee},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.digitalhuman?.tasks,items:this.$store.state.digitalhuman?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),fn={key:0},pn={key:2,class:`w-full h-full flex items-center justify-center`};function mn(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),_=u(`scroll-list`),v=u(`no-tasks`);return g(),s(l,null,[e.tasks?.items===void 0?(g(),s(`div`,fn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),p(_,{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:m(()=>[(g(!0),s(l,null,h(e.tasks?.items,(e,t)=>(g(),p(f,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,pn,[a(v)])):o(``,!0)],64)}var hn=v({name:`DigitalHumanIndex`,components:{ConfigPanel:Ft,Layout:ze,RecentPanel:W(dn,[[`render`,mn]])},mixins:[be],inject:[`initialized`],data(){return{job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.digitalhuman?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.digitalhuman?.status?.getTasks===w.Request||this.fetchingTasks},credential(){return this.$store.state.digitalhuman.credential},config(){return this.$store.state.digitalhuman.config},tasks(){return this.$store.state.digitalhuman.tasks}},watch:{initialized:{async handler(e){window.clearInterval(this.job),e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await re({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(){await this.$store.dispatch(`digitalhuman/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`digitalhuman/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(e){if(!ve(this.uploadTracker,e=>this.$t(e),e=>T.warning(e))||!Ce())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}T.info(this.$t(`digitalhuman.message.startingTask`)),_e(`digitalhuman`,H.generate(e,{token:t})).then(()=>{T.success(this.$t(`digitalhuman.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?T.error(this.$t(`digitalhuman.message.usedUp`)):T.error(this.$t(`digitalhuman.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function gn(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return g(),p(l,null,{config:m(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var _n=W(hn,[[`render`,gn]]);export{_n 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{n as v,r as y,t as b}from"./select-B_LIRKEc.js";import{t as x}from"./upload-CVDRsxmb.js";import{t as S}from"./tooltip-65yx4tvR.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-BKPWGzi5.js";import{t as E}from"./drawer-lPnIZOSX.js";import{t as D}from"./input-number-CScClEsg.js";import{t as O}from"./box-CyVbYdiI.js";import{t as k}from"./clock-picb7ciF.js";import{a as A,c as j,n as M,o as N,r as P,t as F}from"./pagination-51ny6Oso.js";import{t as I}from"./image-BHmbUsfT.js";import{t as ee}from"./info-DhXkijI-.js";import{t as te}from"./trash-2-DtPyMpc8.js";import{t as ne}from"./triangle-alert-DpLecGNq.js";import{t as re}from"./upload-D2oHJ14J.js";import{t as L}from"./wand-sparkles--swdHIwq.js";import{t as ie}from"./zap-BxCVvy5i.js";import{An as ae,Cn as R,Dn as z,En as B,Mn as oe,Nn as V,On as H,Tn as U,bn as se,kn as ce,wn as W,xn as G}from"./constants-u1eIRuNz.js";import{$t as le,Fi as K,Jt as ue,Mr as de,O as q,Qt as fe,en as pe,in as me,nn as he,pn as ge,si as _e,tn as ve,xi as J,zn as ye}from"./index-BK4q_lZQ.js";import{t as be}from"./CopyToClipboard-8zEkaydk.js";import{t as xe}from"./ReportButton-C3Kjfp0k.js";import{t as Y}from"./ImagePreview-aup3tBhe.js";import{n as Se}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Ce}from"./Consumption-DSV6Ajvn.js";import{t as we}from"./ApiCodeButton-DBpwradV.js";import{t as Te}from"./BotPlaceholder-CQECCUDa.js";import{t as Ee}from"./ImageWrapper-lBDb2gpG.js";var De=_({name:`LayoutSeedream`,components:{MagicIcon:L,ElDrawer:E,ElButton:K},mixins:[Se]}),Oe={class:`main flex flex-row flex-1`},ke={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)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(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`,ke,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ae,[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 Me=q(De,[[`render`,je],[`__scopeId`,`data-v-c10167d0`]]),Ne=_({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 Pe(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 Fe=q(Ne,[[`render`,Pe]]),Ie={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 X(e){switch(e){case z:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case B:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case U: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 R:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:G[R],outputFormat:!1,tools:!1};case H:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:G[H],outputFormat:!1,tools:!1};default:return Ie}}function Z(e,t){let n=X(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Le=[`1K`,`2K`,`3K`,`4K`];function Re(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=X(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();(Le.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 ze(e,t,n){let r={...e},i=X(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 Be=_({name:`SeedreamImageInput`,components:{UploadIcon:re,ElUpload:x,ElButton:K,InfoIcon:N,ImagePreview:Y},mixins:[he,ve,le,ue],data(){return{fileList:[],uploadUrl:_e()+`/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 X(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(){T.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){T.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()}}}),Ve={key:0},He={class:`field`},Ue={class:`label`},We={class:`box`},Ge={class:`title font-bold`},Ke={class:`value`},qe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Je(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`,Ve,[e(`div`,He,[e(`div`,Ue,[e(`div`,We,[e(`h2`,Ge,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ke,[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,"before-upload":t.beforeUploadSizeGuard,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`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,qe,[(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 Ye=q(Be,[[`render`,Je],[`__scopeId`,`data-v-21f4dd97`]]),Xe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:N},data(){return{revertKey:0,options:[{value:z,label:this.$t(`seedream.model.seedream50pro`)},{value:B,label:this.$t(`seedream.model.seedream50`)},{value:U,label:this.$t(`seedream.model.seedream45`)},{value:W,label:this.$t(`seedream.model.seedream40`)},{value:R,label:this.$t(`seedream.model.seedream30t2i`)},{value:H,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(se)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Re(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=ze({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),T.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})}}}),Ze={class:`field`},Qe={class:`label`},$e={class:`box`},et={class:`title font-bold`};function tt(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Ze,[e(`div`,Qe,[e(`div`,$e,[e(`h2`,et,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 nt=q(Xe,[[`render`,tt],[`__scopeId`,`data-v-6413c179`]]),rt=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:N},data(){return{SEEDREAM_SIZE_ADAPTIVE:oe,pixelOptions:ae}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return X(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)}}}}),it={class:`field`},at={class:`label`},ot={class:`box`},st={class:`title font-bold`};function ct(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`,it,[e(`div`,at,[e(`div`,ot,[e(`h2`,st,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 lt=q(rt,[[`render`,ct],[`__scopeId`,`data-v-dd7bd021`]]),ut=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}),dt={key:0,class:`field`},ft={class:`label`},pt={class:`box`},mt={class:`title font-bold`},ht={class:`value`};function gt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,dt,[e(`div`,ft,[e(`div`,pt,[e(`h2`,mt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ht,[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 _t=q(ut,[[`render`,gt],[`__scopeId`,`data-v-f079fd20`]]),vt=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:N},data(){return{options:[...ce]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}}),yt={key:0,class:`field`},bt={class:`label`},xt={class:`box`},St={class:`title font-bold`};function Ct(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,yt,[e(`div`,bt,[e(`div`,xt,[e(`h2`,St,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 wt=q(vt,[[`render`,Ct],[`__scopeId`,`data-v-69ea4c07`]]),Tt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}}),Et={key:0,class:`field`},Dt={class:`label`},Ot={class:`box`},kt={class:`title font-bold`},At={class:`value`};function jt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Et,[e(`div`,Dt,[e(`div`,Ot,[e(`h2`,kt,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,At,[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 Mt=q(Tt,[[`render`,jt],[`__scopeId`,`data-v-10cdc1e0`]]),Nt=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(this.config?.model).guidanceScale},defaultValue(){return X(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)}}}}),Pt={key:0,class:`field`},Ft={class:`label`},It={class:`box`},Lt={class:`title font-bold`},Rt={class:`value`};function zt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Pt,[e(`div`,Ft,[e(`div`,It,[e(`h2`,Lt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Rt,[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 Bt=q(Nt,[[`render`,zt],[`__scopeId`,`data-v-7386f064`]]),Q=e=>{let t={...e||{}},n=Z(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}},Vt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:L,ElButton:K,PromptInput:Fe,Consumption:Ce,ImageInput:Ye,ModelSelector:nt,SizeSelector:lt,MaxImagesSelector:_t,OutputFormatSelector:wt,SeedInput:Mt,GuidanceScaleInput:Bt},emits:[`generate`],computed:{action(){return Z(this.config?.model,this.config?.image)},capabilities(){return X(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=Q(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return me({...e,action:this.action,model:V(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`)}}}),Ht={class:`flex flex-col h-full`},Ut={class:`flex-1 overflow-y-auto p-5`},Wt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Gt(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`,Ht,[e(`div`,Ut,[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`,Wt,[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 Kt=q(Vt,[[`render`,Gt]]),qt=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:te,ApplicationIcon:O,ChannelIcon:j,ImageIcon:I,InfoIcon:ee,LightningIcon:ie,MagicIcon:L,TimeIcon:k,WarningIcon:ne,CopyToClipboard:be,ElAlert:C,ImageWrapper:Ee,ElButton:K,ElTooltip:S,ImagePreview:Y,ApiCodeButton:we,ReportButton:xe},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return Q(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}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return V(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)}}}),Jt={class:`preview`},Yt={class:`left`},Xt={class:`main`},Zt={class:`bot`},Qt={class:`datetime`},$t=[`aria-label`],en={class:`info`},tn={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},nn={key:1,class:`prompt mt-2`},rn={key:0},an={key:0,class:n({content:!0})},on={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},sn={key:1,class:n({content:!0,failed:!0})},cn={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},ln={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},un={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},gn={key:2,class:`content`},_n={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Cn={key:3,class:n({content:!0})},wn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function En(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`time-icon`),w=l(`magic-icon`),T=l(`copy-to-clipboard`),E=l(`el-alert`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`api-code-button`),A=l(`report-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`,Jt,[e(`div`,Yt,[a(y,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,Xt,[e(`div`,Zt,[a(y,{capability:`seedream`,part:`name`}),e(`span`,Qt,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,$t)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,en,[Array.isArray(n.modelValue?.request?.image)&&n.modelValue?.request?.image.length>0?(h(),s(`div`,tn,[(h(!0),s(c,null,m(n.modelValue?.request?.image,(e,t)=>(h(),f(S,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,nn,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,rn,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,sn,[e(`div`,cn,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(D,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,ln,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(k,{path:`/seedream/images`,body:n.apiRequest},null,8,[`body`]),a(A,{service:`seedream`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(E,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,un,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,dn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,fn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,pn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,mn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,hn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,gn,[a(E,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,_n,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,vn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,yn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,$,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(h(),s(`p`,bn,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(T,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(h(),s(`p`,xn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Cn,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,wn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(h(),s(`p`,Tn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,an,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,on,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var Dn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:q(qt,[[`render`,En],[`__scopeId`,`data-v-b0055abb`]]),BotPlaceholder:Te,NoTasks:P,ScrollList:M},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?.()}}}),On={key:0},kn={key:2,class:`w-full h-full flex items-center justify-center`};function An(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`,On,[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`,kn,[a(v)])):o(``,!0)],64)}var jn=_({name:`SeedreamIndex`,components:{ConfigPanel:Kt,Layout:Me,RecentPanel:q(Dn,[[`render`,An]])},mixins:[pe],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===w.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 F({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(!fe(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;if(X(this.config?.model).imageRequired&&!this.config?.image?.length){T.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=Q(this.config);if(!ge())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}T.info(this.$t(`seedream.message.startingTask`)),de(`seedream`,ye.generate(e,{token:t})).then(()=>{T.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?T.error(this.$t(`seedream.message.usedUp`)):T.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 Mn(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 Nn=q(jn,[[`render`,Mn]]);export{Nn 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-C_fIfZ2e.js";import{t as x}from"./upload-CVDRsxmb.js";import{t as S}from"./tooltip-BUacpHBv.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-BKPWGzi5.js";import{t as E}from"./drawer-CA6SUQCX.js";import{t as D}from"./input-number-DdR-1uzl.js";import{t as O}from"./box-DHRJ9mGk.js";import{t as k}from"./clock-B1CCVLmO.js";import{a as A,c as j,n as M,o as N,r as P,t as F}from"./pagination-BnPTXcYn.js";import{t as I}from"./image-CQw24VOX.js";import{t as ee}from"./info-W0vYXBmL.js";import{t as te}from"./trash-2-07x8oBrr.js";import{t as ne}from"./triangle-alert-tdzQQL0N.js";import{t as re}from"./upload-DGU-Zk4A.js";import{t as L}from"./wand-sparkles-DbvGGoZ2.js";import{t as ie}from"./zap-C1Tbanxu.js";import{An as ae,Cn as R,Dn as z,En as B,Mn as oe,Nn as V,On as H,Tn as U,bn as se,kn as ce,wn as W,xn as G}from"./constants-u1eIRuNz.js";import{$t as le,Fi as K,Jt as ue,Mr as de,O as q,Qt as fe,en as pe,in as me,nn as he,pn as ge,si as _e,tn as ve,xi as J,zn as ye}from"./index-Dd6xXz4I.js";import{t as be}from"./CopyToClipboard-DJUH_cOj.js";import{t as xe}from"./ReportButton-_V9tUFQF.js";import{t as Y}from"./ImagePreview-SnY13jKc.js";import{n as Se}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Ce}from"./Consumption-Bt_7Xwm9.js";import{t as we}from"./ApiCodeButton-CqlibmjN.js";import{t as Te}from"./BotPlaceholder-99Dh87EM.js";import{t as Ee}from"./ImageWrapper-DQUTRMZA.js";var De=_({name:`LayoutSeedream`,components:{MagicIcon:L,ElDrawer:E,ElButton:K},mixins:[Se]}),Oe={class:`main flex flex-row flex-1`},ke={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)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(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`,ke,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ae,[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 Me=q(De,[[`render`,je],[`__scopeId`,`data-v-c10167d0`]]),Ne=_({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 Pe(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 Fe=q(Ne,[[`render`,Pe]]),Ie={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 X(e){switch(e){case z:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case B:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case U: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 R:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:G[R],outputFormat:!1,tools:!1};case H:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:G[H],outputFormat:!1,tools:!1};default:return Ie}}function Z(e,t){let n=X(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Le=[`1K`,`2K`,`3K`,`4K`];function Re(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=X(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();(Le.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 ze(e,t,n){let r={...e},i=X(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 Be=_({name:`SeedreamImageInput`,components:{UploadIcon:re,ElUpload:x,ElButton:K,InfoIcon:N,ImagePreview:Y},mixins:[he,ve,le,ue],data(){return{fileList:[],uploadUrl:_e()+`/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 X(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(){T.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){T.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()}}}),Ve={key:0},He={class:`field`},Ue={class:`label`},We={class:`box`},Ge={class:`title font-bold`},Ke={class:`value`},qe={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Je(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`,Ve,[e(`div`,He,[e(`div`,Ue,[e(`div`,We,[e(`h2`,Ge,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ke,[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,"before-upload":t.beforeUploadSizeGuard,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`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,qe,[(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 Ye=q(Be,[[`render`,Je],[`__scopeId`,`data-v-21f4dd97`]]),Xe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:N},data(){return{revertKey:0,options:[{value:z,label:this.$t(`seedream.model.seedream50pro`)},{value:B,label:this.$t(`seedream.model.seedream50`)},{value:U,label:this.$t(`seedream.model.seedream45`)},{value:W,label:this.$t(`seedream.model.seedream40`)},{value:R,label:this.$t(`seedream.model.seedream30t2i`)},{value:H,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(se)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Re(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=ze({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),T.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})}}}),Ze={class:`field`},Qe={class:`label`},$e={class:`box`},et={class:`title font-bold`};function tt(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Ze,[e(`div`,Qe,[e(`div`,$e,[e(`h2`,et,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 nt=q(Xe,[[`render`,tt],[`__scopeId`,`data-v-6413c179`]]),rt=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:N},data(){return{SEEDREAM_SIZE_ADAPTIVE:oe,pixelOptions:ae}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return X(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)}}}}),it={class:`field`},at={class:`label`},ot={class:`box`},st={class:`title font-bold`};function ct(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`,it,[e(`div`,at,[e(`div`,ot,[e(`h2`,st,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 lt=q(rt,[[`render`,ct],[`__scopeId`,`data-v-dd7bd021`]]),ut=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}),dt={key:0,class:`field`},ft={class:`label`},pt={class:`box`},mt={class:`title font-bold`},ht={class:`value`};function gt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,dt,[e(`div`,ft,[e(`div`,pt,[e(`h2`,mt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ht,[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 _t=q(ut,[[`render`,gt],[`__scopeId`,`data-v-f079fd20`]]),vt=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:N},data(){return{options:[...ce]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}}),yt={key:0,class:`field`},bt={class:`label`},xt={class:`box`},St={class:`title font-bold`};function Ct(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,yt,[e(`div`,bt,[e(`div`,xt,[e(`h2`,St,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 wt=q(vt,[[`render`,Ct],[`__scopeId`,`data-v-69ea4c07`]]),Tt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(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)}}}}),Et={key:0,class:`field`},Dt={class:`label`},Ot={class:`box`},kt={class:`title font-bold`},At={class:`value`};function jt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Et,[e(`div`,Dt,[e(`div`,Ot,[e(`h2`,kt,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,At,[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 Mt=q(Tt,[[`render`,jt],[`__scopeId`,`data-v-10cdc1e0`]]),Nt=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return X(this.config?.model).guidanceScale},defaultValue(){return X(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)}}}}),Pt={key:0,class:`field`},Ft={class:`label`},It={class:`box`},Lt={class:`title font-bold`},Rt={class:`value`};function zt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Pt,[e(`div`,Ft,[e(`div`,It,[e(`h2`,Lt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Rt,[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 Bt=q(Nt,[[`render`,zt],[`__scopeId`,`data-v-7386f064`]]),Q=e=>{let t={...e||{}},n=Z(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}},Vt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:L,ElButton:K,PromptInput:Fe,Consumption:Ce,ImageInput:Ye,ModelSelector:nt,SizeSelector:lt,MaxImagesSelector:_t,OutputFormatSelector:wt,SeedInput:Mt,GuidanceScaleInput:Bt},emits:[`generate`],computed:{action(){return Z(this.config?.model,this.config?.image)},capabilities(){return X(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=Q(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return me({...e,action:this.action,model:V(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`)}}}),Ht={class:`flex flex-col h-full`},Ut={class:`flex-1 overflow-y-auto p-5`},Wt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Gt(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`,Ht,[e(`div`,Ut,[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`,Wt,[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 Kt=q(Vt,[[`render`,Gt]]),qt=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:te,ApplicationIcon:O,ChannelIcon:j,ImageIcon:I,InfoIcon:ee,LightningIcon:ie,MagicIcon:L,TimeIcon:k,WarningIcon:ne,CopyToClipboard:be,ElAlert:C,ImageWrapper:Ee,ElButton:K,ElTooltip:S,ImagePreview:Y,ApiCodeButton:we,ReportButton:xe},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return Q(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}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return V(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)}}}),Jt={class:`preview`},Yt={class:`left`},Xt={class:`main`},Zt={class:`bot`},Qt={class:`datetime`},$t=[`aria-label`],en={class:`info`},tn={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},nn={key:1,class:`prompt mt-2`},rn={key:0},an={key:0,class:n({content:!0})},on={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},sn={key:1,class:n({content:!0,failed:!0})},cn={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},ln={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},un={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},gn={key:2,class:`content`},_n={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Cn={key:3,class:n({content:!0})},wn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function En(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`time-icon`),w=l(`magic-icon`),T=l(`copy-to-clipboard`),E=l(`el-alert`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`api-code-button`),A=l(`report-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`,Jt,[e(`div`,Yt,[a(y,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,Xt,[e(`div`,Zt,[a(y,{capability:`seedream`,part:`name`}),e(`span`,Qt,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,$t)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,en,[Array.isArray(n.modelValue?.request?.image)&&n.modelValue?.request?.image.length>0?(h(),s(`div`,tn,[(h(!0),s(c,null,m(n.modelValue?.request?.image,(e,t)=>(h(),f(S,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,nn,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,rn,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,sn,[e(`div`,cn,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(D,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,ln,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(k,{path:`/seedream/images`,body:n.apiRequest},null,8,[`body`]),a(A,{service:`seedream`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(E,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,un,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,dn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,fn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,pn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,mn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,hn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,gn,[a(E,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,_n,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,vn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,yn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,$,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(h(),s(`p`,bn,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(T,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(h(),s(`p`,xn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Cn,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,wn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(h(),s(`p`,Tn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,an,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,on,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var Dn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:q(qt,[[`render`,En],[`__scopeId`,`data-v-b0055abb`]]),BotPlaceholder:Te,NoTasks:P,ScrollList:M},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?.()}}}),On={key:0},kn={key:2,class:`w-full h-full flex items-center justify-center`};function An(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`,On,[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`,kn,[a(v)])):o(``,!0)],64)}var jn=_({name:`SeedreamIndex`,components:{ConfigPanel:Kt,Layout:Me,RecentPanel:q(Dn,[[`render`,An]])},mixins:[pe],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===w.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 F({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(!fe(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;if(X(this.config?.model).imageRequired&&!this.config?.image?.length){T.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=Q(this.config);if(!ge())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}T.info(this.$t(`seedream.message.startingTask`)),de(`seedream`,ye.generate(e,{token:t})).then(()=>{T.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?T.error(this.$t(`seedream.message.usedUp`)):T.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 Mn(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 Nn=q(jn,[[`render`,Mn]]);export{Nn 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_LIRKEc.js";import{t as b}from"./upload-CVDRsxmb.js";import{t as x}from"./tooltip-65yx4tvR.js";import{t as S}from"./alert-BprQRUmf.js";import{h as C,v as w}from"./models-BKPWGzi5.js";import{t as T}from"./drawer-lPnIZOSX.js";import{t as E}from"./input-number-CScClEsg.js";import{t as D}from"./slider-Dpo1vqOi.js";import{t as O}from"./clock-picb7ciF.js";import{a as k,c as A,n as j,o as M,r as N,t as P}from"./pagination-51ny6Oso.js";import{t as F}from"./info-DhXkijI-.js";import{t as ee}from"./trash-2-DtPyMpc8.js";import{t as te}from"./triangle-alert-DpLecGNq.js";import{t as I}from"./upload-D2oHJ14J.js";import{t as L}from"./wand-sparkles--swdHIwq.js";import{dr as R,fr as z,ur as B}from"./constants-u1eIRuNz.js";import{$t as V,Fi as H,Jt as U,Mr as W,O as G,Qt as K,Zn as q,en as J,in as Y,nn as X,pn as Z,si as Q,tn as ne,xi as re}from"./index-BK4q_lZQ.js";import{t as ie}from"./CopyToClipboard-8zEkaydk.js";import{t as ae}from"./ReportButton-C3Kjfp0k.js";import{t as oe}from"./ImagePreview-aup3tBhe.js";import{n as se}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ce}from"./Consumption-DSV6Ajvn.js";import{t as le}from"./ApiCodeButton-DBpwradV.js";import{t as ue}from"./BotPlaceholder-CQECCUDa.js";import{t as de}from"./ImageWrapper-lBDb2gpG.js";var fe=_({name:`LayoutFlux`,components:{MagicIcon:L,ElDrawer:T,ElButton:H},mixins:[se]}),pe={class:`main flex flex-row flex-1`},me={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)]`},he={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ge(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,pe,[e(`div`,me,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,he,[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 _e=G(fe,[[`render`,ge],[`__scopeId`,`data-v-72e82d52`]]),ve=_({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||=z}}),ye={class:`field`},be={class:`title font-bold`};function xe(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,ye,[e(`h2`,be,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 Se=G(ve,[[`render`,xe],[`__scopeId`,`data-v-e9b17945`]]),Ce=_({name:`CountSelector`,components:{ElSlider:D,InfoIcon:M,ElInputNumber:E},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}}),we={class:`flex justify-between`},Te={class:`flex justify-start items-center`},Ee={class:`text-sm font-bold`},De={class:`flex justify-end items-center`},Oe={class:`w-full`};function ke(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`,we,[e(`div`,Te,[e(`span`,Ee,i(t.$t(`flux.name.numbers`)),1),a(d,{content:t.$t(`flux.description.numbers`)},null,8,[`content`])]),e(`div`,De,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Oe,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:1,max:4,step:1},null,8,[`modelValue`])])])}var Ae=G(Ce,[[`render`,ke]]),je=_({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||=R}}),Me={class:`field`},Ne={class:`title font-bold`};function Pe(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Me,[e(`h2`,Ne,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 Fe=G(je,[[`render`,Pe],[`__scopeId`,`data-v-81fd05e5`]]),Ie=_({name:`ImageUrlInput`,components:{UploadIcon:I,ElUpload:b,ElButton:H,InfoIcon:M,ImagePreview:oe},mixins:[X,ne,V,U],emits:[`change`],data(){return{fileList:[],uploadUrl:Q()+`/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(){w.warning(this.$t(`flux.message.uploadStartImageExceed`))},onError(){w.error(this.$t(`flux.message.uploadStartImageError`))}}}),Le={class:`relative`},Re={class:`flex justify-between`},ze={class:`flex justify-start items-center`},Be={class:`text-sm font-bold`};function Ve(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`,Le,[e(`div`,Re,[e(`div`,ze,[e(`span`,Be,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`,"before-upload":t.beforeUploadSizeGuard,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`,`before-upload`,`action`,`on-exceed`,`on-error`,`headers`])])}var He=G(Ie,[[`render`,Ve],[`__scopeId`,`data-v-9830e0c3`]]),Ue=_({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 We(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 Ge=G(Ue,[[`render`,We]]),Ke=_({name:`SizeSelector`,components:{ElSelect:v,ElOption:y},data(){return{options:B}},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`}}),qe={class:`field`},Je={class:`title font-bold`};function Ye(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,qe,[e(`h2`,Je,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 Xe=_({name:`PresetPanel`,components:{MagicIcon:L,ElButton:H,PromptInput:Ge,ModelSelector:Se,CountSelector:Ae,Consumption:ce,ActionSelector:Fe,ImageUrlInput:He,SizeSelector:G(Ke,[[`render`,Ye],[`__scopeId`,`data-v-8c58dc91`]])},emits:[`generate`],computed:{config(){return this.$store.state.flux?.config},consumption(){return Y(this.config,this.service?.cost)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ze={class:`flex flex-col h-full`},Qe={class:`flex-1 overflow-y-auto p-5`},$e={class:`flex flex-col items-center justify-center px-5 pb-5`};function et(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`,Ze,[e(`div`,Qe,[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`,$e,[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 tt=G(Xe,[[`render`,et]]),nt=_({name:`TaskPreview`,components:{DeleteIcon:ee,ElTooltip:x,ChannelIcon:A,InfoIcon:F,MagicIcon:L,TimeIcon:O,WarningIcon:te,CopyToClipboard:ie,ElAlert:S,ImageWrapper:de,ApiCodeButton:le,ReportButton:ae},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 re.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}),w.success(this.$t(`common.message.deleteTaskSuccess`))}catch{w.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`)}}}),rt={class:`preview`},it={class:`left`},at={class:`main`},ot={class:`bot`},st={class:`datetime`},ct=[`aria-label`],lt={class:`info`},ut={key:0,class:`prompt mt-2`},dt={key:0},ft={key:0,class:n({content:!0,failed:!0})},pt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},mt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},ht={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_t={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},vt={key:1,class:n({content:!0})},yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},St={key:2,class:n({content:!0})},Ct={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function wt(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(`report-button`),T=l(`channel-icon`),E=l(`magic-icon`),D=l(`copy-to-clipboard`),O=l(`time-icon`),k=l(`el-alert`),A=l(`warning-icon`),j=l(`info-icon`);return h(),s(`div`,rt,[e(`div`,it,[a(y,{capability:`flux`,part:`avatar`,class:`avatar`})]),e(`div`,at,[e(`div`,ot,[a(y,{capability:`flux`,part:`name`}),e(`span`,st,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,ct)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,lt,[n.modelValue?.request?.prompt?(h(),s(`p`,ut,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,dt,` - (`+i(n.$t(`flux.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,ft,[e(`div`,pt,[(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`,mt,[a(C,{path:`/flux/images`,body:n.modelValue?.request},null,8,[`body`]),a(w,{service:`flux`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(k,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,ht,[a(T,{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`,gt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,_t,[a(O,{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`,vt,[a(k,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.failure`)),1)]),default:p(()=>[e(`p`,yt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,$,[a(j,{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(D,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,bt,[a(O,{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`,xt,[a(T,{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(D,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0),n.modelValue?.response?o(``,!0):(h(),s(`div`,St,[a(k,{closable:!1,class:`info`},{template:p(()=>[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.status.pending`)),1)]),default:p(()=>[e(`p`,Ct,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Tt=_({name:`RecentPanel`,components:{TaskPreview:G(nt,[[`render`,wt],[`__scopeId`,`data-v-7bae4285`]]),BotPlaceholder:ue,NoTasks:N,ScrollList:j},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?.()}}}),Et={key:0},Dt={key:2,class:`w-full h-full flex items-center justify-center`};function Ot(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`,Et,[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`,Dt,[a(v)])):o(``,!0)],64)}var kt=_({name:`FluxIndex`,components:{ConfigPanel:tt,Layout:_e,RecentPanel:G(Tt,[[`render`,Ot]])},mixins:[J],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.flux?.status?.getApplications===C.Request},tasksLoading(){return this.$store.state.flux?.status?.getTasks===C.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 P({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(!K(this.uploadTracker,e=>this.$t(e),e=>w.warning(e)))return;let e={...this.config,async:!0};if(!Z())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}w.info(this.$t(`flux.message.startingTask`)),W(`flux`,q.generate(e,{token:t})).then(()=>{w.success(this.$t(`flux.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?w.error(this.$t(`flux.message.usedUp`)):w.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 At(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 jt=G(kt,[[`render`,At]]);export{jt 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-C_fIfZ2e.js";import{t as b}from"./upload-CVDRsxmb.js";import{t as x}from"./tooltip-BUacpHBv.js";import{t as S}from"./alert-BprQRUmf.js";import{h as C,v as w}from"./models-BKPWGzi5.js";import{t as T}from"./drawer-CA6SUQCX.js";import{t as E}from"./input-number-DdR-1uzl.js";import{t as D}from"./slider-DN9H320Q.js";import{t as O}from"./clock-B1CCVLmO.js";import{a as k,c as A,n as j,o as M,r as N,t as P}from"./pagination-BnPTXcYn.js";import{t as F}from"./info-W0vYXBmL.js";import{t as ee}from"./trash-2-07x8oBrr.js";import{t as te}from"./triangle-alert-tdzQQL0N.js";import{t as I}from"./upload-DGU-Zk4A.js";import{t as L}from"./wand-sparkles-DbvGGoZ2.js";import{dr as R,fr as z,ur as B}from"./constants-u1eIRuNz.js";import{$t as V,Fi as H,Jt as U,Mr as W,O as G,Qt as K,Zn as q,en as J,in as Y,nn as X,pn as Z,si as Q,tn as ne,xi as re}from"./index-Dd6xXz4I.js";import{t as ie}from"./CopyToClipboard-DJUH_cOj.js";import{t as ae}from"./ReportButton-_V9tUFQF.js";import{t as oe}from"./ImagePreview-SnY13jKc.js";import{n as se}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ce}from"./Consumption-Bt_7Xwm9.js";import{t as le}from"./ApiCodeButton-CqlibmjN.js";import{t as ue}from"./BotPlaceholder-99Dh87EM.js";import{t as de}from"./ImageWrapper-DQUTRMZA.js";var fe=_({name:`LayoutFlux`,components:{MagicIcon:L,ElDrawer:T,ElButton:H},mixins:[se]}),pe={class:`main flex flex-row flex-1`},me={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)]`},he={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ge(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,pe,[e(`div`,me,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,he,[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 _e=G(fe,[[`render`,ge],[`__scopeId`,`data-v-72e82d52`]]),ve=_({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||=z}}),ye={class:`field`},be={class:`title font-bold`};function xe(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,ye,[e(`h2`,be,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 Se=G(ve,[[`render`,xe],[`__scopeId`,`data-v-e9b17945`]]),Ce=_({name:`CountSelector`,components:{ElSlider:D,InfoIcon:M,ElInputNumber:E},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}}),we={class:`flex justify-between`},Te={class:`flex justify-start items-center`},Ee={class:`text-sm font-bold`},De={class:`flex justify-end items-center`},Oe={class:`w-full`};function ke(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`,we,[e(`div`,Te,[e(`span`,Ee,i(t.$t(`flux.name.numbers`)),1),a(d,{content:t.$t(`flux.description.numbers`)},null,8,[`content`])]),e(`div`,De,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,Oe,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:1,max:4,step:1},null,8,[`modelValue`])])])}var Ae=G(Ce,[[`render`,ke]]),je=_({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||=R}}),Me={class:`field`},Ne={class:`title font-bold`};function Pe(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,Me,[e(`h2`,Ne,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 Fe=G(je,[[`render`,Pe],[`__scopeId`,`data-v-81fd05e5`]]),Ie=_({name:`ImageUrlInput`,components:{UploadIcon:I,ElUpload:b,ElButton:H,InfoIcon:M,ImagePreview:oe},mixins:[X,ne,V,U],emits:[`change`],data(){return{fileList:[],uploadUrl:Q()+`/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(){w.warning(this.$t(`flux.message.uploadStartImageExceed`))},onError(){w.error(this.$t(`flux.message.uploadStartImageError`))}}}),Le={class:`relative`},Re={class:`flex justify-between`},ze={class:`flex justify-start items-center`},Be={class:`text-sm font-bold`};function Ve(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`,Le,[e(`div`,Re,[e(`div`,ze,[e(`span`,Be,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`,"before-upload":t.beforeUploadSizeGuard,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`,`before-upload`,`action`,`on-exceed`,`on-error`,`headers`])])}var He=G(Ie,[[`render`,Ve],[`__scopeId`,`data-v-9830e0c3`]]),Ue=_({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 We(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 Ge=G(Ue,[[`render`,We]]),Ke=_({name:`SizeSelector`,components:{ElSelect:v,ElOption:y},data(){return{options:B}},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`}}),qe={class:`field`},Je={class:`title font-bold`};function Ye(t,n,r,o,u,d){let g=l(`el-option`),_=l(`el-select`);return h(),s(`div`,qe,[e(`h2`,Je,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 Xe=_({name:`PresetPanel`,components:{MagicIcon:L,ElButton:H,PromptInput:Ge,ModelSelector:Se,CountSelector:Ae,Consumption:ce,ActionSelector:Fe,ImageUrlInput:He,SizeSelector:G(Ke,[[`render`,Ye],[`__scopeId`,`data-v-8c58dc91`]])},emits:[`generate`],computed:{config(){return this.$store.state.flux?.config},consumption(){return Y(this.config,this.service?.cost)},service(){return this.$store.state.flux?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ze={class:`flex flex-col h-full`},Qe={class:`flex-1 overflow-y-auto p-5`},$e={class:`flex flex-col items-center justify-center px-5 pb-5`};function et(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`,Ze,[e(`div`,Qe,[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`,$e,[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 tt=G(Xe,[[`render`,et]]),nt=_({name:`TaskPreview`,components:{DeleteIcon:ee,ElTooltip:x,ChannelIcon:A,InfoIcon:F,MagicIcon:L,TimeIcon:O,WarningIcon:te,CopyToClipboard:ie,ElAlert:S,ImageWrapper:de,ApiCodeButton:le,ReportButton:ae},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 re.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}),w.success(this.$t(`common.message.deleteTaskSuccess`))}catch{w.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`)}}}),rt={class:`preview`},it={class:`left`},at={class:`main`},ot={class:`bot`},st={class:`datetime`},ct=[`aria-label`],lt={class:`info`},ut={key:0,class:`prompt mt-2`},dt={key:0},ft={key:0,class:n({content:!0,failed:!0})},pt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},mt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},ht={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_t={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},vt={key:1,class:n({content:!0})},yt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},St={key:2,class:n({content:!0})},Ct={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function wt(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(`report-button`),T=l(`channel-icon`),E=l(`magic-icon`),D=l(`copy-to-clipboard`),O=l(`time-icon`),k=l(`el-alert`),A=l(`warning-icon`),j=l(`info-icon`);return h(),s(`div`,rt,[e(`div`,it,[a(y,{capability:`flux`,part:`avatar`,class:`avatar`})]),e(`div`,at,[e(`div`,ot,[a(y,{capability:`flux`,part:`name`}),e(`span`,st,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,ct)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,lt,[n.modelValue?.request?.prompt?(h(),s(`p`,ut,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,dt,` - (`+i(n.$t(`flux.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,ft,[e(`div`,pt,[(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`,mt,[a(C,{path:`/flux/images`,body:n.modelValue?.request},null,8,[`body`]),a(w,{service:`flux`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(k,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,ht,[a(T,{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`,gt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,_t,[a(O,{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`,vt,[a(k,{closable:!1,class:`failure`},{template:p(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.failure`)),1)]),default:p(()=>[e(`p`,yt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,$,[a(j,{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(D,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,bt,[a(O,{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`,xt,[a(T,{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(D,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0),n.modelValue?.response?o(``,!0):(h(),s(`div`,St,[a(k,{closable:!1,class:`info`},{template:p(()=>[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.status.pending`)),1)]),default:p(()=>[e(`p`,Ct,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`flux.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(D,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Tt=_({name:`RecentPanel`,components:{TaskPreview:G(nt,[[`render`,wt],[`__scopeId`,`data-v-7bae4285`]]),BotPlaceholder:ue,NoTasks:N,ScrollList:j},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?.()}}}),Et={key:0},Dt={key:2,class:`w-full h-full flex items-center justify-center`};function Ot(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`,Et,[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`,Dt,[a(v)])):o(``,!0)],64)}var kt=_({name:`FluxIndex`,components:{ConfigPanel:tt,Layout:_e,RecentPanel:G(Tt,[[`render`,Ot]])},mixins:[J],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.flux?.status?.getApplications===C.Request},tasksLoading(){return this.$store.state.flux?.status?.getTasks===C.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 P({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(!K(this.uploadTracker,e=>this.$t(e),e=>w.warning(e)))return;let e={...this.config,async:!0};if(!Z())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}w.info(this.$t(`flux.message.startingTask`)),W(`flux`,q.generate(e,{token:t})).then(()=>{w.success(this.$t(`flux.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?w.error(this.$t(`flux.message.usedUp`)):w.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 At(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 jt=G(kt,[[`render`,At]]);export{jt as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-B_LIRKEc.js";import{n as x,t as S}from"./tabs-gaoETP28.js";import{t as C}from"./upload-CVDRsxmb.js";import{t as w}from"./tooltip-65yx4tvR.js";import{t as T}from"./alert-BprQRUmf.js";import{h as E,v as D}from"./models-BKPWGzi5.js";import{t as O}from"./drawer-lPnIZOSX.js";import{t as k}from"./switch-BvCHyQIT.js";import{t as A}from"./box-CyVbYdiI.js";import{t as j}from"./clock-picb7ciF.js";import{a as M,c as N,n as P,o as F,r as I,s as L,t as R}from"./pagination-51ny6Oso.js";import{t as ee}from"./info-DhXkijI-.js";import{t as z}from"./languages-Br0TDzki.js";import{t as B}from"./trash-2-DtPyMpc8.js";import{t as V}from"./triangle-alert-DpLecGNq.js";import{t as te}from"./upload-D2oHJ14J.js";import{t as H}from"./wand-sparkles--swdHIwq.js";import{t as ne}from"./zap-BxCVvy5i.js";import{ai as re,oi as ie,si as U}from"./constants-u1eIRuNz.js";import{$t as W,Fi as G,Jt as K,Mr as q,O as J,Qt as Y,en as ae,in as oe,nn as se,pn as ce,rr as le,si as ue,tn as de,xi as fe}from"./index-BK4q_lZQ.js";import{t as pe}from"./CopyToClipboard-8zEkaydk.js";import{t as me}from"./ReportButton-C3Kjfp0k.js";import{t as X}from"./ImagePreview-aup3tBhe.js";import{n as he}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ge}from"./Consumption-DSV6Ajvn.js";import{t as _e}from"./VideoPlayer-DOF-WUP8.js";import{t as ve}from"./ApiCodeButton-DBpwradV.js";import{t as ye}from"./BotPlaceholder-CQECCUDa.js";var be=v({name:`LayoutVeo`,components:{MagicIcon:H,ElDrawer:O,ElButton:G},mixins:[he]}),xe={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 we(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,xe,[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`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Te=J(be,[[`render`,we],[`__scopeId`,`data-v-293c9493`]]),Z=`veo31-fast-ingredients`,Ee=[{value:`veo31-fast`,label:`Veo 3.1 Fast`},{value:`veo3-fast`,label:`Veo 3 Fast`},{value:`veo31`,label:`Veo 3.1`},{value:`veo3`,label:`Veo 3`}],Q=(e,t)=>{let n=!!(e?.action&&e.action!==t),r={...e,action:t};return t===`text2video`?(r.model=r.model===`veo31-fast-ingredients`?U:r.model||`veo31-fast`,delete r.image_urls,r):t===`ingredients2video`?(r.model=Z,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,3),r):(r.model=r.model===`veo31-fast-ingredients`?U:r.model||`veo31-fast`,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,2),r)},De=e=>{let t={...Q(e,e?.action||`text2video`),async:!0};return t.image_urls?.length||delete t.image_urls,t},Oe=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},computed:{isModelLocked(){return this.$store.state.veo?.config?.action===`ingredients2video`},options(){return this.isModelLocked?[{value:Z,label:`Veo 3.1 Fast`}]:Ee},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=U}}),ke={class:`field`},Ae={class:`title font-bold`};function je(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,ke,[e(`h2`,Ae,i(t.$t(`veo.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),disabled:t.isModelLocked},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])])}var Me=J(Oe,[[`render`,je],[`__scopeId`,`data-v-90ed8cff`]]),Ne=v({name:`ActionSelector`,components:{ElTabs:x,ElTabPane:S},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)}]},value(){return this.$store.state.veo?.config?.action||`text2video`}},mounted(){this.$store.state.veo?.config?.action||this.onUpdate(re)},methods:{onUpdate(e){this.$store.commit(`veo/setConfig`,Q(this.$store.state.veo?.config,e))}}}),Pe={class:`tab-label`},Fe={class:`text`};function Ie(t,n,r,a,o,u){let d=l(`el-tab-pane`),m=l(`el-tabs`);return g(),f(m,{"model-value":t.value,class:`action-tabs scenario-tabs scenario-tabs--divided`,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(d,{key:t.value,name:t.value},{label:p(()=>[e(`span`,Pe,[e(`span`,Fe,i(t.label),1)])]),_:2},1032,[`name`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Le=J(Ne,[[`render`,Ie],[`__scopeId`,`data-v-c72fb85c`]]),Re=v({name:`TranslationSelector`,components:{ElSwitch:k,InfoIcon:F},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),ze={class:`relative`},Be={class:`flex justify-between`},Ve={class:`flex justify-start items-center`},He={class:`text-sm font-bold`},Ue={class:`flex justify-end items-center`};function We(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`span`,He,i(t.$t(`veo.name.translation`)),1),a(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,Ue,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ge=J(Re,[[`render`,We]]),Ke=v({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=ie}}),qe={class:`text-sm font-bold mb-2 block`},Je={class:`items`},Ye=[`onClick`],Xe={class:`name`};function Ze(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,qe,i(t.$t(`veo.name.ratio`)),1),e(`div`,Je,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,Xe,i(r.label),1)],10,Ye))),128))])])}var Qe=J(Ke,[[`render`,Ze],[`__scopeId`,`data-v-28c472c4`]]),$e=v({name:`StartEndImage`,components:{UploadIcon:te,ElUpload:C,ElButton:G,InfoIcon:F,ImagePreview:X},mixins:[se,de,W,K],props:{limit:{type:Number,default:2},ingredients:{type:Boolean,default:!1}},emits:[`change`],data(){return{fileList:[],uploadUrl:ue()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},title(){return this.ingredients?this.$t(`veo.button.actionIngredients`):this.$t(`veo.name.startEndImage`)},description(){return this.ingredients?this.$t(`veo.description.imageUrl`):this.$t(`veo.description.uploadStartEndImage`)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(e=>!!e)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},watch:{limit(){this.fileList.length>this.limit&&(this.fileList=this.fileList.slice(0,this.limit),this.onSetStartEndImageUrl())}},mounted(){this.fileList=(this.value||[]).map((e,t)=>({name:`reference-${t+1}`,percentage:100,response:{file_url:e},status:`success`,uid:Date.now()+t,url:e}))},methods:{onExceed(){D.warning(this.$t(`veo.message.uploadReferencesLimit`,{limit:this.limit}))},onError(){D.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()},onRemove(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),this.onSetStartEndImageUrl()}}}),et={class:`relative`},tt={class:`flex justify-between`},nt={class:`flex justify-start items-center`},rt={class:`text-sm font-bold`};function it(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,et,[e(`div`,tt,[e(`div`,nt,[e(`span`,rt,i(t.title),1),a(h,{content:t.description},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:t.limit,class:`upload-wrapper`,multiple:!0,"before-upload":t.beforeUploadSizeGuard,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?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},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(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var at=J($e,[[`render`,it],[`__scopeId`,`data-v-a4391199`]]),ot=v({name:`PromptInput`,components:{PromptTextarea:M},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function st(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ct=v({name:`ConfigPanel`,components:{MagicIcon:H,ElButton:G,Consumption:ge,PromptInput:J(ot,[[`render`,st]]),ModelSelector:Me,StartEndImage:at,ActionSelector:Le,TranslationSelector:Ge,AspectRatioSelector:Qe},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},showsImages(){return this.config?.action===`image2video`||this.config?.action===`ingredients2video`},imageLimit(){return this.config?.action===`ingredients2video`?3:2},consumption(){return oe(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),lt={class:`flex flex-col h-full`},ut={class:`flex-1 overflow-y-auto p-5`},dt={class:`flex flex-col items-center justify-center px-5 pb-5`};function ft(t,n,c,u,d,m){let h=l(`action-selector`),_=l(`model-selector`),v=l(`start-end-image`),y=l(`prompt-input`),b=l(`aspect-ratio-selector`),x=l(`translation-selector`),S=l(`consumption`),C=l(`magic-icon`),w=l(`el-button`);return g(),s(`div`,lt,[e(`div`,ut,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),t.showsImages?(g(),f(v,{key:t.config?.action,class:`mb-4`,limit:t.imageLimit,ingredients:t.config?.action===`ingredients2video`},null,8,[`limit`,`ingredients`])):o(``,!0),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`})]),e(`div`,dt,[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(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var pt=J(ct,[[`render`,ft]]),mt=v({name:`TaskPreview`,components:{DeleteIcon:B,ApplicationIcon:A,ChannelIcon:N,ExpandIcon:L,InfoIcon:ee,LanguageIcon:z,LightningIcon:ne,MagicIcon:H,TimeIcon:j,WarningIcon:V,CopyToClipboard:pe,ElAlert:T,VideoPlayer:_e,ImagePreview:X,ElTooltip:w,ElButton:G,ApiCodeButton:ve,ReportButton:me},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{referenceImages(){let e=this.modelValue?.request?.image_urls;return Array.isArray(e)?e.filter(e=>typeof e==`string`&&!!e):[]},actionLabel(){let e=this.modelValue?.request,t=e?.model===`veo31-fast-ingredients`||this.referenceImages.length>2?`ingredients2video`:this.referenceImages.length>0?`image2video`:`text2video`,n=e?.action||t;return this.$t({text2video:`veo.button.action1`,image2video:`veo.button.action2`,ingredients2video:`veo.button.actionIngredients`}[n]||`veo.name.action`)},traceId(){return this.modelValue?.response?.trace_id||this.modelValue?.trace_id},taskInfoClass(){return this.modelValue?.response?.success===!0?`success`:this.modelValue?.response?.success===!1?`failure`:`info`}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await fe.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(`veo/deleteTask`,{id:e}),D.success(this.$t(`common.message.deleteTaskSuccess`))}catch{D.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),ht={class:`preview`},gt={class:`left`},_t={class:`main`},vt={class:`bot`},yt={class:`datetime`},bt=[`aria-label`],xt={class:`info`},St={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Ct={key:1,class:`prompt mt-2`},wt={key:0},Tt={key:1},Et={key:0,class:n({content:!0,failed:!0})},Dt={key:0,class:`mb-4`},Ot={key:1,class:n({operations:!0,"mt-2":!0})},kt={key:1,class:n({content:!0})},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={class:n({content:!0})},Mt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Rt(u,d,m,_,v,y){let b=l(`capability-presentation`),x=l(`delete-icon`),S=l(`el-tooltip`),C=l(`image-preview`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`report-button`),O=l(`warning-icon`),k=l(`info-icon`),A=l(`copy-to-clipboard`),j=l(`el-alert`),M=l(`application-icon`),N=l(`lightning-icon`),P=l(`expand-icon`),F=l(`language-icon`),I=l(`magic-icon`),L=l(`time-icon`),R=l(`channel-icon`);return g(),s(`div`,ht,[e(`div`,gt,[a(b,{capability:`veo`,part:`avatar`,class:`avatar`})]),e(`div`,_t,[e(`div`,vt,[a(b,{capability:`veo`,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?(g(),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,bt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,xt,[u.referenceImages.length>0?(g(),s(`div`,St,[(g(!0),s(c,null,h(u.referenceImages,(e,t)=>(g(),f(C,{key:`${t}-${e}`,url:e,name:`reference-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(g(),s(`p`,Ct,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(g(),s(`span`,wt,` - (`+i(u.$t(`veo.status.pending`))+`) `,1)),Array.isArray(u.modelValue?.response?.data)&&u.modelValue?.response?.data[0]?.state===`running`?(g(),s(`span`,Tt,` - (`+i(u.$t(`veo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),u.modelValue?.response?.success===!0&&u.modelValue?.response?.data?(g(),s(`div`,Et,[u.modelValue?.response?.data[0]?.video_url?(g(),s(`div`,Dt,[a(w,{src:u.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):o(``,!0),u.modelValue?.response.success?(g(),s(`div`,Ot,[a(S,{class:`box-item`,effect:`dark`,content:u.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:p(()=>[u.modelValue?.response?.data[0]?.video_url?(g(),f(T,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:d[1]||=e=>u.onDownload(e,u.modelValue?.response?.data[0]?.video_url)},{default:p(()=>[r(i(u.$t(`veo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(E,{path:`/veo/videos`,body:u.modelValue?.request},null,8,[`body`]),a(D,{service:`veo`,"target-id":u.modelValue?.id,snapshot:{prompt:u.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0)])):o(``,!0),u.modelValue?.response?.success===!1?(g(),s(`div`,kt,[a(j,{closable:!1,class:`failure`},{template:p(()=>[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.failure`)),1)]),default:p(()=>[e(`p`,At,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(A,{content:u.modelValue?.response?.error?.message},null,8,[`content`])])]),_:1})])):o(``,!0),e(`div`,jt,[a(j,{closable:!1,class:n([`mt-2`,`task-metadata`,u.taskInfoClass])},{default:p(()=>[u.modelValue?.request?.model?(g(),s(`p`,Mt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.model`))+`: `+i(u.modelValue?.request?.model),1)])):o(``,!0),e(`p`,Nt,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.action`))+`: `+i(u.actionLabel),1)]),u.modelValue?.request?.aspect_ratio?(g(),s(`p`,$,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.ratio`))+`: `+i(u.modelValue?.request?.aspect_ratio),1)])):o(``,!0),u.modelValue?.request?.translation===void 0?o(``,!0):(g(),s(`p`,Pt,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.translation`))+`: `+i(u.$t(u.modelValue?.request?.translation?`seedance.button.on`:`seedance.button.off`)),1)])),e(`p`,Ft,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(A,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(g(),s(`p`,It,[a(L,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.traceId?(g(),s(`p`,Lt,[a(R,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.traceId`))+`: `+i(u.traceId)+` `,1),a(A,{content:u.traceId,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1},8,[`class`])])])])}var zt=v({name:`RecentPanel`,components:{TaskPreview:J(mt,[[`render`,Rt],[`__scopeId`,`data-v-eb0880c2`]]),NoTasks:I,BotPlaceholder:ye,ScrollList:P},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),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`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,Bt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),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(()=>[(g(!0),s(c,null,h(e.tasks?.items,(e,t)=>(g(),f(m,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Vt,[a(v)])):o(``,!0)],64)}var Ut=v({name:`VeoIndex`,components:{ConfigPanel:pt,Layout:Te,RecentPanel:J(zt,[[`render`,Ht]])},mixins:[ae],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===E.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===E.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await R({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!Y(this.uploadTracker,e=>this.$t(e),e=>D.warning(e)))return;let e=De(this.config);if(!ce())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if((e.action===`image2video`||e.action===`ingredients2video`)&&!(e.image_urls&&e.image_urls.length>0)){D.warning(this.$t(`veo.message.imageRequired`));return}D.info(this.$t(`veo.message.startingTask`)),q(`veo`,le.generate(e,{token:t})).then(()=>{D.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?D.error(this.$t(`veo.message.usedUp`)):D.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Wt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Gt=J(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,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-C_fIfZ2e.js";import{n as x,t as S}from"./tabs-gaoETP28.js";import{t as C}from"./upload-CVDRsxmb.js";import{t as w}from"./tooltip-BUacpHBv.js";import{t as T}from"./alert-BprQRUmf.js";import{h as E,v as D}from"./models-BKPWGzi5.js";import{t as O}from"./drawer-CA6SUQCX.js";import{t as k}from"./switch-f4qApZxt.js";import{t as A}from"./box-DHRJ9mGk.js";import{t as j}from"./clock-B1CCVLmO.js";import{a as M,c as N,n as P,o as F,r as I,s as L,t as R}from"./pagination-BnPTXcYn.js";import{t as ee}from"./info-W0vYXBmL.js";import{t as z}from"./languages-CmUnR-ub.js";import{t as B}from"./trash-2-07x8oBrr.js";import{t as V}from"./triangle-alert-tdzQQL0N.js";import{t as te}from"./upload-DGU-Zk4A.js";import{t as H}from"./wand-sparkles-DbvGGoZ2.js";import{t as ne}from"./zap-C1Tbanxu.js";import{ai as re,oi as ie,si as U}from"./constants-u1eIRuNz.js";import{$t as W,Fi as G,Jt as K,Mr as q,O as J,Qt as Y,en as ae,in as oe,nn as se,pn as ce,rr as le,si as ue,tn as de,xi as fe}from"./index-Dd6xXz4I.js";import{t as pe}from"./CopyToClipboard-DJUH_cOj.js";import{t as me}from"./ReportButton-_V9tUFQF.js";import{t as X}from"./ImagePreview-SnY13jKc.js";import{n as he}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ge}from"./Consumption-Bt_7Xwm9.js";import{t as _e}from"./VideoPlayer-DmVZVRbd.js";import{t as ve}from"./ApiCodeButton-CqlibmjN.js";import{t as ye}from"./BotPlaceholder-99Dh87EM.js";var be=v({name:`LayoutVeo`,components:{MagicIcon:H,ElDrawer:O,ElButton:G},mixins:[he]}),xe={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 we(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,xe,[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`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Te=J(be,[[`render`,we],[`__scopeId`,`data-v-293c9493`]]),Z=`veo31-fast-ingredients`,Ee=[{value:`veo31-fast`,label:`Veo 3.1 Fast`},{value:`veo3-fast`,label:`Veo 3 Fast`},{value:`veo31`,label:`Veo 3.1`},{value:`veo3`,label:`Veo 3`}],Q=(e,t)=>{let n=!!(e?.action&&e.action!==t),r={...e,action:t};return t===`text2video`?(r.model=r.model===`veo31-fast-ingredients`?U:r.model||`veo31-fast`,delete r.image_urls,r):t===`ingredients2video`?(r.model=Z,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,3),r):(r.model=r.model===`veo31-fast-ingredients`?U:r.model||`veo31-fast`,n?delete r.image_urls:r.image_urls=r.image_urls?.slice(0,2),r)},De=e=>{let t={...Q(e,e?.action||`text2video`),async:!0};return t.image_urls?.length||delete t.image_urls,t},Oe=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},computed:{isModelLocked(){return this.$store.state.veo?.config?.action===`ingredients2video`},options(){return this.isModelLocked?[{value:Z,label:`Veo 3.1 Fast`}]:Ee},value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=U}}),ke={class:`field`},Ae={class:`title font-bold`};function je(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,ke,[e(`h2`,Ae,i(t.$t(`veo.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),disabled:t.isModelLocked},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])])}var Me=J(Oe,[[`render`,je],[`__scopeId`,`data-v-90ed8cff`]]),Ne=v({name:`ActionSelector`,components:{ElTabs:x,ElTabPane:S},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)}]},value(){return this.$store.state.veo?.config?.action||`text2video`}},mounted(){this.$store.state.veo?.config?.action||this.onUpdate(re)},methods:{onUpdate(e){this.$store.commit(`veo/setConfig`,Q(this.$store.state.veo?.config,e))}}}),Pe={class:`tab-label`},Fe={class:`text`};function Ie(t,n,r,a,o,u){let d=l(`el-tab-pane`),m=l(`el-tabs`);return g(),f(m,{"model-value":t.value,class:`action-tabs scenario-tabs scenario-tabs--divided`,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(d,{key:t.value,name:t.value},{label:p(()=>[e(`span`,Pe,[e(`span`,Fe,i(t.label),1)])]),_:2},1032,[`name`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Le=J(Ne,[[`render`,Ie],[`__scopeId`,`data-v-c72fb85c`]]),Re=v({name:`TranslationSelector`,components:{ElSwitch:k,InfoIcon:F},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),ze={class:`relative`},Be={class:`flex justify-between`},Ve={class:`flex justify-start items-center`},He={class:`text-sm font-bold`},Ue={class:`flex justify-end items-center`};function We(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`span`,He,i(t.$t(`veo.name.translation`)),1),a(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,Ue,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ge=J(Re,[[`render`,We]]),Ke=v({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=ie}}),qe={class:`text-sm font-bold mb-2 block`},Je={class:`items`},Ye=[`onClick`],Xe={class:`name`};function Ze(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,qe,i(t.$t(`veo.name.ratio`)),1),e(`div`,Je,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,Xe,i(r.label),1)],10,Ye))),128))])])}var Qe=J(Ke,[[`render`,Ze],[`__scopeId`,`data-v-28c472c4`]]),$e=v({name:`StartEndImage`,components:{UploadIcon:te,ElUpload:C,ElButton:G,InfoIcon:F,ImagePreview:X},mixins:[se,de,W,K],props:{limit:{type:Number,default:2},ingredients:{type:Boolean,default:!1}},emits:[`change`],data(){return{fileList:[],uploadUrl:ue()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},title(){return this.ingredients?this.$t(`veo.button.actionIngredients`):this.$t(`veo.name.startEndImage`)},description(){return this.ingredients?this.$t(`veo.description.imageUrl`):this.$t(`veo.description.uploadStartEndImage`)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(e=>!!e)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},watch:{limit(){this.fileList.length>this.limit&&(this.fileList=this.fileList.slice(0,this.limit),this.onSetStartEndImageUrl())}},mounted(){this.fileList=(this.value||[]).map((e,t)=>({name:`reference-${t+1}`,percentage:100,response:{file_url:e},status:`success`,uid:Date.now()+t,url:e}))},methods:{onExceed(){D.warning(this.$t(`veo.message.uploadReferencesLimit`,{limit:this.limit}))},onError(){D.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()},onRemove(e){let t=this.fileList.indexOf(e);t>=0&&this.fileList.splice(t,1),this.onSetStartEndImageUrl()}}}),et={class:`relative`},tt={class:`flex justify-between`},nt={class:`flex justify-start items-center`},rt={class:`text-sm font-bold`};function it(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,et,[e(`div`,tt,[e(`div`,nt,[e(`span`,rt,i(t.title),1),a(h,{content:t.description},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:t.limit,class:`upload-wrapper`,multiple:!0,"before-upload":t.beforeUploadSizeGuard,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?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},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(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var at=J($e,[[`render`,it],[`__scopeId`,`data-v-a4391199`]]),ot=v({name:`PromptInput`,components:{PromptTextarea:M},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function st(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ct=v({name:`ConfigPanel`,components:{MagicIcon:H,ElButton:G,Consumption:ge,PromptInput:J(ot,[[`render`,st]]),ModelSelector:Me,StartEndImage:at,ActionSelector:Le,TranslationSelector:Ge,AspectRatioSelector:Qe},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},showsImages(){return this.config?.action===`image2video`||this.config?.action===`ingredients2video`},imageLimit(){return this.config?.action===`ingredients2video`?3:2},consumption(){return oe(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),lt={class:`flex flex-col h-full`},ut={class:`flex-1 overflow-y-auto p-5`},dt={class:`flex flex-col items-center justify-center px-5 pb-5`};function ft(t,n,c,u,d,m){let h=l(`action-selector`),_=l(`model-selector`),v=l(`start-end-image`),y=l(`prompt-input`),b=l(`aspect-ratio-selector`),x=l(`translation-selector`),S=l(`consumption`),C=l(`magic-icon`),w=l(`el-button`);return g(),s(`div`,lt,[e(`div`,ut,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),t.showsImages?(g(),f(v,{key:t.config?.action,class:`mb-4`,limit:t.imageLimit,ingredients:t.config?.action===`ingredients2video`},null,8,[`limit`,`ingredients`])):o(``,!0),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`})]),e(`div`,dt,[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(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var pt=J(ct,[[`render`,ft]]),mt=v({name:`TaskPreview`,components:{DeleteIcon:B,ApplicationIcon:A,ChannelIcon:N,ExpandIcon:L,InfoIcon:ee,LanguageIcon:z,LightningIcon:ne,MagicIcon:H,TimeIcon:j,WarningIcon:V,CopyToClipboard:pe,ElAlert:T,VideoPlayer:_e,ImagePreview:X,ElTooltip:w,ElButton:G,ApiCodeButton:ve,ReportButton:me},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{referenceImages(){let e=this.modelValue?.request?.image_urls;return Array.isArray(e)?e.filter(e=>typeof e==`string`&&!!e):[]},actionLabel(){let e=this.modelValue?.request,t=e?.model===`veo31-fast-ingredients`||this.referenceImages.length>2?`ingredients2video`:this.referenceImages.length>0?`image2video`:`text2video`,n=e?.action||t;return this.$t({text2video:`veo.button.action1`,image2video:`veo.button.action2`,ingredients2video:`veo.button.actionIngredients`}[n]||`veo.name.action`)},traceId(){return this.modelValue?.response?.trace_id||this.modelValue?.trace_id},taskInfoClass(){return this.modelValue?.response?.success===!0?`success`:this.modelValue?.response?.success===!1?`failure`:`info`}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await fe.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(`veo/deleteTask`,{id:e}),D.success(this.$t(`common.message.deleteTaskSuccess`))}catch{D.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),ht={class:`preview`},gt={class:`left`},_t={class:`main`},vt={class:`bot`},yt={class:`datetime`},bt=[`aria-label`],xt={class:`info`},St={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Ct={key:1,class:`prompt mt-2`},wt={key:0},Tt={key:1},Et={key:0,class:n({content:!0,failed:!0})},Dt={key:0,class:`mb-4`},Ot={key:1,class:n({operations:!0,"mt-2":!0})},kt={key:1,class:n({content:!0})},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={class:n({content:!0})},Mt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Rt(u,d,m,_,v,y){let b=l(`capability-presentation`),x=l(`delete-icon`),S=l(`el-tooltip`),C=l(`image-preview`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`report-button`),O=l(`warning-icon`),k=l(`info-icon`),A=l(`copy-to-clipboard`),j=l(`el-alert`),M=l(`application-icon`),N=l(`lightning-icon`),P=l(`expand-icon`),F=l(`language-icon`),I=l(`magic-icon`),L=l(`time-icon`),R=l(`channel-icon`);return g(),s(`div`,ht,[e(`div`,gt,[a(b,{capability:`veo`,part:`avatar`,class:`avatar`})]),e(`div`,_t,[e(`div`,vt,[a(b,{capability:`veo`,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?(g(),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,bt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,xt,[u.referenceImages.length>0?(g(),s(`div`,St,[(g(!0),s(c,null,h(u.referenceImages,(e,t)=>(g(),f(C,{key:`${t}-${e}`,url:e,name:`reference-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(g(),s(`p`,Ct,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(g(),s(`span`,wt,` - (`+i(u.$t(`veo.status.pending`))+`) `,1)),Array.isArray(u.modelValue?.response?.data)&&u.modelValue?.response?.data[0]?.state===`running`?(g(),s(`span`,Tt,` - (`+i(u.$t(`veo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),u.modelValue?.response?.success===!0&&u.modelValue?.response?.data?(g(),s(`div`,Et,[u.modelValue?.response?.data[0]?.video_url?(g(),s(`div`,Dt,[a(w,{src:u.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):o(``,!0),u.modelValue?.response.success?(g(),s(`div`,Ot,[a(S,{class:`box-item`,effect:`dark`,content:u.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:p(()=>[u.modelValue?.response?.data[0]?.video_url?(g(),f(T,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:d[1]||=e=>u.onDownload(e,u.modelValue?.response?.data[0]?.video_url)},{default:p(()=>[r(i(u.$t(`veo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(E,{path:`/veo/videos`,body:u.modelValue?.request},null,8,[`body`]),a(D,{service:`veo`,"target-id":u.modelValue?.id,snapshot:{prompt:u.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0)])):o(``,!0),u.modelValue?.response?.success===!1?(g(),s(`div`,kt,[a(j,{closable:!1,class:`failure`},{template:p(()=>[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.failure`)),1)]),default:p(()=>[e(`p`,At,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(A,{content:u.modelValue?.response?.error?.message},null,8,[`content`])])]),_:1})])):o(``,!0),e(`div`,jt,[a(j,{closable:!1,class:n([`mt-2`,`task-metadata`,u.taskInfoClass])},{default:p(()=>[u.modelValue?.request?.model?(g(),s(`p`,Mt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.model`))+`: `+i(u.modelValue?.request?.model),1)])):o(``,!0),e(`p`,Nt,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.action`))+`: `+i(u.actionLabel),1)]),u.modelValue?.request?.aspect_ratio?(g(),s(`p`,$,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.ratio`))+`: `+i(u.modelValue?.request?.aspect_ratio),1)])):o(``,!0),u.modelValue?.request?.translation===void 0?o(``,!0):(g(),s(`p`,Pt,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.translation`))+`: `+i(u.$t(u.modelValue?.request?.translation?`seedance.button.on`:`seedance.button.off`)),1)])),e(`p`,Ft,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(A,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(g(),s(`p`,It,[a(L,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.traceId?(g(),s(`p`,Lt,[a(R,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`veo.name.traceId`))+`: `+i(u.traceId)+` `,1),a(A,{content:u.traceId,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1},8,[`class`])])])])}var zt=v({name:`RecentPanel`,components:{TaskPreview:J(mt,[[`render`,Rt],[`__scopeId`,`data-v-eb0880c2`]]),NoTasks:I,BotPlaceholder:ye,ScrollList:P},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),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`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,Bt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),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(()=>[(g(!0),s(c,null,h(e.tasks?.items,(e,t)=>(g(),f(m,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Vt,[a(v)])):o(``,!0)],64)}var Ut=v({name:`VeoIndex`,components:{ConfigPanel:pt,Layout:Te,RecentPanel:J(zt,[[`render`,Ht]])},mixins:[ae],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===E.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===E.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await R({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!Y(this.uploadTracker,e=>this.$t(e),e=>D.warning(e)))return;let e=De(this.config);if(!ce())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if((e.action===`image2video`||e.action===`ingredients2video`)&&!(e.image_urls&&e.image_urls.length>0)){D.warning(this.$t(`veo.message.imageRequired`));return}D.info(this.$t(`veo.message.startingTask`)),q(`veo`,le.generate(e,{token:t})).then(()=>{D.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?D.error(this.$t(`veo.message.usedUp`)):D.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Wt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Gt=J(Ut,[[`render`,Wt]]);export{Gt as default};