@acedatacloud/nexior 3.356.6 → 3.356.8

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 (279) hide show
  1. package/dist/assets/{ApiCodeButton-6BQ24hBr.js → ApiCodeButton--xcpcOgv.js} +1 -1
  2. package/dist/assets/{Artifacts-DfOUIZNw.js → Artifacts-ZAl3cwOm.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-CoKe4UW4.js → AskUserQuestionCard-ChAfgIcS.js} +1 -1
  4. package/dist/assets/{Auth-BWqcW37N.js → Auth-BX27ClOD.js} +1 -1
  5. package/dist/assets/{Bare-C7UkiDM1.js → Bare-DHh8pGIa.js} +1 -1
  6. package/dist/assets/{BotPlaceholder-Cv0cpmLN.js → BotPlaceholder-BnCggcL5.js} +1 -1
  7. package/dist/assets/{BottomFooter-DexpBZjG.js → BottomFooter-Cq168rU9.js} +1 -1
  8. package/dist/assets/{BrowserPairingDialog-1grl2MG4.js → BrowserPairingDialog-BwsMYJ1i.js} +1 -1
  9. package/dist/assets/{Callback-DA6RIWas.js → Callback-Cv5KaKcj.js} +1 -1
  10. package/dist/assets/{CodeSnippet-Dx1rpfeG.js → CodeSnippet-qdxr49hm.js} +1 -1
  11. package/dist/assets/{Console-Dv7aTYxJ.js → Console-BwjACuIx.js} +1 -1
  12. package/dist/assets/{Consumption-CUCdAwJr.js → Consumption-DzYByju3.js} +1 -1
  13. package/dist/assets/{Conversation-BZzZN23A.js → Conversation-BDouo7n0.js} +1 -1
  14. package/dist/assets/{Conversation-Bhj7r6Tu.js → Conversation-CYZlj6Dx.js} +1 -1
  15. package/dist/assets/{CopyToClipboard-Bt9-bdiq.js → CopyToClipboard-DCnv3cNN.js} +1 -1
  16. package/dist/assets/{Detail-Bd9gzPbS.js → Detail-AD8HQNsQ.js} +2 -2
  17. package/dist/assets/{Extra-DxdUhw4H.js → Extra-CR7Rmhnz.js} +1 -1
  18. package/dist/assets/{FilePreview-XUDkFjsP.js → FilePreview-ogr_FlB-.js} +1 -1
  19. package/dist/assets/{Hailuo-bw-0fTpS.js → Hailuo-BIUDJq3_.js} +1 -1
  20. package/dist/assets/{History-DHRsIkJf.js → History-BWz138ry.js} +1 -1
  21. package/dist/assets/{ImagePreview-BEpyCuCR.js → ImagePreview-Dn32pgoU.js} +1 -1
  22. package/dist/assets/{ImageWrapper-CfHW59VC.js → ImageWrapper-C0qLHiFb.js} +1 -1
  23. package/dist/assets/{Index-C56WfVcK.js → Index-BB5YzjzJ.js} +1 -1
  24. package/dist/assets/{Index-wuIjdogy2.js → Index-BBBn4a5p2.js} +1 -1
  25. package/dist/assets/{Index-D-7iOsPq.js → Index-BGH8-Rsd.js} +1 -1
  26. package/dist/assets/{Index-JRTJ-kMr.js → Index-BJc-ax50.js} +1 -1
  27. package/dist/assets/{Index-D_YjSXs1.js → Index-BTQeCK3-.js} +1 -1
  28. package/dist/assets/{Index-NR9ijzqR.js → Index-BYpka-x8.js} +1 -1
  29. package/dist/assets/{Index-_XySBZcX.js → Index-BjBJXucI.js} +1 -1
  30. package/dist/assets/Index-BjKDpZyB.js +1 -0
  31. package/dist/assets/{Index-CRDrcKeh.js → Index-BuYbl17j.js} +1 -1
  32. package/dist/assets/{Index-BVzDeTwv.js → Index-C2Q4eeTD.js} +1 -1
  33. package/dist/assets/{Index-BPKLzF292.js → Index-C3tS9o7f2.js} +1 -1
  34. package/dist/assets/{Index-INpUeK0i.js → Index-C8BPLo6z.js} +1 -1
  35. package/dist/assets/{Index-CADF_O042.js → Index-C8F_HZBA2.js} +1 -1
  36. package/dist/assets/{Index-h5RiL56D.js → Index-CCH6KXUL.js} +1 -1
  37. package/dist/assets/{Index-hHV3vXY_.js → Index-CF6m0O37.js} +1 -1
  38. package/dist/assets/{Index-BpMQC9aT.css → Index-CIe21BJa.css} +1 -1
  39. package/dist/assets/{Index-BljR55k-.js → Index-CUsckSm1.js} +1 -1
  40. package/dist/assets/{Index-c1wJ62cO.js → Index-CguVjzlX.js} +1 -1
  41. package/dist/assets/{Index-B7Lswffy2.js → Index-Cmd4FWtg2.js} +1 -1
  42. package/dist/assets/{Index-Ds2kQVkw2.js → Index-CuTPTQWH2.js} +1 -1
  43. package/dist/assets/{Index-D6IKewMA.js → Index-D05YkEGH.js} +1 -1
  44. package/dist/assets/{Index-BFUydcn3.js → Index-D0RqX4MD.js} +1 -1
  45. package/dist/assets/{Index-BwihEh4H.js → Index-DGTQPdBz.js} +1 -1
  46. package/dist/assets/{Index-BvPoCBYp.js → Index-DK5Y7uGg.js} +1 -1
  47. package/dist/assets/{Index-Nl07ZHcQ.js → Index-DL3FSvg3.js} +1 -1
  48. package/dist/assets/{Index-CO088SPK.js → Index-DleyCukv.js} +1 -1
  49. package/dist/assets/{Index-BkghY_pl2.js → Index-DpCRTE2T2.js} +1 -1
  50. package/dist/assets/{Index-Bn-G1Tul.js → Index-DvFtC3Sh.js} +1 -1
  51. package/dist/assets/{Index-wbWEMTAA.js → Index-F5LHk5ct.js} +1 -1
  52. package/dist/assets/{Index-BvpwD5cJ.js → Index-MPM_MoeW.js} +1 -1
  53. package/dist/assets/{Index-BL7YnhK1.js → Index-OUhITPSA.js} +1 -1
  54. package/dist/assets/{Index-Dw4dnBJ8.js → Index-SOioziUI.js} +1 -1
  55. package/dist/assets/{Index-CfRAA9k3.js → Index-Z76DWuvb.js} +1 -1
  56. package/dist/assets/{Index-Bk3W87n9.js → Index-jQS_BCV9.js} +1 -1
  57. package/dist/assets/{Index-DYVPugeH.js → Index-pf1u2zwB.js} +1 -1
  58. package/dist/assets/{Invitees-CRoRR9_L.js → Invitees-Dy3f-YBc.js} +1 -1
  59. package/dist/assets/{List-PSPPIGZu.js → List-BTJIDby6.js} +1 -1
  60. package/dist/assets/{List-y5KotW1i.js → List-BpHIrcOJ.js} +1 -1
  61. package/dist/assets/{List-YVmTkV7l.js → List-BpvW-IXm.js} +1 -1
  62. package/dist/assets/{LocalTools-DE8DPg0B.js → LocalTools-BibY-cpZ.js} +1 -1
  63. package/dist/assets/{LocalTools-B-fJmxPf.js → LocalTools-Cj2ECU51.js} +1 -1
  64. package/dist/assets/{Logo-sFONdVoq.js → Logo-BfCVrnlG.js} +1 -1
  65. package/dist/assets/{Main-Co8CSF5F.js → Main-CLQUxT4U.js} +1 -1
  66. package/dist/assets/{Message-D42j9r4n.js → Message-B39akIev.js} +2 -2
  67. package/dist/assets/{Message-MrnJ51mA.css → Message-Bu2_JYzu.css} +1 -1
  68. package/dist/assets/{Model-CZEgpEeE.js → Model-a9esaSJ-.js} +1 -1
  69. package/dist/assets/{Navigator-B0QtF_7Y.js → Navigator-k4WCNiLu.js} +3 -3
  70. package/dist/assets/{NotFound-DsG897QA.js → NotFound-C3PX48Mu.js} +1 -1
  71. package/dist/assets/{PageHeader-CbkTb8VC.js → PageHeader-DXqSI0T1.js} +1 -1
  72. package/dist/assets/{Pay-PtdW3YJH.js → Pay-C6qJ6vsz.js} +1 -1
  73. package/dist/assets/{Player-CFksbe9W.js → Player-Cubo3E6R.js} +1 -1
  74. package/dist/assets/{Poivelle-C6izEUQu.js → Poivelle-C4zDZ_o_.js} +1 -1
  75. package/dist/assets/{RealtimeCall-EjkRbLIM.js → RealtimeCall-b4pcNjje.js} +1 -1
  76. package/dist/assets/{ReportButton-D01Y2fPF.js → ReportButton-2XluYbQl.js} +1 -1
  77. package/dist/assets/{ReportDialog-C-LvxTDU.js → ReportDialog-DKW6gg-x.js} +1 -1
  78. package/dist/assets/{ScheduledTasks-CSEUvl8u.js → ScheduledTasks-jqixsjbb.js} +1 -1
  79. package/dist/assets/{Status-BFjIX1Il.js → Status-BnoGVda7.js} +1 -1
  80. package/dist/assets/{Subscribe-CmTnt-8g.js → Subscribe-Cmngb3sA.js} +1 -1
  81. package/dist/assets/{TabSwitcher-BTkLfapK.js → TabSwitcher-CHYB2Fkz.js} +1 -1
  82. package/dist/assets/{Tts-BHZR2CK-.js → Tts-BpSftMZ4.js} +1 -1
  83. package/dist/assets/{VideoPlayer-BZ-N1fim.js → VideoPlayer-CLpASkfe.js} +1 -1
  84. package/dist/assets/{VideoPreview-B0iB1u-B.js → VideoPreview-CqaQ4Unf.js} +1 -1
  85. package/dist/assets/arrow-down-B-MxTOw8.js +1 -0
  86. package/dist/assets/{arrow-down-wide-narrow-B5kwbnvK.js → arrow-down-wide-narrow-C6okCb24.js} +1 -1
  87. package/dist/assets/arrow-left-DsdW0NfF.js +1 -0
  88. package/dist/assets/arrow-right-MlEOBLwF.js +1 -0
  89. package/dist/assets/arrow-up-CNieFyfb.js +1 -0
  90. package/dist/assets/{authorizeFlow-C5pGDUo0.js → authorizeFlow-BDEjfVuv.js} +1 -1
  91. package/dist/assets/{avatar-CGmdnfgF.js → avatar-BfkkkNIV.js} +1 -1
  92. package/dist/assets/{basic-3cxK5-jB.js → basic-CLZ8ZMdZ.js} +1 -1
  93. package/dist/assets/{book-open-C1SE6Fda.js → book-open-BMsExVqZ.js} +1 -1
  94. package/dist/assets/{box-wbHSraQR.js → box-B-0qzjXU.js} +1 -1
  95. package/dist/assets/{boxes-MVwGL0nl.js → boxes-XbII8UdZ.js} +1 -1
  96. package/dist/assets/{brain-JmXy3a5o.js → brain-D6WjRFvm.js} +1 -1
  97. package/dist/assets/{chart-no-axes-combined-DUnEKBgM.js → chart-no-axes-combined-7rLOwtUf.js} +1 -1
  98. package/dist/assets/{chat-BTCQbiu-.js → chat-3li2imdP.js} +1 -1
  99. package/dist/assets/{chat-qdQdZYe0.js → chat-BFsK656a.js} +1 -1
  100. package/dist/assets/{chat-CV6dVkzG.js → chat-BGo7NEkZ.js} +1 -1
  101. package/dist/assets/{chat-B498vI5m.js → chat-Bid87n6z.js} +1 -1
  102. package/dist/assets/{chat-UzzPgLAH.js → chat-BnJ2GaXs.js} +1 -1
  103. package/dist/assets/{chat-ClGb8aJq.js → chat-BxvP_eVZ.js} +1 -1
  104. package/dist/assets/{chat-B5nPwlDF.js → chat-C3bcTCoJ.js} +1 -1
  105. package/dist/assets/{chat-DlvXoVwl.js → chat-C5519CdM.js} +1 -1
  106. package/dist/assets/chat-C9LHIhV1.js +1 -0
  107. package/dist/assets/chat-C9zytyhM.js +1 -0
  108. package/dist/assets/{chat-3vsZBdL_.js → chat-CNMup_po.js} +1 -1
  109. package/dist/assets/{chat-DCw2iEzj.js → chat-CeKkD9QI.js} +1 -1
  110. package/dist/assets/{chat-Df_w1_S3.js → chat-DPzNLdvd.js} +1 -1
  111. package/dist/assets/{chat-W5EIWgBd.js → chat-Dj5riIQt.js} +1 -1
  112. package/dist/assets/{chat-Cd23_p1Z.js → chat-Dliu5tJI.js} +1 -1
  113. package/dist/assets/chat-HjJLlJia.js +1 -0
  114. package/dist/assets/{chat-DfnvhmDk.js → chat-VZuxrXkr.js} +1 -1
  115. package/dist/assets/{chat-dqFmGqCf.js → chat-jfpaHSVy.js} +1 -1
  116. package/dist/assets/{chat-C9FsTT2z.js → chat-sHmMso_P.js} +1 -1
  117. package/dist/assets/check-Zd3J0Iv9.js +1 -0
  118. package/dist/assets/chevron-down-X7jnJow-.js +1 -0
  119. package/dist/assets/chevron-right-CvNAh92p.js +1 -0
  120. package/dist/assets/circle-check-kRHtuX7n.js +1 -0
  121. package/dist/assets/{circle-question-mark-DprNRYIi.js → circle-question-mark-D4ryb_5n.js} +1 -1
  122. package/dist/assets/{clipboard-list-CfUN0mkD.js → clipboard-list-MX7MJViB.js} +1 -1
  123. package/dist/assets/clock-BgGjEEpa.js +1 -0
  124. package/dist/assets/code-uZEkA0pf.js +1 -0
  125. package/dist/assets/{codingBridge-Bq1VJQjC.js → codingBridge-CUwNipkw.js} +1 -1
  126. package/dist/assets/{codingBridgeNotify-DPKDONe5.js → codingBridgeNotify-tLqOpmtd.js} +2 -2
  127. package/dist/assets/{coins-b7MZemrt.js → coins-BzSj1k9w.js} +1 -1
  128. package/dist/assets/{collapse-DB5d4IGq.js → collapse-DRVXc0DX.js} +1 -1
  129. package/dist/assets/{constants-CLU-fDDu.js → constants-rUWdh_ex.js} +1 -1
  130. package/dist/assets/{copy-B2YuRywn.js → copy-DkJ7cHHe.js} +1 -1
  131. package/dist/assets/{createTaskActions-1EHlmRvE.js → createTaskActions-BngjtsON.js} +1 -1
  132. package/dist/assets/{digitalhuman-Bk2vgt7Z.js → digitalhuman-QuQI9Vkm.js} +1 -1
  133. package/dist/assets/{dollar-sign-J1NpQDbK.js → dollar-sign-D7ZyS2rV.js} +1 -1
  134. package/dist/assets/{download-BrP-rjrE.js → download-D77eKNbQ.js} +1 -1
  135. package/dist/assets/{drawer-C9nReT9E.js → drawer-C9KSXFM-.js} +1 -1
  136. package/dist/assets/{dropdown-DxoW0THn.js → dropdown-2XM6XDCt.js} +1 -1
  137. package/dist/assets/{dropdown-JbGeLDGF.js → dropdown-CNWa8zzM.js} +1 -1
  138. package/dist/assets/{ellipsis-BxO5GayN.js → ellipsis-Cli2dfhG.js} +1 -1
  139. package/dist/assets/{esm-D3CZGCn5.js → esm-2Kkdnfh_.js} +2 -2
  140. package/dist/assets/{esm-CYRbQnfT.js → esm-BBDqdMz_.js} +3 -3
  141. package/dist/assets/{esm-FDk24ya1.js → esm-BPQhlkof.js} +1 -1
  142. package/dist/assets/{esm-DBN2jeoB.js → esm-BhLCSHOo.js} +1 -1
  143. package/dist/assets/esm-DFftu6GU.js +1 -0
  144. package/dist/assets/{esm-wpoa5VdG.js → esm-DNYs3xPx.js} +1 -1
  145. package/dist/assets/{esm-z2lPt5Wp.js → esm-z9wADuEm.js} +2 -2
  146. package/dist/assets/{external-link-Kw6ZqZY1.js → external-link-BObQxl2C.js} +1 -1
  147. package/dist/assets/{eye-C9rS7I-Z.js → eye-qi3NfFmf.js} +1 -1
  148. package/dist/assets/{file-DR2IZ2Wm.js → file-kKnQ9jSP.js} +1 -1
  149. package/dist/assets/{file-output-VjU75OeS.js → file-output-CsFI_qCB.js} +1 -1
  150. package/dist/assets/{file-text-MaMLzbn-.js → file-text-DK6qfGeu.js} +1 -1
  151. package/dist/assets/{fish-C9B0rie0.js → fish-F1MzjKun.js} +1 -1
  152. package/dist/assets/{flux-PBnLpvhr.js → flux-BXoWutTA.js} +1 -1
  153. package/dist/assets/{folder-DCeDCS_I.js → folder-D1ltK9Lb.js} +1 -1
  154. package/dist/assets/gauge-DO-_Bldx.js +1 -0
  155. package/dist/assets/{globe-Bob7DrFY.js → globe-Bu_YZ328.js} +1 -1
  156. package/dist/assets/{grokvideo-BGd3X5Bt.js → grokvideo-DXdFBAJl.js} +1 -1
  157. package/dist/assets/{hailuo-UHTwVLn2.js → hailuo-DyhsQUFL.js} +1 -1
  158. package/dist/assets/{headphones-CNumdgIN.js → headphones-ChokKnYz.js} +1 -1
  159. package/dist/assets/{history-DxYlDSMb.js → history-Bo02Ft-N.js} +1 -1
  160. package/dist/assets/{house-CarM1_hC.js → house-BsXEcaTR.js} +1 -1
  161. package/dist/assets/{i18n-Cqi3MO17.js → i18n-BdTDSgeo.js} +1 -1
  162. package/dist/assets/{image-C3x2yaF9.js → image-DfORz5aE.js} +1 -1
  163. package/dist/assets/{index-BMhc9ht-.js → index-CJnITX6X.js} +4 -4
  164. package/dist/assets/{index.browser.esm-BHYfuyGM.js → index.browser.esm-B4q5doqj.js} +1 -1
  165. package/dist/assets/{index.es-CXSlnQTL.js → index.es-CbxY5vND.js} +1 -1
  166. package/dist/assets/{info-VadVQTaW.js → info-BJs8f39c.js} +1 -1
  167. package/dist/assets/{input-number-sRRzJirK.js → input-number-Boqx1FHy.js} +1 -1
  168. package/dist/assets/{key-round-Dv4f_RVa.js → key-round-CdAr_twZ.js} +1 -1
  169. package/dist/assets/{kling-B5fnqyL0.js → kling-BbM2MOpc.js} +1 -1
  170. package/dist/assets/{languages-PvIvqbtl.js → languages-Bi-QoiAn.js} +1 -1
  171. package/dist/assets/{laptop-CIXgF4F6.js → laptop-C-oaY5TJ.js} +1 -1
  172. package/dist/assets/{lightbulb-9OJOLCrN.js → lightbulb-WpvzlK9U.js} +1 -1
  173. package/dist/assets/{link-C4THpRA9.js → link-CHWonspm.js} +1 -1
  174. package/dist/assets/loader-circle-D1CHrD0L.js +1 -0
  175. package/dist/assets/{lock-DHKA2YxE.js → lock-B7Uqza32.js} +1 -1
  176. package/dist/assets/{luma-BsF4II8I.js → luma-DUAp_ZxS.js} +1 -1
  177. package/dist/assets/{maestro-D7fU16Z_.js → maestro-CmuKIqQZ.js} +1 -1
  178. package/dist/assets/{maestro-QsaFaQty.js → maestro-D50n7VPI.js} +1 -1
  179. package/dist/assets/{mail-C0hda9yQ.js → mail-BRNsagN5.js} +1 -1
  180. package/dist/assets/{message-circle-Djz2RzFP.js → message-circle-CTBYmTM-.js} +1 -1
  181. package/dist/assets/{mic-BeIuK2ip.js → mic-D4q6VsFS.js} +1 -1
  182. package/dist/assets/{midjourney-BjmF46AI.js → midjourney-DA23-R6S.js} +1 -1
  183. package/dist/assets/{mobileLocalExec-BIgxBl4Y.js → mobileLocalExec-BDMLWerI.js} +2 -2
  184. package/dist/assets/{models-BezwK8kr.js → models-C7_NW_4L.js} +1 -1
  185. package/dist/assets/{monitor-B6S-odAh.js → monitor-_NKV9vUx.js} +1 -1
  186. package/dist/assets/{mouse-pointer-2-cGRAOWQp.js → mouse-pointer-2-DfQSsoUi.js} +1 -1
  187. package/dist/assets/music-2-BkvlUrPV.js +1 -0
  188. package/dist/assets/{nanobanana-DUp6OfMA.js → nanobanana-De87DfK9.js} +1 -1
  189. package/dist/assets/{omni-DeQjdCgR.js → omni-OWJc-dpV.js} +1 -1
  190. package/dist/assets/{openaiimage-Mme4iLDJ.js → openaiimage-CFowp9RN.js} +1 -1
  191. package/dist/assets/{pagination-BJRxAoxX.js → pagination-BEYBxEzN.js} +1 -1
  192. package/dist/assets/{pagination-Z4NRITpd.js → pagination-Cu0HJ57M.js} +1 -1
  193. package/dist/assets/{pagination-B7Iq1pRa.js → pagination-D1oONdhG.js} +1 -1
  194. package/dist/assets/{palette-D4JJcvQv.js → palette-B19v7ZZy.js} +1 -1
  195. package/dist/assets/{paperclip-BfPTf2hh.js → paperclip-BBvAty6p.js} +1 -1
  196. package/dist/assets/{pause-VZaap5SC.js → pause-1oQk0pe1.js} +1 -1
  197. package/dist/assets/{pencil-DyF3kqks.js → pencil-CU26a-p3.js} +1 -1
  198. package/dist/assets/{pika-CmikXQaV.js → pika-C_3331vj.js} +1 -1
  199. package/dist/assets/{pixverse-DuvkxhSa.js → pixverse-DSu9AgEJ.js} +1 -1
  200. package/dist/assets/play-DPjxs2aY.js +1 -0
  201. package/dist/assets/{plug-BomKSL9n.js → plug-C4pYC970.js} +1 -1
  202. package/dist/assets/plus-Bceq4G9z.js +1 -0
  203. package/dist/assets/{poivelle-CFwnHV3l.js → poivelle-BQbiXRXl.js} +1 -1
  204. package/dist/assets/{popover-Cxqmc4sh.js → popover-BRCYNGHX.js} +1 -1
  205. package/dist/assets/{producer-CZVQDkbb.js → producer-JSTBStng.js} +1 -1
  206. package/dist/assets/{qrart-CbtN-s3r.js → qrart-bhzMHzb2.js} +1 -1
  207. package/dist/assets/{realtime-DRhCe8B9.js → realtime-C7tRbIQA.js} +1 -1
  208. package/dist/assets/{refresh-cw-D_W--kgj.js → refresh-cw-BF9qyGQW.js} +1 -1
  209. package/dist/assets/rotate-ccw-e-uQkgmy.js +1 -0
  210. package/dist/assets/rotate-cw-DDQxVePr.js +1 -0
  211. package/dist/assets/{row-B_jKvn5G.js → row-CuzShorK.js} +1 -1
  212. package/dist/assets/search-ZaqM39dy.js +1 -0
  213. package/dist/assets/{seedance-Ohaeyejp.js → seedance-DCofbEcI.js} +1 -1
  214. package/dist/assets/{seedream-xMZNe6qi.js → seedream-BxHaCGm8.js} +1 -1
  215. package/dist/assets/{select-BzDGa5m7.js → select-D1IfJVxx.js} +1 -1
  216. package/dist/assets/{serp-lXkWvScf.js → serp-Z0vz36H1.js} +1 -1
  217. package/dist/assets/{shield-CTZgSVw8.js → shield-Dweed8bx.js} +1 -1
  218. package/dist/assets/{shuffle-Dv9vMhpo.js → shuffle-Cf_i6hh1.js} +1 -1
  219. package/dist/assets/{slider-B1ilR4PR.js → slider-BKu_pKTg.js} +1 -1
  220. package/dist/assets/{solana-wallets-o4brcKaM.js → solana-wallets-L2Zk6SrJ.js} +2 -2
  221. package/dist/assets/{solana-wallets-vue-w3TZF7vc.js → solana-wallets-vue-CdadYDfd.js} +1 -1
  222. package/dist/assets/{sora-Cejv1_nB.js → sora-e18of6X5.js} +1 -1
  223. package/dist/assets/{sparkles-DVeLj533.js → sparkles-DSz4_6_L.js} +1 -1
  224. package/dist/assets/square-BE4lH5I7.js +1 -0
  225. package/dist/assets/{store-B-T1wTXt.js → store-BmZ93VyM.js} +1 -1
  226. package/dist/assets/{suno-BXKweMT5.js → suno-pS3aauPK.js} +1 -1
  227. package/dist/assets/{switch-MNH0pcC0.js → switch-rSn1Bn_8.js} +1 -1
  228. package/dist/assets/{table-CaZfW01f.js → table-Br26gloA.js} +1 -1
  229. package/dist/assets/{tabs-BQRg1x8-.js → tabs-GTPL6KDd.js} +1 -1
  230. package/dist/assets/{tag-BM3rCL07.js → tag-toberKjl.js} +1 -1
  231. package/dist/assets/terminal-Cbe5o7SM.js +1 -0
  232. package/dist/assets/{time-picker-CcCY5PXl.js → time-picker-DT6fkCyP.js} +1 -1
  233. package/dist/assets/{tooltip-qTn7nJhY.js → tooltip-B5x8_vte.js} +1 -1
  234. package/dist/assets/{trash-2-C7OqHxci.js → trash-2-CraM-w_J.js} +1 -1
  235. package/dist/assets/{triangle-alert-D_Ku-290.js → triangle-alert-7hE9H9f5.js} +1 -1
  236. package/dist/assets/{upload-CbQoV27b.js → upload-C2clebjh.js} +1 -1
  237. package/dist/assets/{upload-CaDoepuW.js → upload-CZTwZIBs.js} +1 -1
  238. package/dist/assets/user-DBBqvXgM.js +1 -0
  239. package/dist/assets/{veo-CZhHDGHW.js → veo-j2kC1ErJ.js} +1 -1
  240. package/dist/assets/{video-CV2KbVky.js → video-D5WMBz3f.js} +1 -1
  241. package/dist/assets/{volume-2-CQYW9Gap.js → volume-2-DIGhV1_2.js} +1 -1
  242. package/dist/assets/{wallet-n7Ka0qLA.js → wallet-Dh09Or92.js} +1 -1
  243. package/dist/assets/{wan-DAJyljkz.js → wan-B6s-CAgU.js} +1 -1
  244. package/dist/assets/{wand-sparkles-DT_fyyk1.js → wand-sparkles-BIedQV0b.js} +1 -1
  245. package/dist/assets/{web-CXOZU1L6.js → web-BMddz8tT.js} +1 -1
  246. package/dist/assets/{web-CJZEIbMU.js → web-CJl1ymya.js} +1 -1
  247. package/dist/assets/{web-pdOo0dg0.js → web-C_aiaQcY.js} +1 -1
  248. package/dist/assets/{web-CRMSarK3.js → web-DXhU2KBP.js} +1 -1
  249. package/dist/assets/{web-DHtajFUB.js → web-MxBs7h9o.js} +1 -1
  250. package/dist/assets/{webextrator-CJ-Y5MLa.js → webextrator-kAL_tvdJ.js} +1 -1
  251. package/dist/assets/{zap-CS_Gx6oy.js → zap-B0DTyRcM.js} +1 -1
  252. package/dist/index.html +4 -4
  253. package/package.json +1 -1
  254. package/dist/assets/Index-BgFglTJI.js +0 -1
  255. package/dist/assets/arrow-down-DobiO3I2.js +0 -1
  256. package/dist/assets/arrow-left-C7YbzFz4.js +0 -1
  257. package/dist/assets/arrow-right-BqDy8oUP.js +0 -1
  258. package/dist/assets/arrow-up-D3J0RjzQ.js +0 -1
  259. package/dist/assets/chat-Bx2IC7g4.js +0 -1
  260. package/dist/assets/chat-CBTzxhxo.js +0 -1
  261. package/dist/assets/chat-bEsXg3MF.js +0 -1
  262. package/dist/assets/check-DlRpPo6I.js +0 -1
  263. package/dist/assets/chevron-down-Dh-ucpyc.js +0 -1
  264. package/dist/assets/chevron-right-CVZ8AZ8w.js +0 -1
  265. package/dist/assets/circle-check-CavhTDIT.js +0 -1
  266. package/dist/assets/clock-DEvy_URV.js +0 -1
  267. package/dist/assets/code-C8NvMB5v.js +0 -1
  268. package/dist/assets/esm-C1gTpyxK.js +0 -1
  269. package/dist/assets/gauge-CDZOaO3o.js +0 -1
  270. package/dist/assets/loader-circle-BG-suH_u.js +0 -1
  271. package/dist/assets/music-2-CdvZyn9G.js +0 -1
  272. package/dist/assets/play-DkffiuVx.js +0 -1
  273. package/dist/assets/plus-RBQ1J_ID.js +0 -1
  274. package/dist/assets/rotate-ccw-0WNQDkPL.js +0 -1
  275. package/dist/assets/rotate-cw-D8pd8wOm.js +0 -1
  276. package/dist/assets/search-CGnw5hkl.js +0 -1
  277. package/dist/assets/square-DBjAU4ZY.js +0 -1
  278. package/dist/assets/terminal-BrLABIZl.js +0 -1
  279. package/dist/assets/user-pEJcKZxI.js +0 -1
