@acedatacloud/nexior 3.329.30 → 3.329.31

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 (230) hide show
  1. package/dist/assets/{ApiCodeButton-Dn8hNsX4.js → ApiCodeButton-CVS8YvAm.js} +1 -1
  2. package/dist/assets/{Artifacts-rlI_ud8c.js → Artifacts-CCzwHkZL.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-J2KHYcXP.js → AskUserQuestionCard-DfoJUmfa.js} +1 -1
  4. package/dist/assets/{AudioPreview-WZda7UCf.js → AudioPreview-BDheGY_c.js} +1 -1
  5. package/dist/assets/{Auth-C0f6iOWh.js → Auth-D3vTifvK.js} +1 -1
  6. package/dist/assets/{Bare-BpdaGpje.js → Bare-BHD-PGyp.js} +1 -1
  7. package/dist/assets/{BotPlaceholder-BrZxheK1.js → BotPlaceholder-C7sd9thm.js} +1 -1
  8. package/dist/assets/{BottomFooter-l7Ybqbqt.js → BottomFooter-CES1kDo5.js} +1 -1
  9. package/dist/assets/{Callback-CRPWAKJt.js → Callback-Crtpfu0H.js} +1 -1
  10. package/dist/assets/{CodeSnippet-3N_RzLT7.js → CodeSnippet-D1Z9OJcY.js} +1 -1
  11. package/dist/assets/{Console-ZyCU1huf.js → Console-ye4iTVBF.js} +1 -1
  12. package/dist/assets/{Consumption-CFz0VGfl.js → Consumption-BBcKgILA.js} +1 -1
  13. package/dist/assets/{Conversation-D_ZZpWOc.js → Conversation-BdRZa6KI.js} +1 -1
  14. package/dist/assets/{Conversation-jKhWw4UK.js → Conversation-Ck-TmtXa.js} +1 -1
  15. package/dist/assets/{CopyToClipboard-AcQvl8FS.js → CopyToClipboard-DpNIys5b.js} +1 -1
  16. package/dist/assets/{Detail-CGJDJx5l.js → Detail-sBddKgUl.js} +2 -2
  17. package/dist/assets/{Extra-CkOMQnq9.js → Extra-vPD5dTQk.js} +1 -1
  18. package/dist/assets/{FilePreview-d6z63B1r.js → FilePreview-Dk6JUusq.js} +1 -1
  19. package/dist/assets/{Hailuo-NUvcu0Ug.js → Hailuo-qvIM2-B3.js} +1 -1
  20. package/dist/assets/{History-C4jU9stK.js → History-DBXeJvs1.js} +1 -1
  21. package/dist/assets/{ImagePreview-B0Hz5h5I.js → ImagePreview-BupumqtT.js} +1 -1
  22. package/dist/assets/{ImageWrapper-BAwtx9Eo.js → ImageWrapper-Djbynfsa.js} +1 -1
  23. package/dist/assets/{Index-BiBjwYTe.js → Index-4Q2lK-mw.js} +1 -1
  24. package/dist/assets/{Index-Cbr4CSyg.js → Index-5YqiZkf8.js} +1 -1
  25. package/dist/assets/{Index-BDseLAo_.js → Index-7KXz7HTI.js} +1 -1
  26. package/dist/assets/{Index-DRTraH-n.js → Index-7uv-_Q91.js} +1 -1
  27. package/dist/assets/{Index-B1kDQjGg.js → Index-B0F5AZYk.js} +1 -1
  28. package/dist/assets/{Index-B2BTZ8pS.js → Index-B4Q8Ntgv.js} +1 -1
  29. package/dist/assets/{Index-CG7JYCL4.js → Index-BCN9Ec6a.js} +1 -1
  30. package/dist/assets/{Index-ByFuzHo_.js → Index-BERIJzFw.js} +1 -1
  31. package/dist/assets/{Index-CVXvDBLV.css → Index-BEix-EAc.css} +1 -1
  32. package/dist/assets/{Index-Cp2RCxxR.js → Index-BFKKlwTh.js} +1 -1
  33. package/dist/assets/{Index-CG7MNd6P.js → Index-BLrgC8Gl.js} +1 -1
  34. package/dist/assets/{Index-DtJ3KeYb.js → Index-BV-nz0WO.js} +1 -1
  35. package/dist/assets/{Index-ySOKfvLx.js → Index-BW2bu41q.js} +1 -1
  36. package/dist/assets/{Index-DiyIfvgZ.js → Index-BbECACM4.js} +1 -1
  37. package/dist/assets/{Index-BW5Zo6Xd.js → Index-BpnKREkb.js} +1 -1
  38. package/dist/assets/{Index-Bf2AUUjC.js → Index-C8UGwL23.js} +1 -1
  39. package/dist/assets/{Index-BcjFzA2x.js → Index-CKL6K5TZ.js} +1 -1
  40. package/dist/assets/{Index-Bm0_0rXA.js → Index-CXEotynN.js} +1 -1
  41. package/dist/assets/{Index-CEltGlRM.js → Index-CfcC8LoP.js} +1 -1
  42. package/dist/assets/{Index-ulKfJXoX.js → Index-CkQ_nidN.js} +1 -1
  43. package/dist/assets/{Index-CBZWu9oT.js → Index-Co9oZX_f.js} +1 -1
  44. package/dist/assets/{Index-Bg99GdVY.js → Index-DBb3dWOk.js} +1 -1
  45. package/dist/assets/{Index-C3uzcWQN.js → Index-DPH0_Oe6.js} +1 -1
  46. package/dist/assets/{Index-C2Wlgoil.js → Index-DQIhlmt0.js} +1 -1
  47. package/dist/assets/{Index-QayQpoFS.js → Index-DhV9V16M.js} +1 -1
  48. package/dist/assets/{Index-D7U1B1rk.js → Index-E9fky31R.js} +1 -1
  49. package/dist/assets/{Index-ULFptFhX.js → Index-IAMiAD1u.js} +1 -1
  50. package/dist/assets/{Index-DoDBEJZQ.js → Index-WMVf2jmR.js} +1 -1
  51. package/dist/assets/{Index-D3ZP3C4T.js → Index-lrGM-VD4.js} +1 -1
  52. package/dist/assets/{Index-s-rXkkWa.js → Index-oL3SUWMu.js} +1 -1
  53. package/dist/assets/{Invitees-Rn6XexxG.js → Invitees-CsVIRRHF.js} +1 -1
  54. package/dist/assets/{List-DDnkR9NY.js → List-BUtnO3bI.js} +1 -1
  55. package/dist/assets/{List-DL_-Atdd.js → List-CyU-FNdK.js} +1 -1
  56. package/dist/assets/{List-CVy6GlM2.js → List-J7FZrns1.js} +1 -1
  57. package/dist/assets/{LocalTools-B2YuG84I.js → LocalTools-0qjfDR5j.js} +1 -1
  58. package/dist/assets/{LocalTools-yhVWjSsi.js → LocalTools-DWIxUbEZ.js} +1 -1
  59. package/dist/assets/{Main-DGL8ReEL.js → Main-C7Xa0bIr.js} +1 -1
  60. package/dist/assets/{Message-C2CNZhp7.js → Message-deocm0pb.js} +1 -1
  61. package/dist/assets/{Model-BuBOpqUU.js → Model-6cqJAy1k.js} +1 -1
  62. package/dist/assets/{Navigator-Cc0-XvGX.js → Navigator-a91cip1q.js} +3 -3
  63. package/dist/assets/{NotFound-DDdDSAD5.js → NotFound-Bo_kve7U.js} +1 -1
  64. package/dist/assets/{Pay-C5CgnKVw.js → Pay-CRwf9EWo.js} +1 -1
  65. package/dist/assets/{Player-CXkZYwl-.js → Player-CA6nVq8J.js} +1 -1
  66. package/dist/assets/{PromptTextarea-rvPInlyG.js → PromptTextarea-B5aTi1HH.js} +1 -1
  67. package/dist/assets/{RealtimeCall-B55Uzrpd.js → RealtimeCall-DVscX0Xl.js} +1 -1
  68. package/dist/assets/{ScheduledTasks-CmsRg9yH.js → ScheduledTasks-_8ckxRV9.js} +1 -1
  69. package/dist/assets/{Status-DEjceUue.js → Status-Bkc0JxOJ.js} +1 -1
  70. package/dist/assets/{Subscribe-WAxMKuaH.js → Subscribe-B41XKWd5.js} +1 -1
  71. package/dist/assets/{TabSwitcher-CtlizSfR.js → TabSwitcher-y3kK3B2x.js} +1 -1
  72. package/dist/assets/{Tts-CFosaTkr.js → Tts-cI25zgjZ.js} +1 -1
  73. package/dist/assets/{VideoPlayer-CYbwxMpa.js → VideoPlayer-Dd9V_FnY.js} +1 -1
  74. package/dist/assets/{alert-j_3nRV8t.js → alert-kWYCkGuI.js} +1 -1
  75. package/dist/assets/arrow-down-eScCem2F.js +1 -0
  76. package/dist/assets/{arrow-down-wide-narrow-Dla3pLRk.js → arrow-down-wide-narrow-CGmT9P7k.js} +1 -1
  77. package/dist/assets/arrow-left-DtWmkfLG.js +1 -0
  78. package/dist/assets/arrow-right-D7FFsEUx.js +1 -0
  79. package/dist/assets/arrow-up-ByPp28p2.js +1 -0
  80. package/dist/assets/{avatar-Co1EQAme.js → avatar-CX38U43_.js} +1 -1
  81. package/dist/assets/{basic-D9knL6E_.js → basic-1jPmvKS2.js} +1 -1
  82. package/dist/assets/{box-B0JfZlg1.js → box-BO5U0zzd.js} +1 -1
  83. package/dist/assets/{boxes-BEA-DegW.js → boxes-CfptMsTK.js} +1 -1
  84. package/dist/assets/{brain-CBMtADrT.js → brain-DeidocyY.js} +1 -1
  85. package/dist/assets/{chart-no-axes-combined-DdYl_YcO.js → chart-no-axes-combined-BF8JSkyc.js} +1 -1
  86. package/dist/assets/{chat-E_gQpTQp.js → chat-BI-MrFtc.js} +1 -1
  87. package/dist/assets/check-B8C_xo4z.js +1 -0
  88. package/dist/assets/chevron-down-DuNuPvUP.js +1 -0
  89. package/dist/assets/chevron-right-BkC5YSaD.js +1 -0
  90. package/dist/assets/circle-check-Ch8xM8nA.js +1 -0
  91. package/dist/assets/clock-LeiGWIqv.js +1 -0
  92. package/dist/assets/{codingBridge-BugEF20i.js → codingBridge-4W-Z4WzI.js} +1 -1
  93. package/dist/assets/{codingBridgeNotify-Dna_N6CG.js → codingBridgeNotify-DoXiiYST.js} +2 -2
  94. package/dist/assets/{coins-B9vbPZwa.js → coins-JGpOkuYz.js} +1 -1
  95. package/dist/assets/{collapse-DXwB1Vxo.js → collapse-yWKrzmVx.js} +1 -1
  96. package/dist/assets/{createTaskActions-JvVltTiE.js → createTaskActions-Byr6cQq9.js} +1 -1
  97. package/dist/assets/{digitalhuman-BS-jr5kR.js → digitalhuman-iFhPQZ0P.js} +1 -1
  98. package/dist/assets/{dollar-sign-B2SyHcBe.js → dollar-sign-6Y8IJGD_.js} +1 -1
  99. package/dist/assets/{download-ta4o9EZT.js → download-BhZEVO4v.js} +1 -1
  100. package/dist/assets/{drawer-BTC1LQDm.js → drawer-By2wmxmu.js} +1 -1
  101. package/dist/assets/{dropdown-C_xUF5Pi.js → dropdown-BBKW4jfq.js} +1 -1
  102. package/dist/assets/{dropdown-DMJnYbXn.js → dropdown-DSMfYGzO.js} +1 -1
  103. package/dist/assets/{ellipsis-CT3BE3Gm.js → ellipsis-Dr52BzTe.js} +1 -1
  104. package/dist/assets/esm-BJwcNRzI.js +1 -0
  105. package/dist/assets/{esm-OOJXzO-8.js → esm-BXLrXSMr.js} +2 -2
  106. package/dist/assets/{esm-dMyGctLI.js → esm-BlTW2b4x.js} +2 -2
  107. package/dist/assets/{esm-B4JEIc2S.js → esm-CgtS-fx3.js} +3 -3
  108. package/dist/assets/{esm-BTT3neuG.js → esm-D7w9G5ev.js} +1 -1
  109. package/dist/assets/{esm-IwgDya-p.js → esm-Dh4QPDut.js} +1 -1
  110. package/dist/assets/{esm-DmPGQoyn.js → esm-DwhUHbM9.js} +1 -1
  111. package/dist/assets/{external-link-DIzvxE5E.js → external-link-D19owA5u.js} +1 -1
  112. package/dist/assets/{eye-aA-W4_QC.js → eye-QxDuXSFj.js} +1 -1
  113. package/dist/assets/{file-output-BEjeI75k.js → file-output-CfLp2uXn.js} +1 -1
  114. package/dist/assets/{file-text-CjxnegQH.js → file-text-BT0j9xG1.js} +1 -1
  115. package/dist/assets/{fish-BSWYCnr-.js → fish-BYKBQ2uj.js} +1 -1
  116. package/dist/assets/{flux-CoTmgT36.js → flux-CuVPYeiC.js} +1 -1
  117. package/dist/assets/{folder-32TOc687.js → folder-CrzlMQzh.js} +1 -1
  118. package/dist/assets/gauge-BqDsQZBE.js +1 -0
  119. package/dist/assets/{globe-CcN_svKU.js → globe-KuHLmXkc.js} +1 -1
  120. package/dist/assets/{grokvideo-anstbnGw.js → grokvideo-JIRCJqJu.js} +1 -1
  121. package/dist/assets/{hailuo-AcQLE82F.js → hailuo-BM4pYk7u.js} +1 -1
  122. package/dist/assets/{hash-CdlI_Ed6.js → hash-95R5zuIr.js} +1 -1
  123. package/dist/assets/{headphones-Bkoq_7ua.js → headphones-BbL9bHyz.js} +1 -1
  124. package/dist/assets/{history-BR9ZzFoZ.js → history-BeoHQ3r-.js} +1 -1
  125. package/dist/assets/{image-VeW9WxnM.js → image-v_elL0Bz.js} +1 -1
  126. package/dist/assets/{index-CtzrR21L.js → index-L5CfS5rK.js} +3 -3
  127. package/dist/assets/{index.browser.esm-BuDNKuIk.js → index.browser.esm-BoD-q54e.js} +1 -1
  128. package/dist/assets/{index.es-DbWatLpk.js → index.es-BKvkyYfT.js} +1 -1
  129. package/dist/assets/{info-rBg3OCYW.js → info-CerFhjgW.js} +1 -1
  130. package/dist/assets/{input-number-D24l-83c.js → input-number-CbkzwR1k.js} +1 -1
  131. package/dist/assets/{key-round-BPkV9DZF.js → key-round-CHZOgKUz.js} +1 -1
  132. package/dist/assets/{kling-D8QtJ0JG.js → kling-DOPfHTYZ.js} +1 -1
  133. package/dist/assets/{languages-DdAveSDN.js → languages-0nmQ1n4_.js} +1 -1
  134. package/dist/assets/{laptop-D7_DKbL2.js → laptop-CDOMyrfo.js} +1 -1
  135. package/dist/assets/{lightbulb-yWiAmPxa.js → lightbulb-vTgGlppi.js} +1 -1
  136. package/dist/assets/{link-CKGM-veD.js → link-Rk81aOAb.js} +1 -1
  137. package/dist/assets/loader-circle-BBsLYtTT.js +1 -0
  138. package/dist/assets/{luma-54QRNOYJ.js → luma-LzDJl7VT.js} +1 -1
  139. package/dist/assets/{maestro-H6eenK-W.js → maestro-DU-nDT1f.js} +1 -1
  140. package/dist/assets/{mail-BKuj1APC.js → mail-Cq55CgdN.js} +1 -1
  141. package/dist/assets/{message-circle-DOwTY-B_.js → message-circle-CV8TeBXn.js} +1 -1
  142. package/dist/assets/{mic-CINGbSHC.js → mic-3I-CpPo3.js} +1 -1
  143. package/dist/assets/{midjourney-BzrdqAt4.js → midjourney-7Ajk58p1.js} +1 -1
  144. package/dist/assets/{mobileLocalExec-Cuo26FB6.js → mobileLocalExec-uVUVRWc4.js} +2 -2
  145. package/dist/assets/{mouse-pointer-2-W0Gvmgeh.js → mouse-pointer-2-t3CNxy0K.js} +1 -1
  146. package/dist/assets/music-2-CSQVOw4t.js +1 -0
  147. package/dist/assets/{nanobanana-BYtankkY.js → nanobanana-DnLP0GMF.js} +1 -1
  148. package/dist/assets/{omni-CUBk_qGL.js → omni-DYH2Cp8q.js} +1 -1
  149. package/dist/assets/{openaiimage-DP_o6hag.js → openaiimage-BLPomfmN.js} +1 -1
  150. package/dist/assets/{pagination-DG4UVMDf.js → pagination-87wXZhVI.js} +1 -1
  151. package/dist/assets/{pagination-z1yeQEg3.js → pagination-bzT3Edaj.js} +1 -1
  152. package/dist/assets/{palette-DaUip3WL.js → palette-CvhcQMmg.js} +1 -1
  153. package/dist/assets/{paperclip-ClKxZ88M.js → paperclip-BDHxrT8X.js} +1 -1
  154. package/dist/assets/{pause-C-Z9NQtW.js → pause-S6Dwk1Yf.js} +1 -1
  155. package/dist/assets/{pencil-dJEnojk0.js → pencil-Djq9myXM.js} +1 -1
  156. package/dist/assets/{pika-DvlEDd39.js → pika-Bc46j2jq.js} +1 -1
  157. package/dist/assets/{pixverse-D0gsTRoy.js → pixverse-6LeMhNed.js} +1 -1
  158. package/dist/assets/play-BBltE_r6.js +1 -0
  159. package/dist/assets/plus-J-vAo50L.js +1 -0
  160. package/dist/assets/{popover-TdaEA_Kq.js → popover-CkMgbnUQ.js} +1 -1
  161. package/dist/assets/{producer-D4D-pRXH.js → producer-CYUDYmzt.js} +1 -1
  162. package/dist/assets/{qrart-DbxC-zeT.js → qrart-CZpl3FzU.js} +1 -1
  163. package/dist/assets/{realtime-C3FT1AJ_.js → realtime-CE4ApqAd.js} +1 -1
  164. package/dist/assets/{refresh-cw-DIqzrhMq.js → refresh-cw-JTgAcaND.js} +1 -1
  165. package/dist/assets/rotate-ccw-BwNg8XVm.js +1 -0
  166. package/dist/assets/rotate-cw-B2iUjFe6.js +1 -0
  167. package/dist/assets/{row-mWqaiTaV.js → row-DFw1m_ua.js} +1 -1
  168. package/dist/assets/search-BSfcTgjZ.js +1 -0
  169. package/dist/assets/{seedance-BQSebwux.js → seedance-DXZaS1aw.js} +1 -1
  170. package/dist/assets/{seedream-C-zbGy23.js → seedream-BiXc_RH0.js} +1 -1
  171. package/dist/assets/{select-D-_BwBwU.js → select-CV_KF_4N.js} +1 -1
  172. package/dist/assets/{serp-BzOII7ZV.js → serp-BKCNMu3y.js} +1 -1
  173. package/dist/assets/{shield-BuW1SPvb.js → shield-72IrH0I_.js} +1 -1
  174. package/dist/assets/{shuffle-CoT9fJie.js → shuffle-uwtaxCn0.js} +1 -1
  175. package/dist/assets/{slider-Bryotidd.js → slider-0V56ly1L.js} +1 -1
  176. package/dist/assets/{sliders-horizontal-D7TLz3zs.js → sliders-horizontal-BpCzbGzy.js} +1 -1
  177. package/dist/assets/{solana-wallets-BhPu3TXz.js → solana-wallets-CZqZ5t_F.js} +2 -2
  178. package/dist/assets/{solana-wallets-vue-HDxVvWRE.js → solana-wallets-vue-BKCkkrGp.js} +1 -1
  179. package/dist/assets/{sora-DGeTxEr_.js → sora-Cogrx6AI.js} +1 -1
  180. package/dist/assets/square-np6i1CLN.js +1 -0
  181. package/dist/assets/{suno-Z85SYfKu.js → suno-NP_Effmy.js} +1 -1
  182. package/dist/assets/{switch-BDiksqCG.js → switch-IJ9gvjoD.js} +1 -1
  183. package/dist/assets/{table-Bk3222Q7.js → table-ClZL_qg6.js} +1 -1
  184. package/dist/assets/{tabs-CNyJIJ5s.js → tabs-28-MjRDJ.js} +1 -1
  185. package/dist/assets/{tag-DIU9RwlX.js → tag-D8S3nAAs.js} +1 -1
  186. package/dist/assets/{taskDrawerMixin-MzTeZOH4.js → taskDrawerMixin-BUGIlU_B.js} +1 -1
  187. package/dist/assets/terminal-9wqKYKPJ.js +1 -0
  188. package/dist/assets/{time-picker-DWvxtfjd.js → time-picker-V7YKlSo3.js} +1 -1
  189. package/dist/assets/{tooltip-IRIdGmNi.js → tooltip-1QTlF6Ah.js} +1 -1
  190. package/dist/assets/{trash-2-NQJbszYS.js → trash-2-B0k7gtH-.js} +1 -1
  191. package/dist/assets/{triangle-alert-D3Ot9kW8.js → triangle-alert-C4AHPI71.js} +1 -1
  192. package/dist/assets/{upload-Bhad_P8Q.js → upload-Ce_XQUOt.js} +1 -1
  193. package/dist/assets/{upload-EpkcT4jm.js → upload-b94DR2Pd.js} +1 -1
  194. package/dist/assets/user-C9C9Sryq.js +1 -0
  195. package/dist/assets/{veo-CbGIvG8a.js → veo-BRB7efTV.js} +1 -1
  196. package/dist/assets/{video-DwFG79DI.js → video-BhUqBgec.js} +1 -1
  197. package/dist/assets/{volume-2-tf1IjDbK.js → volume-2-DJY81NRn.js} +1 -1
  198. package/dist/assets/{wallet-Bo5FAVcv.js → wallet-BtPe3FB_.js} +1 -1
  199. package/dist/assets/{wan-uQ798Hlf.js → wan-Ch5CxCmq.js} +1 -1
  200. package/dist/assets/{wand-sparkles-B88S1Wmy.js → wand-sparkles-Cr-DqJ72.js} +1 -1
  201. package/dist/assets/{web-CMXLMAi-.js → web-7SzxmtZb.js} +1 -1
  202. package/dist/assets/{web-VyAOTQmJ.js → web-Bi5XwX3f.js} +1 -1
  203. package/dist/assets/{web-BTLdcH7W.js → web-CwEs7UbJ.js} +1 -1
  204. package/dist/assets/{web-TZ9kYMWt.js → web-DmK7XAzt.js} +1 -1
  205. package/dist/assets/{web-BYjL4qgf.js → web-j7R9zD5h.js} +1 -1
  206. package/dist/assets/{webextrator-Bf_2eCAn.js → webextrator-B7KoEToq.js} +1 -1
  207. package/dist/assets/{zap-CFMYbZi2.js → zap-CSCOqmfz.js} +1 -1
  208. package/dist/index.html +1 -1
  209. package/package.json +1 -1
  210. package/dist/assets/arrow-down-CwVJJROY.js +0 -1
  211. package/dist/assets/arrow-left-B52rc7iw.js +0 -1
  212. package/dist/assets/arrow-right-B01rU2Iy.js +0 -1
  213. package/dist/assets/arrow-up-C6Ez2-pt.js +0 -1
  214. package/dist/assets/check-CJYALkeE.js +0 -1
  215. package/dist/assets/chevron-down-sDKmAFeH.js +0 -1
  216. package/dist/assets/chevron-right-CxGYYXRZ.js +0 -1
  217. package/dist/assets/circle-check-DyIZKkBA.js +0 -1
  218. package/dist/assets/clock-Ca9_jDRB.js +0 -1
  219. package/dist/assets/esm-BdxxcaMX.js +0 -1
  220. package/dist/assets/gauge-DdtQq2z8.js +0 -1
  221. package/dist/assets/loader-circle-Bi8mCbm_.js +0 -1
  222. package/dist/assets/music-2-CRNTOkhW.js +0 -1
  223. package/dist/assets/play-CBBEPwAk.js +0 -1
  224. package/dist/assets/plus-ldLZxepD.js +0 -1
  225. package/dist/assets/rotate-ccw-CfoYAzTy.js +0 -1
  226. package/dist/assets/rotate-cw-CEsFPx4C.js +0 -1
  227. package/dist/assets/search-DWYmccRS.js +0 -1
  228. package/dist/assets/square-DkOO0ufz.js +0 -1
  229. package/dist/assets/terminal-qiUwRFOq.js +0 -1
  230. package/dist/assets/user-DuKkJFC4.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,I as n,Jt as r,L as i,M as a,N as o,S as s,T as c,at as l,ht as u,it as d,j as f,mt as p,ot as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{W as y}from"./use-deprecated-DjO24JGR.js";import{r as b,t as x}from"./select-D-_BwBwU.js";import{n as S,t as C}from"./tabs-CNyJIJ5s.js";import{t as w}from"./upload-EpkcT4jm.js";import{t as T}from"./tooltip-IRIdGmNi.js";import{t as E}from"./avatar-yUP-HfhX.js";import{n as D,r as O}from"./radio-B0Elgaw9.js";import{n as k,t as A}from"./collapse-DXwB1Vxo.js";import{t as j}from"./drawer-BTC1LQDm.js";import{n as M,r as N,t as P}from"./dropdown-DMJnYbXn.js";import{t as F}from"./input-number-D24l-83c.js";import{n as ee,t as I}from"./skeleton-BVbQKb45.js";import{t as L}from"./slider-Bryotidd.js";import{t as R}from"./switch-BDiksqCG.js";import{n as te}from"./taskDrawerMixin-MzTeZOH4.js";import{i as ne,n as re,r as z,t as ie}from"./Player-CXkZYwl-.js";import{n as ae}from"./CodeSnippet-3N_RzLT7.js";import{t as oe}from"./download-ta4o9EZT.js";import{t as se}from"./ellipsis-CT3BE3Gm.js";import{t as ce}from"./image-VeW9WxnM.js";import{t as le}from"./loader-circle-Bi8mCbm_.js";import{t as B}from"./PromptTextarea-rvPInlyG.js";import{t as V}from"./pause-C-Z9NQtW.js";import{t as H}from"./play-CBBEPwAk.js";import{t as U}from"./upload-Bhad_P8Q.js";import{t as W}from"./wand-sparkles-B88S1Wmy.js";import{Jn as ue}from"./constants-CqjLASsC.js";import{$t as de,Ai as G,Bt as fe,E as K,En as q,Vt as pe,Wt as me,ei as J,gi as Y,mr as he,ri as ge,rn as _e,sr as ve,yi as X,zi as Z,zt as ye}from"./index-CtzrR21L.js";import{t as be}from"./Consumption-CFz0VGfl.js";import{a as Q,i as xe,n as Se,r as Ce,t as we}from"./pagination-z1yeQEg3.js";var Te=v({name:`LayoutProducer`,components:{MagicIcon:W,ElDrawer:j,ElButton:G},mixins:[te],data(){return{preview:!1}},computed:{}}),Ee={class:`main flex flex-row flex-1`},De={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)]`},Oe={class:`result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`},ke={class:`preview h-full w-[300px] flex flex-col`};function Ae(t,n,r,a,s,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),o(`div`,Ee,[e(`div`,De,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Oe,[d(t.$slots,`result`,{},void 0,!0)]),e(`div`,ke,[d(t.$slots,`preview`,{},void 0,!0)]),u(i(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(()=>[i(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),i(h,{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 je=K(Te,[[`render`,Ae],[`__scopeId`,`data-v-6461643a`]]),Me=v({name:`TypeSelector`,components:{ElSelect:b,ElOption:x,ElSwitch:R,InfoIcon:Q},data(){return{options:[{label:`FUZZ-2.0 Pro`,value:`FUZZ-2.0 Pro`,desc:this.$t(`producer.model.fuzz20proDesc`)},{label:`FUZZ-2.0`,value:`FUZZ-2.0`,desc:this.$t(`producer.model.fuzz20desc`)},{label:`FUZZ-2.0 Raw`,value:`FUZZ-2.0 Raw`,desc:this.$t(`producer.model.fuzz20rawDesc`)},{label:`FUZZ-1.1 Pro`,value:`FUZZ-1.1 Pro`,desc:this.$t(`producer.model.fuzz11proDesc`)},{label:`FUZZ-1.1`,value:`FUZZ-1.1`,desc:this.$t(`producer.model.fuzz11desc`)},{label:`FUZZ-1.0 Pro`,value:`FUZZ-1.0 Pro`,desc:this.$t(`producer.model.fuzz10proDesc`)},{label:`FUZZ-1.0`,value:`FUZZ-1.0`,desc:this.$t(`producer.model.fuzz10desc`)},{label:`FUZZ-0.8`,value:`FUZZ-0.8`,desc:this.$t(`producer.model.fuzz08desc`)}]}},computed:{custom:{get(){return this.$store.state.producer?.config?.custom||!1},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,custom:e})}},instrumental:{get(){return this.$store.state.producer?.config?.instrumental||!1},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,instrumental:e})}},model:{get(){return this.$store.state.producer?.config?.model},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e})}}},mounted(){this.model||=ue}}),Ne={class:`mb-3`},Pe={class:`flex items-center mb-1`},Fe={class:`text-sm font-bold`},Ie={class:`model-option`},Le={class:`model-option-name`},Re={class:`model-option-desc`},ze={key:0,class:`flex items-center justify-between mb-3`},Be={class:`flex items-center`},Ve={class:`text-sm font-bold`};function He(t,n,s,u,d,m){let _=l(`el-option`),v=l(`el-select`),y=l(`info-icon`),b=l(`el-switch`);return g(),o(`div`,null,[e(`div`,Ne,[e(`div`,Pe,[e(`span`,Fe,r(t.$t(`producer.name.model`)),1)]),i(v,{modelValue:t.model,"onUpdate:modelValue":n[0]||=e=>t.model=e,class:`w-full model-select`,size:`default`,placeholder:t.$t(`producer.placeholder.select`)},{default:p(()=>[(g(!0),o(c,null,h(t.options,t=>(g(),f(_,{key:t.value,label:t.label,value:t.value},{default:p(()=>[e(`div`,Ie,[e(`span`,Le,r(t.label),1),e(`span`,Re,r(t.desc),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),t.custom?(g(),o(`div`,ze,[e(`div`,Be,[e(`span`,Ve,r(t.$t(`producer.name.instrumental`)),1),i(y,{content:t.$t(`producer.description.instrumental`)},null,8,[`content`])]),i(b,{modelValue:t.instrumental,"onUpdate:modelValue":n[1]||=e=>t.instrumental=e},null,8,[`modelValue`])])):a(``,!0)])}var Ue=K(Me,[[`render`,He],[`__scopeId`,`data-v-42496b9a`]]),We=v({name:`UploadAudio`,components:{UploadIcon:U,ElUpload:w,ElButton:G,ElRadioGroup:O,ElRadioButton:D,InfoIcon:Q},mixins:[fe],emits:[`change`],data(){return{fileList:[],uploadUrl:ge()+`/api/v1/files/`,audioPreviewUrl:null,uploading:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},hasUploadedAudio(){let e=this.$store.state.producer?.config?.action;return e===`upload_extend`||e===`upload_cover`},uploadAction:{get(){return this.$store.state.producer?.config?.action||`upload_extend`},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,action:e})}}},watch:{urls:{handler(e){this.$emit(`change`,e)}}},methods:{onExceed(){Y.warning(this.$t(`producer.message.uploadReferencesExceed`))},onError(){this.uploading=!1,Y.error(this.$t(`producer.message.uploadReferencesError`))},async onSuccess(){let e=this.urls?.[0];if(!e){this.uploading=!1;return}this.audioPreviewUrl=e,await this.onGenerateAudioId(e)},async onGenerateAudioId(e){let t={audio_url:e},n=this.credential?.token;if(!n){console.error(`no token specified`),this.uploading=!1;return}this.uploading=!0,Y.info(this.$t(`producer.message.startingUploadAudio`));try{let e=(await q.upload(t,{token:n})).data?.data.audio_id;this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,audio_id:e,action:`upload_extend`}),Y.success(this.$t(`producer.message.startUploadAudioSuccess`))}catch(e){Y.error(e?.response?.data?.error?.message||this.$t(`producer.message.startUploadAudioFailed`))}finally{this.uploading=!1}}}}),Ge={class:`relative`},Ke={class:`flex justify-between items-center mb-2`},qe={class:`flex justify-start items-center`},Je={class:`text-sm font-bold`},Ye={key:0,class:`mb-2`},Xe=[`src`],Ze={key:1,class:`mt-1`};function Qe(t,s,c,u,d,f){let m=l(`info-icon`),h=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`el-radio-button`),b=l(`el-radio-group`);return g(),o(`div`,Ge,[e(`div`,Ke,[e(`div`,qe,[e(`span`,Je,r(t.$t(`producer.name.referenceAudios`)),1),i(m,{content:t.$t(`producer.description.uploadAudios`)},null,8,[`content`])]),i(v,{"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,limit:1,class:`upload-wrapper inline-upload`,action:t.uploadUrl,accept:`.mp3,.wav,.m4a,audio/*`,"show-file-list":!1,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[i(_,{round:``,type:`primary`,size:`small`,loading:t.uploading},{default:p(()=>[i(h,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`producer.button.uploadAudios`)),1)]),_:1},8,[`loading`])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.audioPreviewUrl?(g(),o(`div`,Ye,[e(`audio`,{src:t.audioPreviewUrl,controls:``,class:`w-full`},null,8,Xe)])):a(``,!0),t.hasUploadedAudio?(g(),o(`div`,Ze,[i(b,{modelValue:t.uploadAction,"onUpdate:modelValue":s[1]||=e=>t.uploadAction=e,size:`small`},{default:p(()=>[i(y,{value:`upload_extend`},{default:p(()=>[n(r(t.$t(`producer.button.extend`)),1)]),_:1}),i(y,{value:`upload_cover`},{default:p(()=>[n(r(t.$t(`producer.button.cover_music`)),1)]),_:1})]),_:1},8,[`modelValue`])])):a(``,!0)])}var $e=K(We,[[`render`,Qe],[`__scopeId`,`data-v-21707bf3`]]),et=v({name:`PromptInput`,components:{PromptTextarea:B},computed:{prompt:{get(){return this.$store.state.producer?.config?.prompt},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,prompt:e})}}},mounted(){this.prompt||=``}});function tt(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(`producer.name.songDescription`),info:e.$t(`producer.description.prompt`),placeholder:e.$t(`producer.placeholder.prompt`),"min-rows":5,"max-rows":14},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var nt=K(et,[[`render`,tt]]),rt=v({name:`LyricInput`,components:{MagicIcon:W,ElInput:Z,ElButton:G,InfoIcon:Q},data(){return{generatingLyrics:!1}},computed:{lyric:{get(){return this.$store.state.producer?.config?.lyric},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyric:e})}},config(){return this.$store.state.producer?.config},credential(){return this.$store.state.producer?.credential}},mounted(){this.lyric||=``},methods:{async onGenerateLyrics(){let e=this.credential?.token;if(!e)return;let t=this.config?.style||this.config?.title||`a beautiful song`;this.generatingLyrics=!0,Y.info(this.$t(`producer.message.generatingLyrics`));try{let n=(await q.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,n?.title&&!this.config?.title&&this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyric:n.text,title:n.title}),Y.success(this.$t(`producer.message.generateLyricsSuccess`)))}catch{Y.error(this.$t(`producer.message.generateLyricsFailed`))}finally{this.generatingLyrics=!1}}}}),it={class:`field`},at={class:`flex items-center justify-between mb-1`},ot={class:`flex items-center`},st={class:`text-sm font-bold`};function ct(t,s,c,u,d,m){let h=l(`info-icon`),_=l(`magic-icon`),v=l(`el-button`),y=l(`el-input`);return g(),o(`div`,it,[e(`div`,at,[e(`div`,ot,[e(`span`,st,r(t.$t(`producer.name.lyrics`)),1),i(h,{content:t.$t(`producer.description.lyrics`)},null,8,[`content`])]),t.config?.action===`extend`?a(``,!0):(g(),f(v,{key:0,size:`small`,loading:t.generatingLyrics,round:``,onClick:t.onGenerateLyrics},{default:p(()=>[t.generatingLyrics?a(``,!0):(g(),f(_,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),n(` `+r(t.$t(`producer.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))]),t.config?.action===`extend`?(g(),f(y,{key:1,modelValue:t.lyric,"onUpdate:modelValue":s[1]||=e=>t.lyric=e,rows:5,type:`textarea`,class:`lyrics`,placeholder:t.$t(`producer.placeholder.extend.lyrics`)},null,8,[`modelValue`,`placeholder`])):(g(),f(y,{key:0,modelValue:t.lyric,"onUpdate:modelValue":s[0]||=e=>t.lyric=e,rows:5,type:`textarea`,class:`lyrics`,placeholder:t.$t(`producer.placeholder.lyrics`)},null,8,[`modelValue`,`placeholder`]))])}var lt=K(rt,[[`render`,ct],[`__scopeId`,`data-v-b1a497a4`]]),ut=v({name:`StyleInput`,components:{ElInput:Z,InfoIcon:Q},computed:{style:{get(){return this.$store.state.producer?.config?.style},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,style:e})}}}}),dt={class:`field`},ft={class:`flex items-center justify-between mb-1`},pt={class:`flex items-center`},mt={class:`text-sm font-bold`};function ht(t,n,a,s,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),o(`div`,dt,[e(`div`,ft,[e(`div`,pt,[e(`span`,mt,r(t.$t(`producer.name.style`)),1),i(d,{content:t.$t(`producer.description.style`)},null,8,[`content`])])]),i(f,{modelValue:t.style,"onUpdate:modelValue":n[0]||=e=>t.style=e,rows:2,type:`textarea`,placeholder:t.$t(`producer.placeholder.style`)},null,8,[`modelValue`,`placeholder`])])}var gt=K(ut,[[`render`,ht]]),_t=v({name:`TitleInput`,components:{ElInput:Z,InfoIcon:Q},computed:{title:{get(){return this.$store.state.producer?.config?.title},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,title:e})}}}}),vt={class:`field`},yt={class:`flex items-center mb-1`},bt={class:`text-sm font-bold`};function xt(t,n,a,s,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),o(`div`,vt,[e(`div`,yt,[e(`span`,bt,r(t.$t(`producer.name.title`)),1),i(d,{content:t.$t(`producer.description.title`)},null,8,[`content`])]),i(f,{modelValue:t.title,"onUpdate:modelValue":n[0]||=e=>t.title=e,placeholder:t.$t(`producer.placeholder.title`)},null,8,[`modelValue`,`placeholder`])])}var St=K(_t,[[`render`,xt]]),Ct=v({name:`ExtendFromInput`,components:{ElImage:X,ElIcon:y,ElInputNumber:F,VideoPlay:H,VideoPause:V},data(){return{}},computed:{audio(){return this.$store.state.producer?.config?.audio},value:{get(){return this.$store.state.producer?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,onPlay(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),wt={class:`field`},Tt={class:`box`},Et={class:`title font-bold`},Dt={class:`input-wrapper`},Ot={class:`task`},kt={class:`left`},At=[`aria-label`,`title`],jt=[`aria-label`,`title`],Mt={key:2,class:`duration`},Nt={class:`info`},Pt={class:`title`},Ft={class:`style`};function It(n,c,d,f,h,_){let v=l(`el-input-number`),y=l(`el-image`),b=l(`video-pause`),x=l(`el-icon`),S=l(`video-play`),C=m(`loading`);return g(),o(`div`,wt,[e(`div`,Tt,[e(`h2`,Et,r(n.$t(`producer.name.extend`)),1),e(`div`,Dt,[i(v,{modelValue:n.value,"onUpdate:modelValue":c[0]||=e=>n.value=e,class:`value`,min:0,max:n.audio?.duration,controls:!1,placeholder:n.$t(`producer.placeholder.extend.continue_at`),onChange:n.handleChange},null,8,[`modelValue`,`max`,`placeholder`,`onChange`])])]),e(`div`,Ot,[n.audio?(g(),o(`div`,{key:0,class:`audio`,onClick:c[7]||=e=>n.onClick(n.audio)},[u((g(),o(`div`,kt,[i(y,{src:n.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),n.audio?.audio_url&&n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`playing`?(g(),o(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.pause`),title:n.$t(`common.player.pause`),onClick:c[1]||=e=>n.onPause(n.audio),onKeydown:[c[2]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`enter`]),c[3]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`space`])]},[i(x,null,{default:p(()=>[i(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,At)):a(``,!0),n.audio?.audio_url&&(n.$store.state?.producer?.audio?.id!==n.audio.id||n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`paused`)?(g(),o(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.play`),title:n.$t(`common.player.play`),onClick:c[4]||=e=>n.onPlay(n.audio),onKeydown:[c[5]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`enter`]),c[6]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`space`])]},[i(x,null,{default:p(()=>[i(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,jt)):a(``,!0),n.audio?.duration?(g(),o(`div`,Mt,r(n.useFormatDuring(n.audio?.duration)),1)):a(``,!0)])),[[C,!n.audio?.audio_url]]),e(`div`,Nt,[e(`h2`,Pt,r(n.audio?.title),1),e(`p`,Ft,r(n.audio?.style),1)])])):a(``,!0)])])}var Lt=K(Ct,[[`render`,It],[`__scopeId`,`data-v-96005bd8`]]),Rt=v({name:`CoverFromInput`,components:{ElImage:X,ElIcon:y,VideoPlay:H,VideoPause:V},data(){return{}},computed:{audio(){return this.$store.state.producer?.config?.audio},value:{get(){return this.$store.state.producer?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,onPlay(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),zt={class:`field`},Bt={class:`box`},Vt={class:`title font-bold`},Ht={class:`task`},Ut={class:`left`},Wt=[`aria-label`,`title`],Gt=[`aria-label`,`title`],Kt={key:2,class:`duration`},qt={class:`info`},Jt={class:`title`},Yt={class:`style`};function Xt(n,c,d,f,h,_){let v=l(`el-image`),y=l(`video-pause`),b=l(`el-icon`),x=l(`video-play`),S=m(`loading`);return g(),o(`div`,zt,[e(`div`,Bt,[e(`h2`,Vt,r(n.$t(`producer.name.cover`)),1)]),e(`div`,Ht,[n.audio?(g(),o(`div`,{key:0,class:`audio`,onClick:c[6]||=e=>n.onClick(n.audio)},[u((g(),o(`div`,Ut,[i(v,{src:n.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),n.audio?.audio_url&&n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`playing`?(g(),o(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.pause`),title:n.$t(`common.player.pause`),onClick:c[0]||=e=>n.onPause(n.audio),onKeydown:[c[1]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`enter`]),c[2]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`space`])]},[i(b,null,{default:p(()=>[i(y,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,Wt)):a(``,!0),n.audio?.audio_url&&(n.$store.state?.producer?.audio?.id!==n.audio.id||n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`paused`)?(g(),o(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.play`),title:n.$t(`common.player.play`),onClick:c[3]||=e=>n.onPlay(n.audio),onKeydown:[c[4]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`enter`]),c[5]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`space`])]},[i(b,null,{default:p(()=>[i(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,Gt)):a(``,!0),n.audio?.duration?(g(),o(`div`,Kt,r(n.useFormatDuring(n.audio?.duration)),1)):a(``,!0)])),[[S,!n.audio?.audio_url]]),e(`div`,qt,[e(`h2`,Jt,r(n.audio?.title),1),e(`p`,Yt,r(n.audio?.style),1)])])):a(``,!0)])])}var Zt=K(Rt,[[`render`,Xt],[`__scopeId`,`data-v-9a4b0b16`]]),Qt=v({name:`VocalGenderSelector`,components:{ElRadioGroup:O,ElRadioButton:D,InfoIcon:Q},computed:{vocalGender:{get(){return this.$store.state.producer?.config?.vocal_gender||``},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,vocal_gender:e||void 0})}}}}),$t={class:`mb-2`},en={class:`flex items-center mb-1`},tn={class:`text-sm font-bold`};function nn(t,a,s,c,u,d){let f=l(`info-icon`),m=l(`el-radio-button`),h=l(`el-radio-group`);return g(),o(`div`,$t,[e(`div`,en,[e(`span`,tn,r(t.$t(`producer.name.vocalGender`)),1),i(f,{content:t.$t(`producer.description.vocalGender`)},null,8,[`content`])]),i(h,{modelValue:t.vocalGender,"onUpdate:modelValue":a[0]||=e=>t.vocalGender=e},{default:p(()=>[i(m,{value:``},{default:p(()=>[n(r(t.$t(`producer.gender.auto`)),1)]),_:1}),i(m,{value:`f`},{default:p(()=>[n(r(t.$t(`producer.gender.female`)),1)]),_:1}),i(m,{value:`m`},{default:p(()=>[n(r(t.$t(`producer.gender.male`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var rn=K(Qt,[[`render`,nn]]),an=v({name:`AdvancedParams`,components:{ElCollapse:A,ElCollapseItem:k,ElInput:Z,ElSlider:L,ElInputNumber:F,InfoIcon:Q},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.producer?.config},styleNegative:{get(){return this.$store.state.producer?.config?.style_negative||``},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,style_negative:e||void 0})}},lyricPrompt:{get(){return this.$store.state.producer?.config?.lyric_prompt||``},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyric_prompt:e||void 0})}},weirdness:{get(){return this.$store.state.producer?.config?.weirdness??.5},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,weirdness:e})}},soundStrength:{get(){return this.$store.state.producer?.config?.sound_strength??.7},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,sound_strength:e})}},lyricsStrength:{get(){return this.$store.state.producer?.config?.lyrics_strength??.7},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyrics_strength:e})}},seed:{get(){return this.$store.state.producer?.config?.seed},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,seed:e})}}},mounted(){let e=this.$store.state.producer?.config;if(!e)return;let t={};typeof e.weirdness==`number`&&e.weirdness>1&&(t.weirdness=e.weirdness/100),typeof e.sound_strength==`number`&&e.sound_strength>1&&(t.sound_strength=e.sound_strength/100),typeof e.lyrics_strength==`number`&&e.lyrics_strength>1&&(t.lyrics_strength=e.lyrics_strength/100),Object.keys(t).length>0&&this.$store.commit(`producer/setConfig`,{...e,...t})}}),on={key:0,class:`mb-3`},sn={class:`flex items-center mb-1`},cn={class:`text-xs font-bold`},ln={key:1,class:`mb-3`},un={class:`flex items-center mb-1`},dn={class:`text-xs font-bold`},fn={class:`mb-3`},pn={class:`flex items-center justify-between mb-1`},mn={class:`flex items-center`},hn={class:`text-xs font-bold`},gn={class:`text-xs text-[var(--el-text-color-secondary)]`},_n={class:`mb-3`},vn={class:`flex items-center justify-between mb-1`},yn={class:`flex items-center`},bn={class:`text-xs font-bold`},xn={class:`text-xs text-[var(--el-text-color-secondary)]`},Sn={key:2,class:`mb-3`},Cn={class:`flex items-center justify-between mb-1`},wn={class:`flex items-center`},Tn={class:`text-xs font-bold`},En={class:`text-xs text-[var(--el-text-color-secondary)]`},Dn={class:`mb-3`},On={class:`flex items-center mb-1`},kn={class:`text-xs font-bold`};function An(t,n,s,c,u,d){let m=l(`info-icon`),h=l(`el-input`),_=l(`el-slider`),v=l(`el-input-number`),y=l(`el-collapse-item`),b=l(`el-collapse`);return g(),f(b,{modelValue:t.activeNames,"onUpdate:modelValue":n[6]||=e=>t.activeNames=e,class:`advanced-collapse`},{default:p(()=>[i(y,{title:t.$t(`producer.name.advancedParams`),name:`advanced`},{default:p(()=>[t.config?.custom?(g(),o(`div`,on,[e(`div`,sn,[e(`span`,cn,r(t.$t(`producer.name.styleNegative`)),1),i(m,{content:t.$t(`producer.description.styleNegative`)},null,8,[`content`])]),i(h,{modelValue:t.styleNegative,"onUpdate:modelValue":n[0]||=e=>t.styleNegative=e,size:`small`,placeholder:t.$t(`producer.placeholder.styleNegative`)},null,8,[`modelValue`,`placeholder`])])):a(``,!0),t.config?.custom&&!t.config?.instrumental?(g(),o(`div`,ln,[e(`div`,un,[e(`span`,dn,r(t.$t(`producer.name.lyricPrompt`)),1),i(m,{content:t.$t(`producer.description.lyricPrompt`)},null,8,[`content`])]),i(h,{modelValue:t.lyricPrompt,"onUpdate:modelValue":n[1]||=e=>t.lyricPrompt=e,size:`small`,placeholder:t.$t(`producer.placeholder.lyricPrompt`)},null,8,[`modelValue`,`placeholder`])])):a(``,!0),e(`div`,fn,[e(`div`,pn,[e(`div`,mn,[e(`span`,hn,r(t.$t(`producer.name.weirdness`)),1),i(m,{content:t.$t(`producer.description.weirdness`)},null,8,[`content`])]),e(`span`,gn,r(t.weirdness??.5),1)]),i(_,{modelValue:t.weirdness,"onUpdate:modelValue":n[2]||=e=>t.weirdness=e,min:0,max:1,step:.01},null,8,[`modelValue`])]),e(`div`,_n,[e(`div`,vn,[e(`div`,yn,[e(`span`,bn,r(t.$t(`producer.name.soundStrength`)),1),i(m,{content:t.$t(`producer.description.soundStrength`)},null,8,[`content`])]),e(`span`,xn,r(t.soundStrength??.7),1)]),i(_,{modelValue:t.soundStrength,"onUpdate:modelValue":n[3]||=e=>t.soundStrength=e,min:.2,max:1,step:.01},null,8,[`modelValue`])]),t.config?.custom&&!t.config?.instrumental?(g(),o(`div`,Sn,[e(`div`,Cn,[e(`div`,wn,[e(`span`,Tn,r(t.$t(`producer.name.lyricsStrength`)),1),i(m,{content:t.$t(`producer.description.lyricsStrength`)},null,8,[`content`])]),e(`span`,En,r(t.lyricsStrength??.7),1)]),i(_,{modelValue:t.lyricsStrength,"onUpdate:modelValue":n[4]||=e=>t.lyricsStrength=e,min:0,max:1,step:.01},null,8,[`modelValue`])])):a(``,!0),e(`div`,Dn,[e(`div`,On,[e(`span`,kn,r(t.$t(`producer.name.seed`)),1),i(m,{content:t.$t(`producer.description.seed`)},null,8,[`content`])]),i(v,{modelValue:t.seed,"onUpdate:modelValue":n[5]||=e=>t.seed=e,min:0,controls:!1,size:`small`,placeholder:t.$t(`producer.placeholder.seed`),class:`w-full`},null,8,[`modelValue`,`placeholder`])])]),_:1},8,[`title`])]),_:1},8,[`modelValue`])}var jn=K(an,[[`render`,An],[`__scopeId`,`data-v-f9296888`]]),Mn=v({name:`ReplaceSectionInput`,components:{ElInputNumber:F,ElImage:X,InfoIcon:Q},computed:{audio(){return this.$store.state.producer?.config?.audio},replaceSectionStart:{get(){return this.$store.state.producer?.config?.replace_section_start},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,replace_section_start:e})}},replaceSectionEnd:{get(){return this.$store.state.producer?.config?.replace_section_end},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,replace_section_end:e})}}},methods:{onClick(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`})}}}),Nn={class:`field`},Pn={class:`flex items-center mb-2`},Fn={class:`text-sm font-bold m-0`},In={key:0,class:`task mb-2`},Ln={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Rn={class:`info flex-1 min-w-0`},zn={class:`text-sm font-bold m-0 truncate`},Bn={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Vn={class:`flex gap-2`};function Hn(t,n,s,c,d,f){let p=l(`info-icon`),h=l(`el-image`),_=l(`el-input-number`),v=m(`loading`);return g(),o(`div`,Nn,[e(`div`,Pn,[e(`h2`,Fn,r(t.$t(`producer.name.replaceSection`)),1),i(p,{content:t.$t(`producer.description.replaceSection`)},null,8,[`content`])]),t.audio?(g(),o(`div`,In,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[u((g(),o(`div`,Ln,[i(h,{src:t.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!t.audio?.audio_url]]),e(`div`,Rn,[e(`h2`,zn,r(t.audio?.title),1),e(`p`,Bn,r(t.audio?.style),1)])])])):a(``,!0),e(`div`,Vn,[i(_,{modelValue:t.replaceSectionStart,"onUpdate:modelValue":n[1]||=e=>t.replaceSectionStart=e,class:`flex-1`,min:0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`producer.placeholder.replaceSectionStart`)},null,8,[`modelValue`,`max`,`placeholder`]),i(_,{modelValue:t.replaceSectionEnd,"onUpdate:modelValue":n[2]||=e=>t.replaceSectionEnd=e,class:`flex-1`,min:t.replaceSectionStart||0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`producer.placeholder.replaceSectionEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Un=v({name:`PresetPanel`,components:{CleanupIcon:ne,MagicIcon:W,TypeSelector:Ue,PromptInput:nt,LyricInput:lt,StyleInput:gt,TitleInput:St,ExtendFromInput:Lt,CoverFromInput:Zt,UploadAudio:$e,VocalGenderSelector:rn,AdvancedParams:jn,ReplaceSectionInput:K(Mn,[[`render`,Hn]]),ElButton:G,ElTabs:S,ElTabPane:C,Consumption:be},emits:[`generate`],computed:{config(){return this.$store.state.producer?.config},mode:{get(){return this.$store.state.producer?.config?.custom?`custom`:`simple`},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,custom:e===`custom`})}},consumption(){return me(this.config,this.service?.cost)},service(){return this.$store.state.producer?.service},generateButtonText(){let e=this.config?.action;return e===`extend`||e===`upload_extend`?this.$t(`producer.button.extend`):e===`cover`||e===`upload_cover`?this.$t(`producer.button.cover_music`):e===`variation`?this.$t(`producer.button.variation`):e===`replace_section`?this.$t(`producer.button.replace_section`):e===`stems`?this.$t(`producer.button.get_stems`):e===`swap_vocals`?this.$t(`producer.button.swap_vocals`):e===`swap_instrumentals`?this.$t(`producer.button.swap_instrumentals`):this.$t(`producer.button.generate`)}},methods:{onGenerate(){this.$emit(`generate`)},onClearAll(){this.$store.commit(`producer/setConfig`,{custom:this.$store.state.producer?.config?.custom||!1,instrumental:!1,prompt:``,lyric:``,style:``,title:``,model:this.$store.state.producer?.config?.model})}}}),Wn={class:`flex flex-col h-full`},Gn={class:`flex-1 min-h-0 overflow-hidden`},Kn={class:`p-5`},qn={class:`p-5`},Jn={class:`flex flex-col items-center justify-center px-5 pb-5 gap-2`},Yn={class:`flex gap-2 w-full`};function Xn(t,s,c,u,d,m){let h=l(`type-selector`),_=l(`upload-audio`),v=l(`prompt-input`),y=l(`extend-from-input`),b=l(`cover-from-input`),x=l(`replace-section-input`),S=l(`advanced-params`),C=l(`el-tab-pane`),w=l(`lyric-input`),T=l(`style-input`),E=l(`title-input`),D=l(`vocal-gender-selector`),O=l(`el-tabs`),k=l(`consumption`),A=l(`cleanup-icon`),j=l(`el-button`),M=l(`magic-icon`);return g(),o(`div`,Wn,[e(`div`,Gn,[i(O,{modelValue:t.mode,"onUpdate:modelValue":s[0]||=e=>t.mode=e,class:`producer-mode-tabs`,stretch:``},{default:p(()=>[i(C,{label:t.$t(`producer.mode.simple`),name:`simple`},{default:p(()=>[e(`div`,Kn,[i(h,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),t.config?.action===`extend`?(g(),f(y,{key:0,class:`mb-4`})):a(``,!0),t.config?.action===`cover`?(g(),f(b,{key:1,class:`mb-4`})):a(``,!0),t.config?.action===`replace_section`?(g(),f(x,{key:2,class:`mb-4`})):a(``,!0),i(S,{class:`mb-4`})])]),_:1},8,[`label`]),i(C,{label:t.$t(`producer.mode.custom`),name:`custom`},{default:p(()=>[e(`div`,qn,[i(h,{class:`mb-4`}),i(_,{class:`mb-4`}),t.config?.instrumental?a(``,!0):(g(),f(w,{key:0,class:`mb-4`})),i(T,{class:`mb-4`}),i(E,{class:`mb-4`}),t.config?.instrumental?a(``,!0):(g(),f(D,{key:1,class:`mb-4`})),t.config?.action===`extend`?(g(),f(y,{key:2,class:`mb-4`})):a(``,!0),t.config?.action===`cover`?(g(),f(b,{key:3,class:`mb-4`})):a(``,!0),t.config?.action===`replace_section`?(g(),f(x,{key:4,class:`mb-4`})):a(``,!0),i(S,{class:`mb-4`})])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),e(`div`,Jn,[i(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),e(`div`,Yn,[i(j,{class:`flex-1`,onClick:t.onClearAll},{default:p(()=>[i(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`producer.button.clear_all`)),1)]),_:1},8,[`onClick`]),i(j,{type:`primary`,class:`flex-1`,round:``,onClick:t.onGenerate},{default:p(()=>[i(M,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.generateButtonText),1)]),_:1},8,[`onClick`])])])])}var Zn=K(Un,[[`render`,Xn],[`__scopeId`,`data-v-acdfec88`]]),Qn=re(),$n=v({name:`TaskPreview`,components:{CodeIcon:ae,DownloadIcon:oe,MoreIcon:se,ElImage:X,ElIcon:y,ElTooltip:T,VideoPlay:H,VideoPause:V,ElDropdown:P,ElDropdownMenu:N,ElDropdownItem:M,Loading:le,ApiCodeDialog:xe},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,apiCodeVisible:!1,apiCodePath:`/producer/audios`,apiCodeBody:{}}},computed:{loading(){return this.$store.state.producer?.status?.getApplications===J.Request},showViewCode(){return _e()},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},task(){return this.$store.state.producer?.tasks},audios(){let e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(e=>({...e,action:t})):e},application(){return this.$store.state.producer?.application},active(){return this.$store.state.producer?.tasks?.active}},methods:{useFormatDuring:z,onViewCode(){let e=this.modelValue?.request||{},t={};Object.entries(e).forEach(([e,n])=>{e===`application_id`||e===`callback_url`||n!=null&&(typeof n==`string`&&n===``||Array.isArray(n)&&n.length===0||(t[e]=n))}),this.apiCodeBody=t,this.apiCodePath=`/producer/audios`,this.apiCodeVisible=!0},onPlay(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e?.stopPropagation(),console.debug(`set config`,t),this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:`extend`,audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e?.stopPropagation();let n=new URL(t).pathname,r=n.substring(n.lastIndexOf(`/`)+1);fetch(t).then(e=>e.blob()).then(e=>{(0,Qn.saveAs)(e,r)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;let t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(e){console.error(`get videoUrl failed:`,e),Y.error(this.$t(`producer.message.getVideoUrlFailed`))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,n)=>{let r={audio_id:e},i=this.credential?.token;if(!i){console.error(`no token specified`),n(Error(`No token specified`));return}q.video(r,{token:i}).then(e=>{let r=e.data?.data?.video_url;r?t(r):n(Error(`Video URL not found in response`))}).catch(e=>{n(e)})})},onPreview(e,t){e?.stopPropagation(),window.open(t,`_blank`)},async onGetStems(e){await this.onGenerateAudioUrl(`stems`,e)},onCover(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`cover`,audio:e,audio_id:e.id})},onVariation(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e.model,custom:!0,style:e.style,action:`variation`,audio:e,audio_id:e.id})},async onSwapVocals(e){await this.onGenerateAudioUrl(`swap_vocals`,e)},async onSwapInstrumentals(e){await this.onGenerateAudioUrl(`swap_instrumentals`,e)},async onGetAllStems(e){await this.onGenerateAudioUrl(`all_stems`,e)},onReplaceSection(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`replace_section`,audio:e,audio_id:e.id,replace_section_start:0,replace_section_end:Math.min(30,e.duration||30)})},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;let t=this.credential?.token;if(t)try{this.isFetchingWav=!0,Y.info(this.$t(`producer.message.fetchingWav`));let n=(await q.wav({audio_id:e.id},{token:t})).data?.data,r=Array.isArray(n)?n[0]?.file_url:n?.file_url||n?.audio_url;r?this.onDownload(null,r):Y.error(this.$t(`producer.message.fetchWavFailed`))}catch{Y.error(this.$t(`producer.message.fetchWavFailed`))}finally{this.isFetchingWav=!1}},async onGenerateAudioUrl(e,t){let n={action:e,audio_id:t,async:!0},r=this.credential?.token;if(!r){console.error(`no token specified`);return}Y.info(this.$t(`producer.message.startingTask`)),q.audio(n,{token:r}).then(()=>{Y.success(this.$t(`producer.message.startTaskSuccess`))}).catch(e=>{Y.error(e?.response?.data?.error?.message||this.$t(`producer.message.startTaskFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{let e=document.querySelector(`.tasks`);e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug(`loading`);return}await this.$store.dispatch(`producer/getTasks`,{limit:30,offset:0})}}}),er={class:`task`},tr=[`onClick`],nr={class:`left`},rr=[`aria-label`,`title`,`onClick`,`onKeydown`],ir=[`aria-label`,`title`,`onClick`,`onKeydown`],ar={key:2,class:`duration`},or={class:`info`},sr={class:`title`},cr={class:`style`},lr={class:`right`},ur={class:`el-dropdown-link`},dr={class:`flex items-center min-w-[120px]`},fr={class:`flex items-center min-w-[120px]`},pr={class:`el-dropdown-link`};function mr(d,_,v,y,b,x){let S=l(`el-image`),C=l(`video-pause`),w=l(`el-icon`),T=l(`video-play`),E=l(`download-icon`),D=l(`el-tooltip`),O=l(`Loading`),k=l(`el-dropdown-item`),A=l(`el-dropdown-menu`),j=l(`el-dropdown`),M=l(`more-icon`),N=l(`code-icon`),P=l(`api-code-dialog`),F=m(`loading`);return g(),o(`div`,er,[(g(!0),o(c,null,h(d.audios,c=>(g(),o(`div`,{key:c.id,class:`audio`,onClick:t(e=>d.onClick(c),[`stop`])},[u((g(),o(`div`,nr,[i(S,{src:c?.image_url,class:`cover`,fit:`cover`,lazy:``},null,8,[`src`]),c?.audio_url&&d.$store.state?.producer?.audio?.id===c.id&&d.$store.state?.producer?.audio?.state===`playing`?(g(),o(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":d.$t(`common.player.pause`),title:d.$t(`common.player.pause`),onClick:t(e=>d.onPause(c),[`stop`]),onKeydown:[s(t(e=>d.onPause(c),[`stop`,`prevent`]),[`enter`]),s(t(e=>d.onPause(c),[`stop`,`prevent`]),[`space`])]},[i(w,null,{default:p(()=>[i(C,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,rr)):a(``,!0),c?.audio_url&&(d.$store.state?.producer?.audio?.id!==c.id||d.$store.state?.producer?.audio?.id===c.id&&d.$store.state?.producer?.audio?.state===`paused`)?(g(),o(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":d.$t(`common.player.play`),title:d.$t(`common.player.play`),onClick:t(e=>d.onPlay(c),[`stop`]),onKeydown:[s(t(e=>d.onPlay(c),[`stop`,`prevent`]),[`enter`]),s(t(e=>d.onPlay(c),[`stop`,`prevent`]),[`space`])]},[i(w,null,{default:p(()=>[i(T,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,ir)):a(``,!0),c?.duration?(g(),o(`div`,ar,r(d.useFormatDuring(c?.duration)),1)):a(``,!0)])),[[F,!c?.audio_url]]),e(`div`,or,[e(`h2`,sr,r(c?.title),1),e(`p`,cr,r(c?.style),1)]),e(`div`,lr,[i(j,null,{dropdown:p(()=>[i(A,null,{default:p(()=>[i(k,{disabled:d.isFetchingVideoUrl,onClick:e=>d.handleVideoDownload(c)},{default:p(()=>[e(`div`,dr,[d.isFetchingVideoUrl?(g(),f(w,{key:0,class:`is-loading mr-2`},{default:p(()=>[i(O,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})):a(``,!0),e(`span`,null,r(d.$t(`producer.button.download_video`)),1)])]),_:1},8,[`disabled`,`onClick`]),c?.audio_url?(g(),f(k,{key:0,onClick:t(e=>d.onDownload(e,c?.audio_url),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.download_audio`)),1)]),_:1},8,[`onClick`])):a(``,!0),i(k,{disabled:d.isFetchingWav,onClick:e=>d.handleWavDownload(c)},{default:p(()=>[e(`div`,fr,[d.isFetchingWav?(g(),f(w,{key:0,class:`is-loading mr-2`},{default:p(()=>[i(O,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})):a(``,!0),e(`span`,null,r(d.$t(`producer.button.download_wav`)),1)])]),_:1},8,[`disabled`,`onClick`])]),_:2},1024)]),default:p(()=>[e(`span`,ur,[i(D,{effect:`dark`,content:d.$t(`producer.button.download`),placement:`top`},{default:p(()=>[c?.audio_url||c?.video_url?(g(),f(E,{key:0,class:`icon icon-download`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):a(``,!0)]),_:2},1032,[`content`])])]),_:2},1024),i(j,null,{dropdown:p(()=>[i(A,null,{default:p(()=>[c?.audio_url?(g(),f(k,{key:0,onClick:t(e=>d.onExtend(e,c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.extend`)),1)]),_:1},8,[`onClick`])):a(``,!0),c.id?(g(),f(k,{key:1,onClick:t(e=>d.onGetStems(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.get_stems`)),1)]),_:1},8,[`onClick`])):a(``,!0),c.id?(g(),f(k,{key:2,onClick:t(e=>d.onGetAllStems(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.all_stems`)),1)]),_:1},8,[`onClick`])):a(``,!0),i(k,{onClick:t(e=>d.onCover(c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.cover_music`)),1)]),_:1},8,[`onClick`]),c?.id?(g(),f(k,{key:3,onClick:t(e=>d.onVariation(c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.variation`)),1)]),_:1},8,[`onClick`])):a(``,!0),c?.id?(g(),f(k,{key:4,onClick:t(e=>d.onSwapVocals(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.swap_vocals`)),1)]),_:1},8,[`onClick`])):a(``,!0),c?.id?(g(),f(k,{key:5,onClick:t(e=>d.onSwapInstrumentals(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.swap_instrumentals`)),1)]),_:1},8,[`onClick`])):a(``,!0),c?.id?(g(),f(k,{key:6,onClick:t(e=>d.onReplaceSection(c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.replace_section`)),1)]),_:1},8,[`onClick`])):a(``,!0),d.showViewCode?(g(),f(k,{key:7,onClick:t(d.onViewCode,[`stop`])},{default:p(()=>[i(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(d.$t(`common.button.viewCode`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:2},1024)]),default:p(()=>[e(`span`,pr,[i(D,{effect:`dark`,content:d.$t(`producer.button.more`),placement:`top`},{default:p(()=>[c?.audio_url||c?.video_url?(g(),f(M,{key:0,class:`icon icon-ellipsis`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):a(``,!0)]),_:2},1032,[`content`])])]),_:2},1024)])],8,tr))),128)),i(P,{visible:d.apiCodeVisible,"onUpdate:visible":_[0]||=e=>d.apiCodeVisible=e,method:`POST`,path:d.apiCodePath,body:d.apiCodeBody,token:d.$store.state.producer?.credential?.token||``},null,8,[`visible`,`path`,`body`,`token`])])}var $=v({name:`RecentPanel`,components:{ElSkeletonItem:ee,ElSkeleton:I,TaskPreview:K($n,[[`render`,mr]]),Player:ie,NoTasks:Ce,ScrollList:Se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.producer?.tasks,items:this.$store.state.producer?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),hr={key:0,class:`tasks`},gr={class:`left w-[70px] p-[10px] flex items-center`},_r={class:`main w-[calc(100%-70px)] flex-1 p-[10px]`},vr={key:2,class:`w-full flex-1 flex items-center justify-center`},yr={class:`h-20`};function br(t,n,r,s,d,m){let v=l(`el-skeleton-item`),y=l(`el-skeleton`),b=l(`task-preview`),x=l(`scroll-list`),S=l(`no-tasks`),C=l(`player`);return g(),o(c,null,[t.tasks?.items===void 0?(g(),o(`div`,hr,[(g(),o(c,null,h(3,t=>e(`div`,{key:t,class:`flex`},[e(`div`,gr,[i(y,{animated:``},{template:p(()=>[i(v,{variant:`image`,class:`avatar w-[50px] h-[50px]`})]),_:1})]),e(`div`,_r,[i(y,{animated:``},{template:p(()=>[i(v,{variant:`p`,class:`w-[200px] h-[15px] mb-[5px] mt-[10px]`}),i(v,{variant:`text`})]),_:1})])])),64))])):t.tasks?.items?.length&&t.tasks?.items?.length>0?(g(),f(x,{key:1,ref:`scrollList`,class:`flex-1 w-full overflow-y-auto tasks p-2`,loading:t.loading,onReachTop:n[0]||=e=>t.$emit(`reach-top`)},{default:p(()=>[(g(!0),o(c,null,h(t.tasks?.items,(e,t)=>(g(),f(b,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),t.tasks?.items?.length===0?(g(),o(`div`,vr,[i(S)])):a(``,!0),u(e(`div`,yr,[i(C,{namespace:`producer`})],512),[[_,!!t.$store?.state?.producer?.audio?.object]])],64)}var xr=K($,[[`render`,br]]),Sr=v({name:`TaskPreview`,components:{IconPicture:ce,ElImage:X,ElAvatar:E,ElIcon:y},computed:{audio(){return this.$store.state.producer?.audio}}}),Cr={key:0,class:`size-full overflow-hidden`},wr={class:`relative h-[300px]`},Tr={class:`flex items-center justify-center size-full bg-[var(--el-bg-color)]`},Er={class:`absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent`},Dr={class:`p-4`},Or={class:`flex items-center font-bold mb-2`},kr={class:`text-[var(--el-text-color-regular)] mb-2`},Ar={class:`text-xs text-[var(--el-text-color-regular)]`},jr={class:`mt-4 text-sm leading-[25px] whitespace-pre-wrap`},Mr={key:1,class:`w-full h-full`};function Nr(t,n,a,s,c,u){let d=l(`icon-picture`),f=l(`el-icon`),m=l(`el-image`),h=l(`el-avatar`);return t.audio?.object?(g(),o(`div`,Cr,[e(`div`,wr,[i(m,{src:t.audio.image_url,fit:`cover`,class:`size-full`},{error:p(()=>[e(`div`,Tr,[i(f,{class:`text-3xl`},{default:p(()=>[i(d,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})])]),_:1},8,[`src`]),e(`h2`,Er,r(t.audio?.title),1)]),e(`div`,Dr,[e(`div`,Or,[i(h,{size:30,src:t.audio?.image_url,class:`mr-2`},null,8,[`src`]),e(`span`,null,r(t.audio?.title),1)]),e(`p`,kr,r(t.audio?.style),1),e(`p`,Ar,r(t.$dayjs.format(t.audio?.created_at)),1),e(`div`,jr,[e(`p`,null,r(t.audio?.lyric),1)])])])):(g(),o(`div`,Mr))}var Pr=v({name:`ProducerIndex`,components:{Layout:je,ConfigPanel:Zn,RecentPanel:xr,PreviewPanel:K(Sr,[[`render`,Nr]])},mixins:[pe],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.producer?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.producer?.status?.getTasks===J.Request||this.fetchingTasks},service(){return this.$store.state.producer.service},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},initializing(){return this.$store.state.producer.status.getApplications===J.Request},needApply(){return this.$store.state.producer.status.getApplications===J.Success&&!this.application},application(){return this.$store.state.producer.application},tasks(){return this.$store.state.producer.tasks},applications(){return this.$store.state.producer.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await we({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(`producer/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplications`),await this.$store.dispatch(`producer/getApplications`),console.debug(`end onGetApplications`),await this.onGetTasks()},onApply(){ve.create({application:this.application}).then(({data:e})=>{this.application=e,Y.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&Y.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`producer/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){if(!ye(this.uploadTracker,e=>this.$t(e),e=>Y.warning(e)))return;let e={...this.config,async:!0};if(!de())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}Y.info(this.$t(`producer.message.startingTask`)),he(`producer`,q.audio(e,{token:t})).then(()=>{Y.success(this.$t(`producer.message.startTaskSuccess`))}).catch(e=>{Y.error(e?.response?.data?.error?.message||this.$t(`producer.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Fr(e,t,n,r,a,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`preview-panel`),d=l(`layout`);return g(),f(d,null,{config:p(()=>[i(s,{onGenerate:e.onGenerateAudio},null,8,[`onGenerate`])]),result:p(()=>[i(c,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),preview:p(()=>[i(u)]),_:1})}var Ir=K(Pr,[[`render`,Fr],[`__scopeId`,`data-v-23eb99dc`]]);export{Ir as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,I as n,Jt as r,L as i,M as a,N as o,S as s,T as c,at as l,ht as u,it as d,j as f,mt as p,ot as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{W as y}from"./use-deprecated-DjO24JGR.js";import{r as b,t as x}from"./select-CV_KF_4N.js";import{n as S,t as C}from"./tabs-28-MjRDJ.js";import{t as w}from"./upload-b94DR2Pd.js";import{t as T}from"./tooltip-1QTlF6Ah.js";import{t as E}from"./avatar-yUP-HfhX.js";import{n as D,r as O}from"./radio-B0Elgaw9.js";import{n as k,t as A}from"./collapse-yWKrzmVx.js";import{t as j}from"./drawer-By2wmxmu.js";import{n as M,r as N,t as P}from"./dropdown-DSMfYGzO.js";import{t as F}from"./input-number-CbkzwR1k.js";import{n as ee,t as I}from"./skeleton-BVbQKb45.js";import{t as L}from"./slider-0V56ly1L.js";import{t as R}from"./switch-IJ9gvjoD.js";import{n as te}from"./taskDrawerMixin-BUGIlU_B.js";import{i as ne,n as re,r as z,t as ie}from"./Player-CA6nVq8J.js";import{n as ae}from"./CodeSnippet-D1Z9OJcY.js";import{t as oe}from"./download-BhZEVO4v.js";import{t as se}from"./ellipsis-Dr52BzTe.js";import{t as ce}from"./image-v_elL0Bz.js";import{t as le}from"./loader-circle-BBsLYtTT.js";import{t as B}from"./PromptTextarea-B5aTi1HH.js";import{t as V}from"./pause-S6Dwk1Yf.js";import{t as H}from"./play-BBltE_r6.js";import{t as U}from"./upload-Ce_XQUOt.js";import{t as W}from"./wand-sparkles-Cr-DqJ72.js";import{Jn as ue}from"./constants-CqjLASsC.js";import{$t as de,Ai as G,Bt as fe,E as K,En as q,Vt as pe,Wt as me,ei as J,gi as Y,mr as he,ri as ge,rn as _e,sr as ve,yi as X,zi as Z,zt as ye}from"./index-L5CfS5rK.js";import{t as be}from"./Consumption-BBcKgILA.js";import{a as Q,i as xe,n as Se,r as Ce,t as we}from"./pagination-bzT3Edaj.js";var Te=v({name:`LayoutProducer`,components:{MagicIcon:W,ElDrawer:j,ElButton:G},mixins:[te],data(){return{preview:!1}},computed:{}}),Ee={class:`main flex flex-row flex-1`},De={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)]`},Oe={class:`result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`},ke={class:`preview h-full w-[300px] flex flex-col`};function Ae(t,n,r,a,s,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),o(`div`,Ee,[e(`div`,De,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Oe,[d(t.$slots,`result`,{},void 0,!0)]),e(`div`,ke,[d(t.$slots,`preview`,{},void 0,!0)]),u(i(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(()=>[i(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),i(h,{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 je=K(Te,[[`render`,Ae],[`__scopeId`,`data-v-6461643a`]]),Me=v({name:`TypeSelector`,components:{ElSelect:b,ElOption:x,ElSwitch:R,InfoIcon:Q},data(){return{options:[{label:`FUZZ-2.0 Pro`,value:`FUZZ-2.0 Pro`,desc:this.$t(`producer.model.fuzz20proDesc`)},{label:`FUZZ-2.0`,value:`FUZZ-2.0`,desc:this.$t(`producer.model.fuzz20desc`)},{label:`FUZZ-2.0 Raw`,value:`FUZZ-2.0 Raw`,desc:this.$t(`producer.model.fuzz20rawDesc`)},{label:`FUZZ-1.1 Pro`,value:`FUZZ-1.1 Pro`,desc:this.$t(`producer.model.fuzz11proDesc`)},{label:`FUZZ-1.1`,value:`FUZZ-1.1`,desc:this.$t(`producer.model.fuzz11desc`)},{label:`FUZZ-1.0 Pro`,value:`FUZZ-1.0 Pro`,desc:this.$t(`producer.model.fuzz10proDesc`)},{label:`FUZZ-1.0`,value:`FUZZ-1.0`,desc:this.$t(`producer.model.fuzz10desc`)},{label:`FUZZ-0.8`,value:`FUZZ-0.8`,desc:this.$t(`producer.model.fuzz08desc`)}]}},computed:{custom:{get(){return this.$store.state.producer?.config?.custom||!1},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,custom:e})}},instrumental:{get(){return this.$store.state.producer?.config?.instrumental||!1},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,instrumental:e})}},model:{get(){return this.$store.state.producer?.config?.model},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e})}}},mounted(){this.model||=ue}}),Ne={class:`mb-3`},Pe={class:`flex items-center mb-1`},Fe={class:`text-sm font-bold`},Ie={class:`model-option`},Le={class:`model-option-name`},Re={class:`model-option-desc`},ze={key:0,class:`flex items-center justify-between mb-3`},Be={class:`flex items-center`},Ve={class:`text-sm font-bold`};function He(t,n,s,u,d,m){let _=l(`el-option`),v=l(`el-select`),y=l(`info-icon`),b=l(`el-switch`);return g(),o(`div`,null,[e(`div`,Ne,[e(`div`,Pe,[e(`span`,Fe,r(t.$t(`producer.name.model`)),1)]),i(v,{modelValue:t.model,"onUpdate:modelValue":n[0]||=e=>t.model=e,class:`w-full model-select`,size:`default`,placeholder:t.$t(`producer.placeholder.select`)},{default:p(()=>[(g(!0),o(c,null,h(t.options,t=>(g(),f(_,{key:t.value,label:t.label,value:t.value},{default:p(()=>[e(`div`,Ie,[e(`span`,Le,r(t.label),1),e(`span`,Re,r(t.desc),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),t.custom?(g(),o(`div`,ze,[e(`div`,Be,[e(`span`,Ve,r(t.$t(`producer.name.instrumental`)),1),i(y,{content:t.$t(`producer.description.instrumental`)},null,8,[`content`])]),i(b,{modelValue:t.instrumental,"onUpdate:modelValue":n[1]||=e=>t.instrumental=e},null,8,[`modelValue`])])):a(``,!0)])}var Ue=K(Me,[[`render`,He],[`__scopeId`,`data-v-42496b9a`]]),We=v({name:`UploadAudio`,components:{UploadIcon:U,ElUpload:w,ElButton:G,ElRadioGroup:O,ElRadioButton:D,InfoIcon:Q},mixins:[fe],emits:[`change`],data(){return{fileList:[],uploadUrl:ge()+`/api/v1/files/`,audioPreviewUrl:null,uploading:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},hasUploadedAudio(){let e=this.$store.state.producer?.config?.action;return e===`upload_extend`||e===`upload_cover`},uploadAction:{get(){return this.$store.state.producer?.config?.action||`upload_extend`},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,action:e})}}},watch:{urls:{handler(e){this.$emit(`change`,e)}}},methods:{onExceed(){Y.warning(this.$t(`producer.message.uploadReferencesExceed`))},onError(){this.uploading=!1,Y.error(this.$t(`producer.message.uploadReferencesError`))},async onSuccess(){let e=this.urls?.[0];if(!e){this.uploading=!1;return}this.audioPreviewUrl=e,await this.onGenerateAudioId(e)},async onGenerateAudioId(e){let t={audio_url:e},n=this.credential?.token;if(!n){console.error(`no token specified`),this.uploading=!1;return}this.uploading=!0,Y.info(this.$t(`producer.message.startingUploadAudio`));try{let e=(await q.upload(t,{token:n})).data?.data.audio_id;this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,audio_id:e,action:`upload_extend`}),Y.success(this.$t(`producer.message.startUploadAudioSuccess`))}catch(e){Y.error(e?.response?.data?.error?.message||this.$t(`producer.message.startUploadAudioFailed`))}finally{this.uploading=!1}}}}),Ge={class:`relative`},Ke={class:`flex justify-between items-center mb-2`},qe={class:`flex justify-start items-center`},Je={class:`text-sm font-bold`},Ye={key:0,class:`mb-2`},Xe=[`src`],Ze={key:1,class:`mt-1`};function Qe(t,s,c,u,d,f){let m=l(`info-icon`),h=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`el-radio-button`),b=l(`el-radio-group`);return g(),o(`div`,Ge,[e(`div`,Ke,[e(`div`,qe,[e(`span`,Je,r(t.$t(`producer.name.referenceAudios`)),1),i(m,{content:t.$t(`producer.description.uploadAudios`)},null,8,[`content`])]),i(v,{"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,limit:1,class:`upload-wrapper inline-upload`,action:t.uploadUrl,accept:`.mp3,.wav,.m4a,audio/*`,"show-file-list":!1,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[i(_,{round:``,type:`primary`,size:`small`,loading:t.uploading},{default:p(()=>[i(h,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`producer.button.uploadAudios`)),1)]),_:1},8,[`loading`])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.audioPreviewUrl?(g(),o(`div`,Ye,[e(`audio`,{src:t.audioPreviewUrl,controls:``,class:`w-full`},null,8,Xe)])):a(``,!0),t.hasUploadedAudio?(g(),o(`div`,Ze,[i(b,{modelValue:t.uploadAction,"onUpdate:modelValue":s[1]||=e=>t.uploadAction=e,size:`small`},{default:p(()=>[i(y,{value:`upload_extend`},{default:p(()=>[n(r(t.$t(`producer.button.extend`)),1)]),_:1}),i(y,{value:`upload_cover`},{default:p(()=>[n(r(t.$t(`producer.button.cover_music`)),1)]),_:1})]),_:1},8,[`modelValue`])])):a(``,!0)])}var $e=K(We,[[`render`,Qe],[`__scopeId`,`data-v-21707bf3`]]),et=v({name:`PromptInput`,components:{PromptTextarea:B},computed:{prompt:{get(){return this.$store.state.producer?.config?.prompt},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,prompt:e})}}},mounted(){this.prompt||=``}});function tt(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(`producer.name.songDescription`),info:e.$t(`producer.description.prompt`),placeholder:e.$t(`producer.placeholder.prompt`),"min-rows":5,"max-rows":14},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var nt=K(et,[[`render`,tt]]),rt=v({name:`LyricInput`,components:{MagicIcon:W,ElInput:Z,ElButton:G,InfoIcon:Q},data(){return{generatingLyrics:!1}},computed:{lyric:{get(){return this.$store.state.producer?.config?.lyric},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyric:e})}},config(){return this.$store.state.producer?.config},credential(){return this.$store.state.producer?.credential}},mounted(){this.lyric||=``},methods:{async onGenerateLyrics(){let e=this.credential?.token;if(!e)return;let t=this.config?.style||this.config?.title||`a beautiful song`;this.generatingLyrics=!0,Y.info(this.$t(`producer.message.generatingLyrics`));try{let n=(await q.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,n?.title&&!this.config?.title&&this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyric:n.text,title:n.title}),Y.success(this.$t(`producer.message.generateLyricsSuccess`)))}catch{Y.error(this.$t(`producer.message.generateLyricsFailed`))}finally{this.generatingLyrics=!1}}}}),it={class:`field`},at={class:`flex items-center justify-between mb-1`},ot={class:`flex items-center`},st={class:`text-sm font-bold`};function ct(t,s,c,u,d,m){let h=l(`info-icon`),_=l(`magic-icon`),v=l(`el-button`),y=l(`el-input`);return g(),o(`div`,it,[e(`div`,at,[e(`div`,ot,[e(`span`,st,r(t.$t(`producer.name.lyrics`)),1),i(h,{content:t.$t(`producer.description.lyrics`)},null,8,[`content`])]),t.config?.action===`extend`?a(``,!0):(g(),f(v,{key:0,size:`small`,loading:t.generatingLyrics,round:``,onClick:t.onGenerateLyrics},{default:p(()=>[t.generatingLyrics?a(``,!0):(g(),f(_,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),n(` `+r(t.$t(`producer.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))]),t.config?.action===`extend`?(g(),f(y,{key:1,modelValue:t.lyric,"onUpdate:modelValue":s[1]||=e=>t.lyric=e,rows:5,type:`textarea`,class:`lyrics`,placeholder:t.$t(`producer.placeholder.extend.lyrics`)},null,8,[`modelValue`,`placeholder`])):(g(),f(y,{key:0,modelValue:t.lyric,"onUpdate:modelValue":s[0]||=e=>t.lyric=e,rows:5,type:`textarea`,class:`lyrics`,placeholder:t.$t(`producer.placeholder.lyrics`)},null,8,[`modelValue`,`placeholder`]))])}var lt=K(rt,[[`render`,ct],[`__scopeId`,`data-v-b1a497a4`]]),ut=v({name:`StyleInput`,components:{ElInput:Z,InfoIcon:Q},computed:{style:{get(){return this.$store.state.producer?.config?.style},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,style:e})}}}}),dt={class:`field`},ft={class:`flex items-center justify-between mb-1`},pt={class:`flex items-center`},mt={class:`text-sm font-bold`};function ht(t,n,a,s,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),o(`div`,dt,[e(`div`,ft,[e(`div`,pt,[e(`span`,mt,r(t.$t(`producer.name.style`)),1),i(d,{content:t.$t(`producer.description.style`)},null,8,[`content`])])]),i(f,{modelValue:t.style,"onUpdate:modelValue":n[0]||=e=>t.style=e,rows:2,type:`textarea`,placeholder:t.$t(`producer.placeholder.style`)},null,8,[`modelValue`,`placeholder`])])}var gt=K(ut,[[`render`,ht]]),_t=v({name:`TitleInput`,components:{ElInput:Z,InfoIcon:Q},computed:{title:{get(){return this.$store.state.producer?.config?.title},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,title:e})}}}}),vt={class:`field`},yt={class:`flex items-center mb-1`},bt={class:`text-sm font-bold`};function xt(t,n,a,s,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),o(`div`,vt,[e(`div`,yt,[e(`span`,bt,r(t.$t(`producer.name.title`)),1),i(d,{content:t.$t(`producer.description.title`)},null,8,[`content`])]),i(f,{modelValue:t.title,"onUpdate:modelValue":n[0]||=e=>t.title=e,placeholder:t.$t(`producer.placeholder.title`)},null,8,[`modelValue`,`placeholder`])])}var St=K(_t,[[`render`,xt]]),Ct=v({name:`ExtendFromInput`,components:{ElImage:X,ElIcon:y,ElInputNumber:F,VideoPlay:H,VideoPause:V},data(){return{}},computed:{audio(){return this.$store.state.producer?.config?.audio},value:{get(){return this.$store.state.producer?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){if(e===void 0){this.value=void 0;return}e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,onPlay(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),wt={class:`field`},Tt={class:`box`},Et={class:`title font-bold`},Dt={class:`input-wrapper`},Ot={class:`task`},kt={class:`left`},At=[`aria-label`,`title`],jt=[`aria-label`,`title`],Mt={key:2,class:`duration`},Nt={class:`info`},Pt={class:`title`},Ft={class:`style`};function It(n,c,d,f,h,_){let v=l(`el-input-number`),y=l(`el-image`),b=l(`video-pause`),x=l(`el-icon`),S=l(`video-play`),C=m(`loading`);return g(),o(`div`,wt,[e(`div`,Tt,[e(`h2`,Et,r(n.$t(`producer.name.extend`)),1),e(`div`,Dt,[i(v,{modelValue:n.value,"onUpdate:modelValue":c[0]||=e=>n.value=e,class:`value`,min:0,max:n.audio?.duration,controls:!1,placeholder:n.$t(`producer.placeholder.extend.continue_at`),onChange:n.handleChange},null,8,[`modelValue`,`max`,`placeholder`,`onChange`])])]),e(`div`,Ot,[n.audio?(g(),o(`div`,{key:0,class:`audio`,onClick:c[7]||=e=>n.onClick(n.audio)},[u((g(),o(`div`,kt,[i(y,{src:n.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),n.audio?.audio_url&&n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`playing`?(g(),o(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.pause`),title:n.$t(`common.player.pause`),onClick:c[1]||=e=>n.onPause(n.audio),onKeydown:[c[2]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`enter`]),c[3]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`space`])]},[i(x,null,{default:p(()=>[i(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,At)):a(``,!0),n.audio?.audio_url&&(n.$store.state?.producer?.audio?.id!==n.audio.id||n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`paused`)?(g(),o(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.play`),title:n.$t(`common.player.play`),onClick:c[4]||=e=>n.onPlay(n.audio),onKeydown:[c[5]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`enter`]),c[6]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`space`])]},[i(x,null,{default:p(()=>[i(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,jt)):a(``,!0),n.audio?.duration?(g(),o(`div`,Mt,r(n.useFormatDuring(n.audio?.duration)),1)):a(``,!0)])),[[C,!n.audio?.audio_url]]),e(`div`,Nt,[e(`h2`,Pt,r(n.audio?.title),1),e(`p`,Ft,r(n.audio?.style),1)])])):a(``,!0)])])}var Lt=K(Ct,[[`render`,It],[`__scopeId`,`data-v-96005bd8`]]),Rt=v({name:`CoverFromInput`,components:{ElImage:X,ElIcon:y,VideoPlay:H,VideoPause:V},data(){return{}},computed:{audio(){return this.$store.state.producer?.config?.audio},value:{get(){return this.$store.state.producer?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,continue_at:e?parseInt(e):void 0})}}},mounted(){this.value||=void 0},methods:{handleChange(e){e<0?this.value=0:e>this.audio?.duration?this.value=this.audio?.duration:this.value=e},useFormatDuring:z,onPlay(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),zt={class:`field`},Bt={class:`box`},Vt={class:`title font-bold`},Ht={class:`task`},Ut={class:`left`},Wt=[`aria-label`,`title`],Gt=[`aria-label`,`title`],Kt={key:2,class:`duration`},qt={class:`info`},Jt={class:`title`},Yt={class:`style`};function Xt(n,c,d,f,h,_){let v=l(`el-image`),y=l(`video-pause`),b=l(`el-icon`),x=l(`video-play`),S=m(`loading`);return g(),o(`div`,zt,[e(`div`,Bt,[e(`h2`,Vt,r(n.$t(`producer.name.cover`)),1)]),e(`div`,Ht,[n.audio?(g(),o(`div`,{key:0,class:`audio`,onClick:c[6]||=e=>n.onClick(n.audio)},[u((g(),o(`div`,Ut,[i(v,{src:n.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),n.audio?.audio_url&&n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`playing`?(g(),o(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.pause`),title:n.$t(`common.player.pause`),onClick:c[0]||=e=>n.onPause(n.audio),onKeydown:[c[1]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`enter`]),c[2]||=s(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`space`])]},[i(b,null,{default:p(()=>[i(y,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,Wt)):a(``,!0),n.audio?.audio_url&&(n.$store.state?.producer?.audio?.id!==n.audio.id||n.$store.state?.producer?.audio?.id===n.audio.id&&n.$store.state?.producer?.audio?.state===`paused`)?(g(),o(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.play`),title:n.$t(`common.player.play`),onClick:c[3]||=e=>n.onPlay(n.audio),onKeydown:[c[4]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`enter`]),c[5]||=s(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`space`])]},[i(b,null,{default:p(()=>[i(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,Gt)):a(``,!0),n.audio?.duration?(g(),o(`div`,Kt,r(n.useFormatDuring(n.audio?.duration)),1)):a(``,!0)])),[[S,!n.audio?.audio_url]]),e(`div`,qt,[e(`h2`,Jt,r(n.audio?.title),1),e(`p`,Yt,r(n.audio?.style),1)])])):a(``,!0)])])}var Zt=K(Rt,[[`render`,Xt],[`__scopeId`,`data-v-9a4b0b16`]]),Qt=v({name:`VocalGenderSelector`,components:{ElRadioGroup:O,ElRadioButton:D,InfoIcon:Q},computed:{vocalGender:{get(){return this.$store.state.producer?.config?.vocal_gender||``},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,vocal_gender:e||void 0})}}}}),$t={class:`mb-2`},en={class:`flex items-center mb-1`},tn={class:`text-sm font-bold`};function nn(t,a,s,c,u,d){let f=l(`info-icon`),m=l(`el-radio-button`),h=l(`el-radio-group`);return g(),o(`div`,$t,[e(`div`,en,[e(`span`,tn,r(t.$t(`producer.name.vocalGender`)),1),i(f,{content:t.$t(`producer.description.vocalGender`)},null,8,[`content`])]),i(h,{modelValue:t.vocalGender,"onUpdate:modelValue":a[0]||=e=>t.vocalGender=e},{default:p(()=>[i(m,{value:``},{default:p(()=>[n(r(t.$t(`producer.gender.auto`)),1)]),_:1}),i(m,{value:`f`},{default:p(()=>[n(r(t.$t(`producer.gender.female`)),1)]),_:1}),i(m,{value:`m`},{default:p(()=>[n(r(t.$t(`producer.gender.male`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var rn=K(Qt,[[`render`,nn]]),an=v({name:`AdvancedParams`,components:{ElCollapse:A,ElCollapseItem:k,ElInput:Z,ElSlider:L,ElInputNumber:F,InfoIcon:Q},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.producer?.config},styleNegative:{get(){return this.$store.state.producer?.config?.style_negative||``},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,style_negative:e||void 0})}},lyricPrompt:{get(){return this.$store.state.producer?.config?.lyric_prompt||``},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyric_prompt:e||void 0})}},weirdness:{get(){return this.$store.state.producer?.config?.weirdness??.5},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,weirdness:e})}},soundStrength:{get(){return this.$store.state.producer?.config?.sound_strength??.7},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,sound_strength:e})}},lyricsStrength:{get(){return this.$store.state.producer?.config?.lyrics_strength??.7},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,lyrics_strength:e})}},seed:{get(){return this.$store.state.producer?.config?.seed},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,seed:e})}}},mounted(){let e=this.$store.state.producer?.config;if(!e)return;let t={};typeof e.weirdness==`number`&&e.weirdness>1&&(t.weirdness=e.weirdness/100),typeof e.sound_strength==`number`&&e.sound_strength>1&&(t.sound_strength=e.sound_strength/100),typeof e.lyrics_strength==`number`&&e.lyrics_strength>1&&(t.lyrics_strength=e.lyrics_strength/100),Object.keys(t).length>0&&this.$store.commit(`producer/setConfig`,{...e,...t})}}),on={key:0,class:`mb-3`},sn={class:`flex items-center mb-1`},cn={class:`text-xs font-bold`},ln={key:1,class:`mb-3`},un={class:`flex items-center mb-1`},dn={class:`text-xs font-bold`},fn={class:`mb-3`},pn={class:`flex items-center justify-between mb-1`},mn={class:`flex items-center`},hn={class:`text-xs font-bold`},gn={class:`text-xs text-[var(--el-text-color-secondary)]`},_n={class:`mb-3`},vn={class:`flex items-center justify-between mb-1`},yn={class:`flex items-center`},bn={class:`text-xs font-bold`},xn={class:`text-xs text-[var(--el-text-color-secondary)]`},Sn={key:2,class:`mb-3`},Cn={class:`flex items-center justify-between mb-1`},wn={class:`flex items-center`},Tn={class:`text-xs font-bold`},En={class:`text-xs text-[var(--el-text-color-secondary)]`},Dn={class:`mb-3`},On={class:`flex items-center mb-1`},kn={class:`text-xs font-bold`};function An(t,n,s,c,u,d){let m=l(`info-icon`),h=l(`el-input`),_=l(`el-slider`),v=l(`el-input-number`),y=l(`el-collapse-item`),b=l(`el-collapse`);return g(),f(b,{modelValue:t.activeNames,"onUpdate:modelValue":n[6]||=e=>t.activeNames=e,class:`advanced-collapse`},{default:p(()=>[i(y,{title:t.$t(`producer.name.advancedParams`),name:`advanced`},{default:p(()=>[t.config?.custom?(g(),o(`div`,on,[e(`div`,sn,[e(`span`,cn,r(t.$t(`producer.name.styleNegative`)),1),i(m,{content:t.$t(`producer.description.styleNegative`)},null,8,[`content`])]),i(h,{modelValue:t.styleNegative,"onUpdate:modelValue":n[0]||=e=>t.styleNegative=e,size:`small`,placeholder:t.$t(`producer.placeholder.styleNegative`)},null,8,[`modelValue`,`placeholder`])])):a(``,!0),t.config?.custom&&!t.config?.instrumental?(g(),o(`div`,ln,[e(`div`,un,[e(`span`,dn,r(t.$t(`producer.name.lyricPrompt`)),1),i(m,{content:t.$t(`producer.description.lyricPrompt`)},null,8,[`content`])]),i(h,{modelValue:t.lyricPrompt,"onUpdate:modelValue":n[1]||=e=>t.lyricPrompt=e,size:`small`,placeholder:t.$t(`producer.placeholder.lyricPrompt`)},null,8,[`modelValue`,`placeholder`])])):a(``,!0),e(`div`,fn,[e(`div`,pn,[e(`div`,mn,[e(`span`,hn,r(t.$t(`producer.name.weirdness`)),1),i(m,{content:t.$t(`producer.description.weirdness`)},null,8,[`content`])]),e(`span`,gn,r(t.weirdness??.5),1)]),i(_,{modelValue:t.weirdness,"onUpdate:modelValue":n[2]||=e=>t.weirdness=e,min:0,max:1,step:.01},null,8,[`modelValue`])]),e(`div`,_n,[e(`div`,vn,[e(`div`,yn,[e(`span`,bn,r(t.$t(`producer.name.soundStrength`)),1),i(m,{content:t.$t(`producer.description.soundStrength`)},null,8,[`content`])]),e(`span`,xn,r(t.soundStrength??.7),1)]),i(_,{modelValue:t.soundStrength,"onUpdate:modelValue":n[3]||=e=>t.soundStrength=e,min:.2,max:1,step:.01},null,8,[`modelValue`])]),t.config?.custom&&!t.config?.instrumental?(g(),o(`div`,Sn,[e(`div`,Cn,[e(`div`,wn,[e(`span`,Tn,r(t.$t(`producer.name.lyricsStrength`)),1),i(m,{content:t.$t(`producer.description.lyricsStrength`)},null,8,[`content`])]),e(`span`,En,r(t.lyricsStrength??.7),1)]),i(_,{modelValue:t.lyricsStrength,"onUpdate:modelValue":n[4]||=e=>t.lyricsStrength=e,min:0,max:1,step:.01},null,8,[`modelValue`])])):a(``,!0),e(`div`,Dn,[e(`div`,On,[e(`span`,kn,r(t.$t(`producer.name.seed`)),1),i(m,{content:t.$t(`producer.description.seed`)},null,8,[`content`])]),i(v,{modelValue:t.seed,"onUpdate:modelValue":n[5]||=e=>t.seed=e,min:0,controls:!1,size:`small`,placeholder:t.$t(`producer.placeholder.seed`),class:`w-full`},null,8,[`modelValue`,`placeholder`])])]),_:1},8,[`title`])]),_:1},8,[`modelValue`])}var jn=K(an,[[`render`,An],[`__scopeId`,`data-v-f9296888`]]),Mn=v({name:`ReplaceSectionInput`,components:{ElInputNumber:F,ElImage:X,InfoIcon:Q},computed:{audio(){return this.$store.state.producer?.config?.audio},replaceSectionStart:{get(){return this.$store.state.producer?.config?.replace_section_start},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,replace_section_start:e})}},replaceSectionEnd:{get(){return this.$store.state.producer?.config?.replace_section_end},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,replace_section_end:e})}}},methods:{onClick(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`})}}}),Nn={class:`field`},Pn={class:`flex items-center mb-2`},Fn={class:`text-sm font-bold m-0`},In={key:0,class:`task mb-2`},Ln={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Rn={class:`info flex-1 min-w-0`},zn={class:`text-sm font-bold m-0 truncate`},Bn={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Vn={class:`flex gap-2`};function Hn(t,n,s,c,d,f){let p=l(`info-icon`),h=l(`el-image`),_=l(`el-input-number`),v=m(`loading`);return g(),o(`div`,Nn,[e(`div`,Pn,[e(`h2`,Fn,r(t.$t(`producer.name.replaceSection`)),1),i(p,{content:t.$t(`producer.description.replaceSection`)},null,8,[`content`])]),t.audio?(g(),o(`div`,In,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[u((g(),o(`div`,Ln,[i(h,{src:t.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!t.audio?.audio_url]]),e(`div`,Rn,[e(`h2`,zn,r(t.audio?.title),1),e(`p`,Bn,r(t.audio?.style),1)])])])):a(``,!0),e(`div`,Vn,[i(_,{modelValue:t.replaceSectionStart,"onUpdate:modelValue":n[1]||=e=>t.replaceSectionStart=e,class:`flex-1`,min:0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`producer.placeholder.replaceSectionStart`)},null,8,[`modelValue`,`max`,`placeholder`]),i(_,{modelValue:t.replaceSectionEnd,"onUpdate:modelValue":n[2]||=e=>t.replaceSectionEnd=e,class:`flex-1`,min:t.replaceSectionStart||0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`producer.placeholder.replaceSectionEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Un=v({name:`PresetPanel`,components:{CleanupIcon:ne,MagicIcon:W,TypeSelector:Ue,PromptInput:nt,LyricInput:lt,StyleInput:gt,TitleInput:St,ExtendFromInput:Lt,CoverFromInput:Zt,UploadAudio:$e,VocalGenderSelector:rn,AdvancedParams:jn,ReplaceSectionInput:K(Mn,[[`render`,Hn]]),ElButton:G,ElTabs:S,ElTabPane:C,Consumption:be},emits:[`generate`],computed:{config(){return this.$store.state.producer?.config},mode:{get(){return this.$store.state.producer?.config?.custom?`custom`:`simple`},set(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,custom:e===`custom`})}},consumption(){return me(this.config,this.service?.cost)},service(){return this.$store.state.producer?.service},generateButtonText(){let e=this.config?.action;return e===`extend`||e===`upload_extend`?this.$t(`producer.button.extend`):e===`cover`||e===`upload_cover`?this.$t(`producer.button.cover_music`):e===`variation`?this.$t(`producer.button.variation`):e===`replace_section`?this.$t(`producer.button.replace_section`):e===`stems`?this.$t(`producer.button.get_stems`):e===`swap_vocals`?this.$t(`producer.button.swap_vocals`):e===`swap_instrumentals`?this.$t(`producer.button.swap_instrumentals`):this.$t(`producer.button.generate`)}},methods:{onGenerate(){this.$emit(`generate`)},onClearAll(){this.$store.commit(`producer/setConfig`,{custom:this.$store.state.producer?.config?.custom||!1,instrumental:!1,prompt:``,lyric:``,style:``,title:``,model:this.$store.state.producer?.config?.model})}}}),Wn={class:`flex flex-col h-full`},Gn={class:`flex-1 min-h-0 overflow-hidden`},Kn={class:`p-5`},qn={class:`p-5`},Jn={class:`flex flex-col items-center justify-center px-5 pb-5 gap-2`},Yn={class:`flex gap-2 w-full`};function Xn(t,s,c,u,d,m){let h=l(`type-selector`),_=l(`upload-audio`),v=l(`prompt-input`),y=l(`extend-from-input`),b=l(`cover-from-input`),x=l(`replace-section-input`),S=l(`advanced-params`),C=l(`el-tab-pane`),w=l(`lyric-input`),T=l(`style-input`),E=l(`title-input`),D=l(`vocal-gender-selector`),O=l(`el-tabs`),k=l(`consumption`),A=l(`cleanup-icon`),j=l(`el-button`),M=l(`magic-icon`);return g(),o(`div`,Wn,[e(`div`,Gn,[i(O,{modelValue:t.mode,"onUpdate:modelValue":s[0]||=e=>t.mode=e,class:`producer-mode-tabs`,stretch:``},{default:p(()=>[i(C,{label:t.$t(`producer.mode.simple`),name:`simple`},{default:p(()=>[e(`div`,Kn,[i(h,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),t.config?.action===`extend`?(g(),f(y,{key:0,class:`mb-4`})):a(``,!0),t.config?.action===`cover`?(g(),f(b,{key:1,class:`mb-4`})):a(``,!0),t.config?.action===`replace_section`?(g(),f(x,{key:2,class:`mb-4`})):a(``,!0),i(S,{class:`mb-4`})])]),_:1},8,[`label`]),i(C,{label:t.$t(`producer.mode.custom`),name:`custom`},{default:p(()=>[e(`div`,qn,[i(h,{class:`mb-4`}),i(_,{class:`mb-4`}),t.config?.instrumental?a(``,!0):(g(),f(w,{key:0,class:`mb-4`})),i(T,{class:`mb-4`}),i(E,{class:`mb-4`}),t.config?.instrumental?a(``,!0):(g(),f(D,{key:1,class:`mb-4`})),t.config?.action===`extend`?(g(),f(y,{key:2,class:`mb-4`})):a(``,!0),t.config?.action===`cover`?(g(),f(b,{key:3,class:`mb-4`})):a(``,!0),t.config?.action===`replace_section`?(g(),f(x,{key:4,class:`mb-4`})):a(``,!0),i(S,{class:`mb-4`})])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),e(`div`,Jn,[i(k,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),e(`div`,Yn,[i(j,{class:`flex-1`,onClick:t.onClearAll},{default:p(()=>[i(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.$t(`producer.button.clear_all`)),1)]),_:1},8,[`onClick`]),i(j,{type:`primary`,class:`flex-1`,round:``,onClick:t.onGenerate},{default:p(()=>[i(M,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(t.generateButtonText),1)]),_:1},8,[`onClick`])])])])}var Zn=K(Un,[[`render`,Xn],[`__scopeId`,`data-v-acdfec88`]]),Qn=re(),$n=v({name:`TaskPreview`,components:{CodeIcon:ae,DownloadIcon:oe,MoreIcon:se,ElImage:X,ElIcon:y,ElTooltip:T,VideoPlay:H,VideoPause:V,ElDropdown:P,ElDropdownMenu:N,ElDropdownItem:M,Loading:le,ApiCodeDialog:xe},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,apiCodeVisible:!1,apiCodePath:`/producer/audios`,apiCodeBody:{}}},computed:{loading(){return this.$store.state.producer?.status?.getApplications===J.Request},showViewCode(){return _e()},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},task(){return this.$store.state.producer?.tasks},audios(){let e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(e=>({...e,action:t})):e},application(){return this.$store.state.producer?.application},active(){return this.$store.state.producer?.tasks?.active}},methods:{useFormatDuring:z,onViewCode(){let e=this.modelValue?.request||{},t={};Object.entries(e).forEach(([e,n])=>{e===`application_id`||e===`callback_url`||n!=null&&(typeof n==`string`&&n===``||Array.isArray(n)&&n.length===0||(t[e]=n))}),this.apiCodeBody=t,this.apiCodePath=`/producer/audios`,this.apiCodeVisible=!0},onPlay(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`producer/setAudio`,{...this.$store.state.producer.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.producer?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e?.stopPropagation(),console.debug(`set config`,t),this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:t.model,custom:!0,instrumental:!1,style:t.style,action:`extend`,audio:t,audio_id:t.id,continue_at:t.duration})},onDownload(e,t){e&&e?.stopPropagation();let n=new URL(t).pathname,r=n.substring(n.lastIndexOf(`/`)+1);fetch(t).then(e=>e.blob()).then(e=>{(0,Qn.saveAs)(e,r)})},async handleVideoDownload(e){if(e.video_url){this.onDownload(null,e.video_url);return}if(!this.isFetchingVideoUrl)try{this.isFetchingVideoUrl=!0;let t=await this.fetchVideoUrlFromApi(e?.id);console.log(`get videoUrl: ${t}`),e.video_url=t,this.onDownload(null,t)}catch(e){console.error(`get videoUrl failed:`,e),Y.error(this.$t(`producer.message.getVideoUrlFailed`))}finally{this.isFetchingVideoUrl=!1}},async fetchVideoUrlFromApi(e){return new Promise((t,n)=>{let r={audio_id:e},i=this.credential?.token;if(!i){console.error(`no token specified`),n(Error(`No token specified`));return}q.video(r,{token:i}).then(e=>{let r=e.data?.data?.video_url;r?t(r):n(Error(`Video URL not found in response`))}).catch(e=>{n(e)})})},onPreview(e,t){e?.stopPropagation(),window.open(t,`_blank`)},async onGetStems(e){await this.onGenerateAudioUrl(`stems`,e)},onCover(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`cover`,audio:e,audio_id:e.id})},onVariation(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e.model,custom:!0,style:e.style,action:`variation`,audio:e,audio_id:e.id})},async onSwapVocals(e){await this.onGenerateAudioUrl(`swap_vocals`,e)},async onSwapInstrumentals(e){await this.onGenerateAudioUrl(`swap_instrumentals`,e)},async onGetAllStems(e){await this.onGenerateAudioUrl(`all_stems`,e)},onReplaceSection(e){this.$store.commit(`producer/setConfig`,{...this.$store.state.producer?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`replace_section`,audio:e,audio_id:e.id,replace_section_start:0,replace_section_end:Math.min(30,e.duration||30)})},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;let t=this.credential?.token;if(t)try{this.isFetchingWav=!0,Y.info(this.$t(`producer.message.fetchingWav`));let n=(await q.wav({audio_id:e.id},{token:t})).data?.data,r=Array.isArray(n)?n[0]?.file_url:n?.file_url||n?.audio_url;r?this.onDownload(null,r):Y.error(this.$t(`producer.message.fetchWavFailed`))}catch{Y.error(this.$t(`producer.message.fetchWavFailed`))}finally{this.isFetchingWav=!1}},async onGenerateAudioUrl(e,t){let n={action:e,audio_id:t,async:!0},r=this.credential?.token;if(!r){console.error(`no token specified`);return}Y.info(this.$t(`producer.message.startingTask`)),q.audio(n,{token:r}).then(()=>{Y.success(this.$t(`producer.message.startTaskSuccess`))}).catch(e=>{Y.error(e?.response?.data?.error?.message||this.$t(`producer.message.startTaskFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},async onScrollDown(){setTimeout(()=>{let e=document.querySelector(`.tasks`);e&&(e.scrollTop=e.scrollHeight)},1e3)},async onGetTasks(){if(this.loading){console.debug(`loading`);return}await this.$store.dispatch(`producer/getTasks`,{limit:30,offset:0})}}}),er={class:`task`},tr=[`onClick`],nr={class:`left`},rr=[`aria-label`,`title`,`onClick`,`onKeydown`],ir=[`aria-label`,`title`,`onClick`,`onKeydown`],ar={key:2,class:`duration`},or={class:`info`},sr={class:`title`},cr={class:`style`},lr={class:`right`},ur={class:`el-dropdown-link`},dr={class:`flex items-center min-w-[120px]`},fr={class:`flex items-center min-w-[120px]`},pr={class:`el-dropdown-link`};function mr(d,_,v,y,b,x){let S=l(`el-image`),C=l(`video-pause`),w=l(`el-icon`),T=l(`video-play`),E=l(`download-icon`),D=l(`el-tooltip`),O=l(`Loading`),k=l(`el-dropdown-item`),A=l(`el-dropdown-menu`),j=l(`el-dropdown`),M=l(`more-icon`),N=l(`code-icon`),P=l(`api-code-dialog`),F=m(`loading`);return g(),o(`div`,er,[(g(!0),o(c,null,h(d.audios,c=>(g(),o(`div`,{key:c.id,class:`audio`,onClick:t(e=>d.onClick(c),[`stop`])},[u((g(),o(`div`,nr,[i(S,{src:c?.image_url,class:`cover`,fit:`cover`,lazy:``},null,8,[`src`]),c?.audio_url&&d.$store.state?.producer?.audio?.id===c.id&&d.$store.state?.producer?.audio?.state===`playing`?(g(),o(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":d.$t(`common.player.pause`),title:d.$t(`common.player.pause`),onClick:t(e=>d.onPause(c),[`stop`]),onKeydown:[s(t(e=>d.onPause(c),[`stop`,`prevent`]),[`enter`]),s(t(e=>d.onPause(c),[`stop`,`prevent`]),[`space`])]},[i(w,null,{default:p(()=>[i(C,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,rr)):a(``,!0),c?.audio_url&&(d.$store.state?.producer?.audio?.id!==c.id||d.$store.state?.producer?.audio?.id===c.id&&d.$store.state?.producer?.audio?.state===`paused`)?(g(),o(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":d.$t(`common.player.play`),title:d.$t(`common.player.play`),onClick:t(e=>d.onPlay(c),[`stop`]),onKeydown:[s(t(e=>d.onPlay(c),[`stop`,`prevent`]),[`enter`]),s(t(e=>d.onPlay(c),[`stop`,`prevent`]),[`space`])]},[i(w,null,{default:p(()=>[i(T,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,ir)):a(``,!0),c?.duration?(g(),o(`div`,ar,r(d.useFormatDuring(c?.duration)),1)):a(``,!0)])),[[F,!c?.audio_url]]),e(`div`,or,[e(`h2`,sr,r(c?.title),1),e(`p`,cr,r(c?.style),1)]),e(`div`,lr,[i(j,null,{dropdown:p(()=>[i(A,null,{default:p(()=>[i(k,{disabled:d.isFetchingVideoUrl,onClick:e=>d.handleVideoDownload(c)},{default:p(()=>[e(`div`,dr,[d.isFetchingVideoUrl?(g(),f(w,{key:0,class:`is-loading mr-2`},{default:p(()=>[i(O,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})):a(``,!0),e(`span`,null,r(d.$t(`producer.button.download_video`)),1)])]),_:1},8,[`disabled`,`onClick`]),c?.audio_url?(g(),f(k,{key:0,onClick:t(e=>d.onDownload(e,c?.audio_url),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.download_audio`)),1)]),_:1},8,[`onClick`])):a(``,!0),i(k,{disabled:d.isFetchingWav,onClick:e=>d.handleWavDownload(c)},{default:p(()=>[e(`div`,fr,[d.isFetchingWav?(g(),f(w,{key:0,class:`is-loading mr-2`},{default:p(()=>[i(O,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})):a(``,!0),e(`span`,null,r(d.$t(`producer.button.download_wav`)),1)])]),_:1},8,[`disabled`,`onClick`])]),_:2},1024)]),default:p(()=>[e(`span`,ur,[i(D,{effect:`dark`,content:d.$t(`producer.button.download`),placement:`top`},{default:p(()=>[c?.audio_url||c?.video_url?(g(),f(E,{key:0,class:`icon icon-download`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):a(``,!0)]),_:2},1032,[`content`])])]),_:2},1024),i(j,null,{dropdown:p(()=>[i(A,null,{default:p(()=>[c?.audio_url?(g(),f(k,{key:0,onClick:t(e=>d.onExtend(e,c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.extend`)),1)]),_:1},8,[`onClick`])):a(``,!0),c.id?(g(),f(k,{key:1,onClick:t(e=>d.onGetStems(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.get_stems`)),1)]),_:1},8,[`onClick`])):a(``,!0),c.id?(g(),f(k,{key:2,onClick:t(e=>d.onGetAllStems(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.all_stems`)),1)]),_:1},8,[`onClick`])):a(``,!0),i(k,{onClick:t(e=>d.onCover(c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.cover_music`)),1)]),_:1},8,[`onClick`]),c?.id?(g(),f(k,{key:3,onClick:t(e=>d.onVariation(c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.variation`)),1)]),_:1},8,[`onClick`])):a(``,!0),c?.id?(g(),f(k,{key:4,onClick:t(e=>d.onSwapVocals(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.swap_vocals`)),1)]),_:1},8,[`onClick`])):a(``,!0),c?.id?(g(),f(k,{key:5,onClick:t(e=>d.onSwapInstrumentals(c.id),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.swap_instrumentals`)),1)]),_:1},8,[`onClick`])):a(``,!0),c?.id?(g(),f(k,{key:6,onClick:t(e=>d.onReplaceSection(c),[`stop`])},{default:p(()=>[n(r(d.$t(`producer.button.replace_section`)),1)]),_:1},8,[`onClick`])):a(``,!0),d.showViewCode?(g(),f(k,{key:7,onClick:t(d.onViewCode,[`stop`])},{default:p(()=>[i(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(d.$t(`common.button.viewCode`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:2},1024)]),default:p(()=>[e(`span`,pr,[i(D,{effect:`dark`,content:d.$t(`producer.button.more`),placement:`top`},{default:p(()=>[c?.audio_url||c?.video_url?(g(),f(M,{key:0,class:`icon icon-ellipsis`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):a(``,!0)]),_:2},1032,[`content`])])]),_:2},1024)])],8,tr))),128)),i(P,{visible:d.apiCodeVisible,"onUpdate:visible":_[0]||=e=>d.apiCodeVisible=e,method:`POST`,path:d.apiCodePath,body:d.apiCodeBody,token:d.$store.state.producer?.credential?.token||``},null,8,[`visible`,`path`,`body`,`token`])])}var $=v({name:`RecentPanel`,components:{ElSkeletonItem:ee,ElSkeleton:I,TaskPreview:K($n,[[`render`,mr]]),Player:ie,NoTasks:Ce,ScrollList:Se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.producer?.tasks,items:this.$store.state.producer?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),hr={key:0,class:`tasks`},gr={class:`left w-[70px] p-[10px] flex items-center`},_r={class:`main w-[calc(100%-70px)] flex-1 p-[10px]`},vr={key:2,class:`w-full flex-1 flex items-center justify-center`},yr={class:`h-20`};function br(t,n,r,s,d,m){let v=l(`el-skeleton-item`),y=l(`el-skeleton`),b=l(`task-preview`),x=l(`scroll-list`),S=l(`no-tasks`),C=l(`player`);return g(),o(c,null,[t.tasks?.items===void 0?(g(),o(`div`,hr,[(g(),o(c,null,h(3,t=>e(`div`,{key:t,class:`flex`},[e(`div`,gr,[i(y,{animated:``},{template:p(()=>[i(v,{variant:`image`,class:`avatar w-[50px] h-[50px]`})]),_:1})]),e(`div`,_r,[i(y,{animated:``},{template:p(()=>[i(v,{variant:`p`,class:`w-[200px] h-[15px] mb-[5px] mt-[10px]`}),i(v,{variant:`text`})]),_:1})])])),64))])):t.tasks?.items?.length&&t.tasks?.items?.length>0?(g(),f(x,{key:1,ref:`scrollList`,class:`flex-1 w-full overflow-y-auto tasks p-2`,loading:t.loading,onReachTop:n[0]||=e=>t.$emit(`reach-top`)},{default:p(()=>[(g(!0),o(c,null,h(t.tasks?.items,(e,t)=>(g(),f(b,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),t.tasks?.items?.length===0?(g(),o(`div`,vr,[i(S)])):a(``,!0),u(e(`div`,yr,[i(C,{namespace:`producer`})],512),[[_,!!t.$store?.state?.producer?.audio?.object]])],64)}var xr=K($,[[`render`,br]]),Sr=v({name:`TaskPreview`,components:{IconPicture:ce,ElImage:X,ElAvatar:E,ElIcon:y},computed:{audio(){return this.$store.state.producer?.audio}}}),Cr={key:0,class:`size-full overflow-hidden`},wr={class:`relative h-[300px]`},Tr={class:`flex items-center justify-center size-full bg-[var(--el-bg-color)]`},Er={class:`absolute bottom-0 left-0 right-0 m-0 p-4 text-white z-10 bg-gradient-to-t from-black/70 to-transparent`},Dr={class:`p-4`},Or={class:`flex items-center font-bold mb-2`},kr={class:`text-[var(--el-text-color-regular)] mb-2`},Ar={class:`text-xs text-[var(--el-text-color-regular)]`},jr={class:`mt-4 text-sm leading-[25px] whitespace-pre-wrap`},Mr={key:1,class:`w-full h-full`};function Nr(t,n,a,s,c,u){let d=l(`icon-picture`),f=l(`el-icon`),m=l(`el-image`),h=l(`el-avatar`);return t.audio?.object?(g(),o(`div`,Cr,[e(`div`,wr,[i(m,{src:t.audio.image_url,fit:`cover`,class:`size-full`},{error:p(()=>[e(`div`,Tr,[i(f,{class:`text-3xl`},{default:p(()=>[i(d,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})])]),_:1},8,[`src`]),e(`h2`,Er,r(t.audio?.title),1)]),e(`div`,Dr,[e(`div`,Or,[i(h,{size:30,src:t.audio?.image_url,class:`mr-2`},null,8,[`src`]),e(`span`,null,r(t.audio?.title),1)]),e(`p`,kr,r(t.audio?.style),1),e(`p`,Ar,r(t.$dayjs.format(t.audio?.created_at)),1),e(`div`,jr,[e(`p`,null,r(t.audio?.lyric),1)])])])):(g(),o(`div`,Mr))}var Pr=v({name:`ProducerIndex`,components:{Layout:je,ConfigPanel:Zn,RecentPanel:xr,PreviewPanel:K(Sr,[[`render`,Nr]])},mixins:[pe],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.producer?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.producer?.status?.getTasks===J.Request||this.fetchingTasks},service(){return this.$store.state.producer.service},credential(){return this.$store.state.producer.credential},config(){return this.$store.state.producer.config},initializing(){return this.$store.state.producer.status.getApplications===J.Request},needApply(){return this.$store.state.producer.status.getApplications===J.Success&&!this.application},application(){return this.$store.state.producer.application},tasks(){return this.$store.state.producer.tasks},applications(){return this.$store.state.producer.applications}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await we({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(`producer/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplications`),await this.$store.dispatch(`producer/getApplications`),console.debug(`end onGetApplications`),await this.onGetTasks()},onApply(){ve.create({application:this.application}).then(({data:e})=>{this.application=e,Y.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&Y.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`producer/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){if(!ye(this.uploadTracker,e=>this.$t(e),e=>Y.warning(e)))return;let e={...this.config,async:!0};if(!de())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}Y.info(this.$t(`producer.message.startingTask`)),he(`producer`,q.audio(e,{token:t})).then(()=>{Y.success(this.$t(`producer.message.startTaskSuccess`))}).catch(e=>{Y.error(e?.response?.data?.error?.message||this.$t(`producer.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Fr(e,t,n,r,a,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`preview-panel`),d=l(`layout`);return g(),f(d,null,{config:p(()=>[i(s,{onGenerate:e.onGenerateAudio},null,8,[`onGenerate`])]),result:p(()=>[i(c,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),preview:p(()=>[i(u)]),_:1})}var Ir=K(Pr,[[`render`,Fr],[`__scopeId`,`data-v-23eb99dc`]]);export{Ir 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-D-_BwBwU.js";import{t as x}from"./upload-EpkcT4jm.js";import{t as S}from"./tooltip-IRIdGmNi.js";import{t as C}from"./alert-j_3nRV8t.js";import{t as w}from"./drawer-BTC1LQDm.js";import{t as T}from"./input-number-D24l-83c.js";import{n as E}from"./taskDrawerMixin-MzTeZOH4.js";import{t as D}from"./box-B0JfZlg1.js";import{t as O}from"./clock-Ca9_jDRB.js";import{t as k}from"./CopyToClipboard-AcQvl8FS.js";import{t as A}from"./hash-CdlI_Ed6.js";import{t as j}from"./image-VeW9WxnM.js";import{t as M}from"./info-rBg3OCYW.js";import{t as N}from"./PromptTextarea-rvPInlyG.js";import{t as P}from"./triangle-alert-D3Ot9kW8.js";import{t as F}from"./upload-Bhad_P8Q.js";import{t as I}from"./wand-sparkles-B88S1Wmy.js";import{t as ee}from"./zap-CFMYbZi2.js";import{Cn as te,En as L,Sn as ne,Tn as re,_n as R,bn as z,gn as B,mn as V,pn as ie,vn as H,xn as U,yn as W}from"./constants-CqjLASsC.js";import{$t as ae,Ai as G,Bt as oe,Cn as se,E as K,Ht as ce,Vt as le,Wt as ue,ei as q,gi as J,hi as de,mr as fe,ri as pe,zt as me}from"./index-CtzrR21L.js";import{t as Y}from"./ImagePreview-B0Hz5h5I.js";import{t as he}from"./Consumption-CFz0VGfl.js";import{a as X,n as ge,r as _e,t as ve}from"./pagination-z1yeQEg3.js";import{t as ye}from"./ApiCodeButton-Dn8hNsX4.js";import{t as be}from"./BotPlaceholder-BrZxheK1.js";import{t as xe}from"./ImageWrapper-BAwtx9Eo.js";var Se=_({name:`LayoutSeedream`,components:{MagicIcon:I,ElDrawer:w,ElButton:G},mixins:[E]}),Ce={class:`main flex flex-row flex-1`},we={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)]`},Te={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ee(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,Ce,[e(`div`,we,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Te,[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 De=K(Se,[[`render`,Ee],[`__scopeId`,`data-v-c10167d0`]]),Oe=_({name:`SeedreamPromptInput`,components:{PromptTextarea:N},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 ke(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 Ae=K(Oe,[[`render`,ke]]),je={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 Z(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 W:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case H:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case R:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case B:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:V[B],outputFormat:!1,tools:!1};case U:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:V[U],outputFormat:!1,tools:!1};default:return je}}function Q(e,t){let n=Z(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Me=[`1K`,`2K`,`3K`,`4K`];function Ne(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Z(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();(Me.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 Pe(e,t,n){let r={...e},i=Z(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 Fe=_({name:`SeedreamImageInput`,components:{UploadIcon:F,ElUpload:x,ElButton:G,InfoIcon:X,ImagePreview:Y},mixins:[ce,oe],data(){return{fileList:[],uploadUrl:pe()+`/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 Z(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(){J.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){J.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()}}}),Ie={key:0},Le={class:`field`},Re={class:`label`},ze={class:`box`},Be={class:`title font-bold`},Ve={class:`value`},He={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ue(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`,Ie,[e(`div`,Le,[e(`div`,Re,[e(`div`,ze,[e(`h2`,Be,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ve,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,He,[(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 We=K(Fe,[[`render`,Ue],[`__scopeId`,`data-v-ac071e59`]]),Ge=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},data(){return{revertKey:0,options:[{value:z,label:this.$t(`seedream.model.seedream50pro`)},{value:W,label:this.$t(`seedream.model.seedream50`)},{value:H,label:this.$t(`seedream.model.seedream45`)},{value:R,label:this.$t(`seedream.model.seedream40`)},{value:B,label:this.$t(`seedream.model.seedream30t2i`)},{value:U,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(ie)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Ne(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await de.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=Pe({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),J.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})}}}),Ke={class:`field`},qe={class:`label`},Je={class:`box`},Ye={class:`title font-bold`};function Xe(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Ke,[e(`div`,qe,[e(`div`,Je,[e(`h2`,Ye,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 Ze=K(Ge,[[`render`,Xe],[`__scopeId`,`data-v-6413c179`]]),Qe=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:X},data(){return{SEEDREAM_SIZE_ADAPTIVE:re,pixelOptions:te}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Z(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)}}}}),$e={class:`field`},et={class:`label`},tt={class:`box`},nt={class:`title font-bold`};function rt(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`,$e,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,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 it=K(Qe,[[`render`,rt],[`__scopeId`,`data-v-dd7bd021`]]),at=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:T,InfoIcon:X},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Z(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)}}}),ot={key:0,class:`field`},st={class:`label`},ct={class:`box`},lt={class:`title font-bold`},ut={class:`value`};function dt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,ot,[e(`div`,st,[e(`div`,ct,[e(`h2`,lt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ut,[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 ft=K(at,[[`render`,dt],[`__scopeId`,`data-v-f079fd20`]]),pt=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},data(){return{options:[...ne]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Z(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)}}}}),mt={key:0,class:`field`},ht={class:`label`},gt={class:`box`},_t={class:`title font-bold`};function vt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,mt,[e(`div`,ht,[e(`div`,gt,[e(`h2`,_t,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 yt=K(pt,[[`render`,vt],[`__scopeId`,`data-v-69ea4c07`]]),bt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:T,InfoIcon:X},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Z(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)}}}}),xt={key:0,class:`field`},St={class:`label`},Ct={class:`box`},wt={class:`title font-bold`},Tt={class:`value`};function Et(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,xt,[e(`div`,St,[e(`div`,Ct,[e(`h2`,wt,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Tt,[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 Dt=K(bt,[[`render`,Et],[`__scopeId`,`data-v-10cdc1e0`]]),Ot=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:T,InfoIcon:X},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Z(this.config?.model).guidanceScale},defaultValue(){return Z(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)}}}}),kt={key:0,class:`field`},At={class:`label`},jt={class:`box`},Mt={class:`title font-bold`},Nt={class:`value`};function Pt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,kt,[e(`div`,At,[e(`div`,jt,[e(`h2`,Mt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Nt,[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 Ft=K(Ot,[[`render`,Pt],[`__scopeId`,`data-v-7386f064`]]),$=e=>{let t={...e||{}},n=Q(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}},It=_({name:`SeedreamConfigPanel`,components:{MagicIcon:I,ElButton:G,PromptInput:Ae,Consumption:he,ImageInput:We,ModelSelector:Ze,SizeSelector:it,MaxImagesSelector:ft,OutputFormatSelector:yt,SeedInput:Dt,GuidanceScaleInput:Ft},emits:[`generate`],computed:{action(){return Q(this.config?.model,this.config?.image)},capabilities(){return Z(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=$(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return ue({...e,action:this.action,model:L(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Lt={class:`flex flex-col h-full`},Rt={class:`flex-1 overflow-y-auto p-5`},zt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Bt(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`,Lt,[e(`div`,Rt,[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`,zt,[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 Vt=K(It,[[`render`,Bt]]),Ht=_({name:`SeedreamTaskPreview`,components:{ApplicationIcon:D,ChannelIcon:A,ImageIcon:j,InfoIcon:M,LightningIcon:ee,MagicIcon:I,TimeIcon:O,WarningIcon:P,CopyToClipboard:k,ElAlert:C,ImageWrapper:xe,ElButton:G,ElTooltip:S,ImagePreview:Y,ApiCodeButton:ye},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return $(this.modelValue?.request)},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return L(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Ut={class:`preview`},Wt={class:`left`},Gt={class:`main`},Kt={class:`bot`},qt={class:`datetime`},Jt={class:`info`},Yt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Xt={key:1,class:`prompt mt-2`},Zt={key:0},Qt={key:0,class:n({content:!0})},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},en={key:1,class:n({content:!0,failed:!0})},tn={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},nn={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},rn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-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-2`},gn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},_n={key:3,class:n({content:!0})},vn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(u,d,g,_,v,y){let b=l(`capability-presentation`),x=l(`image-preview`),S=l(`time-icon`),C=l(`magic-icon`),w=l(`copy-to-clipboard`),T=l(`el-alert`),E=l(`image-wrapper`),D=l(`el-button`),O=l(`el-tooltip`),k=l(`api-code-button`),A=l(`application-icon`),j=l(`image-icon`),M=l(`lightning-icon`),N=l(`channel-icon`),P=l(`warning-icon`),F=l(`info-icon`);return h(),s(`div`,Ut,[e(`div`,Wt,[a(b,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,Gt,[e(`div`,Kt,[a(b,{capability:`seedream`,part:`name`}),e(`span`,qt,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Jt,[Array.isArray(u.modelValue?.request?.image)&&u.modelValue?.request?.image.length>0?(h(),s(`div`,Yt,[(h(!0),s(c,null,m(u.modelValue?.request?.image,(e,t)=>(h(),f(x,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(h(),s(`p`,Xt,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(h(),s(`span`,Zt,` - (`+i(u.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),u.modelValue?.response?u.modelValue?.response?.success===!0?(h(),s(`div`,en,[e(`div`,tn,[(h(!0),s(c,null,m(u.images,(e,t)=>(h(),f(E,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,nn,[a(O,{class:`box-item`,effect:`dark`,content:u.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(D,{type:`info`,size:`small`,class:`btn-action`,onClick:d[0]||=t(e=>u.onEdit(u.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(u.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(k,{path:`/seedream/images`,body:u.apiRequest},null,8,[`body`])]),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,rn,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,an,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,on,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,sn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(h(),s(`p`,cn,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):u.modelValue?.response?.success===!1?(h(),s(`div`,{key:2,class:n({content:!0,"mt-[15px]":!u.modelValue?.request?.prompt})},[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failure`)),1)]),default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,un,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,dn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,fn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,pn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.error?.message?(h(),s(`p`,mn,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(w,{content:u.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),u.modelValue?.elapsed?(h(),s(`p`,hn,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,gn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})],2)):(h(),s(`div`,_n,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,vn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Qt,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,$t,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var xn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:K(Ht,[[`render`,bn],[`__scopeId`,`data-v-9c8af4df`]]),BotPlaceholder:be,NoTasks:_e,ScrollList:ge},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?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(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`,Sn,[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`,Cn,[a(v)])):o(``,!0)],64)}var Tn=_({name:`SeedreamIndex`,components:{ConfigPanel:Vt,Layout:De,RecentPanel:K(xn,[[`render`,wn]])},mixins:[le],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===q.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ve({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(!me(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;if(Z(this.config?.model).imageRequired&&!this.config?.image?.length){J.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=$(this.config);if(!ae())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}J.info(this.$t(`seedream.message.startingTask`)),fe(`seedream`,se.generate(e,{token:t})).then(()=>{J.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?J.error(this.$t(`seedream.message.usedUp`)):J.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 En(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 Dn=K(Tn,[[`render`,En]]);export{Dn 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-CV_KF_4N.js";import{t as x}from"./upload-b94DR2Pd.js";import{t as S}from"./tooltip-1QTlF6Ah.js";import{t as C}from"./alert-kWYCkGuI.js";import{t as w}from"./drawer-By2wmxmu.js";import{t as T}from"./input-number-CbkzwR1k.js";import{n as E}from"./taskDrawerMixin-BUGIlU_B.js";import{t as D}from"./box-BO5U0zzd.js";import{t as O}from"./clock-LeiGWIqv.js";import{t as k}from"./CopyToClipboard-DpNIys5b.js";import{t as A}from"./hash-95R5zuIr.js";import{t as j}from"./image-v_elL0Bz.js";import{t as M}from"./info-CerFhjgW.js";import{t as N}from"./PromptTextarea-B5aTi1HH.js";import{t as P}from"./triangle-alert-C4AHPI71.js";import{t as F}from"./upload-Ce_XQUOt.js";import{t as I}from"./wand-sparkles-Cr-DqJ72.js";import{t as ee}from"./zap-CSCOqmfz.js";import{Cn as te,En as L,Sn as ne,Tn as re,_n as R,bn as z,gn as B,mn as V,pn as ie,vn as H,xn as U,yn as W}from"./constants-CqjLASsC.js";import{$t as ae,Ai as G,Bt as oe,Cn as se,E as K,Ht as ce,Vt as le,Wt as ue,ei as q,gi as J,hi as de,mr as fe,ri as pe,zt as me}from"./index-L5CfS5rK.js";import{t as Y}from"./ImagePreview-BupumqtT.js";import{t as he}from"./Consumption-BBcKgILA.js";import{a as X,n as ge,r as _e,t as ve}from"./pagination-bzT3Edaj.js";import{t as ye}from"./ApiCodeButton-CVS8YvAm.js";import{t as be}from"./BotPlaceholder-C7sd9thm.js";import{t as xe}from"./ImageWrapper-Djbynfsa.js";var Se=_({name:`LayoutSeedream`,components:{MagicIcon:I,ElDrawer:w,ElButton:G},mixins:[E]}),Ce={class:`main flex flex-row flex-1`},we={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)]`},Te={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ee(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,Ce,[e(`div`,we,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Te,[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 De=K(Se,[[`render`,Ee],[`__scopeId`,`data-v-c10167d0`]]),Oe=_({name:`SeedreamPromptInput`,components:{PromptTextarea:N},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 ke(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 Ae=K(Oe,[[`render`,ke]]),je={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 Z(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 W:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case H:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case R:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case B:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:V[B],outputFormat:!1,tools:!1};case U:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:V[U],outputFormat:!1,tools:!1};default:return je}}function Q(e,t){let n=Z(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Me=[`1K`,`2K`,`3K`,`4K`];function Ne(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Z(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();(Me.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 Pe(e,t,n){let r={...e},i=Z(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 Fe=_({name:`SeedreamImageInput`,components:{UploadIcon:F,ElUpload:x,ElButton:G,InfoIcon:X,ImagePreview:Y},mixins:[ce,oe],data(){return{fileList:[],uploadUrl:pe()+`/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 Z(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(){J.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){J.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()}}}),Ie={key:0},Le={class:`field`},Re={class:`label`},ze={class:`box`},Be={class:`title font-bold`},Ve={class:`value`},He={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ue(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`,Ie,[e(`div`,Le,[e(`div`,Re,[e(`div`,ze,[e(`h2`,Be,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ve,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,He,[(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 We=K(Fe,[[`render`,Ue],[`__scopeId`,`data-v-ac071e59`]]),Ge=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},data(){return{revertKey:0,options:[{value:z,label:this.$t(`seedream.model.seedream50pro`)},{value:W,label:this.$t(`seedream.model.seedream50`)},{value:H,label:this.$t(`seedream.model.seedream45`)},{value:R,label:this.$t(`seedream.model.seedream40`)},{value:B,label:this.$t(`seedream.model.seedream30t2i`)},{value:U,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(ie)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Ne(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await de.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=Pe({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),J.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})}}}),Ke={class:`field`},qe={class:`label`},Je={class:`box`},Ye={class:`title font-bold`};function Xe(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Ke,[e(`div`,qe,[e(`div`,Je,[e(`h2`,Ye,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 Ze=K(Ge,[[`render`,Xe],[`__scopeId`,`data-v-6413c179`]]),Qe=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:X},data(){return{SEEDREAM_SIZE_ADAPTIVE:re,pixelOptions:te}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Z(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)}}}}),$e={class:`field`},et={class:`label`},tt={class:`box`},nt={class:`title font-bold`};function rt(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`,$e,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,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 it=K(Qe,[[`render`,rt],[`__scopeId`,`data-v-dd7bd021`]]),at=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:T,InfoIcon:X},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Z(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)}}}),ot={key:0,class:`field`},st={class:`label`},ct={class:`box`},lt={class:`title font-bold`},ut={class:`value`};function dt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,ot,[e(`div`,st,[e(`div`,ct,[e(`h2`,lt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ut,[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 ft=K(at,[[`render`,dt],[`__scopeId`,`data-v-f079fd20`]]),pt=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:X},data(){return{options:[...ne]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Z(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)}}}}),mt={key:0,class:`field`},ht={class:`label`},gt={class:`box`},_t={class:`title font-bold`};function vt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,mt,[e(`div`,ht,[e(`div`,gt,[e(`h2`,_t,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 yt=K(pt,[[`render`,vt],[`__scopeId`,`data-v-69ea4c07`]]),bt=_({name:`SeedreamSeedInput`,components:{ElInputNumber:T,InfoIcon:X},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Z(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)}}}}),xt={key:0,class:`field`},St={class:`label`},Ct={class:`box`},wt={class:`title font-bold`},Tt={class:`value`};function Et(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,xt,[e(`div`,St,[e(`div`,Ct,[e(`h2`,wt,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Tt,[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 Dt=K(bt,[[`render`,Et],[`__scopeId`,`data-v-10cdc1e0`]]),Ot=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:T,InfoIcon:X},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Z(this.config?.model).guidanceScale},defaultValue(){return Z(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)}}}}),kt={key:0,class:`field`},At={class:`label`},jt={class:`box`},Mt={class:`title font-bold`},Nt={class:`value`};function Pt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,kt,[e(`div`,At,[e(`div`,jt,[e(`h2`,Mt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Nt,[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 Ft=K(Ot,[[`render`,Pt],[`__scopeId`,`data-v-7386f064`]]),$=e=>{let t={...e||{}},n=Q(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}},It=_({name:`SeedreamConfigPanel`,components:{MagicIcon:I,ElButton:G,PromptInput:Ae,Consumption:he,ImageInput:We,ModelSelector:Ze,SizeSelector:it,MaxImagesSelector:ft,OutputFormatSelector:yt,SeedInput:Dt,GuidanceScaleInput:Ft},emits:[`generate`],computed:{action(){return Q(this.config?.model,this.config?.image)},capabilities(){return Z(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=$(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return ue({...e,action:this.action,model:L(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Lt={class:`flex flex-col h-full`},Rt={class:`flex-1 overflow-y-auto p-5`},zt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Bt(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`,Lt,[e(`div`,Rt,[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`,zt,[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 Vt=K(It,[[`render`,Bt]]),Ht=_({name:`SeedreamTaskPreview`,components:{ApplicationIcon:D,ChannelIcon:A,ImageIcon:j,InfoIcon:M,LightningIcon:ee,MagicIcon:I,TimeIcon:O,WarningIcon:P,CopyToClipboard:k,ElAlert:C,ImageWrapper:xe,ElButton:G,ElTooltip:S,ImagePreview:Y,ApiCodeButton:ye},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return $(this.modelValue?.request)},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{shortModel(e){return L(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Ut={class:`preview`},Wt={class:`left`},Gt={class:`main`},Kt={class:`bot`},qt={class:`datetime`},Jt={class:`info`},Yt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Xt={key:1,class:`prompt mt-2`},Zt={key:0},Qt={key:0,class:n({content:!0})},$t={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},en={key:1,class:n({content:!0,failed:!0})},tn={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},nn={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},rn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},an={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-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-2`},gn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},_n={key:3,class:n({content:!0})},vn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(u,d,g,_,v,y){let b=l(`capability-presentation`),x=l(`image-preview`),S=l(`time-icon`),C=l(`magic-icon`),w=l(`copy-to-clipboard`),T=l(`el-alert`),E=l(`image-wrapper`),D=l(`el-button`),O=l(`el-tooltip`),k=l(`api-code-button`),A=l(`application-icon`),j=l(`image-icon`),M=l(`lightning-icon`),N=l(`channel-icon`),P=l(`warning-icon`),F=l(`info-icon`);return h(),s(`div`,Ut,[e(`div`,Wt,[a(b,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,Gt,[e(`div`,Kt,[a(b,{capability:`seedream`,part:`name`}),e(`span`,qt,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Jt,[Array.isArray(u.modelValue?.request?.image)&&u.modelValue?.request?.image.length>0?(h(),s(`div`,Yt,[(h(!0),s(c,null,m(u.modelValue?.request?.image,(e,t)=>(h(),f(x,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(h(),s(`p`,Xt,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(h(),s(`span`,Zt,` - (`+i(u.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),u.modelValue?.response?u.modelValue?.response?.success===!0?(h(),s(`div`,en,[e(`div`,tn,[(h(!0),s(c,null,m(u.images,(e,t)=>(h(),f(E,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,nn,[a(O,{class:`box-item`,effect:`dark`,content:u.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(D,{type:`info`,size:`small`,class:`btn-action`,onClick:d[0]||=t(e=>u.onEdit(u.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(u.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(k,{path:`/seedream/images`,body:u.apiRequest},null,8,[`body`])]),a(T,{closable:!1,class:`mt-2 success`},{default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,rn,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,an,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,on,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,sn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(h(),s(`p`,cn,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):u.modelValue?.response?.success===!1?(h(),s(`div`,{key:2,class:n({content:!0,"mt-[15px]":!u.modelValue?.request?.prompt})},[a(T,{closable:!1,class:`failure`},{template:p(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failure`)),1)]),default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,un,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,dn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,fn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,pn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.error?.message?(h(),s(`p`,mn,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(w,{content:u.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),u.modelValue?.elapsed?(h(),s(`p`,hn,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,gn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})],2)):(h(),s(`div`,_n,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,vn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(w,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Qt,[a(T,{closable:!1,class:`info`},{template:p(()=>[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,$t,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(w,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var xn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:K(Ht,[[`render`,bn],[`__scopeId`,`data-v-9c8af4df`]]),BotPlaceholder:be,NoTasks:_e,ScrollList:ge},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?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(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`,Sn,[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`,Cn,[a(v)])):o(``,!0)],64)}var Tn=_({name:`SeedreamIndex`,components:{ConfigPanel:Vt,Layout:De,RecentPanel:K(xn,[[`render`,wn]])},mixins:[le],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===q.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ve({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(!me(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;if(Z(this.config?.model).imageRequired&&!this.config?.image?.length){J.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=$(this.config);if(!ae())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}J.info(this.$t(`seedream.message.startingTask`)),fe(`seedream`,se.generate(e,{token:t})).then(()=>{J.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?J.error(this.$t(`seedream.message.usedUp`)):J.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 En(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 Dn=K(Tn,[[`render`,En]]);export{Dn 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,S as c,T as l,at as u,ht as d,it as f,j as p,mt as m,qt as h,rt as g,tt as _,x as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{r as b,t as x}from"./select-D-_BwBwU.js";import{t as S}from"./upload-EpkcT4jm.js";import{t as C}from"./tooltip-IRIdGmNi.js";import{t as w}from"./alert-j_3nRV8t.js";import{t as T}from"./drawer-BTC1LQDm.js";import{n as E}from"./taskDrawerMixin-MzTeZOH4.js";import{t as D}from"./box-B0JfZlg1.js";import{t as O}from"./clock-Ca9_jDRB.js";import{t as k}from"./CopyToClipboard-AcQvl8FS.js";import{t as A}from"./external-link-DIzvxE5E.js";import{t as j}from"./hash-CdlI_Ed6.js";import{t as M}from"./image-VeW9WxnM.js";import{t as N}from"./info-rBg3OCYW.js";import{t as P}from"./PromptTextarea-rvPInlyG.js";import{t as F}from"./triangle-alert-D3Ot9kW8.js";import{t as I}from"./upload-Bhad_P8Q.js";import{t as L}from"./wand-sparkles-B88S1Wmy.js";import{t as ee}from"./zap-CFMYbZi2.js";import{Gn as R,Kn as z,Un as B,Vn as te,Wn as ne}from"./constants-CqjLASsC.js";import{$t as re,Ai as V,Bt as H,E as U,Ht as W,Tn as G,Vt as K,Wt as q,ei as J,gi as Y,mr as X,ri as ie,zt as ae}from"./index-CtzrR21L.js";import{t as Z}from"./ImagePreview-B0Hz5h5I.js";import{t as oe}from"./Consumption-CFz0VGfl.js";import{a as Q,n as se,r as ce,t as le}from"./pagination-z1yeQEg3.js";import{t as ue}from"./ApiCodeButton-Dn8hNsX4.js";import{t as de}from"./BotPlaceholder-BrZxheK1.js";import{t as fe}from"./ImageWrapper-BAwtx9Eo.js";var pe=y({name:`LayoutNanobanana`,components:{MagicIcon:L,ElDrawer:T,ElButton:V},mixins:[E]}),me={class:`main flex flex-row flex-1`},he={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)]`},ge={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function _e(t,n,r,i,o,c){let l=u(`magic-icon`),p=u(`el-button`),h=u(`el-drawer`);return _(),s(`div`,me,[e(`div`,he,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,ge,[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`]),[[v,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:m(()=>[f(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ve=U(pe,[[`render`,_e],[`__scopeId`,`data-v-6419fc74`]]),ye=y({name:`PromptInput`,components:{PromptTextarea:P},computed:{prompt:{get(){return this.$store.state.nanobanana?.config?.prompt},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,prompt:e})}}},mounted(){this.prompt||=``}});function be(e,t,n,r,i,a){let o=u(`prompt-textarea`);return _(),p(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`nanobanana.name.prompt`),info:e.$t(`nanobanana.description.prompt`),placeholder:e.$t(`nanobanana.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var xe=U(ye,[[`render`,be]]),Se=y({name:`ImageUrlsInput`,components:{UploadIcon:I,ElUpload:S,ElButton:V,InfoIcon:Q,ImagePreview:Z},mixins:[W,H],data(){return{fileList:[],uploadUrl:ie()+`/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.nanobanana?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},mounted(){},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.onSetImageUrls()},onExceed(){Y.warning(this.$t(`nanobanana.message.uploadImageExceed`))},onError(){Y.error(this.$t(`nanobanana.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,image_urls:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImageUrls()},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.onSetImageUrls()}}}),Ce={class:`field mb-[10px] flex items-center justify-between`},we={class:`title m-0 text-[14px] font-bold`},Te={class:`upload-wrapper flex flex-col items-start gap-[8px]`},Ee={class:`controls flex items-center`},De={class:`file-list flex flex-wrap gap-[10px]`};function Oe(t,n,o,c,d,f){let h=u(`upload-icon`),v=u(`el-button`),y=u(`el-upload`),b=u(`info-icon`),x=u(`image-preview`);return _(),s(l,null,[e(`div`,Ce,[e(`h2`,we,i(t.$t(`nanobanana.name.imageUrls`)),1),e(`div`,Te,[e(`div`,Ee,[a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value`,limit:5,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:m(()=>[a(v,{size:`small`,type:`primary`,round:``},{default:m(()=>[a(h,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`nanobanana.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`]),a(b,{content:t.$t(`nanobanana.description.imageUrls`)},null,8,[`content`])])])]),e(`div`,De,[(_(!0),s(l,null,g(t.fileList,(e,n)=>(_(),p(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])],64)}var ke=U(Se,[[`render`,Oe]]),Ae=y({name:`AspectRatioSelector`,components:{InfoIcon:Q},data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`3:2`,label:`3:2`,width:27,height:18},{value:`2:3`,label:`2:3`,width:18,height:27},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25},{value:`4:3`,label:`4:3`,width:24,height:18},{value:`3:4`,label:`3:4`,width:18,height:24}]}},computed:{value(){return this.$store.state.nanobanana?.config?.aspect_ratio}},methods:{onSelect(e){let t=this.value===e?void 0:e,n={...this.$store.state.nanobanana?.config||{}};t?n.aspect_ratio=t:delete n.aspect_ratio,this.$store.commit(`nanobanana/setConfig`,n)}}}),je={class:`ratio`},Me={class:`header`},Ne={class:`title font-bold`},Pe=[`aria-label`],Fe=[`aria-checked`,`aria-label`,`onClick`,`onKeydown`],Ie={class:`preview`},Le={class:`name`};function Re(r,o,d,f,p,m){let v=u(`info-icon`);return _(),s(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(r.$t(`nanobanana.name.aspectRatio`)),1),a(v,{content:r.$t(`nanobanana.description.aspectRatio`),class:`ml-1`},null,8,[`content`])]),e(`div`,{class:`items`,role:`radiogroup`,"aria-label":r.$t(`nanobanana.name.aspectRatio`)},[(_(!0),s(l,null,g(r.options,a=>(_(),s(`div`,{key:a.value,class:n([`item`,{active:r.value===a.value}]),role:`radio`,"aria-checked":r.value===a.value,"aria-label":a.label,tabindex:`0`,onClick:e=>r.onSelect(a.value),onKeydown:[c(t(e=>r.onSelect(a.value),[`prevent`]),[`enter`]),c(t(e=>r.onSelect(a.value),[`prevent`]),[`space`])]},[e(`div`,Ie,[e(`div`,{class:`rect`,style:h({width:a.width+`px`,height:a.height+`px`})},null,4)]),e(`p`,Le,i(a.label),1)],42,Fe))),128))],8,Pe)])}var ze=U(Ae,[[`render`,Re],[`__scopeId`,`data-v-7131eb97`]]),Be=y({name:`NanobananaModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:Q},data(){return{options:[{value:B,label:this.$t(`nanobanana.model.nanoBanana`)},{value:R,label:R},{value:z,label:this.$t(`nanobanana.model.nanoBananaPro`)},{value:ne,label:this.$t(`nanobanana.model.nanoBanana2`)}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.model},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,model:e})}},modelDescription(){return this.$t(`nanobanana.description.model`)}},mounted(){this.value||=te}}),Ve={class:`field`},He={class:`label`},Ue={class:`box`},We={class:`title font-bold`};function Ge(t,n,r,o,c,d){let f=u(`info-icon`),h=u(`el-option`),v=u(`el-select`);return _(),s(`div`,Ve,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`nanobanana.name.model`)),1),a(f,{content:t.modelDescription,class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`nanobanana.placeholder.select`)},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ke=U(Be,[[`render`,Ge],[`__scopeId`,`data-v-11cb675b`]]),qe=y({name:`NanobananaResolutionSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:Q},data(){return{cachedResolution:`1K`,options:[{value:`1K`,label:`1K`},{value:`2K`,label:`2K`},{value:`4K`,label:`4K`}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.resolution},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:e})}},supportsResolution(){let e=this.$store.state.nanobanana?.config?.model;return e===`nano-banana-2`||e===`nano-banana-pro`}},watch:{value(e){this.supportsResolution&&e&&(this.cachedResolution=e)},supportsResolution(e){e?this.value||=this.cachedResolution||`1K`:(this.value&&(this.cachedResolution=this.value),this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:void 0}))}},mounted(){this.supportsResolution&&!this.value&&(this.value=`1K`),!this.supportsResolution&&this.value&&(this.cachedResolution=this.value,this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:void 0}))}}),Je={class:`field`},Ye={class:`label`},Xe={class:`box`},Ze={class:`title font-bold`};function Qe(t,n,r,o,c,d){let f=u(`info-icon`),h=u(`el-option`),v=u(`el-select`);return _(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`nanobanana.name.resolution`)),1),a(f,{content:t.$t(`nanobanana.description.resolutionProOnly`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`nanobanana.placeholder.select`),disabled:!t.supportsResolution},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])])}var $e=y({name:`ConfigPanel`,components:{MagicIcon:L,ElButton:V,PromptInput:xe,Consumption:oe,ImageUrlsInput:ke,AspectRatioSelector:ze,ModelSelector:Ke,ResolutionSelector:U(qe,[[`render`,Qe],[`__scopeId`,`data-v-7ab9d4d4`]])},emits:[`generate`],computed:{config(){return this.$store.state.nanobanana?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;return q({...e,action:t?`edit`:`generate`},this.service?.cost)},service(){return this.$store.state.nanobanana?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),et={class:`flex flex-col h-full`},tt={class:`flex-1 overflow-y-auto p-5`},nt={class:`flex flex-col items-center justify-center px-5 pb-5`};function rt(t,n,o,c,l,d){let f=u(`model-selector`),p=u(`resolution-selector`),h=u(`prompt-input`),g=u(`aspect-ratio-selector`),v=u(`image-urls-input`),y=u(`consumption`),b=u(`magic-icon`),x=u(`el-button`);return _(),s(`div`,et,[e(`div`,tt,[a(f,{class:`mb-4`}),a(p,{class:`mb-4`}),a(h,{class:`mb-4`}),a(g,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,nt,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:m(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`nanobanana.button.generate`)),1)]),_:1},8,[`onClick`])])])}var it=U($e,[[`render`,rt]]),at=y({name:`TaskPreview`,components:{ApplicationIcon:D,ChannelIcon:j,ExternalLinkIcon:A,ImageIcon:M,InfoIcon:N,LightningIcon:ee,MagicIcon:L,TimeIcon:O,WarningIcon:F,CopyToClipboard:k,ElAlert:w,ImageWrapper:fe,ElButton:V,ElTooltip:C,ImagePreview:Z,ApiCodeButton:ue},props:{modelValue:{type:Object,required:!0}},computed:{images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e},hasImages(){return this.images.some(e=>!!e?.image_url)},showResult(){let e=this.modelValue?.response;return e?e.success===!0?!0:this.hasImages&&e.success!==!1:!1}},methods:{onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.nanobanana?.config||{}};delete t.action,t.image_urls=[e],this.$store.commit(`nanobanana/setConfig`,t)}}}),ot={class:`preview`},st={class:`left`},ct={class:`main`},lt={class:`bot`},ut={class:`datetime`},dt={class:`info`},ft={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},pt={key:1,class:`prompt mt-2`},mt={key:0},ht={key:0,class:n({content:!0,failed:!0})},gt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},_t={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},vt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},St={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},wt={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Tt={key:1,class:n({content:!0})},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:2,class:n({content:!0})},Pt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Rt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function zt(n,c,d,f,h,v){let y=u(`capability-presentation`),b=u(`image-preview`),x=u(`image-wrapper`),S=u(`el-button`),C=u(`el-tooltip`),w=u(`api-code-button`),T=u(`application-icon`),E=u(`image-icon`),D=u(`external-link-icon`),O=u(`lightning-icon`),k=u(`magic-icon`),A=u(`copy-to-clipboard`),j=u(`time-icon`),M=u(`channel-icon`),N=u(`el-alert`),P=u(`warning-icon`),F=u(`info-icon`);return _(),s(`div`,ot,[e(`div`,st,[a(y,{capability:`nanobanana`,part:`avatar`,class:`avatar`})]),e(`div`,ct,[e(`div`,lt,[a(y,{capability:`nanobanana`,part:`name`}),e(`span`,ut,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,dt,[n.modelValue?.request?.image_urls&&n.modelValue?.request?.image_urls.length>0?(_(),s(`div`,ft,[(_(!0),s(l,null,g(n.modelValue?.request?.image_urls,(e,t)=>(_(),p(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(_(),s(`p`,pt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(_(),s(`span`,mt,` - (`+i(n.$t(`nanobanana.status.pending`))+`) `,1))])):o(``,!0)]),n.showResult?(_(),s(`div`,ht,[e(`div`,gt,[(_(!0),s(l,null,g(n.images,(e,t)=>(_(),p(x,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,_t,[a(C,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:m(()=>[a(S,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:m(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(w,{path:`/nano-banana/images`,body:n.modelValue?.request},null,8,[`body`])]),a(N,{closable:!1,class:`mt-2 success`},{default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,vt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,yt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,bt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,xt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,St,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(_(),s(`p`,Ct,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(_(),s(`p`,wt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(A,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(_(),s(`div`,Tt,[a(N,{closable:!1,class:`failure`},{template:m(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.failure`)),1)]),default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,Et,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,Dt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,Ot,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,kt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,At,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,jt,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(A,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(_(),s(`p`,Mt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(_(),s(`p`,Nt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(A,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?(_(),s(`div`,$,[a(N,{closable:!1,class:`info`},{template:m(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.failure`)),1)]),default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,Pt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,Ft,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,It,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,Lt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,Rt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var Bt=y({name:`RecentPanel`,components:{TaskPreview:U(at,[[`render`,zt],[`__scopeId`,`data-v-5b586f20`]]),BotPlaceholder:de,NoTasks:ce,ScrollList:se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.nanobanana?.tasks,items:this.$store.state.nanobanana?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Vt={key:0},Ht={key:2,class:`w-full h-full flex items-center justify-center`};function Ut(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),h=u(`scroll-list`),v=u(`no-tasks`);return _(),s(l,null,[e.tasks?.items===void 0?(_(),s(`div`,Vt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(_(),p(h,{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(()=>[(_(!0),s(l,null,g(e.tasks?.items,e=>(_(),p(f,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(_(),s(`div`,Ht,[a(v)])):o(``,!0)],64)}var Wt=y({name:`NanobananaIndex`,components:{ConfigPanel:it,Layout:ve,RecentPanel:U(Bt,[[`render`,Ut]])},mixins:[K],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.nanobanana?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.nanobanana?.status?.getTasks===J.Request},credential(){return this.$store.state.nanobanana?.credential},config(){return this.$store.state.nanobanana?.config},application(){return this.$store.state.nanobanana?.application},tasks(){return this.$store.state.nanobanana?.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 le({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(`nanobanana/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`nanobanana/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(`nanobanana/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ae(this.uploadTracker,e=>this.$t(e),e=>Y.warning(e)))return;let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;delete e.action,!t&&`image_urls`in e&&delete e.image_urls,e?.aspect_ratio||delete e.aspect_ratio;let n=e?.model===`nano-banana-2`||e?.model===`nano-banana-pro`;!n&&`resolution`in e&&delete e.resolution,n&&!e?.resolution&&(e.resolution=`1K`);let r={...e,action:t?`edit`:`generate`,async:!0};if(!re())return;let i=this.credential?.token;if(!i){console.error(`no token specified`);return}Y.info(this.$t(`nanobanana.message.startingTask`)),X(`nanobanana`,G.generate(r,{token:i})).then(()=>{Y.success(this.$t(`nanobanana.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?Y.error(this.$t(`nanobanana.message.usedUp`)):Y.error(this.$t(`nanobanana.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Gt(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return _(),p(l,null,{config:m(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Kt=U(Wt,[[`render`,Gt]]);export{Kt as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,S as c,T as l,at as u,ht as d,it as f,j as p,mt as m,qt as h,rt as g,tt as _,x as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{r as b,t as x}from"./select-CV_KF_4N.js";import{t as S}from"./upload-b94DR2Pd.js";import{t as C}from"./tooltip-1QTlF6Ah.js";import{t as w}from"./alert-kWYCkGuI.js";import{t as T}from"./drawer-By2wmxmu.js";import{n as E}from"./taskDrawerMixin-BUGIlU_B.js";import{t as D}from"./box-BO5U0zzd.js";import{t as O}from"./clock-LeiGWIqv.js";import{t as k}from"./CopyToClipboard-DpNIys5b.js";import{t as A}from"./external-link-D19owA5u.js";import{t as j}from"./hash-95R5zuIr.js";import{t as M}from"./image-v_elL0Bz.js";import{t as N}from"./info-CerFhjgW.js";import{t as P}from"./PromptTextarea-B5aTi1HH.js";import{t as F}from"./triangle-alert-C4AHPI71.js";import{t as I}from"./upload-Ce_XQUOt.js";import{t as L}from"./wand-sparkles-Cr-DqJ72.js";import{t as ee}from"./zap-CSCOqmfz.js";import{Gn as R,Kn as z,Un as B,Vn as te,Wn as ne}from"./constants-CqjLASsC.js";import{$t as re,Ai as V,Bt as H,E as U,Ht as W,Tn as G,Vt as K,Wt as q,ei as J,gi as Y,mr as X,ri as ie,zt as ae}from"./index-L5CfS5rK.js";import{t as Z}from"./ImagePreview-BupumqtT.js";import{t as oe}from"./Consumption-BBcKgILA.js";import{a as Q,n as se,r as ce,t as le}from"./pagination-bzT3Edaj.js";import{t as ue}from"./ApiCodeButton-CVS8YvAm.js";import{t as de}from"./BotPlaceholder-C7sd9thm.js";import{t as fe}from"./ImageWrapper-Djbynfsa.js";var pe=y({name:`LayoutNanobanana`,components:{MagicIcon:L,ElDrawer:T,ElButton:V},mixins:[E]}),me={class:`main flex flex-row flex-1`},he={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)]`},ge={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function _e(t,n,r,i,o,c){let l=u(`magic-icon`),p=u(`el-button`),h=u(`el-drawer`);return _(),s(`div`,me,[e(`div`,he,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,ge,[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`]),[[v,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:m(()=>[f(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var ve=U(pe,[[`render`,_e],[`__scopeId`,`data-v-6419fc74`]]),ye=y({name:`PromptInput`,components:{PromptTextarea:P},computed:{prompt:{get(){return this.$store.state.nanobanana?.config?.prompt},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,prompt:e})}}},mounted(){this.prompt||=``}});function be(e,t,n,r,i,a){let o=u(`prompt-textarea`);return _(),p(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`nanobanana.name.prompt`),info:e.$t(`nanobanana.description.prompt`),placeholder:e.$t(`nanobanana.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var xe=U(ye,[[`render`,be]]),Se=y({name:`ImageUrlsInput`,components:{UploadIcon:I,ElUpload:S,ElButton:V,InfoIcon:Q,ImagePreview:Z},mixins:[W,H],data(){return{fileList:[],uploadUrl:ie()+`/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.nanobanana?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},mounted(){},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.onSetImageUrls()},onExceed(){Y.warning(this.$t(`nanobanana.message.uploadImageExceed`))},onError(){Y.error(this.$t(`nanobanana.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,image_urls:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImageUrls()},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.onSetImageUrls()}}}),Ce={class:`field mb-[10px] flex items-center justify-between`},we={class:`title m-0 text-[14px] font-bold`},Te={class:`upload-wrapper flex flex-col items-start gap-[8px]`},Ee={class:`controls flex items-center`},De={class:`file-list flex flex-wrap gap-[10px]`};function Oe(t,n,o,c,d,f){let h=u(`upload-icon`),v=u(`el-button`),y=u(`el-upload`),b=u(`info-icon`),x=u(`image-preview`);return _(),s(l,null,[e(`div`,Ce,[e(`h2`,we,i(t.$t(`nanobanana.name.imageUrls`)),1),e(`div`,Te,[e(`div`,Ee,[a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value`,limit:5,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:m(()=>[a(v,{size:`small`,type:`primary`,round:``},{default:m(()=>[a(h,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`nanobanana.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`]),a(b,{content:t.$t(`nanobanana.description.imageUrls`)},null,8,[`content`])])])]),e(`div`,De,[(_(!0),s(l,null,g(t.fileList,(e,n)=>(_(),p(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])],64)}var ke=U(Se,[[`render`,Oe]]),Ae=y({name:`AspectRatioSelector`,components:{InfoIcon:Q},data(){return{options:[{value:`1:1`,label:`1:1`,width:20,height:20},{value:`3:2`,label:`3:2`,width:27,height:18},{value:`2:3`,label:`2:3`,width:18,height:27},{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25},{value:`4:3`,label:`4:3`,width:24,height:18},{value:`3:4`,label:`3:4`,width:18,height:24}]}},computed:{value(){return this.$store.state.nanobanana?.config?.aspect_ratio}},methods:{onSelect(e){let t=this.value===e?void 0:e,n={...this.$store.state.nanobanana?.config||{}};t?n.aspect_ratio=t:delete n.aspect_ratio,this.$store.commit(`nanobanana/setConfig`,n)}}}),je={class:`ratio`},Me={class:`header`},Ne={class:`title font-bold`},Pe=[`aria-label`],Fe=[`aria-checked`,`aria-label`,`onClick`,`onKeydown`],Ie={class:`preview`},Le={class:`name`};function Re(r,o,d,f,p,m){let v=u(`info-icon`);return _(),s(`div`,je,[e(`div`,Me,[e(`h2`,Ne,i(r.$t(`nanobanana.name.aspectRatio`)),1),a(v,{content:r.$t(`nanobanana.description.aspectRatio`),class:`ml-1`},null,8,[`content`])]),e(`div`,{class:`items`,role:`radiogroup`,"aria-label":r.$t(`nanobanana.name.aspectRatio`)},[(_(!0),s(l,null,g(r.options,a=>(_(),s(`div`,{key:a.value,class:n([`item`,{active:r.value===a.value}]),role:`radio`,"aria-checked":r.value===a.value,"aria-label":a.label,tabindex:`0`,onClick:e=>r.onSelect(a.value),onKeydown:[c(t(e=>r.onSelect(a.value),[`prevent`]),[`enter`]),c(t(e=>r.onSelect(a.value),[`prevent`]),[`space`])]},[e(`div`,Ie,[e(`div`,{class:`rect`,style:h({width:a.width+`px`,height:a.height+`px`})},null,4)]),e(`p`,Le,i(a.label),1)],42,Fe))),128))],8,Pe)])}var ze=U(Ae,[[`render`,Re],[`__scopeId`,`data-v-7131eb97`]]),Be=y({name:`NanobananaModelSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:Q},data(){return{options:[{value:B,label:this.$t(`nanobanana.model.nanoBanana`)},{value:R,label:R},{value:z,label:this.$t(`nanobanana.model.nanoBananaPro`)},{value:ne,label:this.$t(`nanobanana.model.nanoBanana2`)}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.model},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,model:e})}},modelDescription(){return this.$t(`nanobanana.description.model`)}},mounted(){this.value||=te}}),Ve={class:`field`},He={class:`label`},Ue={class:`box`},We={class:`title font-bold`};function Ge(t,n,r,o,c,d){let f=u(`info-icon`),h=u(`el-option`),v=u(`el-select`);return _(),s(`div`,Ve,[e(`div`,He,[e(`div`,Ue,[e(`h2`,We,i(t.$t(`nanobanana.name.model`)),1),a(f,{content:t.modelDescription,class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`nanobanana.placeholder.select`)},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ke=U(Be,[[`render`,Ge],[`__scopeId`,`data-v-11cb675b`]]),qe=y({name:`NanobananaResolutionSelector`,components:{ElSelect:b,ElOption:x,InfoIcon:Q},data(){return{cachedResolution:`1K`,options:[{value:`1K`,label:`1K`},{value:`2K`,label:`2K`},{value:`4K`,label:`4K`}]}},computed:{value:{get(){return this.$store.state.nanobanana?.config?.resolution},set(e){this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:e})}},supportsResolution(){let e=this.$store.state.nanobanana?.config?.model;return e===`nano-banana-2`||e===`nano-banana-pro`}},watch:{value(e){this.supportsResolution&&e&&(this.cachedResolution=e)},supportsResolution(e){e?this.value||=this.cachedResolution||`1K`:(this.value&&(this.cachedResolution=this.value),this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:void 0}))}},mounted(){this.supportsResolution&&!this.value&&(this.value=`1K`),!this.supportsResolution&&this.value&&(this.cachedResolution=this.value,this.$store.commit(`nanobanana/setConfig`,{...this.$store.state.nanobanana?.config,resolution:void 0}))}}),Je={class:`field`},Ye={class:`label`},Xe={class:`box`},Ze={class:`title font-bold`};function Qe(t,n,r,o,c,d){let f=u(`info-icon`),h=u(`el-option`),v=u(`el-select`);return _(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`nanobanana.name.resolution`)),1),a(f,{content:t.$t(`nanobanana.description.resolutionProOnly`),class:`info`},null,8,[`content`])])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`nanobanana.placeholder.select`),disabled:!t.supportsResolution},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(h,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])])}var $e=y({name:`ConfigPanel`,components:{MagicIcon:L,ElButton:V,PromptInput:xe,Consumption:oe,ImageUrlsInput:ke,AspectRatioSelector:ze,ModelSelector:Ke,ResolutionSelector:U(qe,[[`render`,Qe],[`__scopeId`,`data-v-7ab9d4d4`]])},emits:[`generate`],computed:{config(){return this.$store.state.nanobanana?.config},consumption(){let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;return q({...e,action:t?`edit`:`generate`},this.service?.cost)},service(){return this.$store.state.nanobanana?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),et={class:`flex flex-col h-full`},tt={class:`flex-1 overflow-y-auto p-5`},nt={class:`flex flex-col items-center justify-center px-5 pb-5`};function rt(t,n,o,c,l,d){let f=u(`model-selector`),p=u(`resolution-selector`),h=u(`prompt-input`),g=u(`aspect-ratio-selector`),v=u(`image-urls-input`),y=u(`consumption`),b=u(`magic-icon`),x=u(`el-button`);return _(),s(`div`,et,[e(`div`,tt,[a(f,{class:`mb-4`}),a(p,{class:`mb-4`}),a(h,{class:`mb-4`}),a(g,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,nt,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:m(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`nanobanana.button.generate`)),1)]),_:1},8,[`onClick`])])])}var it=U($e,[[`render`,rt]]),at=y({name:`TaskPreview`,components:{ApplicationIcon:D,ChannelIcon:j,ExternalLinkIcon:A,ImageIcon:M,InfoIcon:N,LightningIcon:ee,MagicIcon:L,TimeIcon:O,WarningIcon:F,CopyToClipboard:k,ElAlert:w,ImageWrapper:fe,ElButton:V,ElTooltip:C,ImagePreview:Z,ApiCodeButton:ue},props:{modelValue:{type:Object,required:!0}},computed:{images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e},hasImages(){return this.images.some(e=>!!e?.image_url)},showResult(){let e=this.modelValue?.response;return e?e.success===!0?!0:this.hasImages&&e.success!==!1:!1}},methods:{onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.nanobanana?.config||{}};delete t.action,t.image_urls=[e],this.$store.commit(`nanobanana/setConfig`,t)}}}),ot={class:`preview`},st={class:`left`},ct={class:`main`},lt={class:`bot`},ut={class:`datetime`},dt={class:`info`},ft={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},pt={key:1,class:`prompt mt-2`},mt={key:0},ht={key:0,class:n({content:!0,failed:!0})},gt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},_t={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},vt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},bt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},St={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},wt={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Tt={key:1,class:n({content:!0})},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Mt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:5,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:2,class:n({content:!0})},Pt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Rt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function zt(n,c,d,f,h,v){let y=u(`capability-presentation`),b=u(`image-preview`),x=u(`image-wrapper`),S=u(`el-button`),C=u(`el-tooltip`),w=u(`api-code-button`),T=u(`application-icon`),E=u(`image-icon`),D=u(`external-link-icon`),O=u(`lightning-icon`),k=u(`magic-icon`),A=u(`copy-to-clipboard`),j=u(`time-icon`),M=u(`channel-icon`),N=u(`el-alert`),P=u(`warning-icon`),F=u(`info-icon`);return _(),s(`div`,ot,[e(`div`,st,[a(y,{capability:`nanobanana`,part:`avatar`,class:`avatar`})]),e(`div`,ct,[e(`div`,lt,[a(y,{capability:`nanobanana`,part:`name`}),e(`span`,ut,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,dt,[n.modelValue?.request?.image_urls&&n.modelValue?.request?.image_urls.length>0?(_(),s(`div`,ft,[(_(!0),s(l,null,g(n.modelValue?.request?.image_urls,(e,t)=>(_(),p(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(_(),s(`p`,pt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(_(),s(`span`,mt,` - (`+i(n.$t(`nanobanana.status.pending`))+`) `,1))])):o(``,!0)]),n.showResult?(_(),s(`div`,ht,[e(`div`,gt,[(_(!0),s(l,null,g(n.images,(e,t)=>(_(),p(x,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,_t,[a(C,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:m(()=>[a(S,{type:`info`,size:`small`,class:`btn-action`,onClick:c[0]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:m(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(w,{path:`/nano-banana/images`,body:n.modelValue?.request},null,8,[`body`])]),a(N,{closable:!1,class:`mt-2 success`},{default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,vt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,yt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,bt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,xt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,St,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(_(),s(`p`,Ct,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(_(),s(`p`,wt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(A,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(_(),s(`div`,Tt,[a(N,{closable:!1,class:`failure`},{template:m(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.failure`)),1)]),default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,Et,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,Dt,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,Ot,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,kt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,At,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,jt,[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(A,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(_(),s(`p`,Mt,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(_(),s(`p`,Nt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(A,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?(_(),s(`div`,$,[a(N,{closable:!1,class:`info`},{template:m(()=>[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.failure`)),1)]),default:m(()=>[n.modelValue?.request?.model?(_(),s(`p`,Pt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(_(),s(`p`,Ft,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.resolution`))+`: `+i(n.modelValue?.request?.resolution),1)])):o(``,!0),n.modelValue?.request?.aspect_ratio?(_(),s(`p`,It,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.aspectRatio`))+`: `+i(n.modelValue?.request?.aspect_ratio),1)])):o(``,!0),n.modelValue?.request?.action?(_(),s(`p`,Lt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.task`))+`: `+i(n.modelValue?.request?.action===`generate`?n.$t(`nanobanana.name.generate`):n.$t(`nanobanana.name.edits`)),1)])):o(``,!0),e(`p`,Rt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`nanobanana.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(A,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var Bt=y({name:`RecentPanel`,components:{TaskPreview:U(at,[[`render`,zt],[`__scopeId`,`data-v-5b586f20`]]),BotPlaceholder:de,NoTasks:ce,ScrollList:se},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.nanobanana?.tasks,items:this.$store.state.nanobanana?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Vt={key:0},Ht={key:2,class:`w-full h-full flex items-center justify-center`};function Ut(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),h=u(`scroll-list`),v=u(`no-tasks`);return _(),s(l,null,[e.tasks?.items===void 0?(_(),s(`div`,Vt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(_(),p(h,{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(()=>[(_(!0),s(l,null,g(e.tasks?.items,e=>(_(),p(f,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(_(),s(`div`,Ht,[a(v)])):o(``,!0)],64)}var Wt=y({name:`NanobananaIndex`,components:{ConfigPanel:it,Layout:ve,RecentPanel:U(Bt,[[`render`,Ut]])},mixins:[K],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.nanobanana?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.nanobanana?.status?.getTasks===J.Request},credential(){return this.$store.state.nanobanana?.credential},config(){return this.$store.state.nanobanana?.config},application(){return this.$store.state.nanobanana?.application},tasks(){return this.$store.state.nanobanana?.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 le({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(`nanobanana/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`nanobanana/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(`nanobanana/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ae(this.uploadTracker,e=>this.$t(e),e=>Y.warning(e)))return;let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;delete e.action,!t&&`image_urls`in e&&delete e.image_urls,e?.aspect_ratio||delete e.aspect_ratio;let n=e?.model===`nano-banana-2`||e?.model===`nano-banana-pro`;!n&&`resolution`in e&&delete e.resolution,n&&!e?.resolution&&(e.resolution=`1K`);let r={...e,action:t?`edit`:`generate`,async:!0};if(!re())return;let i=this.credential?.token;if(!i){console.error(`no token specified`);return}Y.info(this.$t(`nanobanana.message.startingTask`)),X(`nanobanana`,G.generate(r,{token:i})).then(()=>{Y.success(this.$t(`nanobanana.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?Y.error(this.$t(`nanobanana.message.usedUp`)):Y.error(this.$t(`nanobanana.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Gt(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return _(),p(l,null,{config:m(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Kt=U(Wt,[[`render`,Gt]]);export{Kt as default};