@acedatacloud/nexior 3.236.0 → 3.238.0

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 (233) hide show
  1. package/dist/assets/{ApiCodeButton-CrRtDEA-.js → ApiCodeButton-b6I26hKj.js} +1 -1
  2. package/dist/assets/{Auth-DkLzsfmT.js → Auth-PaE6S1n7.js} +1 -1
  3. package/dist/assets/{BotPlaceholder-DshCUMDY.js → BotPlaceholder-CrAvHEBe.js} +1 -1
  4. package/dist/assets/{Callback-BYFJ1AeD.js → Callback-pyYyP0zU.js} +1 -1
  5. package/dist/assets/{Console-DFG4J_Jl.js → Console-_w4gRSww.js} +1 -1
  6. package/dist/assets/{Consumption-BjI49_Pa.js → Consumption-fXKDZQba.js} +1 -1
  7. package/dist/assets/{Conversation-eCZC0Ghs.js → Conversation-CxdAmd_e.js} +1 -1
  8. package/dist/assets/{CopyToClipboard-iGf1rugK.js → CopyToClipboard-Dkvhu2YZ.js} +1 -1
  9. package/dist/assets/{Detail-Cd-pcK8S.js → Detail-R-MvtG_R.js} +2 -2
  10. package/dist/assets/{Extra-DSi3zCdS.js → Extra-Ds15G5nq.js} +1 -1
  11. package/dist/assets/{FilePreview-s1NoIwc1.js → FilePreview-pgoVFo3e.js} +1 -1
  12. package/dist/assets/{Hailuo-BXzKxgGb.js → Hailuo-Bq1kApAZ.js} +1 -1
  13. package/dist/assets/{History-Bv6LP0W8.js → History-CQF5YuSy.js} +1 -1
  14. package/dist/assets/{ImagePreview-CimxR66Y.js → ImagePreview-JALXNCt5.js} +1 -1
  15. package/dist/assets/{ImageWrapper-DcdH0ACg.js → ImageWrapper-B6bwIZC4.js} +1 -1
  16. package/dist/assets/{Index-CtIe5XUM.js → Index-B1038rsE.js} +1 -1
  17. package/dist/assets/{Index-PyKkuUcV.js → Index-BRlqRsZ-.js} +1 -1
  18. package/dist/assets/{Index-BeJ33zEU.js → Index-CCM1QAFu.js} +1 -1
  19. package/dist/assets/{Index-Bj4CFLJC.js → Index-CTdCBia5.js} +1 -1
  20. package/dist/assets/{Index-BZ_bltRK.js → Index-CbvLb6tL.js} +1 -1
  21. package/dist/assets/{Index-BA92Ssbm.js → Index-CdyfsZL0.js} +1 -1
  22. package/dist/assets/{Index-D04baNsJ.js → Index-CfH4QCDe.js} +1 -1
  23. package/dist/assets/{Index-CipAh56z.js → Index-CkuJZMPu.js} +1 -1
  24. package/dist/assets/{Index-DvhJLyZW.js → Index-Cv1-05Yz.js} +1 -1
  25. package/dist/assets/{Index-D_gQjc1L.js → Index-D8oVV2nV.js} +1 -1
  26. package/dist/assets/{Index-1asEOZBd.js → Index-DAGTaxaI.js} +1 -1
  27. package/dist/assets/{Index-xNV5pOBL.js → Index-DBh4pS1n.js} +1 -1
  28. package/dist/assets/{Index-C02epdF-.js → Index-DLRXkkz3.js} +1 -1
  29. package/dist/assets/{Index-CHLG_yhn.js → Index-DRdymI2Z.js} +1 -1
  30. package/dist/assets/{Index-CiqNkIW5.js → Index-DZGXx6cz.js} +1 -1
  31. package/dist/assets/{Index-13SSOOb0.js → Index-DaXBK5Lt.js} +1 -1
  32. package/dist/assets/{Index-xDEKnxjc.js → Index-DccJ89PY.js} +1 -1
  33. package/dist/assets/{Index-__yw529f.js → Index-DctEY-lC.js} +1 -1
  34. package/dist/assets/{Index-ByBYMPWx.js → Index-DsKypp_X.js} +1 -1
  35. package/dist/assets/{Index-BUUmQQLx.js → Index-DwT-pJPK.js} +1 -1
  36. package/dist/assets/{Index-PeHJeb8x.js → Index-EfYdAC_P.js} +1 -1
  37. package/dist/assets/{Index-2Pm85nKJ.js → Index-TTl7OOyv.js} +1 -1
  38. package/dist/assets/{Index-CKdB0Xpt.js → Index-U-8ZmoIp.js} +1 -1
  39. package/dist/assets/{Index-DNKsSLye.js → Index-_8wOc8_e.js} +1 -1
  40. package/dist/assets/{Index-CBrZfy-_.js → Index-uqQtuF5u.js} +1 -1
  41. package/dist/assets/{Invitees-BLVtmP6n.js → Invitees-BRyKw-Ew.js} +1 -1
  42. package/dist/assets/{List-BG2nFZbo.js → List-BLaA0u37.js} +1 -1
  43. package/dist/assets/{List-ZqaLpZaQ.js → List-BzTD-9bE.js} +1 -1
  44. package/dist/assets/{List-BBERwTjb.js → List-DoBAycHx.js} +1 -1
  45. package/dist/assets/{Main-DW5LCJG2.js → Main-Cvp-11ci.js} +1 -1
  46. package/dist/assets/{Model-DxGfMKnq.js → Model-D_jePew7.js} +1 -1
  47. package/dist/assets/{Navigator-C67NgyXL.css → Navigator-A1XUDPoW.css} +1 -1
  48. package/dist/assets/{Navigator-DBzh_exJ.js → Navigator-B9gJBbbb.js} +3 -3
  49. package/dist/assets/{NoTasks-Bbda08Q1.js → NoTasks-BOCm6wvK.js} +1 -1
  50. package/dist/assets/{NotFound-_37Kr_1Z.js → NotFound-ByHiZjrY.js} +1 -1
  51. package/dist/assets/{Pagination-DGQ61fZw.js → Pagination-DYHEKFWr.js} +1 -1
  52. package/dist/assets/{Player.vue_vue_type_script_setup_true_lang-DZtWaqFs.js → Player.vue_vue_type_script_setup_true_lang-CzIy_fae.js} +1 -1
  53. package/dist/assets/{Status-BngjLqTY.js → Status-PbE5axiV.js} +1 -1
  54. package/dist/assets/{Subscribe-BG4pml7u.js → Subscribe-DlW3JFVC.js} +1 -1
  55. package/dist/assets/{TabSwitcher-C0BaS157.js → TabSwitcher-Dj4V_5jH.js} +1 -1
  56. package/dist/assets/{Tts-wXK_UI40.js → Tts-IWPYqTGS.js} +1 -1
  57. package/dist/assets/{VideoPlayer-CVW6n0qR.js → VideoPlayer-F_mj2w_4.js} +1 -1
  58. package/dist/assets/{_Uint8Array-BIXfM435.js → _Uint8Array-ooKCswaC.js} +1 -1
  59. package/dist/assets/{_baseClone-DKeYjJkl.js → _baseClone-Bx_7nX1I.js} +1 -1
  60. package/dist/assets/{_baseIteratee-Bt2Y2jN_.js → _baseIteratee-HaFBNbp6.js} +1 -1
  61. package/dist/assets/{_initCloneObject-DtPLipIO.js → _initCloneObject-C5CIR6rP.js} +1 -1
  62. package/dist/assets/{add-DP5Syu6f.js → add-BCfQ8OJn.js} +1 -1
  63. package/dist/assets/{all-wallets-8yVAxmmT.js → all-wallets-C8FhwEvE.js} +1 -1
  64. package/dist/assets/{app-store-BOg17Gjl.js → app-store-Db_hbUAA.js} +1 -1
  65. package/dist/assets/{apple-bcuTLrjA.js → apple-C1nLkTdo.js} +1 -1
  66. package/dist/assets/{arrow-bottom-BKh0d3eM.js → arrow-bottom-C9TzCbGE.js} +1 -1
  67. package/dist/assets/{arrow-bottom-circle-kwWs6RBF.js → arrow-bottom-circle-Cmw3ideO.js} +1 -1
  68. package/dist/assets/{arrow-left-BywpPIZq.js → arrow-left-7SUCR-qr.js} +1 -1
  69. package/dist/assets/{arrow-right-Ch2ZAinv.js → arrow-right-Dr8vfZj-.js} +1 -1
  70. package/dist/assets/{arrow-top-B1IDAg0j.js → arrow-top-CvXgatok.js} +1 -1
  71. package/dist/assets/{avatar-DUEuHWZY.js → avatar-BVySs6Bp.js} +1 -1
  72. package/dist/assets/{bank-CdaVCgNz.js → bank-D249hLbf.js} +1 -1
  73. package/dist/assets/{basic-BucaJggZ.js → basic-DDwYNh7w.js} +1 -1
  74. package/dist/assets/{browser-Jd_ss_AE.js → browser-DGePgZWY.js} +1 -1
  75. package/dist/assets/{byokCredential-_EqeEUmA.js → byokCredential-CIO21ETK.js} +1 -1
  76. package/dist/assets/{card-g7tegcbv.js → card-Bsxs6t2R.js} +1 -1
  77. package/dist/assets/{castArray-BExg_RaC.js → castArray-CSG0_HUe.js} +1 -1
  78. package/dist/assets/{chat-Cm8roG0-.js → chat-Cfx2CxcS.js} +1 -1
  79. package/dist/assets/{checkmark-CTEA0GfP.js → checkmark-DZIjsrS0.js} +1 -1
  80. package/dist/assets/{checkmark-bold-D-S3iZDY.js → checkmark-bold-Dx7SBwPk.js} +1 -1
  81. package/dist/assets/{chevron-bottom-DQzXs88q.js → chevron-bottom-Dd0jT9QE.js} +1 -1
  82. package/dist/assets/{chevron-left-Vi0IndPr.js → chevron-left-k4gIKys9.js} +1 -1
  83. package/dist/assets/{chevron-right-BbIfeDRh.js → chevron-right-F2xrz2jY.js} +1 -1
  84. package/dist/assets/{chevron-top-sBbj-jMN.js → chevron-top-CVdtppR-.js} +1 -1
  85. package/dist/assets/{chrome-store-DI_8qjrM.js → chrome-store-BQi3LIHv.js} +1 -1
  86. package/dist/assets/{clock-BIxFFmfb.js → clock-6izBLfCe.js} +1 -1
  87. package/dist/assets/{close-9blcGFMO.js → close-DFU60i1J.js} +1 -1
  88. package/dist/assets/{coinPlaceholder-CPNRBLWM.js → coinPlaceholder-BU5JD01g.js} +1 -1
  89. package/dist/assets/{compass-i0HU2h-C.js → compass-CQlnnMXr.js} +1 -1
  90. package/dist/assets/{copy-BluERDb8.js → copy-BJdtwGL3.js} +1 -1
  91. package/dist/assets/{createTaskActions-BUn4vcvp.js → createTaskActions-BZaylhhZ.js} +1 -1
  92. package/dist/assets/{cursor-Bx5Oe8ju.js → cursor-4I-zeOxX.js} +1 -1
  93. package/dist/assets/{cursor-transparent-EzG9HD-L.js → cursor-transparent-CphXpHJ1.js} +1 -1
  94. package/dist/assets/{debounce-B5JvncAZ.js → debounce-fZxSJHZ_.js} +1 -1
  95. package/dist/assets/{desktop-DsqWOXwi.js → desktop-BI7zJTse.js} +1 -1
  96. package/dist/assets/{disconnect-C22OblXS.js → disconnect-qcdddOLL.js} +1 -1
  97. package/dist/assets/{discord-meHw7PRp.js → discord-CJFXOjle.js} +1 -1
  98. package/dist/assets/{distribution-DnXsmqRw.js → distribution-BioQJXxd.js} +1 -1
  99. package/dist/assets/{dropdown-BtVThzlo.js → dropdown-aMZPur8s.js} +1 -1
  100. package/dist/assets/{etherscan-LGXYuQ6H.js → etherscan-BDn5Hdve.js} +1 -1
  101. package/dist/assets/{exclamation-triangle-CiEz9r_4.js → exclamation-triangle-DJPIU8WP.js} +1 -1
  102. package/dist/assets/{extension-D5c_04bR.js → extension-CnXDQWGY.js} +1 -1
  103. package/dist/assets/{external-link-CFOp3-_L.js → external-link-DIlCqv85.js} +1 -1
  104. package/dist/assets/{facebook-DpzF4K3d.js → facebook-CBzYYEaL.js} +1 -1
  105. package/dist/assets/{farcaster-Cpv9yoQS.js → farcaster-D9lupJT5.js} +1 -1
  106. package/dist/assets/{filters-iri6P30z.js → filters-CAfkIXcG.js} +1 -1
  107. package/dist/assets/{github-DWXnHz0G.js → github-CsnVzrSp.js} +1 -1
  108. package/dist/assets/{google-BrBeQVB2.js → google-DxqSI8RI.js} +1 -1
  109. package/dist/assets/{help-circle-xfW-MzPb.js → help-circle-D-Sy65pP.js} +1 -1
  110. package/dist/assets/{highlight-Cd4Q8Ip_.js → highlight-DIDZXu3F.js} +1 -1
  111. package/dist/assets/{id-DpKMPdq1.js → id-Dk-Bksvl.js} +1 -1
  112. package/dist/assets/{image-Dixu48We.js → image-Djxj6sC2.js} +1 -1
  113. package/dist/assets/{index-CCflpVIr.js → index-0EOY7nNo.js} +1 -1
  114. package/dist/assets/{index-9IEjRM3Q.js → index-4KdttWz0.js} +1 -1
  115. package/dist/assets/{index-Bt5-RXgT.js → index-6jnimpYJ.js} +1 -1
  116. package/dist/assets/{index-DNG9pOUN.js → index-6lKOOYK7.js} +1 -1
  117. package/dist/assets/{index-D_2hNSYx.js → index-9TeCOLrR.js} +1 -1
  118. package/dist/assets/{index-leMa1X7j.js → index-B-fIel7P.js} +2 -2
  119. package/dist/assets/{index-CjUyXen-.js → index-B46AZLGT.js} +1 -1
  120. package/dist/assets/{index-DwC66Fwb.js → index-BDV5xox6.js} +3 -3
  121. package/dist/assets/{index-X-1_xsGt.js → index-BJnI1MzM.js} +1 -1
  122. package/dist/assets/{index-5TS5Jk95.js → index-BM-soeZl.js} +1 -1
  123. package/dist/assets/{index-C2M-sv6S.js → index-BM6IZS2N.js} +1 -1
  124. package/dist/assets/{index-BOMdArDy.js → index-BNIYCj8d.js} +1 -1
  125. package/dist/assets/{index-DBnE9R1q.js → index-BODp36LS.js} +1 -1
  126. package/dist/assets/{index-BWW2lqnk.js → index-BPdZU3_P.js} +1 -1
  127. package/dist/assets/{index-DWLmb3Vm.js → index-BS8AFq0l.js} +1 -1
  128. package/dist/assets/{index-CDJdWaFL.js → index-BSOpiibX.js} +1 -1
  129. package/dist/assets/{index-Bo95hXWb.js → index-BXWsNfNJ.js} +1 -1
  130. package/dist/assets/{index-B2WALAp5.js → index-BfZYY_Cw.js} +1 -1
  131. package/dist/assets/{index-DolGpV2t.js → index-BirF_gHh.js} +1 -1
  132. package/dist/assets/{index-cOKgHCal.js → index-Bo9-h3mb.js} +1 -1
  133. package/dist/assets/{index-BkTNHP9z.js → index-Bpc8FKMm.js} +1 -1
  134. package/dist/assets/{index-DiXnIqqf.js → index-Bs_Kqm0p.js} +1 -1
  135. package/dist/assets/{index-BuBDSpZN.js → index-C-A3Y18l.js} +1 -1
  136. package/dist/assets/{index-BNoscgvM.js → index-C07GA-Xx.js} +1 -1
  137. package/dist/assets/{index-DjLUpjhY.js → index-C6wOzYOU.js} +1 -1
  138. package/dist/assets/{index-X_X2TThs.js → index-CCWYVsaT.js} +1 -1
  139. package/dist/assets/{index-DFXRfmTt.js → index-CDysMHTs.js} +1 -1
  140. package/dist/assets/{index-B8YaNbjH.js → index-CIkG6_7_.js} +1 -1
  141. package/dist/assets/{index-yMgoe7cg.js → index-CT1hKOaL.js} +1 -1
  142. package/dist/assets/{index-DXmaMdK_.js → index-CUO4sgY9.js} +3 -3
  143. package/dist/assets/{index-CmG99V2b.js → index-CjyxruJV.js} +1 -1
  144. package/dist/assets/{index-Cx7iXDXZ.js → index-Cs9zuzYY.js} +1 -1
  145. package/dist/assets/{index-BocpEQoC.js → index-CsjRXF2-.js} +1 -1
  146. package/dist/assets/{index-BM_rafS_.js → index-D0NO_C06.js} +1 -1
  147. package/dist/assets/{index-Ceqc9VEg.js → index-D1diS6bQ.js} +1 -1
  148. package/dist/assets/{index-CmJh3jrM.js → index-D3SMW7f0.js} +1 -1
  149. package/dist/assets/{index-Dihf-9rG.js → index-D9XGQtIq.js} +1 -1
  150. package/dist/assets/{index-C89C7nG9.js → index-DAUUyVMy.js} +1 -1
  151. package/dist/assets/{index-CkDY6kja.js → index-DEJK14AJ.js} +1 -1
  152. package/dist/assets/{index-BubLGEsB.js → index-DGtQ-IRs.js} +5 -5
  153. package/dist/assets/{index-gfg_ojKJ.js → index-DH96CJeg.js} +1 -1
  154. package/dist/assets/{index-ldjZ5TYG.js → index-DK_tTxqg.js} +1 -1
  155. package/dist/assets/{index-CxMk1myK.js → index-DQNg6PhM.js} +1 -1
  156. package/dist/assets/{index-BsgWMyQj.js → index-DYF-eqPA.js} +1 -1
  157. package/dist/assets/{index-DiPZ2n0W.js → index-DfGWjX4S.js} +1 -1
  158. package/dist/assets/{index-B0eTyQTH.js → index-Dg6GicnA.js} +1 -1
  159. package/dist/assets/{index-C18DxXVU.js → index-DgP-G5eG.js} +1 -1
  160. package/dist/assets/{index-DVIwA9Ae.js → index-Dl_2Zq1s.js} +1 -1
  161. package/dist/assets/{index-C_9yphc-.js → index-DnMVw642.js} +1 -1
  162. package/dist/assets/{index-CmHsQcx3.js → index-DrHHQRyJ.js} +1 -1
  163. package/dist/assets/{index-hI7LZIWp.js → index-DuI2-KLS.js} +1 -1
  164. package/dist/assets/{index-Clyl-evN.js → index-FgLYOmsH.js} +1 -1
  165. package/dist/assets/{index-C_ZyWVYR.js → index-Knta1eH8.js} +1 -1
  166. package/dist/assets/{index-L1kyDTDU.js → index-Mpd0hq_o.js} +1 -1
  167. package/dist/assets/{index-M4EnMXNy.js → index-YhuroIKW.js} +1 -1
  168. package/dist/assets/{index-BzJ9ycab.js → index-Z5mOVLFU.js} +1 -1
  169. package/dist/assets/{index-zBbrdRKQ.js → index-_ji8JoBH.js} +1 -1
  170. package/dist/assets/{index-CgUGJb8-.js → index-cXUIaexd.js} +1 -1
  171. package/dist/assets/{index-DMJfKS3G.js → index-k1pTRbDT.js} +1 -1
  172. package/dist/assets/{index-CjIENp6y.js → index-lcjCImNL.js} +1 -1
  173. package/dist/assets/{index-DwMBbou4.js → index-tslUst9E.js} +1 -1
  174. package/dist/assets/{index-BOG4F4Qw.js → index-vD0vTCx_.js} +1 -1
  175. package/dist/assets/{index-CG1AViSL.js → index-zwVEHcuP.js} +1 -1
  176. package/dist/assets/{index.browser.esm-DVE6wWGw.js → index.browser.esm-DwzSsw0C.js} +1 -1
  177. package/dist/assets/{index.es-BaOhWH-V.js → index.es-D_XmAgqo.js} +1 -1
  178. package/dist/assets/{info-QCDoF9IJ.js → info-WviTqDt0.js} +1 -1
  179. package/dist/assets/{info-circle-BBN5AtJ2.js → info-circle-BZgk3t2w.js} +1 -1
  180. package/dist/assets/{isEqual-uMzYjeDA.js → isEqual-CdtVhbUc.js} +1 -1
  181. package/dist/assets/{isPlainObject-CQUsyoDX.js → isPlainObject-DKjU-KYs.js} +1 -1
  182. package/dist/assets/{lightbulb-DhfMOA3X.js → lightbulb-Da3s2voz.js} +1 -1
  183. package/dist/assets/{mail-7Gwl_ErA.js → mail-DSQOOAMq.js} +1 -1
  184. package/dist/assets/{midjourney-Cft6OjPB.js → midjourney-DUC1KMNo.js} +1 -1
  185. package/dist/assets/{mobile-DgVxx_R_.js → mobile-COivVfpc.js} +1 -1
  186. package/dist/assets/{more-BLolMtA2.js → more-CI2GUUsp.js} +1 -1
  187. package/dist/assets/{network-placeholder-oG4Us0QU.js → network-placeholder-BB38R_6U.js} +1 -1
  188. package/dist/assets/{nftPlaceholder-BQ5emzN4.js → nftPlaceholder-Bsez8Wwc.js} +1 -1
  189. package/dist/assets/{off-BPIRIjOI.js → off-D8vEEffJ.js} +1 -1
  190. package/dist/assets/{order-C6MRl1po.js → order-BWYyHNRf.js} +1 -1
  191. package/dist/assets/{pagination-D69V5D3k.js → pagination-bfgKFQAv.js} +1 -1
  192. package/dist/assets/{play-store-DGKxYiH0.js → play-store-Bp9TjUPA.js} +1 -1
  193. package/dist/assets/{plus-CQMOyp9s.js → plus-lkYCi_ic.js} +1 -1
  194. package/dist/assets/{price-DV27GZnr.js → price-DS1hrWYx.js} +1 -1
  195. package/dist/assets/{producer-LF1GZ9Lo.js → producer-Cx3ZYJaf.js} +1 -1
  196. package/dist/assets/{qr-code-DiDYDYyb.js → qr-code-Ck6XKy3-.js} +1 -1
  197. package/dist/assets/{recycle-horizontal-350d7OV4.js → recycle-horizontal-D9SA20CE.js} +1 -1
  198. package/dist/assets/{refresh-Dr7uM2Zh.js → refresh-CgRkNwID.js} +1 -1
  199. package/dist/assets/{reown-logo-B_hilFfo.js → reown-logo-BguX47pw.js} +1 -1
  200. package/dist/assets/{search-CSp2BqBD.js → search-Bt3yR_0f.js} +1 -1
  201. package/dist/assets/{secp256k1-CFbI0H2v.js → secp256k1-3bqbhHKB.js} +1 -1
  202. package/dist/assets/{secp256k1-DV_eQ-_m.js → secp256k1-Dwz4pK2q.js} +1 -1
  203. package/dist/assets/{seedream-QaEOiyEi.js → seedream-B7t3kArS.js} +1 -1
  204. package/dist/assets/{send-CBwi06V0.js → send-akMHa4mU.js} +1 -1
  205. package/dist/assets/{service-CbfCn1-f.js → service-BEEnlTfJ.js} +1 -1
  206. package/dist/assets/{solana-wallets-IfFbx2TH.js → solana-wallets-CB41ppI-.js} +2 -2
  207. package/dist/assets/{solana-wallets-vue-D-xRGUtg.js → solana-wallets-vue-CSa25iUy.js} +1 -1
  208. package/dist/assets/{suno-CnwAtQeI.js → suno-BlFexLf8.js} +1 -1
  209. package/dist/assets/{swapHorizontal-Be33d-pv.js → swapHorizontal-180gq4At.js} +1 -1
  210. package/dist/assets/{swapHorizontalBold-4Z99yQEh.js → swapHorizontalBold-BFeZAr1x.js} +1 -1
  211. package/dist/assets/{swapHorizontalMedium-5uGUFgtV.js → swapHorizontalMedium-Vw-l94Wt.js} +1 -1
  212. package/dist/assets/{swapHorizontalRoundedBold-D_y3Xu7Q.js → swapHorizontalRoundedBold-CMcMkiNG.js} +1 -1
  213. package/dist/assets/{swapVertical-DgyDhS6o.js → swapVertical-BNuPea2i.js} +1 -1
  214. package/dist/assets/{telegram-68zct5HC.js → telegram-BkB3VQtX.js} +1 -1
  215. package/dist/assets/{three-dots-BvY3GgIL.js → three-dots-CwsfW2Zf.js} +1 -1
  216. package/dist/assets/{twitch-BOIbdq7O.js → twitch-CRrrIVk7.js} +1 -1
  217. package/dist/assets/{twitterIcon-DCW3mTwE.js → twitterIcon-ejwUsRcJ.js} +1 -1
  218. package/dist/assets/{typescript-D1b6FMjT.js → typescript-oQ90Bxn4.js} +1 -1
  219. package/dist/assets/{use-form-item-BeeWnEBl.js → use-form-item-BixqpttR.js} +1 -1
  220. package/dist/assets/validator-COLrY0lB.js +1 -0
  221. package/dist/assets/{verify-COJ52jm7.js → verify-CKbqQagY.js} +1 -1
  222. package/dist/assets/{verify-filled-BAFaofJc.js → verify-filled-BqVMjUrC.js} +1 -1
  223. package/dist/assets/{w3m-modal-D_hxalrk.js → w3m-modal-Bui2ydhi.js} +1 -1
  224. package/dist/assets/{wallet-_6_X7A1Z.js → wallet-DeDC1amR.js} +1 -1
  225. package/dist/assets/{wallet-placeholder-CGn04GBh.js → wallet-placeholder-PYBLBYrb.js} +1 -1
  226. package/dist/assets/{walletconnect-BxBAgIqY.js → walletconnect-BPP86lfd.js} +1 -1
  227. package/dist/assets/{warning-circle-ZzPF2j6w.js → warning-circle-y0tILzFB.js} +1 -1
  228. package/dist/assets/{web-Dd11E95S.js → web-0BAImU-p.js} +1 -1
  229. package/dist/assets/{web-ZVY_Bstv.js → web-BVU5z0-a.js} +1 -1
  230. package/dist/assets/{x-RkNmOT9S.js → x-DWOFLBRd.js} +1 -1
  231. package/dist/index.html +1 -1
  232. package/package.json +1 -1
  233. package/dist/assets/validator-Drnv2L_O.js +0 -1