@@ -0,0 +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,ot as h,rt as g,tt as _,x as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{F as b}from"./icon-CDmWyIgD.js";import{r as x,t as S}from"./select-D1IfJVxx.js";import{n as C,t as w}from"./tabs-GTPL6KDd.js";import{n as T,t as E}from"./form-BdKMEyCR.js";import{t as D}from"./upload-CZTwZIBs.js";import{t as O}from"./tooltip-B5x8_vte.js";import{t as k}from"./alert-BprQRUmf.js";import{h as A,v as j}from"./models-C7_NW_4L.js";import{t as M}from"./avatar-DEN_WCPo.js";import{t as N}from"./checkbox-DXMDpaxv.js";import{n as P,r as F,t as I}from"./radio-BNhFzeBO.js";import{n as L,t as R}from"./collapse-DRVXc0DX.js";import{t as z}from"./drawer-C9KSXFM-.js";import{n as B,r as V,t as H}from"./dropdown-2XM6XDCt.js";import{t as U}from"./input-number-Boqx1FHy.js";import{t as ee}from"./popover-BRCYNGHX.js";import{t as te}from"./progress-BuyYfFZn.js";import{n as ne,t as re}from"./skeleton-Dj_a_iIP.js";import{t as ie}from"./slider-BKu_pKTg.js";import{t as ae}from"./switch-rSn1Bn_8.js";import{t as oe}from"./arrow-down-wide-narrow-C6okCb24.js";import{i as se,n as ce,r as W,t as le}from"./Player-Cubo3E6R.js";import{t as ue}from"./circle-check-kRHtuX7n.js";import{t as de}from"./clock-BgGjEEpa.js";import{t as fe}from"./code-uZEkA0pf.js";import{t as pe}from"./download-D77eKNbQ.js";import{t as me}from"./ellipsis-Cli2dfhG.js";import{t as he}from"./gauge-DO-_Bldx.js";import{a as ge,c as _e,i as ve,n as ye,o as G,r as be,s as xe,t as Se}from"./pagination-Cu0HJ57M.js";import{t as Ce}from"./headphones-ChokKnYz.js";import{t as we}from"./image-DfORz5aE.js";import{t as Te}from"./info-BJs8f39c.js";import{t as Ee}from"./link-CHWonspm.js";import{t as De}from"./loader-circle-D1CHrD0L.js";import{t as K}from"./mic-D4q6VsFS.js";import{t as Oe}from"./music-2-BkvlUrPV.js";import{t as ke}from"./palette-B19v7ZZy.js";import{t as Ae}from"./pause-1oQk0pe1.js";import{t as je}from"./pencil-CU26a-p3.js";import{t as Me}from"./play-DPjxs2aY.js";import{t as Ne}from"./plus-Bceq4G9z.js";import{t as Pe}from"./refresh-cw-BF9qyGQW.js";import{t as Fe}from"./rotate-ccw-e-uQkgmy.js";import{t as Ie}from"./search-ZaqM39dy.js";import{t as Le}from"./shuffle-Cf_i6hh1.js";import{t as Re}from"./square-BE4lH5I7.js";import{t as ze}from"./trash-2-CraM-w_J.js";import{t as Be}from"./triangle-alert-7hE9H9f5.js";import{t as Ve}from"./upload-C2clebjh.js";import{t as q}from"./wand-sparkles-BIedQV0b.js";import{rr as He}from"./constants-rUWdh_ex.js";import{$t as Ue,Di as We,Er as Ge,Ii as J,Nr as Ke,O as Y,Si as qe,Ti as X,Wi as Z,Wn as Q,Yt as Je,an as Ye,ci as Xe,en as Ze,mn as Qe,tn as $e,vn as et,xi as $}from"./index-CJnITX6X.js";import{t as tt}from"./CopyToClipboard-DCnv3cNN.js";import{t as nt}from"./ReportDialog-DKW6gg-x.js";import{n as rt}from"./taskDrawerMixin-DyAUhFEq.js";import{t as it}from"./Consumption-DzYByju3.js";var at=$(`drum`,[[`path`,{d:`m2 2 8 8`,key:`1v6059`}],[`path`,{d:`m22 2-8 8`,key:`173r8a`}],[`ellipse`,{cx:`12`,cy:`9`,rx:`10`,ry:`5`,key:`liohsx`}],[`path`,{d:`M7 13.4v7.9`,key:`1yi6u9`}],[`path`,{d:`M12 14v8`,key:`1tn2tj`}],[`path`,{d:`M17 13.4v7.9`,key:`eqz2v3`}],[`path`,{d:`M2 9v8a10 5 0 0 0 20 0V9`,key:`1750ul`}]]),ot=$(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),st=$(`fast-forward`,[[`path`,{d:`M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z`,key:`b19h5q`}],[`path`,{d:`M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z`,key:`h7h5ge`}]]),ct=$(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),lt=$(`guitar`,[[`path`,{d:`m11.9 12.1 4.514-4.514`,key:`109xqo`}],[`path`,{d:`M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z`,key:`txyc8t`}],[`path`,{d:`m6 16 2 2`,key:`16qmzd`}],[`path`,{d:`M8.23 9.85A3 3 0 0 1 11 8a5 5 0 0 1 5 5 3 3 0 0 1-1.85 2.77l-.92.38A2 2 0 0 0 12 18a4 4 0 0 1-4 4 6 6 0 0 1-6-6 4 4 0 0 1 4-4 2 2 0 0 0 1.85-1.23z`,key:`1de1vg`}]]),ut=$(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),dt=$(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),ft=$(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),pt=y({name:`LayoutSuno`,components:{MagicIcon:q,ElDrawer:z,ElButton:J},mixins:[rt]}),mt={class:`main flex flex-row flex-1`},ht={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)]`},gt={class:`result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`},_t={class:`preview h-full w-[300px] flex flex-col`};function vt(t,n,r,i,o,c){let l=u(`magic-icon`),p=u(`el-button`),h=u(`el-drawer`);return _(),s(`div`,mt,[e(`div`,ht,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,gt,[f(t.$slots,`result`,{},void 0,!0)]),e(`div`,_t,[f(t.$slots,`preview`,{},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 yt=Y(pt,[[`render`,vt],[`__scopeId`,`data-v-e3f41341`]]),bt=y({name:`TypeSelector`,components:{ElSelect:x,ElOption:S,ElSwitch:ae},data(){return{options:[{label:`v5.5`,value:`chirp-v5-5`,desc:this.$t(`suno.model.v55desc`)},{label:`v5`,value:`chirp-v5`,desc:this.$t(`suno.model.v5desc`)},{label:`v4.5+`,value:`chirp-v4-5-plus`,desc:this.$t(`suno.model.v45plusdesc`)},{label:`v4.5`,value:`chirp-v4-5`,desc:this.$t(`suno.model.v45desc`),dividerAfter:!0},{label:`v4`,value:`chirp-v4`,desc:this.$t(`suno.model.v4desc`)},{label:`v3.5`,value:`chirp-v3-5`,desc:this.$t(`suno.model.v35desc`)},{label:`v3`,value:`chirp-v3-0`,desc:this.$t(`suno.model.v3desc`)}]}},computed:{custom:{get(){return this.$store.state.suno?.config?.custom||!1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,custom:e})}},instrumental:{get(){return this.$store.state.suno?.config?.instrumental||!1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,instrumental:e})}},model:{get(){return this.$store.state.suno?.config?.model},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e})}}},mounted(){this.model||=He}}),xt={class:`mb-3`},St={class:`flex items-center mb-1`},Ct={class:`text-sm font-bold`},wt={class:`model-option`},Tt={class:`model-option-left`},Et={class:`model-option-name`},Dt={class:`model-option-desc`},Ot={key:0,class:`flex items-center justify-between mb-3`},kt={class:`text-sm font-bold`};function At(t,r,c,d,f,h){let v=u(`el-option`),y=u(`el-select`),b=u(`el-switch`);return _(),s(`div`,null,[e(`div`,xt,[e(`div`,St,[e(`span`,Ct,i(t.$t(`suno.name.model`)),1)]),a(y,{modelValue:t.model,"onUpdate:modelValue":r[0]||=e=>t.model=e,class:`w-full model-select`,size:`default`,placeholder:t.$t(`suno.placeholder.select`)},{default:m(()=>[(_(!0),s(l,null,g(t.options,t=>(_(),p(v,{key:t.value,label:t.label,value:t.value,class:n({"model-option-divider":t.dividerAfter})},{default:m(()=>[e(`div`,wt,[e(`div`,Tt,[e(`span`,Et,i(t.label),1)]),e(`span`,Dt,i(t.desc),1)])]),_:2},1032,[`label`,`value`,`class`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),t.custom?(_(),s(`div`,Ot,[e(`span`,kt,i(t.$t(`suno.name.instrumental`)),1),a(b,{modelValue:t.instrumental,"onUpdate:modelValue":r[1]||=e=>t.instrumental=e},null,8,[`modelValue`])])):o(``,!0)])}var jt=Y(bt,[[`render`,At],[`__scopeId`,`data-v-16e4d6fc`]]),Mt=y({name:`UploadAudio`,components:{MicrophoneIcon:K,StopIcon:Re,SuccessIcon:ue,UndoIcon:Fe,UploadIcon:Ve,ElUpload:D,ElButton:J,ElDialog:We,ElTabs:C,ElTabPane:w,InfoIcon:G,ElRadioGroup:F,ElRadioButton:P},mixins:[Ze,Je],emits:[`change`],data(){return{fileList:[],uploadUrl:Xe()+`/api/v1/files/`,dialogVisible:!1,activeTab:`browse`,recording:!1,recordedBlob:null,recordedAudioUrl:null,audioPreviewUrl:null,recordTimer:null,recordSeconds:0,mediaRecorder:null,mediaStream:null,recordedChunks:[],uploadingRecord:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.suno?.config?.audio_id},set(){}},hasUploadedAudio(){let e=this.$store.state.suno?.config?.action;return e===`upload_extend`||e===`upload_cover`},uploadAction:{get(){return this.$store.state.suno?.config?.action||`upload_extend`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,action:e})}},formattedTime(){return`${Math.floor(this.recordSeconds/60).toString().padStart(2,`0`)}:${(this.recordSeconds%60).toString().padStart(2,`0`)}`}},watch:{urls:{handler(e){this.$emit(`change`,e)}}},beforeUnmount(){this.cleanupRecording()},methods:{onExceed(){j.warning(this.$t(`suno.message.uploadReferencesExceed`))},onError(){j.error(this.$t(`suno.message.uploadReferencesError`))},async onBrowseSuccess(){let e=this.urls?.[0];e&&(this.audioPreviewUrl=e,await this.onGenerateAudioId(e),this.dialogVisible=!1)},async onGenerateAudioId(e){let t={audio_url:e},n=this.credential?.token;if(!n){console.error(`no token specified`);return}j.info(this.$t(`suno.message.startingUploadAudio`));try{let e=await Q.upload(t,{token:n});console.debug(`get upload music success`,e.data);let r=e.data?.data.audio_id;this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,audio_id:r,action:`upload_extend`}),j.success(this.$t(`suno.message.startUploadAudioSuccess`))}catch(e){j.error(e?.response?.data?.error?.message||this.$t(`suno.message.startUploadAudioFailed`))}},async startRecording(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){j.error(this.$t(`suno.message.recordingUnsupported`));return}try{this.mediaStream=await navigator.mediaDevices.getUserMedia({audio:!0}),this.recordedChunks=[],this.mediaRecorder=new MediaRecorder(this.mediaStream),this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.recordedChunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.recordedChunks,{type:`audio/webm`});this.recordedBlob=e,this.recordedAudioUrl&&URL.revokeObjectURL(this.recordedAudioUrl),this.recordedAudioUrl=URL.createObjectURL(e),this.releaseStream()},this.mediaRecorder.start(),this.recording=!0,this.recordSeconds=0,this.recordTimer=window.setInterval(()=>{this.recordSeconds+=1,this.recordSeconds>=600&&this.stopRecording()},1e3)}catch(e){console.error(`record error`,e),j.error(this.$t(`suno.message.recordingPermissionDenied`))}},stopRecording(){this.recordTimer&&=(window.clearInterval(this.recordTimer),null),this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),this.recording=!1},resetRecording(){this.recordedAudioUrl&&URL.revokeObjectURL(this.recordedAudioUrl),this.recordedBlob=null,this.recordedAudioUrl=null,this.recordSeconds=0},async uploadRecording(){if(this.recordedBlob){this.uploadingRecord=!0;try{let e=new FormData,t=`recording-${Date.now()}.webm`;e.append(`file`,this.recordedBlob,t);let n=await fetch(this.uploadUrl,{method:`POST`,headers:{Authorization:`Bearer ${this.$store.state.token.access}`},body:e});if(!n.ok)throw Error(`upload failed: ${n.status}`);let r=await n.json(),i=r?.file_url||r?.data?.file_url;if(!i)throw Error(`no file_url in response`);this.audioPreviewUrl=i,await this.onGenerateAudioId(i),this.dialogVisible=!1,this.resetRecording()}catch(e){console.error(e),j.error(e?.message||this.$t(`suno.message.uploadReferencesError`))}finally{this.uploadingRecord=!1}}},releaseStream(){this.mediaStream&&=(this.mediaStream.getTracks().forEach(e=>e.stop()),null)},cleanupRecording(){this.recordTimer&&=(window.clearInterval(this.recordTimer),null),this.releaseStream(),this.recordedAudioUrl&&=(URL.revokeObjectURL(this.recordedAudioUrl),null)}}}),Nt={class:`relative`},Pt={class:`flex justify-between items-center mb-2`},Ft={class:`flex justify-start items-center`},It={class:`text-sm font-bold`},Lt={key:0,class:`mb-2`},Rt=[`src`],zt={key:1,class:`mt-2`},Bt={class:`py-4`},Vt={class:`text-center py-6`},Ht={class:`text-sm`},Ut={class:`text-xs text-gray-400 mt-1`},Wt={class:`py-4 text-center`},Gt={class:`recorder-display mb-4`},Kt={key:0,class:`text-red-500 flex items-center justify-center gap-2`},qt={class:`text-2xl font-mono`},Jt={key:1,class:`text-green-600`},Yt={key:2,class:`text-gray-400 text-2xl font-mono`},Xt={key:0,class:`mb-4`},Zt=[`src`],Qt={class:`flex justify-center gap-3`};function $t(t,n,c,d,f,h){let g=u(`info-icon`),v=u(`el-button`),y=u(`el-radio-button`),b=u(`el-radio-group`),x=u(`upload-icon`),S=u(`el-upload`),C=u(`el-tab-pane`),w=u(`success-icon`),T=u(`microphone-icon`),E=u(`stop-icon`),D=u(`undo-icon`),O=u(`el-tabs`),k=u(`el-dialog`);return _(),s(`div`,Nt,[e(`div`,Pt,[e(`div`,Ft,[e(`span`,It,i(t.$t(`suno.name.referenceAudios`)),1),a(g,{content:t.$t(`suno.description.uploadAudios`)},null,8,[`content`])]),a(v,{round:``,type:`primary`,size:`small`,onClick:n[0]||=e=>t.dialogVisible=!0},{default:m(()=>[r(i(t.$t(`suno.button.addAudio`)),1)]),_:1})]),t.audioPreviewUrl?(_(),s(`div`,Lt,[e(`audio`,{src:t.audioPreviewUrl,controls:``,class:`w-full`},null,8,Rt)])):o(``,!0),t.hasUploadedAudio?(_(),s(`div`,zt,[a(b,{modelValue:t.uploadAction,"onUpdate:modelValue":n[1]||=e=>t.uploadAction=e,size:`small`},{default:m(()=>[a(y,{value:`upload_extend`},{default:m(()=>[r(i(t.$t(`suno.button.extend`)),1)]),_:1}),a(y,{value:`upload_cover`},{default:m(()=>[r(i(t.$t(`suno.button.upload_cover`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),a(k,{modelValue:t.dialogVisible,"onUpdate:modelValue":n[4]||=e=>t.dialogVisible=e,title:t.$t(`suno.name.addAudio`),width:`520px`,"close-on-click-modal":!1,"append-to-body":``},{default:m(()=>[a(O,{modelValue:t.activeTab,"onUpdate:modelValue":n[3]||=e=>t.activeTab=e,class:`add-audio-tabs`},{default:m(()=>[a(C,{name:`browse`,label:t.$t(`suno.tab.browse`)},{default:m(()=>[e(`div`,Bt,[a(S,{"file-list":t.fileList,"onUpdate:fileList":n[2]||=e=>t.fileList=e,name:`file`,limit:1,class:`upload-wrapper`,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,accept:`.mp3,.wav,.m4a,audio/*`,"show-file-list":!0,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onBrowseSuccess,headers:t.headers,drag:``},{default:m(()=>[e(`div`,Vt,[a(x,{class:`text-4xl text-gray-400 mb-3`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`div`,Ht,i(t.$t(`suno.description.dropAudioHere`)),1),e(`div`,Ut,i(t.$t(`suno.description.audioFormats`)),1)])]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])]),_:1},8,[`label`]),a(C,{name:`record`,label:t.$t(`suno.tab.record`)},{default:m(()=>[e(`div`,Wt,[e(`div`,Gt,[t.recording?(_(),s(`div`,Kt,[n[5]||=e(`span`,{class:`recording-dot`},null,-1),e(`span`,qt,i(t.formattedTime),1)])):t.recordedBlob?(_(),s(`div`,Jt,[a(w,{class:`text-2xl mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`span`,null,i(t.$t(`suno.message.recordingReady`))+` (`+i(t.formattedTime)+`)`,1)])):(_(),s(`div`,Yt,`00:00`))]),t.recordedAudioUrl&&!t.recording?(_(),s(`div`,Xt,[e(`audio`,{src:t.recordedAudioUrl,controls:``,class:`w-full`},null,8,Zt)])):o(``,!0),e(`div`,Qt,[!t.recording&&!t.recordedBlob?(_(),p(v,{key:0,type:`primary`,round:``,onClick:t.startRecording},{default:m(()=>[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`suno.button.startRecord`)),1)]),_:1},8,[`onClick`])):o(``,!0),t.recording?(_(),p(v,{key:1,type:`danger`,round:``,onClick:t.stopRecording},{default:m(()=>[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`suno.button.stopRecord`)),1)]),_:1},8,[`onClick`])):o(``,!0),t.recordedBlob&&!t.recording?(_(),s(l,{key:2},[a(v,{round:``,onClick:t.resetRecording},{default:m(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`suno.button.reRecord`)),1)]),_:1},8,[`onClick`]),a(v,{type:`primary`,round:``,loading:t.uploadingRecord,onClick:t.uploadRecording},{default:m(()=>[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`suno.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])],64)):o(``,!0)])])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`])])}var en=Y(Mt,[[`render`,$t],[`__scopeId`,`data-v-a535be8b`]]),tn=[{key:`lofi`,label:`🎧 Lo-fi Chill`,prompt:`a relaxing lo-fi hip hop beat for studying`},{key:`pop-love`,label:`💕 Pop Love Song`,prompt:`a catchy pop love song with sweet melodies`},{key:`rock-anthem`,label:`🎸 Rock Anthem`,prompt:`an energetic rock anthem with electric guitars`},{key:`jazz-night`,label:`🎷 Jazz Night`,prompt:`a smooth late-night jazz piece with saxophone`},{key:`edm-drop`,label:`⚡ EDM Drop`,prompt:`an intense EDM track with a massive drop`},{key:`folk-story`,label:`🪕 Folk Story`,prompt:`a warm folk song telling a story about traveling`},{key:`rnb-groove`,label:`🎤 R&B Groove`,prompt:`a smooth R&B groove with soulful vocals`},{key:`classical`,label:`🎻 Classical`,prompt:`an elegant classical piece for orchestra`},{key:`hip-hop`,label:`🎤 Hip Hop`,prompt:`a hard-hitting hip hop beat with bass`},{key:`country`,label:`🤠 Country`,prompt:`an upbeat country song with acoustic guitar and banjo`},{key:`reggae`,label:`🌴 Reggae`,prompt:`a laid-back reggae tune with island vibes`},{key:`latin`,label:`💃 Latin`,prompt:`a vibrant Latin dance track with percussion`},{key:`ambient`,label:`🌊 Ambient`,prompt:`a dreamy ambient soundscape for relaxation`},{key:`metal`,label:`🤘 Metal`,prompt:`a powerful metal song with heavy riffs and double bass drums`},{key:`soul`,label:`🎵 Soul`,prompt:`a heartfelt soul ballad with gospel harmonies`},{key:`synthwave`,label:`🌃 Synthwave`,prompt:`a retro synthwave track with 80s vibes`},{key:`kpop`,label:`🇰🇷 K-Pop`,prompt:`a catchy K-pop dance track with hook`},{key:`lullaby`,label:`🌙 Lullaby`,prompt:`a gentle lullaby for bedtime with soft piano`},{key:`cinematic`,label:`🎬 Cinematic`,prompt:`an epic cinematic orchestral score for a movie trailer`},{key:`blues`,label:`🎸 Blues`,prompt:`a soulful blues song with electric guitar bends`},{key:`disco`,label:`🕺 Disco`,prompt:`a funky disco track with groovy bassline`},{key:`punk`,label:`🔥 Punk Rock`,prompt:`a fast punk rock song with raw energy`},{key:`gospel`,label:`⛪ Gospel`,prompt:`an uplifting gospel choir song with piano`},{key:`trap`,label:`🔊 Trap`,prompt:`a dark trap beat with 808s and hi-hats`},{key:`bossa`,label:`☕ Bossa Nova`,prompt:`a gentle bossa nova with nylon guitar`},{key:`indie`,label:`🎶 Indie`,prompt:`a dreamy indie track with ethereal vocals`},{key:`cpop`,label:`🇨🇳 C-Pop`,prompt:`a beautiful Chinese pop ballad with emotional vocals`},{key:`jpop`,label:`🇯🇵 J-Pop`,prompt:`a cheerful J-pop song with anime vibes`},{key:`afrobeat`,label:`🥁 Afrobeat`,prompt:`a groovy Afrobeat track with layered percussion`},{key:`game`,label:`🎮 Game BGM`,prompt:`an adventurous video game background music`}],nn=8;function rn(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var an=y({name:`PromptInput`,components:{RefreshIcon:Pe,PromptTextarea:ge},data(){return{shuffledTags:rn(tn)}},computed:{prompt:{get(){return this.$store.state.suno?.config?.prompt},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,prompt:e})}},visibleTags(){return this.shuffledTags.slice(0,nn)}},mounted(){this.prompt||=``},methods:{onTagClick(e){this.prompt=e.prompt},onRefreshTags(){this.shuffledTags=rn(tn)}}}),on={class:`inspo-tags`},sn=[`onClick`],cn=[`aria-label`,`title`];function ln(t,n,r,o,c,d){let f=u(`refresh-icon`),h=u(`prompt-textarea`);return _(),p(h,{modelValue:t.prompt,"onUpdate:modelValue":n[1]||=e=>t.prompt=e,title:t.$t(`suno.name.songDescription`),info:t.$t(`suno.description.prompt`),placeholder:t.$t(`suno.placeholder.prompt`),"min-rows":5,"max-rows":14},{after:m(()=>[e(`div`,on,[(_(!0),s(l,null,g(t.visibleTags,e=>(_(),s(`button`,{key:e.key,class:`inspo-tag`,onClick:n=>t.onTagClick(e)},i(e.label),9,sn))),128)),e(`button`,{class:`inspo-tag inspo-tag-refresh`,"aria-label":t.$t(`common.button.refresh`),title:t.$t(`common.button.refresh`),onClick:n[0]||=(...e)=>t.onRefreshTags&&t.onRefreshTags(...e)},[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,cn)])]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var un=Y(an,[[`render`,ln],[`__scopeId`,`data-v-302bad6d`]]),dn=y({name:`LyricInput`,components:{ClearIcon:ot,FullscreenIcon:xe,MagicIcon:q,UndoIcon:Fe,ElInput:Z,ElButton:J,ElTooltip:O,ElDialog:We,InfoIcon:G},data(){return{generatingLyrics:!1,enhancingLyrics:!1,enhancePrompt:``,lyricHistory:[],expanded:!1}},computed:{lyric:{get(){return this.$store.state.suno?.config?.lyric},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric:e})}},config(){return this.$store.state.suno?.config},credential(){return this.$store.state.suno?.credential}},mounted(){this.lyric||=``},methods:{pushHistory(){this.lyric&&(this.lyricHistory.push(this.lyric),this.lyricHistory.length>20&&this.lyricHistory.shift())},onUndo(){let e=this.lyricHistory.pop();e!==void 0&&(this.lyric=e)},onClear(){this.pushHistory(),this.lyric=``},async onEnhanceLyrics(){let e=this.credential?.token;if(!(!e||!this.lyric||!this.enhancePrompt)){this.pushHistory(),this.enhancingLyrics=!0,j.info(this.$t(`suno.message.enhancingLyrics`));try{let t=`${this.enhancePrompt}\n\nOriginal lyrics:\n${this.lyric}`,n=(await Q.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,this.enhancePrompt=``,j.success(this.$t(`suno.message.enhanceLyricsSuccess`)))}catch{j.error(this.$t(`suno.message.enhanceLyricsFailed`))}finally{this.enhancingLyrics=!1}}},async onGenerateLyrics(){let e=this.credential?.token;if(!e)return;let t;try{t=((await qe.prompt(this.$t(`suno.message.lyricsThemePromptMessage`),this.$t(`suno.message.lyricsThemePromptTitle`),{confirmButtonText:this.$t(`common.button.confirm`),cancelButtonText:this.$t(`common.button.cancel`),inputPlaceholder:this.$t(`suno.placeholder.lyricsTheme`),inputValue:this.config?.title||``,inputType:`textarea`,inputValidator:e=>typeof e==`string`&&e.trim().length>0||this.$t(`suno.message.lyricsThemeRequired`)})).value||``).trim()}catch{return}if(t){this.pushHistory(),this.generatingLyrics=!0,j.info(this.$t(`suno.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(`suno/setConfig`,{...this.$store.state.suno?.config,lyric:n.text,title:n.title}),j.success(this.$t(`suno.message.generateLyricsSuccess`)))}catch{j.error(this.$t(`suno.message.generateLyricsFailed`))}finally{this.generatingLyrics=!1}}}}}),fn={class:`field`},pn={class:`flex items-center justify-between mb-1`},mn={class:`flex items-center`},hn={class:`text-sm font-bold`},gn={class:`flex items-center gap-1`},_n={class:`relative`},vn={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},yn={key:0,class:`enhance-bar`},bn={key:0,class:`enhance-bar mt-3`},xn={class:`flex items-center justify-between`},Sn={class:`flex items-center gap-1`};function Cn(t,n,l,d,f,h){let g=u(`info-icon`),v=u(`undo-icon`),y=u(`el-button`),b=u(`el-tooltip`),x=u(`clear-icon`),S=u(`fullscreen-icon`),C=u(`magic-icon`),w=u(`el-input`),T=u(`el-dialog`);return _(),s(`div`,fn,[e(`div`,pn,[e(`div`,mn,[e(`span`,hn,i(t.$t(`suno.name.lyrics`)),1),a(g,{content:t.$t(`suno.description.lyrics`)},null,8,[`content`])]),e(`div`,gn,[t.lyricHistory.length>0?(_(),p(b,{key:0,content:t.$t(`suno.button.undo`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,"aria-label":t.$t(`suno.button.undo`),title:t.$t(`suno.button.undo`),onClick:t.onUndo},{default:m(()=>[a(v,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`,`onClick`])]),_:1},8,[`content`])):o(``,!0),t.lyric?(_(),p(b,{key:1,content:t.$t(`suno.button.clear_lyrics`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,"aria-label":t.$t(`suno.button.clear_lyrics`),title:t.$t(`suno.button.clear_lyrics`),onClick:t.onClear},{default:m(()=>[a(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`,`onClick`])]),_:1},8,[`content`])):o(``,!0),a(b,{content:t.$t(`suno.button.expand_lyrics`),placement:`top`},{default:m(()=>[a(y,{size:`small`,circle:``,"aria-label":t.$t(`suno.button.expand_lyrics`),title:t.$t(`suno.button.expand_lyrics`),onClick:n[0]||=e=>t.expanded=!0},{default:m(()=>[a(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`])]),_:1},8,[`content`]),t.config?.action===`extend`?o(``,!0):(_(),p(y,{key:2,size:`small`,loading:t.generatingLyrics,round:``,onClick:t.onGenerateLyrics},{default:m(()=>[t.generatingLyrics?o(``,!0):(_(),p(C,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),r(` `+i(t.$t(`suno.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))])]),e(`div`,_n,[t.config?.action===`extend`?(_(),p(w,{key:1,modelValue:t.lyric,"onUpdate:modelValue":n[2]||=e=>t.lyric=e,rows:5,type:`textarea`,class:`lyrics`,placeholder:t.$t(`suno.placeholder.extend.lyrics`)},null,8,[`modelValue`,`placeholder`])):(_(),p(w,{key:0,modelValue:t.lyric,"onUpdate:modelValue":n[1]||=e=>t.lyric=e,rows:5,type:`textarea`,class:`lyrics`,placeholder:t.$t(`suno.placeholder.lyrics`)},null,8,[`modelValue`,`placeholder`])),e(`div`,vn,i(t.lyric?.length||0)+`/5000`,1)]),t.lyric&&t.config?.action!==`extend`?(_(),s(`div`,yn,[a(w,{modelValue:t.enhancePrompt,"onUpdate:modelValue":n[3]||=e=>t.enhancePrompt=e,size:`small`,placeholder:t.$t(`suno.placeholder.enhanceLyrics`),class:`enhance-input`,onKeyup:c(t.onEnhanceLyrics,[`enter`])},{append:m(()=>[a(y,{loading:t.enhancingLyrics,onClick:t.onEnhanceLyrics},{default:m(()=>[t.enhancingLyrics?o(``,!0):(_(),p(C,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),r(` `+i(t.$t(`suno.button.enhance_lyrics`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])])):o(``,!0),a(T,{modelValue:t.expanded,"onUpdate:modelValue":n[7]||=e=>t.expanded=e,title:t.$t(`suno.name.lyrics`),width:`720px`,top:`5vh`,"close-on-click-modal":!1,class:`lyrics-expand-dialog`},{footer:m(()=>[e(`div`,xn,[e(`div`,Sn,[t.lyricHistory.length>0?(_(),p(y,{key:0,size:`small`,onClick:t.onUndo},{default:m(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`suno.button.undo`)),1)]),_:1},8,[`onClick`])):o(``,!0),t.lyric?(_(),p(y,{key:1,size:`small`,onClick:t.onClear},{default:m(()=>[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`suno.button.clear_lyrics`)),1)]),_:1},8,[`onClick`])):o(``,!0),t.config?.action===`extend`?o(``,!0):(_(),p(y,{key:2,size:`small`,loading:t.generatingLyrics,onClick:t.onGenerateLyrics},{default:m(()=>[t.generatingLyrics?o(``,!0):(_(),p(C,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),r(` `+i(t.$t(`suno.button.generate_lyrics`)),1)]),_:1},8,[`loading`,`onClick`]))]),a(y,{type:`primary`,onClick:n[6]||=e=>t.expanded=!1},{default:m(()=>[r(i(t.$t(`common.button.confirm`)),1)]),_:1})])]),default:m(()=>[a(w,{modelValue:t.lyric,"onUpdate:modelValue":n[4]||=e=>t.lyric=e,type:`textarea`,rows:20,class:`lyrics-expanded`,placeholder:t.$t(`suno.placeholder.lyrics`),autofocus:``},null,8,[`modelValue`,`placeholder`]),t.config?.action===`extend`?o(``,!0):(_(),s(`div`,bn,[a(w,{modelValue:t.enhancePrompt,"onUpdate:modelValue":n[5]||=e=>t.enhancePrompt=e,size:`small`,placeholder:t.$t(`suno.placeholder.enhanceLyrics`),class:`enhance-input`,onKeyup:c(t.onEnhanceLyrics,[`enter`])},{append:m(()=>[a(y,{loading:t.enhancingLyrics,onClick:t.onEnhanceLyrics},{default:m(()=>[t.enhancingLyrics?o(``,!0):(_(),p(C,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),r(` `+i(t.$t(`suno.button.enhance_lyrics`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1},8,[`modelValue`,`placeholder`,`onKeyup`])]))]),_:1},8,[`modelValue`,`title`])])}var wn=Y(dn,[[`render`,Cn],[`__scopeId`,`data-v-d537dc57`]]),Tn=`Pop.Rock.Jazz.R&B.Hip Hop.Lo-fi.Electronic.Classical.Country.Blues.Folk.Reggae.Metal.Punk.Soul.Funk.Ambient.Indie.Latin.Acoustic.Dance.Disco.Gospel.K-Pop.J-Pop.C-Pop.Bossa Nova.Trap.Drill.House.Techno.Dubstep.Synthwave.Chill.Dreamy.Upbeat.Melancholic.Romantic.Epic.Cinematic.Orchestral.Piano.Guitar.Saxophone.Violin.Tribal.World Music.Afrobeat.Ska.Grunge`.split(`.`),En=12;function Dn(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var On=y({name:`StyleInput`,components:{MagicIcon:q,RefreshIcon:Pe,ElInput:Z,ElButton:J,InfoIcon:G},data(){return{optimizing:!1,shuffledTags:Dn(Tn)}},computed:{style:{get(){return this.$store.state.suno?.config?.style},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style:e})}},credential(){return this.$store.state.suno?.credential},visibleTags(){return this.shuffledTags.slice(0,En)}},methods:{onTagClick(e){let t=this.style||``;t.toLowerCase().includes(e.toLowerCase())||(this.style=t?`${t}, ${e}`:e)},onRefreshTags(){this.shuffledTags=Dn(Tn)},async onOptimizeStyle(){let e=this.credential?.token;if(!(!e||!this.style)){this.optimizing=!0,j.info(this.$t(`suno.message.optimizingStyle`));try{let t=await Q.style({prompt:this.style},{token:e}),n=t.data?.text||t.data?.data?.text;n&&(this.style=n,j.success(this.$t(`suno.message.optimizeStyleSuccess`)))}catch{j.error(this.$t(`suno.message.optimizeStyleFailed`))}finally{this.optimizing=!1}}}}}),kn={class:`field`},An={class:`flex items-center justify-between mb-1`},jn={class:`flex items-center`},Mn={class:`text-sm font-bold`},Nn={class:`relative`},Pn={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},Fn={class:`style-tags`},In=[`onClick`],Ln=[`aria-label`,`title`];function Rn(t,n,c,d,f,h){let v=u(`info-icon`),y=u(`magic-icon`),b=u(`el-button`),x=u(`el-input`),S=u(`refresh-icon`);return _(),s(`div`,kn,[e(`div`,An,[e(`div`,jn,[e(`span`,Mn,i(t.$t(`suno.name.style`)),1),a(v,{content:t.$t(`suno.description.style`)},null,8,[`content`])]),a(b,{size:`small`,loading:t.optimizing,round:``,onClick:t.onOptimizeStyle},{default:m(()=>[t.optimizing?o(``,!0):(_(),p(y,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),r(` `+i(t.$t(`suno.button.optimize_style`)),1)]),_:1},8,[`loading`,`onClick`])]),e(`div`,Nn,[a(x,{modelValue:t.style,"onUpdate:modelValue":n[0]||=e=>t.style=e,rows:2,type:`textarea`,placeholder:t.$t(`suno.placeholder.style`)},null,8,[`modelValue`,`placeholder`]),e(`div`,Pn,i(t.style?.length||0)+`/1000`,1)]),e(`div`,Fn,[(_(!0),s(l,null,g(t.visibleTags,e=>(_(),s(`button`,{key:e,class:`style-tag`,onClick:n=>t.onTagClick(e)},i(e),9,In))),128)),e(`button`,{class:`style-tag style-tag-refresh`,"aria-label":t.$t(`common.button.refresh`),title:t.$t(`common.button.refresh`),onClick:n[1]||=(...e)=>t.onRefreshTags&&t.onRefreshTags(...e)},[a(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Ln)])])}var zn=Y(On,[[`render`,Rn],[`__scopeId`,`data-v-86037edb`]]),Bn=y({name:`TitleInput`,components:{ElInput:Z,InfoIcon:G},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,title:e})}}}}),Vn={class:`field`},Hn={class:`flex items-center mb-1`},Un={class:`text-sm font-bold`};function Wn(t,n,r,o,c,l){let d=u(`info-icon`),f=u(`el-input`);return _(),s(`div`,Vn,[e(`div`,Hn,[e(`span`,Un,i(t.$t(`suno.name.title`)),1),a(d,{content:t.$t(`suno.description.title`)},null,8,[`content`])]),a(f,{modelValue:t.title,"onUpdate:modelValue":n[0]||=e=>t.title=e,placeholder:t.$t(`suno.placeholder.title`)},null,8,[`modelValue`,`placeholder`])])}var Gn=Y(Bn,[[`render`,Wn]]),Kn=y({name:`ExtendFromInput`,components:{ElImage:X,ElIcon:b,ElInputNumber:U,VideoPlay:Me,VideoPause:Ae},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.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:W,onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),qn={class:`field`},Jn={class:`box`},Yn={class:`title font-bold`},Xn={class:`input-wrapper`},Zn={class:`task`},Qn={class:`left`},$n=[`aria-label`,`title`],er=[`aria-label`,`title`],tr={key:2,class:`duration`},nr={class:`info`},rr={class:`title`},ir={class:`style`};function ar(n,r,l,f,p,g){let v=u(`el-input-number`),y=u(`el-image`),b=u(`video-pause`),x=u(`el-icon`),S=u(`video-play`),C=h(`loading`);return _(),s(`div`,qn,[e(`div`,Jn,[e(`h2`,Yn,i(n.$t(`suno.name.extend`)),1),e(`div`,Xn,[a(v,{modelValue:n.value,"onUpdate:modelValue":r[0]||=e=>n.value=e,class:`value`,min:0,max:n.audio?.duration,controls:!1,placeholder:n.$t(`suno.placeholder.extend.continue_at`),onChange:n.handleChange},null,8,[`modelValue`,`max`,`placeholder`,`onChange`])])]),e(`div`,Zn,[n.audio?(_(),s(`div`,{key:0,class:`audio`,onClick:r[7]||=e=>n.onClick(n.audio)},[d((_(),s(`div`,Qn,[a(y,{src:n.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),n.audio?.audio_url&&n.$store.state?.suno?.audio?.id===n.audio.id&&n.$store.state?.suno?.audio?.state===`playing`?(_(),s(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.pause`),title:n.$t(`common.player.pause`),onClick:r[1]||=e=>n.onPause(n.audio),onKeydown:[r[2]||=c(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`enter`]),r[3]||=c(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`space`])]},[a(x,null,{default:m(()=>[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,$n)):o(``,!0),n.audio?.audio_url&&(n.$store.state?.suno?.audio?.id!==n.audio.id||n.$store.state?.suno?.audio?.id===n.audio.id&&n.$store.state?.suno?.audio?.state===`paused`)?(_(),s(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.play`),title:n.$t(`common.player.play`),onClick:r[4]||=e=>n.onPlay(n.audio),onKeydown:[r[5]||=c(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`enter`]),r[6]||=c(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`space`])]},[a(x,null,{default:m(()=>[a(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,er)):o(``,!0),n.audio?.duration?(_(),s(`div`,tr,i(n.useFormatDuring(n.audio?.duration)),1)):o(``,!0)])),[[C,!n.audio?.audio_url]]),e(`div`,nr,[e(`h2`,rr,i(n.audio?.title),1),e(`p`,ir,i(n.audio?.style),1)])])):o(``,!0)])])}var or=Y(Kn,[[`render`,ar],[`__scopeId`,`data-v-4600553c`]]),sr=y({name:`CoverFromInput`,components:{ElImage:X,ElIcon:b,VideoPlay:Me,VideoPause:Ae},data(){return{}},computed:{audio(){return this.$store.state.suno?.config?.audio},value:{get(){return this.$store.state.suno?.config?.continue_at},set(e){console.debug(`set continue_at`,e),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.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:W,onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`}),console.log(`on play`)},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`}),console.log(`on pause`)},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})}}}),cr={class:`field`},lr={class:`box`},ur={class:`title font-bold`},dr={class:`task`},fr={class:`left`},pr=[`aria-label`,`title`],mr=[`aria-label`,`title`],hr={key:2,class:`duration`},gr={class:`info`},_r={class:`title`},vr={class:`style`};function yr(n,r,l,f,p,g){let v=u(`el-image`),y=u(`video-pause`),b=u(`el-icon`),x=u(`video-play`),S=h(`loading`);return _(),s(`div`,cr,[e(`div`,lr,[e(`h2`,ur,i(n.$t(`suno.name.cover`)),1)]),e(`div`,dr,[n.audio?(_(),s(`div`,{key:0,class:`audio`,onClick:r[6]||=e=>n.onClick(n.audio)},[d((_(),s(`div`,fr,[a(v,{src:n.audio?.image_url,class:`cover`,fit:`cover`},null,8,[`src`]),n.audio?.audio_url&&n.$store.state?.suno?.audio?.id===n.audio.id&&n.$store.state?.suno?.audio?.state===`playing`?(_(),s(`div`,{key:0,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.pause`),title:n.$t(`common.player.pause`),onClick:r[0]||=e=>n.onPause(n.audio),onKeydown:[r[1]||=c(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`enter`]),r[2]||=c(t(e=>n.onPause(n.audio),[`stop`,`prevent`]),[`space`])]},[a(b,null,{default:m(()=>[a(y,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,pr)):o(``,!0),n.audio?.audio_url&&(n.$store.state?.suno?.audio?.id!==n.audio.id||n.$store.state?.suno?.audio?.id===n.audio.id&&n.$store.state?.suno?.audio?.state===`paused`)?(_(),s(`div`,{key:1,class:`overlay`,role:`button`,tabindex:`0`,"aria-label":n.$t(`common.player.play`),title:n.$t(`common.player.play`),onClick:r[3]||=e=>n.onPlay(n.audio),onKeydown:[r[4]||=c(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`enter`]),r[5]||=c(t(e=>n.onPlay(n.audio),[`stop`,`prevent`]),[`space`])]},[a(b,null,{default:m(()=>[a(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,mr)):o(``,!0),n.audio?.duration?(_(),s(`div`,hr,i(n.useFormatDuring(n.audio?.duration)),1)):o(``,!0)])),[[S,!n.audio?.audio_url]]),e(`div`,gr,[e(`h2`,_r,i(n.audio?.title),1),e(`p`,vr,i(n.audio?.style),1)])])):o(``,!0)])])}var br=Y(sr,[[`render`,yr],[`__scopeId`,`data-v-aa3e3b20`]]),xr=y({name:`VocalGenderSelector`,components:{ElRadioGroup:F,ElRadioButton:P,InfoIcon:G},computed:{vocalGender:{get(){return this.$store.state.suno?.config?.vocal_gender||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,vocal_gender:e||void 0})}}}}),Sr={class:`flex items-center mb-1`},Cr={class:`text-sm font-bold`};function wr(t,n,o,c,l,d){let f=u(`info-icon`),p=u(`el-radio-button`),h=u(`el-radio-group`);return _(),s(`div`,null,[e(`div`,Sr,[e(`span`,Cr,i(t.$t(`suno.name.vocalGender`)),1),a(f,{content:t.$t(`suno.description.vocalGender`)},null,8,[`content`])]),a(h,{modelValue:t.vocalGender,"onUpdate:modelValue":n[0]||=e=>t.vocalGender=e,size:`small`},{default:m(()=>[a(p,{value:``},{default:m(()=>[r(i(t.$t(`suno.gender.auto`)),1)]),_:1}),a(p,{value:`f`},{default:m(()=>[r(i(t.$t(`suno.gender.female`)),1)]),_:1}),a(p,{value:`m`},{default:m(()=>[r(i(t.$t(`suno.gender.male`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var Tr=Y(xr,[[`render`,wr]]),Er=y({name:`AdvancedParams`,components:{ElCollapse:R,ElCollapseItem:L,ElInput:Z,ElInputNumber:U,ElSlider:ie,ElRadioGroup:F,ElRadioButton:P,ElSwitch:ae},data(){return{activeNames:[]}},computed:{config(){return this.$store.state.suno?.config},isV5OrAbove(){let e=this.config?.model||``;return[`chirp-v5`,`chirp-v5-5`].includes(e)},durationEnabled:{get(){return this.$store.state.suno?.config?.duration!==void 0},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,duration:e?120:void 0})}},duration:{get(){return this.$store.state.suno?.config?.duration??120},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,duration:e})}},styleNegative:{get(){return this.$store.state.suno?.config?.negative_tags||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,negative_tags:e||void 0})}},lyricPrompt:{get(){return this.$store.state.suno?.config?.lyric_prompt||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyric_prompt:e||void 0})}},weirdness:{get(){return this.$store.state.suno?.config?.weirdness??0},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,weirdness:e||void 0})}},styleInfluence:{get(){return this.$store.state.suno?.config?.style_influence??.5},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style_influence:e})}},variationCategory:{get(){return this.$store.state.suno?.config?.variation_category||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,variation_category:e||void 0})}},audioWeight:{get(){return this.$store.state.suno?.config?.audio_weight??.5},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,audio_weight:e})}},lyricsMode:{get(){return this.$store.state.suno?.config?.lyrics_mode||`manual`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,lyrics_mode:e})}}},mounted(){let e=this.$store.state.suno?.config;if(!e)return;let t={};typeof e.weirdness==`number`&&e.weirdness>1&&(t.weirdness=e.weirdness/100),typeof e.style_influence==`number`&&e.style_influence>1&&(t.style_influence=e.style_influence/100),typeof e.audio_weight==`number`&&e.audio_weight>1&&(t.audio_weight=e.audio_weight/100),Object.keys(t).length>0&&this.$store.commit(`suno/setConfig`,{...e,...t})}}),Dr={key:0,class:`mb-3`},Or={class:`flex items-center mb-1`},kr={class:`text-xs font-bold`},Ar={key:1,class:`mb-3`},jr={class:`flex items-center mb-1`},Mr={class:`text-xs font-bold`},Nr={key:2,class:`mb-3`},Pr={class:`flex items-center justify-between mb-1`},Fr={class:`text-xs font-bold`},Ir={class:`text-xs text-[var(--el-text-color-secondary)]`},Lr={key:3,class:`mb-3`},Rr={class:`flex items-center justify-between mb-1`},zr={class:`text-xs font-bold`},Br={class:`text-xs text-[var(--el-text-color-secondary)]`},Vr={key:4,class:`mb-3`},Hr={class:`flex items-center mb-1`},Ur={class:`text-xs font-bold`},Wr={key:5,class:`mb-3`},Gr={class:`flex items-center justify-between mb-1`},Kr={class:`text-xs font-bold`},qr={class:`text-xs text-[var(--el-text-color-secondary)]`},Jr={key:6,class:`mb-3`},Yr={class:`flex items-center justify-between mb-1`},Xr={class:`text-xs font-bold`},Zr={class:`text-xs text-[var(--el-text-color-secondary)]`},Qr={key:7,class:`mb-3`},$r={class:`flex items-center mb-1`},ei={class:`text-xs font-bold`};function ti(t,n,c,d,f,h){let g=u(`el-input`),v=u(`el-slider`),y=u(`el-radio-button`),b=u(`el-radio-group`),x=u(`el-switch`),S=u(`el-input-number`),C=u(`el-collapse-item`),w=u(`el-collapse`);return _(),p(w,{modelValue:t.activeNames,"onUpdate:modelValue":n[9]||=e=>t.activeNames=e,class:`advanced-collapse`},{default:m(()=>[a(C,{title:t.$t(`suno.name.advancedParams`),name:`advanced`},{default:m(()=>[t.config?.custom?(_(),s(`div`,Dr,[e(`div`,Or,[e(`span`,kr,i(t.$t(`suno.name.styleNegative`)),1)]),a(g,{modelValue:t.styleNegative,"onUpdate:modelValue":n[0]||=e=>t.styleNegative=e,size:`small`,placeholder:t.$t(`suno.placeholder.styleNegative`)},null,8,[`modelValue`,`placeholder`])])):o(``,!0),t.config?.custom&&!t.config?.instrumental?(_(),s(`div`,Ar,[e(`div`,jr,[e(`span`,Mr,i(t.$t(`suno.name.lyricPrompt`)),1)]),a(g,{modelValue:t.lyricPrompt,"onUpdate:modelValue":n[1]||=e=>t.lyricPrompt=e,size:`small`,placeholder:t.$t(`suno.placeholder.lyricPrompt`)},null,8,[`modelValue`,`placeholder`])])):o(``,!0),t.config?.custom?(_(),s(`div`,Nr,[e(`div`,Pr,[e(`span`,Fr,i(t.$t(`suno.name.weirdness`)),1),e(`span`,Ir,i(t.weirdness??0),1)]),a(v,{modelValue:t.weirdness,"onUpdate:modelValue":n[2]||=e=>t.weirdness=e,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),t.config?.custom?(_(),s(`div`,Lr,[e(`div`,Rr,[e(`span`,zr,i(t.$t(`suno.name.styleInfluence`)),1),e(`span`,Br,i(t.styleInfluence??.5),1)]),a(v,{modelValue:t.styleInfluence,"onUpdate:modelValue":n[3]||=e=>t.styleInfluence=e,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),t.isV5OrAbove?(_(),s(`div`,Vr,[e(`div`,Hr,[e(`span`,Ur,i(t.$t(`suno.name.variationCategory`)),1)]),a(b,{modelValue:t.variationCategory,"onUpdate:modelValue":n[4]||=e=>t.variationCategory=e},{default:m(()=>[a(y,{value:``},{default:m(()=>[r(i(t.$t(`suno.gender.auto`)),1)]),_:1}),a(y,{value:`high`},{default:m(()=>[r(i(t.$t(`suno.variation.high`)),1)]),_:1}),a(y,{value:`low`},{default:m(()=>[r(i(t.$t(`suno.variation.low`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),t.config?.action===`cover`?(_(),s(`div`,Wr,[e(`div`,Gr,[e(`span`,Kr,i(t.$t(`suno.name.audioWeight`)),1),e(`span`,qr,i(t.audioWeight??.5),1)]),a(v,{modelValue:t.audioWeight,"onUpdate:modelValue":n[5]||=e=>t.audioWeight=e,min:0,max:1,step:.01},null,8,[`modelValue`])])):o(``,!0),t.config?.custom?(_(),s(`div`,Jr,[e(`div`,Yr,[e(`span`,Xr,i(t.$t(`suno.name.duration`)),1),a(x,{modelValue:t.durationEnabled,"onUpdate:modelValue":n[6]||=e=>t.durationEnabled=e,size:`small`},null,8,[`modelValue`])]),t.durationEnabled?(_(),s(l,{key:0},[a(S,{modelValue:t.duration,"onUpdate:modelValue":n[7]||=e=>t.duration=e,size:`small`,step:10,precision:0,class:`w-full`},null,8,[`modelValue`]),e(`div`,Zr,i(t.$t(`suno.description.duration`)),1)],64)):o(``,!0)])):o(``,!0),t.config?.custom&&!t.config?.instrumental?(_(),s(`div`,Qr,[e(`div`,$r,[e(`span`,ei,i(t.$t(`suno.name.lyricsMode`)),1)]),a(b,{modelValue:t.lyricsMode,"onUpdate:modelValue":n[8]||=e=>t.lyricsMode=e,size:`small`},{default:m(()=>[a(y,{value:`manual`},{default:m(()=>[r(i(t.$t(`suno.lyricsMode.manual`)),1)]),_:1}),a(y,{value:`auto`},{default:m(()=>[r(i(t.$t(`suno.lyricsMode.auto`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0)]),_:1},8,[`title`])]),_:1},8,[`modelValue`])}var ni=Y(Er,[[`render`,ti],[`__scopeId`,`data-v-bb5cce54`]]),ri=y({name:`ReplaceSectionInput`,components:{ElInputNumber:U,ElImage:X,InfoIcon:G},computed:{audio(){return this.$store.state.suno?.config?.audio},replaceSectionStart:{get(){return this.$store.state.suno?.config?.replace_section_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,replace_section_start:e})}},replaceSectionEnd:{get(){return this.$store.state.suno?.config?.replace_section_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,replace_section_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),ii={class:`field`},ai={class:`flex items-center mb-2`},oi={class:`text-sm font-bold m-0`},si={key:0,class:`task mb-2`},ci={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},li={class:`info flex-1 min-w-0`},ui={class:`text-sm font-bold m-0 truncate`},di={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},fi={class:`flex gap-2`};function pi(t,n,r,c,l,f){let p=u(`info-icon`),m=u(`el-image`),g=u(`el-input-number`),v=h(`loading`);return _(),s(`div`,ii,[e(`div`,ai,[e(`h2`,oi,i(t.$t(`suno.name.replaceSection`)),1),a(p,{content:t.$t(`suno.description.replaceSection`)},null,8,[`content`])]),t.audio?(_(),s(`div`,si,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[d((_(),s(`div`,ci,[a(m,{src:t.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!t.audio?.audio_url]]),e(`div`,li,[e(`h2`,ui,i(t.audio?.title),1),e(`p`,di,i(t.audio?.style),1)])])])):o(``,!0),e(`div`,fi,[a(g,{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(`suno.placeholder.replaceSectionStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(g,{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(`suno.placeholder.replaceSectionEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var mi=Y(ri,[[`render`,pi]]),hi=y({name:`OverpaintingInput`,components:{ElInputNumber:U,ElImage:X,InfoIcon:G},computed:{audio(){return this.$store.state.suno?.config?.audio},overpaintingStart:{get(){return this.$store.state.suno?.config?.overpainting_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,overpainting_start:e})}},overpaintingEnd:{get(){return this.$store.state.suno?.config?.overpainting_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,overpainting_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),gi={class:`field`},_i={class:`flex items-center mb-2`},vi={class:`text-sm font-bold m-0`},yi={key:0,class:`task mb-2`},bi={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},xi={class:`info flex-1 min-w-0`},Si={class:`text-sm font-bold m-0 truncate`},Ci={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},wi={class:`flex gap-2`};function Ti(t,n,r,c,l,f){let p=u(`info-icon`),m=u(`el-image`),g=u(`el-input-number`),v=h(`loading`);return _(),s(`div`,gi,[e(`div`,_i,[e(`h2`,vi,i(t.$t(`suno.name.overpaintingRange`)),1),a(p,{content:t.$t(`suno.description.overpainting`)},null,8,[`content`])]),t.audio?(_(),s(`div`,yi,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[d((_(),s(`div`,bi,[a(m,{src:t.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!t.audio?.audio_url]]),e(`div`,xi,[e(`h2`,Si,i(t.audio?.title),1),e(`p`,Ci,i(t.audio?.style),1)])])])):o(``,!0),e(`div`,wi,[a(g,{modelValue:t.overpaintingStart,"onUpdate:modelValue":n[1]||=e=>t.overpaintingStart=e,class:`flex-1`,size:`small`,min:0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`suno.placeholder.overpaintingStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(g,{modelValue:t.overpaintingEnd,"onUpdate:modelValue":n[2]||=e=>t.overpaintingEnd=e,class:`flex-1`,size:`small`,min:t.overpaintingStart||0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`suno.placeholder.overpaintingEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Ei=Y(hi,[[`render`,Ti]]),Di=y({name:`UnderpaintingInput`,components:{ElInputNumber:U,ElImage:X,InfoIcon:G},computed:{audio(){return this.$store.state.suno?.config?.audio},underpaintingStart:{get(){return this.$store.state.suno?.config?.underpainting_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,underpainting_start:e})}},underpaintingEnd:{get(){return this.$store.state.suno?.config?.underpainting_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,underpainting_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),Oi={class:`field`},ki={class:`flex items-center mb-2`},Ai={class:`text-sm font-bold m-0`},ji={key:0,class:`task mb-2`},Mi={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Ni={class:`info flex-1 min-w-0`},Pi={class:`text-sm font-bold m-0 truncate`},Fi={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Ii={class:`flex gap-2`};function Li(t,n,r,c,l,f){let p=u(`info-icon`),m=u(`el-image`),g=u(`el-input-number`),v=h(`loading`);return _(),s(`div`,Oi,[e(`div`,ki,[e(`h2`,Ai,i(t.$t(`suno.name.underpaintingRange`)),1),a(p,{content:t.$t(`suno.description.underpainting`)},null,8,[`content`])]),t.audio?(_(),s(`div`,ji,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[d((_(),s(`div`,Mi,[a(m,{src:t.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!t.audio?.audio_url]]),e(`div`,Ni,[e(`h2`,Pi,i(t.audio?.title),1),e(`p`,Fi,i(t.audio?.style),1)])])])):o(``,!0),e(`div`,Ii,[a(g,{modelValue:t.underpaintingStart,"onUpdate:modelValue":n[1]||=e=>t.underpaintingStart=e,class:`flex-1`,size:`small`,min:0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`suno.placeholder.underpaintingStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(g,{modelValue:t.underpaintingEnd,"onUpdate:modelValue":n[2]||=e=>t.underpaintingEnd=e,class:`flex-1`,size:`small`,min:t.underpaintingStart||0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`suno.placeholder.underpaintingEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Ri=Y(Di,[[`render`,Li]]),zi=y({name:`SamplesInput`,components:{ElInputNumber:U,ElImage:X,InfoIcon:G},computed:{audio(){return this.$store.state.suno?.config?.audio},samplesStart:{get(){return this.$store.state.suno?.config?.samples_start},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,samples_start:e})}},samplesEnd:{get(){return this.$store.state.suno?.config?.samples_end},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,samples_end:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),Bi={class:`field`},Vi={class:`flex items-center mb-2`},Hi={class:`text-sm font-bold m-0`},Ui={key:0,class:`task mb-2`},Wi={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Gi={class:`info flex-1 min-w-0`},Ki={class:`text-sm font-bold m-0 truncate`},qi={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Ji={class:`flex gap-2`};function Yi(t,n,r,c,l,f){let p=u(`info-icon`),m=u(`el-image`),g=u(`el-input-number`),v=h(`loading`);return _(),s(`div`,Bi,[e(`div`,Vi,[e(`h2`,Hi,i(t.$t(`suno.name.samplesRange`)),1),a(p,{content:t.$t(`suno.description.samples`)},null,8,[`content`])]),t.audio?(_(),s(`div`,Ui,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[d((_(),s(`div`,Wi,[a(m,{src:t.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[v,!t.audio?.audio_url]]),e(`div`,Gi,[e(`h2`,Ki,i(t.audio?.title),1),e(`p`,qi,i(t.audio?.style),1)])])])):o(``,!0),e(`div`,Ji,[a(g,{modelValue:t.samplesStart,"onUpdate:modelValue":n[1]||=e=>t.samplesStart=e,class:`flex-1`,size:`small`,min:0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`suno.placeholder.samplesStart`)},null,8,[`modelValue`,`max`,`placeholder`]),a(g,{modelValue:t.samplesEnd,"onUpdate:modelValue":n[2]||=e=>t.samplesEnd=e,class:`flex-1`,size:`small`,min:t.samplesStart||0,max:t.audio?.duration,controls:!1,placeholder:t.$t(`suno.placeholder.samplesEnd`)},null,8,[`modelValue`,`min`,`max`,`placeholder`])])])}var Xi=Y(zi,[[`render`,Yi]]),Zi=[.5,.75,1,1.25,1.5,2],Qi=y({name:`AdjustSpeedInput`,components:{ElRadioGroup:F,ElRadioButton:P,ElImage:X,InfoIcon:G},data(){return{options:Zi}},computed:{audio(){return this.$store.state.suno?.config?.audio},speed:{get(){let e=this.$store.state.suno?.config?.speed;return typeof e==`number`?e:1},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,speed:e})}}},methods:{onClick(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})}}}),$i={class:`field`},ea={class:`flex items-center mb-2`},ta={class:`text-sm font-bold m-0`},na={key:0,class:`task mb-2`},ra={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},ia={class:`info flex-1 min-w-0`},aa={class:`text-sm font-bold m-0 truncate`},oa={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`};function sa(t,n,c,f,v,y){let b=u(`info-icon`),x=u(`el-image`),S=u(`el-radio-button`),C=u(`el-radio-group`),w=h(`loading`);return _(),s(`div`,$i,[e(`div`,ea,[e(`h2`,ta,i(t.$t(`suno.name.adjustSpeed`)),1),a(b,{content:t.$t(`suno.description.adjustSpeed`)},null,8,[`content`])]),t.audio?(_(),s(`div`,na,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[d((_(),s(`div`,ra,[a(x,{src:t.audio?.image_url,class:`w-full h-full rounded`,fit:`cover`},null,8,[`src`])])),[[w,!t.audio?.audio_url]]),e(`div`,ia,[e(`h2`,aa,i(t.audio?.title),1),e(`p`,oa,i(t.audio?.style),1)])])])):o(``,!0),a(C,{modelValue:t.speed,"onUpdate:modelValue":n[1]||=e=>t.speed=e,size:`small`,class:`speed-group`},{default:m(()=>[(_(!0),s(l,null,g(t.options,e=>(_(),p(S,{key:e,value:e},{default:m(()=>[r(i(e)+`x`,1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`])])}var ca=Y(Qi,[[`render`,sa],[`__scopeId`,`data-v-ba834628`]]),la=y({name:`VoiceCreateDialog`,components:{ElDialog:We,ElForm:E,ElFormItem:T,ElInput:Z,ElButton:J,ElRadioGroup:F,ElRadio:I},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{sourceType:`song`,form:{name:``,description:``,audio_id:``,audio_url:``},loading:!1}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit(`update:modelValue`,e)}},token(){return this.$store.state.suno?.credential?.token},canSubmit(){return!(!this.form.name||this.sourceType===`song`&&!this.form.audio_id||this.sourceType===`upload`&&!this.form.audio_url)}},methods:{onClose(){this.visible=!1,this.resetForm()},resetForm(){this.form={name:``,description:``,audio_id:``,audio_url:``},this.sourceType=`song`},async onSubmit(){if(this.token){this.loading=!0;try{this.sourceType===`song`?await Q.persona({audio_id:this.form.audio_id,name:this.form.name,description:this.form.description},{token:this.token}):await Q.voices({audio_url:this.form.audio_url,name:this.form.name,description:this.form.description},{token:this.token}),j.success(this.$t(`suno.voice.createSuccess`)),this.$emit(`created`),this.onClose()}catch{j.error(this.$t(`suno.voice.createFailed`))}finally{this.loading=!1}}}}});function ua(e,t,n,s,c,l){let d=u(`el-input`),f=u(`el-form-item`),h=u(`el-radio`),g=u(`el-radio-group`),v=u(`el-form`),y=u(`el-button`),b=u(`el-dialog`);return _(),p(b,{modelValue:e.visible,"onUpdate:modelValue":t[5]||=t=>e.visible=t,title:e.$t(`suno.voice.createTitle`),width:`480px`,"close-on-click-modal":!1,onClose:e.onClose},{footer:m(()=>[a(y,{onClick:e.onClose},{default:m(()=>[r(i(e.$t(`common.button.cancel`)),1)]),_:1},8,[`onClick`]),a(y,{type:`primary`,loading:e.loading,disabled:!e.canSubmit,onClick:e.onSubmit},{default:m(()=>[r(i(e.$t(`suno.voice.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:m(()=>[a(v,{"label-position":`top`,class:`voice-create-form`},{default:m(()=>[a(f,{label:e.$t(`suno.voice.name`)},{default:m(()=>[a(d,{modelValue:e.form.name,"onUpdate:modelValue":t[0]||=t=>e.form.name=t,placeholder:e.$t(`suno.voice.namePlaceholder`),maxlength:`50`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a(f,{label:e.$t(`suno.voice.description`)},{default:m(()=>[a(d,{modelValue:e.form.description,"onUpdate:modelValue":t[1]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`suno.voice.descriptionPlaceholder`),maxlength:`200`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a(f,{label:e.$t(`suno.voice.sourceType`)},{default:m(()=>[a(g,{modelValue:e.sourceType,"onUpdate:modelValue":t[2]||=t=>e.sourceType=t,class:`w-full`},{default:m(()=>[a(h,{value:`song`},{default:m(()=>[r(i(e.$t(`suno.voice.fromSong`)),1)]),_:1}),a(h,{value:`upload`},{default:m(()=>[r(i(e.$t(`suno.voice.fromUpload`)),1)]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),e.sourceType===`song`?(_(),p(f,{key:0,label:e.$t(`suno.voice.audioId`)},{default:m(()=>[a(d,{modelValue:e.form.audio_id,"onUpdate:modelValue":t[3]||=t=>e.form.audio_id=t,placeholder:e.$t(`suno.voice.audioIdPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):o(``,!0),e.sourceType===`upload`?(_(),p(f,{key:1,label:e.$t(`suno.voice.audioUrl`)},{default:m(()=>[a(d,{modelValue:e.form.audio_url,"onUpdate:modelValue":t[4]||=t=>e.form.audio_url=t,placeholder:e.$t(`suno.voice.audioUrlPlaceholder`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):o(``,!0)]),_:1})]),_:1},8,[`modelValue`,`title`,`onClose`])}var da=y({name:`VoiceManager`,components:{AddIcon:Ne,DeleteIcon:ze,FavoriteIcon:ft,ElButton:J,ElIcon:b,ElTabs:C,ElTabPane:w,ElTooltip:O,Loading:De,MicrophoneIcon:K,MusicIcon:Oe,VoiceCreateDialog:Y(la,[[`render`,ua]])},data(){return{showCreateDialog:!1,loading:!1,deletingId:null,activeTab:`all`}},computed:{personas(){return this.$store.state.suno?.personas||[]},favoriteIds(){return this.$store.state.suno?.favoritePersonaIds||[]},favoritePersonas(){return this.personas.filter(e=>e.persona_id&&this.favoriteIds.includes(e.persona_id))},visiblePersonas(){return this.activeTab===`favorites`?this.favoritePersonas:this.personas},selectedPersonaId(){return this.$store.state.suno?.config?.persona_id}},watch:{"$store.state.suno.credential":{handler(){this.loadPersonas()},immediate:!0}},methods:{isFavorite(e){return!!e&&this.favoriteIds.includes(e)},onToggleFavorite(e){e.persona_id&&this.$store.commit(`suno/togglePersonaFavorite`,e.persona_id)},async loadPersonas(){if(this.$store.state.suno?.credential?.token){this.loading=!0;try{await this.$store.dispatch(`suno/getPersonas`)}finally{this.loading=!1}}},selectPersona(e){let t={...this.$store.state.suno?.config};t.persona_id===e.persona_id?t.persona_id=void 0:t.persona_id=e.persona_id,this.$store.dispatch(`suno/setConfig`,t)},async onDelete(e){try{await qe.confirm(this.$t(`suno.voice.confirmDelete`),this.$t(`suno.voice.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.confirm`),cancelButtonText:this.$t(`common.button.cancel`)})}catch{return}if(!e.persona_id)return;this.deletingId=e.persona_id;let t=await this.$store.dispatch(`suno/deletePersona`,e.persona_id);if(this.deletingId=null,t){if(j.success(this.$t(`suno.voice.deleteSuccess`)),this.selectedPersonaId===e.persona_id){let e={...this.$store.state.suno?.config,persona_id:void 0};this.$store.dispatch(`suno/setConfig`,e)}this.favoriteIds.includes(e.persona_id)&&this.$store.commit(`suno/togglePersonaFavorite`,e.persona_id)}else j.error(this.$t(`suno.voice.deleteFailed`))},async onCreated(){await this.loadPersonas()}}}),fa={class:`voice-manager`},pa={class:`flex items-center justify-between mb-3`},ma={class:`text-sm font-medium`},ha={key:0,class:`text-center py-6`},ga={key:1,class:`text-center py-6 text-gray-400 text-sm`},_a={key:2,class:`voice-list`},va=[`onClick`],ya={class:`flex-1 min-w-0`},ba={class:`voice-name`},xa={key:0,class:`voice-desc`};function Sa(c,d,f,h,v,y){let b=u(`add-icon`),x=u(`el-button`),S=u(`el-tab-pane`),C=u(`el-tabs`),w=u(`loading`),T=u(`el-icon`),E=u(`microphone-icon`),D=u(`music-icon`),O=u(`favorite-icon`),k=u(`el-tooltip`),A=u(`delete-icon`),j=u(`voice-create-dialog`);return _(),s(`div`,fa,[e(`div`,pa,[e(`span`,ma,i(c.$t(`suno.voice.title`)),1),a(x,{type:`primary`,size:`small`,onClick:d[0]||=e=>c.showCreateDialog=!0},{default:m(()=>[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(c.$t(`suno.voice.create`)),1)]),_:1})]),a(C,{modelValue:c.activeTab,"onUpdate:modelValue":d[1]||=e=>c.activeTab=e,class:`voice-tabs`,size:`small`},{default:m(()=>[a(S,{name:`all`,label:c.$t(`suno.voice.tabAll`)+` (`+(c.personas?.length||0)+`)`},null,8,[`label`]),a(S,{name:`favorites`,label:c.$t(`suno.voice.tabFavorites`)+` (`+c.favoritePersonas.length+`)`},null,8,[`label`])]),_:1},8,[`modelValue`]),c.loading?(_(),s(`div`,ha,[a(T,{class:`is-loading`},{default:m(()=>[a(w,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})])):c.visiblePersonas.length===0?(_(),s(`div`,ga,i(c.activeTab===`favorites`?c.$t(`suno.voice.emptyFavorites`):c.$t(`suno.voice.empty`)),1)):(_(),s(`div`,_a,[(_(!0),s(l,null,g(c.visiblePersonas,l=>(_(),s(`div`,{key:l.persona_id,class:n([`voice-item`,{active:c.selectedPersonaId===l.persona_id}]),onClick:e=>c.selectPersona(l)},[e(`div`,ya,[e(`div`,ba,[l.source_type===`voice`?(_(),p(E,{key:0,class:`mr-1.5 text-xs opacity-60`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(_(),p(D,{key:1,class:`mr-1.5 text-xs opacity-60`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),r(` `+i(l.name||l.persona_id),1)]),l.description?(_(),s(`div`,xa,i(l.description),1)):o(``,!0)]),e(`div`,{class:`voice-actions`,onClick:d[2]||=t(()=>{},[`stop`])},[a(k,{content:c.isFavorite(l.persona_id)?c.$t(`suno.voice.unfavorite`):c.$t(`suno.voice.favorite`),placement:`top`},{default:m(()=>[a(x,{size:`small`,text:``,class:n({"voice-fav-active":c.isFavorite(l.persona_id)}),"aria-label":c.isFavorite(l.persona_id)?c.$t(`suno.voice.unfavorite`):c.$t(`suno.voice.favorite`),title:c.isFavorite(l.persona_id)?c.$t(`suno.voice.unfavorite`):c.$t(`suno.voice.favorite`),onClick:e=>c.onToggleFavorite(l)},{default:m(()=>[a(O,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`class`,`aria-label`,`title`,`onClick`])]),_:2},1032,[`content`]),a(x,{type:`danger`,size:`small`,text:``,loading:c.deletingId===l.persona_id,"aria-label":c.$t(`common.button.delete`),title:c.$t(`common.button.delete`),onClick:e=>c.onDelete(l)},{default:m(()=>[a(A,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`loading`,`aria-label`,`title`,`onClick`])])],10,va))),128))])),a(j,{modelValue:c.showCreateDialog,"onUpdate:modelValue":d[3]||=e=>c.showCreateDialog=e,onCreated:c.onCreated},null,8,[`modelValue`,`onCreated`])])}var Ca=y({name:`PersonaInput`,components:{MicrophoneIcon:K,ElSelect:x,ElOption:S,ElButton:J,ElDrawer:z,InfoIcon:G,VoiceManager:Y(da,[[`render`,Sa],[`__scopeId`,`data-v-29070b80`]])},data(){return{showManager:!1}},computed:{personaId:{get(){return this.$store.state.suno?.config?.persona_id||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,persona_id:e||void 0})}},personas(){return this.$store.state.suno?.personas||[]}}}),wa={class:`field`},Ta={class:`flex items-center justify-between mb-2`},Ea={class:`flex items-center`},Da={class:`text-sm font-bold`},Oa={class:`flex items-center justify-between w-full`},ka={key:0,class:`text-xs text-gray-400 ml-2`};function Aa(t,n,c,d,f,h){let v=u(`info-icon`),y=u(`microphone-icon`),b=u(`el-button`),x=u(`el-option`),S=u(`el-select`),C=u(`voice-manager`),w=u(`el-drawer`);return _(),s(`div`,wa,[e(`div`,Ta,[e(`div`,Ea,[e(`span`,Da,i(t.$t(`suno.name.persona`)),1),a(v,{content:t.$t(`suno.description.persona`)},null,8,[`content`])]),a(b,{size:`small`,round:``,onClick:n[0]||=e=>t.showManager=!0},{default:m(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`suno.voice.manage`)),1)]),_:1})]),a(S,{modelValue:t.personaId,"onUpdate:modelValue":n[1]||=e=>t.personaId=e,placeholder:t.$t(`suno.placeholder.personaId`),clearable:``,filterable:``,class:`w-full`},{default:m(()=>[(_(!0),s(l,null,g(t.personas,t=>(_(),p(x,{key:t.persona_id||``,value:t.persona_id||``,label:t.name||t.persona_id||``},{default:m(()=>[e(`div`,Oa,[e(`span`,null,i(t.name||t.persona_id),1),t.source_type?(_(),s(`span`,ka,i(t.source_type),1)):o(``,!0)])]),_:2},1032,[`value`,`label`]))),128))]),_:1},8,[`modelValue`,`placeholder`]),a(w,{modelValue:t.showManager,"onUpdate:modelValue":n[2]||=e=>t.showManager=e,title:t.$t(`suno.voice.title`),size:`380px`,direction:`rtl`},{default:m(()=>[a(C)]),_:1},8,[`modelValue`,`title`])])}var ja=y({name:`PresetPanel`,components:{CleanupIcon:se,MagicIcon:q,TypeSelector:jt,PromptInput:un,LyricInput:wn,StyleInput:zn,TitleInput:Gn,ExtendFromInput:or,CoverFromInput:br,UploadAudio:en,VocalGenderSelector:Tr,AdvancedParams:ni,ReplaceSectionInput:mi,OverpaintingInput:Ei,UnderpaintingInput:Ri,SamplesInput:Xi,AdjustSpeedInput:ca,PersonaInput:Y(Ca,[[`render`,Aa]]),ElButton:J,ElTabs:C,ElTabPane:w,Consumption:it},emits:[`generate`],computed:{config(){return this.$store.state.suno?.config},mode:{get(){return this.$store.state.suno?.config?.custom?`custom`:`simple`},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,custom:e===`custom`})}},consumption(){return Ye(this.config,this.service?.cost)},service(){return this.$store.state.suno?.service},supportsVocalGender(){let e=this.config?.model||``;return[`chirp-v4-5-plus`,`chirp-v5`,`chirp-v5-5`].includes(e)},supportsPersona(){let e=this.config?.action;return!e||e===`generate`||e===`artist_consistency`||e===`artist_consistency_vox`},generateButtonText(){let e=this.config?.action;return e===`extend`?this.$t(`suno.button.extend`):e===`cover`?this.$t(`suno.button.cover_music`):e===`remaster`?this.$t(`suno.button.remaster`):e===`replace_section`?this.$t(`suno.button.replace_section`):e===`mashup`?this.$t(`suno.button.mashup`):e===`stems`?this.$t(`suno.button.get_stems`):e===`concat`?this.$t(`suno.button.concat_music`):e===`upload_cover`?this.$t(`suno.button.upload_cover`):e===`artist_consistency`?this.$t(`suno.button.artist_consistency`):e===`artist_consistency_vox`?this.$t(`suno.button.artist_consistency_vox`):e===`overpainting`?this.$t(`suno.button.overpainting`):e===`underpainting`?this.$t(`suno.button.underpainting`):e===`samples`?this.$t(`suno.button.samples`):e===`adjust_speed`?this.$t(`suno.button.adjust_speed`):this.$t(`suno.button.generate`)}},methods:{onGenerate(){this.$emit(`generate`)},onClearAll(){this.$store.commit(`suno/setConfig`,{custom:!1,sounds:!1,instrumental:!1,lyric:``,style:``,title:``,lyrics_mode:`manual`,model:this.$store.state.suno?.config?.model})}}}),Ma={class:`flex flex-col h-full`},Na={class:`flex-1 min-h-0 overflow-hidden`},Pa={class:`p-5`},Fa={class:`p-5`},Ia={class:`flex flex-col items-center justify-center px-5 pb-5 gap-2`},La={class:`flex gap-2 w-full`};function Ra(t,n,c,l,d,f){let h=u(`type-selector`),g=u(`upload-audio`),v=u(`prompt-input`),y=u(`extend-from-input`),b=u(`cover-from-input`),x=u(`replace-section-input`),S=u(`overpainting-input`),C=u(`underpainting-input`),w=u(`samples-input`),T=u(`adjust-speed-input`),E=u(`advanced-params`),D=u(`el-tab-pane`),O=u(`lyric-input`),k=u(`style-input`),A=u(`title-input`),j=u(`vocal-gender-selector`),M=u(`persona-input`),N=u(`el-tabs`),P=u(`consumption`),F=u(`cleanup-icon`),I=u(`el-button`),L=u(`magic-icon`);return _(),s(`div`,Ma,[e(`div`,Na,[a(N,{modelValue:t.mode,"onUpdate:modelValue":n[0]||=e=>t.mode=e,class:`suno-mode-tabs scenario-tabs scenario-tabs--scrollable`},{default:m(()=>[a(D,{label:t.$t(`suno.mode.simple`),name:`simple`},{default:m(()=>[e(`div`,Pa,[a(h,{class:`mb-4`}),a(g,{class:`mb-4`}),a(v,{class:`mb-4`}),t.config?.action===`extend`?(_(),p(y,{key:0,class:`mb-4`})):o(``,!0),t.config?.action===`cover`?(_(),p(b,{key:1,class:`mb-4`})):o(``,!0),t.config?.action===`replace_section`?(_(),p(x,{key:2,class:`mb-4`})):o(``,!0),t.config?.action===`overpainting`?(_(),p(S,{key:3,class:`mb-4`})):o(``,!0),t.config?.action===`underpainting`?(_(),p(C,{key:4,class:`mb-4`})):o(``,!0),t.config?.action===`samples`?(_(),p(w,{key:5,class:`mb-4`})):o(``,!0),t.config?.action===`adjust_speed`?(_(),p(T,{key:6,class:`mb-4`})):o(``,!0),a(E,{class:`mb-4`})])]),_:1},8,[`label`]),a(D,{label:t.$t(`suno.mode.custom`),name:`custom`},{default:m(()=>[e(`div`,Fa,[a(h,{class:`mb-4`}),a(g,{class:`mb-4`}),t.config?.instrumental?o(``,!0):(_(),p(O,{key:0,class:`mb-4`})),a(k,{class:`mb-4`}),a(A,{class:`mb-4`}),!t.config?.instrumental&&t.supportsVocalGender?(_(),p(j,{key:1,class:`mb-4`})):o(``,!0),t.supportsPersona?(_(),p(M,{key:2,class:`mb-4`})):o(``,!0),t.config?.action===`extend`?(_(),p(y,{key:3,class:`mb-4`})):o(``,!0),t.config?.action===`cover`?(_(),p(b,{key:4,class:`mb-4`})):o(``,!0),t.config?.action===`replace_section`?(_(),p(x,{key:5,class:`mb-4`})):o(``,!0),t.config?.action===`overpainting`?(_(),p(S,{key:6,class:`mb-4`})):o(``,!0),t.config?.action===`underpainting`?(_(),p(C,{key:7,class:`mb-4`})):o(``,!0),t.config?.action===`samples`?(_(),p(w,{key:8,class:`mb-4`})):o(``,!0),t.config?.action===`adjust_speed`?(_(),p(T,{key:9,class:`mb-4`})):o(``,!0),a(E,{class:`mb-4`})])]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),e(`div`,Ia,[a(P,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),e(`div`,La,[a(I,{class:`flex-1`,onClick:t.onClearAll},{default:m(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`suno.button.clear_all`)),1)]),_:1},8,[`onClick`]),a(I,{type:`primary`,class:`flex-1`,round:``,onClick:t.onGenerate},{default:m(()=>[a(L,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.generateButtonText),1)]),_:1},8,[`onClick`])])])])}var za=Y(ja,[[`render`,Ra],[`__scopeId`,`data-v-e03149a5`]]),Ba=ce(),Va=y({name:`TaskPreview`,components:{AudioIcon:Ce,ChannelIcon:_e,CodeIcon:fe,CollectionIcon:ut,CutIcon:dt,DeleteIcon:ze,DownloadIcon:pe,DrumIcon:at,EditIcon:je,FastForwardIcon:st,GuitarIcon:lt,InfoIcon:Te,LinkIcon:Ee,MagicIcon:q,MicrophoneIcon:K,MoreIcon:me,MusicIcon:Oe,PaletteIcon:ke,PerformanceIcon:he,ShuffleIcon:Le,SortIcon:oe,TimeIcon:de,UndoIcon:Fe,WarningIcon:Be,ElImage:X,ElIcon:b,ElTooltip:O,VideoPlay:Me,VideoPause:Ae,ElDropdown:H,ElDropdownMenu:V,ElDropdownItem:B,ElInput:Z,ElProgress:te,ElCheckbox:N,ElAlert:k,Loading:De,ApiCodeDialog:ve,ReportDialog:nt,CopyToClipboard:tt},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,isFetchingMidi:!1,editingAudioId:null,editingTitle:``,apiCodeVisible:!1,reportVisible:!1,reportTargetId:``,reportSnapshot:void 0,apiCodePath:`/suno/audios`,apiCodeBody:{}}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===A.Request},showViewCode(){return et()},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},task(){return this.$store.state.suno?.tasks},audios(){let e=this.modelValue?.response?.data??[],t=this.modelValue?.request?.action;return t?e.map(e=>({...e,action:t})):e},isFailure(){return this.audios.length===0&&(this.modelValue?.response?.success===!1||!!this.modelValue?.response?.error)},failureReason(){let e=this.modelValue?.response?.error;return typeof e==`string`?e:e?.message},traceId(){return this.modelValue?.response?.trace_id||this.modelValue?.trace_id},application(){return this.$store.state.suno?.application},active(){return this.$store.state.suno?.tasks?.active},isMashupMode(){return this.$store.state.suno?.config?.action===`mashup`},mashupAudioIds(){return this.$store.state.suno?.config?.mashup_audio_ids||[]}},methods:{onReport(e){this.reportTargetId=e?.id||``,this.reportSnapshot={prompt:e?.prompt,title:e?.title},this.reportVisible=!0},useFormatDuring:W,shortModel(e){let t=e?.model;if(!t)return``;let n=/v(\d+)(?:-(\d+))?(-plus)?/i.exec(t);if(!n)return t;let r=n[2]&&n[2]!==`0`?`.`+n[2]:``;return`v${n[1]}${r}${n[3]?`+`:``}`},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=`/suno/audios`,this.apiCodeVisible=!0},onPlay(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`playing`})},onPause(e){this.$store.dispatch(`suno/setAudio`,{...this.$store.state.suno.audio,...e,state:`paused`})},onClick(e){this.$store.state?.suno?.audio?.id!==e.id&&this.onPlay({...e,progress:0})},onExtend(e,t){e?.stopPropagation(),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.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,Ba.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);e.video_url=t,this.onDownload(null,t)}catch(e){console.error(`get videoUrl failed:`,e),j.error(this.$t(`suno.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.mp4(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(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,instrumental:!1,style:e.style,action:`cover`,audio:e,audio_id:e.id})},async onConcatMusic(e){await this.onGenerateAudioUrl(`concat`,e)},async onRemaster(e){await this.onGenerateAudioUrl(`remaster`,e)},async onGetAllStems(e){await this.onGenerateAudioUrl(`all_stems`,e)},onReplaceSection(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.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)})},onMashup(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`mashup`,audio:e,audio_id:e.id,mashup_audio_ids:[e.id]})},onOverpainting(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`overpainting`,audio:e,audio_id:e.id,overpainting_start:0,overpainting_end:Math.min(30,e.duration||30)})},onUnderpainting(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`underpainting`,audio:e,audio_id:e.id,underpainting_start:0,underpainting_end:Math.min(30,e.duration||30)})},onSamples(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`samples`,audio:e,audio_id:e.id,samples_start:0,samples_end:Math.min(30,e.duration||30)})},onArtistConsistency(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`artist_consistency`,audio:e,audio_id:e.id})},onAdjustSpeed(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:e.model,custom:!0,style:e.style,action:`adjust_speed`,audio:e,audio_id:e.id,speed:1})},onReusePrompt(e){let t=this.modelValue?.request??{};if(!(t.prompt||t.lyric||t.style||t.title||t.lyric_prompt||t.negative_tags||t.style_negative||t.persona_id)){j.warning(this.$t(`suno.message.reusePromptEmpty`));return}this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,model:t.model??e.model,custom:t.custom??!1,instrumental:t.instrumental??!1,prompt:t.prompt??``,lyric:t.lyric??``,lyric_prompt:t.lyric_prompt??``,lyrics_mode:t.lyrics_mode??`manual`,title:t.title??``,style:t.style??``,negative_tags:t.negative_tags??t.style_negative??``,vocal_gender:t.vocal_gender,weirdness:t.weirdness,style_influence:t.style_influence,variation_category:t.variation_category,audio_weight:t.audio_weight,duration:t.duration,persona_id:t.persona_id,action:void 0,audio:void 0,audio_id:void 0,mashup_audio_ids:void 0,continue_at:void 0,speed:void 0,replace_section_start:void 0,replace_section_end:void 0,overpainting_start:void 0,overpainting_end:void 0,underpainting_start:void 0,underpainting_end:void 0,samples_start:void 0,samples_end:void 0}),j.success(this.$t(`suno.message.reusePromptSuccess`))},async onExtractVocals(e){let t=this.credential?.token;t&&(j.info(this.$t(`suno.message.extractingVocals`)),Q.vox({audio_id:e,async:!0},{token:t}).then(()=>{j.success(this.$t(`suno.message.extractVocalsSuccess`))}).catch(e=>{j.error(e?.response?.data?.error?.message||this.$t(`suno.message.extractVocalsFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()}))},async onGetTiming(e){let t=this.credential?.token;t&&(j.info(this.$t(`suno.message.fetchingTiming`)),Q.timing({audio_id:e},{token:t}).then(()=>{j.success(this.$t(`suno.message.fetchTimingSuccess`))}).catch(e=>{j.error(e?.response?.data?.error?.message||this.$t(`suno.message.fetchTimingFailed`))}))},async handleWavDownload(e){if(!e?.id||this.isFetchingWav)return;let t=this.credential?.token;if(t)try{this.isFetchingWav=!0,j.info(this.$t(`suno.message.fetchingWav`));let n=(await Q.wav({audio_id:e.id},{token:t})).data?.data?.[0]?.file_url;n?this.onDownload(null,n):j.error(this.$t(`suno.message.fetchWavFailed`))}catch(e){let t=e?.response?.data?.error?.message;j.error(t||this.$t(`suno.message.fetchWavFailed`))}finally{this.isFetchingWav=!1}},async handleMidiDownload(e){if(!e?.id||this.isFetchingMidi)return;let t=this.credential?.token;if(t)try{this.isFetchingMidi=!0,j.info(this.$t(`suno.message.fetchingMidi`));let n=(await Q.midi({audio_id:e.id},{token:t})).data?.data;if(!n?.length){j.error(this.$t(`suno.message.fetchMidiFailed`));return}let r=(e.title||e.id||`suno`).replace(/[^\w.-]+/g,`_`)+`.json`;(0,Ba.saveAs)(new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),r)}catch(e){let t=e?.response?.data?.error?.message;j.error(t||this.$t(`suno.message.fetchMidiFailed`))}finally{this.isFetchingMidi=!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}j.info(this.$t(`suno.message.startingTask`)),Q.audio(n,{token:r}).then(()=>{j.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{j.error(e?.response?.data?.error?.message||this.$t(`suno.message.startTaskFailed`))}).finally(async()=>{await this.onGetTasks(),await this.onScrollDown()})},isMashupSelected(e){return!!e.id&&this.mashupAudioIds.includes(e.id)},onToggleMashup(e){if(!e.id)return;let t=[...this.mashupAudioIds],n=t.indexOf(e.id);n===-1?t.push(e.id):t.splice(n,1),this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,mashup_audio_ids:t})},async onScrollDown(){setTimeout(()=>{let e=document.querySelector(`.tasks`);e&&(e.scrollTop=e.scrollHeight)},1e3)},onStartTitleEdit(e){this.editingAudioId=e.id??null,this.editingTitle=e.title||``,this.$nextTick(()=>{this.$refs.titleInput?.focus?.()})},onSaveTitleEdit(e){if(this.editingAudioId!==e.id)return;let t=this.editingTitle.trim();if(t&&t!==e.title){let n=this.$store.state.suno?.tasks;if(n?.items)for(let r of n.items){let n=(r?.response?.data??[]).find(t=>t.id===e.id);if(n){n.title=t;break}}}this.editingAudioId=null,this.editingTitle=``},onCancelTitleEdit(){this.editingAudioId=null,this.editingTitle=``},async onDelete(e){try{await qe.confirm(this.$t(`suno.message.confirmDelete`),{confirmButtonText:this.$t(`suno.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`})}catch{return}let t=this.$store.state.suno?.tasks;if(t?.items)for(let n of t.items){let r=n?.response?.data??[],i=r.findIndex(t=>t.id===e.id);if(i!==-1){if(r.splice(i,1),r.length===0){let e=t.items.indexOf(n);e!==-1&&t.items.splice(e,1)}break}}this.$store.state?.suno?.audio?.id===e.id&&this.$store.dispatch(`suno/setAudio`,null),j.success(this.$t(`suno.message.deleteSuccess`))},async onGetTasks(){this.loading||await this.$store.dispatch(`suno/getTasks`,{limit:30,offset:0})}}}),Ha={class:`task`},Ua={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wa={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ga={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ka=[`onClick`],qa=[`onClick`],Ja={class:`left`},Ya={key:0,class:`variation-badge`},Xa=[`aria-label`,`title`,`onClick`,`onKeydown`],Za=[`aria-label`,`title`,`onClick`,`onKeydown`],Qa={key:3,class:`duration`},$a={class:`info`},eo={key:1,class:`title-row`},to={class:`title`},no={key:0,class:`model-chip`},ro=[`aria-label`,`title`,`onClick`],io={class:`style`},ao={key:2,class:`progress-row`},oo={class:`progress-text`},so={class:`right`},co=[`aria-label`,`title`,`onClick`],lo={class:`el-dropdown-link`},uo={class:`flex items-center min-w-[120px]`},fo={class:`flex items-center min-w-[120px]`},po={class:`flex items-center min-w-[120px]`},mo={class:`el-dropdown-link`};function ho(f,v,y,b,x,S){let C=u(`warning-icon`),w=u(`magic-icon`),T=u(`copy-to-clipboard`),E=u(`info-icon`),D=u(`channel-icon`),O=u(`el-alert`),k=u(`el-checkbox`),A=u(`el-image`),j=u(`video-pause`),M=u(`el-icon`),N=u(`video-play`),P=u(`el-input`),F=u(`edit-icon`),I=u(`el-progress`),L=u(`fast-forward-icon`),R=u(`el-tooltip`),z=u(`download-icon`),B=u(`Loading`),V=u(`el-dropdown-item`),H=u(`el-dropdown-menu`),U=u(`el-dropdown`),ee=u(`more-icon`),te=u(`music-icon`),ne=u(`shuffle-icon`),re=u(`link-icon`),ie=u(`cut-icon`),ae=u(`microphone-icon`),oe=u(`guitar-icon`),se=u(`drum-icon`),ce=u(`collection-icon`),W=u(`sort-icon`),le=u(`audio-icon`),ue=u(`palette-icon`),de=u(`performance-icon`),fe=u(`undo-icon`),pe=u(`time-icon`),me=u(`code-icon`),he=u(`delete-icon`),ge=u(`api-code-dialog`),_e=u(`report-dialog`),ve=h(`loading`);return _(),s(`div`,Ha,[f.isFailure?(_(),p(O,{key:0,closable:!1,class:`task-failure`},{title:m(()=>[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.name.failure`)),1)]),default:m(()=>[e(`p`,Ua,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.name.taskId`))+`: `+i(f.modelValue?.id)+` `,1),a(T,{content:f.modelValue?.id},null,8,[`content`])]),f.failureReason?(_(),s(`p`,Wa,[a(E,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.name.failureReason`))+`: `+i(f.failureReason)+` `,1),a(T,{content:f.failureReason},null,8,[`content`])])):o(``,!0),f.traceId?(_(),s(`p`,Ga,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.name.traceId`))+`: `+i(f.traceId)+` `,1),a(T,{content:f.traceId},null,8,[`content`])])):o(``,!0)]),_:1})):o(``,!0),(_(!0),s(l,null,g(f.audios,(l,u)=>(_(),s(`div`,{key:l.id,class:n([`audio`,{"mashup-selected":f.isMashupSelected(l),active:f.$store.state?.suno?.audio?.id===l.id,generating:!l?.audio_url}]),onClick:t(e=>f.onClick(l),[`stop`])},[f.isMashupMode&&l?.audio_url?(_(),s(`div`,{key:0,class:`mashup-check`,onClick:t(e=>f.onToggleMashup(l),[`stop`])},[a(k,{"model-value":f.isMashupSelected(l),onClick:v[0]||=t(()=>{},[`stop`])},null,8,[`model-value`])],8,qa)):o(``,!0),d((_(),s(`div`,Ja,[a(A,{src:l?.image_url,class:`cover`,fit:`cover`,lazy:``},null,8,[`src`]),f.audios.length>1?(_(),s(`div`,Ya,i(u+1),1)):o(``,!0),l?.audio_url&&f.$store.state?.suno?.audio?.id===l.id&&f.$store.state?.suno?.audio?.state===`playing`?(_(),s(`div`,{key:1,class:`play-btn`,role:`button`,tabindex:`0`,"aria-label":f.$t(`common.player.pause`),title:f.$t(`common.player.pause`),onClick:t(e=>f.onPause(l),[`stop`]),onKeydown:[c(t(e=>f.onPause(l),[`stop`,`prevent`]),[`enter`]),c(t(e=>f.onPause(l),[`stop`,`prevent`]),[`space`])]},[a(M,null,{default:m(()=>[a(j,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,Xa)):l?.audio_url?(_(),s(`div`,{key:2,class:`play-btn`,role:`button`,tabindex:`0`,"aria-label":f.$t(`common.player.play`),title:f.$t(`common.player.play`),onClick:t(e=>f.onPlay(l),[`stop`]),onKeydown:[c(t(e=>f.onPlay(l),[`stop`,`prevent`]),[`enter`]),c(t(e=>f.onPlay(l),[`stop`,`prevent`]),[`space`])]},[a(M,null,{default:m(()=>[a(N,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,Za)):o(``,!0),l?.duration?(_(),s(`div`,Qa,i(f.useFormatDuring(l?.duration)),1)):o(``,!0)])),[[ve,!l?.audio_url]]),e(`div`,$a,[f.editingAudioId===l.id?(_(),s(`div`,{key:0,class:`title-edit`,onClick:v[2]||=t(()=>{},[`stop`])},[a(P,{ref_for:!0,ref:`titleInput`,modelValue:f.editingTitle,"onUpdate:modelValue":v[1]||=e=>f.editingTitle=e,size:`small`,onKeyup:[c(e=>f.onSaveTitleEdit(l),[`enter`]),c(f.onCancelTitleEdit,[`escape`])],onBlur:e=>f.onSaveTitleEdit(l)},null,8,[`modelValue`,`onKeyup`,`onBlur`])])):(_(),s(`div`,eo,[e(`h2`,to,i(l?.title),1),f.shortModel(l)?(_(),s(`span`,no,i(f.shortModel(l)),1)):o(``,!0),l?.audio_url?(_(),s(`button`,{key:1,type:`button`,class:`icon-button edit-icon`,"aria-label":f.$t(`common.button.edit`),title:f.$t(`common.button.edit`),onClick:t(e=>f.onStartTitleEdit(l),[`stop`])},[a(F,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ro)):o(``,!0)])),e(`p`,io,i(l?.style),1),!l?.audio_url&&l?.progress!=null&&l?.progress<100?(_(),s(`div`,ao,[a(I,{percentage:Math.round(l.progress),"stroke-width":4,"show-text":!1,status:`warning`,class:`progress-bar`},null,8,[`percentage`]),e(`span`,oo,i(f.$t(`suno.name.generating`))+` `+i(Math.round(l.progress))+`%`,1)])):o(``,!0)]),e(`div`,so,[l?.audio_url?(_(),p(R,{key:0,effect:`dark`,content:f.$t(`suno.button.extend`),placement:`top`},{default:m(()=>[e(`button`,{type:`button`,class:`icon-button icon icon-extend`,"aria-label":f.$t(`suno.button.extend`),title:f.$t(`suno.button.extend`),onClick:t(e=>f.onExtend(e,l),[`stop`])},[a(L,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,co)]),_:2},1032,[`content`])):o(``,!0),a(U,null,{dropdown:m(()=>[a(H,null,{default:m(()=>[a(V,{disabled:f.isFetchingVideoUrl,onClick:e=>f.handleVideoDownload(l)},{default:m(()=>[e(`div`,uo,[f.isFetchingVideoUrl?(_(),p(M,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(B,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})):o(``,!0),e(`span`,null,i(f.$t(`suno.button.download_video`)),1)])]),_:1},8,[`disabled`,`onClick`]),l?.audio_url?(_(),p(V,{key:0,onClick:t(e=>f.onDownload(e,l?.audio_url),[`stop`])},{default:m(()=>[r(i(f.$t(`suno.button.download_audio`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(V,{disabled:f.isFetchingWav,onClick:e=>f.handleWavDownload(l)},{default:m(()=>[e(`div`,fo,[f.isFetchingWav?(_(),p(M,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(B,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})):o(``,!0),e(`span`,null,i(f.$t(`suno.button.download_wav`)),1)])]),_:1},8,[`disabled`,`onClick`]),a(V,{disabled:f.isFetchingMidi,onClick:e=>f.handleMidiDownload(l)},{default:m(()=>[e(`div`,po,[f.isFetchingMidi?(_(),p(M,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(B,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})):o(``,!0),e(`span`,null,i(f.$t(`suno.button.download_midi`)),1)])]),_:1},8,[`disabled`,`onClick`])]),_:2},1024)]),default:m(()=>[e(`span`,lo,[a(R,{effect:`dark`,content:f.$t(`suno.button.download`),placement:`top`},{default:m(()=>[l?.audio_url||l?.video_url?(_(),p(z,{key:0,class:`icon icon-download`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024),a(U,null,{dropdown:m(()=>[a(H,{class:`suno-action-menu`},{default:m(()=>[l?.audio_url?(_(),p(V,{key:0,onClick:t(e=>f.onExtend(e,l),[`stop`])},{default:m(()=>[a(L,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.extend`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(V,{onClick:t(e=>f.onCover(l),[`stop`])},{default:m(()=>[a(te,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.cover_music`)),1)]),_:1},8,[`onClick`]),l?.id?(_(),p(V,{key:1,onClick:t(e=>f.onMashup(l),[`stop`])},{default:m(()=>[a(ne,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.mashup`)),1)]),_:1},8,[`onClick`])):o(``,!0),l?.id&&l?.action===`extend`?(_(),p(V,{key:2,onClick:t(e=>f.onConcatMusic(l?.id),[`stop`])},{default:m(()=>[a(re,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.concat_music`)),1)]),_:1},8,[`onClick`])):o(``,!0),v[5]||=e(`div`,{class:`menu-divider`},null,-1),l?.id?(_(),p(V,{key:3,onClick:t(e=>f.onReplaceSection(l),[`stop`])},{default:m(()=>[a(ie,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.replace_section`)),1)]),_:1},8,[`onClick`])):o(``,!0),l?.id?(_(),p(V,{key:4,onClick:t(e=>f.onOverpainting(l),[`stop`])},{default:m(()=>[a(ae,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.overpainting`)),1)]),_:1},8,[`onClick`])):o(``,!0),l?.id?(_(),p(V,{key:5,onClick:t(e=>f.onUnderpainting(l),[`stop`])},{default:m(()=>[a(oe,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.underpainting`)),1)]),_:1},8,[`onClick`])):o(``,!0),l?.id?(_(),p(V,{key:6,onClick:t(e=>f.onSamples(l),[`stop`])},{default:m(()=>[a(se,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.samples`)),1)]),_:1},8,[`onClick`])):o(``,!0),v[6]||=e(`div`,{class:`menu-divider`},null,-1),l.id?(_(),p(V,{key:7,onClick:t(e=>f.onGetStems(l.id),[`stop`])},{default:m(()=>[a(ce,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.get_stems`)),1)]),_:1},8,[`onClick`])):o(``,!0),l.id?(_(),p(V,{key:8,onClick:t(e=>f.onGetAllStems(l.id),[`stop`])},{default:m(()=>[a(W,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.all_stems`)),1)]),_:1},8,[`onClick`])):o(``,!0),l?.id?(_(),p(V,{key:9,onClick:t(e=>f.onRemaster(l.id),[`stop`])},{default:m(()=>[a(w,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.remaster`)),1)]),_:1},8,[`onClick`])):o(``,!0),l?.id?(_(),p(V,{key:10,onClick:t(e=>f.onExtractVocals(l.id),[`stop`])},{default:m(()=>[a(le,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.extract_vocals`)),1)]),_:1},8,[`onClick`])):o(``,!0),l?.id?(_(),p(V,{key:11,onClick:t(e=>f.onArtistConsistency(l),[`stop`])},{default:m(()=>[a(ue,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.artist_consistency`)),1)]),_:1},8,[`onClick`])):o(``,!0),l?.id?(_(),p(V,{key:12,onClick:t(e=>f.onAdjustSpeed(l),[`stop`])},{default:m(()=>[a(de,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.adjust_speed`)),1)]),_:1},8,[`onClick`])):o(``,!0),v[7]||=e(`div`,{class:`menu-divider`},null,-1),a(V,{onClick:t(e=>f.onReusePrompt(l),[`stop`])},{default:m(()=>[a(fe,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.reuse_prompt`)),1)]),_:1},8,[`onClick`]),l?.id?(_(),p(V,{key:13,onClick:t(e=>f.onGetTiming(l.id),[`stop`])},{default:m(()=>[a(pe,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.get_timing`)),1)]),_:1},8,[`onClick`])):o(``,!0),f.showViewCode?(_(),p(V,{key:14,onClick:t(f.onViewCode,[`stop`])},{default:m(()=>[a(me,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`common.button.viewCode`)),1)]),_:1},8,[`onClick`])):o(``,!0),l?.id?(_(),p(V,{key:15,onClick:t(e=>f.onReport(l),[`stop`])},{default:m(()=>[a(C,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`common.button.report`)),1)]),_:1},8,[`onClick`])):o(``,!0),v[8]||=e(`div`,{class:`menu-divider`},null,-1),l?.id?(_(),p(V,{key:16,class:`delete-item`,onClick:t(e=>f.onDelete(l),[`stop`])},{default:m(()=>[a(he,{class:`menu-icon delete-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.delete`)),1)]),_:1},8,[`onClick`])):o(``,!0)]),_:2},1024)]),default:m(()=>[e(`span`,mo,[a(R,{effect:`dark`,content:f.$t(`suno.button.more`),placement:`top`},{default:m(()=>[l?.audio_url||l?.video_url?(_(),p(ee,{key:0,class:`icon icon-ellipsis`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024)])],10,Ka))),128)),a(ge,{visible:f.apiCodeVisible,"onUpdate:visible":v[3]||=e=>f.apiCodeVisible=e,method:`POST`,path:f.apiCodePath,body:f.apiCodeBody,token:f.$store.state.suno?.credential?.token||``},null,8,[`visible`,`path`,`body`,`token`]),a(_e,{visible:f.reportVisible,"onUpdate:visible":v[4]||=e=>f.reportVisible=e,service:`suno`,"target-id":f.reportTargetId,snapshot:f.reportSnapshot},null,8,[`visible`,`target-id`,`snapshot`])])}var go=y({name:`RecentPanel`,components:{FilterIcon:ct,SearchIcon:Ie,SortIcon:oe,ElSkeletonItem:ne,ElSkeleton:re,ElInput:Z,ElButton:J,ElDropdown:H,ElDropdownMenu:V,ElDropdownItem:B,ElPopover:ee,ElRadioGroup:F,ElRadioButton:P,ElSelect:x,ElOption:S,ElIcon:b,Loading:De,TaskPreview:Y(Va,[[`render`,ho]]),Player:le,NoTasks:be,ScrollList:ye},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`,`load-all`],data(){return{job:0,searchQuery:``,historyRequested:!1,sortBy:`newest`,filterType:`all`,filterDuration:`all`,filterVideo:`all`,filterModel:`all`}},computed:{tasks(){return{...this.$store.state.suno?.tasks,items:this.$store.state.suno?.tasks?.items?.slice()}},sortLabel(){return this.sortBy===`newest`?this.$t(`suno.sort.newest`):this.$t(`suno.sort.oldest`)},activeFilterCount(){let e=0;return this.filterType!==`all`&&e++,this.filterDuration!==`all`&&e++,this.filterVideo!==`all`&&e++,this.filterModel&&this.filterModel!==`all`&&e++,e},availableModels(){let e=this.tasks?.items||[],t=new Set;for(let n of e){let e=n?.response?.data??[];for(let n of e)n.model&&t.add(n.model)}return Array.from(t).sort()},filteredTasks(){let e=this.tasks?.items||[];if(this.searchQuery){let t=this.searchQuery.toLowerCase();e=e.filter(e=>(e?.response?.data??[]).some(e=>e.title?.toLowerCase().includes(t)||e.style?.toLowerCase().includes(t)||e.prompt?.toLowerCase().includes(t)))}return this.activeFilterCount>0&&(e=e.filter(e=>{let t=e?.request??{},n=e?.response?.data??[];return this.filterType===`vocal`&&t.instrumental===!0||this.filterType===`instrumental`&&t.instrumental!==!0?!1:this.filterDuration!==`all`||this.filterVideo!==`all`||this.filterModel&&this.filterModel!==`all`?n.some(e=>!(this.filterDuration===`short`&&!(typeof e.duration==`number`&&e.duration<60)||this.filterDuration===`medium`&&!(typeof e.duration==`number`&&e.duration>=60&&e.duration<=180)||this.filterDuration===`long`&&!(typeof e.duration==`number`&&e.duration>180)||this.filterVideo===`with`&&!e.video_url||this.filterVideo===`without`&&e.video_url||this.filterModel&&this.filterModel!==`all`&&e.model!==this.filterModel)):!0})),this.sortBy===`oldest`&&(e=[...e].reverse()),e},visibleTracks(){let e=[];for(let t of this.filteredTasks)for(let n of t?.response?.data??[])n?.audio_url&&e.push(n);return e}},watch:{searchQuery(e){e&&this.requestFullHistory()},activeFilterCount(e){e>0&&this.requestFullHistory()}},methods:{requestFullHistory(){this.historyRequested||(this.historyRequested=!0,this.$emit(`load-all`))},onSortChange(e){this.sortBy=e},onResetFilters(){this.filterType=`all`,this.filterDuration=`all`,this.filterVideo=`all`,this.filterModel=`all`},getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),_o={key:0,class:`tasks`},vo={class:`left w-[70px] p-[10px] flex items-center`},yo={class:`main w-[calc(100%-70px)] flex-1 p-[10px]`},bo={key:0,class:`task-toolbar`},xo={key:0,class:`filter-badge`},So={class:`filter-popover`},Co={class:`filter-row`},wo={class:`filter-label`},To={class:`filter-row`},Eo={class:`filter-label`},Do={class:`filter-row`},Oo={class:`filter-label`},ko={key:0,class:`filter-row`},Ao={class:`filter-label`},jo={class:`filter-actions`},Mo={key:2,class:`w-full flex-1 flex items-center justify-center`},No={class:`text-sm text-gray-400`},Po={key:3,class:`w-full flex-1 flex flex-col items-center justify-center gap-2`},Fo={class:`text-sm text-gray-400`},Io={key:4,class:`w-full flex-1 flex items-center justify-center`},Lo={key:5,class:`w-full flex-1 flex items-center justify-center`},Ro={class:`h-20`};function zo(t,c,f,h,y,b){let x=u(`el-skeleton-item`),S=u(`el-skeleton`),C=u(`search-icon`),w=u(`el-input`),T=u(`sort-icon`),E=u(`el-button`),D=u(`el-dropdown-item`),O=u(`el-dropdown-menu`),k=u(`el-dropdown`),A=u(`filter-icon`),j=u(`el-radio-button`),M=u(`el-radio-group`),N=u(`el-option`),P=u(`el-select`),F=u(`el-popover`),I=u(`task-preview`),L=u(`scroll-list`),R=u(`loading`),z=u(`el-icon`),B=u(`no-tasks`),V=u(`player`);return _(),s(l,null,[t.tasks?.items===void 0?(_(),s(`div`,_o,[(_(),s(l,null,g(3,t=>e(`div`,{key:t,class:`flex`},[e(`div`,vo,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`image`,class:`avatar w-[50px] h-[50px]`})]),_:1})]),e(`div`,yo,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`p`,class:`w-[200px] h-[15px] mb-[5px] mt-[10px]`}),a(x,{variant:`text`})]),_:1})])])),64))])):(_(),s(l,{key:1},[t.tasks?.items?.length?(_(),s(`div`,bo,[a(w,{modelValue:t.searchQuery,"onUpdate:modelValue":c[0]||=e=>t.searchQuery=e,size:`small`,placeholder:t.$t(`suno.placeholder.searchSongs`),clearable:``,class:`task-search`},{prefix:m(()=>[a(C,{class:`text-xs`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`]),a(k,{trigger:`click`,onCommand:t.onSortChange},{dropdown:m(()=>[a(O,null,{default:m(()=>[a(D,{command:`newest`,class:n({"is-active":t.sortBy===`newest`})},{default:m(()=>[r(i(t.$t(`suno.sort.newest`)),1)]),_:1},8,[`class`]),a(D,{command:`oldest`,class:n({"is-active":t.sortBy===`oldest`})},{default:m(()=>[r(i(t.$t(`suno.sort.oldest`)),1)]),_:1},8,[`class`])]),_:1})]),default:m(()=>[a(E,{size:`small`,round:``,class:`sort-btn`},{default:m(()=>[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.sortLabel),1)]),_:1})]),_:1},8,[`onCommand`]),a(F,{trigger:`click`,placement:`bottom-end`,width:260},{reference:m(()=>[a(E,{size:`small`,round:``,class:n([`filter-btn`,{"has-active-filter":t.activeFilterCount>0}])},{default:m(()=>[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`suno.filter.title`))+` `,1),t.activeFilterCount>0?(_(),s(`span`,xo,i(t.activeFilterCount),1)):o(``,!0)]),_:1},8,[`class`])]),default:m(()=>[e(`div`,So,[e(`div`,Co,[e(`div`,wo,i(t.$t(`suno.filter.type`)),1),a(M,{modelValue:t.filterType,"onUpdate:modelValue":c[1]||=e=>t.filterType=e,size:`small`},{default:m(()=>[a(j,{value:`all`},{default:m(()=>[r(i(t.$t(`suno.filter.typeAll`)),1)]),_:1}),a(j,{value:`vocal`},{default:m(()=>[r(i(t.$t(`suno.filter.typeVocal`)),1)]),_:1}),a(j,{value:`instrumental`},{default:m(()=>[r(i(t.$t(`suno.filter.typeInstrumental`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e(`div`,To,[e(`div`,Eo,i(t.$t(`suno.filter.duration`)),1),a(M,{modelValue:t.filterDuration,"onUpdate:modelValue":c[2]||=e=>t.filterDuration=e,size:`small`},{default:m(()=>[a(j,{value:`all`},{default:m(()=>[r(i(t.$t(`suno.filter.durationAll`)),1)]),_:1}),a(j,{value:`short`},{default:m(()=>[r(i(t.$t(`suno.filter.durationShort`)),1)]),_:1}),a(j,{value:`medium`},{default:m(()=>[r(i(t.$t(`suno.filter.durationMedium`)),1)]),_:1}),a(j,{value:`long`},{default:m(()=>[r(i(t.$t(`suno.filter.durationLong`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e(`div`,Do,[e(`div`,Oo,i(t.$t(`suno.filter.video`)),1),a(M,{modelValue:t.filterVideo,"onUpdate:modelValue":c[3]||=e=>t.filterVideo=e,size:`small`},{default:m(()=>[a(j,{value:`all`},{default:m(()=>[r(i(t.$t(`suno.filter.videoAll`)),1)]),_:1}),a(j,{value:`with`},{default:m(()=>[r(i(t.$t(`suno.filter.videoWith`)),1)]),_:1}),a(j,{value:`without`},{default:m(()=>[r(i(t.$t(`suno.filter.videoWithout`)),1)]),_:1})]),_:1},8,[`modelValue`])]),t.availableModels.length>0?(_(),s(`div`,ko,[e(`div`,Ao,i(t.$t(`suno.filter.model`)),1),a(P,{modelValue:t.filterModel,"onUpdate:modelValue":c[4]||=e=>t.filterModel=e,size:`small`,placeholder:t.$t(`suno.filter.modelAll`),clearable:``},{default:m(()=>[a(N,{label:t.$t(`suno.filter.modelAll`),value:`all`},null,8,[`label`]),(_(!0),s(l,null,g(t.availableModels,e=>(_(),p(N,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0),e(`div`,jo,[a(E,{size:`small`,text:``,onClick:t.onResetFilters},{default:m(()=>[r(i(t.$t(`suno.filter.reset`)),1)]),_:1},8,[`onClick`])])])]),_:1})])):o(``,!0),t.filteredTasks?.length>0?(_(),p(L,{key:1,ref:`scrollList`,class:`flex-1 w-full overflow-y-auto tasks p-2`,loading:t.loading,onReachTop:c[5]||=e=>t.$emit(`reach-top`)},{default:m(()=>[(_(!0),s(l,null,g(t.filteredTasks,(e,t)=>(_(),p(I,{key:t,"model-value":e,class:`preview`},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):!t.loading&&t.searchQuery&&t.tasks?.items?.length>0?(_(),s(`div`,Mo,[e(`p`,No,i(t.$t(`suno.message.noSearchResults`)),1)])):!t.loading&&t.activeFilterCount>0&&t.tasks?.items?.length>0?(_(),s(`div`,Po,[e(`p`,Fo,i(t.$t(`suno.message.noFilterResults`)),1),a(E,{size:`small`,text:``,onClick:t.onResetFilters},{default:m(()=>[r(i(t.$t(`suno.filter.reset`)),1)]),_:1},8,[`onClick`])])):t.loading?(_(),s(`div`,Io,[a(z,{class:`is-loading text-xl text-gray-400`},{default:m(()=>[a(R,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})])):t.tasks?.items?.length===0?(_(),s(`div`,Lo,[a(B)])):o(``,!0)],64)),d(e(`div`,Ro,[a(V,{namespace:`suno`,tracks:t.visibleTracks},null,8,[`tracks`])],512),[[v,!!t.$store?.state?.suno?.audio?.object]])],64)}var Bo=Y(go,[[`render`,zo],[`__scopeId`,`data-v-06fc829c`]]),Vo=y({name:`TaskPreview`,components:{IconPicture:we,Headset:Ce,ElImage:X,ElAvatar:M,ElIcon:b},computed:{audio(){return this.$store.state.suno?.audio}}}),Ho={key:0,class:`size-full overflow-hidden`},Uo={class:`relative h-[300px]`},Wo={class:`flex items-center justify-center size-full bg-[var(--el-bg-color)]`},Go={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`},Ko={class:`p-4`},qo={class:`flex items-center font-bold mb-2`},Jo={class:`text-[var(--el-text-color-regular)] mb-2`},Yo={class:`text-xs text-[var(--el-text-color-regular)]`},Xo={class:`mt-4 text-sm leading-[25px] whitespace-pre-wrap`},Zo={key:1,class:`flex flex-col items-center justify-center w-full h-full text-[var(--el-text-color-placeholder)]`};function Qo(t,n,r,o,c,l){let d=u(`icon-picture`),f=u(`el-icon`),p=u(`el-image`),h=u(`el-avatar`),g=u(`headset`);return t.audio?.object?(_(),s(`div`,Ho,[e(`div`,Uo,[a(p,{src:t.audio.image_url,fit:`cover`,class:`size-full`},{error:m(()=>[e(`div`,Wo,[a(f,{class:`text-3xl`},{default:m(()=>[a(d,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})])]),_:1},8,[`src`]),e(`h2`,Go,i(t.audio?.title),1)]),e(`div`,Ko,[e(`div`,qo,[a(h,{size:30,src:t.audio?.image_url,class:`mr-2`},null,8,[`src`]),e(`span`,null,i(t.audio?.title),1)]),e(`p`,Jo,i(t.audio?.style),1),e(`p`,Yo,i(t.$dayjs.format(t.audio?.created_at)),1),e(`div`,Xo,[e(`p`,null,i(t.audio?.lyric),1)])])])):(_(),s(`div`,Zo,[a(f,{class:`text-5xl opacity-40`},{default:m(()=>[a(g,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})]))}var $o=y({name:`SunoIndex`,components:{Layout:yt,ConfigPanel:za,RecentPanel:Bo,PreviewPanel:Y(Vo,[[`render`,Qo]])},mixins:[$e],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,loadingAll:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===A.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===A.Request||this.fetchingTasks},service(){return this.$store.state.suno.service},credential(){return this.$store.state.suno.credential},config(){return this.$store.state.suno.config},initializing(){return this.$store.state.suno.status.getApplications===A.Request},needApply(){return this.$store.state.suno.status.getApplications===A.Success&&!this.application},application(){return this.$store.state.suno.application},tasks(){return this.$store.state.suno.tasks},applications(){return this.$store.state.suno.applications}},watch:{tasks:{handler(e,t){e?.items?.length,t?.items?.length},deep:!0},initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await Se({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 onLoadAll(){if(!this.loadingAll){this.loadingAll=!0;try{for(let e=0;e<100;e++){for(let e=0;(this.fetchingTasks||this.applicationsLoading)&&e<50;e++)await new Promise(e=>setTimeout(e,100));let e=this.tasks?.items??[],t=this.tasks?.total;if(t!==void 0&&e.length>=t)break;let n=e[0];if(!n?.created_at)break;let r=e.length;if(await this.onGetTasks({createdAtMax:n.created_at}),(this.tasks?.items?.length??0)<=r)break}}finally{this.loadingAll=!1}}},async onGetService(){await this.$store.dispatch(`suno/getService`)},async onGetApplication(){await this.$store.dispatch(`suno/getApplications`),await this.onGetTasks()},onApply(){Ge.create({application:this.application}).then(({data:e})=>{this.application=e,j.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&j.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)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`suno/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerateAudio(){if(!Ue(this.uploadTracker,e=>this.$t(e),e=>j.warning(e)))return;let e={...this.config,async:!0};if(!this.hasSunoInput(e)){j.error(this.$t(`suno.message.promptRequired`));return}if(this.hasText(e.prompt)&&(e.prompt=e.prompt.trim()),!Qe())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}j.info(this.$t(`suno.message.startingTask`)),Ke(`suno`,Q.audio(e,{token:t})).then(()=>{j.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{j.error(e?.response?.data?.error?.message||this.$t(`suno.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0},hasSunoInput(e){return[e.prompt,e.lyric,e.lyric_prompt,e.style,e.title].some(e=>this.hasText(e))||this.hasText(e.audio_id)||Array.isArray(e.mashup_audio_ids)&&e.mashup_audio_ids.length>0}}});function es(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`preview-panel`),d=u(`layout`);return _(),p(d,null,{config:m(()=>[a(s,{onGenerate:e.onGenerateAudio},null,8,[`onGenerate`])]),result:m(()=>[a(c,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore||e.loadingAll,onReachTop:e.onReachTop,onLoadAll:e.onLoadAll},null,8,[`loading`,`onReachTop`,`onLoadAll`])]),preview:m(()=>[a(l)]),_:1})}var ts=Y($o,[[`render`,es],[`__scopeId`,`data-v-237ce3b7`]]);export{ts 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-BzDGa5m7.js";import{t as x}from"./upload-CaDoepuW.js";import{t as S}from"./tooltip-qTn7nJhY.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-BezwK8kr.js";import{t as E}from"./drawer-C9nReT9E.js";import{t as D}from"./input-number-sRRzJirK.js";import{t as O}from"./box-wbHSraQR.js";import{t as k}from"./clock-DEvy_URV.js";import{a as A,c as j,n as M,o as N,r as P,t as F}from"./pagination-Z4NRITpd.js";import{t as I}from"./image-C3x2yaF9.js";import{t as ee}from"./info-VadVQTaW.js";import{t as te}from"./trash-2-C7OqHxci.js";import{t as ne}from"./triangle-alert-D_Ku-290.js";import{t as re}from"./upload-CbQoV27b.js";import{t as L}from"./wand-sparkles-DT_fyyk1.js";import{t as ie}from"./zap-CS_Gx6oy.js";import{An as R,Cn as z,Dn as ae,En as oe,Sn as B,Tn as V,bn as H,kn as se,wn as U}from"./constants-CLU-fDDu.js";import{$t as ce,Bn as le,Ii as W,Nr as ue,O as G,Si as K,Yt as de,an as fe,ci as pe,en as me,mn as he,nn as ge,rn as _e,tn as ve}from"./index-BMhc9ht-.js";import{t as ye}from"./CopyToClipboard-Bt9-bdiq.js";import{t as be}from"./ReportButton-D01Y2fPF.js";import{t as q}from"./ImagePreview-BEpyCuCR.js";import{n as xe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Se}from"./Consumption-CUCdAwJr.js";import{t as Ce}from"./ApiCodeButton-6BQ24hBr.js";import{t as we}from"./BotPlaceholder-Cv0cpmLN.js";import{t as Te}from"./ImageWrapper-CfHW59VC.js";var Ee=_({name:`LayoutSeedream`,components:{MagicIcon:L,ElDrawer:E,ElButton:W},mixins:[xe]}),De={class:`main flex flex-row flex-1`},Oe={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)]`},ke={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ae(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,De,[e(`div`,Oe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ke,[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 je=G(Ee,[[`render`,Ae],[`__scopeId`,`data-v-c10167d0`]]),Me=_({name:`SeedreamPromptInput`,components:{PromptTextarea:A},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ne(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 Pe=G(Me,[[`render`,Ne]]),Fe={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 J(e){switch(e){case V:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case U:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case z:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case B:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};default:return Fe}}function Y(e,t){let n=J(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Ie=[`1K`,`2K`,`3K`,`4K`];function X(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=J(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();(Ie.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 Z(e,t,n){let r={...e},i=J(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var Le=_({name:`SeedreamImageInput`,components:{UploadIcon:re,ElUpload:x,ElButton:W,InfoIcon:N,ImagePreview:q},mixins:[_e,ge,me,de],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 J(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){T.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){T.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Re={key:0},ze={class:`field`},Be={class:`label`},Ve={class:`box`},He={class:`title font-bold`},Ue={class:`value`},We={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ge(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ue,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,We,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Ke=G(Le,[[`render`,Ge],[`__scopeId`,`data-v-21f4dd97`]]),qe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:N},data(){return{revertKey:0,options:[{value:V,label:this.$t(`seedream.model.seedream50pro`)},{value:U,label:this.$t(`seedream.model.seedream50`)},{value:z,label:this.$t(`seedream.model.seedream45`)},{value:B,label:this.$t(`seedream.model.seedream40`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){if(this.value&&this.options.some(e=>e.value===this.value))return;let e={...this.$store.state.seedream?.config||{},model:H},t=X(e,{model:H});this.$store.commit(`seedream/setConfig`,Z(e,t,{model:H}))},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=X(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await K.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=Z({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),T.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Je={class:`field`},Ye={class:`label`},Xe={class:`box`},Ze={class:`title font-bold`};function Qe(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var $e=G(qe,[[`render`,Qe],[`__scopeId`,`data-v-bb6a29ab`]]),et=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:N},data(){return{SEEDREAM_SIZE_ADAPTIVE:se,pixelOptions:ae}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return J(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),tt={class:`field`},nt={class:`label`},rt={class:`box`},it={class:`title font-bold`};function at(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`h2`,it,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var ot=G(et,[[`render`,at],[`__scopeId`,`data-v-dd7bd021`]]),st=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),ct={key:0,class:`field`},lt={class:`label`},ut={class:`box`},dt={class:`title font-bold`},ft={class:`value`};function pt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,ct,[e(`div`,lt,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var mt=G(st,[[`render`,pt],[`__scopeId`,`data-v-f079fd20`]]),ht=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:N},data(){return{options:[...oe]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`};function bt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,gt,[e(`div`,_t,[e(`div`,vt,[e(`h2`,yt,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var xt=G(ht,[[`render`,bt],[`__scopeId`,`data-v-69ea4c07`]]),St=_({name:`SeedreamSeedInput`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),Ct={key:0,class:`field`},wt={class:`label`},Tt={class:`box`},Et={class:`title font-bold`},Dt={class:`value`};function Ot(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Ct,[e(`div`,wt,[e(`div`,Tt,[e(`h2`,Et,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Dt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var kt=G(St,[[`render`,Ot],[`__scopeId`,`data-v-10cdc1e0`]]),At=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(this.config?.model).guidanceScale},defaultValue(){return J(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),jt={key:0,class:`field`},Mt={class:`label`},Nt={class:`box`},Pt={class:`title font-bold`},Ft={class:`value`};function It(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`h2`,Pt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Lt=G(At,[[`render`,It],[`__scopeId`,`data-v-7386f064`]]),Q=e=>{let t={...e||{}},n=Y(t.model,t.image);return delete t.action,t.watermark=!1,(n!==`edit`||!t.image?.length)&&delete t.image,t.size||delete t.size,t.sequential_image_generation!==`auto`&&delete t.sequential_image_generation_options,{...t,async:!0}},Rt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:L,ElButton:W,PromptInput:Pe,Consumption:Se,ImageInput:Ke,ModelSelector:$e,SizeSelector:ot,MaxImagesSelector:mt,OutputFormatSelector:xt,SeedInput:kt,GuidanceScaleInput:Lt},emits:[`generate`],computed:{action(){return Y(this.config?.model,this.config?.image)},capabilities(){return J(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=Q(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return fe({...e,action:this.action,model:R(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),zt={class:`flex flex-col h-full`},Bt={class:`flex-1 overflow-y-auto p-5`},Vt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ht(t,n,c,u,d,m){let g=l(`model-selector`),_=l(`size-selector`),v=l(`max-images-selector`),y=l(`output-format-selector`),b=l(`seed-input`),x=l(`guidance-scale-input`),S=l(`prompt-input`),C=l(`image-input`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,zt,[e(`div`,Bt,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),t.capabilities.image?(h(),f(C,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,Vt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(E,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ut=G(Rt,[[`render`,Ht]]),Wt=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:te,ApplicationIcon:O,ChannelIcon:j,ImageIcon:I,InfoIcon:ee,LightningIcon:ie,MagicIcon:L,TimeIcon:k,WarningIcon:ne,CopyToClipboard:ye,ElAlert:C,ImageWrapper:Te,ElButton:W,ElTooltip:S,ImagePreview:q,ApiCodeButton:Ce,ReportButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return Q(this.modelValue?.request)},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await K.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`seedream/deleteTask`,{id:e}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return R(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Gt={class:`preview`},Kt={class:`left`},qt={class:`main`},Jt={class:`bot`},Yt={class:`datetime`},Xt=[`aria-label`],Zt={class:`info`},Qt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},$t={key:1,class:`prompt mt-2`},en={key:0},tn={key:0,class:n({content:!0})},nn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},rn={key:1,class:n({content:!0,failed:!0})},an={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},on={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},pn={key:2,class:`content`},mn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bn={key:3,class:n({content:!0})},xn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Cn(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`time-icon`),w=l(`magic-icon`),T=l(`copy-to-clipboard`),E=l(`el-alert`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`api-code-button`),A=l(`report-button`),j=l(`application-icon`),M=l(`image-icon`),N=l(`lightning-icon`),P=l(`channel-icon`),F=l(`warning-icon`),I=l(`info-icon`);return h(),s(`div`,Gt,[e(`div`,Kt,[a(y,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,qt,[e(`div`,Jt,[a(y,{capability:`seedream`,part:`name`}),e(`span`,Yt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Xt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Zt,[Array.isArray(n.modelValue?.request?.image)&&n.modelValue?.request?.image.length>0?(h(),s(`div`,Qt,[(h(!0),s(c,null,m(n.modelValue?.request?.image,(e,t)=>(h(),f(S,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,$t,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,en,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,rn,[e(`div`,an,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(D,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,on,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(k,{path:`/seedream/images`,body:n.apiRequest},null,8,[`body`]),a(A,{service:`seedream`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(E,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,sn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,cn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,un,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,dn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,fn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,pn,[a(E,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,mn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,hn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,gn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,_n,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(h(),s(`p`,vn,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(T,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(h(),s(`p`,yn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,$,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,bn,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,xn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,tn,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,nn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var wn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Wt,[[`render`,Cn],[`__scopeId`,`data-v-b0055abb`]]),BotPlaceholder:we,NoTasks:P,ScrollList:M},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Tn={key:0},En={key:2,class:`w-full h-full flex items-center justify-center`};function Dn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Tn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,En,[a(v)])):o(``,!0)],64)}var On=_({name:`SeedreamIndex`,components:{ConfigPanel:Ut,Layout:je,RecentPanel:G(wn,[[`render`,Dn]])},mixins:[ve],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===w.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await F({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ce(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;if(J(this.config?.model).imageRequired&&!this.config?.image?.length){T.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=Q(this.config);if(!he())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}T.info(this.$t(`seedream.message.startingTask`)),ue(`seedream`,le.generate(e,{token:t})).then(()=>{T.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?T.error(this.$t(`seedream.message.usedUp`)):T.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function kn(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var An=G(On,[[`render`,kn]]);export{An as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-D1IfJVxx.js";import{t as x}from"./upload-CZTwZIBs.js";import{t as S}from"./tooltip-B5x8_vte.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-C7_NW_4L.js";import{t as E}from"./drawer-C9KSXFM-.js";import{t as D}from"./input-number-Boqx1FHy.js";import{t as O}from"./box-B-0qzjXU.js";import{t as k}from"./clock-BgGjEEpa.js";import{a as A,c as j,n as M,o as N,r as P,t as F}from"./pagination-Cu0HJ57M.js";import{t as I}from"./image-DfORz5aE.js";import{t as ee}from"./info-BJs8f39c.js";import{t as te}from"./trash-2-CraM-w_J.js";import{t as ne}from"./triangle-alert-7hE9H9f5.js";import{t as re}from"./upload-C2clebjh.js";import{t as L}from"./wand-sparkles-BIedQV0b.js";import{t as ie}from"./zap-B0DTyRcM.js";import{An as R,Cn as z,Dn as ae,En as oe,Sn as B,Tn as V,bn as H,kn as se,wn as U}from"./constants-rUWdh_ex.js";import{$t as ce,Bn as le,Ii as W,Nr as ue,O as G,Si as K,Yt as de,an as fe,ci as pe,en as me,mn as he,nn as ge,rn as _e,tn as ve}from"./index-CJnITX6X.js";import{t as ye}from"./CopyToClipboard-DCnv3cNN.js";import{t as be}from"./ReportButton-2XluYbQl.js";import{t as q}from"./ImagePreview-Dn32pgoU.js";import{n as xe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Se}from"./Consumption-DzYByju3.js";import{t as Ce}from"./ApiCodeButton--xcpcOgv.js";import{t as we}from"./BotPlaceholder-BnCggcL5.js";import{t as Te}from"./ImageWrapper-C0qLHiFb.js";var Ee=_({name:`LayoutSeedream`,components:{MagicIcon:L,ElDrawer:E,ElButton:W},mixins:[xe]}),De={class:`main flex flex-row flex-1`},Oe={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)]`},ke={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ae(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,De,[e(`div`,Oe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ke,[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 je=G(Ee,[[`render`,Ae],[`__scopeId`,`data-v-c10167d0`]]),Me=_({name:`SeedreamPromptInput`,components:{PromptTextarea:A},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ne(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 Pe=G(Me,[[`render`,Ne]]),Fe={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 J(e){switch(e){case V:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case U:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case z:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case B:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};default:return Fe}}function Y(e,t){let n=J(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Ie=[`1K`,`2K`,`3K`,`4K`];function X(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=J(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();(Ie.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 Z(e,t,n){let r={...e},i=J(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var Le=_({name:`SeedreamImageInput`,components:{UploadIcon:re,ElUpload:x,ElButton:W,InfoIcon:N,ImagePreview:q},mixins:[_e,ge,me,de],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 J(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){T.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){T.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Re={key:0},ze={class:`field`},Be={class:`label`},Ve={class:`box`},He={class:`title font-bold`},Ue={class:`value`},We={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ge(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ue,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,We,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Ke=G(Le,[[`render`,Ge],[`__scopeId`,`data-v-21f4dd97`]]),qe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:N},data(){return{revertKey:0,options:[{value:V,label:this.$t(`seedream.model.seedream50pro`)},{value:U,label:this.$t(`seedream.model.seedream50`)},{value:z,label:this.$t(`seedream.model.seedream45`)},{value:B,label:this.$t(`seedream.model.seedream40`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){if(this.value&&this.options.some(e=>e.value===this.value))return;let e={...this.$store.state.seedream?.config||{},model:H},t=X(e,{model:H});this.$store.commit(`seedream/setConfig`,Z(e,t,{model:H}))},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=X(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await K.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=Z({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),T.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Je={class:`field`},Ye={class:`label`},Xe={class:`box`},Ze={class:`title font-bold`};function Qe(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var $e=G(qe,[[`render`,Qe],[`__scopeId`,`data-v-bb6a29ab`]]),et=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:N},data(){return{SEEDREAM_SIZE_ADAPTIVE:se,pixelOptions:ae}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return J(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),tt={class:`field`},nt={class:`label`},rt={class:`box`},it={class:`title font-bold`};function at(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`h2`,it,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var ot=G(et,[[`render`,at],[`__scopeId`,`data-v-dd7bd021`]]),st=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),ct={key:0,class:`field`},lt={class:`label`},ut={class:`box`},dt={class:`title font-bold`},ft={class:`value`};function pt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,ct,[e(`div`,lt,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var mt=G(st,[[`render`,pt],[`__scopeId`,`data-v-f079fd20`]]),ht=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:N},data(){return{options:[...oe]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`};function bt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,gt,[e(`div`,_t,[e(`div`,vt,[e(`h2`,yt,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var xt=G(ht,[[`render`,bt],[`__scopeId`,`data-v-69ea4c07`]]),St=_({name:`SeedreamSeedInput`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),Ct={key:0,class:`field`},wt={class:`label`},Tt={class:`box`},Et={class:`title font-bold`},Dt={class:`value`};function Ot(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Ct,[e(`div`,wt,[e(`div`,Tt,[e(`h2`,Et,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Dt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var kt=G(St,[[`render`,Ot],[`__scopeId`,`data-v-10cdc1e0`]]),At=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:D,InfoIcon:N},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return J(this.config?.model).guidanceScale},defaultValue(){return J(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),jt={key:0,class:`field`},Mt={class:`label`},Nt={class:`box`},Pt={class:`title font-bold`},Ft={class:`value`};function It(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`h2`,Pt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Lt=G(At,[[`render`,It],[`__scopeId`,`data-v-7386f064`]]),Q=e=>{let t={...e||{}},n=Y(t.model,t.image);return delete t.action,t.watermark=!1,(n!==`edit`||!t.image?.length)&&delete t.image,t.size||delete t.size,t.sequential_image_generation!==`auto`&&delete t.sequential_image_generation_options,{...t,async:!0}},Rt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:L,ElButton:W,PromptInput:Pe,Consumption:Se,ImageInput:Ke,ModelSelector:$e,SizeSelector:ot,MaxImagesSelector:mt,OutputFormatSelector:xt,SeedInput:kt,GuidanceScaleInput:Lt},emits:[`generate`],computed:{action(){return Y(this.config?.model,this.config?.image)},capabilities(){return J(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=Q(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return fe({...e,action:this.action,model:R(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),zt={class:`flex flex-col h-full`},Bt={class:`flex-1 overflow-y-auto p-5`},Vt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ht(t,n,c,u,d,m){let g=l(`model-selector`),_=l(`size-selector`),v=l(`max-images-selector`),y=l(`output-format-selector`),b=l(`seed-input`),x=l(`guidance-scale-input`),S=l(`prompt-input`),C=l(`image-input`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,zt,[e(`div`,Bt,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),t.capabilities.image?(h(),f(C,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,Vt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(E,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ut=G(Rt,[[`render`,Ht]]),Wt=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:te,ApplicationIcon:O,ChannelIcon:j,ImageIcon:I,InfoIcon:ee,LightningIcon:ie,MagicIcon:L,TimeIcon:k,WarningIcon:ne,CopyToClipboard:ye,ElAlert:C,ImageWrapper:Te,ElButton:W,ElTooltip:S,ImagePreview:q,ApiCodeButton:Ce,ReportButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return Q(this.modelValue?.request)},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await K.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`seedream/deleteTask`,{id:e}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return R(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Gt={class:`preview`},Kt={class:`left`},qt={class:`main`},Jt={class:`bot`},Yt={class:`datetime`},Xt=[`aria-label`],Zt={class:`info`},Qt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},$t={key:1,class:`prompt mt-2`},en={key:0},tn={key:0,class:n({content:!0})},nn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},rn={key:1,class:n({content:!0,failed:!0})},an={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},on={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},pn={key:2,class:`content`},mn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bn={key:3,class:n({content:!0})},xn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Cn(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`time-icon`),w=l(`magic-icon`),T=l(`copy-to-clipboard`),E=l(`el-alert`),D=l(`image-wrapper`),O=l(`el-button`),k=l(`api-code-button`),A=l(`report-button`),j=l(`application-icon`),M=l(`image-icon`),N=l(`lightning-icon`),P=l(`channel-icon`),F=l(`warning-icon`),I=l(`info-icon`);return h(),s(`div`,Gt,[e(`div`,Kt,[a(y,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,qt,[e(`div`,Jt,[a(y,{capability:`seedream`,part:`name`}),e(`span`,Yt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Xt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Zt,[Array.isArray(n.modelValue?.request?.image)&&n.modelValue?.request?.image.length>0?(h(),s(`div`,Qt,[(h(!0),s(c,null,m(n.modelValue?.request?.image,(e,t)=>(h(),f(S,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,$t,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,en,` - (`+i(n.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(h(),s(`div`,rn,[e(`div`,an,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(D,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,on,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(O,{type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(k,{path:`/seedream/images`,body:n.apiRequest},null,8,[`body`]),a(A,{service:`seedream`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(E,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,sn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,cn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,un,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,dn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,fn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,pn,[a(E,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,mn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.model`))+`: `+i(n.shortModel(n.modelValue?.request?.model)),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,hn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),e(`p`,gn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.task`))+`: `+i(n.isEdit?n.$t(`seedream.name.edits`):n.$t(`seedream.name.generate`)),1)]),e(`p`,_n,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(h(),s(`p`,vn,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(T,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),n.modelValue?.elapsed?(h(),s(`p`,yn,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,$,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,bn,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,xn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(T,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,tn,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,nn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`seedream.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(T,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var wn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Wt,[[`render`,Cn],[`__scopeId`,`data-v-b0055abb`]]),BotPlaceholder:we,NoTasks:P,ScrollList:M},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Tn={key:0},En={key:2,class:`w-full h-full flex items-center justify-center`};function Dn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Tn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,En,[a(v)])):o(``,!0)],64)}var On=_({name:`SeedreamIndex`,components:{ConfigPanel:Ut,Layout:je,RecentPanel:G(wn,[[`render`,Dn]])},mixins:[ve],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===w.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await F({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ce(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;if(J(this.config?.model).imageRequired&&!this.config?.image?.length){T.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=Q(this.config);if(!he())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}T.info(this.$t(`seedream.message.startingTask`)),ue(`seedream`,le.generate(e,{token:t})).then(()=>{T.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?T.error(this.$t(`seedream.message.usedUp`)):T.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function kn(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var An=G(On,[[`render`,kn]]);export{An as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,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-BzDGa5m7.js";import{t as x}from"./upload-CaDoepuW.js";import{t as S}from"./tooltip-qTn7nJhY.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-BezwK8kr.js";import{t as E}from"./drawer-C9nReT9E.js";import{t as D}from"./input-number-sRRzJirK.js";import{t as O}from"./switch-MNH0pcC0.js";import{t as k}from"./box-wbHSraQR.js";import{t as A}from"./clock-DEvy_URV.js";import{a as j,c as M,n as N,o as P,r as F,t as I}from"./pagination-Z4NRITpd.js";import{t as ee}from"./image-C3x2yaF9.js";import{t as te}from"./info-VadVQTaW.js";import{t as L}from"./trash-2-C7OqHxci.js";import{t as ne}from"./triangle-alert-D_Ku-290.js";import{t as re}from"./upload-CbQoV27b.js";import{t as R}from"./wand-sparkles-DT_fyyk1.js";import{t as ie}from"./zap-CS_Gx6oy.js";import{Bn as ae,Gn as oe,Kn as z,Ln as B,Mn as V,Nn as H,Pn as U,Rn as W,Un as G,Vn as K,Wn as q,jn as se,zn as ce}from"./constants-CLU-fDDu.js";import{$t as le,Ii as J,Nr as ue,O as Y,Si as de,Vn as X,Yt as fe,an as pe,ci as me,en as he,mn as ge,nn as _e,rn as ve,tn as ye}from"./index-BMhc9ht-.js";import{t as be}from"./CopyToClipboard-Bt9-bdiq.js";import{t as xe}from"./ReportButton-D01Y2fPF.js";import{t as Z}from"./ImagePreview-BEpyCuCR.js";import{n as Se}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Ce}from"./Consumption-CUCdAwJr.js";import{t as we}from"./ApiCodeButton-6BQ24hBr.js";import{t as Te}from"./BotPlaceholder-Cv0cpmLN.js";import{t as Ee}from"./ImageWrapper-CfHW59VC.js";var De=_({name:`LayoutNanobanana`,components:{MagicIcon:R,ElDrawer:E,ElButton:J},mixins:[Se]}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,Oe,[e(`div`,ke,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ae,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=Y(De,[[`render`,je],[`__scopeId`,`data-v-fa2172a6`]]),Ne=_({name:`PromptInput`,components:{PromptTextarea:j},computed:{prompt:{get(){return this.$store.state.openaiimage?.config?.prompt},set(e){this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Pe(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`openaiimage.name.prompt`),info:e.$t(`openaiimage.description.prompt`),placeholder:e.$t(`openaiimage.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Fe=Y(Ne,[[`render`,Pe]]),Ie=_({name:`ImageUrlsInput`,components:{UploadIcon:re,ElUpload:x,ElButton:J,InfoIcon:P,ImagePreview:Z},mixins:[ve,_e,he,fe],data(){return{fileList:[],uploadUrl:me()+`/api/v1/files/`,suppressWatch:!1}},computed:{maxImages(){return 16},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.openaiimage?.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(){T.warning(this.$t(`openaiimage.message.uploadImageExceed`,{count:16}))},onError(){T.error(this.$t(`openaiimage.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.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()}}}),Le={class:`field flex min-h-8 w-full items-center justify-between gap-3`},Re={class:`flex min-w-0 items-center`},ze={class:`title m-0 text-[14px] font-bold`},Be={class:`file-list flex flex-wrap gap-[10px]`};function Ve(t,n,o,u,d,g){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return h(),s(`div`,null,[e(`div`,Le,[e(`div`,Re,[e(`h2`,ze,i(t.$t(`openaiimage.name.imageUrls`)),1),a(_,{content:t.$t(`openaiimage.description.imageUrls`)},null,8,[`content`])]),a(b,{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 shrink-0`,limit:t.maxImages,multiple:!0,"show-file-list":!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(y,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`openaiimage.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Be,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])}var He=Y(Ie,[[`render`,Ve]]),Ue=_({name:`OpenAIImageModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},data(){return{options:[{value:B,label:this.$t(`openaiimage.model.gptImage1`)},{value:W,label:this.$t(`openaiimage.model.gptImage15`)},{value:ce,label:this.$t(`openaiimage.model.gptImage2`)},{value:ae,label:this.$t(`openaiimage.model.gptImage2Official`)}]}},computed:{value:{get(){return this.$store.state.openaiimage?.config?.model},set(e){this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.config,model:e})}},modelDescription(){return this.$t(`openaiimage.description.model`)}},mounted(){this.value||=U}}),We={class:`field`},Ge={class:`label`},Ke={class:`box`},qe={class:`title font-bold`};function Je(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,We,[e(`div`,Ge,[e(`div`,Ke,[e(`h2`,qe,i(t.$t(`openaiimage.name.model`)),1),a(g,{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(`openaiimage.placeholder.select`)},{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,[`modelValue`,`placeholder`])])}var Ye=Y(Ue,[[`render`,Je],[`__scopeId`,`data-v-a42acad4`]]);function Q(e){if(!e)return;let t=/^(\d+)x(\d+)$/.exec(e);if(t)return{w:Number(t[1]),h:Number(t[2])}}var Xe=_({name:`OpenAIImageSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,ElSwitch:O,ElInputNumber:D,InfoIcon:P},data(){return{customMode:!1,customWidth:1024,customHeight:1024}},computed:{model(){return this.$store.state.openaiimage?.config?.model||`gpt-image-2`},storedSize(){return this.$store.state.openaiimage?.config?.size},autoSizeValue(){return z},customSupported(){return H.includes(this.model)},presets(){return K[this.model]??K[`gpt-image-2`]??[]},presetGroups(){return this.model===`gpt-image-2`||this.model===`gpt-image-2:official`?[{label:this.$t(`openaiimage.sizeGroup.standard1k`),options:G},{label:this.$t(`openaiimage.sizeGroup.preset2k`),options:q},{label:this.$t(`openaiimage.sizeGroup.preset4k`),options:oe}]:[{label:this.$t(`openaiimage.sizeGroup.standard1k`),options:this.presets}]},useCustom:{get(){return this.customSupported&&this.customMode},set(e){if(!(e&&!this.customSupported))if(this.customMode=e,e){if(this.customError)return;this.commitSize(`${this.customWidth}x${this.customHeight}`)}else this.commitSize(z)}},presetValue:{get(){let e=this.storedSize;return e&&this.presets.includes(e)?e:this.autoSizeValue},set(e){this.customMode=!1,this.commitSize(e||void 0)}},multiple(){return 16},minSide(){return 256},maxSide(){return se},customError(){let e=this.customWidth,t=this.customHeight;return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?this.$t(`openaiimage.error.customSizePositive`):e%this.multiple!==0||t%this.multiple!==0?this.$t(`openaiimage.error.customSizeMultiple`,{multiple:this.multiple}):e<this.minSide||t<this.minSide?this.$t(`openaiimage.error.customSizeMin`,{min:this.minSide}):Math.max(e,t)>this.maxSide?this.$t(`openaiimage.error.customSizeMax`,{max:this.maxSide}):e*t>8294400?this.$t(`openaiimage.error.customSizePixels`,{pixels:V.toLocaleString()}):``}},watch:{model:{immediate:!1,handler(){this.customSupported||(this.customMode=!1);let e=this.storedSize;if(!e||e===`auto`||this.presets.includes(e))return;let t=Q(e);t&&this.customSupported&&(this.customMode=!0,this.customWidth=t.w,this.customHeight=t.h,!this.customError)||this.commitSize(z)}},storedSize(e){if(!e||e===`auto`){this.customMode=!1;return}if(this.presets.includes(e)){this.customMode=!1;return}let t=Q(e);t&&this.customSupported&&(this.customMode=!0,this.customWidth!==t.w&&(this.customWidth=t.w),this.customHeight!==t.h&&(this.customHeight=t.h))},customWidth(){this.syncCustomToStore()},customHeight(){this.syncCustomToStore()}},mounted(){let e=this.storedSize,t=Q(e);e&&t&&this.customSupported&&!this.presets.includes(e)&&(this.customMode=!0,this.customWidth=t.w,this.customHeight=t.h)},methods:{commitSize(e){let t={...this.$store.state.openaiimage?.config};e?t.size=e:delete t.size,this.$store.commit(`openaiimage/setConfig`,t)},syncCustomToStore(){this.useCustom&&(this.customError||this.commitSize(`${this.customWidth}x${this.customHeight}`))}}}),Ze={class:`resolution`},Qe={class:`field`},$e={class:`label`},et={class:`box`},tt={class:`title font-bold`},nt={class:`field custom-toggle`},rt={class:`label`},it={class:`box`},at={class:`title font-bold`},ot={key:0,class:`custom-inputs`},st={class:`row`},ct={class:`row-label`},lt={class:`row`},ut={class:`row-label`},dt={key:0,class:`error`};function ft(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`),x=l(`el-switch`),S=l(`el-input-number`);return h(),s(`div`,Ze,[e(`div`,Qe,[e(`div`,$e,[e(`div`,et,[e(`h2`,tt,i(t.$t(`openaiimage.name.size`)),1),a(_,{content:t.$t(`openaiimage.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.presetValue,"onUpdate:modelValue":n[0]||=e=>t.presetValue=e,class:`value`,placeholder:t.$t(`openaiimage.placeholder.select`),disabled:t.useCustom},{default:p(()=>[a(v,{label:t.$t(`openaiimage.size.auto`),value:t.autoSizeValue},null,8,[`label`,`value`]),(h(!0),s(c,null,m(t.presetGroups,e=>(h(),f(y,{key:e.label,label:e.label},{default:p(()=>[(h(!0),s(c,null,m(e.options,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])]),t.customSupported?(h(),s(c,{key:0},[e(`div`,nt,[e(`div`,rt,[e(`div`,it,[e(`h2`,at,i(t.$t(`openaiimage.name.customSize`)),1),a(_,{content:t.$t(`openaiimage.description.customSize`),class:`info`},null,8,[`content`])])]),a(x,{modelValue:t.useCustom,"onUpdate:modelValue":n[1]||=e=>t.useCustom=e,class:`value-switch`},null,8,[`modelValue`])]),t.useCustom?(h(),s(`div`,ot,[e(`div`,st,[e(`span`,ct,i(t.$t(`openaiimage.name.width`)),1),a(S,{modelValue:t.customWidth,"onUpdate:modelValue":n[2]||=e=>t.customWidth=e,class:`row-input`,min:t.minSide,max:t.maxSide,step:t.multiple,"step-strictly":!0,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`,`step`])]),e(`div`,lt,[e(`span`,ut,i(t.$t(`openaiimage.name.height`)),1),a(S,{modelValue:t.customHeight,"onUpdate:modelValue":n[3]||=e=>t.customHeight=e,class:`row-input`,min:t.minSide,max:t.maxSide,step:t.multiple,"step-strictly":!0,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`,`step`])]),t.customError?(h(),s(`div`,dt,i(t.customError),1)):o(``,!0)])):o(``,!0)],64)):o(``,!0)])}var pt=_({name:`ConfigPanel`,components:{MagicIcon:R,ElButton:J,PromptInput:Fe,Consumption:Ce,ImageUrlsInput:He,ModelSelector:Ye,ResolutionSelector:Y(Xe,[[`render`,ft],[`__scopeId`,`data-v-22ab23e0`]])},emits:[`generate`],computed:{config(){return this.$store.state.openaiimage?.config},consumption(){return pe({...this.config||{}},this.service?.cost)},service(){return this.$store.state.openaiimage?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),mt={class:`flex flex-col h-full`},ht={class:`flex-1 overflow-y-auto p-5`},gt={class:`flex flex-col items-center justify-center px-5 pb-5`};function _t(t,n,o,c,u,d){let f=l(`model-selector`),m=l(`resolution-selector`),g=l(`prompt-input`),_=l(`image-urls-input`),v=l(`consumption`),y=l(`magic-icon`),b=l(`el-button`);return h(),s(`div`,mt,[e(`div`,ht,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`})]),e(`div`,gt,[a(v,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(b,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`openaiimage.button.generate`)),1)]),_:1},8,[`onClick`])])])}var vt=Y(pt,[[`render`,_t]]),yt=_({name:`TaskPreview`,components:{ApplicationIcon:k,ChannelIcon:M,DeleteIcon:L,ImageIcon:ee,InfoIcon:te,LightningIcon:ie,MagicIcon:R,TimeIcon:A,WarningIcon:ne,CopyToClipboard:be,ElAlert:C,ImageWrapper:Ee,ElButton:J,ElTooltip:S,ImagePreview:Z,ApiCodeButton:we,ReportButton:xe},props:{modelValue:{type:Object,required:!0}},computed:{isEditRequest(){let e=this.modelValue?.request;return this.modelValue?.type===`images_edits`||e?.action===`edit`||this.referenceImages.length>0},showTaskType(){return!!(this.modelValue?.request?.action||this.modelValue?.type||this.referenceImages.length>0)},taskTypeLabel(){return this.isEditRequest?this.$t(`openaiimage.name.edits`):this.$t(`openaiimage.name.generate`)},openaiimagePath(){return this.isEditRequest?`/openai/images/edits`:`/openai/images/generations`},openaiimageCodeBody(){let e=this.modelValue?.request;if(!e)return;let t={...e};if(delete t.action,delete t.callback_url,this.isEditRequest){delete t.image_urls,delete t.image;let e=this.referenceImages;e.length===1?t.image=e[0]:e.length>1&&(t.image=e)}else delete t.image_urls,delete t.image;return t},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{let n=t;if(n?.image_url||n?.url){e.push(n);return}n?.b64_json&&e.push({...n,url:`data:image/png;base64,${n.b64_json}`})}),e},referenceImages(){let e=this.modelValue?.request;if(!e)return[];let t=Array.isArray(e.image_urls)?e.image_urls:[];if(t.length>0)return t.filter(e=>typeof e==`string`&&e.length>0);let n=e.image;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):typeof n==`string`&&n.length>0?[n]:Array.isArray(e.images)?e.images.map(e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`)return e.image_url}).filter(e=>typeof e==`string`&&e.length>0):[]}},methods:{onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.openaiimage?.config||{}};t.image_urls=[e],this.$store.commit(`openaiimage/setConfig`,t)},async onDelete(){let e=this.modelValue?.id;if(e){try{await de.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`openaiimage/deleteTask`,{id:e}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}}}}),bt={class:`preview`},xt={class:`left`},St={class:`main`},Ct={class:`bot`},wt={class:`datetime`},Tt=[`aria-label`],Et={class:`info`},Dt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Ot={key:1,class:`prompt mt-2`},kt={key:0},At={key:0,class:n({content:!0,failed:!0})},jt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},Mt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Nt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={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={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},zt={key:1,class:n({content:!0})},Bt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Vt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ht={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ut={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Gt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Kt={key:2,class:n({content:!0})},qt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Yt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function Zt(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`image-wrapper`),w=l(`el-button`),T=l(`api-code-button`),E=l(`report-button`),D=l(`application-icon`),O=l(`image-icon`),k=l(`lightning-icon`),A=l(`magic-icon`),j=l(`copy-to-clipboard`),M=l(`time-icon`),N=l(`channel-icon`),P=l(`el-alert`),F=l(`warning-icon`),I=l(`info-icon`);return h(),s(`div`,bt,[e(`div`,xt,[a(y,{capability:`openaiimage`,part:`avatar`,class:`avatar`})]),e(`div`,St,[e(`div`,Ct,[a(y,{capability:`openaiimage`,part:`name`}),e(`span`,wt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Tt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Et,[n.referenceImages.length>0?(h(),s(`div`,Dt,[(h(!0),s(c,null,m(n.referenceImages,(e,t)=>(h(),f(S,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,Ot,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,kt,` - (`+i(n.$t(`openaiimage.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,At,[e(`div`,jt,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(C,{key:t,src:e?.image_url||e?.url||``,"raw-src":e?.image_url||e?.url||``},null,8,[`src`,`raw-src`]))),128))]),e(`div`,Mt,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(w,{type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url||n.images?.[0]?.url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(T,{path:n.openaiimagePath,body:n.openaiimageCodeBody},null,8,[`path`,`body`]),a(E,{service:`openaiimage`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(P,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,Nt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,Pt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,Ft,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,It,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Lt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,Rt,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(j,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,zt,[a(P,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,Bt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,$,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,Vt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,Ht,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,Ut,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(j,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Wt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,Gt,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(j,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Kt,[a(P,{closable:!1,class:`info`},{template:p(()=>[n.modelValue?.response?(h(),f(I,{key:1,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(h(),f(M,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),r(` `+i(n.$t(n.modelValue?.response?`openaiimage.name.status`:`openaiimage.status.pending`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,qt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,Jt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,Yt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,Xt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Qt=_({name:`RecentPanel`,components:{TaskPreview:Y(yt,[[`render`,Zt],[`__scopeId`,`data-v-6519c932`]]),BotPlaceholder:Te,NoTasks:F,ScrollList:N},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.openaiimage?.tasks,items:this.$store.state.openaiimage?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),$t={key:0},en={key:2,class:`w-full h-full flex items-center justify-center`};function tn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,$t,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,en,[a(v)])):o(``,!0)],64)}var nn=_({name:`OpenAIImageIndex`,components:{ConfigPanel:vt,Layout:Me,RecentPanel:Y(Qt,[[`render`,tn]])},mixins:[ye],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.openaiimage?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.openaiimage?.status?.getTasks===w.Request},credential(){return this.$store.state.openaiimage?.credential},config(){return this.$store.state.openaiimage?.config},application(){return this.$store.state.openaiimage?.application},tasks(){return this.$store.state.openaiimage?.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 I({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(`openaiimage/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`openaiimage/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(`openaiimage/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!le(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;if(!this.hasText(e.prompt)){T.error(this.$t(`openaiimage.message.promptRequired`));return}e.prompt=e.prompt.trim(),!t&&`image_urls`in e&&delete e.image_urls,e.size||delete e.size;let n={...e,action:`generate`,async:!0},r={action:`edit`,model:e?.model,prompt:e?.prompt,size:e?.size,image_urls:e?.image_urls||[],async:!0};if(!ge())return;let i=this.credential?.token;if(!i){console.error(`no token specified`);return}T.info(this.$t(`openaiimage.message.startingTask`)),ue(`openaiimage`,t?X.edit(r,{token:i}):X.generate(n,{token:i})).then(e=>{console.debug(`task accepted`,e.data?.task_id),T.success(this.$t(`openaiimage.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?T.error(this.$t(`openaiimage.message.usedUp`)):T.error(this.$t(`openaiimage.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function rn(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var an=Y(nn,[[`render`,rn]]);export{an as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,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-D1IfJVxx.js";import{t as x}from"./upload-CZTwZIBs.js";import{t as S}from"./tooltip-B5x8_vte.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-C7_NW_4L.js";import{t as E}from"./drawer-C9KSXFM-.js";import{t as D}from"./input-number-Boqx1FHy.js";import{t as O}from"./switch-rSn1Bn_8.js";import{t as k}from"./box-B-0qzjXU.js";import{t as A}from"./clock-BgGjEEpa.js";import{a as j,c as M,n as N,o as P,r as F,t as I}from"./pagination-Cu0HJ57M.js";import{t as ee}from"./image-DfORz5aE.js";import{t as te}from"./info-BJs8f39c.js";import{t as L}from"./trash-2-CraM-w_J.js";import{t as ne}from"./triangle-alert-7hE9H9f5.js";import{t as re}from"./upload-C2clebjh.js";import{t as R}from"./wand-sparkles-BIedQV0b.js";import{t as ie}from"./zap-B0DTyRcM.js";import{Bn as ae,Gn as oe,Kn as z,Ln as B,Mn as V,Nn as H,Pn as U,Rn as W,Un as G,Vn as K,Wn as q,jn as se,zn as ce}from"./constants-rUWdh_ex.js";import{$t as le,Ii as J,Nr as ue,O as Y,Si as de,Vn as X,Yt as fe,an as pe,ci as me,en as he,mn as ge,nn as _e,rn as ve,tn as ye}from"./index-CJnITX6X.js";import{t as be}from"./CopyToClipboard-DCnv3cNN.js";import{t as xe}from"./ReportButton-2XluYbQl.js";import{t as Z}from"./ImagePreview-Dn32pgoU.js";import{n as Se}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Ce}from"./Consumption-DzYByju3.js";import{t as we}from"./ApiCodeButton--xcpcOgv.js";import{t as Te}from"./BotPlaceholder-BnCggcL5.js";import{t as Ee}from"./ImageWrapper-C0qLHiFb.js";var De=_({name:`LayoutNanobanana`,components:{MagicIcon:R,ElDrawer:E,ElButton:J},mixins:[Se]}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,Oe,[e(`div`,ke,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ae,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=Y(De,[[`render`,je],[`__scopeId`,`data-v-fa2172a6`]]),Ne=_({name:`PromptInput`,components:{PromptTextarea:j},computed:{prompt:{get(){return this.$store.state.openaiimage?.config?.prompt},set(e){this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Pe(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`openaiimage.name.prompt`),info:e.$t(`openaiimage.description.prompt`),placeholder:e.$t(`openaiimage.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Fe=Y(Ne,[[`render`,Pe]]),Ie=_({name:`ImageUrlsInput`,components:{UploadIcon:re,ElUpload:x,ElButton:J,InfoIcon:P,ImagePreview:Z},mixins:[ve,_e,he,fe],data(){return{fileList:[],uploadUrl:me()+`/api/v1/files/`,suppressWatch:!1}},computed:{maxImages(){return 16},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.openaiimage?.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(){T.warning(this.$t(`openaiimage.message.uploadImageExceed`,{count:16}))},onError(){T.error(this.$t(`openaiimage.message.uploadImageError`))},onSetImageUrls(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.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()}}}),Le={class:`field flex min-h-8 w-full items-center justify-between gap-3`},Re={class:`flex min-w-0 items-center`},ze={class:`title m-0 text-[14px] font-bold`},Be={class:`file-list flex flex-wrap gap-[10px]`};function Ve(t,n,o,u,d,g){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return h(),s(`div`,null,[e(`div`,Le,[e(`div`,Re,[e(`h2`,ze,i(t.$t(`openaiimage.name.imageUrls`)),1),a(_,{content:t.$t(`openaiimage.description.imageUrls`)},null,8,[`content`])]),a(b,{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 shrink-0`,limit:t.maxImages,multiple:!0,"show-file-list":!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(y,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`openaiimage.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Be,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])}var He=Y(Ie,[[`render`,Ve]]),Ue=_({name:`OpenAIImageModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},data(){return{options:[{value:B,label:this.$t(`openaiimage.model.gptImage1`)},{value:W,label:this.$t(`openaiimage.model.gptImage15`)},{value:ce,label:this.$t(`openaiimage.model.gptImage2`)},{value:ae,label:this.$t(`openaiimage.model.gptImage2Official`)}]}},computed:{value:{get(){return this.$store.state.openaiimage?.config?.model},set(e){this.$store.commit(`openaiimage/setConfig`,{...this.$store.state.openaiimage?.config,model:e})}},modelDescription(){return this.$t(`openaiimage.description.model`)}},mounted(){this.value||=U}}),We={class:`field`},Ge={class:`label`},Ke={class:`box`},qe={class:`title font-bold`};function Je(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,We,[e(`div`,Ge,[e(`div`,Ke,[e(`h2`,qe,i(t.$t(`openaiimage.name.model`)),1),a(g,{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(`openaiimage.placeholder.select`)},{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,[`modelValue`,`placeholder`])])}var Ye=Y(Ue,[[`render`,Je],[`__scopeId`,`data-v-a42acad4`]]);function Q(e){if(!e)return;let t=/^(\d+)x(\d+)$/.exec(e);if(t)return{w:Number(t[1]),h:Number(t[2])}}var Xe=_({name:`OpenAIImageSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,ElSwitch:O,ElInputNumber:D,InfoIcon:P},data(){return{customMode:!1,customWidth:1024,customHeight:1024}},computed:{model(){return this.$store.state.openaiimage?.config?.model||`gpt-image-2`},storedSize(){return this.$store.state.openaiimage?.config?.size},autoSizeValue(){return z},customSupported(){return H.includes(this.model)},presets(){return K[this.model]??K[`gpt-image-2`]??[]},presetGroups(){return this.model===`gpt-image-2`||this.model===`gpt-image-2:official`?[{label:this.$t(`openaiimage.sizeGroup.standard1k`),options:G},{label:this.$t(`openaiimage.sizeGroup.preset2k`),options:q},{label:this.$t(`openaiimage.sizeGroup.preset4k`),options:oe}]:[{label:this.$t(`openaiimage.sizeGroup.standard1k`),options:this.presets}]},useCustom:{get(){return this.customSupported&&this.customMode},set(e){if(!(e&&!this.customSupported))if(this.customMode=e,e){if(this.customError)return;this.commitSize(`${this.customWidth}x${this.customHeight}`)}else this.commitSize(z)}},presetValue:{get(){let e=this.storedSize;return e&&this.presets.includes(e)?e:this.autoSizeValue},set(e){this.customMode=!1,this.commitSize(e||void 0)}},multiple(){return 16},minSide(){return 256},maxSide(){return se},customError(){let e=this.customWidth,t=this.customHeight;return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?this.$t(`openaiimage.error.customSizePositive`):e%this.multiple!==0||t%this.multiple!==0?this.$t(`openaiimage.error.customSizeMultiple`,{multiple:this.multiple}):e<this.minSide||t<this.minSide?this.$t(`openaiimage.error.customSizeMin`,{min:this.minSide}):Math.max(e,t)>this.maxSide?this.$t(`openaiimage.error.customSizeMax`,{max:this.maxSide}):e*t>8294400?this.$t(`openaiimage.error.customSizePixels`,{pixels:V.toLocaleString()}):``}},watch:{model:{immediate:!1,handler(){this.customSupported||(this.customMode=!1);let e=this.storedSize;if(!e||e===`auto`||this.presets.includes(e))return;let t=Q(e);t&&this.customSupported&&(this.customMode=!0,this.customWidth=t.w,this.customHeight=t.h,!this.customError)||this.commitSize(z)}},storedSize(e){if(!e||e===`auto`){this.customMode=!1;return}if(this.presets.includes(e)){this.customMode=!1;return}let t=Q(e);t&&this.customSupported&&(this.customMode=!0,this.customWidth!==t.w&&(this.customWidth=t.w),this.customHeight!==t.h&&(this.customHeight=t.h))},customWidth(){this.syncCustomToStore()},customHeight(){this.syncCustomToStore()}},mounted(){let e=this.storedSize,t=Q(e);e&&t&&this.customSupported&&!this.presets.includes(e)&&(this.customMode=!0,this.customWidth=t.w,this.customHeight=t.h)},methods:{commitSize(e){let t={...this.$store.state.openaiimage?.config};e?t.size=e:delete t.size,this.$store.commit(`openaiimage/setConfig`,t)},syncCustomToStore(){this.useCustom&&(this.customError||this.commitSize(`${this.customWidth}x${this.customHeight}`))}}}),Ze={class:`resolution`},Qe={class:`field`},$e={class:`label`},et={class:`box`},tt={class:`title font-bold`},nt={class:`field custom-toggle`},rt={class:`label`},it={class:`box`},at={class:`title font-bold`},ot={key:0,class:`custom-inputs`},st={class:`row`},ct={class:`row-label`},lt={class:`row`},ut={class:`row-label`},dt={key:0,class:`error`};function ft(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`),x=l(`el-switch`),S=l(`el-input-number`);return h(),s(`div`,Ze,[e(`div`,Qe,[e(`div`,$e,[e(`div`,et,[e(`h2`,tt,i(t.$t(`openaiimage.name.size`)),1),a(_,{content:t.$t(`openaiimage.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.presetValue,"onUpdate:modelValue":n[0]||=e=>t.presetValue=e,class:`value`,placeholder:t.$t(`openaiimage.placeholder.select`),disabled:t.useCustom},{default:p(()=>[a(v,{label:t.$t(`openaiimage.size.auto`),value:t.autoSizeValue},null,8,[`label`,`value`]),(h(!0),s(c,null,m(t.presetGroups,e=>(h(),f(y,{key:e.label,label:e.label},{default:p(()=>[(h(!0),s(c,null,m(e.options,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`])]),t.customSupported?(h(),s(c,{key:0},[e(`div`,nt,[e(`div`,rt,[e(`div`,it,[e(`h2`,at,i(t.$t(`openaiimage.name.customSize`)),1),a(_,{content:t.$t(`openaiimage.description.customSize`),class:`info`},null,8,[`content`])])]),a(x,{modelValue:t.useCustom,"onUpdate:modelValue":n[1]||=e=>t.useCustom=e,class:`value-switch`},null,8,[`modelValue`])]),t.useCustom?(h(),s(`div`,ot,[e(`div`,st,[e(`span`,ct,i(t.$t(`openaiimage.name.width`)),1),a(S,{modelValue:t.customWidth,"onUpdate:modelValue":n[2]||=e=>t.customWidth=e,class:`row-input`,min:t.minSide,max:t.maxSide,step:t.multiple,"step-strictly":!0,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`,`step`])]),e(`div`,lt,[e(`span`,ut,i(t.$t(`openaiimage.name.height`)),1),a(S,{modelValue:t.customHeight,"onUpdate:modelValue":n[3]||=e=>t.customHeight=e,class:`row-input`,min:t.minSide,max:t.maxSide,step:t.multiple,"step-strictly":!0,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`,`step`])]),t.customError?(h(),s(`div`,dt,i(t.customError),1)):o(``,!0)])):o(``,!0)],64)):o(``,!0)])}var pt=_({name:`ConfigPanel`,components:{MagicIcon:R,ElButton:J,PromptInput:Fe,Consumption:Ce,ImageUrlsInput:He,ModelSelector:Ye,ResolutionSelector:Y(Xe,[[`render`,ft],[`__scopeId`,`data-v-22ab23e0`]])},emits:[`generate`],computed:{config(){return this.$store.state.openaiimage?.config},consumption(){return pe({...this.config||{}},this.service?.cost)},service(){return this.$store.state.openaiimage?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),mt={class:`flex flex-col h-full`},ht={class:`flex-1 overflow-y-auto p-5`},gt={class:`flex flex-col items-center justify-center px-5 pb-5`};function _t(t,n,o,c,u,d){let f=l(`model-selector`),m=l(`resolution-selector`),g=l(`prompt-input`),_=l(`image-urls-input`),v=l(`consumption`),y=l(`magic-icon`),b=l(`el-button`);return h(),s(`div`,mt,[e(`div`,ht,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`})]),e(`div`,gt,[a(v,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(b,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`openaiimage.button.generate`)),1)]),_:1},8,[`onClick`])])])}var vt=Y(pt,[[`render`,_t]]),yt=_({name:`TaskPreview`,components:{ApplicationIcon:k,ChannelIcon:M,DeleteIcon:L,ImageIcon:ee,InfoIcon:te,LightningIcon:ie,MagicIcon:R,TimeIcon:A,WarningIcon:ne,CopyToClipboard:be,ElAlert:C,ImageWrapper:Ee,ElButton:J,ElTooltip:S,ImagePreview:Z,ApiCodeButton:we,ReportButton:xe},props:{modelValue:{type:Object,required:!0}},computed:{isEditRequest(){let e=this.modelValue?.request;return this.modelValue?.type===`images_edits`||e?.action===`edit`||this.referenceImages.length>0},showTaskType(){return!!(this.modelValue?.request?.action||this.modelValue?.type||this.referenceImages.length>0)},taskTypeLabel(){return this.isEditRequest?this.$t(`openaiimage.name.edits`):this.$t(`openaiimage.name.generate`)},openaiimagePath(){return this.isEditRequest?`/openai/images/edits`:`/openai/images/generations`},openaiimageCodeBody(){let e=this.modelValue?.request;if(!e)return;let t={...e};if(delete t.action,delete t.callback_url,this.isEditRequest){delete t.image_urls,delete t.image;let e=this.referenceImages;e.length===1?t.image=e[0]:e.length>1&&(t.image=e)}else delete t.image_urls,delete t.image;return t},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{let n=t;if(n?.image_url||n?.url){e.push(n);return}n?.b64_json&&e.push({...n,url:`data:image/png;base64,${n.b64_json}`})}),e},referenceImages(){let e=this.modelValue?.request;if(!e)return[];let t=Array.isArray(e.image_urls)?e.image_urls:[];if(t.length>0)return t.filter(e=>typeof e==`string`&&e.length>0);let n=e.image;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):typeof n==`string`&&n.length>0?[n]:Array.isArray(e.images)?e.images.map(e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`)return e.image_url}).filter(e=>typeof e==`string`&&e.length>0):[]}},methods:{onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.openaiimage?.config||{}};t.image_urls=[e],this.$store.commit(`openaiimage/setConfig`,t)},async onDelete(){let e=this.modelValue?.id;if(e){try{await de.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`openaiimage/deleteTask`,{id:e}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.error(this.$t(`common.message.deleteTaskFailed`))}}}}}),bt={class:`preview`},xt={class:`left`},St={class:`main`},Ct={class:`bot`},wt={class:`datetime`},Tt=[`aria-label`],Et={class:`info`},Dt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},Ot={key:1,class:`prompt mt-2`},kt={key:0},At={key:0,class:n({content:!0,failed:!0})},jt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},Mt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Nt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={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={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},zt={key:1,class:n({content:!0})},Bt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Vt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ht={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ut={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Wt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Gt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Kt={key:2,class:n({content:!0})},qt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Jt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Yt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Xt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function Zt(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`image-wrapper`),w=l(`el-button`),T=l(`api-code-button`),E=l(`report-button`),D=l(`application-icon`),O=l(`image-icon`),k=l(`lightning-icon`),A=l(`magic-icon`),j=l(`copy-to-clipboard`),M=l(`time-icon`),N=l(`channel-icon`),P=l(`el-alert`),F=l(`warning-icon`),I=l(`info-icon`);return h(),s(`div`,bt,[e(`div`,xt,[a(y,{capability:`openaiimage`,part:`avatar`,class:`avatar`})]),e(`div`,St,[e(`div`,Ct,[a(y,{capability:`openaiimage`,part:`name`}),e(`span`,wt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Tt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Et,[n.referenceImages.length>0?(h(),s(`div`,Dt,[(h(!0),s(c,null,m(n.referenceImages,(e,t)=>(h(),f(S,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,Ot,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,kt,` - (`+i(n.$t(`openaiimage.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,At,[e(`div`,jt,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(C,{key:t,src:e?.image_url||e?.url||``,"raw-src":e?.image_url||e?.url||``},null,8,[`src`,`raw-src`]))),128))]),e(`div`,Mt,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(w,{type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=t(e=>n.onEdit(n.images?.[0]?.image_url||n.images?.[0]?.url),[`stop`])},{default:p(()=>[r(i(n.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(T,{path:n.openaiimagePath,body:n.openaiimageCodeBody},null,8,[`path`,`body`]),a(E,{service:`openaiimage`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])]),a(P,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,Nt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,Pt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,Ft,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,It,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Lt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,Rt,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(j,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(h(),s(`div`,zt,[a(P,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.failure`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,Bt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,$,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,Vt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,Ht,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,Ut,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(j,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Wt,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(h(),s(`p`,Gt,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(j,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Kt,[a(P,{closable:!1,class:`info`},{template:p(()=>[n.modelValue?.response?(h(),f(I,{key:1,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):(h(),f(M,{key:0,class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),r(` `+i(n.$t(n.modelValue?.response?`openaiimage.name.status`:`openaiimage.status.pending`)),1)]),default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,qt,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.size?(h(),s(`p`,Jt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.size`))+`: `+i(n.modelValue?.request?.size),1)])):o(``,!0),n.showTaskType?(h(),s(`p`,Yt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.task`))+`: `+i(n.taskTypeLabel),1)])):o(``,!0),e(`p`,Xt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Qt=_({name:`RecentPanel`,components:{TaskPreview:Y(yt,[[`render`,Zt],[`__scopeId`,`data-v-6519c932`]]),BotPlaceholder:Te,NoTasks:F,ScrollList:N},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.openaiimage?.tasks,items:this.$store.state.openaiimage?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),$t={key:0},en={key:2,class:`w-full h-full flex items-center justify-center`};function tn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,$t,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,en,[a(v)])):o(``,!0)],64)}var nn=_({name:`OpenAIImageIndex`,components:{ConfigPanel:vt,Layout:Me,RecentPanel:Y(Qt,[[`render`,tn]])},mixins:[ye],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.openaiimage?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.openaiimage?.status?.getTasks===w.Request},credential(){return this.$store.state.openaiimage?.credential},config(){return this.$store.state.openaiimage?.config},application(){return this.$store.state.openaiimage?.application},tasks(){return this.$store.state.openaiimage?.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 I({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(`openaiimage/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`openaiimage/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(`openaiimage/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!le(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;if(!this.hasText(e.prompt)){T.error(this.$t(`openaiimage.message.promptRequired`));return}e.prompt=e.prompt.trim(),!t&&`image_urls`in e&&delete e.image_urls,e.size||delete e.size;let n={...e,action:`generate`,async:!0},r={action:`edit`,model:e?.model,prompt:e?.prompt,size:e?.size,image_urls:e?.image_urls||[],async:!0};if(!ge())return;let i=this.credential?.token;if(!i){console.error(`no token specified`);return}T.info(this.$t(`openaiimage.message.startingTask`)),ue(`openaiimage`,t?X.edit(r,{token:i}):X.generate(n,{token:i})).then(e=>{console.debug(`task accepted`,e.data?.task_id),T.success(this.$t(`openaiimage.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?T.error(this.$t(`openaiimage.message.usedUp`)):T.error(this.$t(`openaiimage.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function rn(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var an=Y(nn,[[`render`,rn]]);export{an as default};