@acedatacloud/nexior 3.329.27 → 3.329.28

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 (234) hide show
  1. package/dist/assets/{ApiCodeButton-CbZLUqWT.js → ApiCodeButton-DpqfYFPA.js} +1 -1
  2. package/dist/assets/{Artifacts-Chvkgamy.js → Artifacts-B52QC4aa.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-BuRuSjbr.js → AskUserQuestionCard-CSk8RJbT.js} +1 -1
  4. package/dist/assets/{AudioPreview-t34MHY1X.js → AudioPreview-Ca9vMJMx.js} +1 -1
  5. package/dist/assets/{Auth-DZ-ugjEm.js → Auth-CrfVusAW.js} +1 -1
  6. package/dist/assets/{Bare-CVAM5zEs.js → Bare-BlaV2wHm.js} +1 -1
  7. package/dist/assets/{BotPlaceholder-HnC2WR5J.js → BotPlaceholder-CsTEWhRD.js} +1 -1
  8. package/dist/assets/{BottomFooter-B1gZpsWK.js → BottomFooter-B8grmkqX.js} +1 -1
  9. package/dist/assets/{Callback-C3Weay2s.js → Callback-CTWXlJ-J.js} +1 -1
  10. package/dist/assets/{CodeSnippet-zpA8z4M_.js → CodeSnippet-HB8uHfXK.js} +1 -1
  11. package/dist/assets/{Console-Cn8Xx0ed.js → Console-BvPPJdx6.js} +1 -1
  12. package/dist/assets/{Consumption-Byvcpogq.js → Consumption-Dr3zhOGS.js} +1 -1
  13. package/dist/assets/{Conversation-Cgalh2Xr.js → Conversation-C2LKeHi7.js} +1 -1
  14. package/dist/assets/{Conversation-DS-SAPI-.js → Conversation-v0Wi1-zs.js} +1 -1
  15. package/dist/assets/{CopyToClipboard-CMiMmisS.js → CopyToClipboard-BMIKPJkS.js} +1 -1
  16. package/dist/assets/{Detail-CJwEkPQE.js → Detail-DI558NK9.js} +2 -2
  17. package/dist/assets/{Extra-DqL_WU8l.js → Extra-BT2KwxPf.js} +1 -1
  18. package/dist/assets/{FilePreview-Bc3RJz-d.js → FilePreview-C-GEywkR.js} +1 -1
  19. package/dist/assets/{Hailuo-TngjeGp5.js → Hailuo-Ca1zX6oC.js} +1 -1
  20. package/dist/assets/{History-NtAyP2vP.js → History-CTunya2R.js} +1 -1
  21. package/dist/assets/{ImagePreview-BjSo9spH.js → ImagePreview-DQ9FtwGn.js} +1 -1
  22. package/dist/assets/{ImageWrapper-DbMM6MID.js → ImageWrapper-0UgdGlmm.js} +1 -1
  23. package/dist/assets/{Index-C5Rbuqvt.js → Index-3M8SzxF6.js} +1 -1
  24. package/dist/assets/{Index-DCP2o6oM.js → Index-BKngWTcf.js} +1 -1
  25. package/dist/assets/Index-BMFkvW4F.js +1 -0
  26. package/dist/assets/{Index-C1RxZl2p.js → Index-BRQa3Pz6.js} +1 -1
  27. package/dist/assets/{Index-Bawc26Rz.js → Index-BVIIMfrO.js} +1 -1
  28. package/dist/assets/{Index-BtN73Su-.js → Index-BY0RC3x_.js} +1 -1
  29. package/dist/assets/{Index-UZQ9Snis.js → Index-Ba0V2134.js} +1 -1
  30. package/dist/assets/{Index-DTbh7YXB.js → Index-BeAWQ82x.js} +1 -1
  31. package/dist/assets/{Index-DYmXOkwP.js → Index-BmEkFJE2.js} +1 -1
  32. package/dist/assets/{Index-Dnkgxcl7.js → Index-Bvwr0wpt.js} +1 -1
  33. package/dist/assets/{Index-2BHiRzfi.js → Index-C1JbZNSa.js} +1 -1
  34. package/dist/assets/{Index-DPMb4QS2.js → Index-CGRgwbda.js} +1 -1
  35. package/dist/assets/{Index-CSLOyNE_.js → Index-CknUiPPk.js} +1 -1
  36. package/dist/assets/Index-Csytn7C2.js +1 -0
  37. package/dist/assets/{Index-B_05L791.js → Index-CxXs5u37.js} +1 -1
  38. package/dist/assets/{Index-BUCFZJmS.js → Index-D-3u5Ugq.js} +1 -1
  39. package/dist/assets/{Index-D-jh6suG.js → Index-D4oLVEMM.js} +1 -1
  40. package/dist/assets/{Index-D7jKV_ZK.js → Index-D9WwCV3E.js} +1 -1
  41. package/dist/assets/{Index-DOT4Hkl_.js → Index-DICsANSh.js} +1 -1
  42. package/dist/assets/{Index-DWAvFo2d.js → Index-DJ4blkZt.js} +1 -1
  43. package/dist/assets/{Index-BeG-oZzP.js → Index-DQ1IHLvi.js} +1 -1
  44. package/dist/assets/{Index-DwozO2xY.js → Index-DSFZSzK1.js} +1 -1
  45. package/dist/assets/{Index-CWfdrTdD.css → Index-DkHadGVw.css} +1 -1
  46. package/dist/assets/{Index-nMcSjZEH.js → Index-Dq398c1B.js} +1 -1
  47. package/dist/assets/{Index-16lRcFkO.js → Index-DrwWYmx1.js} +1 -1
  48. package/dist/assets/{Index-DDg32mh2.js → Index-SPuU2rKa.js} +1 -1
  49. package/dist/assets/{Index-BS7nHzcA.js → Index-W0tro8sI.js} +1 -1
  50. package/dist/assets/{Index-D5uwpezH.js → Index-WFWUXVMy.js} +1 -1
  51. package/dist/assets/{Index-uwC7aIfr.js → Index-kW-768-k.js} +1 -1
  52. package/dist/assets/{Index-hsoWM_bm.js → Index-orodVENg.js} +1 -1
  53. package/dist/assets/{Index-C77fdGjX.css → Index-rEmRBC9C.css} +1 -1
  54. package/dist/assets/{Invitees-Bew2QtpH.js → Invitees-CaYgyPTK.js} +1 -1
  55. package/dist/assets/{List-22CiGNPU.js → List-CPgqbMRj.js} +1 -1
  56. package/dist/assets/{List-iu_F5Zd_.js → List-DX4jfV7y.js} +1 -1
  57. package/dist/assets/{List-Bste7J8J.js → List-KTzJU8uL.js} +1 -1
  58. package/dist/assets/{LocalTools-CVyUE98T.js → LocalTools-Cd_cIzBu.js} +1 -1
  59. package/dist/assets/{LocalTools-C7Nn1thu.js → LocalTools-RuL42MO7.js} +1 -1
  60. package/dist/assets/{Main-B6aDqobB.js → Main-Cnlbb22m.js} +1 -1
  61. package/dist/assets/{Message-CDOsw4dj.js → Message-CRsmheDV.js} +1 -1
  62. package/dist/assets/{Model-NQ0hmVc0.js → Model-o_cUzCLu.js} +1 -1
  63. package/dist/assets/{Navigator-DTi99yI1.js → Navigator-CnN5roew.js} +3 -3
  64. package/dist/assets/{NotFound-CAEk1nwS.js → NotFound-C_yvKJ01.js} +1 -1
  65. package/dist/assets/{Pay-1V6xxD2-.js → Pay-B3NpCv0R.js} +1 -1
  66. package/dist/assets/{Player-DVwQKYQ5.js → Player-3HDcDI8P.js} +1 -1
  67. package/dist/assets/{PromptTextarea-Dhj4WJey.js → PromptTextarea-V8KSdVr_.js} +1 -1
  68. package/dist/assets/{RealtimeCall-3WMhkP5q.js → RealtimeCall-BalXBwqa.js} +1 -1
  69. package/dist/assets/{ScheduledTasks-DNNoIDHv.js → ScheduledTasks-Ahs1aZo4.js} +1 -1
  70. package/dist/assets/{Status-Bgf1q1s1.js → Status-DwbuyNjU.js} +1 -1
  71. package/dist/assets/{Subscribe-3OdKPYKO.js → Subscribe-Cvtmv5xz.js} +1 -1
  72. package/dist/assets/{TabSwitcher-DoWJlQlV.js → TabSwitcher-gTEnbM7j.js} +1 -1
  73. package/dist/assets/{Tts-Br6aclCA.js → Tts-JkpFzH1d.js} +1 -1
  74. package/dist/assets/{VideoPlayer-C-TSeOkk.js → VideoPlayer-C3zj9i45.js} +1 -1
  75. package/dist/assets/{alert-B8xKY_cZ.js → alert-FLPzVn5V.js} +1 -1
  76. package/dist/assets/arrow-down-DvkiHxu5.js +1 -0
  77. package/dist/assets/{arrow-down-wide-narrow-DzdoiI9L.js → arrow-down-wide-narrow-XS8RsnyW.js} +1 -1
  78. package/dist/assets/arrow-left-CWtzOXc5.js +1 -0
  79. package/dist/assets/arrow-right-C5V9z_3v.js +1 -0
  80. package/dist/assets/arrow-up-4cNWiTGO.js +1 -0
  81. package/dist/assets/{avatar-BbkcCX2P.js → avatar-RBqvNXZT.js} +1 -1
  82. package/dist/assets/{basic-2CeDYHhH.js → basic-BAlam-qd.js} +1 -1
  83. package/dist/assets/{box-BQZFgJhA.js → box-CBQ3Qg4z.js} +1 -1
  84. package/dist/assets/{boxes-BNL0DDxl.js → boxes-BCNKqEkp.js} +1 -1
  85. package/dist/assets/{brain-Bk4dnx_k.js → brain-CG4vKEAW.js} +1 -1
  86. package/dist/assets/{chart-no-axes-combined-CiEYEEGq.js → chart-no-axes-combined-CRTI4XCa.js} +1 -1
  87. package/dist/assets/{chat-BMxhddIF.js → chat-DYLU1NSP.js} +1 -1
  88. package/dist/assets/check-BymUI0Pz.js +1 -0
  89. package/dist/assets/chevron-down-C3AeAtZC.js +1 -0
  90. package/dist/assets/chevron-right-BUSHRa7K.js +1 -0
  91. package/dist/assets/circle-check-RzFC3CQX.js +1 -0
  92. package/dist/assets/clock-BGDVOm2I.js +1 -0
  93. package/dist/assets/{codingBridge-CebQStfH.js → codingBridge-BRhFuYlk.js} +1 -1
  94. package/dist/assets/{codingBridgeNotify-Bgs35h3e.js → codingBridgeNotify-DlQHzK2j.js} +2 -2
  95. package/dist/assets/{coins-B-lUTm64.js → coins-BPX9AJmF.js} +1 -1
  96. package/dist/assets/{collapse-DLomRoFE.js → collapse-Cl5wZwzX.js} +1 -1
  97. package/dist/assets/{createTaskActions-Bma6TaWY.js → createTaskActions-CFk2G0BS.js} +1 -1
  98. package/dist/assets/{digitalhuman-CRouEcai.js → digitalhuman-JSV6j8F8.js} +1 -1
  99. package/dist/assets/{dollar-sign-D30nvB9I.js → dollar-sign-BKUTHli2.js} +1 -1
  100. package/dist/assets/{download-Ct2jPsJB.js → download-CyMiSpiB.js} +1 -1
  101. package/dist/assets/{drawer-B3YqI23b.js → drawer-D2zF1fRK.js} +1 -1
  102. package/dist/assets/{dropdown-CMqex_tL.js → dropdown-DLOHY4b1.js} +1 -1
  103. package/dist/assets/{dropdown-B9g7G6sW.js → dropdown-PHAZtR5Y.js} +1 -1
  104. package/dist/assets/{ellipsis-D6zla1fr.js → ellipsis-DG1A5C3o.js} +1 -1
  105. package/dist/assets/{esm-BGdJcoMp.js → esm-2jNEyQP5.js} +1 -1
  106. package/dist/assets/esm-BJeXEI0M.js +1 -0
  107. package/dist/assets/{esm-BB-hiidi.js → esm-BWMbmW7K.js} +1 -1
  108. package/dist/assets/{esm-B_EbPprO.js → esm-CFVMbqUp.js} +3 -3
  109. package/dist/assets/{esm-TWPziMtX.js → esm-CRMdrkg8.js} +1 -1
  110. package/dist/assets/{esm-B7uCI6Jo.js → esm-D2PRUQPH.js} +2 -2
  111. package/dist/assets/{esm-GP8JDzz3.js → esm-GvtagVvC.js} +2 -2
  112. package/dist/assets/{external-link-DdjcySYE.js → external-link-eDjJyuOF.js} +1 -1
  113. package/dist/assets/{eye-ChXnBYFt.js → eye-oqIQhLcx.js} +1 -1
  114. package/dist/assets/{file-output-B4IbqxGY.js → file-output-D1RQA7qR.js} +1 -1
  115. package/dist/assets/{file-text-C6haQUUh.js → file-text-IzTysbAp.js} +1 -1
  116. package/dist/assets/{fish-BA7waa57.js → fish-eI_uzp2m.js} +1 -1
  117. package/dist/assets/{flux-B3E9NRsX.js → flux-5Mr7WBBV.js} +1 -1
  118. package/dist/assets/{folder-oTpycFS0.js → folder-BnjZK5cx.js} +1 -1
  119. package/dist/assets/gauge-RDr7KHqH.js +1 -0
  120. package/dist/assets/{globe-DoXOBwuI.js → globe-CqQTSoXF.js} +1 -1
  121. package/dist/assets/{grokvideo-D3_p-TUq.js → grokvideo-qh1AT4-F.js} +1 -1
  122. package/dist/assets/{hailuo-C5DAJEFe.js → hailuo-BKrgQaQG.js} +1 -1
  123. package/dist/assets/{hash-CC5NzWfo.js → hash-DoI4RrAO.js} +1 -1
  124. package/dist/assets/{headphones-CV5rXd3Z.js → headphones-CHPeUHp3.js} +1 -1
  125. package/dist/assets/{history-DbnTb1x_.js → history-XVGaeVo-.js} +1 -1
  126. package/dist/assets/{image-OOgYSkAt.js → image-D48Xnk8e.js} +1 -1
  127. package/dist/assets/{index-D2CNFRRj.css → index-Cfewjxc5.css} +1 -1
  128. package/dist/assets/{index-BFeCxAir.js → index-ZJhysbj9.js} +3 -3
  129. package/dist/assets/{index.browser.esm-DQaRfXoI.js → index.browser.esm-d1sfkULD.js} +1 -1
  130. package/dist/assets/{index.es-Cw8I3uag.js → index.es-Bb6IyoMU.js} +1 -1
  131. package/dist/assets/{info-C2D_XeJh.js → info-BxHKDQkc.js} +1 -1
  132. package/dist/assets/{input-number-ColumRcM.js → input-number-BRjaLilb.js} +1 -1
  133. package/dist/assets/{key-round-Dtae8UvU.js → key-round-DR2CKlEk.js} +1 -1
  134. package/dist/assets/{kling-Bu5USCbc.js → kling-XZfytUij.js} +1 -1
  135. package/dist/assets/{languages-DDAFwTLw.js → languages-Dri1LKgi.js} +1 -1
  136. package/dist/assets/{laptop-lfNEIupT.js → laptop-C9KaTJr4.js} +1 -1
  137. package/dist/assets/{lightbulb-CFYGFGVT.js → lightbulb-BAYVr2Zp.js} +1 -1
  138. package/dist/assets/{link-CuToP8s_.js → link-D8t1pXCj.js} +1 -1
  139. package/dist/assets/loader-circle-B6MkJY43.js +1 -0
  140. package/dist/assets/{luma-DGwmVnfX.js → luma-BBjQuqLY.js} +1 -1
  141. package/dist/assets/{maestro-Bx5he5Oq.js → maestro-BQyVEwsU.js} +1 -1
  142. package/dist/assets/{mail-_s2rPJZJ.js → mail-C1YQYOif.js} +1 -1
  143. package/dist/assets/{message-circle-BDB6M5Bo.js → message-circle-BPVMpzgL.js} +1 -1
  144. package/dist/assets/{mic-D59HeE8Q.js → mic-XKZFITG1.js} +1 -1
  145. package/dist/assets/{midjourney-DXV9B6lW.js → midjourney-DcuiqHo9.js} +1 -1
  146. package/dist/assets/{mobileLocalExec-DJwJ4f1Q.js → mobileLocalExec-BrH47sIm.js} +2 -2
  147. package/dist/assets/{mouse-pointer-2-BnxCg9Pc.js → mouse-pointer-2-DKhaiEdB.js} +1 -1
  148. package/dist/assets/music-2-Dl5_PQsX.js +1 -0
  149. package/dist/assets/{nanobanana-ZmCx9HIE.js → nanobanana-BAGlAk7M.js} +1 -1
  150. package/dist/assets/{omni-DMr56bKh.js → omni-DUoQ0uO5.js} +1 -1
  151. package/dist/assets/{openaiimage-BUuMHQtZ.js → openaiimage-BKEOm6H-.js} +1 -1
  152. package/dist/assets/{pagination-hXYdo7XR.js → pagination-BdkLCKvX.js} +1 -1
  153. package/dist/assets/{pagination-CB3471Sj.js → pagination-CfluQtNV.js} +1 -1
  154. package/dist/assets/{palette-BRHvysMf.js → palette-D01_dREY.js} +1 -1
  155. package/dist/assets/{paperclip-Bgm9ZPGF.js → paperclip-ktAidlRa.js} +1 -1
  156. package/dist/assets/{pause-KEZ__Cmx.js → pause-NsboEH_W.js} +1 -1
  157. package/dist/assets/{pencil-LuRVBNP-.js → pencil-B-VeDrH-.js} +1 -1
  158. package/dist/assets/{pika-kjOU525t.js → pika-BUW8vBob.js} +1 -1
  159. package/dist/assets/{pixverse-CtfsUojl.js → pixverse-Dawe8xnu.js} +1 -1
  160. package/dist/assets/play-BCEODzA0.js +1 -0
  161. package/dist/assets/plus-BclYXndj.js +1 -0
  162. package/dist/assets/{popover-CWDn0Yqb.js → popover-B8iGB2sr.js} +1 -1
  163. package/dist/assets/{producer-BDvSXhJH.js → producer-DrosaZGh.js} +1 -1
  164. package/dist/assets/{qrart-Bt7gaBIi.js → qrart-DiaX5w9R.js} +1 -1
  165. package/dist/assets/{realtime-81cc0bWI.js → realtime-JKOlw7z4.js} +1 -1
  166. package/dist/assets/{refresh-cw-DZq5AcuC.js → refresh-cw-Clz-T3zl.js} +1 -1
  167. package/dist/assets/rotate-ccw-C4YzzErf.js +1 -0
  168. package/dist/assets/rotate-cw-3N-m-MYl.js +1 -0
  169. package/dist/assets/{row-B1TJrqsS.js → row-DYpFUG-j.js} +1 -1
  170. package/dist/assets/search-BBIX8c2K.js +1 -0
  171. package/dist/assets/{seedance-CLMnr6zL.js → seedance-Bdh6w0mV.js} +1 -1
  172. package/dist/assets/{seedream-D5C_qxfy.js → seedream-B2kgKmKr.js} +1 -1
  173. package/dist/assets/{select-DT9RB41V.js → select-DkUAUy_k.js} +1 -1
  174. package/dist/assets/{serp-DFkO5g8g.js → serp-CWvIWSrO.js} +1 -1
  175. package/dist/assets/{shield-C4oR8VO2.js → shield-CxwjvOym.js} +1 -1
  176. package/dist/assets/{shuffle-YFtZhmWN.js → shuffle-CyYMq0XJ.js} +1 -1
  177. package/dist/assets/{slider-CRLZZmIa.js → slider-0EqLNpnf.js} +1 -1
  178. package/dist/assets/{sliders-horizontal-CaXeAW3w.js → sliders-horizontal-zJsW0VdG.js} +1 -1
  179. package/dist/assets/{solana-wallets-DvnDmLSP.js → solana-wallets-Dn2uNfKX.js} +2 -2
  180. package/dist/assets/{solana-wallets-vue-FirM8r-E.js → solana-wallets-vue-p9Mu__hh.js} +1 -1
  181. package/dist/assets/{sora-DZFqIWJo.js → sora-DY8cVRT4.js} +1 -1
  182. package/dist/assets/square-M_Rk0Pkk.js +1 -0
  183. package/dist/assets/{suno-Cjw0RFP7.js → suno-D6DKRK_I.js} +1 -1
  184. package/dist/assets/{switch-CyBT54Uh.js → switch-DEm5ZvmH.js} +1 -1
  185. package/dist/assets/{table-BMr39fgx.js → table-Dybv2DoK.js} +1 -1
  186. package/dist/assets/{tabs-CR27Alo5.js → tabs-BzWMYvFl.js} +1 -1
  187. package/dist/assets/{tag-DbiGRztm.js → tag-C2c6nYnM.js} +1 -1
  188. package/dist/assets/{taskDrawerMixin-CjsoaGWg.js → taskDrawerMixin-CHc1XRAW.js} +1 -1
  189. package/dist/assets/terminal-C3ptxv9o.js +1 -0
  190. package/dist/assets/{time-picker-CjY_AuYN.js → time-picker-sZdk4p2h.js} +1 -1
  191. package/dist/assets/{tooltip-BPoFx_0r.js → tooltip-Zj7J10Sl.js} +1 -1
  192. package/dist/assets/{trash-2-DJ2DJzQE.js → trash-2-DuTquRcI.js} +1 -1
  193. package/dist/assets/{triangle-alert-DmzQvoA8.js → triangle-alert-Baf4IzQp.js} +1 -1
  194. package/dist/assets/{upload-CwrIdcvB.js → upload-CxpxrNW4.js} +1 -1
  195. package/dist/assets/{upload-B5dfYOVm.js → upload-DgSyNPbF.js} +1 -1
  196. package/dist/assets/user-v8lHPak9.js +1 -0
  197. package/dist/assets/{veo-Co9VXUo2.js → veo-CcmOeVzY.js} +1 -1
  198. package/dist/assets/{video-s497gPSq.js → video-BD9YzJyF.js} +1 -1
  199. package/dist/assets/{volume-2-oaWvFyL6.js → volume-2-CAMsm4ZI.js} +1 -1
  200. package/dist/assets/{wallet-D6j9eGtF.js → wallet-DKZ9Tnm0.js} +1 -1
  201. package/dist/assets/{wan-BTJ30eT_.js → wan-ChFI6YpH.js} +1 -1
  202. package/dist/assets/{wand-sparkles-RP6KkE1-.js → wand-sparkles-CZvTgSiZ.js} +1 -1
  203. package/dist/assets/{web-ZkNhAIBE.js → web-B6dj1-JV.js} +1 -1
  204. package/dist/assets/{web-CfBKqXUg.js → web-BgVb6eHc.js} +1 -1
  205. package/dist/assets/{web-CR1Ti7pr.js → web-BvoMfa4k.js} +1 -1
  206. package/dist/assets/{web-CMDm_WKq.js → web-Bz-iE1KV.js} +1 -1
  207. package/dist/assets/{web-DHOsSdD0.js → web-CRrrWRUL.js} +1 -1
  208. package/dist/assets/{webextrator-BsefbuHL.js → webextrator-DpBH8998.js} +1 -1
  209. package/dist/assets/{zap-BvpwfPaQ.js → zap-DMW4jsPf.js} +1 -1
  210. package/dist/index.html +2 -2
  211. package/package.json +1 -1
  212. package/dist/assets/Index-ClM2SMJJ.js +0 -1
  213. package/dist/assets/Index-DqtzyoOS.js +0 -1
  214. package/dist/assets/arrow-down-GzJVZZJD.js +0 -1
  215. package/dist/assets/arrow-left-HE170TRW.js +0 -1
  216. package/dist/assets/arrow-right-B8iX4AMa.js +0 -1
  217. package/dist/assets/arrow-up-Bbos6asC.js +0 -1
  218. package/dist/assets/check-Clof9oh_.js +0 -1
  219. package/dist/assets/chevron-down-DXC6HS37.js +0 -1
  220. package/dist/assets/chevron-right-DUSeDe2V.js +0 -1
  221. package/dist/assets/circle-check-Cjgr9Ugg.js +0 -1
  222. package/dist/assets/clock-bNJ1O4h8.js +0 -1
  223. package/dist/assets/esm-D8h3eHEh.js +0 -1
  224. package/dist/assets/gauge-8OBRNfw2.js +0 -1
  225. package/dist/assets/loader-circle-q3hhAvQp.js +0 -1
  226. package/dist/assets/music-2-DqqiIX_j.js +0 -1
  227. package/dist/assets/play-CTiSUyyP.js +0 -1
  228. package/dist/assets/plus-BgxTy_7g.js +0 -1
  229. package/dist/assets/rotate-ccw-v9BtrxkO.js +0 -1
  230. package/dist/assets/rotate-cw-ByDC8khe.js +0 -1
  231. package/dist/assets/search-COWjz9ZH.js +0 -1
  232. package/dist/assets/square-CTFZS-XR.js +0 -1
  233. package/dist/assets/terminal-CBU3r3IS.js +0 -1
  234. package/dist/assets/user-C1YjKxgh.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,j as u,mt as d,rt as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{r as h,t as g}from"./select-DT9RB41V.js";import{t as _}from"./upload-CwrIdcvB.js";import{t as v}from"./tooltip-BPoFx_0r.js";import{t as y}from"./alert-B8xKY_cZ.js";import{t as b}from"./clock-bNJ1O4h8.js";import{t as x}from"./CopyToClipboard-CMiMmisS.js";import{t as S}from"./hash-CC5NzWfo.js";import{t as C}from"./info-C2D_XeJh.js";import{t as w}from"./PromptTextarea-Dhj4WJey.js";import{t as T}from"./triangle-alert-DmzQvoA8.js";import{t as E}from"./wand-sparkles-RP6KkE1-.js";import{er as D}from"./constants-CqjLASsC.js";import{$t as O,Ai as k,Bt as A,E as j,Ht as M,Pn as ee,Vt as te,Wt as N,ei as P,gi as F,mr as I,ri as L,zt as R}from"./index-BFeCxAir.js";import{t as z}from"./ImagePreview-BjSo9spH.js";import{t as B}from"./Consumption-Byvcpogq.js";import{a as V,n as H,r as U,t as W}from"./pagination-CB3471Sj.js";import{t as G}from"./VideoPlayer-C-TSeOkk.js";import{t as K}from"./ApiCodeButton-CbZLUqWT.js";import{t as q}from"./BotPlaceholder-HnC2WR5J.js";import{t as J}from"./Hailuo-TngjeGp5.js";var Y=m({name:`ModelSelector`,components:{ElSelect:h,ElOption:g},data(){return{}},computed:{options(){return[{value:`minimax-t2v`,label:this.$t(`hailuo.button.model1`)},{value:`minimax-i2v`,label:this.$t(`hailuo.button.model2`)},{value:`minimax-i2v-director`,label:this.$t(`hailuo.button.model3`)}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||=D}}),X={class:`field`},Z={class:`title font-bold`},Q={class:`float-left`};function ne(t,n,r,o,m,h){let g=l(`el-option`),_=l(`el-select`);return p(),s(`div`,X,[e(`h2`,Z,i(t.$t(`hailuo.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`hailuo.placeholder.select`),clearable:``},{default:d(()=>[(p(!0),s(c,null,f(t.options,t=>(p(),u(g,{key:t.value,label:t.label,value:t.value},{default:d(()=>[e(`span`,Q,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var re=j(Y,[[`render`,ne],[`__scopeId`,`data-v-a768fbd9`]]),ie=m({name:`StartImageUrlInput`,components:{ElUpload:_,ElButton:k,InfoIcon:V,ImagePreview:z},mixins:[M,A],data(){return{fileList:[],uploadUrl:L()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){F.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){F.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){F.error(this.$t(`hailuo.message.uploadStartImageError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ae={class:`relative`},oe={class:`flex justify-between`},se={class:`flex justify-start items-center`},ce={class:`text-sm font-bold`};function le(t,n,c,f,m,h){let g=l(`info-icon`),_=l(`image-preview`),v=l(`el-button`),y=l(`el-upload`);return p(),s(`div`,ae,[e(`div`,oe,[e(`div`,se,[e(`span`,ce,i(t.$t(`hailuo.name.startImageUrl`)),1),a(g,{content:t.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{file:d(({file:e})=>[e.url&&e.percentage!==void 0?(p(),u(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:d(()=>[a(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:d(()=>[r(i(t.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var ue=j(ie,[[`render`,le],[`__scopeId`,`data-v-fbf49b06`]]),de=m({name:`PromptInput`,components:{PromptTextarea:w},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function fe(e,t,n,r,i,a){let o=l(`prompt-textarea`);return p(),u(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`hailuo.name.prompt`),info:e.$t(`hailuo.description.prompt`),placeholder:e.$t(`hailuo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var pe=m({name:`PresetPanel`,components:{MagicIcon:E,ElButton:k,PromptInput:j(de,[[`render`,fe]]),StartImageUrlInput:ue,ModelSelector:re,Consumption:B},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return N(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),me={class:`flex flex-col h-full`},he={class:`flex-1 overflow-y-auto p-5`},ge={class:`flex flex-col items-center justify-center px-5 pb-5`};function _e(t,n,c,f,m,h){let g=l(`prompt-input`),_=l(`model-selector`),v=l(`start-image-url-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return p(),s(`div`,me,[e(`div`,he,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.config?.model===`minimax-i2v`?(p(),u(v,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,ge,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(p(),u(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(p(),u(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var ve=j(pe,[[`render`,_e]]),ye=m({name:`TaskPreview`,components:{ChannelIcon:S,InfoIcon:C,MagicIcon:E,TimeIcon:b,WarningIcon:T,CopyToClipboard:x,ElAlert:y,VideoPlayer:G,ElTooltip:v,ElButton:k,ApiCodeButton:K},props:{modelValue:{type:Object,required:!0}},computed:{application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{onDownload(e){console.debug(`on download hailuo video`,e),window.open(e,`_blank`)}}}),be={class:`preview`},xe={class:`left`},Se={class:`main`},Ce={class:`bot`},we={class:`datetime`},Te={class:`info`},Ee={key:0,class:`prompt mt-2`},De={key:0},Oe={key:1},ke={key:0,class:n({content:!0,failed:!0})},Ae={key:0,class:`mb-4`},je={key:1,class:n({operations:!0,"mt-2":!0})},Me={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ne={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pe={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:n({content:!0})},Fe={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ie={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Le={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Re={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ze={key:2,class:n({content:!0})},Be={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ve(n,c,f,m,h,g){let _=l(`capability-presentation`),v=l(`video-player`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`api-code-button`),S=l(`channel-icon`),C=l(`copy-to-clipboard`),w=l(`magic-icon`),T=l(`time-icon`),E=l(`el-alert`),D=l(`warning-icon`),O=l(`info-icon`);return p(),s(`div`,be,[e(`div`,xe,[a(_,{capability:`hailuo`,part:`avatar`,class:`avatar`})]),e(`div`,Se,[e(`div`,Ce,[a(_,{capability:`hailuo`,part:`name`}),e(`span`,we,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Te,[n.modelValue?.request?.prompt?(p(),s(`p`,Ee,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(p(),s(`span`,De,` - (`+i(n.$t(`hailuo.status.pending`))+`) `,1)),n.video?.state===`processing`||n.video?.state===`pending`||n.video?.state===`running`?(p(),s(`span`,Oe,` - (`+i(n.$t(`hailuo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0?(p(),s(`div`,ke,[n.video?.video_url?(p(),s(`div`,Ae,[a(v,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?(p(),s(`div`,je,[a(b,{class:`box-item`,effect:`dark`,content:n.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:d(()=>[n.video?.video_url?(p(),u(y,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:c[0]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:d(()=>[r(i(n.$t(`hailuo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(x,{path:`/hailuo/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(E,{closable:!1,class:`mt-2 success`},{default:d(()=>[n.modelValue?.request?.model?(p(),s(`p`,Me,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.model`))+`: `+i(n.modelValue?.request?.model)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])])):o(``,!0),e(`p`,Ne,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,Pe,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===!1?(p(),s(`div`,$,[a(E,{closable:!1,class:`failure`},{template:d(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failure`)),1)]),default:d(()=>[e(`p`,Fe,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Ie,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(C,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,Le,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Re,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(C,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),n.modelValue?.response?.success===void 0?(p(),s(`div`,ze,[a(E,{closable:!1,class:`info`},{template:d(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failure`)),1)]),default:d(()=>[e(`p`,Be,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var He=m({name:`RecentPanel`,components:{TaskPreview:j(ye,[[`render`,Ve],[`__scopeId`,`data-v-03b088a6`]]),BotPlaceholder:q,NoTasks:U,ScrollList:H},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ue={key:0},We={key:2,class:`w-full h-full flex items-center justify-center`};function Ge(e,t,n,r,i,m){let h=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return p(),s(c,null,[e.tasks?.items===void 0?(p(),s(`div`,Ue,[a(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(p(),u(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:d(()=>[(p(!0),s(c,null,f(e.tasks?.items,e=>(p(),u(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(p(),s(`div`,We,[a(v)])):o(``,!0)],64)}var Ke=m({name:`HailuoIndex`,components:{ConfigPanel:ve,Layout:J,RecentPanel:j(He,[[`render`,Ge]])},mixins:[te],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.hailuo?.status?.getApplications===P.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===P.Request||this.fetchingTasks},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await W({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`hailuo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`hailuo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`hailuo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!R(this.uploadTracker,e=>this.$t(e),e=>F.warning(e)))return;let e={...this.config,async:!0};if(!O())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}F.info(this.$t(`hailuo.message.startingTask`)),I(`hailuo`,ee.generate(e,{token:t})).then(()=>{F.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?F.error(this.$t(`hailuo.message.usedUp`)):F.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function qe(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),f=l(`layout`);return p(),u(f,null,{config:d(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:d(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Je=j(Ke,[[`render`,qe]]);export{Je as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,j as u,mt as d,rt as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{r as h,t as g}from"./select-DkUAUy_k.js";import{t as _}from"./upload-CxpxrNW4.js";import{t as v}from"./tooltip-Zj7J10Sl.js";import{t as y}from"./alert-FLPzVn5V.js";import{t as b}from"./clock-BGDVOm2I.js";import{t as x}from"./CopyToClipboard-BMIKPJkS.js";import{t as S}from"./hash-DoI4RrAO.js";import{t as C}from"./info-BxHKDQkc.js";import{t as w}from"./PromptTextarea-V8KSdVr_.js";import{t as T}from"./triangle-alert-Baf4IzQp.js";import{t as E}from"./wand-sparkles-CZvTgSiZ.js";import{er as D}from"./constants-CqjLASsC.js";import{$t as O,Ai as k,Bt as A,E as j,Ht as M,Pn as ee,Vt as te,Wt as N,ei as P,gi as F,mr as I,ri as L,zt as R}from"./index-ZJhysbj9.js";import{t as z}from"./ImagePreview-DQ9FtwGn.js";import{t as B}from"./Consumption-Dr3zhOGS.js";import{a as V,n as H,r as U,t as W}from"./pagination-CfluQtNV.js";import{t as G}from"./VideoPlayer-C3zj9i45.js";import{t as K}from"./ApiCodeButton-DpqfYFPA.js";import{t as q}from"./BotPlaceholder-CsTEWhRD.js";import{t as J}from"./Hailuo-Ca1zX6oC.js";var Y=m({name:`ModelSelector`,components:{ElSelect:h,ElOption:g},data(){return{}},computed:{options(){return[{value:`minimax-t2v`,label:this.$t(`hailuo.button.model1`)},{value:`minimax-i2v`,label:this.$t(`hailuo.button.model2`)},{value:`minimax-i2v-director`,label:this.$t(`hailuo.button.model3`)}]},value:{get(){return this.$store.state.hailuo?.config?.model},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,model:e})}}},mounted(){this.value||=D}}),X={class:`field`},Z={class:`title font-bold`},Q={class:`float-left`};function ne(t,n,r,o,m,h){let g=l(`el-option`),_=l(`el-select`);return p(),s(`div`,X,[e(`h2`,Z,i(t.$t(`hailuo.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`hailuo.placeholder.select`),clearable:``},{default:d(()=>[(p(!0),s(c,null,f(t.options,t=>(p(),u(g,{key:t.value,label:t.label,value:t.value},{default:d(()=>[e(`span`,Q,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var re=j(Y,[[`render`,ne],[`__scopeId`,`data-v-a768fbd9`]]),ie=m({name:`StartImageUrlInput`,components:{ElUpload:_,ElButton:k,InfoIcon:V,ImagePreview:z},mixins:[M,A],data(){return{fileList:[],uploadUrl:L()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e.url).filter(e=>e!==void 0)},value:{get(){return this.$store.state.hailuo?.config?.first_image_url},set(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){F.warning(this.$t(`hailuo.message.uploadStartImageExceed`))},onError(){F.error(this.$t(`hailuo.message.uploadStartImageError`))},async onRemove(){F.error(this.$t(`hailuo.message.uploadStartImageError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,first_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),ae={class:`relative`},oe={class:`flex justify-between`},se={class:`flex justify-start items-center`},ce={class:`text-sm font-bold`};function le(t,n,c,f,m,h){let g=l(`info-icon`),_=l(`image-preview`),v=l(`el-button`),y=l(`el-upload`);return p(),s(`div`,ae,[e(`div`,oe,[e(`div`,se,[e(`span`,ce,i(t.$t(`hailuo.name.startImageUrl`)),1),a(g,{content:t.$t(`hailuo.description.startImageUrl`),class:`info`},null,8,[`content`])])]),a(y,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,"show-file-list":!0,limit:1,multiple:!1,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{file:d(({file:e})=>[e.url&&e.percentage!==void 0?(p(),u(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:d(()=>[a(v,{size:`small`,type:`primary`,class:`btn btn-upload`,round:``},{default:d(()=>[r(i(t.$t(`hailuo.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])])}var ue=j(ie,[[`render`,le],[`__scopeId`,`data-v-fbf49b06`]]),de=m({name:`PromptInput`,components:{PromptTextarea:w},computed:{prompt:{get(){return this.$store.state.hailuo?.config?.prompt},set(e){this.$store.commit(`hailuo/setConfig`,{...this.$store.state.hailuo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function fe(e,t,n,r,i,a){let o=l(`prompt-textarea`);return p(),u(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`hailuo.name.prompt`),info:e.$t(`hailuo.description.prompt`),placeholder:e.$t(`hailuo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var pe=m({name:`PresetPanel`,components:{MagicIcon:E,ElButton:k,PromptInput:j(de,[[`render`,fe]]),StartImageUrlInput:ue,ModelSelector:re,Consumption:B},emits:[`generate`],computed:{config(){return this.$store.state.hailuo?.config},consumption(){return N(this.config,this.service?.cost)},service(){return this.$store.state.hailuo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),me={class:`flex flex-col h-full`},he={class:`flex-1 overflow-y-auto p-5`},ge={class:`flex flex-col items-center justify-center px-5 pb-5`};function _e(t,n,c,f,m,h){let g=l(`prompt-input`),_=l(`model-selector`),v=l(`start-image-url-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return p(),s(`div`,me,[e(`div`,he,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),t.config?.model===`minimax-i2v`?(p(),u(v,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,ge,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(p(),u(x,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`hailuo.button.extend`)),1)]),_:1},8,[`onClick`])):(p(),u(x,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:d(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`hailuo.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var ve=j(pe,[[`render`,_e]]),ye=m({name:`TaskPreview`,components:{ChannelIcon:S,InfoIcon:C,MagicIcon:E,TimeIcon:b,WarningIcon:T,CopyToClipboard:x,ElAlert:y,VideoPlayer:G,ElTooltip:v,ElButton:k,ApiCodeButton:K},props:{modelValue:{type:Object,required:!0}},computed:{application(){return this.$store.state.hailuo?.application},config(){return this.$store.state.hailuo?.config},video(){return this.modelValue?.response?.data?.[0]}},methods:{onDownload(e){console.debug(`on download hailuo video`,e),window.open(e,`_blank`)}}}),be={class:`preview`},xe={class:`left`},Se={class:`main`},Ce={class:`bot`},we={class:`datetime`},Te={class:`info`},Ee={key:0,class:`prompt mt-2`},De={key:0},Oe={key:1},ke={key:0,class:n({content:!0,failed:!0})},Ae={key:0,class:`mb-4`},je={key:1,class:n({operations:!0,"mt-2":!0})},Me={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ne={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pe={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:n({content:!0})},Fe={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ie={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Le={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Re={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ze={key:2,class:n({content:!0})},Be={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Ve(n,c,f,m,h,g){let _=l(`capability-presentation`),v=l(`video-player`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`api-code-button`),S=l(`channel-icon`),C=l(`copy-to-clipboard`),w=l(`magic-icon`),T=l(`time-icon`),E=l(`el-alert`),D=l(`warning-icon`),O=l(`info-icon`);return p(),s(`div`,be,[e(`div`,xe,[a(_,{capability:`hailuo`,part:`avatar`,class:`avatar`})]),e(`div`,Se,[e(`div`,Ce,[a(_,{capability:`hailuo`,part:`name`}),e(`span`,we,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Te,[n.modelValue?.request?.prompt?(p(),s(`p`,Ee,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(p(),s(`span`,De,` - (`+i(n.$t(`hailuo.status.pending`))+`) `,1)),n.video?.state===`processing`||n.video?.state===`pending`||n.video?.state===`running`?(p(),s(`span`,Oe,` - (`+i(n.$t(`hailuo.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0?(p(),s(`div`,ke,[n.video?.video_url?(p(),s(`div`,Ae,[a(v,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?(p(),s(`div`,je,[a(b,{class:`box-item`,effect:`dark`,content:n.$t(`hailuo.message.downloadVideo`),placement:`top-start`},{default:d(()=>[n.video?.video_url?(p(),u(y,{key:0,type:`info`,size:`small`,class:`mb-2`,onClick:c[0]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:d(()=>[r(i(n.$t(`hailuo.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(x,{path:`/hailuo/videos`,body:n.modelValue?.request},null,8,[`body`])])):o(``,!0),a(E,{closable:!1,class:`mt-2 success`},{default:d(()=>[n.modelValue?.request?.model?(p(),s(`p`,Me,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.model`))+`: `+i(n.modelValue?.request?.model)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])])):o(``,!0),e(`p`,Ne,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,Pe,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===!1?(p(),s(`div`,$,[a(E,{closable:!1,class:`failure`},{template:d(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failure`)),1)]),default:d(()=>[e(`p`,Fe,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Ie,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(C,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(p(),s(`p`,Le,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Re,[a(S,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(C,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),n.modelValue?.response?.success===void 0?(p(),s(`div`,ze,[a(E,{closable:!1,class:`info`},{template:d(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.failure`)),1)]),default:d(()=>[e(`p`,Be,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`hailuo.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(C,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var He=m({name:`RecentPanel`,components:{TaskPreview:j(ye,[[`render`,Ve],[`__scopeId`,`data-v-03b088a6`]]),BotPlaceholder:q,NoTasks:U,ScrollList:H},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.hailuo?.tasks,items:this.$store.state.hailuo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ue={key:0},We={key:2,class:`w-full h-full flex items-center justify-center`};function Ge(e,t,n,r,i,m){let h=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return p(),s(c,null,[e.tasks?.items===void 0?(p(),s(`div`,Ue,[a(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(p(),u(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:d(()=>[(p(!0),s(c,null,f(e.tasks?.items,e=>(p(),u(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(p(),s(`div`,We,[a(v)])):o(``,!0)],64)}var Ke=m({name:`HailuoIndex`,components:{ConfigPanel:ve,Layout:J,RecentPanel:j(He,[[`render`,Ge]])},mixins:[te],inject:[`initialized`],data(){return{task:void 0,job:0,timer:void 0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.hailuo?.status?.getApplications===P.Request},tasksLoading(){return this.$store.state.hailuo?.status?.getTasks===P.Request||this.fetchingTasks},credential(){return this.$store.state.hailuo.credential},config(){return this.$store.state.hailuo.config},application(){return this.$store.state.hailuo.application},tasks(){return this.$store.state.hailuo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await W({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`hailuo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`hailuo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`hailuo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!R(this.uploadTracker,e=>this.$t(e),e=>F.warning(e)))return;let e={...this.config,async:!0};if(!O())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}F.info(this.$t(`hailuo.message.startingTask`)),I(`hailuo`,ee.generate(e,{token:t})).then(()=>{F.success(this.$t(`hailuo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?F.error(this.$t(`hailuo.message.usedUp`)):F.error(this.$t(`hailuo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function qe(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),f=l(`layout`);return p(),u(f,null,{config:d(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:d(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Je=j(Ke,[[`render`,qe]]);export{Je as default};
@@ -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{W as b}from"./use-deprecated-DjO24JGR.js";import{r as x,t as S}from"./select-DkUAUy_k.js";import{n as C,t as w}from"./tabs-BzWMYvFl.js";import{n as T,t as E}from"./form-Cw041a2Z.js";import{t as D}from"./upload-CxpxrNW4.js";import{t as O}from"./tooltip-Zj7J10Sl.js";import{t as k}from"./avatar-yUP-HfhX.js";import{t as A}from"./checkbox-DLvBiGkW.js";import{n as j,r as M,t as N}from"./radio-B0Elgaw9.js";import{n as P,t as F}from"./collapse-Cl5wZwzX.js";import{t as I}from"./drawer-D2zF1fRK.js";import{n as L,r as R,t as z}from"./dropdown-DLOHY4b1.js";import{t as B}from"./input-number-BRjaLilb.js";import{t as ee}from"./popover-B8iGB2sr.js";import{t as te}from"./progress-BeEbKKvj.js";import{n as ne,t as re}from"./skeleton-BVbQKb45.js";import{t as ie}from"./slider-0EqLNpnf.js";import{t as ae}from"./switch-DEm5ZvmH.js";import{t as oe}from"./arrow-down-wide-narrow-XS8RsnyW.js";import{n as se}from"./taskDrawerMixin-CHc1XRAW.js";import{i as ce,n as le,r as V,t as ue}from"./Player-3HDcDI8P.js";import{t as de}from"./circle-check-RzFC3CQX.js";import{t as fe}from"./clock-BGDVOm2I.js";import{n as pe}from"./CodeSnippet-HB8uHfXK.js";import{t as me}from"./download-CyMiSpiB.js";import{t as he}from"./ellipsis-DG1A5C3o.js";import{t as ge}from"./gauge-RDr7KHqH.js";import{t as _e}from"./headphones-CHPeUHp3.js";import{t as ve}from"./image-D48Xnk8e.js";import{t as ye}from"./link-D8t1pXCj.js";import{t as be}from"./loader-circle-B6MkJY43.js";import{n as xe,t as Se}from"./PromptTextarea-V8KSdVr_.js";import{t as H}from"./mic-XKZFITG1.js";import{t as Ce}from"./music-2-Dl5_PQsX.js";import{t as we}from"./palette-D01_dREY.js";import{t as Te}from"./pause-NsboEH_W.js";import{t as Ee}from"./pencil-B-VeDrH-.js";import{t as U}from"./play-BCEODzA0.js";import{t as De}from"./plus-BclYXndj.js";import{t as Oe}from"./refresh-cw-Clz-T3zl.js";import{t as ke}from"./rotate-ccw-C4YzzErf.js";import{t as Ae}from"./search-BBIX8c2K.js";import{t as je}from"./shuffle-CyYMq0XJ.js";import{t as Me}from"./square-M_Rk0Pkk.js";import{t as Ne}from"./trash-2-DuTquRcI.js";import{t as Pe}from"./upload-DgSyNPbF.js";import{t as W}from"./wand-sparkles-CZvTgSiZ.js";import{Zn as Fe}from"./constants-CqjLASsC.js";import{$t as Ie,Ai as G,Bt as Le,Dn as K,E as q,Vt as Re,Wt as ze,ei as J,gi as Y,hi as Be,mi as X,mr as Ve,ri as He,rn as Ue,sr as We,xi as Ge,yi as Z,zi as Q,zt as Ke}from"./index-ZJhysbj9.js";import{t as qe}from"./Consumption-Dr3zhOGS.js";import{a as $,i as Je,n as Ye,r as Xe,t as Ze}from"./pagination-CfluQtNV.js";var Qe=X(`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`}]]),$e=X(`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`}]]),et=X(`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`}]]),tt=X(`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`}]]),nt=X(`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`}]]),rt=X(`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`}]]),it=X(`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`}]]),at=X(`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`}]]),ot=y({name:`LayoutSuno`,components:{MagicIcon:W,ElDrawer:I,ElButton:G},mixins:[se]}),st={class:`main flex flex-row flex-1`},ct={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)]`},lt={class:`result h-full flex flex-col flex-1 min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`},ut={class:`preview h-full w-[300px] flex flex-col`};function dt(t,n,r,i,o,c){let l=u(`magic-icon`),p=u(`el-button`),h=u(`el-drawer`);return _(),s(`div`,st,[e(`div`,ct,[f(t.$slots,`config`,{},void 0,!0)]),e(`div`,lt,[f(t.$slots,`result`,{},void 0,!0)]),e(`div`,ut,[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 ft=q(ot,[[`render`,dt],[`__scopeId`,`data-v-e3f41341`]]),pt=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||=Fe}}),mt={class:`mb-3`},ht={class:`flex items-center mb-1`},gt={class:`text-sm font-bold`},_t={class:`model-option`},vt={class:`model-option-left`},yt={class:`model-option-name`},bt={class:`model-option-desc`},xt={key:0,class:`flex items-center justify-between mb-3`},St={class:`text-sm font-bold`};function Ct(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`,mt,[e(`div`,ht,[e(`span`,gt,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`,_t,[e(`div`,vt,[e(`span`,yt,i(t.label),1)]),e(`span`,bt,i(t.desc),1)])]),_:2},1032,[`label`,`value`,`class`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),t.custom?(_(),s(`div`,xt,[e(`span`,St,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 wt=q(pt,[[`render`,Ct],[`__scopeId`,`data-v-16e4d6fc`]]),Tt=y({name:`UploadAudio`,components:{MicrophoneIcon:H,StopIcon:Me,SuccessIcon:de,UndoIcon:ke,UploadIcon:Pe,ElUpload:D,ElButton:G,ElDialog:Ge,ElTabs:C,ElTabPane:w,InfoIcon:$,ElRadioGroup:M,ElRadioButton:j},mixins:[Le],emits:[`change`],data(){return{fileList:[],uploadUrl:He()+`/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(){Y.warning(this.$t(`suno.message.uploadReferencesExceed`))},onError(){Y.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}Y.info(this.$t(`suno.message.startingUploadAudio`));try{let e=await K.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`}),Y.success(this.$t(`suno.message.startUploadAudioSuccess`))}catch(e){Y.error(e?.response?.data?.error?.message||this.$t(`suno.message.startUploadAudioFailed`))}},async startRecording(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){Y.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),Y.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),Y.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)}}}),Et={class:`relative`},Dt={class:`flex justify-between items-center mb-2`},Ot={class:`flex justify-start items-center`},kt={class:`text-sm font-bold`},At={key:0,class:`mb-2`},jt=[`src`],Mt={key:1,class:`mt-2`},Nt={class:`py-4`},Pt={class:`text-center py-6`},Ft={class:`text-sm`},It={class:`text-xs text-gray-400 mt-1`},Lt={class:`py-4 text-center`},Rt={class:`recorder-display mb-4`},zt={key:0,class:`text-red-500 flex items-center justify-center gap-2`},Bt={class:`text-2xl font-mono`},Vt={key:1,class:`text-green-600`},Ht={key:2,class:`text-gray-400 text-2xl font-mono`},Ut={key:0,class:`mb-4`},Wt=[`src`],Gt={class:`flex justify-center gap-3`};function Kt(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`,Et,[e(`div`,Dt,[e(`div`,Ot,[e(`span`,kt,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`,At,[e(`audio`,{src:t.audioPreviewUrl,controls:``,class:`w-full`},null,8,jt)])):o(``,!0),t.hasUploadedAudio?(_(),s(`div`,Mt,[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`,Nt,[a(S,{"file-list":t.fileList,"onUpdate:fileList":n[2]||=e=>t.fileList=e,name:`file`,limit:1,class:`upload-wrapper`,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`,Pt,[a(x,{class:`text-4xl text-gray-400 mb-3`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`div`,Ft,i(t.$t(`suno.description.dropAudioHere`)),1),e(`div`,It,i(t.$t(`suno.description.audioFormats`)),1)])]),_:1},8,[`file-list`,`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`,Lt,[e(`div`,Rt,[t.recording?(_(),s(`div`,zt,[n[5]||=e(`span`,{class:`recording-dot`},null,-1),e(`span`,Bt,i(t.formattedTime),1)])):t.recordedBlob?(_(),s(`div`,Vt,[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`,Ht,`00:00`))]),t.recordedAudioUrl&&!t.recording?(_(),s(`div`,Ut,[e(`audio`,{src:t.recordedAudioUrl,controls:``,class:`w-full`},null,8,Wt)])):o(``,!0),e(`div`,Gt,[!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 qt=q(Tt,[[`render`,Kt],[`__scopeId`,`data-v-0b4dff2c`]]),Jt=[{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`}],Yt=8;function Xt(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 Zt=y({name:`PromptInput`,components:{RefreshIcon:Oe,PromptTextarea:Se},data(){return{shuffledTags:Xt(Jt)}},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,Yt)}},mounted(){this.prompt||=``},methods:{onTagClick(e){this.prompt=e.prompt},onRefreshTags(){this.shuffledTags=Xt(Jt)}}}),Qt={class:`inspo-tags`},$t=[`onClick`],en=[`aria-label`,`title`];function tn(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`,Qt,[(_(!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,$t))),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,en)])]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var nn=q(Zt,[[`render`,tn],[`__scopeId`,`data-v-302bad6d`]]),rn=y({name:`LyricInput`,components:{ClearIcon:$e,FullscreenIcon:xe,MagicIcon:W,UndoIcon:ke,ElInput:Q,ElButton:G,ElTooltip:O,ElDialog:Ge,InfoIcon:$},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,Y.info(this.$t(`suno.message.enhancingLyrics`));try{let t=`${this.enhancePrompt}\n\nOriginal lyrics:\n${this.lyric}`,n=(await K.lyric({prompt:t},{token:e})).data?.data;n?.text&&(this.lyric=n.text,this.enhancePrompt=``,Y.success(this.$t(`suno.message.enhanceLyricsSuccess`)))}catch{Y.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 Be.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,Y.info(this.$t(`suno.message.generatingLyrics`));try{let n=(await K.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}),Y.success(this.$t(`suno.message.generateLyricsSuccess`)))}catch{Y.error(this.$t(`suno.message.generateLyricsFailed`))}finally{this.generatingLyrics=!1}}}}}),an={class:`field`},on={class:`flex items-center justify-between mb-1`},sn={class:`flex items-center`},cn={class:`text-sm font-bold`},ln={class:`flex items-center gap-1`},un={class:`relative`},dn={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},fn={key:0,class:`enhance-bar`},pn={key:0,class:`enhance-bar mt-3`},mn={class:`flex items-center justify-between`},hn={class:`flex items-center gap-1`};function gn(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`,an,[e(`div`,on,[e(`div`,sn,[e(`span`,cn,i(t.$t(`suno.name.lyrics`)),1),a(g,{content:t.$t(`suno.description.lyrics`)},null,8,[`content`])]),e(`div`,ln,[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`,un,[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`,dn,i(t.lyric?.length||0)+`/5000`,1)]),t.lyric&&t.config?.action!==`extend`?(_(),s(`div`,fn,[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`,mn,[e(`div`,hn,[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`,pn,[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 _n=q(rn,[[`render`,gn],[`__scopeId`,`data-v-d537dc57`]]),vn=`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(`.`),yn=12;function bn(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 xn=y({name:`StyleInput`,components:{MagicIcon:W,RefreshIcon:Oe,ElInput:Q,ElButton:G,InfoIcon:$},data(){return{optimizing:!1,shuffledTags:bn(vn)}},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,yn)}},methods:{onTagClick(e){let t=this.style||``;t.toLowerCase().includes(e.toLowerCase())||(this.style=t?`${t}, ${e}`:e)},onRefreshTags(){this.shuffledTags=bn(vn)},async onOptimizeStyle(){let e=this.credential?.token;if(!(!e||!this.style)){this.optimizing=!0,Y.info(this.$t(`suno.message.optimizingStyle`));try{let t=await K.style({prompt:this.style},{token:e}),n=t.data?.text||t.data?.data?.text;n&&(this.style=n,Y.success(this.$t(`suno.message.optimizeStyleSuccess`)))}catch{Y.error(this.$t(`suno.message.optimizeStyleFailed`))}finally{this.optimizing=!1}}}}}),Sn={class:`field`},Cn={class:`flex items-center justify-between mb-1`},wn={class:`flex items-center`},Tn={class:`text-sm font-bold`},En={class:`relative`},Dn={class:`text-xs text-right text-[var(--el-text-color-secondary)] mt-1`},On={class:`style-tags`},kn=[`onClick`],An=[`aria-label`,`title`];function jn(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`,Sn,[e(`div`,Cn,[e(`div`,wn,[e(`span`,Tn,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`,En,[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`,Dn,i(t.style?.length||0)+`/1000`,1)]),e(`div`,On,[(_(!0),s(l,null,g(t.visibleTags,e=>(_(),s(`button`,{key:e,class:`style-tag`,onClick:n=>t.onTagClick(e)},i(e),9,kn))),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,An)])])}var Mn=q(xn,[[`render`,jn],[`__scopeId`,`data-v-86037edb`]]),Nn=y({name:`TitleInput`,components:{ElInput:Q,InfoIcon:$},computed:{title:{get(){return this.$store.state.suno?.config?.title},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,title:e})}}}}),Pn={class:`field`},Fn={class:`flex items-center mb-1`},In={class:`text-sm font-bold`};function Ln(t,n,r,o,c,l){let d=u(`info-icon`),f=u(`el-input`);return _(),s(`div`,Pn,[e(`div`,Fn,[e(`span`,In,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 Rn=q(Nn,[[`render`,Ln]]),zn=y({name:`ExtendFromInput`,components:{ElImage:Z,ElIcon:b,ElInputNumber:B,VideoPlay:U,VideoPause:Te},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:V,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})}}}),Bn={class:`field`},Vn={class:`box`},Hn={class:`title font-bold`},Un={class:`input-wrapper`},Wn={class:`task`},Gn={class:`left`},Kn=[`aria-label`,`title`],qn=[`aria-label`,`title`],Jn={key:2,class:`duration`},Yn={class:`info`},Xn={class:`title`},Zn={class:`style`};function Qn(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`,Bn,[e(`div`,Vn,[e(`h2`,Hn,i(n.$t(`suno.name.extend`)),1),e(`div`,Un,[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`,Wn,[n.audio?(_(),s(`div`,{key:0,class:`audio`,onClick:r[7]||=e=>n.onClick(n.audio)},[d((_(),s(`div`,Gn,[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,Kn)):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,qn)):o(``,!0),n.audio?.duration?(_(),s(`div`,Jn,i(n.useFormatDuring(n.audio?.duration)),1)):o(``,!0)])),[[C,!n.audio?.audio_url]]),e(`div`,Yn,[e(`h2`,Xn,i(n.audio?.title),1),e(`p`,Zn,i(n.audio?.style),1)])])):o(``,!0)])])}var $n=q(zn,[[`render`,Qn],[`__scopeId`,`data-v-4600553c`]]),er=y({name:`CoverFromInput`,components:{ElImage:Z,ElIcon:b,VideoPlay:U,VideoPause:Te},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:V,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})}}}),tr={class:`field`},nr={class:`box`},rr={class:`title font-bold`},ir={class:`task`},ar={class:`left`},or=[`aria-label`,`title`],sr=[`aria-label`,`title`],cr={key:2,class:`duration`},lr={class:`info`},ur={class:`title`},dr={class:`style`};function fr(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`,tr,[e(`div`,nr,[e(`h2`,rr,i(n.$t(`suno.name.cover`)),1)]),e(`div`,ir,[n.audio?(_(),s(`div`,{key:0,class:`audio`,onClick:r[6]||=e=>n.onClick(n.audio)},[d((_(),s(`div`,ar,[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,or)):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,sr)):o(``,!0),n.audio?.duration?(_(),s(`div`,cr,i(n.useFormatDuring(n.audio?.duration)),1)):o(``,!0)])),[[S,!n.audio?.audio_url]]),e(`div`,lr,[e(`h2`,ur,i(n.audio?.title),1),e(`p`,dr,i(n.audio?.style),1)])])):o(``,!0)])])}var pr=q(er,[[`render`,fr],[`__scopeId`,`data-v-aa3e3b20`]]),mr=y({name:`VocalGenderSelector`,components:{ElRadioGroup:M,ElRadioButton:j,InfoIcon:$},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})}}}}),hr={class:`flex items-center mb-1`},gr={class:`text-sm font-bold`};function _r(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`,hr,[e(`span`,gr,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 vr=q(mr,[[`render`,_r]]),yr=y({name:`AdvancedParams`,components:{ElCollapse:F,ElCollapseItem:P,ElInput:Q,ElSlider:ie,ElRadioGroup:M,ElRadioButton:j},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)},styleNegative:{get(){return this.$store.state.suno?.config?.style_negative||``},set(e){this.$store.commit(`suno/setConfig`,{...this.$store.state.suno?.config,style_negative: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})}}),br={key:0,class:`mb-3`},xr={class:`flex items-center mb-1`},Sr={class:`text-xs font-bold`},Cr={key:1,class:`mb-3`},wr={class:`flex items-center mb-1`},Tr={class:`text-xs font-bold`},Er={key:2,class:`mb-3`},Dr={class:`flex items-center justify-between mb-1`},Or={class:`text-xs font-bold`},kr={class:`text-xs text-[var(--el-text-color-secondary)]`},Ar={key:3,class:`mb-3`},jr={class:`flex items-center justify-between mb-1`},Mr={class:`text-xs font-bold`},Nr={class:`text-xs text-[var(--el-text-color-secondary)]`},Pr={key:4,class:`mb-3`},Fr={class:`flex items-center mb-1`},Ir={class:`text-xs font-bold`},Lr={key:5,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:6,class:`mb-3`},Hr={class:`flex items-center mb-1`},Ur={class:`text-xs font-bold`};function Wr(t,n,c,l,d,f){let h=u(`el-input`),g=u(`el-slider`),v=u(`el-radio-button`),y=u(`el-radio-group`),b=u(`el-collapse-item`),x=u(`el-collapse`);return _(),p(x,{modelValue:t.activeNames,"onUpdate:modelValue":n[7]||=e=>t.activeNames=e,class:`advanced-collapse`},{default:m(()=>[a(b,{title:t.$t(`suno.name.advancedParams`),name:`advanced`},{default:m(()=>[t.config?.custom?(_(),s(`div`,br,[e(`div`,xr,[e(`span`,Sr,i(t.$t(`suno.name.styleNegative`)),1)]),a(h,{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`,Cr,[e(`div`,wr,[e(`span`,Tr,i(t.$t(`suno.name.lyricPrompt`)),1)]),a(h,{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`,Er,[e(`div`,Dr,[e(`span`,Or,i(t.$t(`suno.name.weirdness`)),1),e(`span`,kr,i(t.weirdness??0),1)]),a(g,{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`,Ar,[e(`div`,jr,[e(`span`,Mr,i(t.$t(`suno.name.styleInfluence`)),1),e(`span`,Nr,i(t.styleInfluence??.5),1)]),a(g,{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`,Pr,[e(`div`,Fr,[e(`span`,Ir,i(t.$t(`suno.name.variationCategory`)),1)]),a(y,{modelValue:t.variationCategory,"onUpdate:modelValue":n[4]||=e=>t.variationCategory=e},{default:m(()=>[a(v,{value:``},{default:m(()=>[r(i(t.$t(`suno.gender.auto`)),1)]),_:1}),a(v,{value:`high`},{default:m(()=>[r(i(t.$t(`suno.variation.high`)),1)]),_:1}),a(v,{value:`low`},{default:m(()=>[r(i(t.$t(`suno.variation.low`)),1)]),_:1})]),_:1},8,[`modelValue`])])):o(``,!0),t.config?.action===`cover`?(_(),s(`div`,Lr,[e(`div`,Rr,[e(`span`,zr,i(t.$t(`suno.name.audioWeight`)),1),e(`span`,Br,i(t.audioWeight??.5),1)]),a(g,{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&&!t.config?.instrumental?(_(),s(`div`,Vr,[e(`div`,Hr,[e(`span`,Ur,i(t.$t(`suno.name.lyricsMode`)),1)]),a(y,{modelValue:t.lyricsMode,"onUpdate:modelValue":n[6]||=e=>t.lyricsMode=e,size:`small`},{default:m(()=>[a(v,{value:`manual`},{default:m(()=>[r(i(t.$t(`suno.lyricsMode.manual`)),1)]),_:1}),a(v,{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 Gr=q(yr,[[`render`,Wr],[`__scopeId`,`data-v-eb6f5834`]]),Kr=y({name:`ReplaceSectionInput`,components:{ElInputNumber:B,ElImage:Z,InfoIcon:$},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`})}}}),qr={class:`field`},Jr={class:`flex items-center mb-2`},Yr={class:`text-sm font-bold m-0`},Xr={key:0,class:`task mb-2`},Zr={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Qr={class:`info flex-1 min-w-0`},$r={class:`text-sm font-bold m-0 truncate`},ei={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},ti={class:`flex gap-2`};function ni(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`,qr,[e(`div`,Jr,[e(`h2`,Yr,i(t.$t(`suno.name.replaceSection`)),1),a(p,{content:t.$t(`suno.description.replaceSection`)},null,8,[`content`])]),t.audio?(_(),s(`div`,Xr,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[d((_(),s(`div`,Zr,[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`,Qr,[e(`h2`,$r,i(t.audio?.title),1),e(`p`,ei,i(t.audio?.style),1)])])])):o(``,!0),e(`div`,ti,[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 ri=q(Kr,[[`render`,ni]]),ii=y({name:`OverpaintingInput`,components:{ElInputNumber:B,ElImage:Z,InfoIcon:$},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`})}}}),ai={class:`field`},oi={class:`flex items-center mb-2`},si={class:`text-sm font-bold m-0`},ci={key:0,class:`task mb-2`},li={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},ui={class:`info flex-1 min-w-0`},di={class:`text-sm font-bold m-0 truncate`},fi={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},pi={class:`flex gap-2`};function mi(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`,ai,[e(`div`,oi,[e(`h2`,si,i(t.$t(`suno.name.overpaintingRange`)),1),a(p,{content:t.$t(`suno.description.overpainting`)},null,8,[`content`])]),t.audio?(_(),s(`div`,ci,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[d((_(),s(`div`,li,[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`,ui,[e(`h2`,di,i(t.audio?.title),1),e(`p`,fi,i(t.audio?.style),1)])])])):o(``,!0),e(`div`,pi,[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 hi=q(ii,[[`render`,mi]]),gi=y({name:`UnderpaintingInput`,components:{ElInputNumber:B,ElImage:Z,InfoIcon:$},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`})}}}),_i={class:`field`},vi={class:`flex items-center mb-2`},yi={class:`text-sm font-bold m-0`},bi={key:0,class:`task mb-2`},xi={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Si={class:`info flex-1 min-w-0`},Ci={class:`text-sm font-bold m-0 truncate`},wi={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Ti={class:`flex gap-2`};function Ei(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`,_i,[e(`div`,vi,[e(`h2`,yi,i(t.$t(`suno.name.underpaintingRange`)),1),a(p,{content:t.$t(`suno.description.underpainting`)},null,8,[`content`])]),t.audio?(_(),s(`div`,bi,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[d((_(),s(`div`,xi,[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`,Si,[e(`h2`,Ci,i(t.audio?.title),1),e(`p`,wi,i(t.audio?.style),1)])])])):o(``,!0),e(`div`,Ti,[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 Di=q(gi,[[`render`,Ei]]),Oi=y({name:`SamplesInput`,components:{ElInputNumber:B,ElImage:Z,InfoIcon:$},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`})}}}),ki={class:`field`},Ai={class:`flex items-center mb-2`},ji={class:`text-sm font-bold m-0`},Mi={key:0,class:`task mb-2`},Ni={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},Pi={class:`info flex-1 min-w-0`},Fi={class:`text-sm font-bold m-0 truncate`},Ii={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`},Li={class:`flex gap-2`};function Ri(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`,ki,[e(`div`,Ai,[e(`h2`,ji,i(t.$t(`suno.name.samplesRange`)),1),a(p,{content:t.$t(`suno.description.samples`)},null,8,[`content`])]),t.audio?(_(),s(`div`,Mi,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[d((_(),s(`div`,Ni,[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`,Pi,[e(`h2`,Fi,i(t.audio?.title),1),e(`p`,Ii,i(t.audio?.style),1)])])])):o(``,!0),e(`div`,Li,[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 zi=q(Oi,[[`render`,Ri]]),Bi=[.5,.75,1,1.25,1.5,2],Vi=y({name:`AdjustSpeedInput`,components:{ElRadioGroup:M,ElRadioButton:j,ElImage:Z,InfoIcon:$},data(){return{options:Bi}},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`})}}}),Hi={class:`field`},Ui={class:`flex items-center mb-2`},Wi={class:`text-sm font-bold m-0`},Gi={key:0,class:`task mb-2`},Ki={class:`left relative w-[50px] h-[50px] mr-3 flex-shrink-0`},qi={class:`info flex-1 min-w-0`},Ji={class:`text-sm font-bold m-0 truncate`},Yi={class:`text-xs text-[var(--el-text-color-secondary)] m-0 truncate`};function Xi(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`,Hi,[e(`div`,Ui,[e(`h2`,Wi,i(t.$t(`suno.name.adjustSpeed`)),1),a(b,{content:t.$t(`suno.description.adjustSpeed`)},null,8,[`content`])]),t.audio?(_(),s(`div`,Gi,[e(`div`,{class:`audio flex items-center`,onClick:n[0]||=e=>t.onClick(t.audio)},[d((_(),s(`div`,Ki,[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`,qi,[e(`h2`,Ji,i(t.audio?.title),1),e(`p`,Yi,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 Zi=q(Vi,[[`render`,Xi],[`__scopeId`,`data-v-ba834628`]]),Qi=y({name:`VoiceCreateDialog`,components:{ElDialog:Ge,ElForm:E,ElFormItem:T,ElInput:Q,ElButton:G,ElRadioGroup:M,ElRadio:N},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 K.persona({audio_id:this.form.audio_id,name:this.form.name,description:this.form.description},{token:this.token}):await K.voices({audio_url:this.form.audio_url,name:this.form.name,description:this.form.description},{token:this.token}),Y.success(this.$t(`suno.voice.createSuccess`)),this.$emit(`created`),this.onClose()}catch{Y.error(this.$t(`suno.voice.createFailed`))}finally{this.loading=!1}}}}});function $i(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 ea=y({name:`VoiceManager`,components:{AddIcon:De,DeleteIcon:Ne,FavoriteIcon:at,ElButton:G,ElIcon:b,ElTabs:C,ElTabPane:w,ElTooltip:O,Loading:be,MicrophoneIcon:H,MusicIcon:Ce,VoiceCreateDialog:q(Qi,[[`render`,$i]])},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 Be.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(Y.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 Y.error(this.$t(`suno.voice.deleteFailed`))},async onCreated(){await this.loadPersonas()}}}),ta={class:`voice-manager`},na={class:`flex items-center justify-between mb-3`},ra={class:`text-sm font-medium`},ia={key:0,class:`text-center py-6`},aa={key:1,class:`text-center py-6 text-gray-400 text-sm`},oa={key:2,class:`voice-list`},sa=[`onClick`],ca={class:`flex-1 min-w-0`},la={class:`voice-name`},ua={key:0,class:`voice-desc`};function da(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`,ta,[e(`div`,na,[e(`span`,ra,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`,ia,[a(T,{class:`is-loading`},{default:m(()=>[a(w,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})])):c.visiblePersonas.length===0?(_(),s(`div`,aa,i(c.activeTab===`favorites`?c.$t(`suno.voice.emptyFavorites`):c.$t(`suno.voice.empty`)),1)):(_(),s(`div`,oa,[(_(!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`,ca,[e(`div`,la,[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`,ua,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,sa))),128))])),a(j,{modelValue:c.showCreateDialog,"onUpdate:modelValue":d[3]||=e=>c.showCreateDialog=e,onCreated:c.onCreated},null,8,[`modelValue`,`onCreated`])])}var fa=y({name:`PersonaInput`,components:{MicrophoneIcon:H,ElSelect:x,ElOption:S,ElButton:G,ElDrawer:I,InfoIcon:$,VoiceManager:q(ea,[[`render`,da],[`__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||[]}}}),pa={class:`field`},ma={class:`flex items-center justify-between mb-2`},ha={class:`flex items-center`},ga={class:`text-sm font-bold`},_a={class:`flex items-center justify-between w-full`},va={key:0,class:`text-xs text-gray-400 ml-2`};function ya(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`,pa,[e(`div`,ma,[e(`div`,ha,[e(`span`,ga,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`,_a,[e(`span`,null,i(t.name||t.persona_id),1),t.source_type?(_(),s(`span`,va,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 ba=y({name:`PresetPanel`,components:{CleanupIcon:ce,MagicIcon:W,TypeSelector:wt,PromptInput:nn,LyricInput:_n,StyleInput:Mn,TitleInput:Rn,ExtendFromInput:$n,CoverFromInput:pr,UploadAudio:qt,VocalGenderSelector:vr,AdvancedParams:Gr,ReplaceSectionInput:ri,OverpaintingInput:hi,UnderpaintingInput:Di,SamplesInput:zi,AdjustSpeedInput:Zi,PersonaInput:q(fa,[[`render`,ya]]),ElButton:G,ElTabs:C,ElTabPane:w,Consumption:qe},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 ze(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})}}}),xa={class:`flex flex-col h-full`},Sa={class:`flex-1 min-h-0 overflow-hidden`},Ca={class:`p-5`},wa={class:`p-5`},Ta={class:`flex flex-col items-center justify-center px-5 pb-5 gap-2`},Ea={class:`flex gap-2 w-full`};function Da(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`,xa,[e(`div`,Sa,[a(N,{modelValue:t.mode,"onUpdate:modelValue":n[0]||=e=>t.mode=e,class:`suno-mode-tabs`,stretch:``},{default:m(()=>[a(D,{label:t.$t(`suno.mode.simple`),name:`simple`},{default:m(()=>[e(`div`,Ca,[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`,wa,[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`,Ta,[a(P,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),e(`div`,Ea,[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 Oa=q(ba,[[`render`,Da],[`__scopeId`,`data-v-c9eacc4d`]]),ka=le(),Aa=y({name:`TaskPreview`,components:{AudioIcon:_e,CodeIcon:pe,CollectionIcon:rt,CutIcon:it,DeleteIcon:Ne,DownloadIcon:me,DrumIcon:Qe,EditIcon:Ee,FastForwardIcon:et,GuitarIcon:nt,LinkIcon:ye,MagicIcon:W,MicrophoneIcon:H,MoreIcon:he,MusicIcon:Ce,PaletteIcon:we,PerformanceIcon:ge,ShuffleIcon:je,SortIcon:oe,TimeIcon:fe,UndoIcon:ke,ElImage:Z,ElIcon:b,ElTooltip:O,VideoPlay:U,VideoPause:Te,ElDropdown:z,ElDropdownMenu:R,ElDropdownItem:L,ElInput:Q,ElProgress:te,ElCheckbox:A,Loading:be,ApiCodeDialog:Je},props:{modelValue:{type:Object,required:!0}},data(){return{isFetchingVideoUrl:!1,isFetchingWav:!1,isFetchingMidi:!1,editingAudioId:null,editingTitle:``,apiCodeVisible:!1,apiCodePath:`/suno/audios`,apiCodeBody:{}}},computed:{loading(){return this.$store.state.suno?.status?.getApplications===J.Request},showViewCode(){return Ue()},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},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:{useFormatDuring:V,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,ka.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),Y.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}K.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.style_negative||t.persona_id)){Y.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??``,style_negative: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,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}),Y.success(this.$t(`suno.message.reusePromptSuccess`))},async onExtractVocals(e){let t=this.credential?.token;t&&(Y.info(this.$t(`suno.message.extractingVocals`)),K.vox({audio_id:e,async:!0},{token:t}).then(()=>{Y.success(this.$t(`suno.message.extractVocalsSuccess`))}).catch(e=>{Y.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&&(Y.info(this.$t(`suno.message.fetchingTiming`)),K.timing({audio_id:e},{token:t}).then(()=>{Y.success(this.$t(`suno.message.fetchTimingSuccess`))}).catch(e=>{Y.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,Y.info(this.$t(`suno.message.fetchingWav`));let n=(await K.wav({audio_id:e.id},{token:t})).data?.data?.[0]?.file_url;n?this.onDownload(null,n):Y.error(this.$t(`suno.message.fetchWavFailed`))}catch(e){let t=e?.response?.data?.error?.message;Y.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,Y.info(this.$t(`suno.message.fetchingMidi`));let n=(await K.midi({audio_id:e.id},{token:t})).data?.data;if(!n?.length){Y.error(this.$t(`suno.message.fetchMidiFailed`));return}let r=(e.title||e.id||`suno`).replace(/[^\w.-]+/g,`_`)+`.json`;(0,ka.saveAs)(new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),r)}catch(e){let t=e?.response?.data?.error?.message;Y.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}Y.info(this.$t(`suno.message.startingTask`)),K.audio(n,{token:r}).then(()=>{Y.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{Y.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 Be.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),Y.success(this.$t(`suno.message.deleteSuccess`))},async onGetTasks(){this.loading||await this.$store.dispatch(`suno/getTasks`,{limit:30,offset:0})}}}),ja={class:`task`},Ma=[`onClick`],Na=[`onClick`],Pa={class:`left`},Fa={key:0,class:`variation-badge`},Ia=[`aria-label`,`title`,`onClick`,`onKeydown`],La=[`aria-label`,`title`,`onClick`,`onKeydown`],Ra={key:3,class:`duration`},za={class:`info`},Ba={key:1,class:`title-row`},Va={class:`title`},Ha={key:0,class:`model-chip`},Ua=[`aria-label`,`title`,`onClick`],Wa={class:`style`},Ga={key:2,class:`progress-row`},Ka={class:`progress-text`},qa={class:`right`},Ja=[`aria-label`,`title`,`onClick`],Ya={class:`el-dropdown-link`},Xa={class:`flex items-center min-w-[120px]`},Za={class:`flex items-center min-w-[120px]`},Qa={class:`flex items-center min-w-[120px]`},$a={class:`el-dropdown-link`};function eo(f,v,y,b,x,S){let C=u(`el-checkbox`),w=u(`el-image`),T=u(`video-pause`),E=u(`el-icon`),D=u(`video-play`),O=u(`el-input`),k=u(`edit-icon`),A=u(`el-progress`),j=u(`fast-forward-icon`),M=u(`el-tooltip`),N=u(`download-icon`),P=u(`Loading`),F=u(`el-dropdown-item`),I=u(`el-dropdown-menu`),L=u(`el-dropdown`),R=u(`more-icon`),z=u(`music-icon`),B=u(`shuffle-icon`),ee=u(`link-icon`),te=u(`cut-icon`),ne=u(`microphone-icon`),re=u(`guitar-icon`),ie=u(`drum-icon`),ae=u(`collection-icon`),oe=u(`sort-icon`),se=u(`magic-icon`),ce=u(`audio-icon`),le=u(`palette-icon`),V=u(`performance-icon`),ue=u(`undo-icon`),de=u(`time-icon`),fe=u(`code-icon`),pe=u(`delete-icon`),me=u(`api-code-dialog`),he=h(`loading`);return _(),s(`div`,ja,[(_(!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(C,{"model-value":f.isMashupSelected(l),onClick:v[0]||=t(()=>{},[`stop`])},null,8,[`model-value`])],8,Na)):o(``,!0),d((_(),s(`div`,Pa,[a(w,{src:l?.image_url,class:`cover`,fit:`cover`,lazy:``},null,8,[`src`]),f.audios.length>1?(_(),s(`div`,Fa,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(E,null,{default:m(()=>[a(T,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,Ia)):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(E,null,{default:m(()=>[a(D,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})],40,La)):o(``,!0),l?.duration?(_(),s(`div`,Ra,i(f.useFormatDuring(l?.duration)),1)):o(``,!0)])),[[he,!l?.audio_url]]),e(`div`,za,[f.editingAudioId===l.id?(_(),s(`div`,{key:0,class:`title-edit`,onClick:v[2]||=t(()=>{},[`stop`])},[a(O,{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`,Ba,[e(`h2`,Va,i(l?.title),1),f.shortModel(l)?(_(),s(`span`,Ha,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(k,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Ua)):o(``,!0)])),e(`p`,Wa,i(l?.style),1),!l?.audio_url&&l?.progress!=null&&l?.progress<100?(_(),s(`div`,Ga,[a(A,{percentage:Math.round(l.progress),"stroke-width":4,"show-text":!1,status:`warning`,class:`progress-bar`},null,8,[`percentage`]),e(`span`,Ka,i(f.$t(`suno.name.generating`))+` `+i(Math.round(l.progress))+`%`,1)])):o(``,!0)]),e(`div`,qa,[l?.audio_url?(_(),p(M,{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(j,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Ja)]),_:2},1032,[`content`])):o(``,!0),a(L,null,{dropdown:m(()=>[a(I,null,{default:m(()=>[a(F,{disabled:f.isFetchingVideoUrl,onClick:e=>f.handleVideoDownload(l)},{default:m(()=>[e(`div`,Xa,[f.isFetchingVideoUrl?(_(),p(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(P,{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(F,{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(F,{disabled:f.isFetchingWav,onClick:e=>f.handleWavDownload(l)},{default:m(()=>[e(`div`,Za,[f.isFetchingWav?(_(),p(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(P,{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(F,{disabled:f.isFetchingMidi,onClick:e=>f.handleMidiDownload(l)},{default:m(()=>[e(`div`,Qa,[f.isFetchingMidi?(_(),p(E,{key:0,class:`is-loading mr-2`},{default:m(()=>[a(P,{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`,Ya,[a(M,{effect:`dark`,content:f.$t(`suno.button.download`),placement:`top`},{default:m(()=>[l?.audio_url||l?.video_url?(_(),p(N,{key:0,class:`icon icon-download`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024),a(L,null,{dropdown:m(()=>[a(I,{class:`suno-action-menu`},{default:m(()=>[l?.audio_url?(_(),p(F,{key:0,onClick:t(e=>f.onExtend(e,l),[`stop`])},{default:m(()=>[a(j,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.extend`)),1)]),_:1},8,[`onClick`])):o(``,!0),a(F,{onClick:t(e=>f.onCover(l),[`stop`])},{default:m(()=>[a(z,{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(F,{key:1,onClick:t(e=>f.onMashup(l),[`stop`])},{default:m(()=>[a(B,{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(F,{key:2,onClick:t(e=>f.onConcatMusic(l?.id),[`stop`])},{default:m(()=>[a(ee,{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[4]||=e(`div`,{class:`menu-divider`},null,-1),l?.id?(_(),p(F,{key:3,onClick:t(e=>f.onReplaceSection(l),[`stop`])},{default:m(()=>[a(te,{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(F,{key:4,onClick:t(e=>f.onOverpainting(l),[`stop`])},{default:m(()=>[a(ne,{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(F,{key:5,onClick:t(e=>f.onUnderpainting(l),[`stop`])},{default:m(()=>[a(re,{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(F,{key:6,onClick:t(e=>f.onSamples(l),[`stop`])},{default:m(()=>[a(ie,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`suno.button.samples`)),1)]),_:1},8,[`onClick`])):o(``,!0),v[5]||=e(`div`,{class:`menu-divider`},null,-1),l.id?(_(),p(F,{key:7,onClick:t(e=>f.onGetStems(l.id),[`stop`])},{default:m(()=>[a(ae,{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(F,{key:8,onClick:t(e=>f.onGetAllStems(l.id),[`stop`])},{default:m(()=>[a(oe,{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(F,{key:9,onClick:t(e=>f.onRemaster(l.id),[`stop`])},{default:m(()=>[a(se,{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(F,{key:10,onClick:t(e=>f.onExtractVocals(l.id),[`stop`])},{default:m(()=>[a(ce,{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(F,{key:11,onClick:t(e=>f.onArtistConsistency(l),[`stop`])},{default:m(()=>[a(le,{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(F,{key:12,onClick:t(e=>f.onAdjustSpeed(l),[`stop`])},{default:m(()=>[a(V,{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[6]||=e(`div`,{class:`menu-divider`},null,-1),a(F,{onClick:t(e=>f.onReusePrompt(l),[`stop`])},{default:m(()=>[a(ue,{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(F,{key:13,onClick:t(e=>f.onGetTiming(l.id),[`stop`])},{default:m(()=>[a(de,{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(F,{key:14,onClick:t(f.onViewCode,[`stop`])},{default:m(()=>[a(fe,{class:`menu-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(f.$t(`common.button.viewCode`)),1)]),_:1},8,[`onClick`])):o(``,!0),v[7]||=e(`div`,{class:`menu-divider`},null,-1),l?.id?(_(),p(F,{key:15,class:`delete-item`,onClick:t(e=>f.onDelete(l),[`stop`])},{default:m(()=>[a(pe,{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`,$a,[a(M,{effect:`dark`,content:f.$t(`suno.button.more`),placement:`top`},{default:m(()=>[l?.audio_url||l?.video_url?(_(),p(R,{key:0,class:`icon icon-ellipsis`,size:`1em`,"aria-hidden":`true`,focusable:`false`})):o(``,!0)]),_:2},1032,[`content`])])]),_:2},1024)])],10,Ma))),128)),a(me,{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`])])}var to=y({name:`RecentPanel`,components:{FilterIcon:tt,SearchIcon:Ae,SortIcon:oe,ElSkeletonItem:ne,ElSkeleton:re,ElInput:Q,ElButton:G,ElDropdown:z,ElDropdownMenu:R,ElDropdownItem:L,ElPopover:ee,ElRadioGroup:M,ElRadioButton:j,ElSelect:x,ElOption:S,ElIcon:b,Loading:be,TaskPreview:q(Aa,[[`render`,eo]]),Player:ue,NoTasks:Xe,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?.()}}}),no={key:0,class:`tasks`},ro={class:`left w-[70px] p-[10px] flex items-center`},io={class:`main w-[calc(100%-70px)] flex-1 p-[10px]`},ao={key:0,class:`task-toolbar`},oo={key:0,class:`filter-badge`},so={class:`filter-popover`},co={class:`filter-row`},lo={class:`filter-label`},uo={class:`filter-row`},fo={class:`filter-label`},po={class:`filter-row`},mo={class:`filter-label`},ho={key:0,class:`filter-row`},go={class:`filter-label`},_o={class:`filter-actions`},vo={key:2,class:`w-full flex-1 flex items-center justify-center`},yo={class:`text-sm text-gray-400`},bo={key:3,class:`w-full flex-1 flex flex-col items-center justify-center gap-2`},xo={class:`text-sm text-gray-400`},So={key:4,class:`w-full flex-1 flex items-center justify-center`},Co={key:5,class:`w-full flex-1 flex items-center justify-center`},wo={class:`h-20`};function To(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`),ee=u(`player`);return _(),s(l,null,[t.tasks?.items===void 0?(_(),s(`div`,no,[(_(),s(l,null,g(3,t=>e(`div`,{key:t,class:`flex`},[e(`div`,ro,[a(S,{animated:``},{template:m(()=>[a(x,{variant:`image`,class:`avatar w-[50px] h-[50px]`})]),_:1})]),e(`div`,io,[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`,ao,[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`,oo,i(t.activeFilterCount),1)):o(``,!0)]),_:1},8,[`class`])]),default:m(()=>[e(`div`,so,[e(`div`,co,[e(`div`,lo,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`,uo,[e(`div`,fo,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`,po,[e(`div`,mo,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`,ho,[e(`div`,go,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`,_o,[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`,vo,[e(`p`,yo,i(t.$t(`suno.message.noSearchResults`)),1)])):!t.loading&&t.activeFilterCount>0&&t.tasks?.items?.length>0?(_(),s(`div`,bo,[e(`p`,xo,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`,So,[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`,Co,[a(B)])):o(``,!0)],64)),d(e(`div`,wo,[a(ee,{namespace:`suno`,tracks:t.visibleTracks},null,8,[`tracks`])],512),[[v,!!t.$store?.state?.suno?.audio?.object]])],64)}var Eo=q(to,[[`render`,To],[`__scopeId`,`data-v-06fc829c`]]),Do=y({name:`TaskPreview`,components:{IconPicture:ve,Headset:_e,ElImage:Z,ElAvatar:k,ElIcon:b},computed:{audio(){return this.$store.state.suno?.audio}}}),Oo={key:0,class:`size-full overflow-hidden`},ko={class:`relative h-[300px]`},Ao={class:`flex items-center justify-center size-full bg-[var(--el-bg-color)]`},jo={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`},Mo={class:`p-4`},No={class:`flex items-center font-bold mb-2`},Po={class:`text-[var(--el-text-color-regular)] mb-2`},Fo={class:`text-xs text-[var(--el-text-color-regular)]`},Io={class:`mt-4 text-sm leading-[25px] whitespace-pre-wrap`},Lo={key:1,class:`flex flex-col items-center justify-center w-full h-full text-[var(--el-text-color-placeholder)]`};function Ro(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`,Oo,[e(`div`,ko,[a(p,{src:t.audio.image_url,fit:`cover`,class:`size-full`},{error:m(()=>[e(`div`,Ao,[a(f,{class:`text-3xl`},{default:m(()=>[a(d,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})])]),_:1},8,[`src`]),e(`h2`,jo,i(t.audio?.title),1)]),e(`div`,Mo,[e(`div`,No,[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`,Po,i(t.audio?.style),1),e(`p`,Fo,i(t.$dayjs.format(t.audio?.created_at)),1),e(`div`,Io,[e(`p`,null,i(t.audio?.lyric),1)])])])):(_(),s(`div`,Lo,[a(f,{class:`text-5xl opacity-40`},{default:m(()=>[a(g,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1})]))}var zo=y({name:`SunoIndex`,components:{Layout:ft,ConfigPanel:Oa,RecentPanel:Eo,PreviewPanel:q(Do,[[`render`,Ro]])},mixins:[Re],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,loadingAll:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.suno?.status?.getApplications===J.Request},tasksLoading(){return this.$store.state.suno?.status?.getTasks===J.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===J.Request},needApply(){return this.$store.state.suno.status.getApplications===J.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 Ze({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(){We.create({application:this.application}).then(({data:e})=>{this.application=e,Y.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&Y.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)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(!Ke(this.uploadTracker,e=>this.$t(e),e=>Y.warning(e)))return;let e={...this.config,async:!0};if(!this.hasSunoInput(e)){Y.error(this.$t(`suno.message.promptRequired`));return}if(this.hasText(e.prompt)&&(e.prompt=e.prompt.trim()),!Ie())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}Y.info(this.$t(`suno.message.startingTask`)),Ve(`suno`,K.audio(e,{token:t})).then(()=>{Y.success(this.$t(`suno.message.startTaskSuccess`))}).catch(e=>{Y.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 Bo(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 Vo=q(zo,[[`render`,Bo],[`__scopeId`,`data-v-237ce3b7`]]);export{Vo 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-DT9RB41V.js";import{t as x}from"./upload-CwrIdcvB.js";import{t as S}from"./tooltip-BPoFx_0r.js";import{t as C}from"./alert-B8xKY_cZ.js";import{t as w}from"./drawer-B3YqI23b.js";import{t as T}from"./input-number-ColumRcM.js";import{t as E}from"./switch-CyBT54Uh.js";import{n as D}from"./taskDrawerMixin-CjsoaGWg.js";import{t as O}from"./box-BQZFgJhA.js";import{t as k}from"./clock-bNJ1O4h8.js";import{t as A}from"./CopyToClipboard-CMiMmisS.js";import{t as j}from"./hash-CC5NzWfo.js";import{t as M}from"./image-OOgYSkAt.js";import{t as N}from"./info-C2D_XeJh.js";import{t as P}from"./PromptTextarea-Dhj4WJey.js";import{t as F}from"./triangle-alert-DmzQvoA8.js";import{t as ee}from"./upload-B5dfYOVm.js";import{t as I}from"./wand-sparkles-RP6KkE1-.js";import{t as L}from"./zap-BvpwfPaQ.js";import{An as te,Bn as ne,Dn as re,Fn as ie,In as R,Mn as ae,Nn as oe,On as se,Pn as z,Rn as B,kn as V,zn as H}from"./constants-CqjLASsC.js";import{$t as U,Ai as W,Bt as G,E as K,Vt as ce,Wt as le,ei as q,gi as J,mr as ue,ri as de,wn as Y,zt as fe}from"./index-BFeCxAir.js";import{t as X}from"./ImagePreview-BjSo9spH.js";import{t as pe}from"./Consumption-Byvcpogq.js";import{a as Z,n as me,r as he,t as ge}from"./pagination-CB3471Sj.js";import{t as _e}from"./ApiCodeButton-CbZLUqWT.js";import{t as ve}from"./BotPlaceholder-HnC2WR5J.js";import{t as ye}from"./ImageWrapper-DbMM6MID.js";var be=_({name:`LayoutNanobanana`,components:{MagicIcon:I,ElDrawer:w,ElButton:W},mixins:[D]}),xe={class:`main flex flex-row flex-1`},Se={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ce={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function we(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,xe,[e(`div`,Se,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ce,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[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 Te=K(be,[[`render`,we],[`__scopeId`,`data-v-fa2172a6`]]),Ee=_({name:`PromptInput`,components:{PromptTextarea:P},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 De(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 Oe=K(Ee,[[`render`,De]]),ke=_({name:`ImageUrlsInput`,components:{UploadIcon:ee,ElUpload:x,ElButton:W,InfoIcon:Z,ImagePreview:X},mixins:[G],data(){return{fileList:[],uploadUrl:de()+`/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.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(){J.warning(this.$t(`openaiimage.message.uploadImageExceed`))},onError(){J.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()}}}),Ae={class:`field flex items-center justify-between`},je={class:`title font-bold text-[14px] mb-[10px]`},Me={class:`upload-wrapper flex flex-col items-start gap-[8px]`},Ne={class:`controls flex items-center`},Pe={class:`file-list flex flex-wrap gap-[10px]`};function Fe(t,n,o,u,d,g){let _=l(`upload-icon`),v=l(`el-button`),y=l(`el-upload`),b=l(`info-icon`),x=l(`image-preview`);return h(),s(c,null,[e(`div`,Ae,[e(`h2`,je,i(t.$t(`openaiimage.name.imageUrls`)),1),e(`div`,Me,[e(`div`,Ne,[a(y,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value`,limit:5,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(v,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(_,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`openaiimage.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`]),a(b,{content:t.$t(`openaiimage.description.imageUrls`),class:`ml-2`},null,8,[`content`])])])]),e(`div`,Pe,[(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))])],64)}var Ie=K(ke,[[`render`,Fe]]),Le=_({name:`OpenAIImageModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:ae,label:this.$t(`openaiimage.model.gptImage1`)},{value:oe,label:this.$t(`openaiimage.model.gptImage15`)},{value:z,label:this.$t(`openaiimage.model.gptImage2`)},{value:ie,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||=te}}),Re={class:`field`},ze={class:`label`},Be={class:`box`},Ve={class:`title font-bold`};function He(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`h2`,Ve,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 Ue=K(Le,[[`render`,He],[`__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 We=_({name:`OpenAIImageSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,ElSwitch:E,ElInputNumber:T,InfoIcon:Z},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},emptySizeValue(){return``},customSupported(){return V.includes(this.model)},presets(){return R[this.model]??R[`gpt-image-2`]??[]},presetGroups(){return this.model===`gpt-image-2`||this.model===`gpt-image-2:official`?[{label:this.$t(`openaiimage.sizeGroup.standard1k`),options:B},{label:this.$t(`openaiimage.sizeGroup.preset2k`),options:H},{label:this.$t(`openaiimage.sizeGroup.preset4k`),options:ne}]:[{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()}},presetValue:{get(){let e=this.storedSize;return e&&this.presets.includes(e)?e:this.emptySizeValue},set(e){this.customMode=!1,this.commitSize(e||void 0)}},multiple(){return 16},minSide(){return 256},maxSide(){return re},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:se.toLocaleString()}):``}},watch:{model:{immediate:!1,handler(){this.customSupported||(this.customMode=!1);let e=this.storedSize;if(!e||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()}},storedSize(e){if(!e){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}`))}}}),Ge={class:`resolution`},Ke={class:`field`},qe={class:`label`},Je={class:`box`},Ye={class:`title font-bold`},Xe={class:`field custom-toggle`},Ze={class:`label`},Qe={class:`box`},$e={class:`title font-bold`},et={key:0,class:`custom-inputs`},tt={class:`row`},nt={class:`row-label`},rt={class:`row`},it={class:`row-label`},at={key:0,class:`error`};function ot(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`,Ge,[e(`div`,Ke,[e(`div`,qe,[e(`div`,Je,[e(`h2`,Ye,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(`suno.gender.auto`),value:t.emptySizeValue},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`,Xe,[e(`div`,Ze,[e(`div`,Qe,[e(`h2`,$e,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`,et,[e(`div`,tt,[e(`span`,nt,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`,rt,[e(`span`,it,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`,at,i(t.customError),1)):o(``,!0)])):o(``,!0)],64)):o(``,!0)])}var st=_({name:`ConfigPanel`,components:{MagicIcon:I,ElButton:W,PromptInput:Oe,Consumption:pe,ImageUrlsInput:Ie,ModelSelector:Ue,ResolutionSelector:K(We,[[`render`,ot],[`__scopeId`,`data-v-dfce4922`]])},emits:[`generate`],computed:{config(){return this.$store.state.openaiimage?.config},consumption(){return le({...this.config||{}},this.service?.cost)},service(){return this.$store.state.openaiimage?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),ct={class:`flex flex-col h-full`},lt={class:`flex-1 overflow-y-auto p-5`},ut={class:`flex flex-col items-center justify-center px-5 pb-5`};function dt(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`,ct,[e(`div`,lt,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`})]),e(`div`,ut,[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 ft=K(st,[[`render`,dt]]),pt=_({name:`TaskPreview`,components:{ApplicationIcon:O,ChannelIcon:j,ImageIcon:M,InfoIcon:N,LightningIcon:L,MagicIcon:I,TimeIcon:k,WarningIcon:F,CopyToClipboard:A,ElAlert:C,ImageWrapper:ye,ElButton:W,ElTooltip:S,ImagePreview:X,ApiCodeButton:_e},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)}}}),mt={class:`preview`},ht={class:`left`},gt={class:`main`},_t={class:`bot`},vt={class:`datetime`},yt={class:`info`},bt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},xt={key:1,class:`prompt mt-2`},St={key:0},Ct={key:0,class:n({content:!0,failed:!0})},wt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},Tt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Mt={key:1,class:n({content:!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={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Rt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},zt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Bt={key:2,class:n({content:!0})},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Vt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ht={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ut={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function Wt(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`image-preview`),x=l(`image-wrapper`),S=l(`el-button`),C=l(`el-tooltip`),w=l(`api-code-button`),T=l(`application-icon`),E=l(`image-icon`),D=l(`lightning-icon`),O=l(`magic-icon`),k=l(`copy-to-clipboard`),A=l(`time-icon`),j=l(`channel-icon`),M=l(`el-alert`),N=l(`warning-icon`),P=l(`info-icon`);return h(),s(`div`,mt,[e(`div`,ht,[a(y,{capability:`openaiimage`,part:`avatar`,class:`avatar`})]),e(`div`,gt,[e(`div`,_t,[a(y,{capability:`openaiimage`,part:`name`}),e(`span`,vt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,yt,[n.referenceImages.length>0?(h(),s(`div`,bt,[(h(!0),s(c,null,m(n.referenceImages,(e,t)=>(h(),f(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,xt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,St,` - (`+i(n.$t(`openaiimage.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,Ct,[e(`div`,wt,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(x,{key:t,src:e?.image_url||e?.url||``,"raw-src":e?.image_url||e?.url||``},null,8,[`src`,`raw-src`]))),128))]),e(`div`,Tt,[a(C,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(S,{type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=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(w,{path:n.openaiimagePath,body:n.openaiimageCodeBody},null,8,[`path`,`body`])]),a(M,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,Et,[a(T,{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`,Dt,[a(E,{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`,Ot,[a(D,{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`,kt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(k,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,At,[a(A,{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`,jt,[a(j,{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(k,{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`,Mt,[a(M,{closable:!1,class:`failure`},{template:p(()=>[a(N,{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`,Nt,[a(T,{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(E,{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(D,{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(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(k,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,Lt,[a(P,{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(k,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Rt,[a(A,{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`,zt,[a(j,{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(k,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Bt,[a(M,{closable:!1,class:`info`},{template:p(()=>[a(N,{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`,$,[a(T,{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`,Vt,[a(E,{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`,Ht,[a(D,{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`,Ut,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(k,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Gt=_({name:`RecentPanel`,components:{TaskPreview:K(pt,[[`render`,Wt],[`__scopeId`,`data-v-6fc90c3b`]]),BotPlaceholder:ve,NoTasks:he,ScrollList:me},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?.()}}}),Kt={key:0},qt={key:2,class:`w-full h-full flex items-center justify-center`};function Jt(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`,Kt,[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`,qt,[a(v)])):o(``,!0)],64)}var Yt=_({name:`OpenAIImageIndex`,components:{ConfigPanel:ft,Layout:Te,RecentPanel:K(Gt,[[`render`,Jt]])},mixins:[ce],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.openaiimage?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.openaiimage?.status?.getTasks===q.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 ge({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(!fe(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;if(!this.hasText(e.prompt)){J.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(!U())return;let i=this.credential?.token;if(!i){console.error(`no token specified`);return}J.info(this.$t(`openaiimage.message.startingTask`)),ue(`openaiimage`,t?Y.edit(r,{token:i}):Y.generate(n,{token:i})).then(e=>{console.debug(`task accepted`,e.data?.task_id),J.success(this.$t(`openaiimage.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?J.error(this.$t(`openaiimage.message.usedUp`)):J.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 Xt(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 Zt=K(Yt,[[`render`,Xt]]);export{Zt 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-DkUAUy_k.js";import{t as x}from"./upload-CxpxrNW4.js";import{t as S}from"./tooltip-Zj7J10Sl.js";import{t as C}from"./alert-FLPzVn5V.js";import{t as w}from"./drawer-D2zF1fRK.js";import{t as T}from"./input-number-BRjaLilb.js";import{t as E}from"./switch-DEm5ZvmH.js";import{n as D}from"./taskDrawerMixin-CHc1XRAW.js";import{t as O}from"./box-CBQ3Qg4z.js";import{t as k}from"./clock-BGDVOm2I.js";import{t as A}from"./CopyToClipboard-BMIKPJkS.js";import{t as j}from"./hash-DoI4RrAO.js";import{t as M}from"./image-D48Xnk8e.js";import{t as N}from"./info-BxHKDQkc.js";import{t as P}from"./PromptTextarea-V8KSdVr_.js";import{t as F}from"./triangle-alert-Baf4IzQp.js";import{t as ee}from"./upload-DgSyNPbF.js";import{t as I}from"./wand-sparkles-CZvTgSiZ.js";import{t as L}from"./zap-DMW4jsPf.js";import{An as te,Bn as ne,Dn as re,Fn as ie,In as R,Mn as ae,Nn as oe,On as se,Pn as z,Rn as B,kn as V,zn as H}from"./constants-CqjLASsC.js";import{$t as U,Ai as W,Bt as G,E as K,Vt as ce,Wt as le,ei as q,gi as J,mr as ue,ri as de,wn as Y,zt as fe}from"./index-ZJhysbj9.js";import{t as X}from"./ImagePreview-DQ9FtwGn.js";import{t as pe}from"./Consumption-Dr3zhOGS.js";import{a as Z,n as me,r as he,t as ge}from"./pagination-CfluQtNV.js";import{t as _e}from"./ApiCodeButton-DpqfYFPA.js";import{t as ve}from"./BotPlaceholder-CsTEWhRD.js";import{t as ye}from"./ImageWrapper-0UgdGlmm.js";var be=_({name:`LayoutNanobanana`,components:{MagicIcon:I,ElDrawer:w,ElButton:W},mixins:[D]}),xe={class:`main flex flex-row flex-1`},Se={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ce={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function we(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,xe,[e(`div`,Se,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ce,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[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 Te=K(be,[[`render`,we],[`__scopeId`,`data-v-fa2172a6`]]),Ee=_({name:`PromptInput`,components:{PromptTextarea:P},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 De(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 Oe=K(Ee,[[`render`,De]]),ke=_({name:`ImageUrlsInput`,components:{UploadIcon:ee,ElUpload:x,ElButton:W,InfoIcon:Z,ImagePreview:X},mixins:[G],data(){return{fileList:[],uploadUrl:de()+`/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.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(){J.warning(this.$t(`openaiimage.message.uploadImageExceed`))},onError(){J.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()}}}),Ae={class:`field flex items-center justify-between`},je={class:`title font-bold text-[14px] mb-[10px]`},Me={class:`upload-wrapper flex flex-col items-start gap-[8px]`},Ne={class:`controls flex items-center`},Pe={class:`file-list flex flex-wrap gap-[10px]`};function Fe(t,n,o,u,d,g){let _=l(`upload-icon`),v=l(`el-button`),y=l(`el-upload`),b=l(`info-icon`),x=l(`image-preview`);return h(),s(c,null,[e(`div`,Ae,[e(`h2`,je,i(t.$t(`openaiimage.name.imageUrls`)),1),e(`div`,Me,[e(`div`,Ne,[a(y,{"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value`,limit:5,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(v,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(_,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`openaiimage.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`]),a(b,{content:t.$t(`openaiimage.description.imageUrls`),class:`ml-2`},null,8,[`content`])])])]),e(`div`,Pe,[(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))])],64)}var Ie=K(ke,[[`render`,Fe]]),Le=_({name:`OpenAIImageModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[{value:ae,label:this.$t(`openaiimage.model.gptImage1`)},{value:oe,label:this.$t(`openaiimage.model.gptImage15`)},{value:z,label:this.$t(`openaiimage.model.gptImage2`)},{value:ie,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||=te}}),Re={class:`field`},ze={class:`label`},Be={class:`box`},Ve={class:`title font-bold`};function He(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`h2`,Ve,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 Ue=K(Le,[[`render`,He],[`__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 We=_({name:`OpenAIImageSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,ElSwitch:E,ElInputNumber:T,InfoIcon:Z},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},emptySizeValue(){return``},customSupported(){return V.includes(this.model)},presets(){return R[this.model]??R[`gpt-image-2`]??[]},presetGroups(){return this.model===`gpt-image-2`||this.model===`gpt-image-2:official`?[{label:this.$t(`openaiimage.sizeGroup.standard1k`),options:B},{label:this.$t(`openaiimage.sizeGroup.preset2k`),options:H},{label:this.$t(`openaiimage.sizeGroup.preset4k`),options:ne}]:[{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()}},presetValue:{get(){let e=this.storedSize;return e&&this.presets.includes(e)?e:this.emptySizeValue},set(e){this.customMode=!1,this.commitSize(e||void 0)}},multiple(){return 16},minSide(){return 256},maxSide(){return re},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:se.toLocaleString()}):``}},watch:{model:{immediate:!1,handler(){this.customSupported||(this.customMode=!1);let e=this.storedSize;if(!e||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()}},storedSize(e){if(!e){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}`))}}}),Ge={class:`resolution`},Ke={class:`field`},qe={class:`label`},Je={class:`box`},Ye={class:`title font-bold`},Xe={class:`field custom-toggle`},Ze={class:`label`},Qe={class:`box`},$e={class:`title font-bold`},et={key:0,class:`custom-inputs`},tt={class:`row`},nt={class:`row-label`},rt={class:`row`},it={class:`row-label`},at={key:0,class:`error`};function ot(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`,Ge,[e(`div`,Ke,[e(`div`,qe,[e(`div`,Je,[e(`h2`,Ye,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(`suno.gender.auto`),value:t.emptySizeValue},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`,Xe,[e(`div`,Ze,[e(`div`,Qe,[e(`h2`,$e,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`,et,[e(`div`,tt,[e(`span`,nt,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`,rt,[e(`span`,it,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`,at,i(t.customError),1)):o(``,!0)])):o(``,!0)],64)):o(``,!0)])}var st=_({name:`ConfigPanel`,components:{MagicIcon:I,ElButton:W,PromptInput:Oe,Consumption:pe,ImageUrlsInput:Ie,ModelSelector:Ue,ResolutionSelector:K(We,[[`render`,ot],[`__scopeId`,`data-v-dfce4922`]])},emits:[`generate`],computed:{config(){return this.$store.state.openaiimage?.config},consumption(){return le({...this.config||{}},this.service?.cost)},service(){return this.$store.state.openaiimage?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),ct={class:`flex flex-col h-full`},lt={class:`flex-1 overflow-y-auto p-5`},ut={class:`flex flex-col items-center justify-center px-5 pb-5`};function dt(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`,ct,[e(`div`,lt,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(g,{class:`mb-4`}),a(_,{class:`mb-4`})]),e(`div`,ut,[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 ft=K(st,[[`render`,dt]]),pt=_({name:`TaskPreview`,components:{ApplicationIcon:O,ChannelIcon:j,ImageIcon:M,InfoIcon:N,LightningIcon:L,MagicIcon:I,TimeIcon:k,WarningIcon:F,CopyToClipboard:A,ElAlert:C,ImageWrapper:ye,ElButton:W,ElTooltip:S,ImagePreview:X,ApiCodeButton:_e},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)}}}),mt={class:`preview`},ht={class:`left`},gt={class:`main`},_t={class:`bot`},vt={class:`datetime`},yt={class:`info`},bt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},xt={key:1,class:`prompt mt-2`},St={key:0},Ct={key:0,class:n({content:!0,failed:!0})},wt={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},Tt={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Dt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ot={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Mt={key:1,class:n({content:!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={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Rt={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},zt={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Bt={key:2,class:n({content:!0})},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Vt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ht={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ut={class:`text-[var(--el-text-color-regular)] text-xs mb-2`};function Wt(n,u,d,g,_,v){let y=l(`capability-presentation`),b=l(`image-preview`),x=l(`image-wrapper`),S=l(`el-button`),C=l(`el-tooltip`),w=l(`api-code-button`),T=l(`application-icon`),E=l(`image-icon`),D=l(`lightning-icon`),O=l(`magic-icon`),k=l(`copy-to-clipboard`),A=l(`time-icon`),j=l(`channel-icon`),M=l(`el-alert`),N=l(`warning-icon`),P=l(`info-icon`);return h(),s(`div`,mt,[e(`div`,ht,[a(y,{capability:`openaiimage`,part:`avatar`,class:`avatar`})]),e(`div`,gt,[e(`div`,_t,[a(y,{capability:`openaiimage`,part:`name`}),e(`span`,vt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,yt,[n.referenceImages.length>0?(h(),s(`div`,bt,[(h(!0),s(c,null,m(n.referenceImages,(e,t)=>(h(),f(b,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),n.modelValue?.request?.prompt?(h(),s(`p`,xt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,St,` - (`+i(n.$t(`openaiimage.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,Ct,[e(`div`,wt,[(h(!0),s(c,null,m(n.images,(e,t)=>(h(),f(x,{key:t,src:e?.image_url||e?.url||``,"raw-src":e?.image_url||e?.url||``},null,8,[`src`,`raw-src`]))),128))]),e(`div`,Tt,[a(C,{class:`box-item`,effect:`dark`,content:n.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(S,{type:`info`,size:`small`,class:`btn-action`,onClick:u[0]||=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(w,{path:n.openaiimagePath,body:n.openaiimageCodeBody},null,8,[`path`,`body`])]),a(M,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(h(),s(`p`,Et,[a(T,{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`,Dt,[a(E,{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`,Ot,[a(D,{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`,kt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(k,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,At,[a(A,{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`,jt,[a(j,{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(k,{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`,Mt,[a(M,{closable:!1,class:`failure`},{template:p(()=>[a(N,{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`,Nt,[a(T,{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(E,{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(D,{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(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(k,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,Lt,[a(P,{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(k,{content:n.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Rt,[a(A,{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`,zt,[a(j,{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(k,{content:n.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,Bt,[a(M,{closable:!1,class:`info`},{template:p(()=>[a(N,{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`,$,[a(T,{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`,Vt,[a(E,{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`,Ht,[a(D,{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`,Ut,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`openaiimage.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(k,{content:n.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})]))])])}var Gt=_({name:`RecentPanel`,components:{TaskPreview:K(pt,[[`render`,Wt],[`__scopeId`,`data-v-6fc90c3b`]]),BotPlaceholder:ve,NoTasks:he,ScrollList:me},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?.()}}}),Kt={key:0},qt={key:2,class:`w-full h-full flex items-center justify-center`};function Jt(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`,Kt,[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`,qt,[a(v)])):o(``,!0)],64)}var Yt=_({name:`OpenAIImageIndex`,components:{ConfigPanel:ft,Layout:Te,RecentPanel:K(Gt,[[`render`,Jt]])},mixins:[ce],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.openaiimage?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.openaiimage?.status?.getTasks===q.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 ge({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(!fe(this.uploadTracker,e=>this.$t(e),e=>J.warning(e)))return;let e={...this.config||{}},t=Array.isArray(e?.image_urls)&&e.image_urls.length>0;if(!this.hasText(e.prompt)){J.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(!U())return;let i=this.credential?.token;if(!i){console.error(`no token specified`);return}J.info(this.$t(`openaiimage.message.startingTask`)),ue(`openaiimage`,t?Y.edit(r,{token:i}):Y.generate(n,{token:i})).then(e=>{console.debug(`task accepted`,e.data?.task_id),J.success(this.$t(`openaiimage.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?J.error(this.$t(`openaiimage.message.usedUp`)):J.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 Xt(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 Zt=K(Yt,[[`render`,Xt]]);export{Zt as default};