@@ -1 +1 @@
1
- import{F as L}from"./index.es-BaOhWH-V.js";import{E as M}from"./index-hI7LZIWp.js";import{E as ue}from"./index-BzJ9ycab.js";import{d as y,H as m,E as i,z,C as n,y as f,D as o,q as a,F as r,x as S,O as V,N as T,Q as U,J as v,R as ye,I as C,M as we}from"./vendor-vue-NSDaktjZ.js";import{H as w,bp as K,ah as Ce,I as Se,cs as oe,aI as ne,S as se,ct as Ve}from"./index-DwC66Fwb.js";import{a as Ie,b as ie,c as H,d as D,e as Te,f as Ee,g as Le}from"./kling-DwJwIwVI.js";import{E as P,a as G}from"./index-CG1AViSL.js";import{E as W}from"./index-CkDY6kja.js";import{E as b}from"./index-DolGpV2t.js";import{I,S as Me,l as Ue}from"./pagination-D69V5D3k.js";import{p as J}from"./pasteUploadMixin-BurWbGNQ.js";import{u as O,a as Re,e as ae}from"./uploadTrackerMixin--N-yU8Tl.js";import{I as j}from"./ImagePreview-CimxR66Y.js";import{E as Q}from"./index-Cx7iXDXZ.js";import{E as N}from"./index-C2M-sv6S.js";import{C as me}from"./Consumption-BjI49_Pa.js";import{E as pe}from"./index-DWLmb3Vm.js";import{E as ge}from"./index-L1kyDTDU.js";import{E as fe}from"./index-BWW2lqnk.js";import{P as Ae,N as De}from"./NoTasks-Bbda08Q1.js";import{E as he}from"./index-Bt5-RXgT.js";import{a as _e}from"./price-DV27GZnr.js";import{F as Pe}from"./FilePreview-s1NoIwc1.js";import{E as Ge,a as Ke}from"./index-CmHsQcx3.js";import{E as Oe,a as je}from"./index-Bo95hXWb.js";import{b as le}from"./errorCode-Cqj9Td_Z.js";import{C as Ne}from"./CopyToClipboard-iGf1rugK.js";import{V as Be}from"./VideoPlayer-CVW6n0qR.js";import{A as ze}from"./ApiCodeButton-CrRtDEA-.js";import{E as Fe}from"./index-BNoscgvM.js";import{E as qe}from"./index-C_ZyWVYR.js";import{B as He}from"./BotPlaceholder-DshCUMDY.js";import"./use-form-item-BeeWnEBl.js";import"./index-BuyEbX8F.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-dayjs-v0j1UNZp.js";import"./vendor-vue-router-Df5ITouH.js";import"./index-gfg_ojKJ.js";import"./typescript-D1b6FMjT.js";import"./index-CDJdWaFL.js";import"./strings-beZM2Y-f.js";import"./isEqual-uMzYjeDA.js";import"./_Uint8Array-BIXfM435.js";import"./castArray-BExg_RaC.js";import"./debounce-B5JvncAZ.js";import"./_baseIteratee-Bt2Y2jN_.js";import"./index-CxMk1myK.js";import"./validator-Drnv2L_O.js";import"./highlight-Cd4Q8Ip_.js";import"./index-BLjywj98.js";import"./vendor-highlight-lEWW1Jxd.js";import"./index-DBnE9R1q.js";import"./_baseClone-DKeYjJkl.js";import"./_initCloneObject-DtPLipIO.js";import"./index-Cu41y2Fl.js";import"./index-CjUyXen-.js";import"./isPlainObject-CQUsyoDX.js";import"./vue-plyr-BO2nlN4c.js";import"./index-C89C7nG9.js";const We=y({name:"LayoutKling",components:{ElDrawer:ue,ElButton:M,FontAwesomeIcon:L},data(){return{drawer:!1}}}),Je={class:"main flex flex-row flex-1 min-h-0"},Qe={class:"config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},Ye={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function Xe(e,t,s,l,u,$){const d=o("font-awesome-icon"),p=o("el-button"),g=o("el-drawer");return a(),m("div",Je,[i("div",Qe,[z(e.$slots,"config",{},void 0,!0)]),i("div",Ye,[z(e.$slots,"result",{},void 0,!0)]),n(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=c=>e.drawer=!0)},{default:f(()=>[n(d,{icon:"fa-solid fa-magic"})]),_:1}),n(g,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=c=>e.drawer=c),direction:"ltr","with-header":!1,size:"350px"},{default:f(()=>[z(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const Ze=w(We,[["render",Xe],["__scopeId","data-v-be4bb0df"]]),xe={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function Y(e,t,s){const l=t||"std",u=s??5;switch(e){case"kling-v1":return{text2video:!0,image2video:!0,endImage:u===5,audio:!1,motionControl:u===5};case"kling-v1-6":case"kling-v2-5-turbo":return{text2video:!0,image2video:!0,endImage:l==="pro",audio:!1,motionControl:!1};case"kling-v2-6":return{text2video:!0,image2video:!0,endImage:l==="pro",audio:l==="pro",motionControl:!1};case"kling-v2-master":case"kling-v2-1-master":return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};case"kling-v3":return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:l!=="4k"};case"kling-v3-omni":return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1};case"kling-video-o1":return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1};default:return xe}}function X(e,t){if(!e)return[];const s=t.model??e.model,l=t.mode??e.mode,u=t.duration??e.duration;if(!s)return[];const $=Y(s,l,u),d=[];return e.end_image_url&&!$.endImage&&d.push({field:"end_image_url",i18nLabel:"kling.name.endImage"}),e.generate_audio&&!$.audio&&d.push({field:"generate_audio",i18nLabel:"kling.name.generateAudio"}),e.camera_control?.type&&(!$.motionControl||e.start_image_url)&&d.push({field:"camera_control",i18nLabel:"kling.name.cameraControl"}),d}function Z(e,t){const s={...e};for(const l of t)l.field==="end_image_url"&&(s.end_image_url=void 0),l.field==="generate_audio"&&(s.generate_audio=!1),l.field==="camera_control"&&(s.camera_control=void 0);return s}const et=y({name:"ModelSelector",components:{ElSelect:G,ElOption:P},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{revertKey:0,options:[{value:"kling-v3",label:"v3"},{value:"kling-v3-omni",label:"v3-Omni"},{value:"kling-v2-6",label:"v2.6"},{value:"kling-v2-5-turbo",label:"v2.5-Turbo"},{value:"kling-v2-1-master",label:"v2.1-Master"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v1",label:"v1"},{value:"kling-video-o1",label:"Video-o1"}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(Ie)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=X(t,{model:e});if(s.length===0){this.applyModel(e);return}const l=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await W.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:l}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Z({...t,model:e},s);this.$store.commit("kling/setConfig",u),b.success(this.$t("kling.message.featureRemovedNotice",{fields:l}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}}),tt={class:"field"},ot={class:"title font-bold"};function nt(e,t,s,l,u,$){const d=o("el-option"),p=o("el-select");return a(),m("div",tt,[i("h2",ot,r(e.$t("pika.name.model")),1),(a(),S(p,{key:e.revertKey,"model-value":e.value,class:"value",placeholder:e.$t("pika.placeholder.select"),onChange:e.onChange},{default:f(()=>[(a(!0),m(V,null,T(e.options,g=>(a(),S(d,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])}const st=w(et,[["render",nt],["__scopeId","data-v-04059875"]]),it=y({name:"ModeSelector",components:{ElSelect:G,ElOption:P,InfoIcon:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||""},cameraControlSet(){return!!this.$store.state.kling?.config?.camera_control?.type},fourKReason(){return H.includes(this.selectedModel)?this.cameraControlSet?this.$t("kling.description.mode4kIncompatibleCamera"):"":this.$t("kling.description.mode4kRequiresV3")},options(){return[{value:"std",label:this.$t("kling.name.modeStd"),disabled:!1,disabledReason:""},{value:"pro",label:this.$t("kling.name.modePro"),disabled:!1,disabledReason:""},{value:"4k",label:this.$t("kling.name.mode4k"),disabled:!!this.fourKReason,disabledReason:this.fourKReason}]},value(){return this.$store.state.kling?.config?.mode}},watch:{fourKReason(e){e&&this.value==="4k"&&this.applyMode(ie)}},mounted(){this.value||this.applyMode(ie)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=X(t,{mode:e});if(s.length===0){this.applyMode(e);return}const l=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await W.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:l}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Z({...t,mode:e},s);this.$store.commit("kling/setConfig",u),b.success(this.$t("kling.message.featureRemovedNotice",{fields:l}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}}),at={class:"field"},lt={class:"header"},rt={class:"title font-bold"},ct={key:0,class:"opt-tip"};function dt(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-option"),g=o("el-select");return a(),m("div",at,[i("div",lt,[i("h2",rt,r(e.$t("kling.name.mode")),1),n(d,{content:e.$t("kling.description.mode"),class:"info-icon"},null,8,["content"])]),(a(),S(g,{key:e.revertKey,"model-value":e.value,class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0,onChange:e.onChange},{default:f(()=>[(a(!0),m(V,null,T(e.options,c=>(a(),S(p,{key:c.value,label:c.label,value:c.value,disabled:c.disabled},{default:f(()=>[i("span",{class:U({"opt-disabled":c.disabled})},r(c.label),3),c.disabled&&c.disabledReason?(a(),m("span",ct,r(c.disabledReason),1)):v("",!0)]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])}const ut=w(it,[["render",dt],["__scopeId","data-v-9a8fa3c5"]]),mt=[3,5,8,10,12,15],pt=[5,10],gt=y({name:"DurationSelector",components:{ElSelect:G,ElOption:P,InfoIcon:I},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||""},isV3Model(){return H.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?mt:pt},value(){return this.$store.state.kling?.config?.duration??D},selectValue(){const e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(D)?D:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(D)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(D)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=X(t,{duration:e});if(s.length===0){this.applyDuration(e);return}const l=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await W.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:l}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Z({...t,duration:e},s);this.$store.commit("kling/setConfig",u),b.success(this.$t("kling.message.featureRemovedNotice",{fields:l}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}}),ft={class:"field"},ht={class:"control"},_t={class:"label"},$t={class:"title font-bold"};function kt(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-option"),g=o("el-select");return a(),m("div",ft,[i("div",ht,[i("div",_t,[i("h2",$t,r(e.$t("kling.name.duration")),1),n(d,{content:e.$t("kling.description.duration"),class:"info-icon ml-1"},null,8,["content"])]),(a(),S(g,{key:e.revertKey,"model-value":e.selectValue,class:"value",placeholder:e.$t("kling.placeholder.select"),onChange:e.onChange},{default:f(()=>[(a(!0),m(V,null,T(e.allowedDurations,c=>(a(),S(p,{key:c,label:`${c}s`,value:c},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])])}const vt=w(gt,[["render",kt],["__scopeId","data-v-5ae55e28"]]),bt=y({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Te)}}),yt={class:"text-sm font-bold mb-2 block"},wt={class:"items"},Ct=["onClick"],St={class:"name"};function Vt(e,t,s,l,u,$){return a(),m("div",null,[i("span",yt,r(e.$t("kling.name.ratio")),1),i("div",wt,[(a(!0),m(V,null,T(e.options,(d,p)=>(a(),m("div",{key:p,class:U({active:e.active===p,item:!0}),onClick:g=>e.value=d.value},[i("div",{class:U(["preview",d.label])},[i("div",{class:"rect",style:ye({width:d.width+"px",height:d.height+"px"})},null,4)],2),i("p",St,r(d.label),1)],10,Ct))),128))])])}const It=w(bt,[["render",Vt],["__scopeId","data-v-cdb14b2f"]]),Tt=y({name:"StartImage",components:{ElUpload:N,ElButton:M,ElTooltip:Q,InfoIcon:I,FontAwesomeIcon:L,ImagePreview:j},mixins:[J,O],emits:["change"],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){b.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){b.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Et={class:"relative"},Lt={class:"flex justify-between"},Mt={class:"flex justify-start items-center"},Ut={class:"text-sm font-bold"};function Rt(e,t,s,l,u,$){const d=o("info-icon"),p=o("image-preview"),g=o("font-awesome-icon"),c=o("el-button"),k=o("el-tooltip"),h=o("el-upload");return a(),m("div",Et,[i("div",Lt,[i("div",Mt,[i("span",Ut,r(e.$t("kling.name.startImage")),1),n(d,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),n(h,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:1,disabled:e.reachedLimit,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:f(({file:_})=>[_.url&&_.percentage!==void 0?(a(),S(p,{key:0,url:_.url,name:_.name,percentage:_.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:f(()=>[n(k,{content:e.$t("kling.message.uploadReferencesExceed"),disabled:!e.reachedLimit,placement:"top"},{default:f(()=>[i("span",null,[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload",disabled:e.reachedLimit},{default:f(()=>[n(g,{icon:"fa-solid fa-upload",class:"icon mr-1"}),C(" "+r(e.$t("kling.button.uploadReferences")),1)]),_:1},8,["disabled"])])]),_:1},8,["content","disabled"])]),_:1},8,["file-list","disabled","action","on-exceed","on-error","on-success","headers"])])}const At=w(Tt,[["render",Rt],["__scopeId","data-v-756dc269"]]),Dt=y({name:"EndImage",components:{ElUpload:N,ElButton:M,ElTooltip:Q,ImagePreview:j,InfoIcon:I,FontAwesomeIcon:L},mixins:[J,O],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return Y(this.klingConfig.model,this.klingConfig.mode,this.klingConfig.duration).endImage},hasStartImage(){return!!this.klingConfig.start_image_url},uploadDisabled(){return this.reachedLimit||!this.endImageSupported||!this.hasStartImage},uploadTooltip(){return this.endImageSupported?this.hasStartImage?this.reachedLimit?this.$t("kling.message.uploadReferencesExceed"):"":this.$t("kling.message.endImageRequiresStart"):this.$t("kling.message.endImageNotSupported")},storeValue(){return this.klingConfig.end_image_url},value:{get(){return this.storeValue},set(){}}},watch:{storeValue(e){!e&&this.fileList.length>0&&(this.fileList=[])},hasStartImage(e){!e&&this.storeValue&&(this.fileList=[],this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:void 0}))}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(b.warning(this.$t("kling.message.endImageRequiresStart")),!1):(b.warning(this.$t("kling.message.endImageNotSupported")),!1)},onExceed(){b.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){b.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Pt={class:"relative"},Gt={class:"flex justify-between"},Kt={class:"flex justify-start items-center"},Ot={class:"text-sm font-bold"};function jt(e,t,s,l,u,$){const d=o("info-icon"),p=o("image-preview"),g=o("font-awesome-icon"),c=o("el-button"),k=o("el-tooltip"),h=o("el-upload");return a(),m("div",Pt,[i("div",Gt,[i("div",Kt,[i("span",Ot,r(e.$t("kling.name.endImage")),1),n(d,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),n(h,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:1,disabled:e.uploadDisabled,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","before-upload":e.onBeforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:f(({file:_})=>[_.url&&_.percentage!==void 0?(a(),S(p,{key:0,url:_.url,name:_.name,percentage:_.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:f(()=>[n(k,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:"top"},{default:f(()=>[i("span",null,[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload",disabled:e.uploadDisabled},{default:f(()=>[n(g,{icon:"fa-solid fa-upload",class:"icon mr-1"}),C(" "+r(e.$t("kling.button.uploadReferences")),1)]),_:1},8,["disabled"])])]),_:1},8,["content","disabled"])]),_:1},8,["file-list","disabled","action","before-upload","on-exceed","on-error","on-success","headers"])])}const Nt=w(Dt,[["render",jt],["__scopeId","data-v-c1b257e5"]]),Bt=y({name:"CfgScaleSelector",components:{ElSlider:ge,InfoIcon:I,ElInputNumber:pe},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=Ee)}}),zt={class:"flex justify-between"},Ft={class:"flex justify-start items-center"},qt={class:"text-sm font-bold"},Ht={class:"flex justify-end items-center"},Wt={class:"w-full"};function Jt(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-input-number"),g=o("el-slider");return a(),m("div",null,[i("div",zt,[i("div",Ft,[i("span",qt,r(e.$t("kling.name.cfgScale")),1),n(d,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),i("div",Ht,[n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),"controls-position":"right"},null,8,["modelValue"])])]),i("div",Wt,[n(g,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=c=>e.value=c),min:0,max:1,step:.1},null,8,["modelValue"])])])}const Qt=w(Bt,[["render",Jt]]),Yt=y({name:"GenerateAudioSelector",components:{ElSwitch:fe,InfoIcon:I},computed:{selectedModel(){return this.$store.state.kling?.config?.model||""},selectedMode(){return this.$store.state.kling?.config?.mode||""},supported(){return!!(H.includes(this.selectedModel)||this.selectedModel==="kling-v2-6"&&this.selectedMode==="pro")},tooltipContent(){return this.supported?this.$t("kling.description.generateAudio"):this.$t("kling.description.generateAudioUnsupported")},value:{get(){return this.supported?this.$store.state.kling?.config?.generate_audio??Le:!1},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,generate_audio:e})}}},watch:{supported(e){!e&&this.$store.state.kling?.config?.generate_audio&&this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,generate_audio:!1})}}}),Xt={class:"relative"},Zt={class:"flex justify-between items-center"},xt={class:"flex justify-start items-center"},eo={class:"text-sm font-bold"};function to(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-switch");return a(),m("div",Xt,[i("div",Zt,[i("div",xt,[i("span",eo,r(e.$t("kling.name.generateAudio")),1),n(d,{content:e.tooltipContent},null,8,["content"])]),n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=g=>e.value=g),class:"value",disabled:!e.supported},null,8,["modelValue","disabled"])])])}const oo=w(Yt,[["render",to]]),no=["horizontal","vertical","pan","tilt","roll","zoom"],so=y({name:"CameraControlSelector",components:{ElSelect:G,ElOption:P,ElSlider:ge,ElInputNumber:pe,InfoIcon:I},data(){return{configKeys:no}},computed:{typeOptions(){return[{value:"",label:this.$t("kling.name.cameraTypeNone")},{value:"simple",label:this.$t("kling.name.cameraTypeSimple")},{value:"down_back",label:this.$t("kling.name.cameraTypeDownBack")},{value:"forward_up",label:this.$t("kling.name.cameraTypeForwardUp")},{value:"left_turn_forward",label:this.$t("kling.name.cameraTypeLeftTurnForward")},{value:"right_turn_forward",label:this.$t("kling.name.cameraTypeRightTurnForward")}]},selectedMode(){return this.$store.state.kling?.config?.mode||""},selectedModel(){return this.$store.state.kling?.config?.model||""},selectedDuration(){return this.$store.state.kling?.config?.duration},motionControlSupported(){return Y(this.selectedModel,this.selectedMode,this.selectedDuration).motionControl},hasStartImage(){return!!this.$store.state.kling?.config?.start_image_url},disabled(){return!this.motionControlSupported||this.hasStartImage},tooltipContent(){return this.motionControlSupported?this.hasStartImage?this.$t("kling.description.cameraControlDisabledImage2Video"):this.$t("kling.description.cameraControl"):this.$t("kling.description.cameraControlNotSupported")},selectedType(){return this.$store.state.kling?.config?.camera_control?.type},selectedTypeRaw:{get(){return this.selectedType??""},set(e){const t=this.$store.state.kling?.config||{};if(!e){const l={...t};delete l.camera_control,this.$store.commit("kling/setConfig",l);return}const s=e;this.$store.commit("kling/setConfig",{...t,camera_control:{type:s,config:s==="simple"?t.camera_control?.config||{}:void 0}})}},configValues(){return this.$store.state.kling?.config?.camera_control?.config||{}}},watch:{disabled(e){e&&this.selectedType!==void 0&&(this.selectedTypeRaw="")}},methods:{writeConfig(e,t){const s=this.$store.state.kling?.config||{},l=s.camera_control||{type:"simple"},u={...l.config||{}};t==null?delete u[e]:u[e]=t,this.$store.commit("kling/setConfig",{...s,camera_control:{...l,type:"simple",config:u}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),io={class:"field"},ao={class:"header"},lo={class:"text-sm font-bold"},ro={key:0,class:"config-grid"},co={class:"cfg-row-head"},uo={class:"cfg-name"};function mo(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-option"),g=o("el-select"),c=o("el-input-number"),k=o("el-slider");return a(),m("div",io,[i("div",ao,[i("span",lo,r(e.$t("kling.name.cameraControl")),1),n(d,{content:e.tooltipContent},null,8,["content"])]),n(g,{modelValue:e.selectedTypeRaw,"onUpdate:modelValue":t[0]||(t[0]=h=>e.selectedTypeRaw=h),class:"value",placeholder:e.$t("kling.placeholder.cameraType"),clearable:!0,disabled:e.disabled},{default:f(()=>[(a(!0),m(V,null,T(e.typeOptions,h=>(a(),S(p,{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"]),e.selectedType==="simple"&&!e.disabled?(a(),m("div",ro,[(a(!0),m(V,null,T(e.configKeys,h=>(a(),m("div",{key:h,class:"cfg-row"},[i("div",co,[i("span",uo,r(e.$t(`kling.name.cc_${h}`)),1),n(c,{modelValue:e.configValues[h],"onUpdate:modelValue":_=>e.configValues[h]=_,min:-1,max:1,step:.1,precision:1,"controls-position":"right",size:"small",class:"cfg-num",onChange:_=>e.onNumberChange(h,_)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),n(k,{"model-value":e.configValues[h]??0,min:-1,max:1,step:.1,onInput:_=>e.onSliderChange(h,_)},null,8,["model-value","onInput"])]))),128))])):v("",!0)])}const po=w(so,[["render",mo],["__scopeId","data-v-cd896060"]]),$e=[{groupKey:"cameraMovements",chipKeys:["rotateAround","stationary","handheld","zoomOut","zoomIn","follow","panRight","tiltUp","tiltDown","orbit"]},{groupKey:"cameraSpeed",chipKeys:["speedSlow","speedMedium","speedFast"]},{groupKey:"shotType",chipKeys:["shotClose","shotMedium","shotLong","shotLowAngle","shotHighAngle","shotShallowDof","shotFront","shotProfile","shotCloseUp","shotDrone"]},{groupKey:"light",chipKeys:["lightSunlight","lightSoft","lightNeon","lightWarm","lightNature","lightCandle","lightCityNight"]},{groupKey:"frame",chipKeys:["frameRichDetails","frameSimpleBg"]},{groupKey:"atmosphere",chipKeys:["atmosphereMysterious","atmospherePeaceful","atmosphereHeartwarming","atmosphereVivid","atmosphereColorful"]}],F=", ";function go(e,t){const s=(e||"").trim();return s?s.includes(t)?s:`${s}${F}${t}`:t}function q(e,t){if(!e||!t)return e||"";const s=[`${t}${F}`,`${F}${t}`,t];let l=e;for(const u of s)if(l.includes(u)){l=l.replace(u,"");break}return l.replace(/(?:,\s*)+$/,"").replace(/^(?:,\s*)+/,"")}const fo=y({name:"InspirationPills",components:{FontAwesomeIcon:L},computed:{prompt(){return this.$store.state.kling?.config?.prompt||""},allChipTexts(){return $e.flatMap(e=>e.chipKeys.map(t=>this.$t(`kling.inspiration.chip.${t}`)))},selected(){const e=this.prompt;if(!e)return[];const t=[];for(const s of this.allChipTexts){const l=e.indexOf(s);l!==-1&&t.push({text:s,idx:l})}return t.sort((s,l)=>s.idx-l.idx).map(s=>s.text)}},methods:{onRemove(e){const t=q(this.prompt,e);this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:t})}}}),ho={key:0,class:"pills",role:"list"},_o={class:"pill-text"},$o=["aria-label","onClick"];function ko(e,t,s,l,u,$){const d=o("font-awesome-icon");return e.selected.length>0?(a(),m("div",ho,[(a(!0),m(V,null,T(e.selected,p=>(a(),m("div",{key:p,class:"pill",role:"listitem"},[i("span",_o,r(p),1),i("button",{type:"button",class:"pill-remove","aria-label":e.$t("kling.inspiration.removeChip"),onClick:we(g=>e.onRemove(p),["stop"])},[n(d,{icon:"fa-solid fa-xmark"})],8,$o)]))),128))])):v("",!0)}const vo=w(fo,[["render",ko],["__scopeId","data-v-5fc4fa65"]]),bo="",yo=y({name:"PromptInput",components:{ElButton:M,FontAwesomeIcon:L,PromptTextarea:Ae,InspirationPills:vo},emits:["open-inspiration"],computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=bo)}});function wo(e,t,s,l,u,$){const d=o("font-awesome-icon"),p=o("el-button"),g=o("inspiration-pills"),c=o("prompt-textarea");return a(),S(c,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=k=>e.prompt=k),title:e.$t("kling.name.prompt"),info:e.$t("kling.description.prompt"),placeholder:e.$t("kling.placeholder.prompt")},{actions:f(()=>[n(p,{text:"",size:"small",class:"inspiration-btn",onClick:t[0]||(t[0]=k=>e.$emit("open-inspiration"))},{default:f(()=>[n(d,{icon:"fa-regular fa-lightbulb",class:"mr-1"}),C(" "+r(e.$t("kling.inspiration.openButton")),1)]),_:1})]),before:f(()=>[n(g)]),_:1},8,["modelValue","title","info","placeholder"])}const Co=w(yo,[["render",wo],["__scopeId","data-v-c01fc1a6"]]),So="",Vo=y({name:"NegativePromptInput",components:{ElInput:he,InfoIcon:I},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=So)}}),Io={class:"field"},To={class:"box"},Eo={class:"title font-bold"};function Lo(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-input");return a(),m("div",Io,[i("div",To,[i("h2",Eo,r(e.$t("kling.name.negativePrompt")),1),n(d,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),n(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=g=>e.prompt=g),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt")},null,8,["modelValue","placeholder"])])}const Mo=w(Vo,[["render",Lo],["__scopeId","data-v-de98cf01"]]),Uo=y({name:"InspirationDrawer",components:{ElDrawer:ue,ElButton:M,FontAwesomeIcon:L},props:{modelValue:{type:Boolean,default:!1}},emits:["update:modelValue"],data(){return{groups:$e,Close:Ce}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit("update:modelValue",e)}},drawerSize(){return window.innerWidth<768?"100%":"380px"},prompt(){return this.$store.state.kling?.config?.prompt||""},allChipTexts(){return this.groups.flatMap(e=>e.chipKeys.map(t=>this.$t(`kling.inspiration.chip.${t}`)))},selectedCount(){return this.allChipTexts.filter(e=>this.isSelected(e)).length}},methods:{chipText(e){return this.$t(`kling.inspiration.chip.${e}`)},isSelected(e){return e?this.prompt.includes(e):!1},setPrompt(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})},onToggle(e){e&&(this.isSelected(e)?this.setPrompt(q(this.prompt,e)):this.setPrompt(go(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(const t of this.allChipTexts)for(;e.includes(t);)e=q(e,t);this.setPrompt(e)}}}),Ro={class:"drawer-content"},Ao={class:"drawer-header"},Do={class:"title-row"},Po={class:"title"},Go={class:"hint"},Ko={key:0,class:"selected-bar"},Oo={class:"selected-text"},jo={class:"groups"},No={class:"group-title"},Bo={class:"chip-grid"},zo=["onClick"];function Fo(e,t,s,l,u,$){const d=o("font-awesome-icon"),p=o("el-button"),g=o("el-drawer");return a(),S(g,{modelValue:e.visible,"onUpdate:modelValue":t[1]||(t[1]=c=>e.visible=c),direction:"rtl","with-header":!1,size:e.drawerSize,"custom-class":"kling-inspiration-drawer","destroy-on-close":!1},{default:f(()=>[i("div",Ro,[i("div",Ao,[i("div",Do,[n(d,{icon:"fa-regular fa-lightbulb",class:"mr-2"}),i("span",Po,r(e.$t("kling.inspiration.title")),1)]),n(p,{text:"",icon:e.Close,class:"close-btn",onClick:t[0]||(t[0]=c=>e.visible=!1)},null,8,["icon"])]),i("div",Go,r(e.$t("kling.inspiration.hint")),1),e.selectedCount>0?(a(),m("div",Ko,[i("span",Oo,r(e.$t("kling.inspiration.selectedSummary",{count:e.selectedCount})),1),n(p,{text:"",size:"small",class:"clear-btn",onClick:e.onClearSelected},{default:f(()=>[C(r(e.$t("kling.inspiration.clearSelected")),1)]),_:1},8,["onClick"])])):v("",!0),i("div",jo,[(a(!0),m(V,null,T(e.groups,c=>(a(),m("div",{key:c.groupKey,class:"group"},[i("div",No,r(e.$t(`kling.inspiration.group.${c.groupKey}`)),1),i("div",Bo,[(a(!0),m(V,null,T(c.chipKeys,k=>(a(),m("button",{key:k,type:"button",class:U({chip:!0,active:e.isSelected(e.chipText(k))}),onClick:h=>e.onToggle(e.chipText(k))},r(e.chipText(k)),11,zo))),128))])]))),128))])])]),_:1},8,["modelValue","size"])}const qo=w(Uo,[["render",Fo],["__scopeId","data-v-7d457a69"]]),Ho={"kling-v3":"v3","kling-v3-omni":"v3-Omni","kling-v2-6":"v2.6","kling-v2-5-turbo":"v2.5-Turbo","kling-v2-1-master":"v2.1-Master","kling-v2-master":"v2-Master","kling-v1-6":"v1.6","kling-v1":"v1","kling-video-o1":"Video-o1"},Wo={std:"720p",pro:"1080p","4k":"4K"},Jo=y({name:"SummaryChip",components:{FontAwesomeIcon:L},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){const e=this.config?.model||"kling-v2-5-turbo";return Ho[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||""},modeLabel(){const e=this.config?.mode||"std";return Wo[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),Qo={class:"summary-chip"},Yo=["title"],Xo=["title"],Zo=["title"],xo=["title"],en=["title"];function tn(e,t,s,l,u,$){const d=o("font-awesome-icon");return a(),m("div",Qo,[i("span",{class:"part",title:e.$t("kling.name.model")},r(e.modelLabel),9,Yo),t[0]||(t[0]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.duration")},r(e.durationLabel),9,Xo),t[1]||(t[1]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.ratio")},r(e.aspectRatio||"16:9"),9,Zo),t[2]||(t[2]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.mode")},r(e.modeLabel),9,xo),e.generateAudio?(a(),m("span",{key:0,class:"audio",title:e.$t("kling.name.generateAudio")},[n(d,{icon:"fa-solid fa-headphones"})],8,en)):v("",!0)])}const on=w(Jo,[["render",tn],["__scopeId","data-v-418a6733"]]),nn=y({name:"ConfigPanel",components:{ElButton:M,Consumption:me,FontAwesomeIcon:L,PromptInput:Co,NegativePromptInput:Mo,ModelSelector:st,ModeSelector:ut,DurationSelector:vt,RatioSelector:It,StartImage:At,CfgScaleSelector:Qt,GenerateAudioSelector:oo,CameraControlSelector:po,InspirationDrawer:qo,SummaryChip:on,EndImage:Nt},emits:["generate"],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return _e(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),sn={class:"flex flex-col h-full"},an={class:"flex-1 overflow-y-auto p-5"},ln={class:"flex flex-col items-center justify-center px-5 pb-5"};function rn(e,t,s,l,u,$){const d=o("prompt-input"),p=o("model-selector"),g=o("ratio-selector"),c=o("start-image"),k=o("end-image"),h=o("duration-selector"),_=o("mode-selector"),E=o("generate-audio-selector"),R=o("camera-control-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),ke=o("summary-chip"),ve=o("consumption"),x=o("font-awesome-icon"),ee=o("el-button"),be=o("inspiration-drawer");return a(),m("div",sn,[i("div",an,[n(d,{class:"mb-4",onOpenInspiration:t[0]||(t[0]=te=>e.inspirationOpen=!0)}),n(p,{class:"mb-4"}),n(g,{class:"mb-4"}),n(c,{class:"mb-2"}),n(k,{class:"mb-2"}),n(h,{class:"mb-4"}),n(_,{class:"mb-4"}),n(E,{class:"mb-4"}),n(R,{class:"mb-4"}),n(A,{class:"mb-4"}),n(B,{class:"mb-4"})]),i("div",ln,[n(ke),n(ve,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),S(ee,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[n(x,{icon:"fa-solid fa-magic",class:"mr-2"}),C(" "+r(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(a(),S(ee,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[n(x,{icon:"fa-solid fa-magic",class:"mr-2"}),C(" "+r(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))]),n(be,{modelValue:e.inspirationOpen,"onUpdate:modelValue":t[1]||(t[1]=te=>e.inspirationOpen=te)},null,8,["modelValue"])])}const cn=w(nn,[["render",rn]]),dn=y({name:"MotionImage",components:{ElUpload:N,ElButton:M,InfoIcon:I,FontAwesomeIcon:L,ImagePreview:j},mixins:[J,O],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},mounted(){this.onSetImageUrl()},methods:{onExceed(){b.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){b.error(this.$t("kling.message.uploadReferencesError"))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,image_url:void 0})},onSetImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),un={class:"relative"},mn={class:"flex justify-between"},pn={class:"flex justify-start items-center"},gn={class:"text-sm font-bold"};function fn(e,t,s,l,u,$){const d=o("info-icon"),p=o("image-preview"),g=o("font-awesome-icon"),c=o("el-button"),k=o("el-upload");return a(),m("div",un,[i("div",mn,[i("div",pn,[i("span",gn,r(e.$t("kling.name.motionImage")),1),n(d,{content:e.$t("kling.description.motionImage")},null,8,["content"])])]),n(k,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=h=>e.fileList=h),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:1,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:f(({file:h})=>[h.url&&h.percentage!==void 0?(a(),S(p,{key:0,url:h.url,name:h.name,percentage:h.percentage,onRemove:_=>e.onRemove(h)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:f(()=>[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:f(()=>[n(g,{icon:"fa-solid fa-upload",class:"icon mr-1"}),C(" "+r(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const hn=w(dn,[["render",fn],["__scopeId","data-v-e52eaf2f"]]),_n=y({name:"MotionVideo",components:{ElUpload:N,ElButton:M,InfoIcon:I,FilePreview:Pe,FontAwesomeIcon:L},mixins:[O],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},mounted(){this.onSetVideoUrl()},methods:{onExceed(){b.warning(this.$t("kling.message.uploadVideoExceed"))},onError(){b.error(this.$t("kling.message.uploadVideoError"))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,video_url:void 0})},beforeUpload(e){const t=e.type==="video/mp4"||e.type==="video/quicktime",s=e.size/1024/1024<100;return t?s?!0:(b.error(this.$t("kling.message.uploadVideoSizeExceed")),!1):(b.error(this.$t("kling.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),$n={class:"relative"},kn={class:"flex justify-between"},vn={class:"flex justify-start items-center"},bn={class:"text-sm font-bold"};function yn(e,t,s,l,u,$){const d=o("info-icon"),p=o("file-preview"),g=o("font-awesome-icon"),c=o("el-button"),k=o("el-upload");return a(),m("div",$n,[i("div",kn,[i("div",vn,[i("span",bn,r(e.$t("kling.name.motionVideo")),1),n(d,{content:e.$t("kling.description.motionVideo")},null,8,["content"])])]),n(k,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=h=>e.fileList=h),accept:".mp4,.mov",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:f(({file:h})=>[h.percentage!==void 0?(a(),S(p,{key:0,url:h.url||h.response?.file_url,name:h.name,percentage:h.percentage,onRemove:_=>e.onRemove(h)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:f(()=>[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:f(()=>[n(g,{icon:"fa-solid fa-upload",class:"icon mr-1"}),C(" "+r(e.$t("kling.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const wn=w(_n,[["render",yn],["__scopeId","data-v-7019a8d2"]]),Cn=y({name:"MotionPromptInput",components:{ElInput:he,InfoIcon:I},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||""},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),Sn={class:"field"},Vn={class:"box"},In={class:"title font-bold"};function Tn(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-input");return a(),m("div",Sn,[i("div",Vn,[i("h2",In,r(e.$t("kling.name.motionPrompt")),1),n(d,{content:e.$t("kling.description.motionPrompt"),class:"info"},null,8,["content"])]),n(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=g=>e.prompt=g),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.motionPrompt")},null,8,["modelValue","placeholder"])])}const En=w(Cn,[["render",Tn],["__scopeId","data-v-ca9fdbe5"]]),re="video",Ln=y({name:"CharacterOrientationSelector",components:{ElRadioGroup:Ke,ElRadioButton:Ge,InfoIcon:I},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||re},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,character_orientation:e})}}},mounted(){this.$store.state.kling?.motionConfig?.character_orientation||(this.value=re)}}),Mn={class:"field"},Un={class:"header"},Rn={class:"text-sm font-bold"};function An(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-radio-button"),g=o("el-radio-group");return a(),m("div",Mn,[i("div",Un,[i("span",Rn,r(e.$t("kling.name.characterOrientation")),1),n(d,{content:e.$t("kling.description.characterOrientation")},null,8,["content"])]),n(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),size:"small",class:"value"},{default:f(()=>[n(p,{label:"image"},{default:f(()=>[C(r(e.$t("kling.name.orientationImage")),1)]),_:1}),n(p,{label:"video"},{default:f(()=>[C(r(e.$t("kling.name.orientationVideo")),1)]),_:1})]),_:1},8,["modelValue"])])}const Dn=w(Ln,[["render",An],["__scopeId","data-v-7a91195b"]]),ce="std",Pn=y({name:"MotionModeSelector",components:{ElSelect:G,ElOption:P,InfoIcon:I},computed:{options(){return[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]},value:{get(){return this.$store.state.kling?.motionConfig?.mode||ce},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=ce)}}),Gn={class:"field"},Kn={class:"header"},On={class:"title font-bold"};function jn(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-option"),g=o("el-select");return a(),m("div",Gn,[i("div",Kn,[i("h2",On,r(e.$t("kling.name.mode")),1),n(d,{content:e.$t("kling.description.motionMode")},null,8,["content"])]),n(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:f(()=>[(a(!0),m(V,null,T(e.options,c=>(a(),S(p,{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Nn=w(Pn,[["render",jn],["__scopeId","data-v-1295688c"]]),Bn=y({name:"KeepOriginalSoundSelector",components:{ElSwitch:fe,InfoIcon:I},computed:{value:{get(){return(this.$store.state.kling?.motionConfig?.keep_original_sound??"yes")==="yes"},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,keep_original_sound:e?"yes":"no"})}}}}),zn={class:"relative"},Fn={class:"flex justify-between items-center"},qn={class:"flex justify-start items-center"},Hn={class:"text-sm font-bold"};function Wn(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-switch");return a(),m("div",zn,[i("div",Fn,[i("div",qn,[i("span",Hn,r(e.$t("kling.name.keepOriginalSound")),1),n(d,{content:e.$t("kling.description.keepOriginalSound")},null,8,["content"])]),n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=g=>e.value=g)},null,8,["modelValue"])])])}const Jn=w(Bn,[["render",Wn]]),Qn=y({name:"MotionPanel",components:{ElButton:M,FontAwesomeIcon:L,Consumption:me,MotionImage:hn,MotionVideo:wn,MotionPromptInput:En,CharacterOrientationSelector:Dn,MotionModeSelector:Nn,KeepOriginalSoundSelector:Jn},emits:["generate"],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return _e(this.motionConfig,this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){const e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit("generate")}}}),Yn={class:"flex flex-col h-full"},Xn={class:"flex-1 overflow-y-auto p-5"},Zn={class:"flex flex-col items-center justify-center px-5 pb-5"};function xn(e,t,s,l,u,$){const d=o("motion-image"),p=o("motion-video"),g=o("motion-prompt-input"),c=o("character-orientation-selector"),k=o("motion-mode-selector"),h=o("keep-original-sound-selector"),_=o("consumption"),E=o("font-awesome-icon"),R=o("el-button");return a(),m("div",Yn,[i("div",Xn,[n(d,{class:"mb-3"}),n(p,{class:"mb-3"}),n(g,{class:"mb-4"}),n(c,{class:"mb-4"}),n(k,{class:"mb-4"}),n(h,{class:"mb-4"})]),i("div",Zn,[n(_,{value:e.consumption,service:e.service},null,8,["value","service"]),n(R,{type:"primary",class:"btn w-full",round:"",disabled:!e.canGenerate,onClick:e.onGenerate},{default:f(()=>[n(E,{icon:"fa-solid fa-magic",class:"mr-2"}),C(" "+r(e.$t("kling.button.generateMotion")),1)]),_:1},8,["disabled","onClick"])])])}const es=w(Qn,[["render",xn]]),ts=y({name:"KlingTabSwitcher",components:{ElTabs:je,ElTabPane:Oe,ElTag:Se},props:{modelValue:{type:String,default:"videos"}},emits:["update:modelValue"],computed:{tabs(){return[{value:"videos",label:this.$t("kling.tab.videoGeneration")},{value:"motion",label:this.$t("kling.tab.motionControl")}]}},methods:{onUpdate(e){this.$emit("update:modelValue",e)}}}),os=["title"],ns={class:"text"};function ss(e,t,s,l,u,$){const d=o("el-tag"),p=o("el-tab-pane"),g=o("el-tabs");return a(),S(g,{"model-value":e.modelValue,class:"kling-tabs",stretch:"","onUpdate:modelValue":e.onUpdate},{default:f(()=>[(a(!0),m(V,null,T(e.tabs,c=>(a(),S(p,{key:c.value,name:c.value,disabled:c.disabled},{label:f(()=>[i("span",{class:"tab-label",title:c.disabled?c.disabledReason:void 0},[i("span",ns,r(c.label),1),c.badge?(a(),S(d,{key:0,size:"small",type:"warning",class:"badge"},{default:f(()=>[C(r(c.badge),1)]),_:2},1024)):v("",!0)],8,os)]),_:2},1032,["name","disabled"]))),128))]),_:1},8,["model-value","onUpdate:modelValue"])}const is=w(ts,[["render",ss],["__scopeId","data-v-bf00c27e"]]),as=y({name:"TaskPreview",components:{ElImage:qe,CopyToClipboard:Ne,FontAwesomeIcon:L,ElAlert:Fe,VideoPlayer:Be,ElTooltip:Q,ElButton:M,ImagePreview:j,ApiCodeButton:ze},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){const e=[],t=this.modelValue?.request?.start_image_url,s=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:"start-image"}),s&&e.push({url:s,name:"end-image"}),e}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ls={class:"preview"},rs={class:"left"},cs={class:"main"},ds={class:"bot"},us={class:"datetime"},ms={class:"info"},ps={key:0,class:"flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto"},gs={key:1,class:"prompt mt-2"},fs={key:0},hs={key:1},_s={key:0,class:U({content:!0,failed:!0})},$s={key:0,class:"mb-4"},ks={key:1,class:U({operations:!0,"mt-2":!0})},vs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},bs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ys={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ws={key:1,class:U({content:!0})},Cs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ss={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Vs={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Is={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ts={key:2,class:U({content:!0})},Es={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ls={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Ms(e,t,s,l,u,$){const d=o("el-image"),p=o("image-preview"),g=o("video-player"),c=o("el-button"),k=o("el-tooltip"),h=o("api-code-button"),_=o("font-awesome-icon"),E=o("copy-to-clipboard"),R=o("el-alert");return a(),m("div",ls,[i("div",rs,[n(d,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),i("div",cs,[i("div",ds,[C(r(e.$t("kling.name.klingBot"))+" ",1),i("span",us,r(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",ms,[e.referenceImages.length>0?(a(),m("div",ps,[(a(!0),m(V,null,T(e.referenceImages,(A,B)=>(a(),S(p,{key:B,url:A.url,name:A.name,closable:!1},null,8,["url","name"]))),128))])):v("",!0),e.modelValue?.request?.prompt?(a(),m("p",gs,[C(r(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?v("",!0):(a(),m("span",fs," - ("+r(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(a(),m("span",hs," - ("+r(e.$t("kling.status.processing"))+") ",1)):v("",!0)])):v("",!0)]),e.modelValue?.response?.success===!0?(a(),m("div",_s,[e.modelValue?.response.video_url?(a(),m("div",$s,[n(g,{src:e.modelValue?.response.video_url},null,8,["src"])])):v("",!0),e.modelValue?.response.success?(a(),m("div",ks,[n(k,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:f(()=>[e.modelValue?.response.video_url?(a(),S(c,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=A=>e.onDownload(A,e.modelValue?.response.video_url))},{default:f(()=>[C(r(e.$t("kling.button.download")),1)]),_:1})):v("",!0)]),_:1},8,["content"]),n(h,{path:"/kling/videos",body:e.modelValue?.request},null,8,["body"])])):v("",!0),n(R,{closable:!1,class:"mt-2 success"},{default:f(()=>[i("p",vs,[n(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),C(" "+r(e.$t("kling.name.model"))+": "+r(e.modelValue?.request?.model),1)]),i("p",bs,[n(_,{icon:"fa-solid fa-magic",class:"mr-1"}),C(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(E,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.elapsed?(a(),m("p",ys,[n(_,{icon:"fa-solid fa-clock",class:"mr-1"}),C(" "+r(e.$t("kling.name.elapsed"))+": "+r(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===!1?(a(),m("div",ws,[n(R,{closable:!1,class:"failure"},{template:f(()=>[n(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),C(" "+r(e.$t("kling.name.failure")),1)]),default:f(()=>[i("p",Cs,[n(_,{icon:"fa-solid fa-magic",class:"mr-1"}),C(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(E,{content:e.modelValue?.id},null,8,["content"])]),i("p",Ss,[n(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),C(" "+r(e.$t("kling.name.failureReason"))+": "+r(e.modelValue?.response?.error?.message)+" ",1),n(E,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.elapsed?(a(),m("p",Vs,[n(_,{icon:"fa-solid fa-clock",class:"mr-1"}),C(" "+r(e.$t("kling.name.elapsed"))+": "+r(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):v("",!0),e.modelValue?.response?.trace_id?(a(),m("p",Is,[n(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),C(" "+r(e.$t("kling.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),n(E,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===void 0?(a(),m("div",Ts,[n(R,{closable:!1,class:"info"},{template:f(()=>[n(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),C(" "+r(e.$t("kling.name.failure")),1)]),default:f(()=>[i("p",Es,[n(_,{icon:"fa-solid fa-magic",class:"mr-1"}),C(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(E,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),m("p",Ls,[n(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),C(" "+r(e.$t("kling.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),n(E,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):v("",!0)]),_:1})])):v("",!0)])])}const Us=w(as,[["render",Ms],["__scopeId","data-v-422e2570"]]),Rs=y({name:"RecentPanel",components:{TaskPreview:Us,NoTasks:De,BotPlaceholder:He,ScrollList:Me},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),As={key:0},Ds={key:2,class:"w-full h-full flex items-center justify-center"};function Ps(e,t,s,l,u,$){const d=o("bot-placeholder"),p=o("task-preview"),g=o("scroll-list"),c=o("no-tasks");return a(),m(V,null,[e.tasks?.items===void 0?(a(),m("div",As,[n(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),S(g,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:t[0]||(t[0]=k=>e.$emit("reach-top"))},{default:f(()=>[(a(!0),m(V,null,T(e.tasks?.items,k=>(a(),S(p,{key:k.id,"model-value":k},null,8,["model-value"]))),128))]),_:1},8,["loading"])):v("",!0),e.tasks?.items?.length===0?(a(),m("div",Ds,[n(c)])):v("",!0)],64)}const Gs=w(Rs,[["render",Ps]]),de=Ve("kling"),Ks=y({name:"KlingIndex",components:{ConfigPanel:cn,MotionPanel:es,TabSwitcher:is,Layout:Ze,RecentPanel:Gs},mixins:[Re],inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===se.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===se.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},taskType(){return this.$store.state.kling.taskType||"videos"},tasks(){return this.$store.state.kling.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 Ue({tasks: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("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();const 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);const{limit:t=5,createdAtMin:s,createdAtMax:l}=e||{};console.debug("limit",t,"createdAtMin",s,"createdAtMax",l),this.fetchingTasks=!0;try{await this.$store.dispatch("kling/getTasks",{limit:t,createdAtMin:s,createdAtMax:l})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ae(this.uploadTracker,u=>this.$t(u),u=>b.warning(u)))return;const{camera_control:e,...t}=this.config||{},s={...t,callback_url:de};if(!s.video_id&&!t.video_url&&!s.start_image_url&&s.end_image_url){b.warning(this.$t("kling.message.endImageRequiresStart"));return}s.action||(s.video_id||t.video_url?s.action="extend":s.start_image_url?s.action="image2video":s.action="text2video"),s.action==="text2video"&&s.end_image_url&&delete s.end_image_url,e?.type&&(s.camera_control={type:e.type,...e.type==="simple"&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,u])=>u!=null))}:{}});const l=this.credential?.token;if(!l){console.error("no token specified");return}b.info(this.$t("kling.message.startingTask")),oe("kling",ne.generate(s,{token:l})).then(()=>{b.success(this.$t("kling.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===le?b.error(this.$t("kling.message.usedUp")):b.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},async onTabChange(e){e!==this.taskType&&(await this.$store.dispatch("kling/setTaskType",e),await this.onGetTasks(),await this.onScrollDown())},async onGenerateMotion(){if(!ae(this.uploadTracker,l=>this.$t(l),l=>b.warning(l)))return;const e=this.motionConfig||{};if(!e.image_url||!e.video_url){b.warning(this.$t("kling.message.motionMissingInputs"));return}const t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||"video",mode:e.mode||"std",keep_original_sound:e.keep_original_sound??"yes",...e.prompt?{prompt:e.prompt}:{},callback_url:de},s=this.credential?.token;if(!s){console.error("no token specified");return}b.info(this.$t("kling.message.startingTask")),oe("kling",ne.motion(t,{token:s})).then(()=>{b.success(this.$t("kling.message.startTaskSuccess"))}).catch(l=>{l?.response?.data?.error?.code===le?b.error(this.$t("kling.message.usedUp")):b.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),Os={class:"flex flex-col h-full"},js={class:"flex-1 min-h-0"};function Ns(e,t,s,l,u,$){const d=o("tab-switcher"),p=o("config-panel"),g=o("motion-panel"),c=o("recent-panel"),k=o("layout");return a(),S(k,null,{config:f(()=>[i("div",Os,[n(d,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,["model-value","onUpdate:modelValue"]),i("div",js,[e.taskType==="videos"?(a(),S(p,{key:0,onGenerate:e.onGenerate},null,8,["onGenerate"])):e.taskType==="motion"?(a(),S(g,{key:1,onGenerate:e.onGenerateMotion},null,8,["onGenerate"])):v("",!0)])])]),result:f(()=>[n(c,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Wi=w(Ks,[["render",Ns]]);export{Wi as default};
1
+ import{F as L}from"./index.es-D_XmAgqo.js";import{E as M}from"./index-DuI2-KLS.js";import{E as ue}from"./index-Z5mOVLFU.js";import{d as y,H as m,E as i,z,C as n,y as f,D as o,q as a,F as r,x as S,O as V,N as T,Q as U,J as v,R as ye,I as C,M as we}from"./vendor-vue-NSDaktjZ.js";import{H as w,bp as K,ah as Ce,I as Se,cs as oe,aI as ne,S as se,ct as Ve}from"./index-BDV5xox6.js";import{a as Ie,b as ie,c as H,d as D,e as Te,f as Ee,g as Le}from"./kling-DwJwIwVI.js";import{E as P,a as G}from"./index-zwVEHcuP.js";import{E as W}from"./index-DEJK14AJ.js";import{E as b}from"./index-BirF_gHh.js";import{I,S as Me,l as Ue}from"./pagination-bfgKFQAv.js";import{p as J}from"./pasteUploadMixin-BurWbGNQ.js";import{u as O,a as Re,e as ae}from"./uploadTrackerMixin--N-yU8Tl.js";import{I as j}from"./ImagePreview-JALXNCt5.js";import{E as Q}from"./index-Cs9zuzYY.js";import{E as N}from"./index-BM6IZS2N.js";import{C as me}from"./Consumption-fXKDZQba.js";import{E as pe}from"./index-BS8AFq0l.js";import{E as ge}from"./index-Mpd0hq_o.js";import{E as fe}from"./index-BPdZU3_P.js";import{P as Ae,N as De}from"./NoTasks-BOCm6wvK.js";import{E as he}from"./index-6jnimpYJ.js";import{a as _e}from"./price-DS1hrWYx.js";import{F as Pe}from"./FilePreview-pgoVFo3e.js";import{E as Ge,a as Ke}from"./index-DrHHQRyJ.js";import{E as Oe,a as je}from"./index-BXWsNfNJ.js";import{b as le}from"./errorCode-Cqj9Td_Z.js";import{C as Ne}from"./CopyToClipboard-Dkvhu2YZ.js";import{V as Be}from"./VideoPlayer-F_mj2w_4.js";import{A as ze}from"./ApiCodeButton-b6I26hKj.js";import{E as Fe}from"./index-C07GA-Xx.js";import{E as qe}from"./index-Knta1eH8.js";import{B as He}from"./BotPlaceholder-CrAvHEBe.js";import"./use-form-item-BixqpttR.js";import"./index-BuyEbX8F.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-dayjs-v0j1UNZp.js";import"./vendor-vue-router-Df5ITouH.js";import"./index-DH96CJeg.js";import"./typescript-oQ90Bxn4.js";import"./index-BSOpiibX.js";import"./strings-beZM2Y-f.js";import"./isEqual-CdtVhbUc.js";import"./_Uint8Array-ooKCswaC.js";import"./castArray-CSG0_HUe.js";import"./debounce-fZxSJHZ_.js";import"./_baseIteratee-HaFBNbp6.js";import"./index-DQNg6PhM.js";import"./validator-COLrY0lB.js";import"./highlight-DIDZXu3F.js";import"./index-BLjywj98.js";import"./vendor-highlight-lEWW1Jxd.js";import"./index-BODp36LS.js";import"./_baseClone-Bx_7nX1I.js";import"./_initCloneObject-C5CIR6rP.js";import"./index-Cu41y2Fl.js";import"./index-B46AZLGT.js";import"./isPlainObject-DKjU-KYs.js";import"./vue-plyr-BO2nlN4c.js";import"./index-DAUUyVMy.js";const We=y({name:"LayoutKling",components:{ElDrawer:ue,ElButton:M,FontAwesomeIcon:L},data(){return{drawer:!1}}}),Je={class:"main flex flex-row flex-1 min-h-0"},Qe={class:"config w-[320px] flex-none h-full flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},Ye={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function Xe(e,t,s,l,u,$){const d=o("font-awesome-icon"),p=o("el-button"),g=o("el-drawer");return a(),m("div",Je,[i("div",Qe,[z(e.$slots,"config",{},void 0,!0)]),i("div",Ye,[z(e.$slots,"result",{},void 0,!0)]),n(p,{circle:"",class:"menu",onClick:t[0]||(t[0]=c=>e.drawer=!0)},{default:f(()=>[n(d,{icon:"fa-solid fa-magic"})]),_:1}),n(g,{modelValue:e.drawer,"onUpdate:modelValue":t[1]||(t[1]=c=>e.drawer=c),direction:"ltr","with-header":!1,size:"350px"},{default:f(()=>[z(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const Ze=w(We,[["render",Xe],["__scopeId","data-v-be4bb0df"]]),xe={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};function Y(e,t,s){const l=t||"std",u=s??5;switch(e){case"kling-v1":return{text2video:!0,image2video:!0,endImage:u===5,audio:!1,motionControl:u===5};case"kling-v1-6":case"kling-v2-5-turbo":return{text2video:!0,image2video:!0,endImage:l==="pro",audio:!1,motionControl:!1};case"kling-v2-6":return{text2video:!0,image2video:!0,endImage:l==="pro",audio:l==="pro",motionControl:!1};case"kling-v2-master":case"kling-v2-1-master":return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1};case"kling-v3":return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:l!=="4k"};case"kling-v3-omni":return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1};case"kling-video-o1":return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1};default:return xe}}function X(e,t){if(!e)return[];const s=t.model??e.model,l=t.mode??e.mode,u=t.duration??e.duration;if(!s)return[];const $=Y(s,l,u),d=[];return e.end_image_url&&!$.endImage&&d.push({field:"end_image_url",i18nLabel:"kling.name.endImage"}),e.generate_audio&&!$.audio&&d.push({field:"generate_audio",i18nLabel:"kling.name.generateAudio"}),e.camera_control?.type&&(!$.motionControl||e.start_image_url)&&d.push({field:"camera_control",i18nLabel:"kling.name.cameraControl"}),d}function Z(e,t){const s={...e};for(const l of t)l.field==="end_image_url"&&(s.end_image_url=void 0),l.field==="generate_audio"&&(s.generate_audio=!1),l.field==="camera_control"&&(s.camera_control=void 0);return s}const et=y({name:"ModelSelector",components:{ElSelect:G,ElOption:P},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{revertKey:0,options:[{value:"kling-v3",label:"v3"},{value:"kling-v3-omni",label:"v3-Omni"},{value:"kling-v2-6",label:"v2.6"},{value:"kling-v2-5-turbo",label:"v2.5-Turbo"},{value:"kling-v2-1-master",label:"v2.1-Master"},{value:"kling-v2-master",label:"v2-Master"},{value:"kling-v1-6",label:"v1.6"},{value:"kling-v1",label:"v1"},{value:"kling-video-o1",label:"Video-o1"}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(Ie)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=X(t,{model:e});if(s.length===0){this.applyModel(e);return}const l=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await W.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:l}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Z({...t,model:e},s);this.$store.commit("kling/setConfig",u),b.success(this.$t("kling.message.featureRemovedNotice",{fields:l}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,model:e})}}}),tt={class:"field"},ot={class:"title font-bold"};function nt(e,t,s,l,u,$){const d=o("el-option"),p=o("el-select");return a(),m("div",tt,[i("h2",ot,r(e.$t("pika.name.model")),1),(a(),S(p,{key:e.revertKey,"model-value":e.value,class:"value",placeholder:e.$t("pika.placeholder.select"),onChange:e.onChange},{default:f(()=>[(a(!0),m(V,null,T(e.options,g=>(a(),S(d,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])}const st=w(et,[["render",nt],["__scopeId","data-v-04059875"]]),it=y({name:"ModeSelector",components:{ElSelect:G,ElOption:P,InfoIcon:I},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||""},cameraControlSet(){return!!this.$store.state.kling?.config?.camera_control?.type},fourKReason(){return H.includes(this.selectedModel)?this.cameraControlSet?this.$t("kling.description.mode4kIncompatibleCamera"):"":this.$t("kling.description.mode4kRequiresV3")},options(){return[{value:"std",label:this.$t("kling.name.modeStd"),disabled:!1,disabledReason:""},{value:"pro",label:this.$t("kling.name.modePro"),disabled:!1,disabledReason:""},{value:"4k",label:this.$t("kling.name.mode4k"),disabled:!!this.fourKReason,disabledReason:this.fourKReason}]},value(){return this.$store.state.kling?.config?.mode}},watch:{fourKReason(e){e&&this.value==="4k"&&this.applyMode(ie)}},mounted(){this.value||this.applyMode(ie)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=X(t,{mode:e});if(s.length===0){this.applyMode(e);return}const l=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await W.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:l}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Z({...t,mode:e},s);this.$store.commit("kling/setConfig",u),b.success(this.$t("kling.message.featureRemovedNotice",{fields:l}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,mode:e})}}}),at={class:"field"},lt={class:"header"},rt={class:"title font-bold"},ct={key:0,class:"opt-tip"};function dt(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-option"),g=o("el-select");return a(),m("div",at,[i("div",lt,[i("h2",rt,r(e.$t("kling.name.mode")),1),n(d,{content:e.$t("kling.description.mode"),class:"info-icon"},null,8,["content"])]),(a(),S(g,{key:e.revertKey,"model-value":e.value,class:"value",placeholder:e.$t("kling.placeholder.select"),clearable:!0,onChange:e.onChange},{default:f(()=>[(a(!0),m(V,null,T(e.options,c=>(a(),S(p,{key:c.value,label:c.label,value:c.value,disabled:c.disabled},{default:f(()=>[i("span",{class:U({"opt-disabled":c.disabled})},r(c.label),3),c.disabled&&c.disabledReason?(a(),m("span",ct,r(c.disabledReason),1)):v("",!0)]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])}const ut=w(it,[["render",dt],["__scopeId","data-v-9a8fa3c5"]]),mt=[3,5,8,10,12,15],pt=[5,10],gt=y({name:"DurationSelector",components:{ElSelect:G,ElOption:P,InfoIcon:I},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||""},isV3Model(){return H.includes(this.selectedModel)},allowedDurations(){return this.isV3Model?mt:pt},value(){return this.$store.state.kling?.config?.duration??D},selectValue(){const e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(D)?D:e[0]}},watch:{isV3Model(){this.allowedDurations.includes(this.value)||this.applyDuration(D)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(D)},methods:{async onChange(e){const t=this.$store.state.kling?.config||{},s=X(t,{duration:e});if(s.length===0){this.applyDuration(e);return}const l=s.map(u=>this.$t(u.i18nLabel)).join("、");try{await W.confirm(this.$t("kling.message.featureNotSupportedBody",{fields:l}),this.$t("kling.message.featureNotSupportedTitle"),{confirmButtonText:this.$t("kling.button.confirmContinue"),cancelButtonText:this.$t("kling.button.cancelSwitch"),type:"warning"});const u=Z({...t,duration:e},s);this.$store.commit("kling/setConfig",u),b.success(this.$t("kling.message.featureRemovedNotice",{fields:l}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling.config,duration:e})}}}),ft={class:"field"},ht={class:"control"},_t={class:"label"},$t={class:"title font-bold"};function kt(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-option"),g=o("el-select");return a(),m("div",ft,[i("div",ht,[i("div",_t,[i("h2",$t,r(e.$t("kling.name.duration")),1),n(d,{content:e.$t("kling.description.duration"),class:"info-icon ml-1"},null,8,["content"])]),(a(),S(g,{key:e.revertKey,"model-value":e.selectValue,class:"value",placeholder:e.$t("kling.placeholder.select"),onChange:e.onChange},{default:f(()=>[(a(!0),m(V,null,T(e.allowedDurations,c=>(a(),S(p,{key:c,label:`${c}s`,value:c},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","onChange"]))])])}const vt=w(gt,[["render",kt],["__scopeId","data-v-5ae55e28"]]),bt=y({name:"RatioSelector",data(){return{options:[{value:"1:1",label:"1:1",width:20,height:20},{value:"16:9",label:"16:9",width:25,height:13},{value:"9:16",label:"9:16",width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state?.kling?.config?.aspect_ratio},set(e){console.debug("set ratio",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,aspect_ratio:e})}}},mounted(){this.value||(this.value=Te)}}),yt={class:"text-sm font-bold mb-2 block"},wt={class:"items"},Ct=["onClick"],St={class:"name"};function Vt(e,t,s,l,u,$){return a(),m("div",null,[i("span",yt,r(e.$t("kling.name.ratio")),1),i("div",wt,[(a(!0),m(V,null,T(e.options,(d,p)=>(a(),m("div",{key:p,class:U({active:e.active===p,item:!0}),onClick:g=>e.value=d.value},[i("div",{class:U(["preview",d.label])},[i("div",{class:"rect",style:ye({width:d.width+"px",height:d.height+"px"})},null,4)],2),i("p",St,r(d.label),1)],10,Ct))),128))])])}const It=w(bt,[["render",Vt],["__scopeId","data-v-cdb14b2f"]]),Tt=y({name:"StartImage",components:{ElUpload:N,ElButton:M,ElTooltip:Q,InfoIcon:I,FontAwesomeIcon:L,ImagePreview:j},mixins:[J,O],emits:["change"],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){b.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){b.error(this.$t("kling.message.uploadReferencesError"))},onSetStartImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Et={class:"relative"},Lt={class:"flex justify-between"},Mt={class:"flex justify-start items-center"},Ut={class:"text-sm font-bold"};function Rt(e,t,s,l,u,$){const d=o("info-icon"),p=o("image-preview"),g=o("font-awesome-icon"),c=o("el-button"),k=o("el-tooltip"),h=o("el-upload");return a(),m("div",Et,[i("div",Lt,[i("div",Mt,[i("span",Ut,r(e.$t("kling.name.startImage")),1),n(d,{content:e.$t("kling.description.uploadStartImage")},null,8,["content"])])]),n(h,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:1,disabled:e.reachedLimit,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:f(({file:_})=>[_.url&&_.percentage!==void 0?(a(),S(p,{key:0,url:_.url,name:_.name,percentage:_.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:f(()=>[n(k,{content:e.$t("kling.message.uploadReferencesExceed"),disabled:!e.reachedLimit,placement:"top"},{default:f(()=>[i("span",null,[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload",disabled:e.reachedLimit},{default:f(()=>[n(g,{icon:"fa-solid fa-upload",class:"icon mr-1"}),C(" "+r(e.$t("kling.button.uploadReferences")),1)]),_:1},8,["disabled"])])]),_:1},8,["content","disabled"])]),_:1},8,["file-list","disabled","action","on-exceed","on-error","on-success","headers"])])}const At=w(Tt,[["render",Rt],["__scopeId","data-v-756dc269"]]),Dt=y({name:"EndImage",components:{ElUpload:N,ElButton:M,ElTooltip:Q,ImagePreview:j,InfoIcon:I,FontAwesomeIcon:L},mixins:[J,O],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return Y(this.klingConfig.model,this.klingConfig.mode,this.klingConfig.duration).endImage},hasStartImage(){return!!this.klingConfig.start_image_url},uploadDisabled(){return this.reachedLimit||!this.endImageSupported||!this.hasStartImage},uploadTooltip(){return this.endImageSupported?this.hasStartImage?this.reachedLimit?this.$t("kling.message.uploadReferencesExceed"):"":this.$t("kling.message.endImageRequiresStart"):this.$t("kling.message.endImageNotSupported")},storeValue(){return this.klingConfig.end_image_url},value:{get(){return this.storeValue},set(){}}},watch:{storeValue(e){!e&&this.fileList.length>0&&(this.fileList=[])},hasStartImage(e){!e&&this.storeValue&&(this.fileList=[],this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:void 0}))}},mounted(){this.value||(this.value=void 0),this.onSetEndImageUrl()},methods:{onBeforeUpload(){return this.endImageSupported?this.hasStartImage?!0:(b.warning(this.$t("kling.message.endImageRequiresStart")),!1):(b.warning(this.$t("kling.message.endImageNotSupported")),!1)},onExceed(){b.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){b.error(this.$t("kling.message.uploadReferencesError"))},onSetEndImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Pt={class:"relative"},Gt={class:"flex justify-between"},Kt={class:"flex justify-start items-center"},Ot={class:"text-sm font-bold"};function jt(e,t,s,l,u,$){const d=o("info-icon"),p=o("image-preview"),g=o("font-awesome-icon"),c=o("el-button"),k=o("el-tooltip"),h=o("el-upload");return a(),m("div",Pt,[i("div",Gt,[i("div",Kt,[i("span",Ot,r(e.$t("kling.name.endImage")),1),n(d,{content:e.$t("kling.description.uploadEndImage")},null,8,["content"])])]),n(h,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=_=>e.fileList=_),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:1,disabled:e.uploadDisabled,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","before-upload":e.onBeforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:f(({file:_})=>[_.url&&_.percentage!==void 0?(a(),S(p,{key:0,url:_.url,name:_.name,percentage:_.percentage,onRemove:E=>e.fileList.splice(e.fileList.indexOf(_),1)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:f(()=>[n(k,{content:e.uploadTooltip,disabled:!e.uploadDisabled,placement:"top"},{default:f(()=>[i("span",null,[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload",disabled:e.uploadDisabled},{default:f(()=>[n(g,{icon:"fa-solid fa-upload",class:"icon mr-1"}),C(" "+r(e.$t("kling.button.uploadReferences")),1)]),_:1},8,["disabled"])])]),_:1},8,["content","disabled"])]),_:1},8,["file-list","disabled","action","before-upload","on-exceed","on-error","on-success","headers"])])}const Nt=w(Dt,[["render",jt],["__scopeId","data-v-c1b257e5"]]),Bt=y({name:"CfgScaleSelector",components:{ElSlider:ge,InfoIcon:I,ElInputNumber:pe},computed:{value:{get(){return this.$store.state?.kling?.config?.cfg_scale},set(e){console.debug("set cfg_scale",e),this.$store.commit("kling/setConfig",{...this.$store.state?.kling?.config,cfg_scale:e})}}},mounted(){this.value||(this.value=Ee)}}),zt={class:"flex justify-between"},Ft={class:"flex justify-start items-center"},qt={class:"text-sm font-bold"},Ht={class:"flex justify-end items-center"},Wt={class:"w-full"};function Jt(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-input-number"),g=o("el-slider");return a(),m("div",null,[i("div",zt,[i("div",Ft,[i("span",qt,r(e.$t("kling.name.cfgScale")),1),n(d,{content:e.$t("kling.description.cfgScale")},null,8,["content"])]),i("div",Ht,[n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),"controls-position":"right"},null,8,["modelValue"])])]),i("div",Wt,[n(g,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=c=>e.value=c),min:0,max:1,step:.1},null,8,["modelValue"])])])}const Qt=w(Bt,[["render",Jt]]),Yt=y({name:"GenerateAudioSelector",components:{ElSwitch:fe,InfoIcon:I},computed:{selectedModel(){return this.$store.state.kling?.config?.model||""},selectedMode(){return this.$store.state.kling?.config?.mode||""},supported(){return!!(H.includes(this.selectedModel)||this.selectedModel==="kling-v2-6"&&this.selectedMode==="pro")},tooltipContent(){return this.supported?this.$t("kling.description.generateAudio"):this.$t("kling.description.generateAudioUnsupported")},value:{get(){return this.supported?this.$store.state.kling?.config?.generate_audio??Le:!1},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,generate_audio:e})}}},watch:{supported(e){!e&&this.$store.state.kling?.config?.generate_audio&&this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,generate_audio:!1})}}}),Xt={class:"relative"},Zt={class:"flex justify-between items-center"},xt={class:"flex justify-start items-center"},eo={class:"text-sm font-bold"};function to(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-switch");return a(),m("div",Xt,[i("div",Zt,[i("div",xt,[i("span",eo,r(e.$t("kling.name.generateAudio")),1),n(d,{content:e.tooltipContent},null,8,["content"])]),n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=g=>e.value=g),class:"value",disabled:!e.supported},null,8,["modelValue","disabled"])])])}const oo=w(Yt,[["render",to]]),no=["horizontal","vertical","pan","tilt","roll","zoom"],so=y({name:"CameraControlSelector",components:{ElSelect:G,ElOption:P,ElSlider:ge,ElInputNumber:pe,InfoIcon:I},data(){return{configKeys:no}},computed:{typeOptions(){return[{value:"",label:this.$t("kling.name.cameraTypeNone")},{value:"simple",label:this.$t("kling.name.cameraTypeSimple")},{value:"down_back",label:this.$t("kling.name.cameraTypeDownBack")},{value:"forward_up",label:this.$t("kling.name.cameraTypeForwardUp")},{value:"left_turn_forward",label:this.$t("kling.name.cameraTypeLeftTurnForward")},{value:"right_turn_forward",label:this.$t("kling.name.cameraTypeRightTurnForward")}]},selectedMode(){return this.$store.state.kling?.config?.mode||""},selectedModel(){return this.$store.state.kling?.config?.model||""},selectedDuration(){return this.$store.state.kling?.config?.duration},motionControlSupported(){return Y(this.selectedModel,this.selectedMode,this.selectedDuration).motionControl},hasStartImage(){return!!this.$store.state.kling?.config?.start_image_url},disabled(){return!this.motionControlSupported||this.hasStartImage},tooltipContent(){return this.motionControlSupported?this.hasStartImage?this.$t("kling.description.cameraControlDisabledImage2Video"):this.$t("kling.description.cameraControl"):this.$t("kling.description.cameraControlNotSupported")},selectedType(){return this.$store.state.kling?.config?.camera_control?.type},selectedTypeRaw:{get(){return this.selectedType??""},set(e){const t=this.$store.state.kling?.config||{};if(!e){const l={...t};delete l.camera_control,this.$store.commit("kling/setConfig",l);return}const s=e;this.$store.commit("kling/setConfig",{...t,camera_control:{type:s,config:s==="simple"?t.camera_control?.config||{}:void 0}})}},configValues(){return this.$store.state.kling?.config?.camera_control?.config||{}}},watch:{disabled(e){e&&this.selectedType!==void 0&&(this.selectedTypeRaw="")}},methods:{writeConfig(e,t){const s=this.$store.state.kling?.config||{},l=s.camera_control||{type:"simple"},u={...l.config||{}};t==null?delete u[e]:u[e]=t,this.$store.commit("kling/setConfig",{...s,camera_control:{...l,type:"simple",config:u}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),io={class:"field"},ao={class:"header"},lo={class:"text-sm font-bold"},ro={key:0,class:"config-grid"},co={class:"cfg-row-head"},uo={class:"cfg-name"};function mo(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-option"),g=o("el-select"),c=o("el-input-number"),k=o("el-slider");return a(),m("div",io,[i("div",ao,[i("span",lo,r(e.$t("kling.name.cameraControl")),1),n(d,{content:e.tooltipContent},null,8,["content"])]),n(g,{modelValue:e.selectedTypeRaw,"onUpdate:modelValue":t[0]||(t[0]=h=>e.selectedTypeRaw=h),class:"value",placeholder:e.$t("kling.placeholder.cameraType"),clearable:!0,disabled:e.disabled},{default:f(()=>[(a(!0),m(V,null,T(e.typeOptions,h=>(a(),S(p,{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"]),e.selectedType==="simple"&&!e.disabled?(a(),m("div",ro,[(a(!0),m(V,null,T(e.configKeys,h=>(a(),m("div",{key:h,class:"cfg-row"},[i("div",co,[i("span",uo,r(e.$t(`kling.name.cc_${h}`)),1),n(c,{modelValue:e.configValues[h],"onUpdate:modelValue":_=>e.configValues[h]=_,min:-1,max:1,step:.1,precision:1,"controls-position":"right",size:"small",class:"cfg-num",onChange:_=>e.onNumberChange(h,_)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),n(k,{"model-value":e.configValues[h]??0,min:-1,max:1,step:.1,onInput:_=>e.onSliderChange(h,_)},null,8,["model-value","onInput"])]))),128))])):v("",!0)])}const po=w(so,[["render",mo],["__scopeId","data-v-cd896060"]]),$e=[{groupKey:"cameraMovements",chipKeys:["rotateAround","stationary","handheld","zoomOut","zoomIn","follow","panRight","tiltUp","tiltDown","orbit"]},{groupKey:"cameraSpeed",chipKeys:["speedSlow","speedMedium","speedFast"]},{groupKey:"shotType",chipKeys:["shotClose","shotMedium","shotLong","shotLowAngle","shotHighAngle","shotShallowDof","shotFront","shotProfile","shotCloseUp","shotDrone"]},{groupKey:"light",chipKeys:["lightSunlight","lightSoft","lightNeon","lightWarm","lightNature","lightCandle","lightCityNight"]},{groupKey:"frame",chipKeys:["frameRichDetails","frameSimpleBg"]},{groupKey:"atmosphere",chipKeys:["atmosphereMysterious","atmospherePeaceful","atmosphereHeartwarming","atmosphereVivid","atmosphereColorful"]}],F=", ";function go(e,t){const s=(e||"").trim();return s?s.includes(t)?s:`${s}${F}${t}`:t}function q(e,t){if(!e||!t)return e||"";const s=[`${t}${F}`,`${F}${t}`,t];let l=e;for(const u of s)if(l.includes(u)){l=l.replace(u,"");break}return l.replace(/(?:,\s*)+$/,"").replace(/^(?:,\s*)+/,"")}const fo=y({name:"InspirationPills",components:{FontAwesomeIcon:L},computed:{prompt(){return this.$store.state.kling?.config?.prompt||""},allChipTexts(){return $e.flatMap(e=>e.chipKeys.map(t=>this.$t(`kling.inspiration.chip.${t}`)))},selected(){const e=this.prompt;if(!e)return[];const t=[];for(const s of this.allChipTexts){const l=e.indexOf(s);l!==-1&&t.push({text:s,idx:l})}return t.sort((s,l)=>s.idx-l.idx).map(s=>s.text)}},methods:{onRemove(e){const t=q(this.prompt,e);this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:t})}}}),ho={key:0,class:"pills",role:"list"},_o={class:"pill-text"},$o=["aria-label","onClick"];function ko(e,t,s,l,u,$){const d=o("font-awesome-icon");return e.selected.length>0?(a(),m("div",ho,[(a(!0),m(V,null,T(e.selected,p=>(a(),m("div",{key:p,class:"pill",role:"listitem"},[i("span",_o,r(p),1),i("button",{type:"button",class:"pill-remove","aria-label":e.$t("kling.inspiration.removeChip"),onClick:we(g=>e.onRemove(p),["stop"])},[n(d,{icon:"fa-solid fa-xmark"})],8,$o)]))),128))])):v("",!0)}const vo=w(fo,[["render",ko],["__scopeId","data-v-5fc4fa65"]]),bo="",yo=y({name:"PromptInput",components:{ElButton:M,FontAwesomeIcon:L,PromptTextarea:Ae,InspirationPills:vo},emits:["open-inspiration"],computed:{prompt:{get(){return this.$store.state.kling?.config?.prompt},set(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=bo)}});function wo(e,t,s,l,u,$){const d=o("font-awesome-icon"),p=o("el-button"),g=o("inspiration-pills"),c=o("prompt-textarea");return a(),S(c,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||(t[1]=k=>e.prompt=k),title:e.$t("kling.name.prompt"),info:e.$t("kling.description.prompt"),placeholder:e.$t("kling.placeholder.prompt")},{actions:f(()=>[n(p,{text:"",size:"small",class:"inspiration-btn",onClick:t[0]||(t[0]=k=>e.$emit("open-inspiration"))},{default:f(()=>[n(d,{icon:"fa-regular fa-lightbulb",class:"mr-1"}),C(" "+r(e.$t("kling.inspiration.openButton")),1)]),_:1})]),before:f(()=>[n(g)]),_:1},8,["modelValue","title","info","placeholder"])}const Co=w(yo,[["render",wo],["__scopeId","data-v-c01fc1a6"]]),So="",Vo=y({name:"NegativePromptInput",components:{ElInput:he,InfoIcon:I},computed:{prompt:{get(){return this.$store.state.kling?.config?.negative_prompt},set(e){console.debug("set prompt",e),this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,negative_prompt:e})}}},mounted(){this.prompt||(this.prompt=So)}}),Io={class:"field"},To={class:"box"},Eo={class:"title font-bold"};function Lo(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-input");return a(),m("div",Io,[i("div",To,[i("h2",Eo,r(e.$t("kling.name.negativePrompt")),1),n(d,{content:e.$t("kling.description.negativePrompt"),class:"info"},null,8,["content"])]),n(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=g=>e.prompt=g),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.negativePrompt")},null,8,["modelValue","placeholder"])])}const Mo=w(Vo,[["render",Lo],["__scopeId","data-v-de98cf01"]]),Uo=y({name:"InspirationDrawer",components:{ElDrawer:ue,ElButton:M,FontAwesomeIcon:L},props:{modelValue:{type:Boolean,default:!1}},emits:["update:modelValue"],data(){return{groups:$e,Close:Ce}},computed:{visible:{get(){return this.modelValue},set(e){this.$emit("update:modelValue",e)}},drawerSize(){return window.innerWidth<768?"100%":"380px"},prompt(){return this.$store.state.kling?.config?.prompt||""},allChipTexts(){return this.groups.flatMap(e=>e.chipKeys.map(t=>this.$t(`kling.inspiration.chip.${t}`)))},selectedCount(){return this.allChipTexts.filter(e=>this.isSelected(e)).length}},methods:{chipText(e){return this.$t(`kling.inspiration.chip.${e}`)},isSelected(e){return e?this.prompt.includes(e):!1},setPrompt(e){this.$store.commit("kling/setConfig",{...this.$store.state.kling?.config,prompt:e})},onToggle(e){e&&(this.isSelected(e)?this.setPrompt(q(this.prompt,e)):this.setPrompt(go(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(const t of this.allChipTexts)for(;e.includes(t);)e=q(e,t);this.setPrompt(e)}}}),Ro={class:"drawer-content"},Ao={class:"drawer-header"},Do={class:"title-row"},Po={class:"title"},Go={class:"hint"},Ko={key:0,class:"selected-bar"},Oo={class:"selected-text"},jo={class:"groups"},No={class:"group-title"},Bo={class:"chip-grid"},zo=["onClick"];function Fo(e,t,s,l,u,$){const d=o("font-awesome-icon"),p=o("el-button"),g=o("el-drawer");return a(),S(g,{modelValue:e.visible,"onUpdate:modelValue":t[1]||(t[1]=c=>e.visible=c),direction:"rtl","with-header":!1,size:e.drawerSize,"custom-class":"kling-inspiration-drawer","destroy-on-close":!1},{default:f(()=>[i("div",Ro,[i("div",Ao,[i("div",Do,[n(d,{icon:"fa-regular fa-lightbulb",class:"mr-2"}),i("span",Po,r(e.$t("kling.inspiration.title")),1)]),n(p,{text:"",icon:e.Close,class:"close-btn",onClick:t[0]||(t[0]=c=>e.visible=!1)},null,8,["icon"])]),i("div",Go,r(e.$t("kling.inspiration.hint")),1),e.selectedCount>0?(a(),m("div",Ko,[i("span",Oo,r(e.$t("kling.inspiration.selectedSummary",{count:e.selectedCount})),1),n(p,{text:"",size:"small",class:"clear-btn",onClick:e.onClearSelected},{default:f(()=>[C(r(e.$t("kling.inspiration.clearSelected")),1)]),_:1},8,["onClick"])])):v("",!0),i("div",jo,[(a(!0),m(V,null,T(e.groups,c=>(a(),m("div",{key:c.groupKey,class:"group"},[i("div",No,r(e.$t(`kling.inspiration.group.${c.groupKey}`)),1),i("div",Bo,[(a(!0),m(V,null,T(c.chipKeys,k=>(a(),m("button",{key:k,type:"button",class:U({chip:!0,active:e.isSelected(e.chipText(k))}),onClick:h=>e.onToggle(e.chipText(k))},r(e.chipText(k)),11,zo))),128))])]))),128))])])]),_:1},8,["modelValue","size"])}const qo=w(Uo,[["render",Fo],["__scopeId","data-v-7d457a69"]]),Ho={"kling-v3":"v3","kling-v3-omni":"v3-Omni","kling-v2-6":"v2.6","kling-v2-5-turbo":"v2.5-Turbo","kling-v2-1-master":"v2.1-Master","kling-v2-master":"v2-Master","kling-v1-6":"v1.6","kling-v1":"v1","kling-video-o1":"Video-o1"},Wo={std:"720p",pro:"1080p","4k":"4K"},Jo=y({name:"SummaryChip",components:{FontAwesomeIcon:L},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){const e=this.config?.model||"kling-v2-5-turbo";return Ho[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||""},modeLabel(){const e=this.config?.mode||"std";return Wo[e]||e},generateAudio(){return!!this.config?.generate_audio}}}),Qo={class:"summary-chip"},Yo=["title"],Xo=["title"],Zo=["title"],xo=["title"],en=["title"];function tn(e,t,s,l,u,$){const d=o("font-awesome-icon");return a(),m("div",Qo,[i("span",{class:"part",title:e.$t("kling.name.model")},r(e.modelLabel),9,Yo),t[0]||(t[0]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.duration")},r(e.durationLabel),9,Xo),t[1]||(t[1]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.ratio")},r(e.aspectRatio||"16:9"),9,Zo),t[2]||(t[2]=i("span",{class:"dot"},"·",-1)),i("span",{class:"part",title:e.$t("kling.name.mode")},r(e.modeLabel),9,xo),e.generateAudio?(a(),m("span",{key:0,class:"audio",title:e.$t("kling.name.generateAudio")},[n(d,{icon:"fa-solid fa-headphones"})],8,en)):v("",!0)])}const on=w(Jo,[["render",tn],["__scopeId","data-v-418a6733"]]),nn=y({name:"ConfigPanel",components:{ElButton:M,Consumption:me,FontAwesomeIcon:L,PromptInput:Co,NegativePromptInput:Mo,ModelSelector:st,ModeSelector:ut,DurationSelector:vt,RatioSelector:It,StartImage:At,CfgScaleSelector:Qt,GenerateAudioSelector:oo,CameraControlSelector:po,InspirationDrawer:qo,SummaryChip:on,EndImage:Nt},emits:["generate"],data(){return{inspirationOpen:!1}},computed:{config(){return this.$store.state.kling?.config},consumption(){return _e(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service}},methods:{onGenerate(){this.$emit("generate")}}}),sn={class:"flex flex-col h-full"},an={class:"flex-1 overflow-y-auto p-5"},ln={class:"flex flex-col items-center justify-center px-5 pb-5"};function rn(e,t,s,l,u,$){const d=o("prompt-input"),p=o("model-selector"),g=o("ratio-selector"),c=o("start-image"),k=o("end-image"),h=o("duration-selector"),_=o("mode-selector"),E=o("generate-audio-selector"),R=o("camera-control-selector"),A=o("cfg-scale-selector"),B=o("negative-prompt-input"),ke=o("summary-chip"),ve=o("consumption"),x=o("font-awesome-icon"),ee=o("el-button"),be=o("inspiration-drawer");return a(),m("div",sn,[i("div",an,[n(d,{class:"mb-4",onOpenInspiration:t[0]||(t[0]=te=>e.inspirationOpen=!0)}),n(p,{class:"mb-4"}),n(g,{class:"mb-4"}),n(c,{class:"mb-2"}),n(k,{class:"mb-2"}),n(h,{class:"mb-4"}),n(_,{class:"mb-4"}),n(E,{class:"mb-4"}),n(R,{class:"mb-4"}),n(A,{class:"mb-4"}),n(B,{class:"mb-4"})]),i("div",ln,[n(ke),n(ve,{value:e.consumption,service:e.service},null,8,["value","service"]),e.config?.video_url!==void 0||e.config?.custom?(a(),S(ee,{key:0,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[n(x,{icon:"fa-solid fa-magic",class:"mr-2"}),C(" "+r(e.$t("kling.button.extend")),1)]),_:1},8,["onClick"])):(a(),S(ee,{key:1,type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:f(()=>[n(x,{icon:"fa-solid fa-magic",class:"mr-2"}),C(" "+r(e.$t("kling.button.generate")),1)]),_:1},8,["onClick"]))]),n(be,{modelValue:e.inspirationOpen,"onUpdate:modelValue":t[1]||(t[1]=te=>e.inspirationOpen=te)},null,8,["modelValue"])])}const cn=w(nn,[["render",rn]]),dn=y({name:"MotionImage",components:{ElUpload:N,ElButton:M,InfoIcon:I,FontAwesomeIcon:L,ImagePreview:j},mixins:[J,O],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},mounted(){this.onSetImageUrl()},methods:{onExceed(){b.warning(this.$t("kling.message.uploadReferencesExceed"))},onError(){b.error(this.$t("kling.message.uploadReferencesError"))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,image_url:void 0})},onSetImageUrl(){const e=this.urls?.[0];this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),un={class:"relative"},mn={class:"flex justify-between"},pn={class:"flex justify-start items-center"},gn={class:"text-sm font-bold"};function fn(e,t,s,l,u,$){const d=o("info-icon"),p=o("image-preview"),g=o("font-awesome-icon"),c=o("el-button"),k=o("el-upload");return a(),m("div",un,[i("div",mn,[i("div",pn,[i("span",gn,r(e.$t("kling.name.motionImage")),1),n(d,{content:e.$t("kling.description.motionImage")},null,8,["content"])])]),n(k,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=h=>e.fileList=h),name:"file",accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",limit:1,class:"upload-wrapper",multiple:!1,action:e.uploadUrl,"list-type":"picture","on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:f(({file:h})=>[h.url&&h.percentage!==void 0?(a(),S(p,{key:0,url:h.url,name:h.name,percentage:h.percentage,onRemove:_=>e.onRemove(h)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:f(()=>[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:f(()=>[n(g,{icon:"fa-solid fa-upload",class:"icon mr-1"}),C(" "+r(e.$t("kling.button.uploadReferences")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-success","headers"])])}const hn=w(dn,[["render",fn],["__scopeId","data-v-e52eaf2f"]]),_n=y({name:"MotionVideo",components:{ElUpload:N,ElButton:M,InfoIcon:I,FilePreview:Pe,FontAwesomeIcon:L},mixins:[O],data(){return{fileList:[],uploadUrl:K()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)}},mounted(){this.onSetVideoUrl()},methods:{onExceed(){b.warning(this.$t("kling.message.uploadVideoExceed"))},onError(){b.error(this.$t("kling.message.uploadVideoError"))},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,video_url:void 0})},beforeUpload(e){const t=e.type==="video/mp4"||e.type==="video/quicktime",s=e.size/1024/1024<100;return t?s?!0:(b.error(this.$t("kling.message.uploadVideoSizeExceed")),!1):(b.error(this.$t("kling.message.uploadVideoTypeFailed")),!1)},onSetVideoUrl(){const e=this.urls?.[0];this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),$n={class:"relative"},kn={class:"flex justify-between"},vn={class:"flex justify-start items-center"},bn={class:"text-sm font-bold"};function yn(e,t,s,l,u,$){const d=o("info-icon"),p=o("file-preview"),g=o("font-awesome-icon"),c=o("el-button"),k=o("el-upload");return a(),m("div",$n,[i("div",kn,[i("div",vn,[i("span",bn,r(e.$t("kling.name.motionVideo")),1),n(d,{content:e.$t("kling.description.motionVideo")},null,8,["content"])])]),n(k,{"file-list":e.fileList,"onUpdate:fileList":t[0]||(t[0]=h=>e.fileList=h),accept:".mp4,.mov",name:"file",class:"value","show-file-list":!0,limit:1,multiple:!1,action:e.uploadUrl,"before-upload":e.beforeUpload,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onSuccess,headers:e.headers},{file:f(({file:h})=>[h.percentage!==void 0?(a(),S(p,{key:0,url:h.url||h.response?.file_url,name:h.name,percentage:h.percentage,onRemove:_=>e.onRemove(h)},null,8,["url","name","percentage","onRemove"])):v("",!0)]),default:f(()=>[n(c,{round:"",type:"primary",size:"small",class:"btn btn-upload"},{default:f(()=>[n(g,{icon:"fa-solid fa-upload",class:"icon mr-1"}),C(" "+r(e.$t("kling.button.uploadVideoUrl")),1)]),_:1})]),_:1},8,["file-list","action","before-upload","on-exceed","on-error","on-success","headers"])])}const wn=w(_n,[["render",yn],["__scopeId","data-v-7019a8d2"]]),Cn=y({name:"MotionPromptInput",components:{ElInput:he,InfoIcon:I},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||""},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),Sn={class:"field"},Vn={class:"box"},In={class:"title font-bold"};function Tn(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-input");return a(),m("div",Sn,[i("div",Vn,[i("h2",In,r(e.$t("kling.name.motionPrompt")),1),n(d,{content:e.$t("kling.description.motionPrompt"),class:"info"},null,8,["content"])]),n(p,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||(t[0]=g=>e.prompt=g),rows:3,type:"textarea",class:"prompt",placeholder:e.$t("kling.placeholder.motionPrompt")},null,8,["modelValue","placeholder"])])}const En=w(Cn,[["render",Tn],["__scopeId","data-v-ca9fdbe5"]]),re="video",Ln=y({name:"CharacterOrientationSelector",components:{ElRadioGroup:Ke,ElRadioButton:Ge,InfoIcon:I},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||re},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,character_orientation:e})}}},mounted(){this.$store.state.kling?.motionConfig?.character_orientation||(this.value=re)}}),Mn={class:"field"},Un={class:"header"},Rn={class:"text-sm font-bold"};function An(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-radio-button"),g=o("el-radio-group");return a(),m("div",Mn,[i("div",Un,[i("span",Rn,r(e.$t("kling.name.characterOrientation")),1),n(d,{content:e.$t("kling.description.characterOrientation")},null,8,["content"])]),n(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),size:"small",class:"value"},{default:f(()=>[n(p,{label:"image"},{default:f(()=>[C(r(e.$t("kling.name.orientationImage")),1)]),_:1}),n(p,{label:"video"},{default:f(()=>[C(r(e.$t("kling.name.orientationVideo")),1)]),_:1})]),_:1},8,["modelValue"])])}const Dn=w(Ln,[["render",An],["__scopeId","data-v-7a91195b"]]),ce="std",Pn=y({name:"MotionModeSelector",components:{ElSelect:G,ElOption:P,InfoIcon:I},computed:{options(){return[{value:"std",label:this.$t("kling.name.modeStd")},{value:"pro",label:this.$t("kling.name.modePro")}]},value:{get(){return this.$store.state.kling?.motionConfig?.mode||ce},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=ce)}}),Gn={class:"field"},Kn={class:"header"},On={class:"title font-bold"};function jn(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-option"),g=o("el-select");return a(),m("div",Gn,[i("div",Kn,[i("h2",On,r(e.$t("kling.name.mode")),1),n(d,{content:e.$t("kling.description.motionMode")},null,8,["content"])]),n(g,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=c=>e.value=c),class:"value",placeholder:e.$t("kling.placeholder.select")},{default:f(()=>[(a(!0),m(V,null,T(e.options,c=>(a(),S(p,{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Nn=w(Pn,[["render",jn],["__scopeId","data-v-1295688c"]]),Bn=y({name:"KeepOriginalSoundSelector",components:{ElSwitch:fe,InfoIcon:I},computed:{value:{get(){return(this.$store.state.kling?.motionConfig?.keep_original_sound??"yes")==="yes"},set(e){this.$store.commit("kling/setMotionConfig",{...this.$store.state.kling?.motionConfig,keep_original_sound:e?"yes":"no"})}}}}),zn={class:"relative"},Fn={class:"flex justify-between items-center"},qn={class:"flex justify-start items-center"},Hn={class:"text-sm font-bold"};function Wn(e,t,s,l,u,$){const d=o("info-icon"),p=o("el-switch");return a(),m("div",zn,[i("div",Fn,[i("div",qn,[i("span",Hn,r(e.$t("kling.name.keepOriginalSound")),1),n(d,{content:e.$t("kling.description.keepOriginalSound")},null,8,["content"])]),n(p,{modelValue:e.value,"onUpdate:modelValue":t[0]||(t[0]=g=>e.value=g)},null,8,["modelValue"])])])}const Jn=w(Bn,[["render",Wn]]),Qn=y({name:"MotionPanel",components:{ElButton:M,FontAwesomeIcon:L,Consumption:me,MotionImage:hn,MotionVideo:wn,MotionPromptInput:En,CharacterOrientationSelector:Dn,MotionModeSelector:Nn,KeepOriginalSoundSelector:Jn},emits:["generate"],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return _e(this.motionConfig,this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){const e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit("generate")}}}),Yn={class:"flex flex-col h-full"},Xn={class:"flex-1 overflow-y-auto p-5"},Zn={class:"flex flex-col items-center justify-center px-5 pb-5"};function xn(e,t,s,l,u,$){const d=o("motion-image"),p=o("motion-video"),g=o("motion-prompt-input"),c=o("character-orientation-selector"),k=o("motion-mode-selector"),h=o("keep-original-sound-selector"),_=o("consumption"),E=o("font-awesome-icon"),R=o("el-button");return a(),m("div",Yn,[i("div",Xn,[n(d,{class:"mb-3"}),n(p,{class:"mb-3"}),n(g,{class:"mb-4"}),n(c,{class:"mb-4"}),n(k,{class:"mb-4"}),n(h,{class:"mb-4"})]),i("div",Zn,[n(_,{value:e.consumption,service:e.service},null,8,["value","service"]),n(R,{type:"primary",class:"btn w-full",round:"",disabled:!e.canGenerate,onClick:e.onGenerate},{default:f(()=>[n(E,{icon:"fa-solid fa-magic",class:"mr-2"}),C(" "+r(e.$t("kling.button.generateMotion")),1)]),_:1},8,["disabled","onClick"])])])}const es=w(Qn,[["render",xn]]),ts=y({name:"KlingTabSwitcher",components:{ElTabs:je,ElTabPane:Oe,ElTag:Se},props:{modelValue:{type:String,default:"videos"}},emits:["update:modelValue"],computed:{tabs(){return[{value:"videos",label:this.$t("kling.tab.videoGeneration")},{value:"motion",label:this.$t("kling.tab.motionControl")}]}},methods:{onUpdate(e){this.$emit("update:modelValue",e)}}}),os=["title"],ns={class:"text"};function ss(e,t,s,l,u,$){const d=o("el-tag"),p=o("el-tab-pane"),g=o("el-tabs");return a(),S(g,{"model-value":e.modelValue,class:"kling-tabs",stretch:"","onUpdate:modelValue":e.onUpdate},{default:f(()=>[(a(!0),m(V,null,T(e.tabs,c=>(a(),S(p,{key:c.value,name:c.value,disabled:c.disabled},{label:f(()=>[i("span",{class:"tab-label",title:c.disabled?c.disabledReason:void 0},[i("span",ns,r(c.label),1),c.badge?(a(),S(d,{key:0,size:"small",type:"warning",class:"badge"},{default:f(()=>[C(r(c.badge),1)]),_:2},1024)):v("",!0)],8,os)]),_:2},1032,["name","disabled"]))),128))]),_:1},8,["model-value","onUpdate:modelValue"])}const is=w(ts,[["render",ss],["__scopeId","data-v-bf00c27e"]]),as=y({name:"TaskPreview",components:{ElImage:qe,CopyToClipboard:Ne,FontAwesomeIcon:L,ElAlert:Fe,VideoPlayer:Be,ElTooltip:Q,ElButton:M,ImagePreview:j,ApiCodeButton:ze},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},referenceImages(){const e=[],t=this.modelValue?.request?.start_image_url,s=this.modelValue?.request?.end_image_url;return t&&e.push({url:t,name:"start-image"}),s&&e.push({url:s,name:"end-image"}),e}},methods:{onDownload(e,t){e.stopPropagation(),console.log("on download"),window.open(t,"_blank")},onOpenVideo(e){window.open(e,"_blank")}}}),ls={class:"preview"},rs={class:"left"},cs={class:"main"},ds={class:"bot"},us={class:"datetime"},ms={class:"info"},ps={key:0,class:"flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto"},gs={key:1,class:"prompt mt-2"},fs={key:0},hs={key:1},_s={key:0,class:U({content:!0,failed:!0})},$s={key:0,class:"mb-4"},ks={key:1,class:U({operations:!0,"mt-2":!0})},vs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},bs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},ys={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},ws={key:1,class:U({content:!0})},Cs={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ss={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Vs={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Is={key:1,class:"text-[var(--el-text-color-regular)] text-xs mb-0"},Ts={key:2,class:U({content:!0})},Es={class:"text-[var(--el-text-color-regular)] text-xs mb-2"},Ls={key:0,class:"text-[var(--el-text-color-regular)] text-xs mb-0"};function Ms(e,t,s,l,u,$){const d=o("el-image"),p=o("image-preview"),g=o("video-player"),c=o("el-button"),k=o("el-tooltip"),h=o("api-code-button"),_=o("font-awesome-icon"),E=o("copy-to-clipboard"),R=o("el-alert");return a(),m("div",ls,[i("div",rs,[n(d,{src:"https://cdn.acedata.cloud/qpbbbb.jpg",class:"avatar"})]),i("div",cs,[i("div",ds,[C(r(e.$t("kling.name.klingBot"))+" ",1),i("span",us,r(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),i("div",ms,[e.referenceImages.length>0?(a(),m("div",ps,[(a(!0),m(V,null,T(e.referenceImages,(A,B)=>(a(),S(p,{key:B,url:A.url,name:A.name,closable:!1},null,8,["url","name"]))),128))])):v("",!0),e.modelValue?.request?.prompt?(a(),m("p",gs,[C(r(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?v("",!0):(a(),m("span",fs," - ("+r(e.$t("kling.status.pending"))+") ",1)),e.modelValue?.response?.state==="submitted"||e.modelValue?.response?.state==="processing"||e.modelValue?.response?.state==="pending"||e.modelValue?.response?.state==="completed"?(a(),m("span",hs," - ("+r(e.$t("kling.status.processing"))+") ",1)):v("",!0)])):v("",!0)]),e.modelValue?.response?.success===!0?(a(),m("div",_s,[e.modelValue?.response.video_url?(a(),m("div",$s,[n(g,{src:e.modelValue?.response.video_url},null,8,["src"])])):v("",!0),e.modelValue?.response.success?(a(),m("div",ks,[n(k,{class:"box-item",effect:"dark",content:e.$t("kling.message.downloadVideo"),placement:"top-start"},{default:f(()=>[e.modelValue?.response.video_url?(a(),S(c,{key:0,type:"info",size:"small",class:"btn-action",onClick:t[0]||(t[0]=A=>e.onDownload(A,e.modelValue?.response.video_url))},{default:f(()=>[C(r(e.$t("kling.button.download")),1)]),_:1})):v("",!0)]),_:1},8,["content"]),n(h,{path:"/kling/videos",body:e.modelValue?.request},null,8,["body"])])):v("",!0),n(R,{closable:!1,class:"mt-2 success"},{default:f(()=>[i("p",vs,[n(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),C(" "+r(e.$t("kling.name.model"))+": "+r(e.modelValue?.request?.model),1)]),i("p",bs,[n(_,{icon:"fa-solid fa-magic",class:"mr-1"}),C(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(E,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.elapsed?(a(),m("p",ys,[n(_,{icon:"fa-solid fa-clock",class:"mr-1"}),C(" "+r(e.$t("kling.name.elapsed"))+": "+r(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===!1?(a(),m("div",ws,[n(R,{closable:!1,class:"failure"},{template:f(()=>[n(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),C(" "+r(e.$t("kling.name.failure")),1)]),default:f(()=>[i("p",Cs,[n(_,{icon:"fa-solid fa-magic",class:"mr-1"}),C(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(E,{content:e.modelValue?.id},null,8,["content"])]),i("p",Ss,[n(_,{icon:"fa-solid fa-circle-info",class:"mr-1"}),C(" "+r(e.$t("kling.name.failureReason"))+": "+r(e.modelValue?.response?.error?.message)+" ",1),n(E,{content:e.modelValue?.response?.error?.message},null,8,["content"])]),e.modelValue?.elapsed?(a(),m("p",Vs,[n(_,{icon:"fa-solid fa-clock",class:"mr-1"}),C(" "+r(e.$t("kling.name.elapsed"))+": "+r(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):v("",!0),e.modelValue?.response?.trace_id?(a(),m("p",Is,[n(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),C(" "+r(e.$t("kling.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),n(E,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):v("",!0)]),_:1})])):v("",!0),e.modelValue?.response?.success===void 0?(a(),m("div",Ts,[n(R,{closable:!1,class:"info"},{template:f(()=>[n(_,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),C(" "+r(e.$t("kling.name.failure")),1)]),default:f(()=>[i("p",Es,[n(_,{icon:"fa-solid fa-magic",class:"mr-1"}),C(" "+r(e.$t("kling.name.taskId"))+": "+r(e.modelValue?.id)+" ",1),n(E,{content:e.modelValue?.id},null,8,["content"])]),e.modelValue?.response?.trace_id?(a(),m("p",Ls,[n(_,{icon:"fa-solid fa-hashtag",class:"mr-1"}),C(" "+r(e.$t("kling.name.traceId"))+": "+r(e.modelValue?.response?.trace_id)+" ",1),n(E,{content:e.modelValue?.response?.trace_id},null,8,["content"])])):v("",!0)]),_:1})])):v("",!0)])])}const Us=w(as,[["render",Ms],["__scopeId","data-v-422e2570"]]),Rs=y({name:"RecentPanel",components:{TaskPreview:Us,NoTasks:De,BotPlaceholder:He,ScrollList:Me},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.kling?.tasks,items:this.$store.state.kling?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),As={key:0},Ds={key:2,class:"w-full h-full flex items-center justify-center"};function Ps(e,t,s,l,u,$){const d=o("bot-placeholder"),p=o("task-preview"),g=o("scroll-list"),c=o("no-tasks");return a(),m(V,null,[e.tasks?.items===void 0?(a(),m("div",As,[n(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),S(g,{key:1,ref:"scrollList",class:"h-full w-full overflow-y-auto tasks",loading:e.loading,onReachTop:t[0]||(t[0]=k=>e.$emit("reach-top"))},{default:f(()=>[(a(!0),m(V,null,T(e.tasks?.items,k=>(a(),S(p,{key:k.id,"model-value":k},null,8,["model-value"]))),128))]),_:1},8,["loading"])):v("",!0),e.tasks?.items?.length===0?(a(),m("div",Ds,[n(c)])):v("",!0)],64)}const Gs=w(Rs,[["render",Ps]]),de=Ve("kling"),Ks=y({name:"KlingIndex",components:{ConfigPanel:cn,MotionPanel:es,TabSwitcher:is,Layout:Ze,RecentPanel:Gs},mixins:[Re],inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===se.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===se.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},taskType(){return this.$store.state.kling.taskType||"videos"},tasks(){return this.$store.state.kling.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 Ue({tasks: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("kling/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("kling/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();const 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);const{limit:t=5,createdAtMin:s,createdAtMax:l}=e||{};console.debug("limit",t,"createdAtMin",s,"createdAtMax",l),this.fetchingTasks=!0;try{await this.$store.dispatch("kling/getTasks",{limit:t,createdAtMin:s,createdAtMax:l})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ae(this.uploadTracker,u=>this.$t(u),u=>b.warning(u)))return;const{camera_control:e,...t}=this.config||{},s={...t,callback_url:de};if(!s.video_id&&!t.video_url&&!s.start_image_url&&s.end_image_url){b.warning(this.$t("kling.message.endImageRequiresStart"));return}s.action||(s.video_id||t.video_url?s.action="extend":s.start_image_url?s.action="image2video":s.action="text2video"),s.action==="text2video"&&s.end_image_url&&delete s.end_image_url,e?.type&&(s.camera_control={type:e.type,...e.type==="simple"&&e.config?{config:Object.fromEntries(Object.entries(e.config).filter(([,u])=>u!=null))}:{}});const l=this.credential?.token;if(!l){console.error("no token specified");return}b.info(this.$t("kling.message.startingTask")),oe("kling",ne.generate(s,{token:l})).then(()=>{b.success(this.$t("kling.message.startTaskSuccess"))}).catch(u=>{u?.response?.data?.error?.code===le?b.error(this.$t("kling.message.usedUp")):b.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},async onTabChange(e){e!==this.taskType&&(await this.$store.dispatch("kling/setTaskType",e),await this.onGetTasks(),await this.onScrollDown())},async onGenerateMotion(){if(!ae(this.uploadTracker,l=>this.$t(l),l=>b.warning(l)))return;const e=this.motionConfig||{};if(!e.image_url||!e.video_url){b.warning(this.$t("kling.message.motionMissingInputs"));return}const t={image_url:e.image_url,video_url:e.video_url,character_orientation:e.character_orientation||"video",mode:e.mode||"std",keep_original_sound:e.keep_original_sound??"yes",...e.prompt?{prompt:e.prompt}:{},callback_url:de},s=this.credential?.token;if(!s){console.error("no token specified");return}b.info(this.$t("kling.message.startingTask")),oe("kling",ne.motion(t,{token:s})).then(()=>{b.success(this.$t("kling.message.startTaskSuccess"))}).catch(l=>{l?.response?.data?.error?.code===le?b.error(this.$t("kling.message.usedUp")):b.error(this.$t("kling.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})}}}),Os={class:"flex flex-col h-full"},js={class:"flex-1 min-h-0"};function Ns(e,t,s,l,u,$){const d=o("tab-switcher"),p=o("config-panel"),g=o("motion-panel"),c=o("recent-panel"),k=o("layout");return a(),S(k,null,{config:f(()=>[i("div",Os,[n(d,{"model-value":e.taskType,"onUpdate:modelValue":e.onTabChange},null,8,["model-value","onUpdate:modelValue"]),i("div",js,[e.taskType==="videos"?(a(),S(p,{key:0,onGenerate:e.onGenerate},null,8,["onGenerate"])):e.taskType==="motion"?(a(),S(g,{key:1,onGenerate:e.onGenerateMotion},null,8,["onGenerate"])):v("",!0)])])]),result:f(()=>[n(c,{ref:"recentPanel",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Wi=w(Ks,[["render",Ns]]);export{Wi as default};
@@ -1 +1 @@
1
- import{F as U}from"./index.es-BaOhWH-V.js";import{E as A}from"./index-hI7LZIWp.js";import{E as O}from"./index-BzJ9ycab.js";import{d as g,H as r,E as c,z as R,C as t,y as m,D as s,q as a,F as n,O as S,N as C,x as V,I as _,J as h,Q as L}from"./vendor-vue-NSDaktjZ.js";import{H as $,bp as B,cs as N,aG as j,o as F,S as P,ct as z}from"./index-DwC66Fwb.js";import{a as K,b as H,c as J}from"./pika-DpzVVVef.js";import{I as G,S as Q,l as W}from"./pagination-D69V5D3k.js";import{E as X}from"./index-BWW2lqnk.js";import{E as D,a as M}from"./index-CG1AViSL.js";import{a as Y,E as Z}from"./index-CmHsQcx3.js";import{p as x}from"./pasteUploadMixin-BurWbGNQ.js";import{u as ee,a as te,e as oe}from"./uploadTrackerMixin--N-yU8Tl.js";import{I as se}from"./ImagePreview-CimxR66Y.js";import{E as ae}from"./index-C2M-sv6S.js";import{E as w}from"./index-DolGpV2t.js";import{P as ne,N as ie}from"./NoTasks-Bbda08Q1.js";import{C as le}from"./Consumption-BjI49_Pa.js";import{a as re}from"./price-DV27GZnr.js";import{b as ce,a as pe}from"./errorCode-Cqj9Td_Z.js";import{C as de}from"./CopyToClipboard-iGf1rugK.js";import{s as ue}from"./vue-plyr-BO2nlN4c.js";import{A as me}from"./ApiCodeButton-CrRtDEA-.js";import{E as fe}from"./index-Cx7iXDXZ.js";import{E as _e}from"./index-BNoscgvM.js";import{E as he}from"./index-C_ZyWVYR.js";import{B as ge}from"./BotPlaceholder-DshCUMDY.js";import"./use-form-item-BeeWnEBl.js";import"./index-BuyEbX8F.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-dayjs-v0j1UNZp.js";import"./vendor-vue-router-Df5ITouH.js";import"./highlight-Cd4Q8Ip_.js";import"./index-BLjywj98.js";import"./vendor-highlight-lEWW1Jxd.js";import"./validator-Drnv2L_O.js";import"./index-CDJdWaFL.js";import"./index-gfg_ojKJ.js";import"./typescript-D1b6FMjT.js";import"./strings-beZM2Y-f.js";import"./isEqual-uMzYjeDA.js";import"./_Uint8Array-BIXfM435.js";import"./castArray-BExg_RaC.js";import"./index-Bt5-RXgT.js";import"./index-CjUyXen-.js";import"./debounce-B5JvncAZ.js";import"./_baseIteratee-Bt2Y2jN_.js";import"./index-CxMk1myK.js";import"./index-DBnE9R1q.js";import"./_baseClone-DKeYjJkl.js";import"./_initCloneObject-DtPLipIO.js";import"./index-C89C7nG9.js";const $e=g({name:"LayoutPika",components:{ElDrawer:O,ElButton:A,FontAwesomeIcon:U},data(){return{drawer:!1}}}),ke={class:"main flex flex-row flex-1"},ve={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},be={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function ye(e,o,l,d,k,v){const p=s("font-awesome-icon"),f=s("el-button"),i=s("el-drawer");return a(),r("div",ke,[c("div",ve,[R(e.$slots,"config",{},void 0,!0)]),c("div",be,[R(e.$slots,"result",{},void 0,!0)]),t(f,{circle:"",class:"menu",onClick:o[0]||(o[0]=b=>e.drawer=!0)},{default:m(()=>[t(p,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=b=>e.drawer=b),direction:"ltr","with-header":!1,size:"350px"},{default:m(()=>[R(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const we=$($e,[["render",ye],["__scopeId","data-v-10596416"]]),Ve=g({name:"IngredientsSelector",components:{ElSwitch:X,InfoIcon:G},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug("set ingredients",e),e||this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,model:"2.0"})}}},mounted(){this.value===void 0&&(this.value=K)}}),Ee={class:"field"},Ie={class:"title font-bold"};function Se(e,o,l,d,k,v){const p=s("el-switch"),f=s("info-icon");return a(),r("div",Ee,[c("h2",Ie,n(e.$t("pika.name.ingredients")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"]),t(f,{content:e.$t("pika.description.ingredients"),class:"info"},null,8,["content"])])}const Te=$(Ve,[["render",Se],["__scopeId","data-v-17c0af5c"]]),Ce=g({name:"EffectSelector",components:{ElSelect:M,ElOption:D},data(){return{}},computed:{options(){return[{value:"Levitate",label:this.$t("pika.style.effect1")},{value:"Decapitate",label:this.$t("pika.style.effect2")},{value:"Eye-pop",label:this.$t("pika.style.effect3")},{value:"Ta-da",label:this.$t("pika.style.effect4")},{value:"Deflate",label:this.$t("pika.style.effect5")},{value:"Crumble",label:this.$t("pika.style.effect6")},{value:"Dissolve",label:this.$t("pika.style.effect7")},{value:"Squish",label:this.$t("pika.style.effect8")},{value:"Inflate",label:this.$t("pika.style.effect9")},{value:"Melt",label:this.$t("pika.style.effect10")},{value:"Cake-ify",label:this.$t("pika.style.effect11")},{value:"Crush",label:this.$t("pika.style.effect12")},{value:"Explode",label:this.$t("pika.style.effect13")}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,effect:e})}}}}),Pe={class:"field"},Ue={class:"title font-bold"},Ae={class:"float-left"};function Le(e,o,l,d,k,v){const p=s("el-option"),f=s("el-select");return a(),r("div",Pe,[c("h2",Ue,n(e.$t("pika.name.effect")),1),t(f,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("pika.placeholder.select"),clearable:""},{default:m(()=>[(a(!0),r(S,null,C(e.options,i=>(a(),V(p,{key:i.value,label:i.label,value:i.value},{default:m(()=>[c("span",Ae,n(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Re=$(Ce,[["render",Le],["__scopeId","data-v-d1c54475"]]),Ge=g({name:"IngredientsModelSelector",components:{ElRadioButton:Z,ElRadioGroup:Y},data(){return{options:[{label:this.$t("pika.button.precise"),value:"precise"},{label:this.$t("pika.button.creative"),value:"creative"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||(this.value=H)}}),De={class:"field"},Me={class:"title font-bold"};function qe(e,o,l,d,k,v){const p=s("el-radio-button"),f=s("el-radio-group");return a(),r("div",De,[c("h2",Me,n(e.$t("pika.name.ingredientsModel")),1),t(f,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"quality"},{default:m(()=>[(a(!0),r(S,null,C(e.options,i=>(a(),V(p,{key:i.value,label:i.value},{default:m(()=>[_(n(i.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const Oe=$(Ge,[["render",qe],["__scopeId","data-v-b72865fa"]]),Be=g({name:"ModelSelector",components:{ElSelect:M,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"2.0",label:"2.0"},{value:"1.5",label:"1.5"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||(this.value=J)}}),Ne={class:"field"},je={class:"title font-bold"};function Fe(e,o,l,d,k,v){const p=s("el-option"),f=s("el-select");return a(),r("div",Ne,[c("h2",je,n(e.$t("pika.name.model")),1),t(f,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:m(()=>[(a(!0),r(S,null,C(e.options,i=>(a(),V(p,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ze=$(Be,[["render",Fe],["__scopeId","data-v-7b2e870a"]]),Ke=g({name:"ImageUrlInput",components:{ElUpload:ae,ElButton:A,InfoIcon:G,ImagePreview:se,FontAwesomeIcon:U},mixins:[x,ee],data(){return{fileList:[],uploadUrl:B()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.pika?.config?.image_url},set(){const e=this.urls?.[0];this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){w.warning(this.$t("pika.message.uploadStartImageExceed"))},onError(){w.error(this.$t("pika.message.uploadStartImageError"))},async onRemove(){w.error(this.$t("pika.message.uploadStartImageError"))},onSetStartImageUrl(){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),He={class:"field"},Je={class:"title font-bold"},Qe={class:"upload-wrapper"};function We(e,o,l,d,k,v){const p=s("image-preview"),f=s("font-awesome-icon"),i=s("el-button"),b=s("el-upload"),E=s("info-icon");return a(),r("div",He,[c("h2",Je,n(e.$t("pika.name.imageUrl")),1),c("div",Qe,[t(b,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=u=>e.fileList=u),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value upload-wrapper",limit:3,multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:u})=>[t(p,{url:u.url||u.response?.file_url,name:u.name,percentage:u.percentage,onRemove:I=>e.fileList.splice(e.fileList.indexOf(u),1)},null,8,["url","name","percentage","onRemove"])]),default:m(()=>[t(i,{size:"small",type:"primary",round:""},{default:m(()=>[t(f,{icon:"fa-solid fa-upload",class:"mr-1"}),_(" "+n(e.$t("pika.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])]),t(E,{content:e.$t("pika.description.imageUrl"),class:"info"},null,8,["content"])])}const Xe=$(Ke,[["render",We],["__scopeId","data-v-25cefe78"]]),Ye="",Ze=g({name:"PromptInput",components:{PromptTextarea:ne},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Ye)}});function xe(e,o,l,d,k,v){const p=s("prompt-textarea");return a(),V(p,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=f=>e.prompt=f),title:e.$t("pika.name.prompt"),info:e.$t("pika.description.prompt"),placeholder:e.$t("pika.placeholder.prompt")},null,8,["modelValue","title","info","placeholder"])}const et=$(Ze,[["render",xe]]),tt=g({name:"PresetPanel",components:{ImageUrlInput:Xe,ElButton:A,FontAwesomeIcon:U,Consumption:le,PromptInput:et,IngredientsSelector:Te,IngredientsModelSelector:Oe,ModelSelector:ze,EffectSelector:Re},emits:["generate"],computed:{config(){return this.$store.state.pika?.config},consumption(){return re(this.config,this.service?.cost)},service(){return this.$store.state.pika?.service}},methods:{onGenerate(){this.$emit("generate")}}}),ot={class:"flex flex-col h-full"},st={class:"flex-1 overflow-y-auto p-5"},at={class:"flex flex-col items-center justify-center px-5 pb-5"};function nt(e,o,l,d,k,v){const p=s("prompt-input"),f=s("model-selector"),i=s("ingredients-selector"),b=s("effect-selector"),E=s("image-url-input"),u=s("ingredients-model-selector"),I=s("consumption"),T=s("font-awesome-icon"),y=s("el-button");return a(),r("div",ot,[c("div",st,[t(p,{class:"mb-4"}),t(f,{class:"mb-4"}),t(i,{class:"mb-4"}),t(b,{class:"mb-4"}),e.config?.ingredients?(a(),V(E,{key:0,class:"mb-4"})):h("",!0),e.config?.ingredients?(a(),V(u,{key:1,class:"mb-4"})):h("",!0)]),c("div",at,[t(I,{value:e.consumption,service:e.service},null,8,["value","service"]),t(y,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[t(T,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("pika.button.generate")),1)]),_:1},8,["onClick"])])])}const it=$(tt,[["render",nt]]),lt=g({name:"VideoPlayer",components:{VuePlyr:ue},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:1080,options:[1080]}}}}}),rt=["data-poster"],ct=["src"];function pt(e,o,l,d,k,v){const p=s("vue-plyr");return a(),r("div",null,[t(p,{options:e.options,class:"video"},{default:m(()=>[c("video",{controls:"",playsinline:"",preload:"metadata","data-poster":e.modelValue?.image_url},[c("source",{size:"1080",src:e.modelValue?.video_url,type:"video/mp4"},null,8,ct)],8,rt)]),_:1},8,["options"])])}const dt=$(lt,[["render",pt],["__scopeId","data-v-897d9fe0"]]),ut=g({name:"TaskPreview",components:{ElImage:he,CopyToClipboard:de,FontAwesomeIcon:U,ElAlert:_e,VideoPlayer:dt,ElTooltip:fe,ElButton:A,ApiCodeButton:me},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(l=>{let d=l;o&&(d.action=o),e.push(d)}),e}},methods:{onDownload(e){console.log("on download"),window.open(e,"_blank")},onReload(e){const o=e.target,l=new URL(o.src),d=l.searchParams.get("retry");if(!d)l.searchParams.set("retry","1");else if(parseInt(d)<2)l.searchParams.set("retry",(parseInt(d)+1).toString());else return;o.src=l.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),mt={class:"left"},ft={class:"main"},_t={class:"bot"},ht={class:"datetime"},gt={class:"info"},$t={key:0,class:"prompt mt-2"},kt={key:0},vt={key:1},bt={key:0,class:L({content:!0,failed:!0})},yt={class:"image-wrapper"},wt={key:0,class:L({operations:!0,"mt-2":!0})},Vt={key:0,class:"description"},Et={class:"description"},It={key:1,class:"description"},St={key:1,class:L({content:!0})},Tt={class:"description"},Ct={class:"description"},Pt={key:0,class:"description"},Ut={class:"description"},At={key:2,class:L({content:!0})},Lt={class:"description"};function Rt(e,o,l,d,k,v){const p=s("el-image"),f=s("VideoPlayer"),i=s("el-button"),b=s("el-tooltip"),E=s("api-code-button"),u=s("font-awesome-icon"),I=s("copy-to-clipboard"),T=s("el-alert");return a(!0),r(S,null,C(e.videos,(y,q)=>(a(),r("div",{key:q,class:"preview"},[c("div",mt,[t(p,{src:"https://cdn.acedata.cloud/i80tgn.png",class:"avatar"})]),c("div",ft,[c("div",_t,[_(n(e.$t("pika.name.pikaBot"))+" ",1),c("span",ht,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",gt,[e.modelValue?.request?.prompt?(a(),r("p",$t,[_(n(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(a(),r("span",kt," - ("+n(e.$t("pika.status.pending"))+") ",1)),y?.state==="processing"||y?.state==="pending"?(a(),r("span",vt," - ("+n(e.$t("pika.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(a(),r("div",bt,[c("div",yt,[t(f,{"model-value":y},null,8,["model-value"])]),y?(a(),r("div",wt,[t(b,{class:"box-item",effect:"dark",content:e.$t("pika.message.downloadVideo"),placement:"top-start"},{default:m(()=>[y?.video_url?(a(),V(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:zt=>e.onDownload(y?.video_url)},{default:m(()=>[_(n(e.$t("pika.button.download")),1)]),_:1},8,["onClick"])):h("",!0)]),_:2},1032,["content"]),t(E,{path:"/pika/videos",body:e.modelValue?.request},null,8,["body"])])):h("",!0),t(T,{closable:!1,class:"mt-2 success"},{default:m(()=>[e.modelValue?.request?.model?(a(),r("p",Vt,[t(u,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("pika.name.model"))+": "+n(e.modelValue?.request?.model),1)])):h("",!0),c("p",Et,[t(u,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("pika.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(I,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),e.modelValue?.elapsed?(a(),r("p",It,[t(u,{icon:"fa-solid fa-clock",class:"mr-1"}),_(" "+n(e.$t("pika.name.elapsed"))+": "+n(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):h("",!0)]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(a(),r("div",St,[t(T,{closable:!1,class:"failure"},{template:m(()=>[t(u,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("pika.name.failure")),1)]),default:m(()=>[c("p",Tt,[t(u,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("pika.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(I,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",Ct,[t(u,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("pika.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(I,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),e.modelValue?.elapsed?(a(),r("p",Pt,[t(u,{icon:"fa-solid fa-clock",class:"mr-1"}),_(" "+n(e.$t("pika.name.elapsed"))+": "+n(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):h("",!0),c("p",Ut,[t(u,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("pika.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(I,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0),!e.modelValue?.response||y?.state==="processing"||y?.state==="pending"?(a(),r("div",At,[t(T,{closable:!1,class:"info"},{template:m(()=>[t(u,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("pika.name.failure")),1)]),default:m(()=>[c("p",Lt,[t(u,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("pika.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(I,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0)])]))),128)}const Gt=$(ut,[["render",Rt],["__scopeId","data-v-52856c99"]]),Dt=g({name:"RecentPanel",components:{TaskPreview:Gt,BotPlaceholder:ge,NoTasks:ie,ScrollList:Q},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Mt={key:0},qt={key:2,class:"w-full h-full flex items-center justify-center"};function Ot(e,o,l,d,k,v){const p=s("bot-placeholder"),f=s("task-preview"),i=s("scroll-list"),b=s("no-tasks");return a(),r(S,null,[e.tasks?.items===void 0?(a(),r("div",Mt,[t(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),V(i,{key:1,ref:"scrollList",class:"tasks h-full w-full overflow-y-auto",loading:e.loading,onReachTop:o[0]||(o[0]=E=>e.$emit("reach-top"))},{default:m(()=>[(a(!0),r(S,null,C(e.tasks?.items,(E,u)=>(a(),V(f,{key:u,"model-value":E},null,8,["model-value"]))),128))]),_:1},8,["loading"])):h("",!0),e.tasks?.items?.length===0?(a(),r("div",qt,[t(b)])):h("",!0)],64)}const Bt=$(Dt,[["render",Ot]]),Nt=z("pika"),jt=g({name:"PikaIndex",components:{ConfigPanel:it,Layout:we,RecentPanel:Bt},mixins:[te],inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pika?.status?.getApplications===P.Request},tasksLoading(){return this.$store.state.pika?.status?.getTasks===P.Request||this.fetchingTasks},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===P.Request},needApply(){return this.$store.state.pika.status.getApplications===P.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.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("pika/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pika/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){F.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===pe&&w.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const 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);const{limit:o=5,createdAtMin:l,createdAtMax:d}=e||{};console.debug("limit",o,"createdAtMin",l,"createdAtMax",d),this.fetchingTasks=!0;try{await this.$store.dispatch("pika/getTasks",{limit:o,createdAtMin:l,createdAtMax:d})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!oe(this.uploadTracker,l=>this.$t(l),l=>w.warning(l)))return;const e={...this.config,callback_url:Nt},o=this.credential?.token;if(!o){console.error("no token specified");return}w.info(this.$t("pika.message.startingTask")),N("pika",j.generate(e,{token:o})).then(()=>{w.success(this.$t("pika.message.startTaskSuccess")),this.$store.commit("pika/setConfig",{config:void 0})}).catch(l=>{l?.response?.data?.error?.code===ce?w.error(this.$t("pika.message.usedUp")):w.error(this.$t("pika.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ft(e,o,l,d,k,v){const p=s("config-panel"),f=s("recent-panel"),i=s("layout");return a(),V(i,null,{config:m(()=>[t(p,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[t(f,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Fo=$(jt,[["render",Ft],["__scopeId","data-v-eae39ce1"]]);export{Fo as default};
1
+ import{F as U}from"./index.es-D_XmAgqo.js";import{E as A}from"./index-DuI2-KLS.js";import{E as O}from"./index-Z5mOVLFU.js";import{d as g,H as r,E as c,z as R,C as t,y as m,D as s,q as a,F as n,O as S,N as C,x as V,I as _,J as h,Q as L}from"./vendor-vue-NSDaktjZ.js";import{H as $,bp as B,cs as N,aG as j,o as F,S as P,ct as z}from"./index-BDV5xox6.js";import{a as K,b as H,c as J}from"./pika-DpzVVVef.js";import{I as G,S as Q,l as W}from"./pagination-bfgKFQAv.js";import{E as X}from"./index-BPdZU3_P.js";import{E as D,a as M}from"./index-zwVEHcuP.js";import{a as Y,E as Z}from"./index-DrHHQRyJ.js";import{p as x}from"./pasteUploadMixin-BurWbGNQ.js";import{u as ee,a as te,e as oe}from"./uploadTrackerMixin--N-yU8Tl.js";import{I as se}from"./ImagePreview-JALXNCt5.js";import{E as ae}from"./index-BM6IZS2N.js";import{E as w}from"./index-BirF_gHh.js";import{P as ne,N as ie}from"./NoTasks-BOCm6wvK.js";import{C as le}from"./Consumption-fXKDZQba.js";import{a as re}from"./price-DS1hrWYx.js";import{b as ce,a as pe}from"./errorCode-Cqj9Td_Z.js";import{C as de}from"./CopyToClipboard-Dkvhu2YZ.js";import{s as ue}from"./vue-plyr-BO2nlN4c.js";import{A as me}from"./ApiCodeButton-b6I26hKj.js";import{E as fe}from"./index-Cs9zuzYY.js";import{E as _e}from"./index-C07GA-Xx.js";import{E as he}from"./index-Knta1eH8.js";import{B as ge}from"./BotPlaceholder-CrAvHEBe.js";import"./use-form-item-BixqpttR.js";import"./index-BuyEbX8F.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-dayjs-v0j1UNZp.js";import"./vendor-vue-router-Df5ITouH.js";import"./highlight-DIDZXu3F.js";import"./index-BLjywj98.js";import"./vendor-highlight-lEWW1Jxd.js";import"./validator-COLrY0lB.js";import"./index-BSOpiibX.js";import"./index-DH96CJeg.js";import"./typescript-oQ90Bxn4.js";import"./strings-beZM2Y-f.js";import"./isEqual-CdtVhbUc.js";import"./_Uint8Array-ooKCswaC.js";import"./castArray-CSG0_HUe.js";import"./index-6jnimpYJ.js";import"./index-B46AZLGT.js";import"./debounce-fZxSJHZ_.js";import"./_baseIteratee-HaFBNbp6.js";import"./index-DQNg6PhM.js";import"./index-BODp36LS.js";import"./_baseClone-Bx_7nX1I.js";import"./_initCloneObject-C5CIR6rP.js";import"./index-DAUUyVMy.js";const $e=g({name:"LayoutPika",components:{ElDrawer:O,ElButton:A,FontAwesomeIcon:U},data(){return{drawer:!1}}}),ke={class:"main flex flex-row flex-1"},ve={class:"config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]"},be={class:"result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]"};function ye(e,o,l,d,k,v){const p=s("font-awesome-icon"),f=s("el-button"),i=s("el-drawer");return a(),r("div",ke,[c("div",ve,[R(e.$slots,"config",{},void 0,!0)]),c("div",be,[R(e.$slots,"result",{},void 0,!0)]),t(f,{circle:"",class:"menu",onClick:o[0]||(o[0]=b=>e.drawer=!0)},{default:m(()=>[t(p,{icon:"fa-solid fa-magic"})]),_:1}),t(i,{modelValue:e.drawer,"onUpdate:modelValue":o[1]||(o[1]=b=>e.drawer=b),direction:"ltr","with-header":!1,size:"350px"},{default:m(()=>[R(e.$slots,"config",{},void 0,!0)]),_:3},8,["modelValue"])])}const we=$($e,[["render",ye],["__scopeId","data-v-10596416"]]),Ve=g({name:"IngredientsSelector",components:{ElSwitch:X,InfoIcon:G},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug("set ingredients",e),e||this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients:e,model:"2.0"})}}},mounted(){this.value===void 0&&(this.value=K)}}),Ee={class:"field"},Ie={class:"title font-bold"};function Se(e,o,l,d,k,v){const p=s("el-switch"),f=s("info-icon");return a(),r("div",Ee,[c("h2",Ie,n(e.$t("pika.name.ingredients")),1),t(p,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value"},null,8,["modelValue"]),t(f,{content:e.$t("pika.description.ingredients"),class:"info"},null,8,["content"])])}const Te=$(Ve,[["render",Se],["__scopeId","data-v-17c0af5c"]]),Ce=g({name:"EffectSelector",components:{ElSelect:M,ElOption:D},data(){return{}},computed:{options(){return[{value:"Levitate",label:this.$t("pika.style.effect1")},{value:"Decapitate",label:this.$t("pika.style.effect2")},{value:"Eye-pop",label:this.$t("pika.style.effect3")},{value:"Ta-da",label:this.$t("pika.style.effect4")},{value:"Deflate",label:this.$t("pika.style.effect5")},{value:"Crumble",label:this.$t("pika.style.effect6")},{value:"Dissolve",label:this.$t("pika.style.effect7")},{value:"Squish",label:this.$t("pika.style.effect8")},{value:"Inflate",label:this.$t("pika.style.effect9")},{value:"Melt",label:this.$t("pika.style.effect10")},{value:"Cake-ify",label:this.$t("pika.style.effect11")},{value:"Crush",label:this.$t("pika.style.effect12")},{value:"Explode",label:this.$t("pika.style.effect13")}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,effect:e})}}}}),Pe={class:"field"},Ue={class:"title font-bold"},Ae={class:"float-left"};function Le(e,o,l,d,k,v){const p=s("el-option"),f=s("el-select");return a(),r("div",Pe,[c("h2",Ue,n(e.$t("pika.name.effect")),1),t(f,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("pika.placeholder.select"),clearable:""},{default:m(()=>[(a(!0),r(S,null,C(e.options,i=>(a(),V(p,{key:i.value,label:i.label,value:i.value},{default:m(()=>[c("span",Ae,n(i.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Re=$(Ce,[["render",Le],["__scopeId","data-v-d1c54475"]]),Ge=g({name:"IngredientsModelSelector",components:{ElRadioButton:Z,ElRadioGroup:Y},data(){return{options:[{label:this.$t("pika.button.precise"),value:"precise"},{label:this.$t("pika.button.creative"),value:"creative"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||(this.value=H)}}),De={class:"field"},Me={class:"title font-bold"};function qe(e,o,l,d,k,v){const p=s("el-radio-button"),f=s("el-radio-group");return a(),r("div",De,[c("h2",Me,n(e.$t("pika.name.ingredientsModel")),1),t(f,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"quality"},{default:m(()=>[(a(!0),r(S,null,C(e.options,i=>(a(),V(p,{key:i.value,label:i.value},{default:m(()=>[_(n(i.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])}const Oe=$(Ge,[["render",qe],["__scopeId","data-v-b72865fa"]]),Be=g({name:"ModelSelector",components:{ElSelect:M,ElOption:D},props:{modelValue:{type:String,default:void 0}},emits:["update:modelValue"],data(){return{options:[{value:"2.0",label:"2.0"},{value:"1.5",label:"1.5"}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||(this.value=J)}}),Ne={class:"field"},je={class:"title font-bold"};function Fe(e,o,l,d,k,v){const p=s("el-option"),f=s("el-select");return a(),r("div",Ne,[c("h2",je,n(e.$t("pika.name.model")),1),t(f,{modelValue:e.value,"onUpdate:modelValue":o[0]||(o[0]=i=>e.value=i),class:"value",placeholder:e.$t("pika.placeholder.select")},{default:m(()=>[(a(!0),r(S,null,C(e.options,i=>(a(),V(p,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const ze=$(Be,[["render",Fe],["__scopeId","data-v-7b2e870a"]]),Ke=g({name:"ImageUrlInput",components:{ElUpload:ae,ElButton:A,InfoIcon:G,ImagePreview:se,FontAwesomeIcon:U},mixins:[x,ee],data(){return{fileList:[],uploadUrl:B()+"/api/v1/files/"}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.pika?.config?.image_url},set(){const e=this.urls?.[0];this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||(this.value=void 0),this.onSetStartImageUrl()},methods:{onExceed(){w.warning(this.$t("pika.message.uploadStartImageExceed"))},onError(){w.error(this.$t("pika.message.uploadStartImageError"))},async onRemove(){w.error(this.$t("pika.message.uploadStartImageError"))},onSetStartImageUrl(){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),He={class:"field"},Je={class:"title font-bold"},Qe={class:"upload-wrapper"};function We(e,o,l,d,k,v){const p=s("image-preview"),f=s("font-awesome-icon"),i=s("el-button"),b=s("el-upload"),E=s("info-icon");return a(),r("div",He,[c("h2",Je,n(e.$t("pika.name.imageUrl")),1),c("div",Qe,[t(b,{ref:"uploader","file-list":e.fileList,"onUpdate:fileList":o[0]||(o[0]=u=>e.fileList=u),accept:".png,.jpg,.jpeg,.gif,.bmp,.webp",name:"file",class:"value upload-wrapper",limit:3,multiple:!0,"list-type":"picture",action:e.uploadUrl,"on-exceed":e.onExceed,"on-error":e.onError,"on-remove":e.onRemove,"on-success":e.onSuccess,headers:e.headers},{file:m(({file:u})=>[t(p,{url:u.url||u.response?.file_url,name:u.name,percentage:u.percentage,onRemove:I=>e.fileList.splice(e.fileList.indexOf(u),1)},null,8,["url","name","percentage","onRemove"])]),default:m(()=>[t(i,{size:"small",type:"primary",round:""},{default:m(()=>[t(f,{icon:"fa-solid fa-upload",class:"mr-1"}),_(" "+n(e.$t("pika.button.uploadImageUrl")),1)]),_:1})]),_:1},8,["file-list","action","on-exceed","on-error","on-remove","on-success","headers"])]),t(E,{content:e.$t("pika.description.imageUrl"),class:"info"},null,8,["content"])])}const Xe=$(Ke,[["render",We],["__scopeId","data-v-25cefe78"]]),Ye="",Ze=g({name:"PromptInput",components:{PromptTextarea:ne},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){this.$store.commit("pika/setConfig",{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||(this.prompt=Ye)}});function xe(e,o,l,d,k,v){const p=s("prompt-textarea");return a(),V(p,{modelValue:e.prompt,"onUpdate:modelValue":o[0]||(o[0]=f=>e.prompt=f),title:e.$t("pika.name.prompt"),info:e.$t("pika.description.prompt"),placeholder:e.$t("pika.placeholder.prompt")},null,8,["modelValue","title","info","placeholder"])}const et=$(Ze,[["render",xe]]),tt=g({name:"PresetPanel",components:{ImageUrlInput:Xe,ElButton:A,FontAwesomeIcon:U,Consumption:le,PromptInput:et,IngredientsSelector:Te,IngredientsModelSelector:Oe,ModelSelector:ze,EffectSelector:Re},emits:["generate"],computed:{config(){return this.$store.state.pika?.config},consumption(){return re(this.config,this.service?.cost)},service(){return this.$store.state.pika?.service}},methods:{onGenerate(){this.$emit("generate")}}}),ot={class:"flex flex-col h-full"},st={class:"flex-1 overflow-y-auto p-5"},at={class:"flex flex-col items-center justify-center px-5 pb-5"};function nt(e,o,l,d,k,v){const p=s("prompt-input"),f=s("model-selector"),i=s("ingredients-selector"),b=s("effect-selector"),E=s("image-url-input"),u=s("ingredients-model-selector"),I=s("consumption"),T=s("font-awesome-icon"),y=s("el-button");return a(),r("div",ot,[c("div",st,[t(p,{class:"mb-4"}),t(f,{class:"mb-4"}),t(i,{class:"mb-4"}),t(b,{class:"mb-4"}),e.config?.ingredients?(a(),V(E,{key:0,class:"mb-4"})):h("",!0),e.config?.ingredients?(a(),V(u,{key:1,class:"mb-4"})):h("",!0)]),c("div",at,[t(I,{value:e.consumption,service:e.service},null,8,["value","service"]),t(y,{type:"primary",class:"btn w-full",round:"",onClick:e.onGenerate},{default:m(()=>[t(T,{icon:"fa-solid fa-magic",class:"mr-2"}),_(" "+n(e.$t("pika.button.generate")),1)]),_:1},8,["onClick"])])])}const it=$(tt,[["render",nt]]),lt=g({name:"VideoPlayer",components:{VuePlyr:ue},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:1080,options:[1080]}}}}}),rt=["data-poster"],ct=["src"];function pt(e,o,l,d,k,v){const p=s("vue-plyr");return a(),r("div",null,[t(p,{options:e.options,class:"video"},{default:m(()=>[c("video",{controls:"",playsinline:"",preload:"metadata","data-poster":e.modelValue?.image_url},[c("source",{size:"1080",src:e.modelValue?.video_url,type:"video/mp4"},null,8,ct)],8,rt)]),_:1},8,["options"])])}const dt=$(lt,[["render",pt],["__scopeId","data-v-897d9fe0"]]),ut=g({name:"TaskPreview",components:{ElImage:he,CopyToClipboard:de,FontAwesomeIcon:U,ElAlert:_e,VideoPlayer:dt,ElTooltip:fe,ElButton:A,ApiCodeButton:me},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[];const o=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(l=>{let d=l;o&&(d.action=o),e.push(d)}),e}},methods:{onDownload(e){console.log("on download"),window.open(e,"_blank")},onReload(e){const o=e.target,l=new URL(o.src),d=l.searchParams.get("retry");if(!d)l.searchParams.set("retry","1");else if(parseInt(d)<2)l.searchParams.set("retry",(parseInt(d)+1).toString());else return;o.src=l.toString()},onOpenVideo(e){window.open(e,"_blank")}}}),mt={class:"left"},ft={class:"main"},_t={class:"bot"},ht={class:"datetime"},gt={class:"info"},$t={key:0,class:"prompt mt-2"},kt={key:0},vt={key:1},bt={key:0,class:L({content:!0,failed:!0})},yt={class:"image-wrapper"},wt={key:0,class:L({operations:!0,"mt-2":!0})},Vt={key:0,class:"description"},Et={class:"description"},It={key:1,class:"description"},St={key:1,class:L({content:!0})},Tt={class:"description"},Ct={class:"description"},Pt={key:0,class:"description"},Ut={class:"description"},At={key:2,class:L({content:!0})},Lt={class:"description"};function Rt(e,o,l,d,k,v){const p=s("el-image"),f=s("VideoPlayer"),i=s("el-button"),b=s("el-tooltip"),E=s("api-code-button"),u=s("font-awesome-icon"),I=s("copy-to-clipboard"),T=s("el-alert");return a(!0),r(S,null,C(e.videos,(y,q)=>(a(),r("div",{key:q,class:"preview"},[c("div",mt,[t(p,{src:"https://cdn.acedata.cloud/i80tgn.png",class:"avatar"})]),c("div",ft,[c("div",_t,[_(n(e.$t("pika.name.pikaBot"))+" ",1),c("span",ht,n(e.$dayjs.format(""+new Date(parseFloat((e.modelValue?.created_at||"").toString())*1e3))),1)]),c("div",gt,[e.modelValue?.request?.prompt?(a(),r("p",$t,[_(n(e.modelValue?.request?.prompt)+" ",1),e.modelValue?.response?h("",!0):(a(),r("span",kt," - ("+n(e.$t("pika.status.pending"))+") ",1)),y?.state==="processing"||y?.state==="pending"?(a(),r("span",vt," - ("+n(e.$t("pika.status.processing"))+") ",1)):h("",!0)])):h("",!0)]),e.modelValue?.response?.success===!0?(a(),r("div",bt,[c("div",yt,[t(f,{"model-value":y},null,8,["model-value"])]),y?(a(),r("div",wt,[t(b,{class:"box-item",effect:"dark",content:e.$t("pika.message.downloadVideo"),placement:"top-start"},{default:m(()=>[y?.video_url?(a(),V(i,{key:0,type:"info",size:"small",class:"btn-action",onClick:zt=>e.onDownload(y?.video_url)},{default:m(()=>[_(n(e.$t("pika.button.download")),1)]),_:1},8,["onClick"])):h("",!0)]),_:2},1032,["content"]),t(E,{path:"/pika/videos",body:e.modelValue?.request},null,8,["body"])])):h("",!0),t(T,{closable:!1,class:"mt-2 success"},{default:m(()=>[e.modelValue?.request?.model?(a(),r("p",Vt,[t(u,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("pika.name.model"))+": "+n(e.modelValue?.request?.model),1)])):h("",!0),c("p",Et,[t(u,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("pika.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(I,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),e.modelValue?.elapsed?(a(),r("p",It,[t(u,{icon:"fa-solid fa-clock",class:"mr-1"}),_(" "+n(e.$t("pika.name.elapsed"))+": "+n(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):h("",!0)]),_:1})])):h("",!0),e.modelValue?.response?.success===!1?(a(),r("div",St,[t(T,{closable:!1,class:"failure"},{template:m(()=>[t(u,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("pika.name.failure")),1)]),default:m(()=>[c("p",Tt,[t(u,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("pika.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(I,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])]),c("p",Ct,[t(u,{icon:"fa-solid fa-circle-info",class:"mr-1"}),_(" "+n(e.$t("pika.name.failureReason"))+": "+n(e.modelValue?.response?.error?.message)+" ",1),t(I,{content:e.modelValue?.response?.error?.message,class:"btn-copy"},null,8,["content"])]),e.modelValue?.elapsed?(a(),r("p",Pt,[t(u,{icon:"fa-solid fa-clock",class:"mr-1"}),_(" "+n(e.$t("pika.name.elapsed"))+": "+n(e.modelValue?.elapsed?.toFixed(2))+"s ",1)])):h("",!0),c("p",Ut,[t(u,{icon:"fa-solid fa-hashtag",class:"mr-1"}),_(" "+n(e.$t("pika.name.traceId"))+": "+n(e.modelValue?.response?.trace_id)+" ",1),t(I,{content:e.modelValue?.response?.trace_id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0),!e.modelValue?.response||y?.state==="processing"||y?.state==="pending"?(a(),r("div",At,[t(T,{closable:!1,class:"info"},{template:m(()=>[t(u,{icon:"fa-solid fa-exclamation-triangle",class:"mr-1"}),_(" "+n(e.$t("pika.name.failure")),1)]),default:m(()=>[c("p",Lt,[t(u,{icon:"fa-solid fa-magic",class:"mr-1"}),_(" "+n(e.$t("pika.name.taskId"))+": "+n(e.modelValue?.id)+" ",1),t(I,{content:e.modelValue?.id,class:"btn-copy"},null,8,["content"])])]),_:1})])):h("",!0)])]))),128)}const Gt=$(ut,[["render",Rt],["__scopeId","data-v-52856c99"]]),Dt=g({name:"RecentPanel",components:{TaskPreview:Gt,BotPlaceholder:ge,NoTasks:ie,ScrollList:Q},props:{loading:{type:Boolean,default:!1}},emits:["reach-top"],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Mt={key:0},qt={key:2,class:"w-full h-full flex items-center justify-center"};function Ot(e,o,l,d,k,v){const p=s("bot-placeholder"),f=s("task-preview"),i=s("scroll-list"),b=s("no-tasks");return a(),r(S,null,[e.tasks?.items===void 0?(a(),r("div",Mt,[t(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(a(),V(i,{key:1,ref:"scrollList",class:"tasks h-full w-full overflow-y-auto",loading:e.loading,onReachTop:o[0]||(o[0]=E=>e.$emit("reach-top"))},{default:m(()=>[(a(!0),r(S,null,C(e.tasks?.items,(E,u)=>(a(),V(f,{key:u,"model-value":E},null,8,["model-value"]))),128))]),_:1},8,["loading"])):h("",!0),e.tasks?.items?.length===0?(a(),r("div",qt,[t(b)])):h("",!0)],64)}const Bt=$(Dt,[["render",Ot]]),Nt=z("pika"),jt=g({name:"PikaIndex",components:{ConfigPanel:it,Layout:we,RecentPanel:Bt},mixins:[te],inject:["initialized"],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pika?.status?.getApplications===P.Request},tasksLoading(){return this.$store.state.pika?.status?.getTasks===P.Request||this.fetchingTasks},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===P.Request},needApply(){return this.$store.state.pika.status.getApplications===P.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,o){e?.items?.length>o?.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("pika/getService"),console.debug("end onGetService")},async onGetApplication(){console.debug("start onGetApplication"),await this.$store.dispatch("pika/getApplications"),console.debug("end onGetApplication"),await this.onGetTasks()},onApply(){F.create({application:this.application}).then(({data:e})=>{this.application=e,w.success(this.$t("application.message.applySuccessfully"))}).catch(e=>{e?.response?.data?.code===pe&&w.error(this.$t("application.message.alreadyApplied"))})},async onScrollDown(){await this.$nextTick();const 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);const{limit:o=5,createdAtMin:l,createdAtMax:d}=e||{};console.debug("limit",o,"createdAtMin",l,"createdAtMax",d),this.fetchingTasks=!0;try{await this.$store.dispatch("pika/getTasks",{limit:o,createdAtMin:l,createdAtMax:d})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!oe(this.uploadTracker,l=>this.$t(l),l=>w.warning(l)))return;const e={...this.config,callback_url:Nt},o=this.credential?.token;if(!o){console.error("no token specified");return}w.info(this.$t("pika.message.startingTask")),N("pika",j.generate(e,{token:o})).then(()=>{w.success(this.$t("pika.message.startTaskSuccess")),this.$store.commit("pika/setConfig",{config:void 0})}).catch(l=>{l?.response?.data?.error?.code===ce?w.error(this.$t("pika.message.usedUp")):w.error(this.$t("pika.message.startTaskFailed"))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Ft(e,o,l,d,k,v){const p=s("config-panel"),f=s("recent-panel"),i=s("layout");return a(),V(i,null,{config:m(()=>[t(p,{onGenerate:e.onGenerate},null,8,["onGenerate"])]),result:m(()=>[t(f,{ref:"recentPanel",class:"panel recent",loading:e.loadingMore,onReachTop:e.onReachTop},null,8,["loading","onReachTop"])]),_:1})}const Fo=$(jt,[["render",Ft],["__scopeId","data-v-eae39ce1"]]);export{Fo as default};