@acedatacloud/nexior 3.380.7 → 3.380.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/dist/assets/{ApiCodeButton-Bl0IKoEK.js → ApiCodeButton-C5tBSXac.js} +1 -1
  2. package/dist/assets/{ApiCodeDialog-BpFuqSZb.js → ApiCodeDialog-tzrLt7MW.js} +1 -1
  3. package/dist/assets/{Artifacts-DxOnuERW.js → Artifacts-Bq-ESji9.js} +1 -1
  4. package/dist/assets/{AskUserQuestionCard-CPPRd9KL.js → AskUserQuestionCard-BHRutjE4.js} +1 -1
  5. package/dist/assets/{AudioPreview-06tVQ8qx.js → AudioPreview-fEc2Zd45.js} +1 -1
  6. package/dist/assets/{Auth-DZAoj-Vn.js → Auth-D0qonxcj.js} +1 -1
  7. package/dist/assets/{Bare-DRrpHReU.js → Bare-gBTQBYOF.js} +1 -1
  8. package/dist/assets/{BotPlaceholder-Di7Uk8RE.js → BotPlaceholder-7Rci0gLD.js} +1 -1
  9. package/dist/assets/{BottomFooter-CHaxvSBp.js → BottomFooter-CXfDJs6K.js} +1 -1
  10. package/dist/assets/{BrowseConnectors-DsHA3HeT.js → BrowseConnectors-jbUHMESo.js} +1 -1
  11. package/dist/assets/{BrowserPairingDialog-BISZnXPq.js → BrowserPairingDialog-BLbseBCp.js} +1 -1
  12. package/dist/assets/{Callback-D45Fi_lJ.js → Callback-DQ7s2YUT.js} +1 -1
  13. package/dist/assets/{CodeSnippet-gd7fobwb.js → CodeSnippet-DtFkobrj.js} +1 -1
  14. package/dist/assets/{Console-L6pP6se4.js → Console-DqcMlqeQ.js} +1 -1
  15. package/dist/assets/{Conversation-Ic9Bz5jQ.js → Conversation-BdtH_RD0.js} +1 -1
  16. package/dist/assets/{Conversation-CeRC-TVk.js → Conversation-CxIjxIV3.js} +1 -1
  17. package/dist/assets/{CopyToClipboard-CPy6HppP.js → CopyToClipboard-CIB9LY9Y.js} +1 -1
  18. package/dist/assets/{Detail-gkbc8bib.js → Detail-Cwhh5P9b.js} +1 -1
  19. package/dist/assets/{Extra-VwsLS6YO.js → Extra-C2rM0X0l.js} +1 -1
  20. package/dist/assets/{FilePreview-XFzuQ-TE.js → FilePreview-_7yUZ2m8.js} +1 -1
  21. package/dist/assets/{Hailuo-wE99sN73.js → Hailuo-Gr9P4KZh.js} +1 -1
  22. package/dist/assets/{History-6Gmii4RH.js → History-BdECMOXE.js} +1 -1
  23. package/dist/assets/{ImagePreview-IlwjPknL.js → ImagePreview-Dq6UkYX8.js} +1 -1
  24. package/dist/assets/{ImageWrapper-DwZLyHlu.js → ImageWrapper-C9nEUyQX.js} +1 -1
  25. package/dist/assets/{Index-DENfri2t.js → Index-AbcXPxs0.js} +1 -1
  26. package/dist/assets/{Index-DKwPiDoa.js → Index-B3fIj3yi.js} +1 -1
  27. package/dist/assets/{Index-D_5kP3GH.js → Index-B7WKuXER.js} +1 -1
  28. package/dist/assets/{Index-DJuIQolu.js → Index-BDfNqyi8.js} +1 -1
  29. package/dist/assets/{Index-C8mf8y3Z.js → Index-BHFcy6tF.js} +1 -1
  30. package/dist/assets/{Index-BCc6R-3p.js → Index-BS1nLceI.js} +1 -1
  31. package/dist/assets/{Index-D91qOM5l.js → Index-BhPsqs3d.js} +1 -1
  32. package/dist/assets/{Index-C5Jx7Yi1.js → Index-Bi_F3a9E.js} +1 -1
  33. package/dist/assets/{Index-CUNVBf2_.js → Index-BinkgTmw.js} +1 -1
  34. package/dist/assets/{Index-5qkpk56T.js → Index-Bo60hgY3.js} +1 -1
  35. package/dist/assets/{Index-FvSnC5Gu.js → Index-Bx9XT7ii.js} +1 -1
  36. package/dist/assets/{Index-ClfPrBNl.js → Index-C8oOUtOA.js} +1 -1
  37. package/dist/assets/{Index-CvLqmn1W.js → Index-CGSt7zKV.js} +1 -1
  38. package/dist/assets/{Index-FPPRahdy.js → Index-CGU29OIG.js} +1 -1
  39. package/dist/assets/{Index-Bzw76kRp.js → Index-CWWsa0Lz.js} +1 -1
  40. package/dist/assets/{Index-CbOx4kXF2.js → Index-CmrcDBzZ2.js} +1 -1
  41. package/dist/assets/{Index-Coc9GN7P.js → Index-D5VNzG82.js} +1 -1
  42. package/dist/assets/{Index-C0hhbatS.js → Index-DAF6Fi1i.js} +1 -1
  43. package/dist/assets/{Index-x6HNp31e.js → Index-DCSPk7nn.js} +1 -1
  44. package/dist/assets/{Index-DiuTmQ18.js → Index-DE4Uanlv.js} +1 -1
  45. package/dist/assets/{Index-DVH9jvhX.js → Index-DF_YSy5V.js} +1 -1
  46. package/dist/assets/{Index-DNBn5SRx.js → Index-DLjlVvNI.js} +1 -1
  47. package/dist/assets/{Index-RJ0tXVSn.js → Index-DN7liprI.js} +1 -1
  48. package/dist/assets/{Index-CRgeGm9t2.js → Index-DUFd5F6p2.js} +1 -1
  49. package/dist/assets/{Index-1LI4qM1U.js → Index-DVhN8ZAF.js} +1 -1
  50. package/dist/assets/{Index-DISZi4AX.js → Index-DeOmC_Q0.js} +1 -1
  51. package/dist/assets/{Index-CRaGpiG2.js → Index-DeYrbAvW.js} +1 -1
  52. package/dist/assets/{Index-DuhBu_dV.js → Index-DfJKnw20.js} +1 -1
  53. package/dist/assets/{Index-CZb3lVKU.js → Index-DgC9uvAK.js} +1 -1
  54. package/dist/assets/{Index-B8iqvMBN.js → Index-Dkc39b3K.js} +1 -1
  55. package/dist/assets/{Index-DikhcXUe.js → Index-Drdb9P_r.js} +1 -1
  56. package/dist/assets/{Index-DLzstYPk.js → Index-DxgRmJSg.js} +1 -1
  57. package/dist/assets/{Index-DUAKBAKC.js → Index-EYQ1NKQW.js} +1 -1
  58. package/dist/assets/{Index-Bc5tHnvd.js → Index-FNGDlXFq.js} +1 -1
  59. package/dist/assets/{Index-B_zeMtQ92.js → Index-SDzpl-Jc2.js} +1 -1
  60. package/dist/assets/{Index-Cg4zypDC.js → Index-Vz7Mw5xh.js} +1 -1
  61. package/dist/assets/{Invitees-DMTIt1f8.js → Invitees-DyGmUv2R.js} +1 -1
  62. package/dist/assets/{List-v0cq20WS.js → List-0tPShY4u.js} +1 -1
  63. package/dist/assets/{List-BJVhbGc2.js → List-5Z5tELQE.js} +1 -1
  64. package/dist/assets/{List-Bg3zNJN6.js → List-lPxHfTDQ.js} +1 -1
  65. package/dist/assets/{LocalTools-CRZWSNYJ.js → LocalTools-BPDI9e-z.js} +1 -1
  66. package/dist/assets/{LocalTools-BXr2LA7c.js → LocalTools-CWWIjS6k.js} +1 -1
  67. package/dist/assets/{Logo-DBYKKsqe.js → Logo-6qSswnm2.js} +1 -1
  68. package/dist/assets/{Main-CKmKHwvW.js → Main-gLvuSjN6.js} +1 -1
  69. package/dist/assets/{Message-B0YuUoNF.js → Message-BtE8gWlu.js} +1 -1
  70. package/dist/assets/Model-CeOYezTT.js +14 -0
  71. package/dist/assets/{Model-CCJ4QTLN.css → Model-CoIdK_fw.css} +1 -1
  72. package/dist/assets/{Navigator-BEWdP8-d.js → Navigator-DqokGio8.js} +3 -3
  73. package/dist/assets/{NotFound-35P720pk.js → NotFound-D3Q4GfiQ.js} +1 -1
  74. package/dist/assets/{PageHeader-CrMUGzE3.js → PageHeader-DOWQjC3H.js} +1 -1
  75. package/dist/assets/{Pay-B2Xb91cJ.js → Pay-O5Qlb6UW.js} +1 -1
  76. package/dist/assets/{Player-BiE9S0-t.js → Player-B3iX2KLl.js} +1 -1
  77. package/dist/assets/{Poivelle-cm5y2eQW.js → Poivelle-DKlkQB2c.js} +1 -1
  78. package/dist/assets/{RealtimeCall-DKT-DWP_.js → RealtimeCall-XAJLDR6Q.js} +1 -1
  79. package/dist/assets/{ReportButton-HJXikYhw.js → ReportButton-D3eba7A1.js} +1 -1
  80. package/dist/assets/{ReportDialog-Cv0l0u0O.js → ReportDialog-tMrdW_fU.js} +1 -1
  81. package/dist/assets/{ScenarioPaymentMode-CLmOm0A2.js → ScenarioPaymentMode-BwoqFZco.js} +1 -1
  82. package/dist/assets/{ScheduledTasks-vZ3715pt.js → ScheduledTasks-CMcU7GEK.js} +1 -1
  83. package/dist/assets/{ServicePricingSummary-WDKPB3K5.js → ServicePricingSummary-N2X5DfKj.js} +1 -1
  84. package/dist/assets/{SharedMarkdown-Bx8pHtWj.js → SharedMarkdown-B8a4sQ0t.js} +1 -1
  85. package/dist/assets/{ShowcaseGrid-D361j0tq.js → ShowcaseGrid-DFAlG_5F.js} +1 -1
  86. package/dist/assets/{ShowcaseResultTabs-BjqfQ-y8.js → ShowcaseResultTabs-Bx16-8QM.js} +1 -1
  87. package/dist/assets/{SolanaWalletPickerDialog-xXMsyABV.js → SolanaWalletPickerDialog-DpiM35uj.js} +1 -1
  88. package/dist/assets/{Status-DpWyDejb.js → Status-CVUE2QYX.js} +1 -1
  89. package/dist/assets/{Subscribe-ChQM0B3X.js → Subscribe-BN32hXrS.js} +1 -1
  90. package/dist/assets/{TabSwitcher-kBSHg_RT.js → TabSwitcher-6c6JSS4_.js} +1 -1
  91. package/dist/assets/{Tts-m-QIPjVW.js → Tts-Dio3pSmI.js} +1 -1
  92. package/dist/assets/{VideoPlayer-Bicexa5t.js → VideoPlayer-BNtDhrpR.js} +1 -1
  93. package/dist/assets/{VideoPreview-sF3vbUe_.js → VideoPreview-K60Fueap.js} +1 -1
  94. package/dist/assets/{VueMarkdown-B43d9bQU.js → VueMarkdown-ktB0s_p4.js} +2 -2
  95. package/dist/assets/{WriteSkillDialog-K2LS3TLf.js → WriteSkillDialog-Bw-u8hlH.js} +1 -1
  96. package/dist/assets/{airwallexCheckout-COCsILnN.js → airwallexCheckout--o-YoruN.js} +1 -1
  97. package/dist/assets/arrow-down-DCMjRdO_.js +1 -0
  98. package/dist/assets/arrow-left-DFXx6UvA.js +1 -0
  99. package/dist/assets/arrow-right-BBcVYEm1.js +1 -0
  100. package/dist/assets/arrow-up-BAfO-War.js +1 -0
  101. package/dist/assets/{authorizeFlow-79yBxAUr.js → authorizeFlow-D30X2Lyo.js} +1 -1
  102. package/dist/assets/{avatar-BfVAMo2Z.js → avatar--_Ho4k0C.js} +1 -1
  103. package/dist/assets/{back-navigation-Bf8as-FA.js → back-navigation-D-lHpBnE.js} +1 -1
  104. package/dist/assets/{basic-DqjasYm3.js → basic-C8xJ8MvR.js} +1 -1
  105. package/dist/assets/{book-open-Czrb7MGi.js → book-open-BH4GaBn5.js} +1 -1
  106. package/dist/assets/{box-SwZkcPwV.js → box-3_e2nW7_.js} +1 -1
  107. package/dist/assets/{boxes-BX01tbYr.js → boxes-DQGNW64d.js} +1 -1
  108. package/dist/assets/{brain-B2dt2mtC.js → brain-DMDAedtO.js} +1 -1
  109. package/dist/assets/{chart-no-axes-combined-BWJUWQ6_.js → chart-no-axes-combined-N5HL2gKV.js} +1 -1
  110. package/dist/assets/{chat-D9dyklxP.js → chat-C3QlZeo1.js} +1 -1
  111. package/dist/assets/check-kkIqx5X1.js +1 -0
  112. package/dist/assets/chevron-down-vUO0pCAt.js +1 -0
  113. package/dist/assets/chevron-right-CHPHpC1T.js +1 -0
  114. package/dist/assets/{circle-alert-DqJ9TVTA.js → circle-alert-C-PFf-1o.js} +1 -1
  115. package/dist/assets/circle-check-1eqJK_BD.js +1 -0
  116. package/dist/assets/{circle-question-mark-fAtYMrnm.js → circle-question-mark-iFkJm6Cg.js} +1 -1
  117. package/dist/assets/{clipboard-list-DSRFxnIJ.js → clipboard-list-Cvngrayq.js} +1 -1
  118. package/dist/assets/clock-DIjv9Rh6.js +1 -0
  119. package/dist/assets/code-Bm4SQ3yq.js +1 -0
  120. package/dist/assets/{codingBridge-BfiSHXN9.js → codingBridge-CeVcO4fE.js} +1 -1
  121. package/dist/assets/{codingBridgeNotify-Ysjl9KMz.js → codingBridgeNotify-BoMwcUhd.js} +2 -2
  122. package/dist/assets/{coins-BKHjrOuK.js → coins-D0M4bX5f.js} +1 -1
  123. package/dist/assets/{collapse-B87qL7a1.js → collapse-Dm00aNe0.js} +1 -1
  124. package/dist/assets/{connection-lRLepK-k.js → connection-CaarfcXm.js} +1 -1
  125. package/dist/assets/{constants-4TRM3yeb.js → constants-CspFM8fh.js} +1 -1
  126. package/dist/assets/{copy-BQhLObZQ.js → copy-CUk5HyqT.js} +1 -1
  127. package/dist/assets/{createTaskActions-BJzACS7D.js → createTaskActions-DQEdc5ib.js} +1 -1
  128. package/dist/assets/{date-picker-SPNad7vN.js → date-picker-C9cLRv2A.js} +1 -1
  129. package/dist/assets/{digitalhuman-B8FhZR44.js → digitalhuman-C7ZvYqCi.js} +1 -1
  130. package/dist/assets/{dollar-sign-DBmpsQy1.js → dollar-sign-C1s1LGmE.js} +1 -1
  131. package/dist/assets/{download-BL2XIF0d.js → download-BmQLXojU.js} +1 -1
  132. package/dist/assets/{drawer-NlOtUlBy.js → drawer-VaJhlwVr.js} +1 -1
  133. package/dist/assets/{dropdown-F0wtZRCE.js → dropdown-DBipAigc.js} +1 -1
  134. package/dist/assets/{dropdown-BxamzZWb.js → dropdown-iF_atr6i.js} +1 -1
  135. package/dist/assets/{ellipsis-B2I7WLsv.js → ellipsis-BqkKsvF-.js} +1 -1
  136. package/dist/assets/{esm-idF2qGYh.js → esm-Cbxht914.js} +2 -2
  137. package/dist/assets/{esm-BJBLTKdR.js → esm-DrVDihqw.js} +2 -2
  138. package/dist/assets/esm-fbzVLLeD.js +1 -0
  139. package/dist/assets/{external-link-Dz73hFs_.js → external-link-C9bruFod.js} +1 -1
  140. package/dist/assets/{eye-DAvfHS0R.js → eye-CFHeQVx8.js} +1 -1
  141. package/dist/assets/{file-BV5-MQMU.js → file-CR75F95u.js} +1 -1
  142. package/dist/assets/{file-output-Q5_Dd4rm.js → file-output-CfzTcR2_.js} +1 -1
  143. package/dist/assets/{file-text-C3onrgVx.js → file-text-DBotrbYk.js} +1 -1
  144. package/dist/assets/{fish-BOAMwF1y.js → fish-3sl5sjjo.js} +1 -1
  145. package/dist/assets/{fish-BWVwHYHy.js → fish-7nSZHdyl.js} +1 -1
  146. package/dist/assets/{fish-CbNRZRfM.js → fish-B1s1UOus.js} +1 -1
  147. package/dist/assets/{fish-QqSH2Ybr.js → fish-BRcyN82l.js} +1 -1
  148. package/dist/assets/{fish-BTIoKy0Z.js → fish-BqSSV68s.js} +1 -1
  149. package/dist/assets/fish-C-hdRW-5.js +1 -0
  150. package/dist/assets/{fish-BjXKlaHz.js → fish-C3d7zHOM.js} +1 -1
  151. package/dist/assets/{fish-CnIfjdFj.js → fish-CRBnMEsf.js} +1 -1
  152. package/dist/assets/{fish-BUijZnTb.js → fish-Clm3uj6k.js} +1 -1
  153. package/dist/assets/{fish-Dps6SChX.js → fish-D50ny6-y.js} +1 -1
  154. package/dist/assets/fish-DjLQRbe6.js +1 -0
  155. package/dist/assets/{fish-DBZnAziG.js → fish-ccw5gk5G.js} +1 -1
  156. package/dist/assets/{fish-CYl3-GX7.js → fish-pcD_DjO2.js} +1 -1
  157. package/dist/assets/{flux-Cz8tTCG7.js → flux-CVzCQ6JR.js} +1 -1
  158. package/dist/assets/{folder-B0j8ZXUr.js → folder-C9cnY4AN.js} +1 -1
  159. package/dist/assets/gauge-BdSNWC_w.js +1 -0
  160. package/dist/assets/{generationInput-DnJFevpe.js → generationInput-VbA_cpqx.js} +1 -1
  161. package/dist/assets/{globe-DaPEXf3D.js → globe-BKX021RY.js} +1 -1
  162. package/dist/assets/{grokvideo-CMjqwWMs.js → grokvideo-IjeySWKZ.js} +1 -1
  163. package/dist/assets/{hailuo-BQXnfi42.js → hailuo-CP8PTXG3.js} +1 -1
  164. package/dist/assets/{hash-Cj1kzh4e.js → hash-B61j4cgz.js} +1 -1
  165. package/dist/assets/{headphones-Dd3X9vkF.js → headphones-SI1F4r-k.js} +1 -1
  166. package/dist/assets/{history-BpiCbuvU.js → history-_iIOa-KW.js} +1 -1
  167. package/dist/assets/{house-CzT-mwyS.js → house-C3am4krm.js} +1 -1
  168. package/dist/assets/{image-DpY9p92X.js → image-DNGAwErV.js} +1 -1
  169. package/dist/assets/{imageRequests-GNQtekZ9.js → imageRequests-D1kPE8U_.js} +1 -1
  170. package/dist/assets/{index-BKiJMLEa.js → index-Bk9SKIXV.js} +5 -5
  171. package/dist/assets/{index.es-DFYaskof.js → index.es-xc1wwztg.js} +1 -1
  172. package/dist/assets/{info-CvT6Qu3B.js → info-CDi6ZfZf.js} +1 -1
  173. package/dist/assets/{input-number-BAYBeYyC.js → input-number-BwJ2QIsY.js} +1 -1
  174. package/dist/assets/{kling-CvdF4sMz.js → kling-BxsNl9_b.js} +1 -1
  175. package/dist/assets/{languages-BiznuS3A.js → languages-p0PeYqme.js} +1 -1
  176. package/dist/assets/{laptop-BL51CFzo.js → laptop-B7PBJgxD.js} +1 -1
  177. package/dist/assets/{lightbulb-BcrhXseN.js → lightbulb-ByXvOBwJ.js} +1 -1
  178. package/dist/assets/{link-SbHNTvQh.js → link-f8tGCmjZ.js} +1 -1
  179. package/dist/assets/loader-circle-BWTf1Yce.js +1 -0
  180. package/dist/assets/{luma-DagjUk4t.js → luma-D_7feexJ.js} +1 -1
  181. package/dist/assets/{maestro-BjJMLjEj.js → maestro-BO062bai.js} +1 -1
  182. package/dist/assets/{mail-DuPozrZ9.js → mail-Cu6rYS5J.js} +1 -1
  183. package/dist/assets/{message-circle-BHAAjfgl.js → message-circle-DQGqX_tb.js} +1 -1
  184. package/dist/assets/{mic-hoiBobBz.js → mic-Duo8uJFA.js} +1 -1
  185. package/dist/assets/{midjourney-D6UJXDEb.js → midjourney-DgbyQQt4.js} +1 -1
  186. package/dist/assets/{minimax-DfN_KBv_.js → minimax-C_26yfUG.js} +1 -1
  187. package/dist/assets/{mobileLocalExec-C-7qkE-A.js → mobileLocalExec-BAoyTFxs.js} +2 -2
  188. package/dist/assets/{monitor-B8sYke_Z.js → monitor-BY7a2lSu.js} +1 -1
  189. package/dist/assets/{mouse-pointer-2-DE7o83M5.js → mouse-pointer-2-BBBdRKNG.js} +1 -1
  190. package/dist/assets/music-2-BmtV50Q3.js +1 -0
  191. package/dist/assets/{nanobanana-hXxLtX9z.js → nanobanana-BPGCIia_.js} +1 -1
  192. package/dist/assets/{omni-BfE1jn3E.js → omni-DRmYijL5.js} +1 -1
  193. package/dist/assets/{openaiimage-CEXH26jW.js → openaiimage-DMLO-tzp.js} +1 -1
  194. package/dist/assets/{pagination-BPJdobR0.js → pagination-BodQ3KsQ.js} +1 -1
  195. package/dist/assets/{pagination-DOpEFcRz.js → pagination-Bxloie8Z.js} +1 -1
  196. package/dist/assets/{pagination-30x3I8le.js → pagination-Srdjt7tL.js} +1 -1
  197. package/dist/assets/{palette-CODnbXUA.js → palette-CBVqiEiY.js} +1 -1
  198. package/dist/assets/{paperclip-BqZb2ebO.js → paperclip-C5ucVDdU.js} +1 -1
  199. package/dist/assets/{pause-BLbkGoHw.js → pause-DEsHu_JX.js} +1 -1
  200. package/dist/assets/{pencil-DjnUUKV4.js → pencil-zCR4E3gn.js} +1 -1
  201. package/dist/assets/{pika-BSBnEnJt.js → pika-CpXs-W0u.js} +1 -1
  202. package/dist/assets/{pixverse-Ddq8Oh7B.js → pixverse-Br13_G7h.js} +1 -1
  203. package/dist/assets/play-XZGUGKIJ.js +1 -0
  204. package/dist/assets/{plug-CNwFr71M.js → plug-BuLs05P4.js} +1 -1
  205. package/dist/assets/plus-Bz8tjapX.js +1 -0
  206. package/dist/assets/{poivelle-L7ro3Gkj.js → poivelle-CmbgX8cH.js} +1 -1
  207. package/dist/assets/{popover-H49TbaK1.js → popover-B0GxuFgb.js} +1 -1
  208. package/dist/assets/{producer-CDz0k5We.js → producer-CtomnQQP.js} +1 -1
  209. package/dist/assets/{qrart-CLUgyDPS.js → qrart-D4w0rqYS.js} +1 -1
  210. package/dist/assets/{qwenimage-D4YCMO3Z.js → qwenimage-DL9zIyXV.js} +1 -1
  211. package/dist/assets/{realtime-D-QPHXzv.js → realtime-DMwjvq1k.js} +1 -1
  212. package/dist/assets/{refresh-cw-Bc03rr36.js → refresh-cw-CcOH8EPk.js} +1 -1
  213. package/dist/assets/rotate-ccw-S9qsO1Sd.js +1 -0
  214. package/dist/assets/rotate-cw-DZrl6qQ6.js +1 -0
  215. package/dist/assets/{row-BgeFnNqr.js → row-BxSRQSNe.js} +1 -1
  216. package/dist/assets/{scheduledTasks-BBhCq1Z4.js → scheduledTasks-BatLQ_gR.js} +1 -1
  217. package/dist/assets/{scroll-text-R1U8uMWl.js → scroll-text-BTS-NpZu.js} +1 -1
  218. package/dist/assets/search-K-yhv6oC.js +1 -0
  219. package/dist/assets/{seedance-Cf4OfUjF.js → seedance-Bou-k6BW.js} +1 -1
  220. package/dist/assets/{seedream-NIMro-y5.js → seedream-C9Rua-7B.js} +1 -1
  221. package/dist/assets/{select-BInIHo7G.js → select-Dv7ZrvnE.js} +1 -1
  222. package/dist/assets/{serp-DhfTVS3G.js → serp-B8GBsdPs.js} +1 -1
  223. package/dist/assets/{shield-BFZdo9VP.js → shield-D-mmPu1n.js} +1 -1
  224. package/dist/assets/{showcase-BwmzUSLv.js → showcase-Cq0oPoIV.js} +1 -1
  225. package/dist/assets/{showcaseRecreateMixin-DZhEbJHb.js → showcaseRecreateMixin-C0UnaxsG.js} +1 -1
  226. package/dist/assets/{shuffle-DyjF4nuU.js → shuffle-D5K8vZCN.js} +1 -1
  227. package/dist/assets/{siteHome-C46V57EN.js → siteHome-Ds14_RM3.js} +1 -1
  228. package/dist/assets/{slider-CjK3h6Ns.js → slider-C4ifUfAq.js} +1 -1
  229. package/dist/assets/{solana-wallets-t-MoSBDB.js → solana-wallets-B_mKv7o5.js} +2 -2
  230. package/dist/assets/{sora-C_tsa4Jq.js → sora-CO4yLi7O.js} +1 -1
  231. package/dist/assets/{sparkles-BtDqpjOi.js → sparkles-BI5Fg4u8.js} +1 -1
  232. package/dist/assets/square-_e71CHtO.js +1 -0
  233. package/dist/assets/{suno-BoSq6jVW.js → suno-BPJ6ThLW.js} +1 -1
  234. package/dist/assets/{switch-Bs3isJHk.js → switch-CFUCWNgM.js} +1 -1
  235. package/dist/assets/{table-CdxI9RXF.js → table-GjLQgxzP.js} +1 -1
  236. package/dist/assets/{tabs-sZ_AqSxe.js → tabs-BpSLc2Is.js} +1 -1
  237. package/dist/assets/{tag-Bqk4GDQ1.js → tag-A8kAprsR.js} +1 -1
  238. package/dist/assets/{taskPolling-Ba924Cu6.js → taskPolling-C9KHdhtK.js} +1 -1
  239. package/dist/assets/terminal-fyhUEvgw.js +1 -0
  240. package/dist/assets/{time-picker-Dg1D8tQc.js → time-picker-D4M2msCX.js} +1 -1
  241. package/dist/assets/{tooltip-BynUkwzp.js → tooltip-L2G5ntVi.js} +1 -1
  242. package/dist/assets/{trash-2-Beln6mAv.js → trash-2-CUcSh2xz.js} +1 -1
  243. package/dist/assets/{triangle-alert-Bq3-_Fkc.js → triangle-alert-fl0O4ttl.js} +1 -1
  244. package/dist/assets/{upload-DvqAUM9o.js → upload-BG3x_JWJ.js} +1 -1
  245. package/dist/assets/{upload-C9ppn-9g.js → upload-ClpzRFqM.js} +1 -1
  246. package/dist/assets/user-3UxB-6FB.js +1 -0
  247. package/dist/assets/{veo-BM_OsVzj.js → veo-DzVF-9VO.js} +1 -1
  248. package/dist/assets/{video-DFCJZTYe.js → video-D2H2yrK5.js} +1 -1
  249. package/dist/assets/{volume-2-D05kCyqN.js → volume-2-DuPw1i4l.js} +1 -1
  250. package/dist/assets/{vuex.esm-bundler-Dh61cDbO.js → vuex.esm-bundler-C-5WV-ta.js} +1 -1
  251. package/dist/assets/{wallet-D_E8xHdl.js → wallet-BoMayNFZ.js} +1 -1
  252. package/dist/assets/{wan-i1x1NPs2.js → wan-Div7QNhT.js} +1 -1
  253. package/dist/assets/{wand-sparkles-DmpeiEvn.js → wand-sparkles-C9xUdsPZ.js} +1 -1
  254. package/dist/assets/{web-ClIZOhEu.js → web-CMUsrooq.js} +1 -1
  255. package/dist/assets/{web-CdqGs2aB.js → web-CXqpsAgb.js} +1 -1
  256. package/dist/assets/{web-n7B5hrAP.js → web-CxmWSgKl.js} +1 -1
  257. package/dist/assets/{web-CnxrQ3-A.js → web-NUACo-ru.js} +1 -1
  258. package/dist/assets/{web-BMIc4KWg.js → web-onuv9tHs.js} +1 -1
  259. package/dist/assets/{webextrator-B0VFkC6C.js → webextrator-Di-ibQB9.js} +1 -1
  260. package/dist/assets/{zap-B9ieVMPc.js → zap-B0eAEhqX.js} +1 -1
  261. package/dist/index.html +3 -3
  262. package/package.json +2 -1
  263. package/dist/assets/Model-CO-op85f.js +0 -1
  264. package/dist/assets/arrow-down-BbbkJBhc.js +0 -1
  265. package/dist/assets/arrow-left-DLmEl6Wt.js +0 -1
  266. package/dist/assets/arrow-right-Cn1HHkEN.js +0 -1
  267. package/dist/assets/arrow-up-CmBM1usJ.js +0 -1
  268. package/dist/assets/check-Bso95mxA.js +0 -1
  269. package/dist/assets/chevron-down-wwaIPuLp.js +0 -1
  270. package/dist/assets/chevron-right-BPElZZtK.js +0 -1
  271. package/dist/assets/circle-check-8Ag9jR7I.js +0 -1
  272. package/dist/assets/clock-DDlHnp3A.js +0 -1
  273. package/dist/assets/code-uWq_r4xP.js +0 -1
  274. package/dist/assets/esm-CpCYiie4.js +0 -1
  275. package/dist/assets/fish-3zof-Oq9.js +0 -1
  276. package/dist/assets/fish-CZdHH_pA.js +0 -1
  277. package/dist/assets/gauge-BSNtDzVJ.js +0 -1
  278. package/dist/assets/loader-circle-Bg3m04-P.js +0 -1
  279. package/dist/assets/music-2-Cah3m1kW.js +0 -1
  280. package/dist/assets/play-C6y7thrI.js +0 -1
  281. package/dist/assets/plus-Crsuo9O8.js +0 -1
  282. package/dist/assets/rotate-ccw-DsaR9Mql.js +0 -1
  283. package/dist/assets/rotate-cw-DG8oZGAk.js +0 -1
  284. package/dist/assets/search-wtwmDOjb.js +0 -1
  285. package/dist/assets/square-DxpmXZ0N.js +0 -1
  286. package/dist/assets/terminal-BmcXFwFy.js +0 -1
  287. package/dist/assets/user-CPjm4jru.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,b as u,ht as d,j as f,mt as p,ot as m,qt as ee,rt as h,st as g,tt as _,x as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{n as b,t as x}from"./tabs-sZ_AqSxe.js";import{t as S}from"./tooltip-BynUkwzp.js";import{v as C}from"./vuex.esm-bundler-Dh61cDbO.js";import{n as w,r as T,t as E}from"./dropdown-BxamzZWb.js";import{t as D}from"./switch-Bs3isJHk.js";import{t as O}from"./book-open-Czrb7MGi.js";import{t as k}from"./chevron-down-wwaIPuLp.js";import{t as A}from"./chevron-right-BPElZZtK.js";import{t as j}from"./circle-check-8Ag9jR7I.js";import{t as M}from"./circle-question-mark-fAtYMrnm.js";import{t as N}from"./clipboard-list-DSRFxnIJ.js";import{a as P,i as F,n as I,r as L,t as R}from"./WriteSkillDialog-K2LS3TLf.js";import{t as z}from"./code-uWq_r4xP.js";import{t as B}from"./copy-BQhLObZQ.js";import{t as V}from"./ellipsis-B2I7WLsv.js";import{t as H}from"./eye-DAvfHS0R.js";import{t as U}from"./file-text-C3onrgVx.js";import{t as W}from"./file-BV5-MQMU.js";import{t as G}from"./folder-B0j8ZXUr.js";import{t as K}from"./image-DpY9p92X.js";import{t as te}from"./plus-Crsuo9O8.js";import{t as q}from"./scroll-text-R1U8uMWl.js";import{t as ne}from"./search-wtwmDOjb.js";import{t as re}from"./trash-2-Beln6mAv.js";import{t as ie}from"./triangle-alert-Bq3-_Fkc.js";import{t as ae}from"./upload-C9ppn-9g.js";import{t as oe}from"./wand-sparkles-DmpeiEvn.js";import{D as J,Ha as se,Ra as ce,Ua as Y,Va as X,lo as le,to as ue}from"./index-BKiJMLEa.js";import{a as de,c as fe,d as pe,f as me,i as he,l as ge,m as Z,n as Q,o as _e,p as ve,r as ye,s as be,t as xe,u as Se}from"./vendor-highlight-PMOaWWrP.js";import{t as Ce}from"./VueMarkdown-B43d9bQU.js";import{t as we}from"./index.es-DFYaskof.js";import{t as Te}from"./PageHeader-CrMUGzE3.js";var Ee=X(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),De=X(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]);Z.registerLanguage(`bash`,ve),Z.registerLanguage(`css`,me),Z.registerLanguage(`go`,pe),Z.registerLanguage(`javascript`,Se),Z.registerLanguage(`json`,ge),Z.registerLanguage(`markdown`,fe),Z.registerLanguage(`python`,be),Z.registerLanguage(`rust`,_e),Z.registerLanguage(`shell`,de),Z.registerLanguage(`sql`,he),Z.registerLanguage(`typescript`,ye),Z.registerLanguage(`xml`,Q),Z.registerLanguage(`html`,Q),Z.registerLanguage(`yaml`,xe),Z.registerAliases([`yml`],{languageName:`yaml`}),Z.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),Z.registerAliases([`js`,`jsx`],{languageName:`javascript`}),Z.registerAliases([`py`],{languageName:`python`}),Z.registerAliases([`rs`],{languageName:`rust`}),Z.registerAliases([`sh`,`zsh`],{languageName:`bash`});var $=1e6;function Oe(e,t){let n=(e.split(`.`).pop()||``).toLowerCase();return n===`md`||t.startsWith(`text/markdown`)?`markdown`:n===`html`||n===`htm`||t.startsWith(`text/html`)?`html`:t.startsWith(`image/`)||[`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`].includes(n)?`image`:t.startsWith(`text/`)||[`json`,`application/json`].includes(t.split(`;`)[0])?n?`code`:`text`:`binary`}function ke(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Z.getLanguage(t)?t:`plain`}var Ae=y({name:`SkillFilePreview`,components:{ElButton:ue,ElTooltip:S,ElTabs:b,ElTabPane:x,CodeIcon:z,CopyIcon:B,FileIcon:W,SaveIcon:De,SuccessIcon:j,ViewIcon:H,WarningIcon:ie,VueMarkdown:Ce},directives:{loading:Y},props:{skillId:{type:String,required:!0},path:{type:String,required:!0},editable:{type:Boolean,default:!1}},emits:[`save`],data(){return{MAX_PREVIEW_BYTES:$,loading:!1,error:``,contentType:``,size:0,textContent:``,imageUrl:``,truncated:!1,viewMode:`rendered`,dirty:!1,saving:!1,copied:!1,copiedTimer:void 0}},computed:{kind(){return this.path?Oe(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${ke(this.path)}`},truncatedText(){return this.textContent}},watch:{path:{handler(){this.fetch()},immediate:!0}},beforeUnmount(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl),this.copiedTimer!==void 0&&window.clearTimeout(this.copiedTimer)},methods:{humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},async fetch(){if(this.path){this.copied=!1,this.copiedTimer!==void 0&&(window.clearTimeout(this.copiedTimer),this.copiedTimer=void 0),this.loading=!0,this.error=``,this.textContent=``,this.truncated=!1,this.dirty=!1,this.imageUrl&&=(URL.revokeObjectURL(this.imageUrl),``);try{let{blob:e,contentType:t}=await F.fetchFile(this.skillId,this.path);this.contentType=t,this.size=e.size;let n=Oe(this.path,t);if(n===`image`)this.imageUrl=URL.createObjectURL(e);else if(n!==`binary`){let t=await e.text();t.length>$&&(t=t.slice(0,$),this.truncated=!0),this.textContent=t,this.viewMode=n===`markdown`||n===`html`?`rendered`:`source`}}catch(e){let t=e,n=t?.response?.status,r=t?.response?.data?.detail||String(e);this.error=n?`(${n}) ${r}`:r}finally{this.loading=!1,this.$nextTick(()=>this.applyHighlight())}}},applyHighlight(){let e=this.$refs.codeEl;e&&this.kind===`code`&&this.viewMode!==`rendered`&&(delete e.dataset.highlighted,Z.highlightElement(e))},async onCopy(){if(this.textContent)try{await navigator.clipboard.writeText(this.textContent),this.copied=!0,this.copiedTimer!==void 0&&window.clearTimeout(this.copiedTimer),this.copiedTimer=window.setTimeout(()=>{this.copied=!1,this.copiedTimer=void 0},3e3),C.success(this.$t(`skill.preview.copied`))}catch{C.error(this.$t(`skill.preview.copyFailed`))}},async onSave(){this.saving=!0;try{await new Promise((e,t)=>{this.$emit(`save`,this.textContent,{resolve:e,reject:t})}),this.dirty=!1}catch{}finally{this.saving=!1}}}}),je={class:`preview-root`},Me={class:`toolbar`},Ne={class:`path-display`},Pe={key:0,class:`size-display`},Fe={class:`body`},Ie={key:0,class:`error`},Le=[`srcdoc`],Re={key:3,class:`image-pane`},ze=[`src`,`alt`],Be={key:4,class:`binary`},Ve=[`placeholder`],He={key:6,class:`source-pane`},Ue={key:7,class:`truncated-warning`};function We(t,c,ee,h,g,v){let y=l(`save-icon`),b=l(`el-button`),x=l(`success-icon`),S=l(`copy-icon`),C=l(`el-tooltip`),w=l(`view-icon`),T=l(`el-tab-pane`),E=l(`code-icon`),D=l(`el-tabs`),O=l(`warning-icon`),k=l(`vue-markdown`),A=l(`file-icon`),j=m(`loading`);return d((_(),s(`div`,je,[e(`div`,Me,[e(`span`,Ne,i(t.path||`—`),1),t.size?(_(),s(`span`,Pe,i(t.humanSize(t.size)),1)):o(``,!0),c[3]||=e(`span`,{class:`toolbar-spacer`},null,-1),t.editable?(_(),f(b,{key:1,type:`primary`,size:`small`,disabled:!t.dirty||t.saving,loading:t.saving,onClick:t.onSave},{default:p(()=>[a(y,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`common.button.save`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])):o(``,!0),a(C,{visible:t.copied,content:t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),placement:`top-start`},{default:p(()=>[a(b,{size:`small`,circle:``,disabled:!t.textContent,"aria-label":t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),title:t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),onClick:t.onCopy},{default:p(()=>[t.copied?(_(),f(x,{key:0,size:16,"aria-hidden":`true`,focusable:`false`})):(_(),f(S,{key:1,size:16,"aria-hidden":`true`,focusable:`false`}))]),_:1},8,[`disabled`,`aria-label`,`title`,`onClick`])]),_:1},8,[`visible`,`content`])]),t.canRender?(_(),f(D,{key:0,modelValue:t.viewMode,"onUpdate:modelValue":c[0]||=e=>t.viewMode=e,class:`view-tabs`},{default:p(()=>[a(T,{name:`rendered`},{label:p(()=>[a(w,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewRendered`)),1)]),_:1}),a(T,{name:`source`},{label:p(()=>[a(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewSource`)),1)]),_:1})]),_:1},8,[`modelValue`])):o(``,!0),e(`div`,Fe,[t.error?(_(),s(`div`,Ie,[a(O,{class:`mr-2`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.error),1)])):t.kind===`markdown`&&t.viewMode===`rendered`?(_(),f(k,{key:1,class:`markdown-rendered`,source:t.textContent,sanitize:``},null,8,[`source`])):t.kind===`html`&&t.viewMode===`rendered`?(_(),s(`iframe`,{key:2,ref:`htmlFrame`,class:`html-frame`,sandbox:``,srcdoc:t.textContent},null,8,Le)):t.kind===`image`?(_(),s(`div`,Re,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,ze)])):t.kind===`binary`?(_(),s(`div`,Be,[a(A,{class:`binary-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.binary`,{type:t.contentType})),1)])):t.editable?d((_(),s(`textarea`,{key:5,"onUpdate:modelValue":c[1]||=e=>t.textContent=e,class:`source-editor`,spellcheck:`false`,placeholder:t.$t(`skill.placeholder.content`),onInput:c[2]||=e=>t.dirty=!0},null,40,Ve)),[[u,t.textContent]]):(_(),s(`pre`,He,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(_(),s(`p`,Ue,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):o(``,!0)])])),[[j,t.loading]])}var Ge=J(Ae,[[`render`,We],[`__scopeId`,`data-v-872078d9`]]),Ke=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),qe=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Je(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?O:n===`md`?U:qe.has(n)?K:Ke.has(n)?Ee:W}function Ye(e){let t=new Map;t.set(``,new Map);let n=(e,n)=>{let r=t.get(e);r||(r=new Map,t.set(e,r));let i=e?`${e}/${n}`:n,a=r.get(n);return a||(a={label:n,path:i,isLeaf:!1,children:[]},r.set(n,a),t.set(i,new Map)),a};for(let r of e){let e=r.split(`/`).filter(Boolean);if(e.length===0)continue;let i=e[e.length-1],a=e.slice(0,-1),o=``;for(let e of a)o=n(o,e).path;let s={label:i,path:r,isLeaf:!0},c=t.get(o);c||(c=new Map,t.set(o,c)),c.set(i,s)}let r=e=>{let n=t.get(e);if(!n)return[];let i=Array.from(n.values());for(let e of i)e.isLeaf||(e.children=r(e.path));return i.sort((e,t)=>e.path===`SKILL.md`?-1:t.path===`SKILL.md`?1:e.isLeaf===t.isLeaf?e.label.localeCompare(t.label):e.isLeaf?1:-1)};return r(``)}var Xe=y({name:`FileNode`,components:{ExpandDownIcon:k,ExpandRightIcon:A,FontAwesomeIcon:we},props:{node:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},skill:{type:Object,required:!0},depth:{type:Number,default:1}},emits:[`select-file`],data(){return{open:!0}},computed:{indent(){return 8+this.depth*16},isActive(){return this.node.isLeaf&&this.selectedSkillId===this.skill.id&&this.selectedPath===this.node.path}},methods:{isHtmlFile(e){return e.isLeaf&&e.path.toLowerCase().endsWith(`.html`)},iconFor(e){return e.isLeaf?Je(e.path):G},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),Ze=[`aria-label`,`title`],Qe={key:1,class:`node-chevron-spacer`},$e={class:`node-label`},et={key:0,class:`children`};function tt(r,a,u,d,p,m){let v=l(`expand-down-icon`),y=l(`expand-right-icon`),b=l(`font-awesome-icon`),x=l(`file-node`,!0);return _(),s(`li`,null,[e(`div`,{class:n([`file-node`,{active:r.isActive}]),style:ee({paddingLeft:r.indent+`px`}),onClick:a[1]||=(...e)=>r.onClick&&r.onClick(...e)},[r.node.isLeaf?(_(),s(`span`,Qe)):(_(),s(`button`,{key:0,class:`node-chevron`,"aria-label":r.$t(r.open?`common.button.collapse`:`common.button.expand`),title:r.$t(r.open?`common.button.collapse`:`common.button.expand`),onClick:a[0]||=t(e=>r.open=!r.open,[`stop`])},[r.open?(_(),f(v,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(_(),f(y,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,Ze)),r.isHtmlFile(r.node)?(_(),f(b,{key:2,icon:`fa-brands fa-html5`,class:`node-icon`})):(_(),f(g(r.iconFor(r.node)),{key:3,class:`node-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),e(`span`,$e,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(_(),s(`ul`,et,[(_(!0),s(c,null,h(r.node.children||[],e=>(_(),f(x,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:r.depth+1,onSelectFile:a[2]||=e=>r.$emit(`select-file`,e)},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`depth`]))),128))])):o(``,!0)])}var nt=y({name:`SkillRow`,components:{ExpandDownIcon:k,ExpandRightIcon:A,SkillIcon:q,FileNode:J(Xe,[[`render`,tt],[`__scopeId`,`data-v-5240087b`]])},props:{skill:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:[`toggle-expand`,`select-skill`,`select-file`],computed:{tree(){return Ye(this.skill.asset_bundle_files)},hasChildren(){return this.skill.asset_bundle_files.length>1},isSkillSelected(){return this.selectedSkillId===this.skill.id&&!this.selectedPath}},methods:{onSelectFile(e){this.$emit(`select-file`,this.skill,e)}}}),rt={class:`skill-row-wrapper`},it=[`aria-label`,`title`],at={key:1,class:`row-chevron-spacer`},ot=[`title`],st={key:0,class:`file-list`};function ct(r,u,d,p,m,ee){let g=l(`expand-down-icon`),v=l(`expand-right-icon`),y=l(`skill-icon`),b=l(`file-node`);return _(),s(`li`,rt,[e(`div`,{class:n([`skill-row`,{active:r.isSkillSelected}]),onClick:u[1]||=e=>r.$emit(`select-skill`,r.skill)},[r.hasChildren?(_(),s(`button`,{key:0,class:`row-chevron`,"aria-label":r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),title:r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),onClick:u[0]||=t(e=>r.$emit(`toggle-expand`,r.skill),[`stop`])},[r.expanded?(_(),f(g,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(_(),f(v,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,it)):(_(),s(`span`,at)),a(y,{class:`row-icon`,size:16,"aria-hidden":`true`,focusable:`false`}),e(`span`,{class:`row-label`,title:r.skill.name},i(r.skill.slug),9,ot)],2),r.expanded&&r.hasChildren?(_(),s(`ul`,st,[(_(!0),s(c,null,h(r.tree,e=>(_(),f(b,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:1,onSelectFile:r.onSelectFile},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`onSelectFile`]))),128))])):o(``,!0)])}var lt=y({name:`UserSkills`,components:{MetaTag:ce,ConsolePageHeader:Te,ElInput:le,ElSwitch:D,ElTooltip:S,ElDropdown:E,ElDropdownMenu:T,ElDropdownItem:w,AddIcon:te,AiCreateIcon:oe,DeleteIcon:re,ExpandDownIcon:k,ExpandRightIcon:A,HelpIcon:M,MarketplaceIcon:P,MoreIcon:V,SearchIcon:ne,SkillIcon:q,UploadIcon:ae,WriteIcon:N,SkillMarketplace:L,SkillFilePreview:Ge,SkillRow:J(nt,[[`render`,ct],[`__scopeId`,`data-v-231c2ce1`]]),UploadSkillDialog:I,WriteSkillDialog:R},directives:{loading:Y},data(){return{activeTab:`marketplace`,loading:!1,skills:[],togglingId:null,selectedSkillId:``,selectedPath:``,expandedSkillIds:[],personalOpen:!0,globalsOpen:!0,searchQuery:``,uploadVisible:!1,writeVisible:!1}},computed:{personalSkills(){return this.skills.filter(e=>e.source!==`global`)},globalSkills(){return this.skills.filter(e=>e.source===`global`)},filteredPersonal(){return this.applyFilter(this.personalSkills)},filteredGlobal(){return this.applyFilter(this.globalSkills)},selectedSkill(){return this.skills.find(e=>e.id===this.selectedSkillId)||null}},mounted(){this.fetchSkills()},methods:{applyFilter(e){let t=this.searchQuery.trim().toLowerCase();return t?e.filter(e=>e.slug.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)):e},async fetchSkills(){this.loading=!0;try{let{data:e}=await F.list();if(this.skills=e||[],!this.selectedSkillId&&this.skills.length){let e=this.personalSkills[0]||this.skills[0];this.selectedSkillId=e.id}else this.selectedSkillId&&!this.skills.find(e=>e.id===this.selectedSkillId)&&(this.selectedSkillId=``,this.selectedPath=``)}catch(e){console.error(e),C.error(this.$t(`skill.message.loadFailed`))}finally{this.loading=!1}},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},selectSkill(e){this.selectedSkillId=e.id,this.selectedPath=``},selectFile(e,t){this.selectedSkillId=e.id,this.selectedPath=t},toggleExpand(e){let t=this.expandedSkillIds.indexOf(e.id);t>=0?this.expandedSkillIds.splice(t,1):this.expandedSkillIds.push(e.id)},openUpload(){this.uploadVisible=!0},openWrite(){this.writeVisible=!0},onBrowse(){this.activeTab=`marketplace`},async onCreated(e){await this.fetchSkills();let t=this.skills.find(t=>t.id===e);t&&(this.selectedSkillId=t.id,this.selectedPath=``,this.personalOpen=!0)},async onSaveContent(e,t){if(!this.selectedSkill){t.reject();return}try{let{data:n}=await F.update(this.selectedSkill.id,{content:e});C.success(this.$t(`skill.message.updateSuccess`));let r=this.skills.findIndex(e=>e.id===n.id);r>=0&&this.skills.splice(r,1,n),t.resolve()}catch(e){C.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)})),t.reject(e)}},async onDelete(e){try{await se.confirm(this.$t(`skill.message.deleteConfirm`,{slug:e.slug}),this.$t(`common.button.delete`),{type:`warning`})}catch{return}try{await F.remove(e.id),C.success(this.$t(`skill.message.deleteSuccess`)),this.selectedSkillId===e.id&&(this.selectedSkillId=``,this.selectedPath=``),await this.fetchSkills()}catch(e){C.error(this.extractError(e))}},async onToggleSkill(e,t){this.togglingId=e.id;try{t?(await F.enable(e.id),C.success(this.$t(`skill.message.enableSuccess`))):(await F.disable(e.id),C.success(this.$t(`skill.message.disableSuccess`))),e.enabled=t}catch(e){C.error(this.extractError(e))}finally{this.togglingId=null}}}}),ut={class:`skills-page`},dt=[`aria-label`],ft=[`aria-selected`],pt=[`aria-selected`],mt={class:`marketplace-page-content`},ht={class:`skills-shell`},gt={class:`left-pane`},_t={class:`left-header`},vt=[`aria-label`,`title`],yt={class:`submenu-trigger`},bt={class:`left-body`},xt={class:`section`},St={key:0,class:`skill-list`},Ct={key:0,class:`empty-row`},wt={key:0,class:`section`},Tt={key:0,class:`skill-list`},Et={class:`right-pane`},Dt={class:`right-header`},Ot={class:`right-title`},kt={class:`right-actions`},At=[`aria-label`,`title`],jt={class:`meta-card`},Mt={class:`meta-grid`},Nt={class:`meta-cell`},Pt={class:`meta-label`},Ft={class:`meta-value`},It={class:`meta-cell`},Lt={class:`meta-label`},Rt={class:`meta-value`},zt={key:0,class:`meta-cell`},Bt={class:`meta-label`},Vt={class:`meta-tags`},Ht={key:0,class:`meta-description`},Ut={class:`meta-description-label`},Wt={class:`meta-label`},Gt={class:`preview-card`},Kt={key:2,class:`right-empty`};function qt(t,u,ee,g,y,b){let x=l(`console-page-header`),S=l(`marketplace-icon`),C=l(`skill-icon`),w=l(`skill-marketplace`),T=l(`search-icon`),E=l(`el-input`),D=l(`add-icon`),O=l(`el-dropdown-item`),k=l(`expand-right-icon`),A=l(`ai-create-icon`),j=l(`meta-tag`),M=l(`write-icon`),N=l(`upload-icon`),P=l(`el-dropdown-menu`),F=l(`el-dropdown`),I=l(`expand-down-icon`),L=l(`skill-row`),R=l(`el-switch`),z=l(`more-icon`),B=l(`delete-icon`),V=l(`help-icon`),H=l(`el-tooltip`),U=l(`skill-file-preview`),W=l(`upload-skill-dialog`),G=l(`write-skill-dialog`),K=m(`loading`);return _(),s(`div`,ut,[a(x,{title:t.$t(`skill.title.skills`),subtitle:t.$t(`skill.message.pageDescription`)},null,8,[`title`,`subtitle`]),e(`div`,{class:`skills-tabs`,role:`tablist`,"aria-label":t.$t(`skill.title.skills`)},[e(`button`,{role:`tab`,"aria-selected":t.activeTab===`marketplace`,class:n({active:t.activeTab===`marketplace`}),onClick:u[0]||=e=>t.activeTab=`marketplace`},[a(S,{size:16,"aria-hidden":`true`}),r(i(t.$t(`skill.marketplace.title`)),1)],10,ft),e(`button`,{role:`tab`,"aria-selected":t.activeTab===`mine`,class:n({active:t.activeTab===`mine`}),onClick:u[1]||=e=>t.activeTab=`mine`},[a(C,{size:16,"aria-hidden":`true`}),r(i(t.$t(`skill.marketplace.mySkills`)),1),e(`span`,null,i(t.personalSkills.length),1)],10,pt)],8,dt),d(e(`div`,mt,[a(w,{onInstalled:t.onCreated},null,8,[`onInstalled`])],512),[[v,t.activeTab===`marketplace`]]),d(e(`div`,ht,[e(`aside`,gt,[e(`header`,_t,[a(E,{modelValue:t.searchQuery,"onUpdate:modelValue":u[2]||=e=>t.searchQuery=e,class:`search-input`,size:`default`,clearable:``,placeholder:t.$t(`skill.placeholder.search`)},{prefix:p(()=>[a(T,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`]),a(F,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:p(()=>[a(P,{class:`add-menu`},{default:p(()=>[a(O,{onClick:t.onBrowse},{default:p(()=>[a(S,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),a(O,{divided:``},{default:p(()=>[a(F,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:p(()=>[a(P,{class:`add-menu`},{default:p(()=>[a(O,{disabled:``},{default:p(()=>[a(A,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),a(j,{class:`badge-soon`,density:`compact`},{default:p(()=>[r(i(t.$t(`skill.menu.soon`)),1)]),_:1})]),_:1}),a(O,{onClick:t.openWrite},{default:p(()=>[a(M,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),a(O,{onClick:t.openUpload},{default:p(()=>[a(N,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.upload`)),1)]),_:1},8,[`onClick`])]),_:1})]),default:p(()=>[e(`span`,yt,[a(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),a(k,{class:`submenu-arrow`,size:14,"aria-hidden":`true`,focusable:`false`})])]),_:1})]),_:1})]),_:1})]),default:p(()=>[e(`button`,{type:`button`,class:`add-button`,"aria-label":t.$t(`skill.button.add`),title:t.$t(`skill.button.add`)},[a(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,vt)]),_:1})]),d((_(),s(`div`,bt,[e(`section`,xt,[e(`button`,{class:`section-header`,onClick:u[3]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(_(),f(I,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(_(),f(k,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.personal`)),1)]),t.personalOpen?(_(),s(`ul`,St,[!t.loading&&t.filteredPersonal.length===0?(_(),s(`li`,Ct,i(t.searchQuery?t.$t(`skill.empty.search`):t.$t(`skill.message.noSkills`)),1)):o(``,!0),(_(!0),s(c,null,h(t.filteredPersonal,e=>(_(),f(L,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):o(``,!0)]),t.globalSkills.length>0?(_(),s(`section`,wt,[e(`button`,{class:`section-header`,onClick:u[4]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(_(),f(I,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(_(),f(k,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.platform`)),1)]),t.globalsOpen?(_(),s(`ul`,Tt,[(_(!0),s(c,null,h(t.filteredGlobal,e=>(_(),f(L,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):o(``,!0)])):o(``,!0)])),[[K,t.loading]])]),e(`main`,Et,[t.selectedSkill&&!t.selectedPath?(_(),s(c,{key:0},[e(`header`,Dt,[e(`h3`,Ot,i(t.selectedSkill.slug),1),e(`div`,kt,[a(R,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:u[5]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?o(``,!0):(_(),f(F,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:p(()=>[a(P,null,{default:p(()=>[a(O,{onClick:u[6]||=e=>t.onDelete(t.selectedSkill)},{default:p(()=>[a(B,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`common.button.delete`)),1)]),_:1})]),_:1})]),default:p(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.more`),title:t.$t(`skill.button.more`)},[a(z,{size:16,"aria-hidden":`true`,focusable:`false`})],8,At)]),_:1}))])]),e(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`span`,Pt,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,Ft,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,It,[e(`span`,Lt,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,Rt,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(_(),s(`div`,zt,[e(`span`,Bt,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,Vt,[(_(!0),s(c,null,h(t.selectedSkill.required_connections,e=>(_(),f(j,{key:e,tone:`info`,density:`compact`},{default:p(()=>[r(i(e),1)]),_:2},1024))),128))])])):o(``,!0)]),t.selectedSkill.description?(_(),s(`div`,Ht,[e(`div`,Ut,[e(`span`,Wt,i(t.$t(`skill.field.description`)),1),t.selectedSkill.when_to_use?(_(),f(H,{key:0,content:t.selectedSkill.when_to_use,placement:`top`},{default:p(()=>[a(V,{class:`meta-info-icon`,size:12,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`content`])):o(``,!0)]),e(`p`,null,i(t.selectedSkill.description),1)])):o(``,!0)]),e(`div`,Gt,[(_(),f(U,{key:`${t.selectedSkill.id}:SKILL.md`,"skill-id":t.selectedSkill.id,path:`SKILL.md`,editable:t.selectedSkill.source===`upload`,onSave:t.onSaveContent},null,8,[`skill-id`,`editable`,`onSave`]))])],64)):t.selectedSkill&&t.selectedPath?(_(),f(U,{key:`${t.selectedSkill.id}:${t.selectedPath}`,"skill-id":t.selectedSkill.id,path:t.selectedPath,editable:!1},null,8,[`skill-id`,`path`])):(_(),s(`div`,Kt,[a(C,{class:`right-empty-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.selectSkill`)),1)]))])],512),[[v,t.activeTab===`mine`]]),a(W,{modelValue:t.uploadVisible,"onUpdate:modelValue":u[7]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),a(G,{modelValue:t.writeVisible,"onUpdate:modelValue":u[8]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`])])}var Jt=J(lt,[[`render`,qt],[`__scopeId`,`data-v-ead29004`]]);export{Jt as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,b as u,ht as d,j as f,mt as p,ot as m,qt as ee,rt as h,st as g,tt as _,x as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{n as b,t as x}from"./tabs-BpSLc2Is.js";import{t as S}from"./tooltip-L2G5ntVi.js";import{v as C}from"./vuex.esm-bundler-C-5WV-ta.js";import{n as w,r as T,t as E}from"./dropdown-iF_atr6i.js";import{t as D}from"./switch-CFUCWNgM.js";import{t as O}from"./book-open-BH4GaBn5.js";import{t as k}from"./chevron-down-vUO0pCAt.js";import{t as A}from"./chevron-right-CHPHpC1T.js";import{t as j}from"./circle-check-1eqJK_BD.js";import{t as M}from"./circle-question-mark-iFkJm6Cg.js";import{t as N}from"./clipboard-list-Cvngrayq.js";import{a as P,i as F,n as I,r as L,t as R}from"./WriteSkillDialog-Bw-u8hlH.js";import{t as z}from"./code-Bm4SQ3yq.js";import{t as B}from"./copy-CUk5HyqT.js";import{t as V}from"./ellipsis-BqkKsvF-.js";import{t as H}from"./eye-CFHeQVx8.js";import{t as U}from"./file-text-DBotrbYk.js";import{t as W}from"./file-CR75F95u.js";import{t as G}from"./folder-C9cnY4AN.js";import{t as K}from"./image-DNGAwErV.js";import{t as te}from"./plus-Bz8tjapX.js";import{t as q}from"./scroll-text-BTS-NpZu.js";import{t as ne}from"./search-K-yhv6oC.js";import{t as re}from"./trash-2-CUcSh2xz.js";import{t as ie}from"./triangle-alert-fl0O4ttl.js";import{t as ae}from"./upload-ClpzRFqM.js";import{t as oe}from"./wand-sparkles-C9xUdsPZ.js";import{D as J,Ha as se,Ra as ce,Ua as Y,Va as X,lo as le,to as ue}from"./index-Bk9SKIXV.js";import{a as de,c as fe,d as pe,f as me,i as he,l as ge,m as Z,n as Q,o as _e,p as ve,r as ye,s as be,t as xe,u as Se}from"./vendor-highlight-PMOaWWrP.js";import{t as Ce}from"./VueMarkdown-ktB0s_p4.js";import{t as we}from"./index.es-xc1wwztg.js";import{t as Te}from"./PageHeader-DOWQjC3H.js";var Ee=X(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),De=X(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]);Z.registerLanguage(`bash`,ve),Z.registerLanguage(`css`,me),Z.registerLanguage(`go`,pe),Z.registerLanguage(`javascript`,Se),Z.registerLanguage(`json`,ge),Z.registerLanguage(`markdown`,fe),Z.registerLanguage(`python`,be),Z.registerLanguage(`rust`,_e),Z.registerLanguage(`shell`,de),Z.registerLanguage(`sql`,he),Z.registerLanguage(`typescript`,ye),Z.registerLanguage(`xml`,Q),Z.registerLanguage(`html`,Q),Z.registerLanguage(`yaml`,xe),Z.registerAliases([`yml`],{languageName:`yaml`}),Z.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),Z.registerAliases([`js`,`jsx`],{languageName:`javascript`}),Z.registerAliases([`py`],{languageName:`python`}),Z.registerAliases([`rs`],{languageName:`rust`}),Z.registerAliases([`sh`,`zsh`],{languageName:`bash`});var $=1e6;function Oe(e,t){let n=(e.split(`.`).pop()||``).toLowerCase();return n===`md`||t.startsWith(`text/markdown`)?`markdown`:n===`html`||n===`htm`||t.startsWith(`text/html`)?`html`:t.startsWith(`image/`)||[`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`].includes(n)?`image`:t.startsWith(`text/`)||[`json`,`application/json`].includes(t.split(`;`)[0])?n?`code`:`text`:`binary`}function ke(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Z.getLanguage(t)?t:`plain`}var Ae=y({name:`SkillFilePreview`,components:{ElButton:ue,ElTooltip:S,ElTabs:b,ElTabPane:x,CodeIcon:z,CopyIcon:B,FileIcon:W,SaveIcon:De,SuccessIcon:j,ViewIcon:H,WarningIcon:ie,VueMarkdown:Ce},directives:{loading:Y},props:{skillId:{type:String,required:!0},path:{type:String,required:!0},editable:{type:Boolean,default:!1}},emits:[`save`],data(){return{MAX_PREVIEW_BYTES:$,loading:!1,error:``,contentType:``,size:0,textContent:``,imageUrl:``,truncated:!1,viewMode:`rendered`,dirty:!1,saving:!1,copied:!1,copiedTimer:void 0}},computed:{kind(){return this.path?Oe(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${ke(this.path)}`},truncatedText(){return this.textContent}},watch:{path:{handler(){this.fetch()},immediate:!0}},beforeUnmount(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl),this.copiedTimer!==void 0&&window.clearTimeout(this.copiedTimer)},methods:{humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},async fetch(){if(this.path){this.copied=!1,this.copiedTimer!==void 0&&(window.clearTimeout(this.copiedTimer),this.copiedTimer=void 0),this.loading=!0,this.error=``,this.textContent=``,this.truncated=!1,this.dirty=!1,this.imageUrl&&=(URL.revokeObjectURL(this.imageUrl),``);try{let{blob:e,contentType:t}=await F.fetchFile(this.skillId,this.path);this.contentType=t,this.size=e.size;let n=Oe(this.path,t);if(n===`image`)this.imageUrl=URL.createObjectURL(e);else if(n!==`binary`){let t=await e.text();t.length>$&&(t=t.slice(0,$),this.truncated=!0),this.textContent=t,this.viewMode=n===`markdown`||n===`html`?`rendered`:`source`}}catch(e){let t=e,n=t?.response?.status,r=t?.response?.data?.detail||String(e);this.error=n?`(${n}) ${r}`:r}finally{this.loading=!1,this.$nextTick(()=>this.applyHighlight())}}},applyHighlight(){let e=this.$refs.codeEl;e&&this.kind===`code`&&this.viewMode!==`rendered`&&(delete e.dataset.highlighted,Z.highlightElement(e))},async onCopy(){if(this.textContent)try{await navigator.clipboard.writeText(this.textContent),this.copied=!0,this.copiedTimer!==void 0&&window.clearTimeout(this.copiedTimer),this.copiedTimer=window.setTimeout(()=>{this.copied=!1,this.copiedTimer=void 0},3e3),C.success(this.$t(`skill.preview.copied`))}catch{C.error(this.$t(`skill.preview.copyFailed`))}},async onSave(){this.saving=!0;try{await new Promise((e,t)=>{this.$emit(`save`,this.textContent,{resolve:e,reject:t})}),this.dirty=!1}catch{}finally{this.saving=!1}}}}),je={class:`preview-root`},Me={class:`toolbar`},Ne={class:`path-display`},Pe={key:0,class:`size-display`},Fe={class:`body`},Ie={key:0,class:`error`},Le=[`srcdoc`],Re={key:3,class:`image-pane`},ze=[`src`,`alt`],Be={key:4,class:`binary`},Ve=[`placeholder`],He={key:6,class:`source-pane`},Ue={key:7,class:`truncated-warning`};function We(t,c,ee,h,g,v){let y=l(`save-icon`),b=l(`el-button`),x=l(`success-icon`),S=l(`copy-icon`),C=l(`el-tooltip`),w=l(`view-icon`),T=l(`el-tab-pane`),E=l(`code-icon`),D=l(`el-tabs`),O=l(`warning-icon`),k=l(`vue-markdown`),A=l(`file-icon`),j=m(`loading`);return d((_(),s(`div`,je,[e(`div`,Me,[e(`span`,Ne,i(t.path||`—`),1),t.size?(_(),s(`span`,Pe,i(t.humanSize(t.size)),1)):o(``,!0),c[3]||=e(`span`,{class:`toolbar-spacer`},null,-1),t.editable?(_(),f(b,{key:1,type:`primary`,size:`small`,disabled:!t.dirty||t.saving,loading:t.saving,onClick:t.onSave},{default:p(()=>[a(y,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`common.button.save`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])):o(``,!0),a(C,{visible:t.copied,content:t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),placement:`top-start`},{default:p(()=>[a(b,{size:`small`,circle:``,disabled:!t.textContent,"aria-label":t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),title:t.copied?t.$t(`skill.preview.copied`):t.$t(`skill.preview.copy`),onClick:t.onCopy},{default:p(()=>[t.copied?(_(),f(x,{key:0,size:16,"aria-hidden":`true`,focusable:`false`})):(_(),f(S,{key:1,size:16,"aria-hidden":`true`,focusable:`false`}))]),_:1},8,[`disabled`,`aria-label`,`title`,`onClick`])]),_:1},8,[`visible`,`content`])]),t.canRender?(_(),f(D,{key:0,modelValue:t.viewMode,"onUpdate:modelValue":c[0]||=e=>t.viewMode=e,class:`view-tabs`},{default:p(()=>[a(T,{name:`rendered`},{label:p(()=>[a(w,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewRendered`)),1)]),_:1}),a(T,{name:`source`},{label:p(()=>[a(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewSource`)),1)]),_:1})]),_:1},8,[`modelValue`])):o(``,!0),e(`div`,Fe,[t.error?(_(),s(`div`,Ie,[a(O,{class:`mr-2`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.error),1)])):t.kind===`markdown`&&t.viewMode===`rendered`?(_(),f(k,{key:1,class:`markdown-rendered`,source:t.textContent,sanitize:``},null,8,[`source`])):t.kind===`html`&&t.viewMode===`rendered`?(_(),s(`iframe`,{key:2,ref:`htmlFrame`,class:`html-frame`,sandbox:``,srcdoc:t.textContent},null,8,Le)):t.kind===`image`?(_(),s(`div`,Re,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,ze)])):t.kind===`binary`?(_(),s(`div`,Be,[a(A,{class:`binary-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.binary`,{type:t.contentType})),1)])):t.editable?d((_(),s(`textarea`,{key:5,"onUpdate:modelValue":c[1]||=e=>t.textContent=e,class:`source-editor`,spellcheck:`false`,placeholder:t.$t(`skill.placeholder.content`),onInput:c[2]||=e=>t.dirty=!0},null,40,Ve)),[[u,t.textContent]]):(_(),s(`pre`,He,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(_(),s(`p`,Ue,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):o(``,!0)])])),[[j,t.loading]])}var Ge=J(Ae,[[`render`,We],[`__scopeId`,`data-v-872078d9`]]),Ke=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),qe=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Je(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?O:n===`md`?U:qe.has(n)?K:Ke.has(n)?Ee:W}function Ye(e){let t=new Map;t.set(``,new Map);let n=(e,n)=>{let r=t.get(e);r||(r=new Map,t.set(e,r));let i=e?`${e}/${n}`:n,a=r.get(n);return a||(a={label:n,path:i,isLeaf:!1,children:[]},r.set(n,a),t.set(i,new Map)),a};for(let r of e){let e=r.split(`/`).filter(Boolean);if(e.length===0)continue;let i=e[e.length-1],a=e.slice(0,-1),o=``;for(let e of a)o=n(o,e).path;let s={label:i,path:r,isLeaf:!0},c=t.get(o);c||(c=new Map,t.set(o,c)),c.set(i,s)}let r=e=>{let n=t.get(e);if(!n)return[];let i=Array.from(n.values());for(let e of i)e.isLeaf||(e.children=r(e.path));return i.sort((e,t)=>e.path===`SKILL.md`?-1:t.path===`SKILL.md`?1:e.isLeaf===t.isLeaf?e.label.localeCompare(t.label):e.isLeaf?1:-1)};return r(``)}var Xe=y({name:`FileNode`,components:{ExpandDownIcon:k,ExpandRightIcon:A,FontAwesomeIcon:we},props:{node:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},skill:{type:Object,required:!0},depth:{type:Number,default:1}},emits:[`select-file`],data(){return{open:!0}},computed:{indent(){return 8+this.depth*16},isActive(){return this.node.isLeaf&&this.selectedSkillId===this.skill.id&&this.selectedPath===this.node.path}},methods:{isHtmlFile(e){return e.isLeaf&&e.path.toLowerCase().endsWith(`.html`)},iconFor(e){return e.isLeaf?Je(e.path):G},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),Ze=[`aria-label`,`title`],Qe={key:1,class:`node-chevron-spacer`},$e={class:`node-label`},et={key:0,class:`children`};function tt(r,a,u,d,p,m){let v=l(`expand-down-icon`),y=l(`expand-right-icon`),b=l(`font-awesome-icon`),x=l(`file-node`,!0);return _(),s(`li`,null,[e(`div`,{class:n([`file-node`,{active:r.isActive}]),style:ee({paddingLeft:r.indent+`px`}),onClick:a[1]||=(...e)=>r.onClick&&r.onClick(...e)},[r.node.isLeaf?(_(),s(`span`,Qe)):(_(),s(`button`,{key:0,class:`node-chevron`,"aria-label":r.$t(r.open?`common.button.collapse`:`common.button.expand`),title:r.$t(r.open?`common.button.collapse`:`common.button.expand`),onClick:a[0]||=t(e=>r.open=!r.open,[`stop`])},[r.open?(_(),f(v,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(_(),f(y,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,Ze)),r.isHtmlFile(r.node)?(_(),f(b,{key:2,icon:`fa-brands fa-html5`,class:`node-icon`})):(_(),f(g(r.iconFor(r.node)),{key:3,class:`node-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),e(`span`,$e,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(_(),s(`ul`,et,[(_(!0),s(c,null,h(r.node.children||[],e=>(_(),f(x,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:r.depth+1,onSelectFile:a[2]||=e=>r.$emit(`select-file`,e)},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`depth`]))),128))])):o(``,!0)])}var nt=y({name:`SkillRow`,components:{ExpandDownIcon:k,ExpandRightIcon:A,SkillIcon:q,FileNode:J(Xe,[[`render`,tt],[`__scopeId`,`data-v-5240087b`]])},props:{skill:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:[`toggle-expand`,`select-skill`,`select-file`],computed:{tree(){return Ye(this.skill.asset_bundle_files)},hasChildren(){return this.skill.asset_bundle_files.length>1},isSkillSelected(){return this.selectedSkillId===this.skill.id&&!this.selectedPath}},methods:{onSelectFile(e){this.$emit(`select-file`,this.skill,e)}}}),rt={class:`skill-row-wrapper`},it=[`aria-label`,`title`],at={key:1,class:`row-chevron-spacer`},ot=[`title`],st={key:0,class:`file-list`};function ct(r,u,d,p,m,ee){let g=l(`expand-down-icon`),v=l(`expand-right-icon`),y=l(`skill-icon`),b=l(`file-node`);return _(),s(`li`,rt,[e(`div`,{class:n([`skill-row`,{active:r.isSkillSelected}]),onClick:u[1]||=e=>r.$emit(`select-skill`,r.skill)},[r.hasChildren?(_(),s(`button`,{key:0,class:`row-chevron`,"aria-label":r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),title:r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),onClick:u[0]||=t(e=>r.$emit(`toggle-expand`,r.skill),[`stop`])},[r.expanded?(_(),f(g,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(_(),f(v,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,it)):(_(),s(`span`,at)),a(y,{class:`row-icon`,size:16,"aria-hidden":`true`,focusable:`false`}),e(`span`,{class:`row-label`,title:r.skill.name},i(r.skill.slug),9,ot)],2),r.expanded&&r.hasChildren?(_(),s(`ul`,st,[(_(!0),s(c,null,h(r.tree,e=>(_(),f(b,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:1,onSelectFile:r.onSelectFile},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`onSelectFile`]))),128))])):o(``,!0)])}var lt=y({name:`UserSkills`,components:{MetaTag:ce,ConsolePageHeader:Te,ElInput:le,ElSwitch:D,ElTooltip:S,ElDropdown:E,ElDropdownMenu:T,ElDropdownItem:w,AddIcon:te,AiCreateIcon:oe,DeleteIcon:re,ExpandDownIcon:k,ExpandRightIcon:A,HelpIcon:M,MarketplaceIcon:P,MoreIcon:V,SearchIcon:ne,SkillIcon:q,UploadIcon:ae,WriteIcon:N,SkillMarketplace:L,SkillFilePreview:Ge,SkillRow:J(nt,[[`render`,ct],[`__scopeId`,`data-v-231c2ce1`]]),UploadSkillDialog:I,WriteSkillDialog:R},directives:{loading:Y},data(){return{activeTab:`marketplace`,loading:!1,skills:[],togglingId:null,selectedSkillId:``,selectedPath:``,expandedSkillIds:[],personalOpen:!0,globalsOpen:!0,searchQuery:``,uploadVisible:!1,writeVisible:!1}},computed:{personalSkills(){return this.skills.filter(e=>e.source!==`global`)},globalSkills(){return this.skills.filter(e=>e.source===`global`)},filteredPersonal(){return this.applyFilter(this.personalSkills)},filteredGlobal(){return this.applyFilter(this.globalSkills)},selectedSkill(){return this.skills.find(e=>e.id===this.selectedSkillId)||null}},mounted(){this.fetchSkills()},methods:{applyFilter(e){let t=this.searchQuery.trim().toLowerCase();return t?e.filter(e=>e.slug.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)):e},async fetchSkills(){this.loading=!0;try{let{data:e}=await F.list();if(this.skills=e||[],!this.selectedSkillId&&this.skills.length){let e=this.personalSkills[0]||this.skills[0];this.selectedSkillId=e.id}else this.selectedSkillId&&!this.skills.find(e=>e.id===this.selectedSkillId)&&(this.selectedSkillId=``,this.selectedPath=``)}catch(e){console.error(e),C.error(this.$t(`skill.message.loadFailed`))}finally{this.loading=!1}},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},selectSkill(e){this.selectedSkillId=e.id,this.selectedPath=``},selectFile(e,t){this.selectedSkillId=e.id,this.selectedPath=t},toggleExpand(e){let t=this.expandedSkillIds.indexOf(e.id);t>=0?this.expandedSkillIds.splice(t,1):this.expandedSkillIds.push(e.id)},openUpload(){this.uploadVisible=!0},openWrite(){this.writeVisible=!0},onBrowse(){this.activeTab=`marketplace`},async onCreated(e){await this.fetchSkills();let t=this.skills.find(t=>t.id===e);t&&(this.selectedSkillId=t.id,this.selectedPath=``,this.personalOpen=!0)},async onSaveContent(e,t){if(!this.selectedSkill){t.reject();return}try{let{data:n}=await F.update(this.selectedSkill.id,{content:e});C.success(this.$t(`skill.message.updateSuccess`));let r=this.skills.findIndex(e=>e.id===n.id);r>=0&&this.skills.splice(r,1,n),t.resolve()}catch(e){C.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)})),t.reject(e)}},async onDelete(e){try{await se.confirm(this.$t(`skill.message.deleteConfirm`,{slug:e.slug}),this.$t(`common.button.delete`),{type:`warning`})}catch{return}try{await F.remove(e.id),C.success(this.$t(`skill.message.deleteSuccess`)),this.selectedSkillId===e.id&&(this.selectedSkillId=``,this.selectedPath=``),await this.fetchSkills()}catch(e){C.error(this.extractError(e))}},async onToggleSkill(e,t){this.togglingId=e.id;try{t?(await F.enable(e.id),C.success(this.$t(`skill.message.enableSuccess`))):(await F.disable(e.id),C.success(this.$t(`skill.message.disableSuccess`))),e.enabled=t}catch(e){C.error(this.extractError(e))}finally{this.togglingId=null}}}}),ut={class:`skills-page`},dt=[`aria-label`],ft=[`aria-selected`],pt=[`aria-selected`],mt={class:`marketplace-page-content`},ht={class:`skills-shell`},gt={class:`left-pane`},_t={class:`left-header`},vt=[`aria-label`,`title`],yt={class:`submenu-trigger`},bt={class:`left-body`},xt={class:`section`},St={key:0,class:`skill-list`},Ct={key:0,class:`empty-row`},wt={key:0,class:`section`},Tt={key:0,class:`skill-list`},Et={class:`right-pane`},Dt={class:`right-header`},Ot={class:`right-title`},kt={class:`right-actions`},At=[`aria-label`,`title`],jt={class:`meta-card`},Mt={class:`meta-grid`},Nt={class:`meta-cell`},Pt={class:`meta-label`},Ft={class:`meta-value`},It={class:`meta-cell`},Lt={class:`meta-label`},Rt={class:`meta-value`},zt={key:0,class:`meta-cell`},Bt={class:`meta-label`},Vt={class:`meta-tags`},Ht={key:0,class:`meta-description`},Ut={class:`meta-description-label`},Wt={class:`meta-label`},Gt={class:`preview-card`},Kt={key:2,class:`right-empty`};function qt(t,u,ee,g,y,b){let x=l(`console-page-header`),S=l(`marketplace-icon`),C=l(`skill-icon`),w=l(`skill-marketplace`),T=l(`search-icon`),E=l(`el-input`),D=l(`add-icon`),O=l(`el-dropdown-item`),k=l(`expand-right-icon`),A=l(`ai-create-icon`),j=l(`meta-tag`),M=l(`write-icon`),N=l(`upload-icon`),P=l(`el-dropdown-menu`),F=l(`el-dropdown`),I=l(`expand-down-icon`),L=l(`skill-row`),R=l(`el-switch`),z=l(`more-icon`),B=l(`delete-icon`),V=l(`help-icon`),H=l(`el-tooltip`),U=l(`skill-file-preview`),W=l(`upload-skill-dialog`),G=l(`write-skill-dialog`),K=m(`loading`);return _(),s(`div`,ut,[a(x,{title:t.$t(`skill.title.skills`),subtitle:t.$t(`skill.message.pageDescription`)},null,8,[`title`,`subtitle`]),e(`div`,{class:`skills-tabs`,role:`tablist`,"aria-label":t.$t(`skill.title.skills`)},[e(`button`,{role:`tab`,"aria-selected":t.activeTab===`marketplace`,class:n({active:t.activeTab===`marketplace`}),onClick:u[0]||=e=>t.activeTab=`marketplace`},[a(S,{size:16,"aria-hidden":`true`}),r(i(t.$t(`skill.marketplace.title`)),1)],10,ft),e(`button`,{role:`tab`,"aria-selected":t.activeTab===`mine`,class:n({active:t.activeTab===`mine`}),onClick:u[1]||=e=>t.activeTab=`mine`},[a(C,{size:16,"aria-hidden":`true`}),r(i(t.$t(`skill.marketplace.mySkills`)),1),e(`span`,null,i(t.personalSkills.length),1)],10,pt)],8,dt),d(e(`div`,mt,[a(w,{onInstalled:t.onCreated},null,8,[`onInstalled`])],512),[[v,t.activeTab===`marketplace`]]),d(e(`div`,ht,[e(`aside`,gt,[e(`header`,_t,[a(E,{modelValue:t.searchQuery,"onUpdate:modelValue":u[2]||=e=>t.searchQuery=e,class:`search-input`,size:`default`,clearable:``,placeholder:t.$t(`skill.placeholder.search`)},{prefix:p(()=>[a(T,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`]),a(F,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:p(()=>[a(P,{class:`add-menu`},{default:p(()=>[a(O,{onClick:t.onBrowse},{default:p(()=>[a(S,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),a(O,{divided:``},{default:p(()=>[a(F,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:p(()=>[a(P,{class:`add-menu`},{default:p(()=>[a(O,{disabled:``},{default:p(()=>[a(A,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),a(j,{class:`badge-soon`,density:`compact`},{default:p(()=>[r(i(t.$t(`skill.menu.soon`)),1)]),_:1})]),_:1}),a(O,{onClick:t.openWrite},{default:p(()=>[a(M,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),a(O,{onClick:t.openUpload},{default:p(()=>[a(N,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.upload`)),1)]),_:1},8,[`onClick`])]),_:1})]),default:p(()=>[e(`span`,yt,[a(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),a(k,{class:`submenu-arrow`,size:14,"aria-hidden":`true`,focusable:`false`})])]),_:1})]),_:1})]),_:1})]),default:p(()=>[e(`button`,{type:`button`,class:`add-button`,"aria-label":t.$t(`skill.button.add`),title:t.$t(`skill.button.add`)},[a(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,vt)]),_:1})]),d((_(),s(`div`,bt,[e(`section`,xt,[e(`button`,{class:`section-header`,onClick:u[3]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(_(),f(I,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(_(),f(k,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.personal`)),1)]),t.personalOpen?(_(),s(`ul`,St,[!t.loading&&t.filteredPersonal.length===0?(_(),s(`li`,Ct,i(t.searchQuery?t.$t(`skill.empty.search`):t.$t(`skill.message.noSkills`)),1)):o(``,!0),(_(!0),s(c,null,h(t.filteredPersonal,e=>(_(),f(L,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):o(``,!0)]),t.globalSkills.length>0?(_(),s(`section`,wt,[e(`button`,{class:`section-header`,onClick:u[4]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(_(),f(I,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(_(),f(k,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.platform`)),1)]),t.globalsOpen?(_(),s(`ul`,Tt,[(_(!0),s(c,null,h(t.filteredGlobal,e=>(_(),f(L,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):o(``,!0)])):o(``,!0)])),[[K,t.loading]])]),e(`main`,Et,[t.selectedSkill&&!t.selectedPath?(_(),s(c,{key:0},[e(`header`,Dt,[e(`h3`,Ot,i(t.selectedSkill.slug),1),e(`div`,kt,[a(R,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:u[5]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?o(``,!0):(_(),f(F,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:p(()=>[a(P,null,{default:p(()=>[a(O,{onClick:u[6]||=e=>t.onDelete(t.selectedSkill)},{default:p(()=>[a(B,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`common.button.delete`)),1)]),_:1})]),_:1})]),default:p(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.more`),title:t.$t(`skill.button.more`)},[a(z,{size:16,"aria-hidden":`true`,focusable:`false`})],8,At)]),_:1}))])]),e(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`span`,Pt,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,Ft,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,It,[e(`span`,Lt,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,Rt,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(_(),s(`div`,zt,[e(`span`,Bt,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,Vt,[(_(!0),s(c,null,h(t.selectedSkill.required_connections,e=>(_(),f(j,{key:e,tone:`info`,density:`compact`},{default:p(()=>[r(i(e),1)]),_:2},1024))),128))])])):o(``,!0)]),t.selectedSkill.description?(_(),s(`div`,Ht,[e(`div`,Ut,[e(`span`,Wt,i(t.$t(`skill.field.description`)),1),t.selectedSkill.when_to_use?(_(),f(H,{key:0,content:t.selectedSkill.when_to_use,placement:`top`},{default:p(()=>[a(V,{class:`meta-info-icon`,size:12,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`content`])):o(``,!0)]),e(`p`,null,i(t.selectedSkill.description),1)])):o(``,!0)]),e(`div`,Gt,[(_(),f(U,{key:`${t.selectedSkill.id}:SKILL.md`,"skill-id":t.selectedSkill.id,path:`SKILL.md`,editable:t.selectedSkill.source===`upload`,onSave:t.onSaveContent},null,8,[`skill-id`,`editable`,`onSave`]))])],64)):t.selectedSkill&&t.selectedPath?(_(),f(U,{key:`${t.selectedSkill.id}:${t.selectedPath}`,"skill-id":t.selectedSkill.id,path:t.selectedPath,editable:!1},null,8,[`skill-id`,`path`])):(_(),s(`div`,Kt,[a(C,{class:`right-empty-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.selectSkill`)),1)]))])],512),[[v,t.activeTab===`mine`]]),a(W,{modelValue:t.uploadVisible,"onUpdate:modelValue":u[7]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),a(G,{modelValue:t.writeVisible,"onUpdate:modelValue":u[8]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`])])}var Jt=J(lt,[[`render`,qt],[`__scopeId`,`data-v-ead29004`]]);export{Jt as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-BInIHo7G.js";import{n as x,t as S}from"./tabs-sZ_AqSxe.js";import{t as C}from"./upload-DvqAUM9o.js";import{t as w}from"./tooltip-BynUkwzp.js";import{t as T}from"./alert-BprQRUmf.js";import{_ as E,v as D}from"./vuex.esm-bundler-Dh61cDbO.js";import{n as O,r as k}from"./radio-BNhFzeBO.js";import{t as A}from"./drawer-NlOtUlBy.js";import{t as j}from"./input-number-BAYBeYyC.js";import{t as M}from"./slider-CjK3h6Ns.js";import{t as N}from"./switch-Bs3isJHk.js";import{t as ee}from"./clock-DDlHnp3A.js";import{t as te}from"./hash-Cj1kzh4e.js";import{t as ne}from"./headphones-Dd3X9vkF.js";import{t as re}from"./info-CvT6Qu3B.js";import{t as ie}from"./lightbulb-BcrhXseN.js";import{a as P,i as ae,n as oe,r as se,t as ce}from"./pagination-BPJdobR0.js";import{t as le}from"./trash-2-Beln6mAv.js";import{t as ue}from"./triangle-alert-Bq3-_Fkc.js";import{t as F}from"./upload-C9ppn-9g.js";import{t as I}from"./wand-sparkles-DmpeiEvn.js";import{Ai as de,Fi as L,Ni as fe,Pi as pe}from"./constants-4TRM3yeb.js";import{Ba as me,D as R,Fi as he,Ha as z,Ia as B,Ir as ge,Li as V,Lr as H,Ra as _e,Rr as U,T as ve,Tn as ye,Xi as W,at as G,ct as K,ia as be,it as xe,li as Se,lo as q,lt as J,nt as Ce,oi as we,ot as Y,rt as Te,st as Ee,to as X,tt as De,zi as Oe}from"./index-BKiJMLEa.js";import{t as ke}from"./CopyToClipboard-CPy6HppP.js";import{t as Ae}from"./ReportButton-HJXikYhw.js";import{t as je}from"./FilePreview-XFzuQ-TE.js";import{t as Z}from"./ImagePreview-IlwjPknL.js";import{n as Me}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Ne}from"./ServicePricingSummary-WDKPB3K5.js";import{t as Pe}from"./AudioPreview-06tVQ8qx.js";import{t as Fe}from"./VideoPlayer-Bicexa5t.js";import{t as Ie}from"./VideoPreview-sF3vbUe_.js";import{t as Le}from"./ScenarioPaymentMode-CLmOm0A2.js";import{t as Re}from"./ApiCodeButton-Bl0IKoEK.js";import{t as ze}from"./BotPlaceholder-Di7Uk8RE.js";import{t as Be}from"./taskPollingMixin-CcLxtz8z.js";import{t as Ve}from"./ShowcaseResultTabs-BjqfQ-y8.js";import{t as He}from"./showcaseRecreateMixin-DZhEbJHb.js";import{n as Ue,t as We}from"./generationInput-DnJFevpe.js";var Ge=v({name:`LayoutKling`,components:{MagicIcon:I,ElDrawer:A,ElButton:X},mixins:[Me]}),Ke={class:`main flex flex-row flex-1 min-h-0`},qe={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Je={class:`result h-full p-4 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ye(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,Ke,[e(`div`,qe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Je,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Xe=R(Ge,[[`render`,Ye],[`__scopeId`,`data-v-f4b791b5`]]),Ze={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};function Q(e,t,n){let r=t||`std`,i=n??5;switch(e){case`kling-v3-turbo`:return{...Ze,audio:!0};case`kling-v1`:return{text2video:!0,image2video:!0,endImage:i===5,audio:!1,motionControl:i===5,referenceVideo:!1,referenceImages:!1};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`,referenceVideo:!1,referenceImages:!1};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1,referenceVideo:!0,referenceImages:!0};case`kling-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1,referenceVideo:!0,referenceImages:!0};default:return Ze}}var $=`<<<video_1>>>`,Qe=/<<<image_\d+>>>/g;function $e(e){return e?e.split($).join(` `).replace(/\s{2,}/g,` `).trim():``}function et(e){return e?e.replace(Qe,` `).replace(/\s{2,}/g,` `).trim():``}function tt(e,t){if(!e)return[];let n=t.model??e.model,r=t.mode??e.mode,i=t.duration??e.duration;if(!n)return[];let a=Q(n,r,i),o=[];e.end_image_url&&!a.endImage&&o.push({field:`end_image_url`,i18nLabel:`kling.name.endImage`}),e.generate_audio&&!a.audio&&o.push({field:`generate_audio`,i18nLabel:`kling.name.generateAudio`}),e.camera_control?.type&&(!a.motionControl||e.start_image_url)&&o.push({field:`camera_control`,i18nLabel:`kling.name.cameraControl`}),e.video_list?.length&&!a.referenceVideo&&o.push({field:`video_list`,i18nLabel:`kling.name.referenceVideo`}),e.image_list?.length&&!a.referenceImages&&o.push({field:`image_list`,i18nLabel:`kling.name.referenceImages`});let s=[`kling-o1`,`kling-v3-omni`,`kling-v3-turbo`].includes(n)||!!(e.image_list?.length||e.video_list?.length);return s&&e.cfg_scale!==void 0&&o.push({field:`cfg_scale`,i18nLabel:`kling.name.cfgScale`}),s&&e.negative_prompt&&o.push({field:`negative_prompt`,i18nLabel:`kling.name.negativePrompt`}),o}function nt(e,t){let n={...e};for(let e of t)e.field===`end_image_url`&&(n.end_image_url=void 0),e.field===`generate_audio`&&(n.generate_audio=!1),e.field===`camera_control`&&(n.camera_control=void 0),e.field===`cfg_scale`&&(n.cfg_scale=void 0),e.field===`negative_prompt`&&(n.negative_prompt=void 0),e.field===`video_list`&&(n.video_list=void 0,n.prompt=$e(n.prompt)),e.field===`image_list`&&(n.image_list=void 0,n.prompt=et(n.prompt));return n}var rt=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0,options:[{value:`kling-v3-turbo`,label:`v3-Turbo`},{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-o1`,label:`Kling O1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(de)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=tt(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await z.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=nt({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),D.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,model:e})}}}),it={class:`field`},at={class:`title font-bold`};function ot(t,n,r,a,o,u){let d=l(`el-option`),m=l(`el-select`);return g(),s(`div`,it,[e(`h2`,at,i(t.$t(`pika.name.model`)),1),(g(),f(m,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`pika.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(d,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var st=R(rt,[[`render`,ot],[`__scopeId`,`data-v-d3faca05`]]),ct=v({name:`ModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},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 L.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(`std`)}},mounted(){this.value||this.applyMode(`std`)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=tt(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await z.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=nt({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),D.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,mode:e})}}}),lt={class:`field`},ut={class:`header`},dt={class:`title font-bold`},ft={key:0,class:`opt-tip`};function pt(t,r,u,d,m,_){let v=l(`info-icon`),y=l(`el-option`),b=l(`el-select`);return g(),s(`div`,lt,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`kling.name.mode`)),1),a(v,{content:t.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(g(),f(b,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`kling.placeholder.select`),clearable:!0,onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(y,{key:t.value,label:t.label,value:t.value,disabled:t.disabled},{default:p(()=>[e(`span`,{class:n({"opt-disabled":t.disabled})},i(t.label),3),t.disabled&&t.disabledReason?(g(),s(`span`,ft,i(t.disabledReason),1)):o(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var mt=R(ct,[[`render`,pt],[`__scopeId`,`data-v-9a8fa3c5`]]),ht=Array.from({length:13},(e,t)=>t+3),gt=[5,10],_t=[5],vt=v({name:`DurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return this.selectedModel===`kling-v3-turbo`||L.includes(this.selectedModel)},allowedDurations(){return this.selectedModel===`kling-o1`?_t:this.isV3Model?ht:gt},value(){return this.$store.state.kling?.config?.duration??5},selectValue(){let e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(5)?5:e[0]}},watch:{selectedModel(){this.allowedDurations.includes(this.value)||this.applyDuration(5)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(5)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=tt(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await z.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=nt({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),D.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,duration:e})}}}),yt={class:`field`},bt={class:`control`},xt={class:`label`},St={class:`title font-bold`};function Ct(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,yt,[e(`div`,bt,[e(`div`,xt,[e(`h2`,St,i(t.$t(`kling.name.duration`)),1),a(m,{content:t.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(g(),f(v,{key:t.revertKey,"model-value":t.selectValue,class:`value`,placeholder:t.$t(`kling.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.allowedDurations,e=>(g(),f(_,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var wt=R(vt,[[`render`,Ct],[`__scopeId`,`data-v-9051ec82`]]),Tt=v({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||=`1:1`}}),Et={class:`text-sm font-bold mb-2 block`},Dt={class:`items`},Ot=[`onClick`],kt={class:`name`};function At(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,Et,i(t.$t(`kling.name.ratio`)),1),e(`div`,Dt,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,kt,i(r.label),1)],10,Ot))),128))])])}var jt=R(Tt,[[`render`,At],[`__scopeId`,`data-v-cdb14b2f`]]),Mt=v({name:`StartImage`,components:{UploadIcon:F,ElUpload:C,ElButton:X,ElTooltip:w,InfoIcon:P,ImagePreview:Z},mixins:[J,K,Y],emits:[`change`],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)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},watch:{value(e){!e&&this.fileList.length>0&&(this.fileList=[])}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){D.error(this.$t(`kling.message.uploadReferencesError`))},onBeforeUpload(){let e=this.$store.state.kling?.config||{};if(e.video_list?.[0]?.refer_type===`base`)return D.warning(this.$t(`kling.message.baseVideoFrameConflict`)),!1;let t=e.video_list?.length?4:7;return(e.image_list?.length||0)+Number(!!e.end_image_url)+1>t?(D.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:t})),!1):!0},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.onSetStartImageUrl()}}}),Nt={class:`relative`},Pt={class:`flex min-h-8 items-center pr-20`},Ft={class:`flex justify-start items-center`},It={class:`text-sm font-bold`};function Lt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`el-upload`);return g(),s(`div`,Nt,[e(`div`,Pt,[e(`div`,Ft,[e(`span`,It,i(t.$t(`kling.name.startImage`)),1),a(h,{content:t.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:t.reachedLimit,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(b,{content:t.$t(`kling.message.uploadReferencesExceed`),disabled:!t.reachedLimit,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.reachedLimit},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$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`])])}var Rt=R(Mt,[[`render`,Lt],[`__scopeId`,`data-v-60844ac3`]]),zt=v({name:`EndImage`,components:{UploadIcon:F,ElUpload:C,ElButton:X,ElTooltip:w,ImagePreview:Z,InfoIcon:P},mixins:[J,K,Y],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)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return Q(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||=void 0,this.onSetEndImageUrl()},methods:{onBeforeUpload(){if(!this.endImageSupported)return D.warning(this.$t(`kling.message.endImageNotSupported`)),!1;if(!this.hasStartImage)return D.warning(this.$t(`kling.message.endImageRequiresStart`)),!1;if(this.klingConfig.video_list?.[0]?.refer_type===`base`)return D.warning(this.$t(`kling.message.baseVideoFrameConflict`)),!1;let e=this.klingConfig.video_list?.length?4:7;return(this.klingConfig.image_list?.length||0)+2>e?(D.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:e})),!1):!0},onExceed(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){D.error(this.$t(`kling.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.onSetEndImageUrl()}}}),Bt={class:`relative`},Vt={class:`flex min-h-8 items-center pr-20`},Ht={class:`flex justify-start items-center`},Ut={class:`text-sm font-bold`};function Wt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`el-upload`);return g(),s(`div`,Bt,[e(`div`,Vt,[e(`div`,Ht,[e(`span`,Ut,i(t.$t(`kling.name.endImage`)),1),a(h,{content:t.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:t.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(b,{content:t.uploadTooltip,disabled:!t.uploadDisabled,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.uploadDisabled},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$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`])])}var Gt=R(zt,[[`render`,Wt],[`__scopeId`,`data-v-b286c4d0`]]),Kt=v({name:`ReferenceVideo`,components:{ElUpload:C,ElButton:X,ElRadioButton:O,ElRadioGroup:k,ElSwitch:N,InfoIcon:P,FilePreview:je,UploadIcon:F},mixins:[K,Y],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)},config(){return this.$store.state.kling?.config||{}},hasVideo(){return!!this.urls?.[0]},referenceType:{get(){return this.config.video_list?.[0]?.refer_type||`feature`},set(e){this.updateVideoOptions(e,this.keepOriginalSound)}},keepOriginalSound:{get(){return this.config.video_list?.[0]?.keep_original_sound===`yes`},set(e){this.updateVideoOptions(this.referenceType,e)}}},methods:{onExceed(){D.warning(this.$t(`kling.message.referenceVideoExceed`))},onError(){D.error(this.$t(`kling.message.referenceVideoError`))},beforeUpload(e){if((this.config.image_list?.length||0)+Number(!!this.config.start_image_url)+Number(!!this.config.end_image_url)>4)return D.error(this.$t(`kling.message.referenceVideoImageLimit`)),!1;let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=xe(e.size);return t?n?!0:(D.error(this.$t(`kling.message.referenceVideoSizeExceed`,{max:Te(Ce)})),!1):(D.error(this.$t(`kling.message.referenceVideoTypeFailed`)),!1)},ensurePromptToken(e){let t=this.$store.state.kling?.config,n=t?.prompt||``,r=n.includes($),i;if(e&&!r)i=n?`${n} ${$}`:$;else if(!e&&r)i=$e(n);else return;this.$store.commit(`kling/setConfig`,{...t,prompt:i})},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,video_list:void 0}),this.ensurePromptToken(!1)},onSetVideoList(){let e=this.urls?.[0],t=e?[{video_url:e,refer_type:this.referenceType,keep_original_sound:this.keepOriginalSound?`yes`:`no`}]:void 0;this.$store.commit(`kling/setConfig`,{...this.config,video_list:t,generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0}),this.ensurePromptToken(!!e)},updateVideoOptions(e,t){let n=this.urls?.[0];n&&this.$store.commit(`kling/setConfig`,{...this.config,video_list:[{video_url:n,refer_type:e,keep_original_sound:t?`yes`:`no`}],...e===`base`?{start_image_url:void 0,end_image_url:void 0}:{},generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0})},async onSuccess(){this.onSetVideoList()}}}),qt={class:`relative`},Jt={class:`flex min-h-8 items-center pr-20`},Yt={class:`flex justify-start items-center`},Xt={class:`text-sm font-bold`},Zt={key:0,class:`reference-options mt-3 flex flex-col gap-3`},Qt={class:`flex flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`},$t={class:`text-sm`},en={class:`flex items-center justify-between gap-3`},tn={class:`text-sm`};function nn(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`el-radio-button`),S=l(`el-radio-group`),C=l(`el-switch`);return g(),s(`div`,qt,[e(`div`,Jt,[e(`div`,Yt,[e(`span`,Xt,i(t.$t(`kling.name.referenceVideo`)),1),a(h,{content:t.$t(`kling.description.omniReferenceVideo`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferenceVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`]),t.hasVideo?(g(),s(`div`,Zt,[e(`div`,Qt,[e(`span`,$t,i(t.$t(`kling.name.referenceVideoType`)),1),a(S,{modelValue:t.referenceType,"onUpdate:modelValue":n[1]||=e=>t.referenceType=e,size:`small`},{default:p(()=>[a(x,{value:`feature`},{default:p(()=>[r(i(t.$t(`kling.name.referenceVideoFeature`)),1)]),_:1}),a(x,{value:`base`},{default:p(()=>[r(i(t.$t(`kling.name.referenceVideoBase`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e(`div`,en,[e(`span`,tn,i(t.$t(`kling.name.keepOriginalSound`)),1),a(C,{modelValue:t.keepOriginalSound,"onUpdate:modelValue":n[2]||=e=>t.keepOriginalSound=e},null,8,[`modelValue`])])])):o(``,!0)])}var rn=R(Kt,[[`render`,nn],[`__scopeId`,`data-v-e3a9dfab`]]),an=v({name:`KlingReferenceImages`,components:{ElButton:X,ElUpload:C,UploadIcon:F,ImagePreview:Z,InfoIcon:P},mixins:[J,K,Y],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.config||{}},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},frameCount(){return Number(!!this.config.start_image_url)+Number(!!this.config.end_image_url)},maxImages(){return this.config.video_list?.length?4:7},referenceLimit(){return Math.max(0,this.maxImages-this.frameCount)},remainingSlots(){return Math.max(0,this.referenceLimit-this.urls.length)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(Boolean)},storeImages(){return this.config.image_list}},watch:{frameCount(){this.syncPromptTokens()},storeImages(e){!e?.length&&this.fileList.length>0&&(this.fileList=[])}},methods:{beforeUpload(){return this.remainingSlots===0?(this.onExceed(),!1):!0},onExceed(){D.warning(this.$t(`kling.message.referenceImagesExceed`,{count:this.remainingSlots}))},onError(){D.error(this.$t(`kling.message.referenceImagesError`))},clearOmniConflicts(e){return{...e,generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0}},syncPromptTokens(e){let t=e||this.config,n=[et(t.prompt),...this.urls.map((e,t)=>`<<<image_${this.frameCount+t+1}>>>`)].filter(Boolean).join(` `);n!==t.prompt&&this.$store.commit(`kling/setConfig`,{...t,prompt:n})},syncConfig(){let e=this.urls.length?this.urls.map(e=>({image_url:e})):void 0,t=this.clearOmniConflicts({...this.config,image_list:e});this.$store.commit(`kling/setConfig`,t),this.syncPromptTokens(t)},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.syncConfig()},onRemove(e,t){this.fileList.splice(e,1),t.url?.startsWith(`blob:`)&&URL.revokeObjectURL(t.url),this.syncConfig()}}}),on={class:`relative`},sn={class:`flex justify-between items-center`},cn={class:`flex justify-start items-center`},ln={class:`text-sm font-bold`},un={key:0,class:`file-list flex flex-wrap gap-2 mt-2`};function dn(t,n,u,d,m,_){let v=l(`info-icon`),y=l(`UploadIcon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return g(),s(`div`,on,[e(`div`,sn,[e(`div`,cn,[e(`span`,ln,i(t.$t(`kling.name.referenceImages`)),1),a(v,{content:t.$t(`kling.description.referenceImages`)},null,8,[`content`])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg`,name:`file`,limit:t.referenceLimit,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[a(b,{round:``,type:`primary`,size:`small`,disabled:t.remainingSlots===0},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferenceImages`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`file-list`,`limit`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.fileList.length?(g(),s(`div`,un,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(S,{key:e.uid||e.url||n,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemove(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])):o(``,!0)])}var fn=R(an,[[`render`,dn]]),pn=v({name:`CfgScaleSelector`,components:{ElSlider:M,InfoIcon:P,ElInputNumber:j},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||=0}}),mn={class:`flex justify-between`},hn={class:`flex justify-start items-center`},gn={class:`text-sm font-bold`},_n={class:`flex justify-end items-center`},vn={class:`w-full`};function yn(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return g(),s(`div`,null,[e(`div`,mn,[e(`div`,hn,[e(`span`,gn,i(t.$t(`kling.name.cfgScale`)),1),a(d,{content:t.$t(`kling.description.cfgScale`)},null,8,[`content`])]),e(`div`,_n,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,vn,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var bn=R(pn,[[`render`,yn]]),xn=v({name:`GenerateAudioSelector`,components:{ElSwitch:N,InfoIcon:P},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},fixedAudio(){return this.selectedModel===`kling-v3-turbo`},supported(){return!!(this.fixedAudio||L.includes(this.selectedModel)||this.selectedModel===`kling-v2-6`&&this.selectedMode===`pro`)},tooltipContent(){return this.fixedAudio?this.$t(`kling.description.generateAudioIncluded`):this.supported?this.$t(`kling.description.generateAudio`):this.$t(`kling.description.generateAudioUnsupported`)},value:{get(){return this.fixedAudio?!0:this.supported?this.$store.state.kling?.config?.generate_audio??!1:!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})}}}),Sn={class:`relative`},Cn={class:`flex justify-between items-center`},wn={class:`flex justify-start items-center`},Tn={class:`text-sm font-bold`};function En(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,Sn,[e(`div`,Cn,[e(`div`,wn,[e(`span`,Tn,i(t.$t(`kling.name.generateAudio`)),1),a(d,{content:t.tooltipContent},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,disabled:!t.supported||t.fixedAudio},null,8,[`modelValue`,`disabled`])])])}var Dn=R(xn,[[`render`,En]]),On=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],kn=v({name:`CameraControlSelector`,components:{ElSelect:y,ElOption:b,ElSlider:M,ElInputNumber:j,InfoIcon:P},data(){return{configKeys:On}},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 Q(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){let t=this.$store.state.kling?.config||{};if(!e){let e={...t};delete e.camera_control,this.$store.commit(`kling/setConfig`,e);return}let n=e;this.$store.commit(`kling/setConfig`,{...t,camera_control:{type:n,config:n===`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){let n=this.$store.state.kling?.config||{},r=n.camera_control||{type:`simple`},i={...r.config||{}};t==null?delete i[e]:i[e]=t,this.$store.commit(`kling/setConfig`,{...n,camera_control:{...r,type:`simple`,config:i}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),An={class:`field`},jn={class:`header`},Mn={class:`text-sm font-bold`},Nn={key:0,class:`config-grid`},Pn={class:`cfg-row-head`},Fn={class:`cfg-name`};function In(t,n,r,u,d,m){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`),b=l(`el-input-number`),x=l(`el-slider`);return g(),s(`div`,An,[e(`div`,jn,[e(`span`,Mn,i(t.$t(`kling.name.cameraControl`)),1),a(_,{content:t.tooltipContent},null,8,[`content`])]),a(y,{modelValue:t.selectedTypeRaw,"onUpdate:modelValue":n[0]||=e=>t.selectedTypeRaw=e,class:`value`,placeholder:t.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:t.disabled},{default:p(()=>[(g(!0),s(c,null,h(t.typeOptions,e=>(g(),f(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),t.selectedType===`simple`&&!t.disabled?(g(),s(`div`,Nn,[(g(!0),s(c,null,h(t.configKeys,n=>(g(),s(`div`,{key:n,class:`cfg-row`},[e(`div`,Pn,[e(`span`,Fn,i(t.$t(`kling.name.cc_${n}`)),1),a(b,{modelValue:t.configValues[n],"onUpdate:modelValue":e=>t.configValues[n]=e,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:e=>t.onNumberChange(n,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),a(x,{"model-value":t.configValues[n]??0,min:-1,max:1,step:.1,onInput:e=>t.onSliderChange(n,e)},null,8,[`model-value`,`onInput`])]))),128))])):o(``,!0)])}var Ln=R(kn,[[`render`,In],[`__scopeId`,`data-v-cd896060`]]),Rn=[{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`]}],zn=`, `;function Bn(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${zn}${t}`:t}function Vn(e,t){if(!e||!t)return e||``;let n=[`${t}${zn}`,`${zn}${t}`,t],r=e;for(let e of n)if(r.includes(e)){r=r.replace(e,``);break}return r.replace(/(?:,\s*)+$/,``).replace(/^(?:,\s*)+/,``)}var Hn=v({name:`InspirationPills`,components:{CloseIcon:me},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return Rn.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selected(){let e=this.prompt;if(!e)return[];let t=[];for(let n of this.allChipTexts){let r=e.indexOf(n);r!==-1&&t.push({text:n,idx:r})}return t.sort((e,t)=>e.idx-t.idx).map(e=>e.text)}},methods:{onRemove(e){let t=Vn(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Un={key:0,class:`pills`,role:`list`},Wn={class:`pill-text`},Gn=[`aria-label`,`title`,`onClick`];function Kn(n,r,u,d,f,p){let m=l(`close-icon`);return n.selected.length>0?(g(),s(`div`,Un,[(g(!0),s(c,null,h(n.selected,r=>(g(),s(`div`,{key:r,class:`pill`,role:`listitem`},[e(`span`,Wn,i(r),1),e(`button`,{type:`button`,class:`pill-remove`,"aria-label":n.$t(`kling.inspiration.removeChip`),title:n.$t(`kling.inspiration.removeChip`),onClick:t(e=>n.onRemove(r),[`stop`])},[a(m,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Gn)]))),128))])):o(``,!0)}var qn=v({name:`PromptInput`,components:{IdeaIcon:ie,ElButton:X,PromptTextarea:ae,InspirationPills:R(Hn,[[`render`,Kn],[`__scopeId`,`data-v-6be01bcf`]])},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||=``}});function Jn(e,t,n,o,s,c){let u=l(`idea-icon`),d=l(`el-button`),m=l(`inspiration-pills`),h=l(`prompt-textarea`);return g(),f(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:p(()=>[a(d,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:p(()=>[a(u,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:p(()=>[a(m)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Yn=R(qn,[[`render`,Jn],[`__scopeId`,`data-v-5754ae54`]]),Xn=v({name:`NegativePromptInput`,components:{ElInput:q,InfoIcon:P},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||=``}}),Zn={class:`field`},Qn={class:`box`},$n={class:`title font-bold`};function er(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,Zn,[e(`div`,Qn,[e(`h2`,$n,i(t.$t(`kling.name.negativePrompt`)),1),a(d,{content:t.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var tr=R(Xn,[[`render`,er],[`__scopeId`,`data-v-de98cf01`]]),nr=v({name:`InspirationDrawer`,components:{Close:me,IdeaIcon:ie,ElDrawer:A,ElButton:X},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:Rn}},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(e=>this.$t(`kling.inspiration.chip.${e}`)))},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(Vn(this.prompt,e)):this.setPrompt(Bn(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=Vn(e,t);this.setPrompt(e)}}}),rr={class:`drawer-content`},ir={class:`drawer-header`},ar={class:`title-row`},or={class:`title`},sr={class:`hint`},cr={key:0,class:`selected-bar`},lr={class:`selected-text`},ur={class:`groups`},dr={class:`group-title`},fr={class:`chip-grid`},pr=[`onClick`];function mr(t,u,d,m,_,v){let y=l(`idea-icon`),b=l(`close`),x=l(`el-button`),S=l(`el-drawer`);return g(),f(S,{modelValue:t.visible,"onUpdate:modelValue":u[1]||=e=>t.visible=e,direction:`rtl`,"with-header":!1,size:t.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:p(()=>[e(`div`,rr,[e(`div`,ir,[e(`div`,ar,[a(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`span`,or,i(t.$t(`kling.inspiration.title`)),1)]),a(x,{text:``,class:`close-btn`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:u[0]||=e=>t.visible=!1},{default:p(()=>[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`])]),e(`div`,sr,i(t.$t(`kling.inspiration.hint`)),1),t.selectedCount>0?(g(),s(`div`,cr,[e(`span`,lr,i(t.$t(`kling.inspiration.selectedSummary`,{count:t.selectedCount})),1),a(x,{text:``,size:`small`,class:`clear-btn`,onClick:t.onClearSelected},{default:p(()=>[r(i(t.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):o(``,!0),e(`div`,ur,[(g(!0),s(c,null,h(t.groups,r=>(g(),s(`div`,{key:r.groupKey,class:`group`},[e(`div`,dr,i(t.$t(`kling.inspiration.group.${r.groupKey}`)),1),e(`div`,fr,[(g(!0),s(c,null,h(r.chipKeys,e=>(g(),s(`button`,{key:e,type:`button`,class:n({chip:!0,active:t.isSelected(t.chipText(e))}),onClick:n=>t.onToggle(t.chipText(e))},i(t.chipText(e)),11,pr))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var hr=R(nr,[[`render`,mr],[`__scopeId`,`data-v-8b2e6a5d`]]),gr={"kling-v3":`v3`,"kling-v3-turbo":`v3-Turbo`,"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-o1":`Kling O1`},_r={std:`720p`,pro:`1080p`,"4k":`4K`},vr=v({name:`SummaryChip`,components:{AudioIcon:ne},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return gr[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return _r[e]||e},generateAudio(){return this.config?.model===`kling-v3-turbo`||!!this.config?.generate_audio}}}),yr={class:`summary-chip`},br=[`title`],xr=[`title`],Sr=[`title`],Cr=[`title`],wr=[`title`];function Tr(t,n,r,c,u,d){let f=l(`audio-icon`);return g(),s(`div`,yr,[e(`span`,{class:`part`,title:t.$t(`kling.name.model`)},i(t.modelLabel),9,br),n[0]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.duration`)},i(t.durationLabel),9,xr),n[1]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.ratio`)},i(t.aspectRatio||`16:9`),9,Sr),n[2]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.mode`)},i(t.modeLabel),9,Cr),t.generateAudio?(g(),s(`span`,{key:0,class:`audio`,title:t.$t(`kling.name.generateAudio`)},[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,wr)):o(``,!0)])}var Er=v({name:`ConfigPanel`,components:{MagicIcon:I,ElButton:X,ServicePricingSummary:Ne,PromptInput:Yn,NegativePromptInput:tr,ModelSelector:st,ModeSelector:mt,DurationSelector:wt,RatioSelector:jt,StartImage:Rt,CfgScaleSelector:bn,GenerateAudioSelector:Dn,CameraControlSelector:Ln,InspirationDrawer:hr,SummaryChip:R(vr,[[`render`,Tr],[`__scopeId`,`data-v-f59e4d1f`]]),EndImage:Gt,ReferenceImages:fn,ReferenceVideo:rn,ScenarioPaymentMode:Le},emits:[`generate`],data(){return{inspirationOpen:!1,quoteTimer:0,quoteRunId:0}},computed:{canGenerate(){return We(`kling`,H(this.config))},config(){return this.$store.state.kling?.config},capabilities(){return Q(this.config?.model,this.config?.mode,this.config?.duration)},restrictedControls(){return[`kling-o1`,`kling-v3-omni`,`kling-v3-turbo`].includes(this.config?.model||``)||!!(this.config?.image_list?.length||this.config?.video_list?.length)},consumption(){return ye(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service},walletMode(){return he()&&V(`kling`).mode===`wallet`}},watch:{walletMode:{handler(e){e&&this.scheduleQuote()},immediate:!0},config:{handler(){this.walletMode&&this.scheduleQuote()},deep:!0}},beforeUnmount(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1},methods:{scheduleQuote(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1;let e=V(`kling`);e.quoteUsdc=void 0,e.quoteLoading=!1,this.canGenerate&&(this.quoteTimer=window.setTimeout(this.refreshQuote,350))},async refreshQuote(){if(!this.canGenerate)return;let e=V(`kling`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=await U.quote(H(this.config));t===this.quoteRunId&&e.mode===`wallet`&&this.canGenerate&&(e.quoteUsdc=n.amountUsdc)}catch(e){console.warn(`x402 quote failed`,e)}finally{t===this.quoteRunId&&(e.quoteLoading=!1)}},onGenerate(){this.$emit(`generate`)}}}),Dr={class:`flex flex-col h-full`},Or={class:`flex-1 overflow-y-auto p-5`},kr={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ar(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`model-selector`),v=l(`ratio-selector`),y=l(`reference-images`),b=l(`reference-video`),x=l(`start-image`),S=l(`end-image`),C=l(`duration-selector`),w=l(`mode-selector`),T=l(`generate-audio-selector`),E=l(`camera-control-selector`),D=l(`cfg-scale-selector`),O=l(`negative-prompt-input`),k=l(`summary-chip`),A=l(`scenario-payment-mode`),j=l(`service-pricing-summary`),M=l(`magic-icon`),N=l(`el-button`),ee=l(`inspiration-drawer`);return g(),s(`div`,Dr,[e(`div`,Or,[a(h,{class:`mb-4`,onOpenInspiration:n[0]||=e=>t.inspirationOpen=!0}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),t.capabilities.referenceImages?(g(),f(y,{key:0,class:`mb-3`})):o(``,!0),t.capabilities.referenceVideo?(g(),f(b,{key:1,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),t.config?.model===`kling-v3-turbo`?o(``,!0):(g(),f(S,{key:2,class:`mb-4`})),a(C,{class:`mb-4`}),a(w,{class:`mb-4`}),a(T,{class:`mb-4`}),t.restrictedControls?o(``,!0):(g(),f(E,{key:3,class:`mb-4`})),t.restrictedControls?o(``,!0):(g(),f(D,{key:4,class:`mb-4`})),t.restrictedControls?o(``,!0):(g(),f(O,{key:5,class:`mb-4`}))]),e(`div`,kr,[a(k),a(A,{scenario:`kling`}),t.walletMode?o(``,!0):(g(),f(j,{key:0,value:t.consumption,service:t.service},null,8,[`value`,`service`])),t.config?.video_url!==void 0||t.config?.custom?(g(),f(N,{key:1,type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(M,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.extend`)),1)]),_:1},8,[`disabled`,`onClick`])):(g(),f(N,{key:2,type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(M,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`]))]),a(ee,{modelValue:t.inspirationOpen,"onUpdate:modelValue":n[1]||=e=>t.inspirationOpen=e},null,8,[`modelValue`])])}var jr=R(Er,[[`render`,Ar]]),Mr=v({name:`MotionImage`,components:{UploadIcon:F,ElUpload:C,ElButton:X,InfoIcon:P,ImagePreview:Z},mixins:[J,K,Y,De],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)}},mounted(){this.onSetImageUrl()},methods:{onExceed(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){D.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(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),Nr={class:`relative`},Pr={class:`flex justify-between`},Fr={class:`flex justify-start items-center`},Ir={class:`text-sm font-bold`};function Lr(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,Nr,[e(`div`,Pr,[e(`div`,Fr,[e(`span`,Ir,i(t.$t(`kling.name.motionImage`)),1),a(h,{content:t.$t(`kling.description.motionImage`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Rr=R(Mr,[[`render`,Lr],[`__scopeId`,`data-v-4a95ef2c`]]),zr=v({name:`MotionVideo`,components:{UploadIcon:F,ElUpload:C,ElButton:X,InfoIcon:P,FilePreview:je},mixins:[K,Y],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)}},mounted(){this.onSetVideoUrl()},methods:{onExceed(){D.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){D.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){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<100;return t?n?!0:(D.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(D.error(this.$t(`kling.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),Br={class:`relative`},Vr={class:`flex justify-between`},Hr={class:`flex justify-start items-center`},Ur={class:`text-sm font-bold`};function Wr(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,Br,[e(`div`,Vr,[e(`div`,Hr,[e(`span`,Ur,i(t.$t(`kling.name.motionVideo`)),1),a(h,{content:t.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Gr=R(zr,[[`render`,Wr],[`__scopeId`,`data-v-630c4521`]]),Kr=v({name:`MotionPromptInput`,components:{ElInput:q,InfoIcon:P},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),qr={class:`field`},Jr={class:`box`},Yr={class:`title font-bold`};function Xr(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,qr,[e(`div`,Jr,[e(`h2`,Yr,i(t.$t(`kling.name.motionPrompt`)),1),a(d,{content:t.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Zr=R(Kr,[[`render`,Xr],[`__scopeId`,`data-v-ca9fdbe5`]]),Qr=`video`,$r=v({name:`CharacterOrientationSelector`,components:{ElRadioGroup:k,ElRadioButton:O,InfoIcon:P},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||Qr},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=Qr)}}),ei={class:`field`},ti={class:`header`},ni={class:`text-sm font-bold`};function ri(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`el-radio-button`),h=l(`el-radio-group`);return g(),s(`div`,ei,[e(`div`,ti,[e(`span`,ni,i(t.$t(`kling.name.characterOrientation`)),1),a(f,{content:t.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),a(h,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,size:`small`,class:`value`},{default:p(()=>[a(m,{label:`image`},{default:p(()=>[r(i(t.$t(`kling.name.orientationImage`)),1)]),_:1}),a(m,{label:`video`},{default:p(()=>[r(i(t.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var ii=R($r,[[`render`,ri],[`__scopeId`,`data-v-7a91195b`]]),ai=`kling-v2-6`,oi=v({name:`MotionModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},computed:{options(){return[{value:`kling-v2-6`,label:`Kling 2.6`},{value:`kling-v3`,label:`Kling 3.0`}]},value:{get(){return this.$store.state.kling?.motionConfig?.model_name||ai},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,model_name:e})}}},mounted(){this.$store.state.kling?.motionConfig?.model_name||(this.value=ai)}}),si={class:`field`},ci={class:`header`},li={class:`title font-bold`};function ui(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,si,[e(`div`,ci,[e(`h2`,li,i(t.$t(`kling.name.motionModel`)),1),a(m,{content:t.$t(`kling.description.motionModel`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var di=R(oi,[[`render`,ui],[`__scopeId`,`data-v-480e8da2`]]),fi=`std`,pi=v({name:`MotionModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},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||fi},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=fi)}}),mi={class:`field`},hi={class:`header`},gi={class:`title font-bold`};function _i(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,mi,[e(`div`,hi,[e(`h2`,gi,i(t.$t(`kling.name.mode`)),1),a(m,{content:t.$t(`kling.description.motionMode`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var vi=R(pi,[[`render`,_i],[`__scopeId`,`data-v-1295688c`]]),yi=v({name:`KeepOriginalSoundSelector`,components:{ElSwitch:N,InfoIcon:P},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`})}}}}),bi={class:`relative`},xi={class:`flex justify-between items-center`},Si={class:`flex justify-start items-center`},Ci={class:`text-sm font-bold`};function wi(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,bi,[e(`div`,xi,[e(`div`,Si,[e(`span`,Ci,i(t.$t(`kling.name.keepOriginalSound`)),1),a(d,{content:t.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e},null,8,[`modelValue`])])])}var Ti=v({name:`MotionPanel`,components:{MagicIcon:I,ElButton:X,ServicePricingSummary:Ne,MotionImage:Rr,MotionVideo:Gr,MotionPromptInput:Zr,CharacterOrientationSelector:ii,MotionModelSelector:di,MotionModeSelector:vi,KeepOriginalSoundSelector:R(yi,[[`render`,wi]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return ye({...this.motionConfig,duration:1},this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ei={class:`flex flex-col h-full`},Di={class:`flex-1 overflow-y-auto p-5`},Oi={class:`flex flex-col items-center justify-center px-5 pb-5`};function ki(t,n,o,c,u,d){let f=l(`motion-image`),m=l(`motion-video`),h=l(`motion-prompt-input`),_=l(`character-orientation-selector`),v=l(`motion-model-selector`),y=l(`motion-mode-selector`),b=l(`keep-original-sound-selector`),x=l(`service-pricing-summary`),S=l(`magic-icon`),C=l(`el-button`);return g(),s(`div`,Ei,[e(`div`,Di,[a(f,{class:`mb-3`}),a(m,{class:`mb-3`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`})]),e(`div`,Oi,[a(x,{value:t.consumption,service:t.service,"rate-unit":t.$t(`kling.name.perSecond`),note:t.$t(`kling.message.motionPricingNote`)},null,8,[`value`,`service`,`rate-unit`,`note`]),a(C,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(S,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Ai=R(Ti,[[`render`,ki]]),ji=v({name:`KlingTabSwitcher`,components:{MetaTag:_e,ElTabs:x,ElTabPane:S},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`)},{value:`talking-photo`,label:this.$t(`kling.tab.talkingPhoto`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),Mi=[`title`],Ni={class:`text`};function Pi(t,n,a,u,d,m){let _=l(`meta-tag`),v=l(`el-tab-pane`),y=l(`el-tabs`);return g(),f(y,{"model-value":t.modelValue,class:`kling-tabs scenario-tabs scenario-tabs--divided`,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.tabs,t=>(g(),f(v,{key:t.value,name:t.value,disabled:t.disabled},{label:p(()=>[e(`span`,{class:`tab-label`,title:t.disabled?t.disabledReason:void 0},[e(`span`,Ni,i(t.label),1),t.badge?(g(),f(_,{key:0,tone:`warning`,class:`badge`,density:`compact`},{default:p(()=>[r(i(t.badge),1)]),_:2},1024)):o(``,!0)],8,Mi)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Fi=R(ji,[[`render`,Pi],[`__scopeId`,`data-v-24ca66ec`]]),Ii={"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`},Li=v({name:`TalkingPhotoModelSelector`,components:{ElSelect:y,ElOption:b},data(){return{options:pe.map(e=>({value:e,label:Ii[e]||e}))}},computed:{value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.model||`kling-v2-1-master`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,model:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.model||(this.value=fe)}}),Ri={class:`field`},zi={class:`title font-bold`};function Bi(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Ri,[e(`h2`,zi,i(t.$t(`kling.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Vi=R(Li,[[`render`,Bi],[`__scopeId`,`data-v-cbc83d11`]]),Hi=v({name:`TalkingPhotoModeSelector`,components:{ElSelect:y,ElOption:b},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?.talkingPhotoConfig?.mode||`pro`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,mode:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.mode||(this.value=`pro`)}}),Ui={class:`field`},Wi={class:`title font-bold`};function Gi(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Ui,[e(`h2`,Wi,i(t.$t(`kling.name.mode`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ki=v({name:`TalkingPhotoPanel`,components:{MagicIcon:I,UploadIcon:F,ElUpload:C,ElButton:X,ElInput:q,ServicePricingSummary:Ne,InfoIcon:P,ImagePreview:Z,ModelSelector:Vi,ModeSelector:R(Hi,[[`render`,Gi],[`__scopeId`,`data-v-92525a1d`]]),ScenarioPaymentMode:Le},mixins:[Y,De],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:B()+`/api/v1/files/`,quoteTimer:0,quoteRunId:0}},computed:{config(){return this.$store.state.kling?.talkingPhotoConfig||{}},audioUrl(){return this.config.audio_url},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},service(){return this.$store.state.kling?.service},consumption(){return ye({...this.config,action:`talking-photo`},this.service?.cost)},canGenerate(){return!!(this.config.image_url&&this.config.audio_url)},walletMode(){return he()&&V(`kling`).mode===`wallet`}},watch:{walletMode:{handler(e){e&&this.scheduleQuote()},immediate:!0},config:{handler(){this.walletMode&&this.scheduleQuote()},deep:!0}},beforeUnmount(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1},methods:{scheduleQuote(){window.clearTimeout(this.quoteTimer),this.quoteTimer=window.setTimeout(this.refreshQuote,350)},async refreshQuote(){let e=V(`kling`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=await U.quoteTalkingPhoto(ge(this.config));t===this.quoteRunId&&e.mode===`wallet`&&(e.quoteUsdc=n.amountUsdc)}catch(e){console.warn(`x402 quote failed`,e)}finally{t===this.quoteRunId&&(e.quoteLoading=!1)}},commit(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.config,...e})},onPromptChange(e){this.commit({prompt:e})},onImageExceed(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){D.error(this.$t(`kling.message.uploadReferencesError`))},onImageSuccess(e){this.commit({image_url:e?.file_url})},onImageRemove(e){this.imageFiles.splice(this.imageFiles.indexOf(e),1),this.commit({image_url:void 0})},onAudioExceed(){D.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){D.error(this.$t(`kling.message.uploadAudioError`))},onAudioSuccess(e){this.commit({audio_url:e?.file_url})},onAudioRemove(){this.commit({audio_url:void 0})},onGenerate(){this.$emit(`generate`)}}}),qi={class:`flex flex-col h-full`},Ji={class:`flex-1 overflow-y-auto p-5`},Yi={class:`relative mb-4`},Xi={class:`flex justify-start items-center`},Zi={class:`text-sm font-bold`},Qi={class:`relative mb-4`},$i={class:`flex justify-start items-center`},ea={class:`text-sm font-bold`},ta=[`src`],na={class:`mb-4`},ra={class:`flex justify-start items-center`},ia={class:`text-sm font-bold`},aa={class:`flex flex-col items-center justify-center px-5 pb-5`};function oa(t,n,c,u,d,m){let h=l(`model-selector`),_=l(`mode-selector`),v=l(`info-icon`),y=l(`image-preview`),b=l(`upload-icon`),x=l(`el-button`),S=l(`el-upload`),C=l(`el-input`),w=l(`scenario-payment-mode`),T=l(`service-pricing-summary`),E=l(`magic-icon`);return g(),s(`div`,qi,[e(`div`,Ji,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),e(`div`,Yi,[e(`div`,Xi,[e(`span`,Zi,i(t.$t(`kling.name.talkingPhotoImage`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoImage`)},null,8,[`content`])]),a(S,{ref:`imageUploader`,"file-list":t.imageFiles,"onUpdate:fileList":n[0]||=e=>t.imageFiles=e,name:`file`,accept:`.png,.jpg,.jpeg,.webp,.bmp`,limit:1,class:`upload-wrapper`,multiple:!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"list-type":`picture`,headers:t.headers,"on-exceed":t.onImageExceed,"on-error":t.onImageError,"on-success":t.onImageSuccess},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(y,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onImageRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(b,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),e(`div`,Qi,[e(`div`,$i,[e(`span`,ea,i(t.$t(`kling.name.talkingPhotoAudio`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoAudio`)},null,8,[`content`])]),a(S,{ref:`audioUploader`,"file-list":t.audioFiles,"onUpdate:fileList":n[1]||=e=>t.audioFiles=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac`,limit:1,class:`upload-wrapper`,multiple:!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,headers:t.headers,"on-exceed":t.onAudioExceed,"on-error":t.onAudioError,"on-success":t.onAudioSuccess,"on-remove":t.onAudioRemove},{default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn`},{default:p(()=>[a(b,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadAudio`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`]),t.audioUrl?(g(),s(`audio`,{key:0,src:t.audioUrl,controls:``,class:`w-full mt-2`},null,8,ta)):o(``,!0)]),e(`div`,na,[e(`div`,ra,[e(`span`,ia,i(t.$t(`kling.name.talkingPhotoPrompt`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoPrompt`)},null,8,[`content`])]),a(C,{"model-value":t.config.prompt,type:`textarea`,rows:2,placeholder:t.$t(`kling.placeholder.talkingPhotoPrompt`),class:`mt-1`,"onUpdate:modelValue":t.onPromptChange},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])])]),e(`div`,aa,[a(w,{scenario:`kling`}),t.walletMode?o(``,!0):(g(),f(T,{key:0,value:t.consumption,service:t.service},null,8,[`value`,`service`])),a(x,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(E,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generateTalkingPhoto`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var sa=R(Ki,[[`render`,oa],[`__scopeId`,`data-v-46191f92`]]),ca=v({name:`TaskPreview`,components:{DeleteIcon:le,ChannelIcon:te,InfoIcon:re,MagicIcon:I,TimeIcon:ee,WarningIcon:ue,CopyToClipboard:ke,ElAlert:T,VideoPlayer:Fe,ElTooltip:w,ElButton:X,ImagePreview:Z,VideoPreview:Ie,AudioPreview:Pe,ApiCodeButton:Re,ReportButton:Ae},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{isFailure(){let e=this.modelValue?.response;return e?.success===!1||!!e?.error||e?.state===`failed`||e?.state===`cancelled`},isWaiting(){let e=this.modelValue?.response;return!e||!this.isFailure&&e.success!==!0&&!e.video_url},application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},displayText(){return this.modelValue?.request?.prompt?.trim()||this.modelValue?.request?.text?.trim()||``},referenceImages(){let e=[],t=this.modelValue?.request?.start_image_url,n=this.modelValue?.request?.end_image_url,r=this.modelValue?.request?.image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),r&&e.push({url:r,name:`reference-image`}),e},referenceVideos(){let e=[],t=this.modelValue?.request?.video_url;t&&e.push({url:t,name:`reference-video`});let n=this.modelValue?.request?.video_list;return(Array.isArray(n)?n:[]).forEach((t,n)=>{t?.video_url&&e.push({url:t.video_url,name:`reference-video-${n+1}`})}),e},referenceAudios(){let e=this.modelValue?.request?.audio_url;return e?[{url:e,name:`reference-audio`}]:[]}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await z.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`kling/deleteTask`,{id:e}),D.success(this.$t(`common.message.deleteTaskSuccess`))}catch{D.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),la={class:`preview`},ua={class:`left`},da={class:`main`},fa={class:`bot`},pa={class:`datetime`},ma=[`aria-label`],ha={key:0,class:`info`},ga={key:0,class:`request-media flex justify-start items-center gap-2 w-full overflow-x-auto`},_a={key:1,class:`prompt`},va={key:0},ya={key:1},ba={key:1,class:n({content:!0,failed:!0})},xa={key:0,class:`mb-4`},Sa={key:1,class:n({operations:!0,"mt-2":!0})},Ca={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},wa={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ta={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ea={key:2,class:n({content:!0})},Da={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Oa={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ka={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Aa={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ja={key:3,class:n({content:!0})},Ma={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Na={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Pa(n,u,d,m,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`video-preview`),w=l(`audio-preview`),T=l(`video-player`),E=l(`el-button`),D=l(`api-code-button`),O=l(`report-button`),k=l(`channel-icon`),A=l(`magic-icon`),j=l(`copy-to-clipboard`),M=l(`time-icon`),N=l(`el-alert`),ee=l(`warning-icon`),te=l(`info-icon`);return g(),s(`div`,la,[e(`div`,ua,[a(y,{capability:`kling`,part:`avatar`,class:`avatar`})]),e(`div`,da,[e(`div`,fa,[a(y,{capability:`kling`,part:`name`}),e(`span`,pa,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(g(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ma)):o(``,!0)]),_:1},8,[`content`])]),n.referenceImages.length>0||n.referenceVideos.length>0||n.referenceAudios.length>0||n.displayText?(g(),s(`div`,ha,[n.referenceImages.length>0||n.referenceVideos.length>0||n.referenceAudios.length>0?(g(),s(`div`,ga,[(g(!0),s(c,null,h(n.referenceImages,(e,t)=>(g(),f(S,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceVideos,(e,t)=>(g(),f(C,{key:`video-${t}`,url:e.url,name:e.name},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceAudios,(e,t)=>(g(),f(w,{key:`audio-${t}`,url:e.url,name:e.name},null,8,[`url`,`name`]))),128))])):o(``,!0),n.displayText?(g(),s(`p`,_a,[r(i(n.displayText)+` `,1),n.modelValue?.response?n.isWaiting?(g(),s(`span`,ya,` - (`+i(n.$t(`kling.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,va,` - (`+i(n.$t(`kling.status.pending`))+`) `,1))])):o(``,!0)])):o(``,!0),n.modelValue?.response?.success===!0&&!n.isFailure?(g(),s(`div`,ba,[n.modelValue?.response.video_url?(g(),s(`div`,xa,[a(T,{src:n.modelValue?.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response.success?(g(),s(`div`,Sa,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:p(()=>[n.modelValue?.response.video_url?(g(),f(E,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=e=>n.onDownload(e,n.modelValue?.response.video_url)},{default:p(()=>[r(i(n.$t(`kling.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(D,{path:`/kling/videos`,body:n.modelValue?.request},null,8,[`body`]),a(O,{service:`kling`,"target-id":n.modelValue?.id,snapshot:{prompt:n.displayText}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(N,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,Ca,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.model`))+`: `+i(n.modelValue?.request?.model),1)]),e(`p`,wa,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,Ta,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(g(),s(`div`,Ea,[a(N,{closable:!1,class:`failure`},{template:p(()=>[a(ee,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.failure`)),1)]),default:p(()=>[e(`p`,Da,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Oa,[a(te,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(j,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,ka,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Aa,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(j,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),n.isWaiting?(g(),s(`div`,ja,[a(N,{closable:!1,class:`info`},{template:p(()=>[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`kling.status.processing`:`kling.status.pending`)),1)]),default:p(()=>[e(`p`,Ma,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,Na,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(j,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var Fa=v({name:`RecentPanel`,components:{TaskPreview:R(ca,[[`render`,Pa],[`__scopeId`,`data-v-73637147`]]),NoTasks:se,BotPlaceholder:ze,ScrollList:oe},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?.()}}}),Ia={key:0},La={key:2,class:`w-full h-full flex items-center justify-center`};function Ra(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,Ia,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,La,[a(v)])):o(``,!0)],64)}var za=v({name:`KlingIndex`,components:{ConfigPanel:jr,MotionPanel:Ai,TalkingPhotoPanel:sa,TabSwitcher:Fi,Layout:Xe,RecentPanel:R(Fa,[[`render`,Ra]]),ShowcaseResultTabs:Ve},mixins:[Ee,He(`kling`),Be(`kling`)],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1,walletTaskIds:[]}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===E.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===E.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},talkingPhotoConfig(){return this.$store.state.kling.talkingPhotoConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.tasks},walletMode(){return this.taskType!==`motion`&&he()&&V(`kling`).mode===`wallet`}},watch:{taskType:{handler(e){Oe(`kling`,e!==`motion`)},immediate:!0},walletMode:{async handler(e,t){if(!(t===void 0||e===t)){if(this.$store.commit(`kling/setTasks`,void 0),e&&!this.job&&(this.job=window.setInterval(this.onPollTasks,5e3)),!e&&!this.credential?.token){window.clearInterval(this.job),this.job=0,await this.onScrollDown();return}await this.onGetTasks(),await this.onScrollDown()}}},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.onPollTasks,5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ce({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();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`kling/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r,...this.walletMode&&!this.credential?.token?{mode:`x402`,ids:this.walletTaskIds}:{}})}finally{this.fetchingTasks=!1}},async onGenerate(){let e=H(this.config),t=Ue(`kling`,e);if(t){D.error(this.$t(`common.message.${t}`));return}if(!G(this.uploadTracker,e=>this.$t(e),e=>D.warning(e)))return;let n=Number(!!e.start_image_url)+Number(!!e.end_image_url),r=e.image_list?.length||0,i=e.video_list?.length?4:7;if(n+r>i){D.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:i}));return}if(e.video_list?.[0]?.refer_type===`base`&&(e.start_image_url||e.end_image_url||e.image_list?.some(({type:e})=>e))){D.warning(this.$t(`kling.message.baseVideoFrameConflict`));return}if(!e.video_id&&!e.video_url&&!e.start_image_url&&e.end_image_url){D.warning(this.$t(`kling.message.endImageRequiresStart`));return}let a=this.createPaymentOperation(t=>U.generate(e,t));a&&(D.info(this.$t(`kling.message.startingTask`)),W(`kling`,a).then(e=>{this.recordWalletTask(e),D.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>this.handleGenerationError(e)).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)}))},createPaymentOperation(e){if(!this.walletMode){if(!be())return;let t=this.credential?.token;return t?e({token:t}):void 0}let t=this.getWalletContext();if(!t){D.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}return e({mode:`x402`,x402:{wallet:t,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credential?.token}})},recordWalletTask(e){let t=e?.data?.task_id;this.walletMode&&!this.credential?.token&&t&&!this.walletTaskIds.includes(t)&&this.walletTaskIds.unshift(t)},handleGenerationError(e){e instanceof we||ve(e,`kling`)||(this.walletMode?D.error(this.$t(`common.x402Scenario.paymentFailed`)):D.error(this.$t(`kling.message.startTaskFailed`)))},getWalletContext(){return Se(this.$wallet)},async confirmWalletPayment(e){return z.confirm(this.$t(`common.x402Scenario.confirmPayment`,{amount:e.amountUsdc}),this.$t(`order.message.x402ConfirmTitle`),{confirmButtonText:this.$t(`order.message.x402WalletPayCta`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`}).then(()=>!0).catch(()=>!1)},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(!G(this.uploadTracker,e=>this.$t(e),e=>D.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){D.warning(this.$t(`kling.message.motionMissingInputs`));return}let 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.model_name?{model_name:e.model_name}:{},...e.prompt?{prompt:e.prompt}:{},async:!0};if(!be())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}D.info(this.$t(`kling.message.startingTask`)),W(`kling`,U.motion(t,{token:n})).then(()=>{D.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{ve(e,`kling`)||D.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!G(this.uploadTracker,e=>this.$t(e),e=>D.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){D.warning(this.$t(`kling.message.talkingPhotoMissingInputs`));return}let t=ge(e),n=this.createPaymentOperation(e=>U.talkingPhoto(t,e));n&&(D.info(this.$t(`kling.message.startingTask`)),W(`kling`,n).then(e=>{this.recordWalletTask(e),D.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>this.handleGenerationError(e)).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)}))}}}),Ba={class:`flex flex-col h-full`},Va={class:`flex-1 min-h-0`};function Ha(t,n,r,i,s,c){let u=l(`tab-switcher`),d=l(`config-panel`),m=l(`motion-panel`),h=l(`talking-photo-panel`),_=l(`recent-panel`),v=l(`showcase-result-tabs`),y=l(`layout`);return g(),f(y,null,{config:p(()=>[e(`div`,Ba,[a(u,{"model-value":t.taskType,"onUpdate:modelValue":t.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),e(`div`,Va,[t.taskType===`videos`?(g(),f(d,{key:0,onGenerate:t.onGenerate},null,8,[`onGenerate`])):t.taskType===`motion`?(g(),f(m,{key:1,onGenerate:t.onGenerateMotion},null,8,[`onGenerate`])):t.taskType===`talking-photo`?(g(),f(h,{key:2,onGenerate:t.onGenerateTalkingPhoto},null,8,[`onGenerate`])):o(``,!0)])])]),result:p(()=>[a(v,{service:`kling`},{tasks:p(()=>[a(_,{ref:`recentPanel`,loading:t.loadingMore,onReachTop:t.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})]),_:1})}var Ua=R(za,[[`render`,Ha]]);export{Ua as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,qt as m,rt as h,tt as g,x as _,z as v}from"./vendor-chart-Dw-P17PN.js";import{r as y,t as b}from"./select-Dv7ZrvnE.js";import{n as x,t as S}from"./tabs-BpSLc2Is.js";import{t as C}from"./upload-BG3x_JWJ.js";import{t as w}from"./tooltip-L2G5ntVi.js";import{t as T}from"./alert-BprQRUmf.js";import{_ as E,v as D}from"./vuex.esm-bundler-C-5WV-ta.js";import{n as O,r as k}from"./radio-BNhFzeBO.js";import{t as A}from"./drawer-VaJhlwVr.js";import{t as j}from"./input-number-BwJ2QIsY.js";import{t as M}from"./slider-C4ifUfAq.js";import{t as N}from"./switch-CFUCWNgM.js";import{t as ee}from"./clock-DIjv9Rh6.js";import{t as te}from"./hash-B61j4cgz.js";import{t as ne}from"./headphones-SI1F4r-k.js";import{t as re}from"./info-CDi6ZfZf.js";import{t as ie}from"./lightbulb-ByXvOBwJ.js";import{a as P,i as ae,n as oe,r as se,t as ce}from"./pagination-BodQ3KsQ.js";import{t as le}from"./trash-2-CUcSh2xz.js";import{t as ue}from"./triangle-alert-fl0O4ttl.js";import{t as F}from"./upload-ClpzRFqM.js";import{t as I}from"./wand-sparkles-C9xUdsPZ.js";import{Ai as de,Fi as L,Ni as fe,Pi as pe}from"./constants-CspFM8fh.js";import{Ba as me,D as R,Fi as he,Ha as z,Ia as B,Ir as ge,Li as V,Lr as H,Ra as _e,Rr as U,T as ve,Tn as ye,Xi as W,at as G,ct as K,ia as be,it as xe,li as Se,lo as q,lt as J,nt as Ce,oi as we,ot as Y,rt as Te,st as Ee,to as X,tt as De,zi as Oe}from"./index-Bk9SKIXV.js";import{t as ke}from"./CopyToClipboard-CIB9LY9Y.js";import{t as Ae}from"./ReportButton-D3eba7A1.js";import{t as je}from"./FilePreview-_7yUZ2m8.js";import{t as Z}from"./ImagePreview-Dq6UkYX8.js";import{n as Me}from"./taskDrawerMixin-DyAUhFEq.js";import{t as Ne}from"./ServicePricingSummary-N2X5DfKj.js";import{t as Pe}from"./AudioPreview-fEc2Zd45.js";import{t as Fe}from"./VideoPlayer-BNtDhrpR.js";import{t as Ie}from"./VideoPreview-K60Fueap.js";import{t as Le}from"./ScenarioPaymentMode-BwoqFZco.js";import{t as Re}from"./ApiCodeButton-C5tBSXac.js";import{t as ze}from"./BotPlaceholder-7Rci0gLD.js";import{t as Be}from"./taskPollingMixin-CcLxtz8z.js";import{t as Ve}from"./ShowcaseResultTabs-Bx16-8QM.js";import{t as He}from"./showcaseRecreateMixin-C0UnaxsG.js";import{n as Ue,t as We}from"./generationInput-VbA_cpqx.js";var Ge=v({name:`LayoutKling`,components:{MagicIcon:I,ElDrawer:A,ElButton:X},mixins:[Me]}),Ke={class:`main flex flex-row flex-1 min-h-0`},qe={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Je={class:`result h-full p-4 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Ye(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,Ke,[e(`div`,qe,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Je,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[_,!t.tasksEmpty]]),a(h,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Xe=R(Ge,[[`render`,Ye],[`__scopeId`,`data-v-f4b791b5`]]),Ze={text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};function Q(e,t,n){let r=t||`std`,i=n??5;switch(e){case`kling-v3-turbo`:return{...Ze,audio:!0};case`kling-v1`:return{text2video:!0,image2video:!0,endImage:i===5,audio:!1,motionControl:i===5,referenceVideo:!1,referenceImages:!1};case`kling-v1-6`:case`kling-v2-5-turbo`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v2-6`:return{text2video:!0,image2video:!0,endImage:r===`pro`,audio:r===`pro`,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v2-master`:case`kling-v2-1-master`:return{text2video:!0,image2video:!0,endImage:!1,audio:!1,motionControl:!1,referenceVideo:!1,referenceImages:!1};case`kling-v3`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:r!==`4k`,referenceVideo:!1,referenceImages:!1};case`kling-v3-omni`:return{text2video:!0,image2video:!0,endImage:!0,audio:!0,motionControl:!1,referenceVideo:!0,referenceImages:!0};case`kling-o1`:return{text2video:!0,image2video:!0,endImage:!0,audio:!1,motionControl:!1,referenceVideo:!0,referenceImages:!0};default:return Ze}}var $=`<<<video_1>>>`,Qe=/<<<image_\d+>>>/g;function $e(e){return e?e.split($).join(` `).replace(/\s{2,}/g,` `).trim():``}function et(e){return e?e.replace(Qe,` `).replace(/\s{2,}/g,` `).trim():``}function tt(e,t){if(!e)return[];let n=t.model??e.model,r=t.mode??e.mode,i=t.duration??e.duration;if(!n)return[];let a=Q(n,r,i),o=[];e.end_image_url&&!a.endImage&&o.push({field:`end_image_url`,i18nLabel:`kling.name.endImage`}),e.generate_audio&&!a.audio&&o.push({field:`generate_audio`,i18nLabel:`kling.name.generateAudio`}),e.camera_control?.type&&(!a.motionControl||e.start_image_url)&&o.push({field:`camera_control`,i18nLabel:`kling.name.cameraControl`}),e.video_list?.length&&!a.referenceVideo&&o.push({field:`video_list`,i18nLabel:`kling.name.referenceVideo`}),e.image_list?.length&&!a.referenceImages&&o.push({field:`image_list`,i18nLabel:`kling.name.referenceImages`});let s=[`kling-o1`,`kling-v3-omni`,`kling-v3-turbo`].includes(n)||!!(e.image_list?.length||e.video_list?.length);return s&&e.cfg_scale!==void 0&&o.push({field:`cfg_scale`,i18nLabel:`kling.name.cfgScale`}),s&&e.negative_prompt&&o.push({field:`negative_prompt`,i18nLabel:`kling.name.negativePrompt`}),o}function nt(e,t){let n={...e};for(let e of t)e.field===`end_image_url`&&(n.end_image_url=void 0),e.field===`generate_audio`&&(n.generate_audio=!1),e.field===`camera_control`&&(n.camera_control=void 0),e.field===`cfg_scale`&&(n.cfg_scale=void 0),e.field===`negative_prompt`&&(n.negative_prompt=void 0),e.field===`video_list`&&(n.video_list=void 0,n.prompt=$e(n.prompt)),e.field===`image_list`&&(n.image_list=void 0,n.prompt=et(n.prompt));return n}var rt=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{revertKey:0,options:[{value:`kling-v3-turbo`,label:`v3-Turbo`},{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-o1`,label:`Kling O1`}]}},computed:{value(){return this.$store.state.kling?.config?.model}},mounted(){this.value||this.applyModel(de)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=tt(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await z.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=nt({...t,model:e},n);this.$store.commit(`kling/setConfig`,i),D.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,model:e})}}}),it={class:`field`},at={class:`title font-bold`};function ot(t,n,r,a,o,u){let d=l(`el-option`),m=l(`el-select`);return g(),s(`div`,it,[e(`h2`,at,i(t.$t(`pika.name.model`)),1),(g(),f(m,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`pika.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(d,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var st=R(rt,[[`render`,ot],[`__scopeId`,`data-v-d3faca05`]]),ct=v({name:`ModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},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 L.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(`std`)}},mounted(){this.value||this.applyMode(`std`)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=tt(t,{mode:e});if(n.length===0){this.applyMode(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await z.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=nt({...t,mode:e},n);this.$store.commit(`kling/setConfig`,i),D.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyMode(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,mode:e})}}}),lt={class:`field`},ut={class:`header`},dt={class:`title font-bold`},ft={key:0,class:`opt-tip`};function pt(t,r,u,d,m,_){let v=l(`info-icon`),y=l(`el-option`),b=l(`el-select`);return g(),s(`div`,lt,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`kling.name.mode`)),1),a(v,{content:t.$t(`kling.description.mode`),class:`info-icon`},null,8,[`content`])]),(g(),f(b,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`kling.placeholder.select`),clearable:!0,onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(y,{key:t.value,label:t.label,value:t.value,disabled:t.disabled},{default:p(()=>[e(`span`,{class:n({"opt-disabled":t.disabled})},i(t.label),3),t.disabled&&t.disabledReason?(g(),s(`span`,ft,i(t.disabledReason),1)):o(``,!0)]),_:2},1032,[`label`,`value`,`disabled`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var mt=R(ct,[[`render`,pt],[`__scopeId`,`data-v-9a8fa3c5`]]),ht=Array.from({length:13},(e,t)=>t+3),gt=[5,10],_t=[5],vt=v({name:`DurationSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},data(){return{revertKey:0}},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},isV3Model(){return this.selectedModel===`kling-v3-turbo`||L.includes(this.selectedModel)},allowedDurations(){return this.selectedModel===`kling-o1`?_t:this.isV3Model?ht:gt},value(){return this.$store.state.kling?.config?.duration??5},selectValue(){let e=this.allowedDurations;return e.includes(this.value)?this.value:e.includes(5)?5:e[0]}},watch:{selectedModel(){this.allowedDurations.includes(this.value)||this.applyDuration(5)}},mounted(){this.$store.state.kling?.config?.duration||this.applyDuration(5)},methods:{async onChange(e){let t=this.$store.state.kling?.config||{},n=tt(t,{duration:e});if(n.length===0){this.applyDuration(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await z.confirm(this.$t(`kling.message.featureNotSupportedBody`,{fields:r}),this.$t(`kling.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`kling.button.confirmContinue`),cancelButtonText:this.$t(`kling.button.cancelSwitch`),type:`warning`});let i=nt({...t,duration:e},n);this.$store.commit(`kling/setConfig`,i),D.success(this.$t(`kling.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyDuration(e){this.$store.commit(`kling/setConfig`,{...this.$store.state.kling.config,duration:e})}}}),yt={class:`field`},bt={class:`control`},xt={class:`label`},St={class:`title font-bold`};function Ct(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,yt,[e(`div`,bt,[e(`div`,xt,[e(`h2`,St,i(t.$t(`kling.name.duration`)),1),a(m,{content:t.$t(`kling.description.duration`),class:`info-icon ml-1`},null,8,[`content`])]),(g(),f(v,{key:t.revertKey,"model-value":t.selectValue,class:`value`,placeholder:t.$t(`kling.placeholder.select`),onChange:t.onChange},{default:p(()=>[(g(!0),s(c,null,h(t.allowedDurations,e=>(g(),f(_,{key:e,label:`${e}s`,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])])}var wt=R(vt,[[`render`,Ct],[`__scopeId`,`data-v-9051ec82`]]),Tt=v({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||=`1:1`}}),Et={class:`text-sm font-bold mb-2 block`},Dt={class:`items`},Ot=[`onClick`],kt={class:`name`};function At(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,Et,i(t.$t(`kling.name.ratio`)),1),e(`div`,Dt,[(g(!0),s(c,null,h(t.options,(r,a)=>(g(),s(`div`,{key:a,class:n({active:t.active===a,item:!0}),onClick:e=>t.value=r.value},[e(`div`,{class:n([`preview`,r.label])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,kt,i(r.label),1)],10,Ot))),128))])])}var jt=R(Tt,[[`render`,At],[`__scopeId`,`data-v-cdb14b2f`]]),Mt=v({name:`StartImage`,components:{UploadIcon:F,ElUpload:C,ElButton:X,ElTooltip:w,InfoIcon:P,ImagePreview:Z},mixins:[J,K,Y],emits:[`change`],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)},reachedLimit(){return(this.fileList?.length||0)>=1},value:{get(){return this.$store.state?.kling?.config?.start_image_url},set(){}}},watch:{value(e){!e&&this.fileList.length>0&&(this.fileList=[])}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){D.error(this.$t(`kling.message.uploadReferencesError`))},onBeforeUpload(){let e=this.$store.state.kling?.config||{};if(e.video_list?.[0]?.refer_type===`base`)return D.warning(this.$t(`kling.message.baseVideoFrameConflict`)),!1;let t=e.video_list?.length?4:7;return(e.image_list?.length||0)+Number(!!e.end_image_url)+1>t?(D.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:t})),!1):!0},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state?.kling?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.onSetStartImageUrl()}}}),Nt={class:`relative`},Pt={class:`flex min-h-8 items-center pr-20`},Ft={class:`flex justify-start items-center`},It={class:`text-sm font-bold`};function Lt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`el-upload`);return g(),s(`div`,Nt,[e(`div`,Pt,[e(`div`,Ft,[e(`span`,It,i(t.$t(`kling.name.startImage`)),1),a(h,{content:t.$t(`kling.description.uploadStartImage`)},null,8,[`content`])])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:t.reachedLimit,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(b,{content:t.$t(`kling.message.uploadReferencesExceed`),disabled:!t.reachedLimit,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.reachedLimit},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$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`])])}var Rt=R(Mt,[[`render`,Lt],[`__scopeId`,`data-v-60844ac3`]]),zt=v({name:`EndImage`,components:{UploadIcon:F,ElUpload:C,ElButton:X,ElTooltip:w,ImagePreview:Z,InfoIcon:P},mixins:[J,K,Y],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)},reachedLimit(){return(this.fileList?.length||0)>=1},klingConfig(){return this.$store.state?.kling?.config||{}},endImageSupported(){return Q(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||=void 0,this.onSetEndImageUrl()},methods:{onBeforeUpload(){if(!this.endImageSupported)return D.warning(this.$t(`kling.message.endImageNotSupported`)),!1;if(!this.hasStartImage)return D.warning(this.$t(`kling.message.endImageRequiresStart`)),!1;if(this.klingConfig.video_list?.[0]?.refer_type===`base`)return D.warning(this.$t(`kling.message.baseVideoFrameConflict`)),!1;let e=this.klingConfig.video_list?.length?4:7;return(this.klingConfig.image_list?.length||0)+2>e?(D.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:e})),!1):!0},onExceed(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){D.error(this.$t(`kling.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.onSetEndImageUrl()}}}),Bt={class:`relative`},Vt={class:`flex min-h-8 items-center pr-20`},Ht={class:`flex justify-start items-center`},Ut={class:`text-sm font-bold`};function Wt(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-tooltip`),x=l(`el-upload`);return g(),s(`div`,Bt,[e(`div`,Vt,[e(`div`,Ht,[e(`span`,Ut,i(t.$t(`kling.name.endImage`)),1),a(h,{content:t.$t(`kling.description.uploadEndImage`)},null,8,[`content`])])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,disabled:t.uploadDisabled,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"before-upload":t.onBeforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(b,{content:t.uploadTooltip,disabled:!t.uploadDisabled,placement:`top`},{default:p(()=>[e(`span`,null,[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`,disabled:t.uploadDisabled},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$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`])])}var Gt=R(zt,[[`render`,Wt],[`__scopeId`,`data-v-b286c4d0`]]),Kt=v({name:`ReferenceVideo`,components:{ElUpload:C,ElButton:X,ElRadioButton:O,ElRadioGroup:k,ElSwitch:N,InfoIcon:P,FilePreview:je,UploadIcon:F},mixins:[K,Y],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)},config(){return this.$store.state.kling?.config||{}},hasVideo(){return!!this.urls?.[0]},referenceType:{get(){return this.config.video_list?.[0]?.refer_type||`feature`},set(e){this.updateVideoOptions(e,this.keepOriginalSound)}},keepOriginalSound:{get(){return this.config.video_list?.[0]?.keep_original_sound===`yes`},set(e){this.updateVideoOptions(this.referenceType,e)}}},methods:{onExceed(){D.warning(this.$t(`kling.message.referenceVideoExceed`))},onError(){D.error(this.$t(`kling.message.referenceVideoError`))},beforeUpload(e){if((this.config.image_list?.length||0)+Number(!!this.config.start_image_url)+Number(!!this.config.end_image_url)>4)return D.error(this.$t(`kling.message.referenceVideoImageLimit`)),!1;let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=xe(e.size);return t?n?!0:(D.error(this.$t(`kling.message.referenceVideoSizeExceed`,{max:Te(Ce)})),!1):(D.error(this.$t(`kling.message.referenceVideoTypeFailed`)),!1)},ensurePromptToken(e){let t=this.$store.state.kling?.config,n=t?.prompt||``,r=n.includes($),i;if(e&&!r)i=n?`${n} ${$}`:$;else if(!e&&r)i=$e(n);else return;this.$store.commit(`kling/setConfig`,{...t,prompt:i})},onRemove(e){this.fileList.splice(this.fileList.indexOf(e),1),this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,video_list:void 0}),this.ensurePromptToken(!1)},onSetVideoList(){let e=this.urls?.[0],t=e?[{video_url:e,refer_type:this.referenceType,keep_original_sound:this.keepOriginalSound?`yes`:`no`}]:void 0;this.$store.commit(`kling/setConfig`,{...this.config,video_list:t,generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0}),this.ensurePromptToken(!!e)},updateVideoOptions(e,t){let n=this.urls?.[0];n&&this.$store.commit(`kling/setConfig`,{...this.config,video_list:[{video_url:n,refer_type:e,keep_original_sound:t?`yes`:`no`}],...e===`base`?{start_image_url:void 0,end_image_url:void 0}:{},generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0})},async onSuccess(){this.onSetVideoList()}}}),qt={class:`relative`},Jt={class:`flex min-h-8 items-center pr-20`},Yt={class:`flex justify-start items-center`},Xt={class:`text-sm font-bold`},Zt={key:0,class:`reference-options mt-3 flex flex-col gap-3`},Qt={class:`flex flex-col items-stretch gap-2 sm:flex-row sm:items-center sm:justify-between`},$t={class:`text-sm`},en={class:`flex items-center justify-between gap-3`},tn={class:`text-sm`};function nn(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`el-radio-button`),S=l(`el-radio-group`),C=l(`el-switch`);return g(),s(`div`,qt,[e(`div`,Jt,[e(`div`,Yt,[e(`span`,Xt,i(t.$t(`kling.name.referenceVideo`)),1),a(h,{content:t.$t(`kling.description.omniReferenceVideo`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferenceVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`]),t.hasVideo?(g(),s(`div`,Zt,[e(`div`,Qt,[e(`span`,$t,i(t.$t(`kling.name.referenceVideoType`)),1),a(S,{modelValue:t.referenceType,"onUpdate:modelValue":n[1]||=e=>t.referenceType=e,size:`small`},{default:p(()=>[a(x,{value:`feature`},{default:p(()=>[r(i(t.$t(`kling.name.referenceVideoFeature`)),1)]),_:1}),a(x,{value:`base`},{default:p(()=>[r(i(t.$t(`kling.name.referenceVideoBase`)),1)]),_:1})]),_:1},8,[`modelValue`])]),e(`div`,en,[e(`span`,tn,i(t.$t(`kling.name.keepOriginalSound`)),1),a(C,{modelValue:t.keepOriginalSound,"onUpdate:modelValue":n[2]||=e=>t.keepOriginalSound=e},null,8,[`modelValue`])])])):o(``,!0)])}var rn=R(Kt,[[`render`,nn],[`__scopeId`,`data-v-e3a9dfab`]]),an=v({name:`KlingReferenceImages`,components:{ElButton:X,ElUpload:C,UploadIcon:F,ImagePreview:Z,InfoIcon:P},mixins:[J,K,Y],data(){return{fileList:[],uploadUrl:B()+`/api/v1/files/`}},computed:{config(){return this.$store.state.kling?.config||{}},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},frameCount(){return Number(!!this.config.start_image_url)+Number(!!this.config.end_image_url)},maxImages(){return this.config.video_list?.length?4:7},referenceLimit(){return Math.max(0,this.maxImages-this.frameCount)},remainingSlots(){return Math.max(0,this.referenceLimit-this.urls.length)},urls(){return this.fileList.map(e=>e.response?.file_url||e.url).filter(Boolean)},storeImages(){return this.config.image_list}},watch:{frameCount(){this.syncPromptTokens()},storeImages(e){!e?.length&&this.fileList.length>0&&(this.fileList=[])}},methods:{beforeUpload(){return this.remainingSlots===0?(this.onExceed(),!1):!0},onExceed(){D.warning(this.$t(`kling.message.referenceImagesExceed`,{count:this.remainingSlots}))},onError(){D.error(this.$t(`kling.message.referenceImagesError`))},clearOmniConflicts(e){return{...e,generate_audio:!1,camera_control:void 0,cfg_scale:void 0,negative_prompt:void 0}},syncPromptTokens(e){let t=e||this.config,n=[et(t.prompt),...this.urls.map((e,t)=>`<<<image_${this.frameCount+t+1}>>>`)].filter(Boolean).join(` `);n!==t.prompt&&this.$store.commit(`kling/setConfig`,{...t,prompt:n})},syncConfig(){let e=this.urls.length?this.urls.map(e=>({image_url:e})):void 0,t=this.clearOmniConflicts({...this.config,image_list:e});this.$store.commit(`kling/setConfig`,t),this.syncPromptTokens(t)},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.syncConfig()},onRemove(e,t){this.fileList.splice(e,1),t.url?.startsWith(`blob:`)&&URL.revokeObjectURL(t.url),this.syncConfig()}}}),on={class:`relative`},sn={class:`flex justify-between items-center`},cn={class:`flex justify-start items-center`},ln={class:`text-sm font-bold`},un={key:0,class:`file-list flex flex-wrap gap-2 mt-2`};function dn(t,n,u,d,m,_){let v=l(`info-icon`),y=l(`UploadIcon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return g(),s(`div`,on,[e(`div`,sn,[e(`div`,cn,[e(`span`,ln,i(t.$t(`kling.name.referenceImages`)),1),a(v,{content:t.$t(`kling.description.referenceImages`)},null,8,[`content`])]),a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg`,name:`file`,limit:t.referenceLimit,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{default:p(()=>[a(b,{round:``,type:`primary`,size:`small`,disabled:t.remainingSlots===0},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferenceImages`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`file-list`,`limit`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.fileList.length?(g(),s(`div`,un,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(S,{key:e.uid||e.url||n,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemove(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])):o(``,!0)])}var fn=R(an,[[`render`,dn]]),pn=v({name:`CfgScaleSelector`,components:{ElSlider:M,InfoIcon:P,ElInputNumber:j},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||=0}}),mn={class:`flex justify-between`},hn={class:`flex justify-start items-center`},gn={class:`text-sm font-bold`},_n={class:`flex justify-end items-center`},vn={class:`w-full`};function yn(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input-number`),p=l(`el-slider`);return g(),s(`div`,null,[e(`div`,mn,[e(`div`,hn,[e(`span`,gn,i(t.$t(`kling.name.cfgScale`)),1),a(d,{content:t.$t(`kling.description.cfgScale`)},null,8,[`content`])]),e(`div`,_n,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,"controls-position":`right`},null,8,[`modelValue`])])]),e(`div`,vn,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[1]||=e=>t.value=e,min:0,max:1,step:.1},null,8,[`modelValue`])])])}var bn=R(pn,[[`render`,yn]]),xn=v({name:`GenerateAudioSelector`,components:{ElSwitch:N,InfoIcon:P},computed:{selectedModel(){return this.$store.state.kling?.config?.model||``},selectedMode(){return this.$store.state.kling?.config?.mode||``},fixedAudio(){return this.selectedModel===`kling-v3-turbo`},supported(){return!!(this.fixedAudio||L.includes(this.selectedModel)||this.selectedModel===`kling-v2-6`&&this.selectedMode===`pro`)},tooltipContent(){return this.fixedAudio?this.$t(`kling.description.generateAudioIncluded`):this.supported?this.$t(`kling.description.generateAudio`):this.$t(`kling.description.generateAudioUnsupported`)},value:{get(){return this.fixedAudio?!0:this.supported?this.$store.state.kling?.config?.generate_audio??!1:!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})}}}),Sn={class:`relative`},Cn={class:`flex justify-between items-center`},wn={class:`flex justify-start items-center`},Tn={class:`text-sm font-bold`};function En(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,Sn,[e(`div`,Cn,[e(`div`,wn,[e(`span`,Tn,i(t.$t(`kling.name.generateAudio`)),1),a(d,{content:t.tooltipContent},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,disabled:!t.supported||t.fixedAudio},null,8,[`modelValue`,`disabled`])])])}var Dn=R(xn,[[`render`,En]]),On=[`horizontal`,`vertical`,`pan`,`tilt`,`roll`,`zoom`],kn=v({name:`CameraControlSelector`,components:{ElSelect:y,ElOption:b,ElSlider:M,ElInputNumber:j,InfoIcon:P},data(){return{configKeys:On}},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 Q(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){let t=this.$store.state.kling?.config||{};if(!e){let e={...t};delete e.camera_control,this.$store.commit(`kling/setConfig`,e);return}let n=e;this.$store.commit(`kling/setConfig`,{...t,camera_control:{type:n,config:n===`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){let n=this.$store.state.kling?.config||{},r=n.camera_control||{type:`simple`},i={...r.config||{}};t==null?delete i[e]:i[e]=t,this.$store.commit(`kling/setConfig`,{...n,camera_control:{...r,type:`simple`,config:i}})},onSliderChange(e,t){this.writeConfig(e,t)},onNumberChange(e,t){this.writeConfig(e,t)}}}),An={class:`field`},jn={class:`header`},Mn={class:`text-sm font-bold`},Nn={key:0,class:`config-grid`},Pn={class:`cfg-row-head`},Fn={class:`cfg-name`};function In(t,n,r,u,d,m){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`),b=l(`el-input-number`),x=l(`el-slider`);return g(),s(`div`,An,[e(`div`,jn,[e(`span`,Mn,i(t.$t(`kling.name.cameraControl`)),1),a(_,{content:t.tooltipContent},null,8,[`content`])]),a(y,{modelValue:t.selectedTypeRaw,"onUpdate:modelValue":n[0]||=e=>t.selectedTypeRaw=e,class:`value`,placeholder:t.$t(`kling.placeholder.cameraType`),clearable:!0,disabled:t.disabled},{default:p(()=>[(g(!0),s(c,null,h(t.typeOptions,e=>(g(),f(v,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`disabled`]),t.selectedType===`simple`&&!t.disabled?(g(),s(`div`,Nn,[(g(!0),s(c,null,h(t.configKeys,n=>(g(),s(`div`,{key:n,class:`cfg-row`},[e(`div`,Pn,[e(`span`,Fn,i(t.$t(`kling.name.cc_${n}`)),1),a(b,{modelValue:t.configValues[n],"onUpdate:modelValue":e=>t.configValues[n]=e,min:-1,max:1,step:.1,precision:1,"controls-position":`right`,size:`small`,class:`cfg-num`,onChange:e=>t.onNumberChange(n,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])]),a(x,{"model-value":t.configValues[n]??0,min:-1,max:1,step:.1,onInput:e=>t.onSliderChange(n,e)},null,8,[`model-value`,`onInput`])]))),128))])):o(``,!0)])}var Ln=R(kn,[[`render`,In],[`__scopeId`,`data-v-cd896060`]]),Rn=[{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`]}],zn=`, `;function Bn(e,t){let n=(e||``).trim();return n?n.includes(t)?n:`${n}${zn}${t}`:t}function Vn(e,t){if(!e||!t)return e||``;let n=[`${t}${zn}`,`${zn}${t}`,t],r=e;for(let e of n)if(r.includes(e)){r=r.replace(e,``);break}return r.replace(/(?:,\s*)+$/,``).replace(/^(?:,\s*)+/,``)}var Hn=v({name:`InspirationPills`,components:{CloseIcon:me},computed:{prompt(){return this.$store.state.kling?.config?.prompt||``},allChipTexts(){return Rn.flatMap(e=>e.chipKeys.map(e=>this.$t(`kling.inspiration.chip.${e}`)))},selected(){let e=this.prompt;if(!e)return[];let t=[];for(let n of this.allChipTexts){let r=e.indexOf(n);r!==-1&&t.push({text:n,idx:r})}return t.sort((e,t)=>e.idx-t.idx).map(e=>e.text)}},methods:{onRemove(e){let t=Vn(this.prompt,e);this.$store.commit(`kling/setConfig`,{...this.$store.state.kling?.config,prompt:t})}}}),Un={key:0,class:`pills`,role:`list`},Wn={class:`pill-text`},Gn=[`aria-label`,`title`,`onClick`];function Kn(n,r,u,d,f,p){let m=l(`close-icon`);return n.selected.length>0?(g(),s(`div`,Un,[(g(!0),s(c,null,h(n.selected,r=>(g(),s(`div`,{key:r,class:`pill`,role:`listitem`},[e(`span`,Wn,i(r),1),e(`button`,{type:`button`,class:`pill-remove`,"aria-label":n.$t(`kling.inspiration.removeChip`),title:n.$t(`kling.inspiration.removeChip`),onClick:t(e=>n.onRemove(r),[`stop`])},[a(m,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Gn)]))),128))])):o(``,!0)}var qn=v({name:`PromptInput`,components:{IdeaIcon:ie,ElButton:X,PromptTextarea:ae,InspirationPills:R(Hn,[[`render`,Kn],[`__scopeId`,`data-v-6be01bcf`]])},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||=``}});function Jn(e,t,n,o,s,c){let u=l(`idea-icon`),d=l(`el-button`),m=l(`inspiration-pills`),h=l(`prompt-textarea`);return g(),f(h,{modelValue:e.prompt,"onUpdate:modelValue":t[1]||=t=>e.prompt=t,title:e.$t(`kling.name.prompt`),info:e.$t(`kling.description.prompt`),placeholder:e.$t(`kling.placeholder.prompt`)},{actions:p(()=>[a(d,{text:``,size:`small`,class:`inspiration-btn`,onClick:t[0]||=t=>e.$emit(`open-inspiration`)},{default:p(()=>[a(u,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(e.$t(`kling.inspiration.openButton`)),1)]),_:1})]),before:p(()=>[a(m)]),_:1},8,[`modelValue`,`title`,`info`,`placeholder`])}var Yn=R(qn,[[`render`,Jn],[`__scopeId`,`data-v-5754ae54`]]),Xn=v({name:`NegativePromptInput`,components:{ElInput:q,InfoIcon:P},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||=``}}),Zn={class:`field`},Qn={class:`box`},$n={class:`title font-bold`};function er(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,Zn,[e(`div`,Qn,[e(`h2`,$n,i(t.$t(`kling.name.negativePrompt`)),1),a(d,{content:t.$t(`kling.description.negativePrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.negativePrompt`)},null,8,[`modelValue`,`placeholder`])])}var tr=R(Xn,[[`render`,er],[`__scopeId`,`data-v-de98cf01`]]),nr=v({name:`InspirationDrawer`,components:{Close:me,IdeaIcon:ie,ElDrawer:A,ElButton:X},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`],data(){return{groups:Rn}},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(e=>this.$t(`kling.inspiration.chip.${e}`)))},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(Vn(this.prompt,e)):this.setPrompt(Bn(this.prompt,e)))},onClearSelected(){let e=this.prompt;for(let t of this.allChipTexts)for(;e.includes(t);)e=Vn(e,t);this.setPrompt(e)}}}),rr={class:`drawer-content`},ir={class:`drawer-header`},ar={class:`title-row`},or={class:`title`},sr={class:`hint`},cr={key:0,class:`selected-bar`},lr={class:`selected-text`},ur={class:`groups`},dr={class:`group-title`},fr={class:`chip-grid`},pr=[`onClick`];function mr(t,u,d,m,_,v){let y=l(`idea-icon`),b=l(`close`),x=l(`el-button`),S=l(`el-drawer`);return g(),f(S,{modelValue:t.visible,"onUpdate:modelValue":u[1]||=e=>t.visible=e,direction:`rtl`,"with-header":!1,size:t.drawerSize,"custom-class":`kling-inspiration-drawer`,"destroy-on-close":!1},{default:p(()=>[e(`div`,rr,[e(`div`,ir,[e(`div`,ar,[a(y,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`span`,or,i(t.$t(`kling.inspiration.title`)),1)]),a(x,{text:``,class:`close-btn`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:u[0]||=e=>t.visible=!1},{default:p(()=>[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`])]),e(`div`,sr,i(t.$t(`kling.inspiration.hint`)),1),t.selectedCount>0?(g(),s(`div`,cr,[e(`span`,lr,i(t.$t(`kling.inspiration.selectedSummary`,{count:t.selectedCount})),1),a(x,{text:``,size:`small`,class:`clear-btn`,onClick:t.onClearSelected},{default:p(()=>[r(i(t.$t(`kling.inspiration.clearSelected`)),1)]),_:1},8,[`onClick`])])):o(``,!0),e(`div`,ur,[(g(!0),s(c,null,h(t.groups,r=>(g(),s(`div`,{key:r.groupKey,class:`group`},[e(`div`,dr,i(t.$t(`kling.inspiration.group.${r.groupKey}`)),1),e(`div`,fr,[(g(!0),s(c,null,h(r.chipKeys,e=>(g(),s(`button`,{key:e,type:`button`,class:n({chip:!0,active:t.isSelected(t.chipText(e))}),onClick:n=>t.onToggle(t.chipText(e))},i(t.chipText(e)),11,pr))),128))])]))),128))])])]),_:1},8,[`modelValue`,`size`])}var hr=R(nr,[[`render`,mr],[`__scopeId`,`data-v-8b2e6a5d`]]),gr={"kling-v3":`v3`,"kling-v3-turbo":`v3-Turbo`,"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-o1":`Kling O1`},_r={std:`720p`,pro:`1080p`,"4k":`4K`},vr=v({name:`SummaryChip`,components:{AudioIcon:ne},computed:{config(){return this.$store.state.kling?.config||{}},modelLabel(){let e=this.config?.model||`kling-v2-5-turbo`;return gr[e]||e},durationLabel(){return`${this.config?.duration??5}s`},aspectRatio(){return this.config?.aspect_ratio||``},modeLabel(){let e=this.config?.mode||`std`;return _r[e]||e},generateAudio(){return this.config?.model===`kling-v3-turbo`||!!this.config?.generate_audio}}}),yr={class:`summary-chip`},br=[`title`],xr=[`title`],Sr=[`title`],Cr=[`title`],wr=[`title`];function Tr(t,n,r,c,u,d){let f=l(`audio-icon`);return g(),s(`div`,yr,[e(`span`,{class:`part`,title:t.$t(`kling.name.model`)},i(t.modelLabel),9,br),n[0]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.duration`)},i(t.durationLabel),9,xr),n[1]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.ratio`)},i(t.aspectRatio||`16:9`),9,Sr),n[2]||=e(`span`,{class:`dot`},`·`,-1),e(`span`,{class:`part`,title:t.$t(`kling.name.mode`)},i(t.modeLabel),9,Cr),t.generateAudio?(g(),s(`span`,{key:0,class:`audio`,title:t.$t(`kling.name.generateAudio`)},[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,wr)):o(``,!0)])}var Er=v({name:`ConfigPanel`,components:{MagicIcon:I,ElButton:X,ServicePricingSummary:Ne,PromptInput:Yn,NegativePromptInput:tr,ModelSelector:st,ModeSelector:mt,DurationSelector:wt,RatioSelector:jt,StartImage:Rt,CfgScaleSelector:bn,GenerateAudioSelector:Dn,CameraControlSelector:Ln,InspirationDrawer:hr,SummaryChip:R(vr,[[`render`,Tr],[`__scopeId`,`data-v-f59e4d1f`]]),EndImage:Gt,ReferenceImages:fn,ReferenceVideo:rn,ScenarioPaymentMode:Le},emits:[`generate`],data(){return{inspirationOpen:!1,quoteTimer:0,quoteRunId:0}},computed:{canGenerate(){return We(`kling`,H(this.config))},config(){return this.$store.state.kling?.config},capabilities(){return Q(this.config?.model,this.config?.mode,this.config?.duration)},restrictedControls(){return[`kling-o1`,`kling-v3-omni`,`kling-v3-turbo`].includes(this.config?.model||``)||!!(this.config?.image_list?.length||this.config?.video_list?.length)},consumption(){return ye(this.config,this.service?.cost)},service(){return this.$store.state.kling?.service},walletMode(){return he()&&V(`kling`).mode===`wallet`}},watch:{walletMode:{handler(e){e&&this.scheduleQuote()},immediate:!0},config:{handler(){this.walletMode&&this.scheduleQuote()},deep:!0}},beforeUnmount(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1},methods:{scheduleQuote(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1;let e=V(`kling`);e.quoteUsdc=void 0,e.quoteLoading=!1,this.canGenerate&&(this.quoteTimer=window.setTimeout(this.refreshQuote,350))},async refreshQuote(){if(!this.canGenerate)return;let e=V(`kling`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=await U.quote(H(this.config));t===this.quoteRunId&&e.mode===`wallet`&&this.canGenerate&&(e.quoteUsdc=n.amountUsdc)}catch(e){console.warn(`x402 quote failed`,e)}finally{t===this.quoteRunId&&(e.quoteLoading=!1)}},onGenerate(){this.$emit(`generate`)}}}),Dr={class:`flex flex-col h-full`},Or={class:`flex-1 overflow-y-auto p-5`},kr={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ar(t,n,c,u,d,m){let h=l(`prompt-input`),_=l(`model-selector`),v=l(`ratio-selector`),y=l(`reference-images`),b=l(`reference-video`),x=l(`start-image`),S=l(`end-image`),C=l(`duration-selector`),w=l(`mode-selector`),T=l(`generate-audio-selector`),E=l(`camera-control-selector`),D=l(`cfg-scale-selector`),O=l(`negative-prompt-input`),k=l(`summary-chip`),A=l(`scenario-payment-mode`),j=l(`service-pricing-summary`),M=l(`magic-icon`),N=l(`el-button`),ee=l(`inspiration-drawer`);return g(),s(`div`,Dr,[e(`div`,Or,[a(h,{class:`mb-4`,onOpenInspiration:n[0]||=e=>t.inspirationOpen=!0}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),t.capabilities.referenceImages?(g(),f(y,{key:0,class:`mb-3`})):o(``,!0),t.capabilities.referenceVideo?(g(),f(b,{key:1,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),t.config?.model===`kling-v3-turbo`?o(``,!0):(g(),f(S,{key:2,class:`mb-4`})),a(C,{class:`mb-4`}),a(w,{class:`mb-4`}),a(T,{class:`mb-4`}),t.restrictedControls?o(``,!0):(g(),f(E,{key:3,class:`mb-4`})),t.restrictedControls?o(``,!0):(g(),f(D,{key:4,class:`mb-4`})),t.restrictedControls?o(``,!0):(g(),f(O,{key:5,class:`mb-4`}))]),e(`div`,kr,[a(k),a(A,{scenario:`kling`}),t.walletMode?o(``,!0):(g(),f(j,{key:0,value:t.consumption,service:t.service},null,8,[`value`,`service`])),t.config?.video_url!==void 0||t.config?.custom?(g(),f(N,{key:1,type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(M,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.extend`)),1)]),_:1},8,[`disabled`,`onClick`])):(g(),f(N,{key:2,type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(M,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`]))]),a(ee,{modelValue:t.inspirationOpen,"onUpdate:modelValue":n[1]||=e=>t.inspirationOpen=e},null,8,[`modelValue`])])}var jr=R(Er,[[`render`,Ar]]),Mr=v({name:`MotionImage`,components:{UploadIcon:F,ElUpload:C,ElButton:X,InfoIcon:P,ImagePreview:Z},mixins:[J,K,Y,De],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)}},mounted(){this.onSetImageUrl()},methods:{onExceed(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onError(){D.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(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,image_url:e})},async onSuccess(){this.onSetImageUrl()}}}),Nr={class:`relative`},Pr={class:`flex justify-between`},Fr={class:`flex justify-start items-center`},Ir={class:`text-sm font-bold`};function Lr(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,Nr,[e(`div`,Pr,[e(`div`,Fr,[e(`span`,Ir,i(t.$t(`kling.name.motionImage`)),1),a(h,{content:t.$t(`kling.description.motionImage`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:1,class:`upload-wrapper`,multiple:!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Rr=R(Mr,[[`render`,Lr],[`__scopeId`,`data-v-4a95ef2c`]]),zr=v({name:`MotionVideo`,components:{UploadIcon:F,ElUpload:C,ElButton:X,InfoIcon:P,FilePreview:je},mixins:[K,Y],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)}},mounted(){this.onSetVideoUrl()},methods:{onExceed(){D.warning(this.$t(`kling.message.uploadVideoExceed`))},onError(){D.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){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=e.size/1024/1024<100;return t?n?!0:(D.error(this.$t(`kling.message.uploadVideoSizeExceed`)),!1):(D.error(this.$t(`kling.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,video_url:e})},async onSuccess(){this.onSetVideoUrl()}}}),Br={class:`relative`},Vr={class:`flex justify-between`},Hr={class:`flex justify-start items-center`},Ur={class:`text-sm font-bold`};function Wr(t,n,c,u,d,m){let h=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return g(),s(`div`,Br,[e(`div`,Vr,[e(`div`,Hr,[e(`span`,Ur,i(t.$t(`kling.name.motionVideo`)),1),a(h,{content:t.$t(`kling.description.motionVideo`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value`,"show-file-list":!0,limit:1,multiple:!1,action:t.uploadUrl,"before-upload":t.beforeUpload,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:p(({file:e})=>[e.percentage===void 0?o(``,!0):(g(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.onRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))]),default:p(()=>[a(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(v,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Gr=R(zr,[[`render`,Wr],[`__scopeId`,`data-v-630c4521`]]),Kr=v({name:`MotionPromptInput`,components:{ElInput:q,InfoIcon:P},computed:{prompt:{get(){return this.$store.state.kling?.motionConfig?.prompt||``},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,prompt:e})}}}}),qr={class:`field`},Jr={class:`box`},Yr={class:`title font-bold`};function Xr(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-input`);return g(),s(`div`,qr,[e(`div`,Jr,[e(`h2`,Yr,i(t.$t(`kling.name.motionPrompt`)),1),a(d,{content:t.$t(`kling.description.motionPrompt`),class:`info`},null,8,[`content`])]),a(f,{modelValue:t.prompt,"onUpdate:modelValue":n[0]||=e=>t.prompt=e,rows:3,type:`textarea`,class:`prompt`,placeholder:t.$t(`kling.placeholder.motionPrompt`)},null,8,[`modelValue`,`placeholder`])])}var Zr=R(Kr,[[`render`,Xr],[`__scopeId`,`data-v-ca9fdbe5`]]),Qr=`video`,$r=v({name:`CharacterOrientationSelector`,components:{ElRadioGroup:k,ElRadioButton:O,InfoIcon:P},computed:{value:{get(){return this.$store.state.kling?.motionConfig?.character_orientation||Qr},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=Qr)}}),ei={class:`field`},ti={class:`header`},ni={class:`text-sm font-bold`};function ri(t,n,o,c,u,d){let f=l(`info-icon`),m=l(`el-radio-button`),h=l(`el-radio-group`);return g(),s(`div`,ei,[e(`div`,ti,[e(`span`,ni,i(t.$t(`kling.name.characterOrientation`)),1),a(f,{content:t.$t(`kling.description.characterOrientation`)},null,8,[`content`])]),a(h,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,size:`small`,class:`value`},{default:p(()=>[a(m,{label:`image`},{default:p(()=>[r(i(t.$t(`kling.name.orientationImage`)),1)]),_:1}),a(m,{label:`video`},{default:p(()=>[r(i(t.$t(`kling.name.orientationVideo`)),1)]),_:1})]),_:1},8,[`modelValue`])])}var ii=R($r,[[`render`,ri],[`__scopeId`,`data-v-7a91195b`]]),ai=`kling-v2-6`,oi=v({name:`MotionModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},computed:{options(){return[{value:`kling-v2-6`,label:`Kling 2.6`},{value:`kling-v3`,label:`Kling 3.0`}]},value:{get(){return this.$store.state.kling?.motionConfig?.model_name||ai},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,model_name:e})}}},mounted(){this.$store.state.kling?.motionConfig?.model_name||(this.value=ai)}}),si={class:`field`},ci={class:`header`},li={class:`title font-bold`};function ui(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,si,[e(`div`,ci,[e(`h2`,li,i(t.$t(`kling.name.motionModel`)),1),a(m,{content:t.$t(`kling.description.motionModel`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var di=R(oi,[[`render`,ui],[`__scopeId`,`data-v-480e8da2`]]),fi=`std`,pi=v({name:`MotionModeSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:P},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||fi},set(e){this.$store.commit(`kling/setMotionConfig`,{...this.$store.state.kling?.motionConfig,mode:e})}}},mounted(){this.$store.state.kling?.motionConfig?.mode||(this.value=fi)}}),mi={class:`field`},hi={class:`header`},gi={class:`title font-bold`};function _i(t,n,r,o,u,d){let m=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return g(),s(`div`,mi,[e(`div`,hi,[e(`h2`,gi,i(t.$t(`kling.name.mode`)),1),a(m,{content:t.$t(`kling.description.motionMode`)},null,8,[`content`])]),a(v,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var vi=R(pi,[[`render`,_i],[`__scopeId`,`data-v-1295688c`]]),yi=v({name:`KeepOriginalSoundSelector`,components:{ElSwitch:N,InfoIcon:P},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`})}}}}),bi={class:`relative`},xi={class:`flex justify-between items-center`},Si={class:`flex justify-start items-center`},Ci={class:`text-sm font-bold`};function wi(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return g(),s(`div`,bi,[e(`div`,xi,[e(`div`,Si,[e(`span`,Ci,i(t.$t(`kling.name.keepOriginalSound`)),1),a(d,{content:t.$t(`kling.description.keepOriginalSound`)},null,8,[`content`])]),a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e},null,8,[`modelValue`])])])}var Ti=v({name:`MotionPanel`,components:{MagicIcon:I,ElButton:X,ServicePricingSummary:Ne,MotionImage:Rr,MotionVideo:Gr,MotionPromptInput:Zr,CharacterOrientationSelector:ii,MotionModelSelector:di,MotionModeSelector:vi,KeepOriginalSoundSelector:R(yi,[[`render`,wi]])},emits:[`generate`],computed:{motionConfig(){return this.$store.state.kling?.motionConfig},consumption(){return ye({...this.motionConfig,duration:1},this.service?.cost)},service(){return this.$store.state.kling?.service},canGenerate(){let e=this.motionConfig;return!!(e?.image_url&&e?.video_url)}},methods:{onGenerate(){this.$emit(`generate`)}}}),Ei={class:`flex flex-col h-full`},Di={class:`flex-1 overflow-y-auto p-5`},Oi={class:`flex flex-col items-center justify-center px-5 pb-5`};function ki(t,n,o,c,u,d){let f=l(`motion-image`),m=l(`motion-video`),h=l(`motion-prompt-input`),_=l(`character-orientation-selector`),v=l(`motion-model-selector`),y=l(`motion-mode-selector`),b=l(`keep-original-sound-selector`),x=l(`service-pricing-summary`),S=l(`magic-icon`),C=l(`el-button`);return g(),s(`div`,Ei,[e(`div`,Di,[a(f,{class:`mb-3`}),a(m,{class:`mb-3`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`})]),e(`div`,Oi,[a(x,{value:t.consumption,service:t.service,"rate-unit":t.$t(`kling.name.perSecond`),note:t.$t(`kling.message.motionPricingNote`)},null,8,[`value`,`service`,`rate-unit`,`note`]),a(C,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(S,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generateMotion`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Ai=R(Ti,[[`render`,ki]]),ji=v({name:`KlingTabSwitcher`,components:{MetaTag:_e,ElTabs:x,ElTabPane:S},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`)},{value:`talking-photo`,label:this.$t(`kling.tab.talkingPhoto`)}]}},methods:{onUpdate(e){this.$emit(`update:modelValue`,e)}}}),Mi=[`title`],Ni={class:`text`};function Pi(t,n,a,u,d,m){let _=l(`meta-tag`),v=l(`el-tab-pane`),y=l(`el-tabs`);return g(),f(y,{"model-value":t.modelValue,class:`kling-tabs scenario-tabs scenario-tabs--divided`,"onUpdate:modelValue":t.onUpdate},{default:p(()=>[(g(!0),s(c,null,h(t.tabs,t=>(g(),f(v,{key:t.value,name:t.value,disabled:t.disabled},{label:p(()=>[e(`span`,{class:`tab-label`,title:t.disabled?t.disabledReason:void 0},[e(`span`,Ni,i(t.label),1),t.badge?(g(),f(_,{key:0,tone:`warning`,class:`badge`,density:`compact`},{default:p(()=>[r(i(t.badge),1)]),_:2},1024)):o(``,!0)],8,Mi)]),_:2},1032,[`name`,`disabled`]))),128))]),_:1},8,[`model-value`,`onUpdate:modelValue`])}var Fi=R(ji,[[`render`,Pi],[`__scopeId`,`data-v-24ca66ec`]]),Ii={"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`},Li=v({name:`TalkingPhotoModelSelector`,components:{ElSelect:y,ElOption:b},data(){return{options:pe.map(e=>({value:e,label:Ii[e]||e}))}},computed:{value:{get(){return this.$store.state.kling?.talkingPhotoConfig?.model||`kling-v2-1-master`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,model:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.model||(this.value=fe)}}),Ri={class:`field`},zi={class:`title font-bold`};function Bi(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Ri,[e(`h2`,zi,i(t.$t(`kling.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Vi=R(Li,[[`render`,Bi],[`__scopeId`,`data-v-cbc83d11`]]),Hi=v({name:`TalkingPhotoModeSelector`,components:{ElSelect:y,ElOption:b},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?.talkingPhotoConfig?.mode||`pro`},set(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.$store.state.kling?.talkingPhotoConfig,mode:e})}}},mounted(){this.$store.state.kling?.talkingPhotoConfig?.mode||(this.value=`pro`)}}),Ui={class:`field`},Wi={class:`title font-bold`};function Gi(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Ui,[e(`h2`,Wi,i(t.$t(`kling.name.mode`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`kling.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.options,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Ki=v({name:`TalkingPhotoPanel`,components:{MagicIcon:I,UploadIcon:F,ElUpload:C,ElButton:X,ElInput:q,ServicePricingSummary:Ne,InfoIcon:P,ImagePreview:Z,ModelSelector:Vi,ModeSelector:R(Hi,[[`render`,Gi],[`__scopeId`,`data-v-92525a1d`]]),ScenarioPaymentMode:Le},mixins:[Y,De],emits:[`generate`],data(){return{imageFiles:[],audioFiles:[],uploadUrl:B()+`/api/v1/files/`,quoteTimer:0,quoteRunId:0}},computed:{config(){return this.$store.state.kling?.talkingPhotoConfig||{}},audioUrl(){return this.config.audio_url},headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},service(){return this.$store.state.kling?.service},consumption(){return ye({...this.config,action:`talking-photo`},this.service?.cost)},canGenerate(){return!!(this.config.image_url&&this.config.audio_url)},walletMode(){return he()&&V(`kling`).mode===`wallet`}},watch:{walletMode:{handler(e){e&&this.scheduleQuote()},immediate:!0},config:{handler(){this.walletMode&&this.scheduleQuote()},deep:!0}},beforeUnmount(){window.clearTimeout(this.quoteTimer),this.quoteRunId+=1},methods:{scheduleQuote(){window.clearTimeout(this.quoteTimer),this.quoteTimer=window.setTimeout(this.refreshQuote,350)},async refreshQuote(){let e=V(`kling`),t=++this.quoteRunId;e.quoteLoading=!0,e.quoteUsdc=void 0;try{let n=await U.quoteTalkingPhoto(ge(this.config));t===this.quoteRunId&&e.mode===`wallet`&&(e.quoteUsdc=n.amountUsdc)}catch(e){console.warn(`x402 quote failed`,e)}finally{t===this.quoteRunId&&(e.quoteLoading=!1)}},commit(e){this.$store.commit(`kling/setTalkingPhotoConfig`,{...this.config,...e})},onPromptChange(e){this.commit({prompt:e})},onImageExceed(){D.warning(this.$t(`kling.message.uploadReferencesExceed`))},onImageError(){D.error(this.$t(`kling.message.uploadReferencesError`))},onImageSuccess(e){this.commit({image_url:e?.file_url})},onImageRemove(e){this.imageFiles.splice(this.imageFiles.indexOf(e),1),this.commit({image_url:void 0})},onAudioExceed(){D.warning(this.$t(`kling.message.uploadAudioExceed`))},onAudioError(){D.error(this.$t(`kling.message.uploadAudioError`))},onAudioSuccess(e){this.commit({audio_url:e?.file_url})},onAudioRemove(){this.commit({audio_url:void 0})},onGenerate(){this.$emit(`generate`)}}}),qi={class:`flex flex-col h-full`},Ji={class:`flex-1 overflow-y-auto p-5`},Yi={class:`relative mb-4`},Xi={class:`flex justify-start items-center`},Zi={class:`text-sm font-bold`},Qi={class:`relative mb-4`},$i={class:`flex justify-start items-center`},ea={class:`text-sm font-bold`},ta=[`src`],na={class:`mb-4`},ra={class:`flex justify-start items-center`},ia={class:`text-sm font-bold`},aa={class:`flex flex-col items-center justify-center px-5 pb-5`};function oa(t,n,c,u,d,m){let h=l(`model-selector`),_=l(`mode-selector`),v=l(`info-icon`),y=l(`image-preview`),b=l(`upload-icon`),x=l(`el-button`),S=l(`el-upload`),C=l(`el-input`),w=l(`scenario-payment-mode`),T=l(`service-pricing-summary`),E=l(`magic-icon`);return g(),s(`div`,qi,[e(`div`,Ji,[a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),e(`div`,Yi,[e(`div`,Xi,[e(`span`,Zi,i(t.$t(`kling.name.talkingPhotoImage`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoImage`)},null,8,[`content`])]),a(S,{ref:`imageUploader`,"file-list":t.imageFiles,"onUpdate:fileList":n[0]||=e=>t.imageFiles=e,name:`file`,accept:`.png,.jpg,.jpeg,.webp,.bmp`,limit:1,class:`upload-wrapper`,multiple:!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"list-type":`picture`,headers:t.headers,"on-exceed":t.onImageExceed,"on-error":t.onImageError,"on-success":t.onImageSuccess},{file:p(({file:e})=>[e.url&&e.percentage!==void 0?(g(),f(y,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.onImageRemove(e)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:p(()=>[a(b,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`])]),e(`div`,Qi,[e(`div`,$i,[e(`span`,ea,i(t.$t(`kling.name.talkingPhotoAudio`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoAudio`)},null,8,[`content`])]),a(S,{ref:`audioUploader`,"file-list":t.audioFiles,"onUpdate:fileList":n[1]||=e=>t.audioFiles=e,name:`file`,accept:`.mp3,.wav,.m4a,.aac`,limit:1,class:`upload-wrapper`,multiple:!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,headers:t.headers,"on-exceed":t.onAudioExceed,"on-error":t.onAudioError,"on-success":t.onAudioSuccess,"on-remove":t.onAudioRemove},{default:p(()=>[a(x,{round:``,type:`primary`,size:`small`,class:`btn`},{default:p(()=>[a(b,{class:`icon mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.uploadAudio`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`]),t.audioUrl?(g(),s(`audio`,{key:0,src:t.audioUrl,controls:``,class:`w-full mt-2`},null,8,ta)):o(``,!0)]),e(`div`,na,[e(`div`,ra,[e(`span`,ia,i(t.$t(`kling.name.talkingPhotoPrompt`)),1),a(v,{content:t.$t(`kling.description.talkingPhotoPrompt`)},null,8,[`content`])]),a(C,{"model-value":t.config.prompt,type:`textarea`,rows:2,placeholder:t.$t(`kling.placeholder.talkingPhotoPrompt`),class:`mt-1`,"onUpdate:modelValue":t.onPromptChange},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])])]),e(`div`,aa,[a(w,{scenario:`kling`}),t.walletMode?o(``,!0):(g(),f(T,{key:0,value:t.consumption,service:t.service},null,8,[`value`,`service`])),a(x,{type:`primary`,class:`btn w-full`,round:``,disabled:!t.canGenerate,onClick:t.onGenerate},{default:p(()=>[a(E,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`kling.button.generateTalkingPhoto`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var sa=R(Ki,[[`render`,oa],[`__scopeId`,`data-v-46191f92`]]),ca=v({name:`TaskPreview`,components:{DeleteIcon:le,ChannelIcon:te,InfoIcon:re,MagicIcon:I,TimeIcon:ee,WarningIcon:ue,CopyToClipboard:ke,ElAlert:T,VideoPlayer:Fe,ElTooltip:w,ElButton:X,ImagePreview:Z,VideoPreview:Ie,AudioPreview:Pe,ApiCodeButton:Re,ReportButton:Ae},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{isFailure(){let e=this.modelValue?.response;return e?.success===!1||!!e?.error||e?.state===`failed`||e?.state===`cancelled`},isWaiting(){let e=this.modelValue?.response;return!e||!this.isFailure&&e.success!==!0&&!e.video_url},application(){return this.$store.state.kling?.application},config(){return this.$store.state.kling?.config},displayText(){return this.modelValue?.request?.prompt?.trim()||this.modelValue?.request?.text?.trim()||``},referenceImages(){let e=[],t=this.modelValue?.request?.start_image_url,n=this.modelValue?.request?.end_image_url,r=this.modelValue?.request?.image_url;return t&&e.push({url:t,name:`start-image`}),n&&e.push({url:n,name:`end-image`}),r&&e.push({url:r,name:`reference-image`}),e},referenceVideos(){let e=[],t=this.modelValue?.request?.video_url;t&&e.push({url:t,name:`reference-video`});let n=this.modelValue?.request?.video_list;return(Array.isArray(n)?n:[]).forEach((t,n)=>{t?.video_url&&e.push({url:t.video_url,name:`reference-video-${n+1}`})}),e},referenceAudios(){let e=this.modelValue?.request?.audio_url;return e?[{url:e,name:`reference-audio`}]:[]}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await z.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`kling/deleteTask`,{id:e}),D.success(this.$t(`common.message.deleteTaskSuccess`))}catch{D.error(this.$t(`common.message.deleteTaskFailed`))}}},onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),la={class:`preview`},ua={class:`left`},da={class:`main`},fa={class:`bot`},pa={class:`datetime`},ma=[`aria-label`],ha={key:0,class:`info`},ga={key:0,class:`request-media flex justify-start items-center gap-2 w-full overflow-x-auto`},_a={key:1,class:`prompt`},va={key:0},ya={key:1},ba={key:1,class:n({content:!0,failed:!0})},xa={key:0,class:`mb-4`},Sa={key:1,class:n({operations:!0,"mt-2":!0})},Ca={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},wa={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ta={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ea={key:2,class:n({content:!0})},Da={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Oa={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ka={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Aa={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ja={key:3,class:n({content:!0})},Ma={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Na={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Pa(n,u,d,m,_,v){let y=l(`capability-presentation`),b=l(`delete-icon`),x=l(`el-tooltip`),S=l(`image-preview`),C=l(`video-preview`),w=l(`audio-preview`),T=l(`video-player`),E=l(`el-button`),D=l(`api-code-button`),O=l(`report-button`),k=l(`channel-icon`),A=l(`magic-icon`),j=l(`copy-to-clipboard`),M=l(`time-icon`),N=l(`el-alert`),ee=l(`warning-icon`),te=l(`info-icon`);return g(),s(`div`,la,[e(`div`,ua,[a(y,{capability:`kling`,part:`avatar`,class:`avatar`})]),e(`div`,da,[e(`div`,fa,[a(y,{capability:`kling`,part:`name`}),e(`span`,pa,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(x,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(g(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:u[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(b,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,ma)):o(``,!0)]),_:1},8,[`content`])]),n.referenceImages.length>0||n.referenceVideos.length>0||n.referenceAudios.length>0||n.displayText?(g(),s(`div`,ha,[n.referenceImages.length>0||n.referenceVideos.length>0||n.referenceAudios.length>0?(g(),s(`div`,ga,[(g(!0),s(c,null,h(n.referenceImages,(e,t)=>(g(),f(S,{key:`image-${t}`,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceVideos,(e,t)=>(g(),f(C,{key:`video-${t}`,url:e.url,name:e.name},null,8,[`url`,`name`]))),128)),(g(!0),s(c,null,h(n.referenceAudios,(e,t)=>(g(),f(w,{key:`audio-${t}`,url:e.url,name:e.name},null,8,[`url`,`name`]))),128))])):o(``,!0),n.displayText?(g(),s(`p`,_a,[r(i(n.displayText)+` `,1),n.modelValue?.response?n.isWaiting?(g(),s(`span`,ya,` - (`+i(n.$t(`kling.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,va,` - (`+i(n.$t(`kling.status.pending`))+`) `,1))])):o(``,!0)])):o(``,!0),n.modelValue?.response?.success===!0&&!n.isFailure?(g(),s(`div`,ba,[n.modelValue?.response.video_url?(g(),s(`div`,xa,[a(T,{src:n.modelValue?.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response.success?(g(),s(`div`,Sa,[a(x,{class:`box-item`,effect:`dark`,content:n.$t(`kling.message.downloadVideo`),placement:`top-start`},{default:p(()=>[n.modelValue?.response.video_url?(g(),f(E,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:u[1]||=e=>n.onDownload(e,n.modelValue?.response.video_url)},{default:p(()=>[r(i(n.$t(`kling.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(D,{path:`/kling/videos`,body:n.modelValue?.request},null,8,[`body`]),a(O,{service:`kling`,"target-id":n.modelValue?.id,snapshot:{prompt:n.displayText}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(N,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,Ca,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.model`))+`: `+i(n.modelValue?.request?.model),1)]),e(`p`,wa,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,Ta,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.isFailure?(g(),s(`div`,Ea,[a(N,{closable:!1,class:`failure`},{template:p(()=>[a(ee,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.failure`)),1)]),default:p(()=>[e(`p`,Da,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Oa,[a(te,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(j,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,ka,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Aa,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(j,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),n.isWaiting?(g(),s(`div`,ja,[a(N,{closable:!1,class:`info`},{template:p(()=>[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`kling.status.processing`:`kling.status.pending`)),1)]),default:p(()=>[e(`p`,Ma,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(j,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,Na,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`kling.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(j,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var Fa=v({name:`RecentPanel`,components:{TaskPreview:R(ca,[[`render`,Pa],[`__scopeId`,`data-v-73637147`]]),NoTasks:se,BotPlaceholder:ze,ScrollList:oe},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?.()}}}),Ia={key:0},La={key:2,class:`w-full h-full flex items-center justify-center`};function Ra(e,t,n,r,i,u){let d=l(`bot-placeholder`),m=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return g(),s(c,null,[e.tasks?.items===void 0?(g(),s(`div`,Ia,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`h-full w-full overflow-y-auto tasks`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,e=>(g(),f(m,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,La,[a(v)])):o(``,!0)],64)}var za=v({name:`KlingIndex`,components:{ConfigPanel:jr,MotionPanel:Ai,TalkingPhotoPanel:sa,TabSwitcher:Fi,Layout:Xe,RecentPanel:R(Fa,[[`render`,Ra]]),ShowcaseResultTabs:Ve},mixins:[Ee,He(`kling`),Be(`kling`)],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1,walletTaskIds:[]}},computed:{applicationsLoading(){return this.$store.state.kling?.status?.getApplications===E.Request},tasksLoading(){return this.$store.state.kling?.status?.getTasks===E.Request||this.fetchingTasks},credential(){return this.$store.state.kling.credential},config(){return this.$store.state.kling.config},motionConfig(){return this.$store.state.kling.motionConfig},talkingPhotoConfig(){return this.$store.state.kling.talkingPhotoConfig},taskType(){return this.$store.state.kling.taskType||`videos`},tasks(){return this.$store.state.kling.tasks},walletMode(){return this.taskType!==`motion`&&he()&&V(`kling`).mode===`wallet`}},watch:{taskType:{handler(e){Oe(`kling`,e!==`motion`)},immediate:!0},walletMode:{async handler(e,t){if(!(t===void 0||e===t)){if(this.$store.commit(`kling/setTasks`,void 0),e&&!this.job&&(this.job=window.setInterval(this.onPollTasks,5e3)),!e&&!this.credential?.token){window.clearInterval(this.job),this.job=0,await this.onScrollDown();return}await this.onGetTasks(),await this.onScrollDown()}}},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.onPollTasks,5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ce({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();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`kling/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r,...this.walletMode&&!this.credential?.token?{mode:`x402`,ids:this.walletTaskIds}:{}})}finally{this.fetchingTasks=!1}},async onGenerate(){let e=H(this.config),t=Ue(`kling`,e);if(t){D.error(this.$t(`common.message.${t}`));return}if(!G(this.uploadTracker,e=>this.$t(e),e=>D.warning(e)))return;let n=Number(!!e.start_image_url)+Number(!!e.end_image_url),r=e.image_list?.length||0,i=e.video_list?.length?4:7;if(n+r>i){D.warning(this.$t(`kling.message.referenceImagesTotalLimit`,{count:i}));return}if(e.video_list?.[0]?.refer_type===`base`&&(e.start_image_url||e.end_image_url||e.image_list?.some(({type:e})=>e))){D.warning(this.$t(`kling.message.baseVideoFrameConflict`));return}if(!e.video_id&&!e.video_url&&!e.start_image_url&&e.end_image_url){D.warning(this.$t(`kling.message.endImageRequiresStart`));return}let a=this.createPaymentOperation(t=>U.generate(e,t));a&&(D.info(this.$t(`kling.message.startingTask`)),W(`kling`,a).then(e=>{this.recordWalletTask(e),D.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>this.handleGenerationError(e)).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)}))},createPaymentOperation(e){if(!this.walletMode){if(!be())return;let t=this.credential?.token;return t?e({token:t}):void 0}let t=this.getWalletContext();if(!t){D.warning(this.$t(`common.x402Scenario.connectWalletFirst`));return}return e({mode:`x402`,x402:{wallet:t,confirm:e=>this.confirmWalletPayment(e),identityToken:this.credential?.token}})},recordWalletTask(e){let t=e?.data?.task_id;this.walletMode&&!this.credential?.token&&t&&!this.walletTaskIds.includes(t)&&this.walletTaskIds.unshift(t)},handleGenerationError(e){e instanceof we||ve(e,`kling`)||(this.walletMode?D.error(this.$t(`common.x402Scenario.paymentFailed`)):D.error(this.$t(`kling.message.startTaskFailed`)))},getWalletContext(){return Se(this.$wallet)},async confirmWalletPayment(e){return z.confirm(this.$t(`common.x402Scenario.confirmPayment`,{amount:e.amountUsdc}),this.$t(`order.message.x402ConfirmTitle`),{confirmButtonText:this.$t(`order.message.x402WalletPayCta`),cancelButtonText:this.$t(`common.button.cancel`),type:`warning`}).then(()=>!0).catch(()=>!1)},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(!G(this.uploadTracker,e=>this.$t(e),e=>D.warning(e)))return;let e=this.motionConfig||{};if(!e.image_url||!e.video_url){D.warning(this.$t(`kling.message.motionMissingInputs`));return}let 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.model_name?{model_name:e.model_name}:{},...e.prompt?{prompt:e.prompt}:{},async:!0};if(!be())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}D.info(this.$t(`kling.message.startingTask`)),W(`kling`,U.motion(t,{token:n})).then(()=>{D.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>{ve(e,`kling`)||D.error(this.$t(`kling.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},async onGenerateTalkingPhoto(){if(!G(this.uploadTracker,e=>this.$t(e),e=>D.warning(e)))return;let e=this.talkingPhotoConfig||{};if(!e.image_url||!e.audio_url){D.warning(this.$t(`kling.message.talkingPhotoMissingInputs`));return}let t=ge(e),n=this.createPaymentOperation(e=>U.talkingPhoto(t,e));n&&(D.info(this.$t(`kling.message.startingTask`)),W(`kling`,n).then(e=>{this.recordWalletTask(e),D.success(this.$t(`kling.message.startTaskSuccess`))}).catch(e=>this.handleGenerationError(e)).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)}))}}}),Ba={class:`flex flex-col h-full`},Va={class:`flex-1 min-h-0`};function Ha(t,n,r,i,s,c){let u=l(`tab-switcher`),d=l(`config-panel`),m=l(`motion-panel`),h=l(`talking-photo-panel`),_=l(`recent-panel`),v=l(`showcase-result-tabs`),y=l(`layout`);return g(),f(y,null,{config:p(()=>[e(`div`,Ba,[a(u,{"model-value":t.taskType,"onUpdate:modelValue":t.onTabChange},null,8,[`model-value`,`onUpdate:modelValue`]),e(`div`,Va,[t.taskType===`videos`?(g(),f(d,{key:0,onGenerate:t.onGenerate},null,8,[`onGenerate`])):t.taskType===`motion`?(g(),f(m,{key:1,onGenerate:t.onGenerateMotion},null,8,[`onGenerate`])):t.taskType===`talking-photo`?(g(),f(h,{key:2,onGenerate:t.onGenerateTalkingPhoto},null,8,[`onGenerate`])):o(``,!0)])])]),result:p(()=>[a(v,{service:`kling`},{tasks:p(()=>[a(_,{ref:`recentPanel`,loading:t.loadingMore,onReachTop:t.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})]),_:1})}var Ua=R(za,[[`render`,Ha]]);export{Ua as default};