@acedatacloud/nexior 3.356.13 → 3.356.14

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 (248) hide show
  1. package/dist/assets/{ApiCodeButton-BG3uOft7.js → ApiCodeButton-Da3_C3Lz.js} +1 -1
  2. package/dist/assets/{Artifacts-CPV9CagV.js → Artifacts-CBWSbuQb.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-CKoVWONV.js → AskUserQuestionCard-BtygXY1_.js} +1 -1
  4. package/dist/assets/{Auth-CV4FBP0o.js → Auth-Cjx5mZSF.js} +1 -1
  5. package/dist/assets/{Bare-CZb9pPfn.js → Bare-CbGRnegx.js} +1 -1
  6. package/dist/assets/{BotPlaceholder-CXmOKAnD.js → BotPlaceholder-C3WTtRMA.js} +1 -1
  7. package/dist/assets/{BottomFooter-BryvPO4R.js → BottomFooter-UwUa0dKo.js} +1 -1
  8. package/dist/assets/{BrowserPairingDialog-BmVPe-2c.js → BrowserPairingDialog-CT3amh2r.js} +1 -1
  9. package/dist/assets/{Callback-pis0GeEe.js → Callback-CfMIYRW9.js} +1 -1
  10. package/dist/assets/{CodeSnippet-RuYvbcNi.js → CodeSnippet-yIqTKMnn.js} +1 -1
  11. package/dist/assets/{Console-8LSIGXy4.js → Console-D6qHeTct.js} +1 -1
  12. package/dist/assets/{Consumption-DiSEqNK8.js → Consumption-Cvw-XQ7S.js} +1 -1
  13. package/dist/assets/{Conversation-UtPacMnm.js → Conversation-BiBeF3Me.js} +1 -1
  14. package/dist/assets/{Conversation-Dw6U8tbI.js → Conversation-Cz18_SeJ.js} +1 -1
  15. package/dist/assets/{CopyToClipboard-D1PN1vgU.js → CopyToClipboard-DOtA8ld0.js} +1 -1
  16. package/dist/assets/{Detail-D0qYh2hQ.js → Detail-Dv-Pp2l6.js} +2 -2
  17. package/dist/assets/{Extra-D400bY0a.js → Extra-D9uMhi5P.js} +1 -1
  18. package/dist/assets/{FilePreview-tLIDSh2u.js → FilePreview-OXl4Fg3S.js} +1 -1
  19. package/dist/assets/{Hailuo-BoOwIPFr.js → Hailuo-DenXn_SI.js} +1 -1
  20. package/dist/assets/{History-ByRTCDVX.js → History-C2qm7xMI.js} +1 -1
  21. package/dist/assets/{ImagePreview-CN8OBvU4.js → ImagePreview-Hobf9iDz.js} +1 -1
  22. package/dist/assets/{ImageWrapper-C3WAO4WL.js → ImageWrapper-CxTfG_75.js} +1 -1
  23. package/dist/assets/{Index-CBw5rFDD.js → Index-7Zr38hNp.js} +1 -1
  24. package/dist/assets/{Index-CGgiUKTv.js → Index-B0xf2jc2.js} +1 -1
  25. package/dist/assets/{Index-CbbR6v73.js → Index-Ba_HMwv_.js} +1 -1
  26. package/dist/assets/{Index-CN_ot8Xw.js → Index-Bfcbx1Y0.js} +1 -1
  27. package/dist/assets/{Index-BUa7JHRK2.js → Index-BgJ6peCC2.js} +1 -1
  28. package/dist/assets/{Index-BkON1ENg2.js → Index-BrOEl-5D2.js} +1 -1
  29. package/dist/assets/{Index-DLu-lbtD.js → Index-C1FTc9nK.js} +1 -1
  30. package/dist/assets/{Index-CG1H1lxh.js → Index-CAa5Pna_.js} +1 -1
  31. package/dist/assets/{Index-NR-TXNhu.js → Index-CFvtJ3aE.js} +1 -1
  32. package/dist/assets/{Index-kAFXP4SR.js → Index-CNN2otO1.js} +1 -1
  33. package/dist/assets/{Index-Cxj0UFHP2.js → Index-CSZsiOar2.js} +1 -1
  34. package/dist/assets/{Index-o6aKFfcj.js → Index-CYekrNsX.js} +1 -1
  35. package/dist/assets/{Index-BWoENnrp2.js → Index-Ch8nxLls2.js} +1 -1
  36. package/dist/assets/{Index-DRe7C-2X.js → Index-CrwLLNi2.js} +1 -1
  37. package/dist/assets/{Index-DE4eQtJi.js → Index-CtcgZ1n3.js} +1 -1
  38. package/dist/assets/{Index-DohINA4_.js → Index-CuYMEoEd.js} +1 -1
  39. package/dist/assets/{Index-sPcBvdwE.js → Index-Dck4cWKi.js} +1 -1
  40. package/dist/assets/{Index-DqTc0EO5.js → Index-DfqMv06d.js} +1 -1
  41. package/dist/assets/{Index-DXC_DoKm2.js → Index-DhL1PmZ92.js} +1 -1
  42. package/dist/assets/{Index-BNjCsOVJ.js → Index-DkGCj1na.js} +1 -1
  43. package/dist/assets/{Index-CyVD9tWl.js → Index-KFXZYXK_.js} +1 -1
  44. package/dist/assets/{Index-DkmWDmj1.js → Index-O2pj5hao.js} +1 -1
  45. package/dist/assets/{Index-Ci8e-H1m.js → Index-S4QxEDJr.js} +1 -1
  46. package/dist/assets/{Index-Dyxr3ovG.js → Index-YhSVSEiQ.js} +1 -1
  47. package/dist/assets/{Index-B3VMqnwj.js → Index-cZqeaFKP.js} +1 -1
  48. package/dist/assets/{Index-QriE6rA6.js → Index-f3Iy4-aj.js} +1 -1
  49. package/dist/assets/{Index-Co7amws1.js → Index-f57uYNwI.js} +1 -1
  50. package/dist/assets/{Index-X_aeyxlV.js → Index-fjI88O8-.js} +1 -1
  51. package/dist/assets/{Index-D1CLzJ50.js → Index-knquWXYE.js} +1 -1
  52. package/dist/assets/{Index-BlSXdk7C.js → Index-r9SH3Vpi.js} +1 -1
  53. package/dist/assets/{Index-D6DuslVp.js → Index-sOyTX1cw.js} +1 -1
  54. package/dist/assets/{Index-B9EzOHkk.js → Index-sbgpTmuB.js} +1 -1
  55. package/dist/assets/{Index-KcPzQgXd.js → Index-tOu0FCzM.js} +1 -1
  56. package/dist/assets/{Index-CzNm1XXi.js → Index-wCoGA9XY.js} +1 -1
  57. package/dist/assets/{Invitees-CneKtJVo.js → Invitees-cRgHRjXm.js} +1 -1
  58. package/dist/assets/{List-DAijs_ko.js → List-C8bBft35.js} +1 -1
  59. package/dist/assets/{List-D6vi6wYd.js → List-D_7sVyl_.js} +1 -1
  60. package/dist/assets/{List-toyeHOp3.js → List-GRz95oK2.js} +1 -1
  61. package/dist/assets/{LocalTools-DaGllIHE.js → LocalTools-B4oqRBCz.js} +1 -1
  62. package/dist/assets/{LocalTools-Bn7my_3W.js → LocalTools-C-4USNTM.js} +1 -1
  63. package/dist/assets/{Logo-ncmT-jcg.js → Logo-WaonQ8bO.js} +1 -1
  64. package/dist/assets/{Main-B0uTAftV.js → Main-BxVhte9H.js} +1 -1
  65. package/dist/assets/{Message-DeQBwFUk.js → Message-D-iwbcjQ.js} +1 -1
  66. package/dist/assets/{Model-BLLbBfD4.js → Model-YncaMO_M.js} +1 -1
  67. package/dist/assets/{Navigator-CSJ0YFuP.js → Navigator-BKP8pbED.js} +3 -3
  68. package/dist/assets/{NotFound-BbJAItAr.js → NotFound-CRCVjFm5.js} +1 -1
  69. package/dist/assets/{PageHeader-CdLs-fU1.js → PageHeader-DXr4vTJc.js} +1 -1
  70. package/dist/assets/{Pay-Bvaz3NA2.js → Pay-ZU3yeZKZ.js} +1 -1
  71. package/dist/assets/{Player-CjlYz11h.js → Player-BgklOHIu.js} +1 -1
  72. package/dist/assets/{Poivelle-Bygtcf3v.js → Poivelle-DrJxt8fE.js} +1 -1
  73. package/dist/assets/{RealtimeCall-BLGOJly0.js → RealtimeCall-COtxRnOy.js} +1 -1
  74. package/dist/assets/{ReportButton-YWxvQv7T.js → ReportButton-CjFO3h6Z.js} +1 -1
  75. package/dist/assets/{ReportDialog-Di6DDJwG.js → ReportDialog-k0KM8hcX.js} +1 -1
  76. package/dist/assets/{ScheduledTasks-BjCxMV41.js → ScheduledTasks-Cy8gkyWO.js} +1 -1
  77. package/dist/assets/{Status-BM8T5G6r.js → Status-KUCUEyHr.js} +1 -1
  78. package/dist/assets/{Subscribe-DOJfTMLv.js → Subscribe-DQB499Pp.js} +1 -1
  79. package/dist/assets/{TabSwitcher-wX5AvBMi.js → TabSwitcher-BMw7QdgX.js} +1 -1
  80. package/dist/assets/{Tts-DWmfoBBL.js → Tts-BoVvzbAr.js} +1 -1
  81. package/dist/assets/{VideoPlayer-Dqej3RIo.js → VideoPlayer-BCs9hDNt.js} +1 -1
  82. package/dist/assets/{VideoPreview-Bhxldvlh.js → VideoPreview-DItsY6mh.js} +1 -1
  83. package/dist/assets/arrow-down-C12wGQL2.js +1 -0
  84. package/dist/assets/{arrow-down-wide-narrow-DgeRLxF6.js → arrow-down-wide-narrow-Bh4T6Tzm.js} +1 -1
  85. package/dist/assets/arrow-left-DyDO296j.js +1 -0
  86. package/dist/assets/arrow-right-CxMk_jDv.js +1 -0
  87. package/dist/assets/arrow-up-D_XEe5Ar.js +1 -0
  88. package/dist/assets/{authorizeFlow-D3eNmeY0.js → authorizeFlow-B3Nt7nAD.js} +1 -1
  89. package/dist/assets/{avatar-C1Gr1iFR.js → avatar-B1I77BI1.js} +1 -1
  90. package/dist/assets/{basic-BjOB4_uV.js → basic-D92ELRZv.js} +1 -1
  91. package/dist/assets/{book-open-DYiFwFR1.js → book-open-DF_HMe1c.js} +1 -1
  92. package/dist/assets/{box-C0dtnlPA.js → box-DXHTJEv-.js} +1 -1
  93. package/dist/assets/{boxes-WbbO39Z7.js → boxes-DavlRUoK.js} +1 -1
  94. package/dist/assets/{brain-fZab3hXA.js → brain-D0PdfMvk.js} +1 -1
  95. package/dist/assets/{chart-no-axes-combined-BLVOA658.js → chart-no-axes-combined-BfoTJT5M.js} +1 -1
  96. package/dist/assets/{chat-CdKwsYWp.js → chat-CE-lIcks.js} +1 -1
  97. package/dist/assets/check-BtKW-lSp.js +1 -0
  98. package/dist/assets/chevron-down-D21JHfLA.js +1 -0
  99. package/dist/assets/chevron-right-DiuiNNMK.js +1 -0
  100. package/dist/assets/circle-check-DPDNVpIH.js +1 -0
  101. package/dist/assets/{circle-question-mark-DGOj7bbQ.js → circle-question-mark-BGlCGgB1.js} +1 -1
  102. package/dist/assets/{clipboard-list-K5kUJRig.js → clipboard-list-DP7ujt0b.js} +1 -1
  103. package/dist/assets/clock-DiJ9741Z.js +1 -0
  104. package/dist/assets/code-Bfk1Rov-.js +1 -0
  105. package/dist/assets/codingBridge-G6Y4WdO3.js +2 -0
  106. package/dist/assets/{codingBridgeNotify-CprVKydm.js → codingBridgeNotify-DhzLBDbQ.js} +2 -2
  107. package/dist/assets/{coins-B09dASJj.js → coins-BY3jXSEG.js} +1 -1
  108. package/dist/assets/{copy-BWb_FWmO.js → copy-fHzKDgD9.js} +1 -1
  109. package/dist/assets/{createTaskActions-A0OVVCwT.js → createTaskActions-BkEbfmbj.js} +1 -1
  110. package/dist/assets/{digitalhuman-DLHMifkO.js → digitalhuman-DbGCqPbt.js} +1 -1
  111. package/dist/assets/{dollar-sign-rKY0qNJp.js → dollar-sign-CywLXTmf.js} +1 -1
  112. package/dist/assets/{download-2Qdwx8V1.js → download-DSRjfbqn.js} +1 -1
  113. package/dist/assets/{drawer-CpQ_k9m7.js → drawer-B447BS-l.js} +1 -1
  114. package/dist/assets/{dropdown-E7h06hcM.js → dropdown-C4b0blEw.js} +1 -1
  115. package/dist/assets/{dropdown-B4C-n1xR.js → dropdown-DC5PJXV3.js} +1 -1
  116. package/dist/assets/{ellipsis-BAbKdRzM.js → ellipsis-CUUOTJ9U.js} +1 -1
  117. package/dist/assets/{esm-DhUI5IHK.js → esm-8KmjJ2jE.js} +1 -1
  118. package/dist/assets/esm-9b_XWwLO.js +1 -0
  119. package/dist/assets/{esm-hUh73nCP.js → esm-BF-WzaIe.js} +1 -1
  120. package/dist/assets/{esm-BhQXoKvx.js → esm-BdwrIVPV.js} +1 -1
  121. package/dist/assets/{esm-8LNL4PtX.js → esm-CfpOPTRX.js} +3 -3
  122. package/dist/assets/{esm-Dx6vr1T-.js → esm-Cq2sB5w8.js} +2 -2
  123. package/dist/assets/{esm-DlIIS3Js.js → esm-DIL76Orx.js} +2 -2
  124. package/dist/assets/{external-link-jGKw--J3.js → external-link-DhIWtDxn.js} +1 -1
  125. package/dist/assets/{eye-BrnoVXWO.js → eye-B376aKof.js} +1 -1
  126. package/dist/assets/{file-DOjVowKo.js → file-LnGz9WRY.js} +1 -1
  127. package/dist/assets/{file-output-CJCqrTiV.js → file-output-DhLnUzfl.js} +1 -1
  128. package/dist/assets/{file-text-Ba0Fr8hn.js → file-text-Xa4jOtFQ.js} +1 -1
  129. package/dist/assets/{fish-6OAgbtFq.js → fish-mHfM8qtb.js} +1 -1
  130. package/dist/assets/{flux-CKcmMOwb.js → flux-B9Wd1c9q.js} +1 -1
  131. package/dist/assets/{folder-BnpdAdOx.js → folder-Dr7ed_3M.js} +1 -1
  132. package/dist/assets/gauge-BHJ_x9lu.js +1 -0
  133. package/dist/assets/{globe-C3D_adfw.js → globe-DITBpAfp.js} +1 -1
  134. package/dist/assets/{grokvideo-NDONdHMX.js → grokvideo-DTAxljfK.js} +1 -1
  135. package/dist/assets/{hailuo-5QMzApl8.js → hailuo-kdyuRdKL.js} +1 -1
  136. package/dist/assets/{headphones-CypIUoNv.js → headphones-BHMQ3JR8.js} +1 -1
  137. package/dist/assets/{history-Cl0xyiad.js → history-CR2ZDOA8.js} +1 -1
  138. package/dist/assets/{house-D0dcqwOf.js → house-BvYUjpyM.js} +1 -1
  139. package/dist/assets/{image-FnjRJ4X3.js → image-HitLU7-H.js} +1 -1
  140. package/dist/assets/{index-C_sjkBHo.js → index-7B54VLaT.js} +3 -3
  141. package/dist/assets/{index.browser.esm-UdtCQBNM.js → index.browser.esm-BeoMwyWW.js} +1 -1
  142. package/dist/assets/{index.es-BG1Z8NLn.js → index.es-CZAzz816.js} +1 -1
  143. package/dist/assets/{info-BPaOsauW.js → info-DGrLjV90.js} +1 -1
  144. package/dist/assets/{input-number-DZm2a-qc.js → input-number-DmyxJw9i.js} +1 -1
  145. package/dist/assets/{key-round-CRtlOPGd.js → key-round-DUBNjRdW.js} +1 -1
  146. package/dist/assets/{kling-BaL7pFs9.js → kling-lqXFUEih.js} +1 -1
  147. package/dist/assets/{languages-CmmLg5T3.js → languages-CswjvEcB.js} +1 -1
  148. package/dist/assets/{laptop-DkpZomSM.js → laptop-86piQGgC.js} +1 -1
  149. package/dist/assets/{lightbulb-aSJr4j2E.js → lightbulb-BLFIvLgR.js} +1 -1
  150. package/dist/assets/{link-Bv9PD6RR.js → link-BeJB5PTF.js} +1 -1
  151. package/dist/assets/loader-circle-D1nh30ir.js +1 -0
  152. package/dist/assets/{lock-CFGc54H-.js → lock-PwvNeuPz.js} +1 -1
  153. package/dist/assets/{luma-xS8MPVmo.js → luma-C8RNy9ae.js} +1 -1
  154. package/dist/assets/{maestro-DzYdPz9V.js → maestro-RSbpfH-m.js} +1 -1
  155. package/dist/assets/{mail-DQmxUiBG.js → mail-Bry6yotN.js} +1 -1
  156. package/dist/assets/{message-circle-iOdDVQ4j.js → message-circle-BBY8sIXT.js} +1 -1
  157. package/dist/assets/{mic-BH3alSnw.js → mic-iQe2Zogu.js} +1 -1
  158. package/dist/assets/{midjourney-DdpmxYvW.js → midjourney-7QhCxCGB.js} +1 -1
  159. package/dist/assets/{mobileLocalExec-C0CZpyA3.js → mobileLocalExec-DPo3SzmW.js} +2 -2
  160. package/dist/assets/{monitor-D-Ihg5W_.js → monitor-CoR6vub6.js} +1 -1
  161. package/dist/assets/{mouse-pointer-2-o0odj8fp.js → mouse-pointer-2-BBn4GKTK.js} +1 -1
  162. package/dist/assets/music-2-D94avajN.js +1 -0
  163. package/dist/assets/{nanobanana-BhGJLST1.js → nanobanana-BL_PPnD0.js} +1 -1
  164. package/dist/assets/{omni-WA7vxGzT.js → omni-CNgYdQTj.js} +1 -1
  165. package/dist/assets/{openaiimage-mAx5FUGZ.js → openaiimage-D9oob_vc.js} +1 -1
  166. package/dist/assets/{pagination-D-uSyaRW.js → pagination-BEagsSLK.js} +1 -1
  167. package/dist/assets/{pagination-BM4GJ-Sf.js → pagination-CuiF_2-G.js} +1 -1
  168. package/dist/assets/{pagination-WL2poeB8.js → pagination-DD8isanr.js} +1 -1
  169. package/dist/assets/{palette-CaO47W0Z.js → palette-opevq_TJ.js} +1 -1
  170. package/dist/assets/{paperclip-8DZuzxqp.js → paperclip-wiMzhV80.js} +1 -1
  171. package/dist/assets/{pause-Q-Xq27LK.js → pause-DdhvQ3ws.js} +1 -1
  172. package/dist/assets/{pencil-CHl88iig.js → pencil-I6_OZ6iL.js} +1 -1
  173. package/dist/assets/{pika-ClI7CuKh.js → pika-YDBt0awL.js} +1 -1
  174. package/dist/assets/{pixverse-TreHn4sJ.js → pixverse-CfEzLhku.js} +1 -1
  175. package/dist/assets/play-D6tP12Kd.js +1 -0
  176. package/dist/assets/{plug-CVWmKuC_.js → plug-__6JvdP1.js} +1 -1
  177. package/dist/assets/plus-C0xbPTZz.js +1 -0
  178. package/dist/assets/{poivelle-6m5eBCZW.js → poivelle-BMBBOlFE.js} +1 -1
  179. package/dist/assets/{popover-DY8pHQut.js → popover-9KWOCLOr.js} +1 -1
  180. package/dist/assets/{producer-CzPcOHfn.js → producer-Ck0rcVi1.js} +1 -1
  181. package/dist/assets/{qrart-CMtw9xkh.js → qrart-CuCforO0.js} +1 -1
  182. package/dist/assets/{realtime-DvSWKMLp.js → realtime-4MIU5LfF.js} +1 -1
  183. package/dist/assets/{refresh-cw-C1aKOTkD.js → refresh-cw-DKwGI7SA.js} +1 -1
  184. package/dist/assets/rotate-ccw-XRrnoF-8.js +1 -0
  185. package/dist/assets/rotate-cw-9BVp5jAO.js +1 -0
  186. package/dist/assets/search-CYty4qCp.js +1 -0
  187. package/dist/assets/{seedance-Ds9N5QEg.js → seedance-FNPSrnoS.js} +1 -1
  188. package/dist/assets/{seedream-C5Qnaa_T.js → seedream-BWYVSdOp.js} +1 -1
  189. package/dist/assets/{select-ChyQns32.js → select-DBAlqBh7.js} +1 -1
  190. package/dist/assets/{serp-CP-qJKWH.js → serp-DgVgl7yC.js} +1 -1
  191. package/dist/assets/{shield-DGhAiApq.js → shield-AmkRPSzW.js} +1 -1
  192. package/dist/assets/{shuffle-BeuDPIr4.js → shuffle-DADlGKNz.js} +1 -1
  193. package/dist/assets/{slider-CY92XsCL.js → slider-CrosZNO7.js} +1 -1
  194. package/dist/assets/{solana-wallets-DgBa0FA_.js → solana-wallets-DbEizSsa.js} +2 -2
  195. package/dist/assets/{solana-wallets-vue-BM_tK09v.js → solana-wallets-vue-CDyIjfBe.js} +1 -1
  196. package/dist/assets/{sora-AEl9SE4P.js → sora-Bf_zPgQs.js} +1 -1
  197. package/dist/assets/{sparkles-Vz7bqEir.js → sparkles-Cs3PcmTJ.js} +1 -1
  198. package/dist/assets/square-ByMVgy9P.js +1 -0
  199. package/dist/assets/{store-g2x7jSoz.js → store-VYbVBG02.js} +1 -1
  200. package/dist/assets/{suno-DV1Tv46s.js → suno-CnP16ycb.js} +1 -1
  201. package/dist/assets/{switch-CI_r8TsE.js → switch-CSqIz9Bn.js} +1 -1
  202. package/dist/assets/{table-B5uHA9cN.js → table-C1vM8njh.js} +1 -1
  203. package/dist/assets/{tag-BN2GZemo.js → tag-CSnQ-ziY.js} +1 -1
  204. package/dist/assets/terminal-n5_CpByL.js +1 -0
  205. package/dist/assets/{time-picker-DE1ng7uG.js → time-picker-OKCizTeB.js} +1 -1
  206. package/dist/assets/{tooltip-pUbjR2xu.js → tooltip-DS2H_6sn.js} +1 -1
  207. package/dist/assets/{trash-2-BfVLvlm9.js → trash-2-aiyl_0iW.js} +1 -1
  208. package/dist/assets/{triangle-alert-BVAKaCSW.js → triangle-alert-D120-HZx.js} +1 -1
  209. package/dist/assets/{upload-CHxTlPO1.js → upload-CRKN-pH5.js} +1 -1
  210. package/dist/assets/user-C5WT4Jb8.js +1 -0
  211. package/dist/assets/{veo-jxagRwld.js → veo-CQgL5zHP.js} +1 -1
  212. package/dist/assets/{video-Dd3ZeLSG.js → video-B8mZ8t2N.js} +1 -1
  213. package/dist/assets/{volume-2-DGhYdIbk.js → volume-2-0ARHsbtR.js} +1 -1
  214. package/dist/assets/{wallet-eAa1xyTv.js → wallet-BcaYe3O4.js} +1 -1
  215. package/dist/assets/{wan-BFDTbf-Y.js → wan-DBuD9JcO.js} +1 -1
  216. package/dist/assets/{wand-sparkles-Dp_e6WgR.js → wand-sparkles-BYpsEWX0.js} +1 -1
  217. package/dist/assets/{web-BJoY2XNu.js → web-BOKsSuvR.js} +1 -1
  218. package/dist/assets/{web-DMA8SArr.js → web-D2yjoitU.js} +1 -1
  219. package/dist/assets/{web-Ck1DjjQD.js → web-DgRMu8I3.js} +1 -1
  220. package/dist/assets/{web-Lhwy08Bj.js → web-Do8nwMFO.js} +1 -1
  221. package/dist/assets/{web-Do11Qy5F.js → web-RspSdP7E.js} +1 -1
  222. package/dist/assets/{webextrator-CamKbO8I.js → webextrator-DjJ1F-W3.js} +1 -1
  223. package/dist/assets/{zap-DZhBoH3Y.js → zap-UbJGLhVu.js} +1 -1
  224. package/dist/index.html +1 -1
  225. package/package.json +1 -1
  226. package/dist/assets/arrow-down--gR3NaHz.js +0 -1
  227. package/dist/assets/arrow-left-B39EagFY.js +0 -1
  228. package/dist/assets/arrow-right-40WAcToQ.js +0 -1
  229. package/dist/assets/arrow-up-Q1ntqZpz.js +0 -1
  230. package/dist/assets/check-Vb1enwhA.js +0 -1
  231. package/dist/assets/chevron-down-BzsAsDSA.js +0 -1
  232. package/dist/assets/chevron-right-mC8jKx3p.js +0 -1
  233. package/dist/assets/circle-check-DaxMxK1P.js +0 -1
  234. package/dist/assets/clock-Varrr0Bl.js +0 -1
  235. package/dist/assets/code-BsfXj8Ll.js +0 -1
  236. package/dist/assets/codingBridge-Coed1aJm.js +0 -2
  237. package/dist/assets/esm-BzAEdgPN.js +0 -1
  238. package/dist/assets/gauge-JH86QFGZ.js +0 -1
  239. package/dist/assets/loader-circle-BMZu6eSq.js +0 -1
  240. package/dist/assets/music-2-BY9FsAt5.js +0 -1
  241. package/dist/assets/play-CC2cYJj4.js +0 -1
  242. package/dist/assets/plus-C2LaXZld.js +0 -1
  243. package/dist/assets/rotate-ccw-BI-R9yqW.js +0 -1
  244. package/dist/assets/rotate-cw-DbYFLksy.js +0 -1
  245. package/dist/assets/search-BIDVC-i5.js +0 -1
  246. package/dist/assets/square-hr7_vQe-.js +0 -1
  247. package/dist/assets/terminal-BVFIc0Qz.js +0 -1
  248. package/dist/assets/user-K2d3Fh6I.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 h,rt as g,st as _,tt as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{r as b,t as x}from"./select-ChyQns32.js";import{n as S,t as C}from"./tabs-BY90FIeI.js";import{t as w}from"./tooltip-pUbjR2xu.js";import{v as T}from"./models-ClsawnaQ.js";import{n as E,r as D,t as O}from"./dropdown-E7h06hcM.js";import{t as k}from"./pagination-WL2poeB8.js";import{t as A}from"./switch-CI_r8TsE.js";import{t as j}from"./arrow-down--gR3NaHz.js";import{t as M}from"./arrow-left-B39EagFY.js";import{t as N}from"./book-open-DYiFwFR1.js";import{t as P}from"./chevron-down-BzsAsDSA.js";import{t as F}from"./chevron-right-mC8jKx3p.js";import{t as I}from"./circle-check-DaxMxK1P.js";import{t as L}from"./circle-question-mark-DGOj7bbQ.js";import{t as ee}from"./clipboard-list-K5kUJRig.js";import{t as te}from"./code-BsfXj8Ll.js";import{t as R}from"./copy-BWb_FWmO.js";import{t as ne}from"./ellipsis-BAbKdRzM.js";import{t as re}from"./eye-BrnoVXWO.js";import{t as ie}from"./file-text-Ba0Fr8hn.js";import{t as z}from"./file-DOjVowKo.js";import{t as B}from"./folder-BnpdAdOx.js";import{t as ae}from"./image-FnjRJ4X3.js";import{t as oe}from"./lock-CFGc54H-.js";import{t as V}from"./plus-C2LaXZld.js";import{n as se,t as ce}from"./store-g2x7jSoz.js";import{t as le}from"./search-BIDVC-i5.js";import{t as ue}from"./trash-2-BfVLvlm9.js";import{t as de}from"./triangle-alert-BVAKaCSW.js";import{t as fe}from"./upload-CHxTlPO1.js";import{t as pe}from"./wand-sparkles-Dp_e6WgR.js";import{Ei as H,Er as U,Fi as W,Ni as me,O as G,Si as K,Ui as q,_i as he,bi as J,ci as ge,di as _e,fi as ve,oi as ye,pi as be,xi as xe}from"./index-C_sjkBHo.js";import{a as Se,c as Ce,d as we,f as Te,i as Ee,l as De,m as Y,n as Oe,o as ke,p as Ae,r as je,s as Me,t as Ne,u as Pe}from"./vendor-highlight-BHrfT4-E.js";import{t as Fe}from"./index.es-BG1Z8NLn.js";import{t as Ie}from"./VueMarkdown-CiiRjbWs.js";import{t as Le}from"./PageHeader-CdLs-fU1.js";var Re=J(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),ze=J(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),Be=J(`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`}]]),Ve=J(`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`}]]),He=J(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),X=()=>({baseURL:`${ye()}/api/v1`}),Z=new class{key=`skills/installed`;async list(){return U.get(`/${this.key}/`,X())}async get(e){return U.get(`/${this.key}/${e}/`,X())}async createMarkdown(e){return U.post(`/${this.key}/`,e,X())}async createTarball(e){let t=new FormData;return t.append(`tarball`,e),U.post(`/${this.key}/`,t,{...X(),headers:{"Content-Type":`multipart/form-data`}})}async update(e,t){return U.patch(`/${this.key}/${e}/`,t,X())}async remove(e){return U.delete(`/${this.key}/${e}/`,X())}async enable(e){return U.post(`/${this.key}/${e}/enable/`,void 0,X())}async disable(e){return U.post(`/${this.key}/${e}/disable/`,void 0,X())}async fetchFile(e,t){let n=await U.get(`/${this.key}/${e}/files/`,{...X(),params:{path:t},responseType:`arraybuffer`}),r=n.headers[`content-type`]||`application/octet-stream`;return{blob:new Blob([n.data],{type:r}),contentType:r}}},Q=new class{key=`skills`;async list(e={}){return U.get(`/${this.key}/`,{...X(),params:e})}async get(e){return U.get(`/${this.key}/${e}/`,X())}async categories(){return U.get(`/${this.key}/categories/`,X())}async install(e,t={}){return U.post(`/${this.key}/${e}/install/`,t,X())}};function Ue(){let e=new Set;ve()&&e.add(`desktop`),be()&&e.add(`ios`),_e()&&e.add(`android`),he()&&e.add(`web`);let t=ge();if(t===`mac`)e.add(`mac`);else if(t===`windows`)e.add(`windows`);else if(typeof navigator<`u`){let t=navigator.userAgent||``,n=navigator.userAgentData?.platform,r=/macintosh/i.test(t)&&(navigator.maxTouchPoints||0)>1;!be()&&!r&&(n===`macOS`||/mac os x|macintosh/i.test(t))&&e.add(`mac`),(n===`Windows`||/windows nt/i.test(t))&&e.add(`windows`)}return e}var We=new Set([`mac`,`windows`,`desktop`,`web`,`ios`,`android`]);function Ge(e){let t=e.filter(e=>We.has(e));if(!t.length)return!0;let n=Ue();return t.some(e=>n.has(e))}Y.registerLanguage(`bash`,Ae),Y.registerLanguage(`json`,Te),Y.registerLanguage(`markdown`,we),Y.registerLanguage(`python`,Pe),Y.registerLanguage(`shell`,De),Y.registerLanguage(`yaml`,Ce),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var Ke=12,qe=y({name:`BrowseSkillsDialog`,components:{VueMarkdown:Ie,ElDialog:H,ElInput:q,ElButton:W,ElPagination:k,ElSelect:b,ElOption:x,FontAwesomeIcon:Fe,AddIcon:V,BackIcon:M,DownIcon:j,InstallIcon:Re,LockIcon:oe,SearchIcon:le,SuccessIcon:I},directives:{loading:K},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`installed`],data(){return{loading:!1,installing:!1,items:[],total:0,currentPage:1,searchQuery:``,namespaceFilter:``,sortBy:`popular`,selectedItem:null,searchTimer:null,knownNamespaces:[],publisherByNamespace:{}}},computed:{pageSize(){return Ke},namespaceOptions(){let e=new Set(this.knownNamespaces);for(let t of this.items)e.add(t.namespace);return Array.from(e).sort().map(e=>({value:e,label:this.publisherForNamespace(e)}))},detailBody(){return this.selectedItem?this.selectedItem.content.replace(/^---\n[\s\S]*?\n---\n?/,``):``}},methods:{onOpen(){this.selectedItem=null,this.searchQuery=``,this.namespaceFilter=``,this.sortBy=`popular`,this.currentPage=1,this.knownNamespaces=[],this.publisherByNamespace={},this.loadFacets(),this.reload()},openDetail(e){this.selectedItem=e},async loadFacets(){try{let{data:e}=await Q.categories(),t=new Set;for(let n of e.namespaces)t.add(n.namespace);this.knownNamespaces=Array.from(t).sort()}catch(e){console.warn(`failed to load skill catalog facets`,e)}},reloadFromFirstPage(){this.currentPage=1,this.reload()},onPageChange(e){this.currentPage=e,this.reload(),this.$nextTick(()=>{let e=this.$el.querySelector(`.directory-grid-wrapper`);e&&(e.scrollTop=0)})},onSearchInput(){this.searchTimer!==null&&window.clearTimeout(this.searchTimer),this.searchTimer=window.setTimeout(()=>{this.searchTimer=null,this.reloadFromFirstPage()},250)},async reload(){this.loading=!0;try{let{data:e}=await Q.list({q:this.searchQuery.trim()||void 0,namespace:this.namespaceFilter||void 0,sort:this.sortBy,limit:this.pageSize,offset:(this.currentPage-1)*this.pageSize});this.items=e.items,this.total=e.total;for(let t of e.items)t.publisher&&(this.publisherByNamespace[t.namespace]=t.publisher)}catch(e){console.error(e),T.error(this.$t(`skill.directory.loadFailed`))}finally{this.loading=!1}},async onInstall(e){if(!this.installing&&!e.installed){if(!this.canInstallOnSurface(e)){T.warning(this.$t(`skill.directory.surfaceBlocked`,{platforms:this.surfaceLabels(e)}));return}this.installing=!0;try{let{data:t}=await Q.install(e.id);T.success(this.$t(`skill.directory.installSuccess`,{name:e.slug})),this.$emit(`installed`,t.id),e.installed=!0,e.install_count+=1}catch(t){let n=this.extractError(t);n.includes(`already exists`)?(e.installed=!0,T.warning(this.$t(`skill.directory.alreadyInstalled`,{name:e.slug}))):T.error(this.$t(`skill.directory.installFailed`,{detail:n}))}finally{this.installing=!1}}},extractError(e){return e?.response?.data?.detail||String(e)||`unknown error`},formatCount(e){return e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)},publisherForNamespace(e){if(this.publisherByNamespace[e])return this.publisherByNamespace[e];let t=this.items.find(t=>t.namespace===e);return t?t.publisher:e},restrictedSurfaces(e){let t=e.frontmatter?.surfaces;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim().toLowerCase()):[]},surfaceLabel(e){let t=`skill.directory.surface.${e}`,n=this.$t(t);return n===t?e:n},surfaceLabels(e){return this.restrictedSurfaces(e).map(e=>this.surfaceLabel(e)).join(` / `)},canInstallOnSurface(e){return Ge(this.restrictedSurfaces(e))}}}),Je={class:`directory`},Ye={class:`directory-main`},Xe={class:`directory-header`},Ze={class:`directory-controls`},Qe={class:`directory-grid-wrapper`},$e={key:0,class:`directory-empty`},et={key:1,class:`directory-grid`},tt=[`onClick`],nt={class:`directory-card-head`},rt={class:`directory-card-title`},it=[`title`],at=[`title`],ot=[`aria-label`,`title`,`onClick`],st=[`title`],ct={class:`directory-card-meta`},lt={class:`directory-card-publisher`},ut={key:0,class:`directory-card-count`},dt=[`title`],ft={class:`directory-card-desc`},pt={key:0,class:`directory-footer`},mt={class:`directory-detail-head`},ht={class:`directory-detail-actions`},gt=[`href`],_t={class:`directory-detail-body`},vt={class:`directory-detail-title`},yt={class:`directory-detail-meta`},bt={key:0},xt={key:1},St=[`title`],Ct={class:`directory-detail-desc`};function wt(u,h,_,y,b,x){let S=l(`search-icon`),C=l(`el-input`),w=l(`el-option`),T=l(`el-select`),E=l(`success-icon`),D=l(`lock-icon`),O=l(`add-icon`),k=l(`down-icon`),A=l(`el-pagination`),j=l(`back-icon`),M=l(`font-awesome-icon`),N=l(`el-button`),P=l(`install-icon`),F=l(`vue-markdown`),I=l(`el-dialog`),L=m(`loading`);return v(),f(I,{"model-value":u.modelValue,title:u.$t(`skill.dialog.directoryTitle`),width:`min(960px, 94vw)`,"align-center":``,class:`directory-dialog`,"close-on-click-modal":!u.installing,"show-close":!u.installing,"onUpdate:modelValue":h[5]||=e=>u.$emit(`update:modelValue`,e),onOpen:u.onOpen},{default:p(()=>[e(`div`,Je,[e(`main`,Ye,[u.selectedItem?(v(),s(c,{key:1},[e(`header`,mt,[e(`button`,{class:`directory-back-btn`,onClick:h[3]||=e=>u.selectedItem=null},[a(j,{size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`skill.directory.back`)),1)]),e(`div`,ht,[u.selectedItem.source_url?(v(),s(`a`,{key:0,href:u.selectedItem.source_url,target:`_blank`,class:`directory-link`},[a(M,{icon:`fa-brands fa-github`}),r(` `+i(u.$t(`skill.directory.viewSource`)),1)],8,gt)):o(``,!0),u.selectedItem.installed?(v(),f(N,{key:1,disabled:``,type:`success`,plain:``},{default:p(()=>[a(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`skill.directory.installed`)),1)]),_:1})):u.selectedItem.installable&&!u.canInstallOnSurface(u.selectedItem)?(v(),f(N,{key:2,disabled:``,title:u.$t(`skill.directory.surfaceBlocked`,{platforms:u.surfaceLabels(u.selectedItem)})},{default:p(()=>[a(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`skill.directory.surfaceUnavailable`)),1)]),_:1},8,[`title`])):u.selectedItem.installable?(v(),f(N,{key:3,type:`primary`,loading:u.installing,onClick:h[4]||=e=>u.onInstall(u.selectedItem)},{default:p(()=>[a(P,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`skill.directory.install`)),1)]),_:1},8,[`loading`])):(v(),f(N,{key:4,disabled:``,title:u.selectedItem.license},{default:p(()=>[a(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.selectedItem.license||u.$t(`skill.directory.notInstallable`)),1)]),_:1},8,[`title`]))])]),e(`div`,_t,[e(`h2`,vt,`/`+i(u.selectedItem.slug),1),e(`div`,yt,[e(`span`,null,[e(`strong`,null,i(u.$t(`skill.meta.addedBy`))+`:`,1),r(` `+i(u.selectedItem.publisher),1)]),u.selectedItem.license?(v(),s(`span`,bt,[e(`strong`,null,i(u.$t(`skill.directory.license`))+`:`,1),r(` `+i(u.selectedItem.license),1)])):o(``,!0),u.selectedItem.version?(v(),s(`span`,xt,`v`+i(u.selectedItem.version),1)):o(``,!0),u.surfaceLabels(u.selectedItem)?(v(),s(`span`,{key:2,class:`directory-detail-surface`,title:u.$t(`skill.directory.surfaceHint`)},i(u.$t(`skill.directory.surfaceOnly`,{platforms:u.surfaceLabels(u.selectedItem)})),9,St)):o(``,!0)]),e(`p`,Ct,i(u.selectedItem.description),1),a(F,{class:`directory-detail-content`,source:u.detailBody,sanitize:``},null,8,[`source`])])],64)):(v(),s(c,{key:0},[e(`header`,Xe,[a(C,{modelValue:u.searchQuery,"onUpdate:modelValue":h[0]||=e=>u.searchQuery=e,class:`directory-search`,size:`default`,clearable:``,placeholder:u.$t(`skill.directory.searchPlaceholder`),onInput:u.onSearchInput},{prefix:p(()=>[a(S,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`,`onInput`]),e(`div`,Ze,[a(T,{modelValue:u.namespaceFilter,"onUpdate:modelValue":h[1]||=e=>u.namespaceFilter=e,class:`directory-select`,placeholder:u.$t(`skill.directory.allPublishers`),clearable:``,size:`default`,onChange:u.reloadFromFirstPage},{default:p(()=>[(v(!0),s(c,null,g(u.namespaceOptions,e=>(v(),f(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),a(T,{modelValue:u.sortBy,"onUpdate:modelValue":h[2]||=e=>u.sortBy=e,class:`directory-select directory-select-sm`,size:`default`,onChange:u.reloadFromFirstPage},{default:p(()=>[a(w,{label:u.$t(`skill.directory.sort.popular`),value:`popular`},null,8,[`label`]),a(w,{label:u.$t(`skill.directory.sort.recent`),value:`recent`},null,8,[`label`]),a(w,{label:u.$t(`skill.directory.sort.name`),value:`name`},null,8,[`label`])]),_:1},8,[`modelValue`,`onChange`])])]),d((v(),s(`div`,Qe,[!u.loading&&u.total===0?(v(),s(`p`,$e,i(u.$t(`skill.directory.empty`)),1)):(v(),s(`div`,et,[(v(!0),s(c,null,g(u.items,c=>(v(),s(`article`,{key:c.id,class:n([`directory-card`,{"is-installed":c.installed}]),onClick:e=>u.openDetail(c)},[e(`div`,nt,[e(`span`,rt,`/`+i(c.slug),1),c.installed?(v(),s(`span`,{key:0,class:`directory-card-action is-installed`,title:u.$t(`skill.directory.installed`)},[a(E,{size:16,"aria-hidden":`true`,focusable:`false`})],8,it)):c.installable&&!u.canInstallOnSurface(c)?(v(),s(`span`,{key:1,class:`directory-card-locked`,title:u.$t(`skill.directory.surfaceBlocked`,{platforms:u.surfaceLabels(c)})},[a(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,at)):c.installable?(v(),s(`button`,{key:2,class:`directory-card-action`,"aria-label":u.$t(`skill.directory.install`),title:u.$t(`skill.directory.install`),onClick:t(e=>u.onInstall(c),[`stop`])},[a(O,{size:16,"aria-hidden":`true`,focusable:`false`})],8,ot)):(v(),s(`span`,{key:3,class:`directory-card-locked`,title:c.license},[a(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,st))]),e(`div`,ct,[e(`span`,lt,i(c.publisher),1),c.install_count>0?(v(),s(`span`,ut,[a(k,{size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.formatCount(c.install_count)),1)])):o(``,!0),u.surfaceLabels(c)?(v(),s(`span`,{key:1,class:`directory-card-surface`,title:u.$t(`skill.directory.surfaceHint`)},i(u.surfaceLabels(c)),9,dt)):o(``,!0)]),e(`p`,ft,i(c.description),1)],10,tt))),128))]))])),[[L,u.loading]]),u.total>u.pageSize?(v(),s(`footer`,pt,[a(A,{"current-page":u.currentPage,"page-size":u.pageSize,total:u.total,"pager-count":5,background:``,layout:`prev, pager, next, total`,onCurrentChange:u.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onCurrentChange`])])):o(``,!0)],64))])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`show-close`,`onOpen`])}var Tt=G(qe,[[`render`,wt],[`__scopeId`,`data-v-a9be2dc3`]]);Y.registerLanguage(`bash`,Ae),Y.registerLanguage(`css`,Me),Y.registerLanguage(`go`,ke),Y.registerLanguage(`javascript`,Se),Y.registerLanguage(`json`,Te),Y.registerLanguage(`markdown`,we),Y.registerLanguage(`python`,Pe),Y.registerLanguage(`rust`,Ee),Y.registerLanguage(`shell`,De),Y.registerLanguage(`sql`,je),Y.registerLanguage(`typescript`,Oe),Y.registerLanguage(`xml`,Ne),Y.registerLanguage(`html`,Ne),Y.registerLanguage(`yaml`,Ce),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),Y.registerAliases([`js`,`jsx`],{languageName:`javascript`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`rs`],{languageName:`rust`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var $=1e6;function Et(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 Dt(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Y.getLanguage(t)?t:`plain`}var Ot=y({name:`SkillFilePreview`,components:{ElButton:W,ElTooltip:w,ElTabs:S,ElTabPane:C,CodeIcon:te,CopyIcon:R,FileIcon:z,SaveIcon:Ve,ViewIcon:re,WarningIcon:de,VueMarkdown:Ie},directives:{loading:K},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}},computed:{kind(){return this.path?Et(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${Dt(this.path)}`},truncatedText(){return this.textContent}},watch:{path:{handler(){this.fetch()},immediate:!0}},beforeUnmount(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl)},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.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 Z.fetchFile(this.skillId,this.path);this.contentType=t,this.size=e.size;let n=Et(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,Y.highlightElement(e))},async onCopy(){if(this.textContent)try{await navigator.clipboard.writeText(this.textContent),T.success(this.$t(`skill.preview.copied`))}catch{T.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}}}}),kt={class:`preview-root`},At={class:`toolbar`},jt={class:`path-display`},Mt={key:0,class:`size-display`},Nt={class:`body`},Pt={key:0,class:`error`},Ft=[`srcdoc`],It={key:3,class:`image-pane`},Lt=[`src`,`alt`],Rt={key:4,class:`binary`},zt=[`placeholder`],Bt={key:6,class:`source-pane`},Vt={key:7,class:`truncated-warning`};function Ht(t,c,h,g,_,y){let b=l(`save-icon`),x=l(`el-button`),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((v(),s(`div`,kt,[e(`div`,At,[e(`span`,jt,i(t.path||`—`),1),t.size?(v(),s(`span`,Mt,i(t.humanSize(t.size)),1)):o(``,!0),c[3]||=e(`span`,{class:`toolbar-spacer`},null,-1),t.editable?(v(),f(x,{key:1,type:`primary`,size:`small`,disabled:!t.dirty||t.saving,loading:t.saving,onClick:t.onSave},{default:p(()=>[a(b,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.save`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])):o(``,!0),a(C,{content:t.$t(`skill.preview.copy`),placement:`bottom`},{default:p(()=>[a(x,{size:`small`,circle:``,disabled:!t.textContent,"aria-label":t.$t(`skill.preview.copy`),title:t.$t(`skill.preview.copy`),onClick:t.onCopy},{default:p(()=>[a(S,{size:16,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`disabled`,`aria-label`,`title`,`onClick`])]),_:1},8,[`content`])]),t.canRender?(v(),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`,Nt,[t.error?(v(),s(`div`,Pt,[a(O,{class:`mr-2`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.error),1)])):t.kind===`markdown`&&t.viewMode===`rendered`?(v(),f(k,{key:1,class:`markdown-rendered`,source:t.textContent,sanitize:``},null,8,[`source`])):t.kind===`html`&&t.viewMode===`rendered`?(v(),s(`iframe`,{key:2,ref:`htmlFrame`,class:`html-frame`,sandbox:``,srcdoc:t.textContent},null,8,Ft)):t.kind===`image`?(v(),s(`div`,It,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,Lt)])):t.kind===`binary`?(v(),s(`div`,Rt,[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((v(),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,zt)),[[u,t.textContent]]):(v(),s(`pre`,Bt,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(v(),s(`p`,Vt,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):o(``,!0)])])),[[j,t.loading]])}var Ut=G(Ot,[[`render`,Ht],[`__scopeId`,`data-v-ec0a447e`]]),Wt=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),Gt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Kt(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?N:n===`md`?ie:Gt.has(n)?ae:Wt.has(n)?Be:z}function qt(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 Jt=y({name:`FileNode`,components:{ExpandDownIcon:P,ExpandRightIcon:F,FontAwesomeIcon:Fe},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?Kt(e.path):B},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),Yt=[`aria-label`,`title`],Xt={key:1,class:`node-chevron-spacer`},Zt={class:`node-label`},Qt={key:0,class:`children`};function $t(r,a,u,d,p,m){let y=l(`expand-down-icon`),b=l(`expand-right-icon`),x=l(`font-awesome-icon`),S=l(`file-node`,!0);return v(),s(`li`,null,[e(`div`,{class:n([`file-node`,{active:r.isActive}]),style:h({paddingLeft:r.indent+`px`}),onClick:a[1]||=(...e)=>r.onClick&&r.onClick(...e)},[r.node.isLeaf?(v(),s(`span`,Xt)):(v(),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?(v(),f(y,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(v(),f(b,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,Yt)),r.isHtmlFile(r.node)?(v(),f(x,{key:2,icon:`fa-brands fa-html5`,class:`node-icon`})):(v(),f(_(r.iconFor(r.node)),{key:3,class:`node-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),e(`span`,Zt,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(v(),s(`ul`,Qt,[(v(!0),s(c,null,g(r.node.children||[],e=>(v(),f(S,{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 en=y({name:`SkillRow`,components:{ExpandDownIcon:P,ExpandRightIcon:F,SkillIcon:se,FileNode:G(Jt,[[`render`,$t],[`__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 qt(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)}}}),tn={class:`skill-row-wrapper`},nn=[`aria-label`,`title`],rn={key:1,class:`row-chevron-spacer`},an=[`title`],on={key:0,class:`file-list`};function sn(r,u,d,p,m,h){let _=l(`expand-down-icon`),y=l(`expand-right-icon`),b=l(`skill-icon`),x=l(`file-node`);return v(),s(`li`,tn,[e(`div`,{class:n([`skill-row`,{active:r.isSkillSelected}]),onClick:u[1]||=e=>r.$emit(`select-skill`,r.skill)},[r.hasChildren?(v(),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?(v(),f(_,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(v(),f(y,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,nn)):(v(),s(`span`,rn)),a(b,{class:`row-icon`,size:16,"aria-hidden":`true`,focusable:`false`}),e(`span`,{class:`row-label`,title:r.skill.name},i(r.skill.slug),9,an)],2),r.expanded&&r.hasChildren?(v(),s(`ul`,on,[(v(!0),s(c,null,g(r.tree,e=>(v(),f(x,{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 cn=G(en,[[`render`,sn],[`__scopeId`,`data-v-231c2ce1`]]),ln=10*1024*1024,un=/\.(tar\.gz|tgz|tar|zip|md)$/i,dn=y({name:`UploadSkillDialog`,components:{ElDialog:H,ElButton:W,AddFileIcon:He,CloudUploadIcon:ze},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{file:null,isDragging:!1,uploading:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.uploading||this.$emit(`update:modelValue`,!1)},reset(){this.file=null,this.isDragging=!1;let e=this.$refs.fileInput;e&&(e.value=``)},humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},onPickFile(){this.uploading||this.$refs.fileInput?.click()},onFilePicked(e){let t=e.target.files?.[0]||null;this.acceptFile(t)},onDrop(e){this.isDragging=!1;let t=e.dataTransfer?.files?.[0]||null;this.acceptFile(t)},acceptFile(e){if(!e){this.file=null;return}if(e.size>ln){T.error(this.$t(`skill.message.fileTooLarge`));return}if(!un.test(e.name)){T.error(this.$t(`skill.message.fileTypeWrong`));return}this.file=e},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.file){this.uploading=!0;try{if(/\.md$/i.test(this.file.name)){let e=await this.file.text(),{data:t}=await Z.createMarkdown({content:e});T.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,t.id)}else{let{data:e}=await Z.createTarball(this.file);T.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id)}this.$emit(`update:modelValue`,!1)}catch(e){T.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.uploading=!1}}}}}),fn={key:0,class:`dropzone-hint`},pn={key:1,class:`dropzone-file`},mn={class:`dropzone-file-name`},hn={class:`dropzone-file-size`},gn={class:`requirements`},_n={class:`requirements-title`};function vn(o,c,u,d,m,h){let g=l(`add-file-icon`),_=l(`el-button`),y=l(`cloud-upload-icon`),b=l(`el-dialog`);return v(),f(b,{"model-value":o.modelValue,title:o.$t(`skill.dialog.uploadTitle`),width:`min(520px, 94vw)`,"align-center":``,"close-on-click-modal":!o.uploading,"close-on-press-escape":!o.uploading,"show-close":!o.uploading,"onUpdate:modelValue":o.onVisibleChange,onClosed:o.reset},{footer:p(()=>[a(_,{disabled:o.uploading,onClick:o.onClose},{default:p(()=>[r(i(o.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),a(_,{type:`primary`,loading:o.uploading,disabled:!o.file,onClick:o.onSubmit},{default:p(()=>[a(y,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(o.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:p(()=>[e(`input`,{ref:`fileInput`,type:`file`,accept:`.tar.gz,.tgz,.tar,.zip,.md,application/gzip,application/zip,application/x-tar,text/markdown`,hidden:``,onChange:c[0]||=(...e)=>o.onFilePicked&&o.onFilePicked(...e)},null,544),e(`div`,{class:n([`dropzone`,{"is-dragging":o.isDragging,"has-file":!!o.file}]),onClick:c[1]||=(...e)=>o.onPickFile&&o.onPickFile(...e),onDragover:c[2]||=t(e=>o.isDragging=!0,[`prevent`]),onDragleave:c[3]||=t(e=>o.isDragging=!1,[`prevent`]),onDrop:c[4]||=t((...e)=>o.onDrop&&o.onDrop(...e),[`prevent`])},[a(g,{class:`dropzone-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),o.file?(v(),s(`p`,pn,[e(`span`,mn,i(o.file.name),1),e(`span`,hn,i(o.humanSize(o.file.size)),1)])):(v(),s(`p`,fn,i(o.$t(`skill.dialog.uploadDrop`)),1))],34),e(`div`,gn,[e(`p`,_n,i(o.$t(`skill.dialog.fileRequirements`)),1),e(`ul`,null,[e(`li`,null,i(o.$t(`skill.dialog.requirementMd`)),1),e(`li`,null,i(o.$t(`skill.dialog.requirementArchive`)),1)])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var yn=G(dn,[[`render`,vn],[`__scopeId`,`data-v-01ead824`]]),bn=y({name:`WriteSkillDialog`,components:{ElDialog:H,ElButton:W,ElInput:q,CloudUploadIcon:ze},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{content:``,saving:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.saving||this.$emit(`update:modelValue`,!1)},reset(){this.content=``},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.content.trim()){this.saving=!0;try{let{data:e}=await Z.createMarkdown({content:this.content});T.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id),this.$emit(`update:modelValue`,!1)}catch(e){T.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.saving=!1}}}}}),xn={class:`hint`};function Sn(t,n,o,s,c,u){let d=l(`el-input`),m=l(`el-button`),h=l(`cloud-upload-icon`),g=l(`el-dialog`);return v(),f(g,{"model-value":t.modelValue,title:t.$t(`skill.dialog.writeTitle`),width:`min(720px, 94vw)`,"align-center":``,"close-on-click-modal":!t.saving,"close-on-press-escape":!t.saving,"show-close":!t.saving,"onUpdate:modelValue":t.onVisibleChange,onClosed:t.reset},{footer:p(()=>[a(m,{disabled:t.saving,onClick:t.onClose},{default:p(()=>[r(i(t.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),a(m,{type:`primary`,loading:t.saving,disabled:!t.content.trim(),onClick:t.onSubmit},{default:p(()=>[a(h,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:p(()=>[e(`p`,xn,i(t.$t(`skill.dialog.writeHint`)),1),a(d,{modelValue:t.content,"onUpdate:modelValue":n[0]||=e=>t.content=e,type:`textarea`,rows:18,placeholder:t.$t(`skill.placeholder.content`),spellcheck:`false`,class:`editor`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var Cn=y({name:`UserSkills`,components:{ConsolePageHeader:Le,ElInput:q,ElSwitch:A,ElTag:me,ElTooltip:w,ElDropdown:O,ElDropdownMenu:D,ElDropdownItem:E,AddIcon:V,AiCreateIcon:pe,DeleteIcon:ue,ExpandDownIcon:P,ExpandRightIcon:F,HelpIcon:L,MarketplaceIcon:ce,MoreIcon:ne,SearchIcon:le,SkillIcon:se,UploadIcon:fe,WriteIcon:ee,BrowseSkillsDialog:Tt,SkillFilePreview:Ut,SkillRow:cn,UploadSkillDialog:yn,WriteSkillDialog:G(bn,[[`render`,Sn],[`__scopeId`,`data-v-f39aab5d`]])},directives:{loading:K},data(){return{loading:!1,skills:[],togglingId:null,selectedSkillId:``,selectedPath:``,expandedSkillIds:[],personalOpen:!0,globalsOpen:!0,searchQuery:``,uploadVisible:!1,writeVisible:!1,browseVisible:!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 Z.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),T.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.browseVisible=!0},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 Z.update(this.selectedSkill.id,{content:e});T.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){T.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)})),t.reject(e)}},async onDelete(e){try{await xe.confirm(this.$t(`skill.message.deleteConfirm`,{slug:e.slug}),this.$t(`skill.button.delete`),{type:`warning`})}catch{return}try{await Z.remove(e.id),T.success(this.$t(`skill.message.deleteSuccess`)),this.selectedSkillId===e.id&&(this.selectedSkillId=``,this.selectedPath=``),await this.fetchSkills()}catch(e){T.error(this.extractError(e))}},async onToggleSkill(e,t){this.togglingId=e.id;try{t?(await Z.enable(e.id),T.success(this.$t(`skill.message.enableSuccess`))):(await Z.disable(e.id),T.success(this.$t(`skill.message.disableSuccess`))),e.enabled=t}catch(e){T.error(this.extractError(e))}finally{this.togglingId=null}}}}),wn={class:`skills-page`},Tn={class:`skills-shell`},En={class:`left-pane`},Dn={class:`left-header`},On=[`aria-label`,`title`],kn={class:`submenu-trigger`},An={class:`badge-soon`},jn={class:`left-body`},Mn={class:`section`},Nn={key:0,class:`skill-list`},Pn={key:0,class:`empty-row`},Fn={key:0,class:`section`},In={key:0,class:`skill-list`},Ln={class:`right-pane`},Rn={class:`right-header`},zn={class:`right-title`},Bn={class:`right-actions`},Vn=[`aria-label`,`title`],Hn={class:`meta-card`},Un={class:`meta-grid`},Wn={class:`meta-cell`},Gn={class:`meta-label`},Kn={class:`meta-value`},qn={class:`meta-cell`},Jn={class:`meta-label`},Yn={class:`meta-value`},Xn={key:0,class:`meta-cell`},Zn={class:`meta-label`},Qn={class:`meta-tags`},$n={key:0,class:`meta-description`},er={class:`meta-description-label`},tr={class:`meta-label`},nr={class:`preview-card`},rr={key:2,class:`right-empty`};function ir(t,n,u,h,_,y){let b=l(`console-page-header`),x=l(`search-icon`),S=l(`el-input`),C=l(`add-icon`),w=l(`marketplace-icon`),T=l(`el-dropdown-item`),E=l(`expand-right-icon`),D=l(`ai-create-icon`),O=l(`write-icon`),k=l(`upload-icon`),A=l(`el-dropdown-menu`),j=l(`el-dropdown`),M=l(`expand-down-icon`),N=l(`skill-row`),P=l(`el-switch`),F=l(`more-icon`),I=l(`delete-icon`),L=l(`el-tag`),ee=l(`help-icon`),te=l(`el-tooltip`),R=l(`skill-file-preview`),ne=l(`skill-icon`),re=l(`upload-skill-dialog`),ie=l(`write-skill-dialog`),z=l(`browse-skills-dialog`),B=m(`loading`);return v(),s(`div`,wn,[a(b,{title:t.$t(`skill.title.skills`),subtitle:t.$t(`skill.message.pageDescription`)},null,8,[`title`,`subtitle`]),e(`div`,Tn,[e(`aside`,En,[e(`header`,Dn,[a(S,{modelValue:t.searchQuery,"onUpdate:modelValue":n[0]||=e=>t.searchQuery=e,class:`search-input`,size:`default`,clearable:``,placeholder:t.$t(`skill.placeholder.search`)},{prefix:p(()=>[a(x,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`]),a(j,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:p(()=>[a(A,{class:`add-menu`},{default:p(()=>[a(T,{onClick:t.onBrowse},{default:p(()=>[a(w,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),a(T,{divided:``},{default:p(()=>[a(j,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:p(()=>[a(A,{class:`add-menu`},{default:p(()=>[a(T,{disabled:``},{default:p(()=>[a(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),e(`span`,An,i(t.$t(`skill.menu.soon`)),1)]),_:1}),a(T,{onClick:t.openWrite},{default:p(()=>[a(O,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),a(T,{onClick:t.openUpload},{default:p(()=>[a(k,{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`,kn,[a(C,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),a(E,{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(C,{size:16,"aria-hidden":`true`,focusable:`false`})],8,On)]),_:1})]),d((v(),s(`div`,jn,[e(`section`,Mn,[e(`button`,{class:`section-header`,onClick:n[1]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(v(),f(M,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(v(),f(E,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.personal`)),1)]),t.personalOpen?(v(),s(`ul`,Nn,[!t.loading&&t.filteredPersonal.length===0?(v(),s(`li`,Pn,i(t.searchQuery?t.$t(`skill.empty.search`):t.$t(`skill.message.noSkills`)),1)):o(``,!0),(v(!0),s(c,null,g(t.filteredPersonal,e=>(v(),f(N,{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?(v(),s(`section`,Fn,[e(`button`,{class:`section-header`,onClick:n[2]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(v(),f(M,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(v(),f(E,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.platform`)),1)]),t.globalsOpen?(v(),s(`ul`,In,[(v(!0),s(c,null,g(t.filteredGlobal,e=>(v(),f(N,{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)])),[[B,t.loading]])]),e(`main`,Ln,[t.selectedSkill&&!t.selectedPath?(v(),s(c,{key:0},[e(`header`,Rn,[e(`h3`,zn,i(t.selectedSkill.slug),1),e(`div`,Bn,[a(P,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:n[3]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?o(``,!0):(v(),f(j,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:p(()=>[a(A,null,{default:p(()=>[a(T,{onClick:n[4]||=e=>t.onDelete(t.selectedSkill)},{default:p(()=>[a(I,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.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(F,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Vn)]),_:1}))])]),e(`div`,Hn,[e(`div`,Un,[e(`div`,Wn,[e(`span`,Gn,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,Kn,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,qn,[e(`span`,Jn,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,Yn,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(v(),s(`div`,Xn,[e(`span`,Zn,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,Qn,[(v(!0),s(c,null,g(t.selectedSkill.required_connections,e=>(v(),f(L,{key:e,size:`small`,type:`info`},{default:p(()=>[r(i(e),1)]),_:2},1024))),128))])])):o(``,!0)]),t.selectedSkill.description?(v(),s(`div`,$n,[e(`div`,er,[e(`span`,tr,i(t.$t(`skill.field.description`)),1),t.selectedSkill.when_to_use?(v(),f(te,{key:0,content:t.selectedSkill.when_to_use,placement:`top`},{default:p(()=>[a(ee,{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`,nr,[(v(),f(R,{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?(v(),f(R,{key:`${t.selectedSkill.id}:${t.selectedPath}`,"skill-id":t.selectedSkill.id,path:t.selectedPath,editable:!1},null,8,[`skill-id`,`path`])):(v(),s(`div`,rr,[a(ne,{class:`right-empty-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.selectSkill`)),1)]))])]),a(re,{modelValue:t.uploadVisible,"onUpdate:modelValue":n[5]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),a(ie,{modelValue:t.writeVisible,"onUpdate:modelValue":n[6]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),a(z,{modelValue:t.browseVisible,"onUpdate:modelValue":n[7]||=e=>t.browseVisible=e,onInstalled:t.onCreated},null,8,[`modelValue`,`onInstalled`])])}var ar=G(Cn,[[`render`,ir],[`__scopeId`,`data-v-e3209347`]]);export{ar 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 h,rt as g,st as _,tt as v,z as y}from"./vendor-chart-Dw-P17PN.js";import{r as b,t as x}from"./select-DBAlqBh7.js";import{n as S,t as C}from"./tabs-BY90FIeI.js";import{t as w}from"./tooltip-DS2H_6sn.js";import{v as T}from"./models-ClsawnaQ.js";import{n as E,r as D,t as O}from"./dropdown-C4b0blEw.js";import{t as k}from"./pagination-DD8isanr.js";import{t as A}from"./switch-CSqIz9Bn.js";import{t as j}from"./arrow-down-C12wGQL2.js";import{t as M}from"./arrow-left-DyDO296j.js";import{t as N}from"./book-open-DF_HMe1c.js";import{t as P}from"./chevron-down-D21JHfLA.js";import{t as F}from"./chevron-right-DiuiNNMK.js";import{t as I}from"./circle-check-DPDNVpIH.js";import{t as L}from"./circle-question-mark-BGlCGgB1.js";import{t as ee}from"./clipboard-list-DP7ujt0b.js";import{t as te}from"./code-Bfk1Rov-.js";import{t as R}from"./copy-fHzKDgD9.js";import{t as ne}from"./ellipsis-CUUOTJ9U.js";import{t as re}from"./eye-B376aKof.js";import{t as ie}from"./file-text-Xa4jOtFQ.js";import{t as z}from"./file-LnGz9WRY.js";import{t as B}from"./folder-Dr7ed_3M.js";import{t as ae}from"./image-HitLU7-H.js";import{t as oe}from"./lock-PwvNeuPz.js";import{t as V}from"./plus-C0xbPTZz.js";import{n as se,t as ce}from"./store-VYbVBG02.js";import{t as le}from"./search-CYty4qCp.js";import{t as ue}from"./trash-2-aiyl_0iW.js";import{t as de}from"./triangle-alert-D120-HZx.js";import{t as fe}from"./upload-CRKN-pH5.js";import{t as pe}from"./wand-sparkles-BYpsEWX0.js";import{Ei as H,Er as U,Fi as W,Ni as me,O as G,Si as K,Ui as q,_i as he,bi as J,ci as ge,di as _e,fi as ve,oi as ye,pi as be,xi as xe}from"./index-7B54VLaT.js";import{a as Se,c as Ce,d as we,f as Te,i as Ee,l as De,m as Y,n as Oe,o as ke,p as Ae,r as je,s as Me,t as Ne,u as Pe}from"./vendor-highlight-BHrfT4-E.js";import{t as Fe}from"./index.es-CZAzz816.js";import{t as Ie}from"./VueMarkdown-CiiRjbWs.js";import{t as Le}from"./PageHeader-DXr4vTJc.js";var Re=J(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),ze=J(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),Be=J(`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`}]]),Ve=J(`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`}]]),He=J(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),X=()=>({baseURL:`${ye()}/api/v1`}),Z=new class{key=`skills/installed`;async list(){return U.get(`/${this.key}/`,X())}async get(e){return U.get(`/${this.key}/${e}/`,X())}async createMarkdown(e){return U.post(`/${this.key}/`,e,X())}async createTarball(e){let t=new FormData;return t.append(`tarball`,e),U.post(`/${this.key}/`,t,{...X(),headers:{"Content-Type":`multipart/form-data`}})}async update(e,t){return U.patch(`/${this.key}/${e}/`,t,X())}async remove(e){return U.delete(`/${this.key}/${e}/`,X())}async enable(e){return U.post(`/${this.key}/${e}/enable/`,void 0,X())}async disable(e){return U.post(`/${this.key}/${e}/disable/`,void 0,X())}async fetchFile(e,t){let n=await U.get(`/${this.key}/${e}/files/`,{...X(),params:{path:t},responseType:`arraybuffer`}),r=n.headers[`content-type`]||`application/octet-stream`;return{blob:new Blob([n.data],{type:r}),contentType:r}}},Q=new class{key=`skills`;async list(e={}){return U.get(`/${this.key}/`,{...X(),params:e})}async get(e){return U.get(`/${this.key}/${e}/`,X())}async categories(){return U.get(`/${this.key}/categories/`,X())}async install(e,t={}){return U.post(`/${this.key}/${e}/install/`,t,X())}};function Ue(){let e=new Set;ve()&&e.add(`desktop`),be()&&e.add(`ios`),_e()&&e.add(`android`),he()&&e.add(`web`);let t=ge();if(t===`mac`)e.add(`mac`);else if(t===`windows`)e.add(`windows`);else if(typeof navigator<`u`){let t=navigator.userAgent||``,n=navigator.userAgentData?.platform,r=/macintosh/i.test(t)&&(navigator.maxTouchPoints||0)>1;!be()&&!r&&(n===`macOS`||/mac os x|macintosh/i.test(t))&&e.add(`mac`),(n===`Windows`||/windows nt/i.test(t))&&e.add(`windows`)}return e}var We=new Set([`mac`,`windows`,`desktop`,`web`,`ios`,`android`]);function Ge(e){let t=e.filter(e=>We.has(e));if(!t.length)return!0;let n=Ue();return t.some(e=>n.has(e))}Y.registerLanguage(`bash`,Ae),Y.registerLanguage(`json`,Te),Y.registerLanguage(`markdown`,we),Y.registerLanguage(`python`,Pe),Y.registerLanguage(`shell`,De),Y.registerLanguage(`yaml`,Ce),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var Ke=12,qe=y({name:`BrowseSkillsDialog`,components:{VueMarkdown:Ie,ElDialog:H,ElInput:q,ElButton:W,ElPagination:k,ElSelect:b,ElOption:x,FontAwesomeIcon:Fe,AddIcon:V,BackIcon:M,DownIcon:j,InstallIcon:Re,LockIcon:oe,SearchIcon:le,SuccessIcon:I},directives:{loading:K},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`installed`],data(){return{loading:!1,installing:!1,items:[],total:0,currentPage:1,searchQuery:``,namespaceFilter:``,sortBy:`popular`,selectedItem:null,searchTimer:null,knownNamespaces:[],publisherByNamespace:{}}},computed:{pageSize(){return Ke},namespaceOptions(){let e=new Set(this.knownNamespaces);for(let t of this.items)e.add(t.namespace);return Array.from(e).sort().map(e=>({value:e,label:this.publisherForNamespace(e)}))},detailBody(){return this.selectedItem?this.selectedItem.content.replace(/^---\n[\s\S]*?\n---\n?/,``):``}},methods:{onOpen(){this.selectedItem=null,this.searchQuery=``,this.namespaceFilter=``,this.sortBy=`popular`,this.currentPage=1,this.knownNamespaces=[],this.publisherByNamespace={},this.loadFacets(),this.reload()},openDetail(e){this.selectedItem=e},async loadFacets(){try{let{data:e}=await Q.categories(),t=new Set;for(let n of e.namespaces)t.add(n.namespace);this.knownNamespaces=Array.from(t).sort()}catch(e){console.warn(`failed to load skill catalog facets`,e)}},reloadFromFirstPage(){this.currentPage=1,this.reload()},onPageChange(e){this.currentPage=e,this.reload(),this.$nextTick(()=>{let e=this.$el.querySelector(`.directory-grid-wrapper`);e&&(e.scrollTop=0)})},onSearchInput(){this.searchTimer!==null&&window.clearTimeout(this.searchTimer),this.searchTimer=window.setTimeout(()=>{this.searchTimer=null,this.reloadFromFirstPage()},250)},async reload(){this.loading=!0;try{let{data:e}=await Q.list({q:this.searchQuery.trim()||void 0,namespace:this.namespaceFilter||void 0,sort:this.sortBy,limit:this.pageSize,offset:(this.currentPage-1)*this.pageSize});this.items=e.items,this.total=e.total;for(let t of e.items)t.publisher&&(this.publisherByNamespace[t.namespace]=t.publisher)}catch(e){console.error(e),T.error(this.$t(`skill.directory.loadFailed`))}finally{this.loading=!1}},async onInstall(e){if(!this.installing&&!e.installed){if(!this.canInstallOnSurface(e)){T.warning(this.$t(`skill.directory.surfaceBlocked`,{platforms:this.surfaceLabels(e)}));return}this.installing=!0;try{let{data:t}=await Q.install(e.id);T.success(this.$t(`skill.directory.installSuccess`,{name:e.slug})),this.$emit(`installed`,t.id),e.installed=!0,e.install_count+=1}catch(t){let n=this.extractError(t);n.includes(`already exists`)?(e.installed=!0,T.warning(this.$t(`skill.directory.alreadyInstalled`,{name:e.slug}))):T.error(this.$t(`skill.directory.installFailed`,{detail:n}))}finally{this.installing=!1}}},extractError(e){return e?.response?.data?.detail||String(e)||`unknown error`},formatCount(e){return e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)},publisherForNamespace(e){if(this.publisherByNamespace[e])return this.publisherByNamespace[e];let t=this.items.find(t=>t.namespace===e);return t?t.publisher:e},restrictedSurfaces(e){let t=e.frontmatter?.surfaces;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim().toLowerCase()):[]},surfaceLabel(e){let t=`skill.directory.surface.${e}`,n=this.$t(t);return n===t?e:n},surfaceLabels(e){return this.restrictedSurfaces(e).map(e=>this.surfaceLabel(e)).join(` / `)},canInstallOnSurface(e){return Ge(this.restrictedSurfaces(e))}}}),Je={class:`directory`},Ye={class:`directory-main`},Xe={class:`directory-header`},Ze={class:`directory-controls`},Qe={class:`directory-grid-wrapper`},$e={key:0,class:`directory-empty`},et={key:1,class:`directory-grid`},tt=[`onClick`],nt={class:`directory-card-head`},rt={class:`directory-card-title`},it=[`title`],at=[`title`],ot=[`aria-label`,`title`,`onClick`],st=[`title`],ct={class:`directory-card-meta`},lt={class:`directory-card-publisher`},ut={key:0,class:`directory-card-count`},dt=[`title`],ft={class:`directory-card-desc`},pt={key:0,class:`directory-footer`},mt={class:`directory-detail-head`},ht={class:`directory-detail-actions`},gt=[`href`],_t={class:`directory-detail-body`},vt={class:`directory-detail-title`},yt={class:`directory-detail-meta`},bt={key:0},xt={key:1},St=[`title`],Ct={class:`directory-detail-desc`};function wt(u,h,_,y,b,x){let S=l(`search-icon`),C=l(`el-input`),w=l(`el-option`),T=l(`el-select`),E=l(`success-icon`),D=l(`lock-icon`),O=l(`add-icon`),k=l(`down-icon`),A=l(`el-pagination`),j=l(`back-icon`),M=l(`font-awesome-icon`),N=l(`el-button`),P=l(`install-icon`),F=l(`vue-markdown`),I=l(`el-dialog`),L=m(`loading`);return v(),f(I,{"model-value":u.modelValue,title:u.$t(`skill.dialog.directoryTitle`),width:`min(960px, 94vw)`,"align-center":``,class:`directory-dialog`,"close-on-click-modal":!u.installing,"show-close":!u.installing,"onUpdate:modelValue":h[5]||=e=>u.$emit(`update:modelValue`,e),onOpen:u.onOpen},{default:p(()=>[e(`div`,Je,[e(`main`,Ye,[u.selectedItem?(v(),s(c,{key:1},[e(`header`,mt,[e(`button`,{class:`directory-back-btn`,onClick:h[3]||=e=>u.selectedItem=null},[a(j,{size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`skill.directory.back`)),1)]),e(`div`,ht,[u.selectedItem.source_url?(v(),s(`a`,{key:0,href:u.selectedItem.source_url,target:`_blank`,class:`directory-link`},[a(M,{icon:`fa-brands fa-github`}),r(` `+i(u.$t(`skill.directory.viewSource`)),1)],8,gt)):o(``,!0),u.selectedItem.installed?(v(),f(N,{key:1,disabled:``,type:`success`,plain:``},{default:p(()=>[a(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`skill.directory.installed`)),1)]),_:1})):u.selectedItem.installable&&!u.canInstallOnSurface(u.selectedItem)?(v(),f(N,{key:2,disabled:``,title:u.$t(`skill.directory.surfaceBlocked`,{platforms:u.surfaceLabels(u.selectedItem)})},{default:p(()=>[a(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`skill.directory.surfaceUnavailable`)),1)]),_:1},8,[`title`])):u.selectedItem.installable?(v(),f(N,{key:3,type:`primary`,loading:u.installing,onClick:h[4]||=e=>u.onInstall(u.selectedItem)},{default:p(()=>[a(P,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`skill.directory.install`)),1)]),_:1},8,[`loading`])):(v(),f(N,{key:4,disabled:``,title:u.selectedItem.license},{default:p(()=>[a(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.selectedItem.license||u.$t(`skill.directory.notInstallable`)),1)]),_:1},8,[`title`]))])]),e(`div`,_t,[e(`h2`,vt,`/`+i(u.selectedItem.slug),1),e(`div`,yt,[e(`span`,null,[e(`strong`,null,i(u.$t(`skill.meta.addedBy`))+`:`,1),r(` `+i(u.selectedItem.publisher),1)]),u.selectedItem.license?(v(),s(`span`,bt,[e(`strong`,null,i(u.$t(`skill.directory.license`))+`:`,1),r(` `+i(u.selectedItem.license),1)])):o(``,!0),u.selectedItem.version?(v(),s(`span`,xt,`v`+i(u.selectedItem.version),1)):o(``,!0),u.surfaceLabels(u.selectedItem)?(v(),s(`span`,{key:2,class:`directory-detail-surface`,title:u.$t(`skill.directory.surfaceHint`)},i(u.$t(`skill.directory.surfaceOnly`,{platforms:u.surfaceLabels(u.selectedItem)})),9,St)):o(``,!0)]),e(`p`,Ct,i(u.selectedItem.description),1),a(F,{class:`directory-detail-content`,source:u.detailBody,sanitize:``},null,8,[`source`])])],64)):(v(),s(c,{key:0},[e(`header`,Xe,[a(C,{modelValue:u.searchQuery,"onUpdate:modelValue":h[0]||=e=>u.searchQuery=e,class:`directory-search`,size:`default`,clearable:``,placeholder:u.$t(`skill.directory.searchPlaceholder`),onInput:u.onSearchInput},{prefix:p(()=>[a(S,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`,`onInput`]),e(`div`,Ze,[a(T,{modelValue:u.namespaceFilter,"onUpdate:modelValue":h[1]||=e=>u.namespaceFilter=e,class:`directory-select`,placeholder:u.$t(`skill.directory.allPublishers`),clearable:``,size:`default`,onChange:u.reloadFromFirstPage},{default:p(()=>[(v(!0),s(c,null,g(u.namespaceOptions,e=>(v(),f(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),a(T,{modelValue:u.sortBy,"onUpdate:modelValue":h[2]||=e=>u.sortBy=e,class:`directory-select directory-select-sm`,size:`default`,onChange:u.reloadFromFirstPage},{default:p(()=>[a(w,{label:u.$t(`skill.directory.sort.popular`),value:`popular`},null,8,[`label`]),a(w,{label:u.$t(`skill.directory.sort.recent`),value:`recent`},null,8,[`label`]),a(w,{label:u.$t(`skill.directory.sort.name`),value:`name`},null,8,[`label`])]),_:1},8,[`modelValue`,`onChange`])])]),d((v(),s(`div`,Qe,[!u.loading&&u.total===0?(v(),s(`p`,$e,i(u.$t(`skill.directory.empty`)),1)):(v(),s(`div`,et,[(v(!0),s(c,null,g(u.items,c=>(v(),s(`article`,{key:c.id,class:n([`directory-card`,{"is-installed":c.installed}]),onClick:e=>u.openDetail(c)},[e(`div`,nt,[e(`span`,rt,`/`+i(c.slug),1),c.installed?(v(),s(`span`,{key:0,class:`directory-card-action is-installed`,title:u.$t(`skill.directory.installed`)},[a(E,{size:16,"aria-hidden":`true`,focusable:`false`})],8,it)):c.installable&&!u.canInstallOnSurface(c)?(v(),s(`span`,{key:1,class:`directory-card-locked`,title:u.$t(`skill.directory.surfaceBlocked`,{platforms:u.surfaceLabels(c)})},[a(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,at)):c.installable?(v(),s(`button`,{key:2,class:`directory-card-action`,"aria-label":u.$t(`skill.directory.install`),title:u.$t(`skill.directory.install`),onClick:t(e=>u.onInstall(c),[`stop`])},[a(O,{size:16,"aria-hidden":`true`,focusable:`false`})],8,ot)):(v(),s(`span`,{key:3,class:`directory-card-locked`,title:c.license},[a(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,st))]),e(`div`,ct,[e(`span`,lt,i(c.publisher),1),c.install_count>0?(v(),s(`span`,ut,[a(k,{size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.formatCount(c.install_count)),1)])):o(``,!0),u.surfaceLabels(c)?(v(),s(`span`,{key:1,class:`directory-card-surface`,title:u.$t(`skill.directory.surfaceHint`)},i(u.surfaceLabels(c)),9,dt)):o(``,!0)]),e(`p`,ft,i(c.description),1)],10,tt))),128))]))])),[[L,u.loading]]),u.total>u.pageSize?(v(),s(`footer`,pt,[a(A,{"current-page":u.currentPage,"page-size":u.pageSize,total:u.total,"pager-count":5,background:``,layout:`prev, pager, next, total`,onCurrentChange:u.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onCurrentChange`])])):o(``,!0)],64))])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`show-close`,`onOpen`])}var Tt=G(qe,[[`render`,wt],[`__scopeId`,`data-v-a9be2dc3`]]);Y.registerLanguage(`bash`,Ae),Y.registerLanguage(`css`,Me),Y.registerLanguage(`go`,ke),Y.registerLanguage(`javascript`,Se),Y.registerLanguage(`json`,Te),Y.registerLanguage(`markdown`,we),Y.registerLanguage(`python`,Pe),Y.registerLanguage(`rust`,Ee),Y.registerLanguage(`shell`,De),Y.registerLanguage(`sql`,je),Y.registerLanguage(`typescript`,Oe),Y.registerLanguage(`xml`,Ne),Y.registerLanguage(`html`,Ne),Y.registerLanguage(`yaml`,Ce),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),Y.registerAliases([`js`,`jsx`],{languageName:`javascript`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`rs`],{languageName:`rust`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var $=1e6;function Et(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 Dt(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Y.getLanguage(t)?t:`plain`}var Ot=y({name:`SkillFilePreview`,components:{ElButton:W,ElTooltip:w,ElTabs:S,ElTabPane:C,CodeIcon:te,CopyIcon:R,FileIcon:z,SaveIcon:Ve,ViewIcon:re,WarningIcon:de,VueMarkdown:Ie},directives:{loading:K},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}},computed:{kind(){return this.path?Et(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${Dt(this.path)}`},truncatedText(){return this.textContent}},watch:{path:{handler(){this.fetch()},immediate:!0}},beforeUnmount(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl)},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.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 Z.fetchFile(this.skillId,this.path);this.contentType=t,this.size=e.size;let n=Et(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,Y.highlightElement(e))},async onCopy(){if(this.textContent)try{await navigator.clipboard.writeText(this.textContent),T.success(this.$t(`skill.preview.copied`))}catch{T.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}}}}),kt={class:`preview-root`},At={class:`toolbar`},jt={class:`path-display`},Mt={key:0,class:`size-display`},Nt={class:`body`},Pt={key:0,class:`error`},Ft=[`srcdoc`],It={key:3,class:`image-pane`},Lt=[`src`,`alt`],Rt={key:4,class:`binary`},zt=[`placeholder`],Bt={key:6,class:`source-pane`},Vt={key:7,class:`truncated-warning`};function Ht(t,c,h,g,_,y){let b=l(`save-icon`),x=l(`el-button`),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((v(),s(`div`,kt,[e(`div`,At,[e(`span`,jt,i(t.path||`—`),1),t.size?(v(),s(`span`,Mt,i(t.humanSize(t.size)),1)):o(``,!0),c[3]||=e(`span`,{class:`toolbar-spacer`},null,-1),t.editable?(v(),f(x,{key:1,type:`primary`,size:`small`,disabled:!t.dirty||t.saving,loading:t.saving,onClick:t.onSave},{default:p(()=>[a(b,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.save`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])):o(``,!0),a(C,{content:t.$t(`skill.preview.copy`),placement:`bottom`},{default:p(()=>[a(x,{size:`small`,circle:``,disabled:!t.textContent,"aria-label":t.$t(`skill.preview.copy`),title:t.$t(`skill.preview.copy`),onClick:t.onCopy},{default:p(()=>[a(S,{size:16,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`disabled`,`aria-label`,`title`,`onClick`])]),_:1},8,[`content`])]),t.canRender?(v(),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`,Nt,[t.error?(v(),s(`div`,Pt,[a(O,{class:`mr-2`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.error),1)])):t.kind===`markdown`&&t.viewMode===`rendered`?(v(),f(k,{key:1,class:`markdown-rendered`,source:t.textContent,sanitize:``},null,8,[`source`])):t.kind===`html`&&t.viewMode===`rendered`?(v(),s(`iframe`,{key:2,ref:`htmlFrame`,class:`html-frame`,sandbox:``,srcdoc:t.textContent},null,8,Ft)):t.kind===`image`?(v(),s(`div`,It,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,Lt)])):t.kind===`binary`?(v(),s(`div`,Rt,[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((v(),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,zt)),[[u,t.textContent]]):(v(),s(`pre`,Bt,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(v(),s(`p`,Vt,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):o(``,!0)])])),[[j,t.loading]])}var Ut=G(Ot,[[`render`,Ht],[`__scopeId`,`data-v-ec0a447e`]]),Wt=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),Gt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Kt(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?N:n===`md`?ie:Gt.has(n)?ae:Wt.has(n)?Be:z}function qt(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 Jt=y({name:`FileNode`,components:{ExpandDownIcon:P,ExpandRightIcon:F,FontAwesomeIcon:Fe},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?Kt(e.path):B},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),Yt=[`aria-label`,`title`],Xt={key:1,class:`node-chevron-spacer`},Zt={class:`node-label`},Qt={key:0,class:`children`};function $t(r,a,u,d,p,m){let y=l(`expand-down-icon`),b=l(`expand-right-icon`),x=l(`font-awesome-icon`),S=l(`file-node`,!0);return v(),s(`li`,null,[e(`div`,{class:n([`file-node`,{active:r.isActive}]),style:h({paddingLeft:r.indent+`px`}),onClick:a[1]||=(...e)=>r.onClick&&r.onClick(...e)},[r.node.isLeaf?(v(),s(`span`,Xt)):(v(),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?(v(),f(y,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(v(),f(b,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,Yt)),r.isHtmlFile(r.node)?(v(),f(x,{key:2,icon:`fa-brands fa-html5`,class:`node-icon`})):(v(),f(_(r.iconFor(r.node)),{key:3,class:`node-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),e(`span`,Zt,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(v(),s(`ul`,Qt,[(v(!0),s(c,null,g(r.node.children||[],e=>(v(),f(S,{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 en=y({name:`SkillRow`,components:{ExpandDownIcon:P,ExpandRightIcon:F,SkillIcon:se,FileNode:G(Jt,[[`render`,$t],[`__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 qt(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)}}}),tn={class:`skill-row-wrapper`},nn=[`aria-label`,`title`],rn={key:1,class:`row-chevron-spacer`},an=[`title`],on={key:0,class:`file-list`};function sn(r,u,d,p,m,h){let _=l(`expand-down-icon`),y=l(`expand-right-icon`),b=l(`skill-icon`),x=l(`file-node`);return v(),s(`li`,tn,[e(`div`,{class:n([`skill-row`,{active:r.isSkillSelected}]),onClick:u[1]||=e=>r.$emit(`select-skill`,r.skill)},[r.hasChildren?(v(),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?(v(),f(_,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(v(),f(y,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,nn)):(v(),s(`span`,rn)),a(b,{class:`row-icon`,size:16,"aria-hidden":`true`,focusable:`false`}),e(`span`,{class:`row-label`,title:r.skill.name},i(r.skill.slug),9,an)],2),r.expanded&&r.hasChildren?(v(),s(`ul`,on,[(v(!0),s(c,null,g(r.tree,e=>(v(),f(x,{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 cn=G(en,[[`render`,sn],[`__scopeId`,`data-v-231c2ce1`]]),ln=10*1024*1024,un=/\.(tar\.gz|tgz|tar|zip|md)$/i,dn=y({name:`UploadSkillDialog`,components:{ElDialog:H,ElButton:W,AddFileIcon:He,CloudUploadIcon:ze},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{file:null,isDragging:!1,uploading:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.uploading||this.$emit(`update:modelValue`,!1)},reset(){this.file=null,this.isDragging=!1;let e=this.$refs.fileInput;e&&(e.value=``)},humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},onPickFile(){this.uploading||this.$refs.fileInput?.click()},onFilePicked(e){let t=e.target.files?.[0]||null;this.acceptFile(t)},onDrop(e){this.isDragging=!1;let t=e.dataTransfer?.files?.[0]||null;this.acceptFile(t)},acceptFile(e){if(!e){this.file=null;return}if(e.size>ln){T.error(this.$t(`skill.message.fileTooLarge`));return}if(!un.test(e.name)){T.error(this.$t(`skill.message.fileTypeWrong`));return}this.file=e},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.file){this.uploading=!0;try{if(/\.md$/i.test(this.file.name)){let e=await this.file.text(),{data:t}=await Z.createMarkdown({content:e});T.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,t.id)}else{let{data:e}=await Z.createTarball(this.file);T.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id)}this.$emit(`update:modelValue`,!1)}catch(e){T.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.uploading=!1}}}}}),fn={key:0,class:`dropzone-hint`},pn={key:1,class:`dropzone-file`},mn={class:`dropzone-file-name`},hn={class:`dropzone-file-size`},gn={class:`requirements`},_n={class:`requirements-title`};function vn(o,c,u,d,m,h){let g=l(`add-file-icon`),_=l(`el-button`),y=l(`cloud-upload-icon`),b=l(`el-dialog`);return v(),f(b,{"model-value":o.modelValue,title:o.$t(`skill.dialog.uploadTitle`),width:`min(520px, 94vw)`,"align-center":``,"close-on-click-modal":!o.uploading,"close-on-press-escape":!o.uploading,"show-close":!o.uploading,"onUpdate:modelValue":o.onVisibleChange,onClosed:o.reset},{footer:p(()=>[a(_,{disabled:o.uploading,onClick:o.onClose},{default:p(()=>[r(i(o.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),a(_,{type:`primary`,loading:o.uploading,disabled:!o.file,onClick:o.onSubmit},{default:p(()=>[a(y,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(o.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:p(()=>[e(`input`,{ref:`fileInput`,type:`file`,accept:`.tar.gz,.tgz,.tar,.zip,.md,application/gzip,application/zip,application/x-tar,text/markdown`,hidden:``,onChange:c[0]||=(...e)=>o.onFilePicked&&o.onFilePicked(...e)},null,544),e(`div`,{class:n([`dropzone`,{"is-dragging":o.isDragging,"has-file":!!o.file}]),onClick:c[1]||=(...e)=>o.onPickFile&&o.onPickFile(...e),onDragover:c[2]||=t(e=>o.isDragging=!0,[`prevent`]),onDragleave:c[3]||=t(e=>o.isDragging=!1,[`prevent`]),onDrop:c[4]||=t((...e)=>o.onDrop&&o.onDrop(...e),[`prevent`])},[a(g,{class:`dropzone-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),o.file?(v(),s(`p`,pn,[e(`span`,mn,i(o.file.name),1),e(`span`,hn,i(o.humanSize(o.file.size)),1)])):(v(),s(`p`,fn,i(o.$t(`skill.dialog.uploadDrop`)),1))],34),e(`div`,gn,[e(`p`,_n,i(o.$t(`skill.dialog.fileRequirements`)),1),e(`ul`,null,[e(`li`,null,i(o.$t(`skill.dialog.requirementMd`)),1),e(`li`,null,i(o.$t(`skill.dialog.requirementArchive`)),1)])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var yn=G(dn,[[`render`,vn],[`__scopeId`,`data-v-01ead824`]]),bn=y({name:`WriteSkillDialog`,components:{ElDialog:H,ElButton:W,ElInput:q,CloudUploadIcon:ze},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{content:``,saving:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.saving||this.$emit(`update:modelValue`,!1)},reset(){this.content=``},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.content.trim()){this.saving=!0;try{let{data:e}=await Z.createMarkdown({content:this.content});T.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id),this.$emit(`update:modelValue`,!1)}catch(e){T.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.saving=!1}}}}}),xn={class:`hint`};function Sn(t,n,o,s,c,u){let d=l(`el-input`),m=l(`el-button`),h=l(`cloud-upload-icon`),g=l(`el-dialog`);return v(),f(g,{"model-value":t.modelValue,title:t.$t(`skill.dialog.writeTitle`),width:`min(720px, 94vw)`,"align-center":``,"close-on-click-modal":!t.saving,"close-on-press-escape":!t.saving,"show-close":!t.saving,"onUpdate:modelValue":t.onVisibleChange,onClosed:t.reset},{footer:p(()=>[a(m,{disabled:t.saving,onClick:t.onClose},{default:p(()=>[r(i(t.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),a(m,{type:`primary`,loading:t.saving,disabled:!t.content.trim(),onClick:t.onSubmit},{default:p(()=>[a(h,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:p(()=>[e(`p`,xn,i(t.$t(`skill.dialog.writeHint`)),1),a(d,{modelValue:t.content,"onUpdate:modelValue":n[0]||=e=>t.content=e,type:`textarea`,rows:18,placeholder:t.$t(`skill.placeholder.content`),spellcheck:`false`,class:`editor`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var Cn=y({name:`UserSkills`,components:{ConsolePageHeader:Le,ElInput:q,ElSwitch:A,ElTag:me,ElTooltip:w,ElDropdown:O,ElDropdownMenu:D,ElDropdownItem:E,AddIcon:V,AiCreateIcon:pe,DeleteIcon:ue,ExpandDownIcon:P,ExpandRightIcon:F,HelpIcon:L,MarketplaceIcon:ce,MoreIcon:ne,SearchIcon:le,SkillIcon:se,UploadIcon:fe,WriteIcon:ee,BrowseSkillsDialog:Tt,SkillFilePreview:Ut,SkillRow:cn,UploadSkillDialog:yn,WriteSkillDialog:G(bn,[[`render`,Sn],[`__scopeId`,`data-v-f39aab5d`]])},directives:{loading:K},data(){return{loading:!1,skills:[],togglingId:null,selectedSkillId:``,selectedPath:``,expandedSkillIds:[],personalOpen:!0,globalsOpen:!0,searchQuery:``,uploadVisible:!1,writeVisible:!1,browseVisible:!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 Z.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),T.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.browseVisible=!0},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 Z.update(this.selectedSkill.id,{content:e});T.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){T.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)})),t.reject(e)}},async onDelete(e){try{await xe.confirm(this.$t(`skill.message.deleteConfirm`,{slug:e.slug}),this.$t(`skill.button.delete`),{type:`warning`})}catch{return}try{await Z.remove(e.id),T.success(this.$t(`skill.message.deleteSuccess`)),this.selectedSkillId===e.id&&(this.selectedSkillId=``,this.selectedPath=``),await this.fetchSkills()}catch(e){T.error(this.extractError(e))}},async onToggleSkill(e,t){this.togglingId=e.id;try{t?(await Z.enable(e.id),T.success(this.$t(`skill.message.enableSuccess`))):(await Z.disable(e.id),T.success(this.$t(`skill.message.disableSuccess`))),e.enabled=t}catch(e){T.error(this.extractError(e))}finally{this.togglingId=null}}}}),wn={class:`skills-page`},Tn={class:`skills-shell`},En={class:`left-pane`},Dn={class:`left-header`},On=[`aria-label`,`title`],kn={class:`submenu-trigger`},An={class:`badge-soon`},jn={class:`left-body`},Mn={class:`section`},Nn={key:0,class:`skill-list`},Pn={key:0,class:`empty-row`},Fn={key:0,class:`section`},In={key:0,class:`skill-list`},Ln={class:`right-pane`},Rn={class:`right-header`},zn={class:`right-title`},Bn={class:`right-actions`},Vn=[`aria-label`,`title`],Hn={class:`meta-card`},Un={class:`meta-grid`},Wn={class:`meta-cell`},Gn={class:`meta-label`},Kn={class:`meta-value`},qn={class:`meta-cell`},Jn={class:`meta-label`},Yn={class:`meta-value`},Xn={key:0,class:`meta-cell`},Zn={class:`meta-label`},Qn={class:`meta-tags`},$n={key:0,class:`meta-description`},er={class:`meta-description-label`},tr={class:`meta-label`},nr={class:`preview-card`},rr={key:2,class:`right-empty`};function ir(t,n,u,h,_,y){let b=l(`console-page-header`),x=l(`search-icon`),S=l(`el-input`),C=l(`add-icon`),w=l(`marketplace-icon`),T=l(`el-dropdown-item`),E=l(`expand-right-icon`),D=l(`ai-create-icon`),O=l(`write-icon`),k=l(`upload-icon`),A=l(`el-dropdown-menu`),j=l(`el-dropdown`),M=l(`expand-down-icon`),N=l(`skill-row`),P=l(`el-switch`),F=l(`more-icon`),I=l(`delete-icon`),L=l(`el-tag`),ee=l(`help-icon`),te=l(`el-tooltip`),R=l(`skill-file-preview`),ne=l(`skill-icon`),re=l(`upload-skill-dialog`),ie=l(`write-skill-dialog`),z=l(`browse-skills-dialog`),B=m(`loading`);return v(),s(`div`,wn,[a(b,{title:t.$t(`skill.title.skills`),subtitle:t.$t(`skill.message.pageDescription`)},null,8,[`title`,`subtitle`]),e(`div`,Tn,[e(`aside`,En,[e(`header`,Dn,[a(S,{modelValue:t.searchQuery,"onUpdate:modelValue":n[0]||=e=>t.searchQuery=e,class:`search-input`,size:`default`,clearable:``,placeholder:t.$t(`skill.placeholder.search`)},{prefix:p(()=>[a(x,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`]),a(j,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:p(()=>[a(A,{class:`add-menu`},{default:p(()=>[a(T,{onClick:t.onBrowse},{default:p(()=>[a(w,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),a(T,{divided:``},{default:p(()=>[a(j,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:p(()=>[a(A,{class:`add-menu`},{default:p(()=>[a(T,{disabled:``},{default:p(()=>[a(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),e(`span`,An,i(t.$t(`skill.menu.soon`)),1)]),_:1}),a(T,{onClick:t.openWrite},{default:p(()=>[a(O,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),a(T,{onClick:t.openUpload},{default:p(()=>[a(k,{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`,kn,[a(C,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),a(E,{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(C,{size:16,"aria-hidden":`true`,focusable:`false`})],8,On)]),_:1})]),d((v(),s(`div`,jn,[e(`section`,Mn,[e(`button`,{class:`section-header`,onClick:n[1]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(v(),f(M,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(v(),f(E,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.personal`)),1)]),t.personalOpen?(v(),s(`ul`,Nn,[!t.loading&&t.filteredPersonal.length===0?(v(),s(`li`,Pn,i(t.searchQuery?t.$t(`skill.empty.search`):t.$t(`skill.message.noSkills`)),1)):o(``,!0),(v(!0),s(c,null,g(t.filteredPersonal,e=>(v(),f(N,{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?(v(),s(`section`,Fn,[e(`button`,{class:`section-header`,onClick:n[2]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(v(),f(M,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(v(),f(E,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.platform`)),1)]),t.globalsOpen?(v(),s(`ul`,In,[(v(!0),s(c,null,g(t.filteredGlobal,e=>(v(),f(N,{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)])),[[B,t.loading]])]),e(`main`,Ln,[t.selectedSkill&&!t.selectedPath?(v(),s(c,{key:0},[e(`header`,Rn,[e(`h3`,zn,i(t.selectedSkill.slug),1),e(`div`,Bn,[a(P,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:n[3]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?o(``,!0):(v(),f(j,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:p(()=>[a(A,null,{default:p(()=>[a(T,{onClick:n[4]||=e=>t.onDelete(t.selectedSkill)},{default:p(()=>[a(I,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.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(F,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Vn)]),_:1}))])]),e(`div`,Hn,[e(`div`,Un,[e(`div`,Wn,[e(`span`,Gn,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,Kn,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,qn,[e(`span`,Jn,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,Yn,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(v(),s(`div`,Xn,[e(`span`,Zn,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,Qn,[(v(!0),s(c,null,g(t.selectedSkill.required_connections,e=>(v(),f(L,{key:e,size:`small`,type:`info`},{default:p(()=>[r(i(e),1)]),_:2},1024))),128))])])):o(``,!0)]),t.selectedSkill.description?(v(),s(`div`,$n,[e(`div`,er,[e(`span`,tr,i(t.$t(`skill.field.description`)),1),t.selectedSkill.when_to_use?(v(),f(te,{key:0,content:t.selectedSkill.when_to_use,placement:`top`},{default:p(()=>[a(ee,{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`,nr,[(v(),f(R,{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?(v(),f(R,{key:`${t.selectedSkill.id}:${t.selectedPath}`,"skill-id":t.selectedSkill.id,path:t.selectedPath,editable:!1},null,8,[`skill-id`,`path`])):(v(),s(`div`,rr,[a(ne,{class:`right-empty-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.selectSkill`)),1)]))])]),a(re,{modelValue:t.uploadVisible,"onUpdate:modelValue":n[5]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),a(ie,{modelValue:t.writeVisible,"onUpdate:modelValue":n[6]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),a(z,{modelValue:t.browseVisible,"onUpdate:modelValue":n[7]||=e=>t.browseVisible=e,onInstalled:t.onCreated},null,8,[`modelValue`,`onInstalled`])])}var ar=G(Cn,[[`render`,ir],[`__scopeId`,`data-v-e3209347`]]);export{ar 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{t as y}from"./upload-DimlTiIl.js";import{t as b}from"./tooltip-pUbjR2xu.js";import{t as x}from"./alert-BprQRUmf.js";import{h as S,v as C}from"./models-ClsawnaQ.js";import{t as w}from"./drawer-CpQ_k9m7.js";import{t as T}from"./box-C0dtnlPA.js";import{t as E}from"./clock-Varrr0Bl.js";import{a as D,c as O,n as k,o as A,r as j,s as M,t as N}from"./pagination-D-uSyaRW.js";import{t as ee}from"./info-BPaOsauW.js";import{t as P}from"./trash-2-BfVLvlm9.js";import{t as F}from"./triangle-alert-BVAKaCSW.js";import{t as I}from"./upload-CHxTlPO1.js";import{t as L}from"./wand-sparkles-Dp_e6WgR.js";import{At as te,Et as ne,Ot as re,Tt as ie,jt as R,kt as z}from"./constants-D04Y0eol.js";import{$t as B,Fi as V,In as H,Jt as U,Mr as W,O as G,Qt as K,Xt as q,Yt as J,Zt as Y,en as ae,in as oe,nn as se,pn as ce,si as X,tn as Z,xi as le}from"./index-C_sjkBHo.js";import{t as ue}from"./CopyToClipboard-D1PN1vgU.js";import{t as de}from"./ReportButton-YWxvQv7T.js";import{t as fe}from"./FilePreview-tLIDSh2u.js";import{t as Q}from"./ImagePreview-CN8OBvU4.js";import{n as pe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as me}from"./Consumption-DiSEqNK8.js";import{t as he}from"./VideoPlayer-Dqej3RIo.js";import{t as ge}from"./ApiCodeButton-BG3uOft7.js";import{t as _e}from"./BotPlaceholder-CXmOKAnD.js";var ve=v({name:`LayoutOmni`,components:{MagicIcon:L,ElDrawer:w,ElButton:V},mixins:[pe]}),ye={class:`main flex flex-row flex-1`},be={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)]`},xe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Se(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,ye,[e(`div`,be,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,xe,[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 Ce=G(ve,[[`render`,Se],[`__scopeId`,`data-v-b76ffabf`]]),we=v({name:`OmniPromptInput`,components:{PromptTextarea:D},computed:{prompt:{get(){return this.$store.state.omni?.config?.prompt},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Te(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`omni.name.prompt`),info:e.$t(`omni.description.prompt`),placeholder:e.$t(`omni.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ee=G(we,[[`render`,Te]]),De=v({name:`OmniResolutionSelector`,components:{InfoIcon:A},data(){return{options:[{value:R,label:`720p`},{value:te,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.omni?.config?.resolution},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,resolution:e})}}},mounted(){this.value||=ne}}),Oe={class:`resolution`},ke={class:`header`},Ae={class:`title font-bold`},je={class:`items`},Me=[`onClick`];function Ne(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Oe,[e(`div`,ke,[e(`h2`,Ae,i(t.$t(`omni.name.resolution`)),1),a(p,{content:t.$t(`omni.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,je,[(g(!0),s(c,null,h(t.options,e=>(g(),s(`div`,{key:e.value,class:n([`item`,{active:t.value===e.value}]),onClick:n=>t.value=e.value},i(e.label),11,Me))),128))])])}var Pe=G(De,[[`render`,Ne],[`__scopeId`,`data-v-1f9abe29`]]),Fe=v({name:`OmniRatioSelector`,components:{InfoIcon:A},computed:{options(){return[{value:re,label:`16:9`,w:32,h:18},{value:z,label:`9:16`,w:18,h:32}]},value:{get(){return this.$store.state.omni?.config?.aspect_ratio},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,aspect_ratio:e})}}},mounted(){this.value||=ie}}),Ie={class:`ratio`},Le={class:`header`},Re={class:`title font-bold`},ze={class:`items`},Be=[`onClick`],Ve={class:`preview`},He={class:`name`};function Ue(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ie,[e(`div`,Le,[e(`h2`,Re,i(t.$t(`omni.name.ratio`)),1),a(p,{content:t.$t(`omni.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,ze,[(g(!0),s(c,null,h(t.options,r=>(g(),s(`div`,{key:r.value,class:n([`item`,{active:t.value===r.value}]),onClick:e=>t.value=r.value},[e(`div`,Ve,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,He,i(r.label),1)],10,Be))),128))])])}var We=G(Fe,[[`render`,Ue],[`__scopeId`,`data-v-1c0c1511`]]),Ge=4,Ke=v({name:`OmniReferenceImagesInput`,components:{ElUpload:y,ElButton:V,InfoIcon:A,ImagePreview:Q,UploadIcon:I},mixins:[se,Z,B,U],data(){return{fileList:[],uploadUrl:X()+`/api/v1/files/`,limit:Ge,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)||[]},value(){return this.$store.state.omni?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetReferenceImages()},onExceed(){C.warning(this.$t(`omni.message.uploadReferenceExceed`))},onError(){C.error(this.$t(`omni.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,image_urls:e.length?e:void 0}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetReferenceImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetReferenceImages()}}}),qe={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},Je={class:`flex min-w-0 items-center`},Ye={class:`title m-0 text-[14px] font-bold`},Xe={class:`file-list flex flex-wrap gap-[10px]`};function Ze(t,n,o,u,d,m){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return g(),s(`div`,null,[e(`div`,qe,[e(`div`,Je,[e(`h2`,Ye,i(t.$t(`omni.name.referenceImages`)),1),a(_,{content:t.$t(`omni.description.referenceImages`)},null,8,[`content`])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value shrink-0`,limit:t.limit,multiple:!0,"show-file-list":!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(y,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Xe,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])}var Qe=G(Ke,[[`render`,Ze]]),$e=v({name:`OmniVideoInput`,components:{ElUpload:y,ElButton:V,InfoIcon:A,FilePreview:fe,UploadIcon:I},mixins:[Z,B],data(){return{fileList:[],uploadUrl:X()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},videoUrl(){return this.$store.state.omni?.config?.video_urls?.[0]},videoName(){let e=this.videoUrl||``;return e.split(`/`).pop()||e}},methods:{onExceed(){C.warning(this.$t(`omni.message.uploadVideoExceed`))},onError(){C.error(this.$t(`omni.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=Y(e.size);return t?n?!0:(C.error(this.$t(`omni.message.uploadVideoSizeExceed`,{max:q(J)})),!1):(C.error(this.$t(`omni.message.uploadVideoTypeFailed`)),!1)},setVideoUrls(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,video_urls:e?[e]:void 0})},onRemove(){this.fileList=[],this.setVideoUrls(void 0)},async onSuccess(e,t){let n=e?.file_url||t?.response?.file_url;this.setVideoUrls(n||void 0)}}}),et={class:`field flex min-h-8 w-full items-center justify-between gap-3`},tt={class:`flex min-w-0 items-center`},nt={class:`title m-0 text-[14px] font-bold`},rt={key:0,class:`file-list flex flex-wrap gap-[10px]`};function it(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`file-preview`);return g(),s(`div`,null,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,i(t.$t(`omni.name.referenceVideo`)),1),a(m,{content:t.$t(`omni.description.referenceVideo`)},null,8,[`content`])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value shrink-0`,"show-file-list":!1,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},{default:p(()=>[a(_,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(h,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.uploadVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.videoUrl?(g(),s(`div`,rt,[a(y,{url:t.videoUrl,name:t.videoName,percentage:100,onRemove:t.onRemove},null,8,[`url`,`name`,`onRemove`])])):o(``,!0)])}var at=v({name:`OmniConfigPanel`,components:{ElButton:V,MagicIcon:L,PromptInput:Ee,ResolutionSelector:Pe,RatioSelector:We,ReferenceImagesInput:Qe,VideoInput:G($e,[[`render`,it],[`__scopeId`,`data-v-b87d1e4e`]]),Consumption:me},emits:[`generate`],computed:{config(){return this.$store.state.omni?.config},consumption(){return oe(this.config,this.service?.cost)},service(){return this.$store.state.omni?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),ot={class:`flex flex-col h-full`},st={class:`flex-1 overflow-y-auto p-5`},ct={class:`flex flex-col items-center justify-center px-5 pb-5`};function lt(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`ratio-selector`),h=l(`resolution-selector`),_=l(`reference-images-input`),v=l(`video-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return g(),s(`div`,ot,[e(`div`,st,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,ct,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.generate`)),1)]),_:1},8,[`onClick`])])])}var ut=G(at,[[`render`,lt]]),dt=v({name:`OmniTaskPreview`,components:{DeleteIcon:P,ApplicationIcon:T,ChannelIcon:O,CopyToClipboard:ue,ExpandIcon:M,InfoIcon:ee,MagicIcon:L,TimeIcon:E,WarningIcon:F,ElAlert:x,VideoPlayer:he,ElTooltip:b,ElButton:V,ImagePreview:Q,ApiCodeButton:ge,ReportButton:de},props:{modelValue:{type:Object,required:!0}},data(){return{nowTs:Date.now(),timer:0}},computed:{video(){return this.modelValue?.response?.data?.[0]},inputImage(){return this.modelValue?.request?.image_urls?.[0]},pendingElapsed(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(e)return Math.max(0,Math.floor(this.nowTs/1e3-e))}},watch:{"modelValue.response":{handler(e){e&&this.stopTimer()}}},mounted(){this.modelValue?.response||(this.timer=window.setInterval(()=>{this.nowTs=Date.now()},1e3))},beforeUnmount(){this.stopTimer()},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await le.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(`omni/deleteTask`,{id:e}),C.success(this.$t(`common.message.deleteTaskSuccess`))}catch{C.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),ft={class:`preview`},pt={class:`left`},mt={class:`main`},ht={class:`bot`},gt={class:`datetime`},_t=[`aria-label`],vt={class:`info`},yt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},bt={key:1,class:`prompt mt-2`},xt={key:0},St={key:1},Ct={key:0,class:n({content:!0})},wt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Et={key:1,class:n({content:!0})},Dt={key:0,class:`mb-4`},Ot={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},kt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:0},Mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Pt={key:2,class:n({content:!0})},Ft={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Rt={key:3,class:n({content:!0})},zt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Bt(n,c,u,d,f,m){let h=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`image-preview`),b=l(`time-icon`),x=l(`magic-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`report-button`),O=l(`application-icon`),k=l(`expand-icon`),A=l(`channel-icon`),j=l(`warning-icon`),M=l(`info-icon`);return g(),s(`div`,ft,[e(`div`,pt,[a(h,{capability:`omni`,part:`avatar`,class:`avatar`})]),e(`div`,mt,[e(`div`,ht,[a(h,{capability:`omni`,part:`name`}),e(`span`,gt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{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:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,_t)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,vt,[n.inputImage?(g(),s(`div`,yt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,bt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,St,` - (`+i(n.$t(`omni.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,xt,` - (`+i(n.$t(`omni.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,Et,[n.video?.video_url?(g(),s(`div`,Dt,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Ot,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`omni.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`omni.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/gemini/videos`,body:n.modelValue?.request},null,8,[`body`]),a(D,{service:`omni`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,kt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,At,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,jt,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,Mt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,Nt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,$,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(g(),s(`div`,Pt,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failure`)),1)]),default:p(()=>[e(`p`,Ft,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,It,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Lt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Rt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.status`)),1)]),default:p(()=>[e(`p`,zt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})])):(g(),s(`div`,Ct,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.status.pending`)),1)]),default:p(()=>[e(`p`,wt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.pendingElapsed===void 0?o(``,!0):(g(),s(`p`,Tt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var Vt=v({name:`OmniRecentPanel`,components:{TaskPreview:G(dt,[[`render`,Bt],[`__scopeId`,`data-v-08bc502f`]]),BotPlaceholder:_e,NoTasks:j,ScrollList:k},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.omni?.tasks,items:this.$store.state.omni?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ht={key:0},Ut={key:2,class:`w-full h-full flex items-center justify-center`};function Wt(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`,Ht,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default: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`,Ut,[a(v)])):o(``,!0)],64)}var Gt=v({name:`OmniIndex`,components:{ConfigPanel:ut,Layout:Ce,RecentPanel:G(Vt,[[`render`,Wt]])},mixins:[ae],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.omni?.status?.getApplications===S.Request},tasksLoading(){return this.$store.state.omni?.status?.getTasks===S.Request||this.fetchingTasks},credential(){return this.$store.state.omni?.credential},config(){return this.$store.state.omni?.config},tasks(){return this.$store.state.omni?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await N({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(){await this.$store.dispatch(`omni/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`omni/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!K(this.uploadTracker,e=>this.$t(e),e=>C.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.image_urls)&&(e.image_urls=e.image_urls.filter(e=>typeof e==`string`&&e.trim()),e.image_urls.length||delete e.image_urls),Array.isArray(e?.video_urls)&&(e.video_urls=e.video_urls.filter(e=>typeof e==`string`&&e.trim()),e.video_urls.length||delete e.video_urls),!e?.prompt){C.warning(this.$t(`omni.message.promptRequired`));return}if(e?.video_urls&&!e?.image_urls){C.warning(this.$t(`omni.message.videoRequiresImage`));return}let t={...e,async:!0};if(!ce())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}C.info(this.$t(`omni.message.startingTask`)),W(`omni`,H.generate(t,{token:n})).then(()=>{C.success(this.$t(`omni.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?C.error(this.$t(`omni.message.usedUp`)):C.error(this.$t(`omni.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Kt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var qt=G(Gt,[[`render`,Kt]]);export{qt 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{t as y}from"./upload-DimlTiIl.js";import{t as b}from"./tooltip-DS2H_6sn.js";import{t as x}from"./alert-BprQRUmf.js";import{h as S,v as C}from"./models-ClsawnaQ.js";import{t as w}from"./drawer-B447BS-l.js";import{t as T}from"./box-DXHTJEv-.js";import{t as E}from"./clock-DiJ9741Z.js";import{a as D,c as O,n as k,o as A,r as j,s as M,t as N}from"./pagination-BEagsSLK.js";import{t as ee}from"./info-DGrLjV90.js";import{t as P}from"./trash-2-aiyl_0iW.js";import{t as F}from"./triangle-alert-D120-HZx.js";import{t as I}from"./upload-CRKN-pH5.js";import{t as L}from"./wand-sparkles-BYpsEWX0.js";import{At as te,Et as ne,Ot as re,Tt as ie,jt as R,kt as z}from"./constants-D04Y0eol.js";import{$t as B,Fi as V,In as H,Jt as U,Mr as W,O as G,Qt as K,Xt as q,Yt as J,Zt as Y,en as ae,in as oe,nn as se,pn as ce,si as X,tn as Z,xi as le}from"./index-7B54VLaT.js";import{t as ue}from"./CopyToClipboard-DOtA8ld0.js";import{t as de}from"./ReportButton-CjFO3h6Z.js";import{t as fe}from"./FilePreview-OXl4Fg3S.js";import{t as Q}from"./ImagePreview-Hobf9iDz.js";import{n as pe}from"./taskDrawerMixin-DyAUhFEq.js";import{t as me}from"./Consumption-Cvw-XQ7S.js";import{t as he}from"./VideoPlayer-BCs9hDNt.js";import{t as ge}from"./ApiCodeButton-Da3_C3Lz.js";import{t as _e}from"./BotPlaceholder-C3WTtRMA.js";var ve=v({name:`LayoutOmni`,components:{MagicIcon:L,ElDrawer:w,ElButton:V},mixins:[pe]}),ye={class:`main flex flex-row flex-1`},be={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)]`},xe={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function Se(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,ye,[e(`div`,be,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,xe,[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 Ce=G(ve,[[`render`,Se],[`__scopeId`,`data-v-b76ffabf`]]),we=v({name:`OmniPromptInput`,components:{PromptTextarea:D},computed:{prompt:{get(){return this.$store.state.omni?.config?.prompt},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Te(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`omni.name.prompt`),info:e.$t(`omni.description.prompt`),placeholder:e.$t(`omni.placeholder.prompt`),"min-rows":5},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ee=G(we,[[`render`,Te]]),De=v({name:`OmniResolutionSelector`,components:{InfoIcon:A},data(){return{options:[{value:R,label:`720p`},{value:te,label:`1080p`}]}},computed:{value:{get(){return this.$store.state.omni?.config?.resolution},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,resolution:e})}}},mounted(){this.value||=ne}}),Oe={class:`resolution`},ke={class:`header`},Ae={class:`title font-bold`},je={class:`items`},Me=[`onClick`];function Ne(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Oe,[e(`div`,ke,[e(`h2`,Ae,i(t.$t(`omni.name.resolution`)),1),a(p,{content:t.$t(`omni.description.resolution`),class:`info`},null,8,[`content`])]),e(`div`,je,[(g(!0),s(c,null,h(t.options,e=>(g(),s(`div`,{key:e.value,class:n([`item`,{active:t.value===e.value}]),onClick:n=>t.value=e.value},i(e.label),11,Me))),128))])])}var Pe=G(De,[[`render`,Ne],[`__scopeId`,`data-v-1f9abe29`]]),Fe=v({name:`OmniRatioSelector`,components:{InfoIcon:A},computed:{options(){return[{value:re,label:`16:9`,w:32,h:18},{value:z,label:`9:16`,w:18,h:32}]},value:{get(){return this.$store.state.omni?.config?.aspect_ratio},set(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,aspect_ratio:e})}}},mounted(){this.value||=ie}}),Ie={class:`ratio`},Le={class:`header`},Re={class:`title font-bold`},ze={class:`items`},Be=[`onClick`],Ve={class:`preview`},He={class:`name`};function Ue(t,r,o,u,d,f){let p=l(`info-icon`);return g(),s(`div`,Ie,[e(`div`,Le,[e(`h2`,Re,i(t.$t(`omni.name.ratio`)),1),a(p,{content:t.$t(`omni.description.ratio`),class:`info`},null,8,[`content`])]),e(`div`,ze,[(g(!0),s(c,null,h(t.options,r=>(g(),s(`div`,{key:r.value,class:n([`item`,{active:t.value===r.value}]),onClick:e=>t.value=r.value},[e(`div`,Ve,[e(`div`,{class:`rect`,style:m({width:r.w+`px`,height:r.h+`px`})},null,4)]),e(`div`,He,i(r.label),1)],10,Be))),128))])])}var We=G(Fe,[[`render`,Ue],[`__scopeId`,`data-v-1c0c1511`]]),Ge=4,Ke=v({name:`OmniReferenceImagesInput`,components:{ElUpload:y,ElButton:V,InfoIcon:A,ImagePreview:Q,UploadIcon:I},mixins:[se,Z,B,U],data(){return{fileList:[],uploadUrl:X()+`/api/v1/files/`,limit:Ge,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)||[]},value(){return this.$store.state.omni?.config?.image_urls}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetReferenceImages()},onExceed(){C.warning(this.$t(`omni.message.uploadReferenceExceed`))},onError(){C.error(this.$t(`omni.message.uploadError`))},onSetReferenceImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,image_urls:e.length?e:void 0}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetReferenceImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetReferenceImages()}}}),qe={class:`field mb-[10px] flex min-h-8 w-full items-center justify-between gap-3`},Je={class:`flex min-w-0 items-center`},Ye={class:`title m-0 text-[14px] font-bold`},Xe={class:`file-list flex flex-wrap gap-[10px]`};function Ze(t,n,o,u,d,m){let _=l(`info-icon`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`),x=l(`image-preview`);return g(),s(`div`,null,[e(`div`,qe,[e(`div`,Je,[e(`h2`,Ye,i(t.$t(`omni.name.referenceImages`)),1),a(_,{content:t.$t(`omni.description.referenceImages`)},null,8,[`content`])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value shrink-0`,limit:t.limit,multiple:!0,"show-file-list":!1,"before-upload":t.beforeUploadSizeGuard,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(y,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(v,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.upload`)),1)]),_:1})]),_:1},8,[`file-list`,`limit`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])]),e(`div`,Xe,[(g(!0),s(c,null,h(t.fileList,(e,n)=>(g(),f(x,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])}var Qe=G(Ke,[[`render`,Ze]]),$e=v({name:`OmniVideoInput`,components:{ElUpload:y,ElButton:V,InfoIcon:A,FilePreview:fe,UploadIcon:I},mixins:[Z,B],data(){return{fileList:[],uploadUrl:X()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},videoUrl(){return this.$store.state.omni?.config?.video_urls?.[0]},videoName(){let e=this.videoUrl||``;return e.split(`/`).pop()||e}},methods:{onExceed(){C.warning(this.$t(`omni.message.uploadVideoExceed`))},onError(){C.error(this.$t(`omni.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`||e.type===`video/quicktime`,n=Y(e.size);return t?n?!0:(C.error(this.$t(`omni.message.uploadVideoSizeExceed`,{max:q(J)})),!1):(C.error(this.$t(`omni.message.uploadVideoTypeFailed`)),!1)},setVideoUrls(e){this.$store.commit(`omni/setConfig`,{...this.$store.state.omni?.config,video_urls:e?[e]:void 0})},onRemove(){this.fileList=[],this.setVideoUrls(void 0)},async onSuccess(e,t){let n=e?.file_url||t?.response?.file_url;this.setVideoUrls(n||void 0)}}}),et={class:`field flex min-h-8 w-full items-center justify-between gap-3`},tt={class:`flex min-w-0 items-center`},nt={class:`title m-0 text-[14px] font-bold`},rt={key:0,class:`file-list flex flex-wrap gap-[10px]`};function it(t,n,c,u,d,f){let m=l(`info-icon`),h=l(`upload-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`file-preview`);return g(),s(`div`,null,[e(`div`,et,[e(`div`,tt,[e(`h2`,nt,i(t.$t(`omni.name.referenceVideo`)),1),a(m,{content:t.$t(`omni.description.referenceVideo`)},null,8,[`content`])]),a(v,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4,.mov`,name:`file`,class:`value shrink-0`,"show-file-list":!1,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},{default:p(()=>[a(_,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(h,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.uploadVideo`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])]),t.videoUrl?(g(),s(`div`,rt,[a(y,{url:t.videoUrl,name:t.videoName,percentage:100,onRemove:t.onRemove},null,8,[`url`,`name`,`onRemove`])])):o(``,!0)])}var at=v({name:`OmniConfigPanel`,components:{ElButton:V,MagicIcon:L,PromptInput:Ee,ResolutionSelector:Pe,RatioSelector:We,ReferenceImagesInput:Qe,VideoInput:G($e,[[`render`,it],[`__scopeId`,`data-v-b87d1e4e`]]),Consumption:me},emits:[`generate`],computed:{config(){return this.$store.state.omni?.config},consumption(){return oe(this.config,this.service?.cost)},service(){return this.$store.state.omni?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),ot={class:`flex flex-col h-full`},st={class:`flex-1 overflow-y-auto p-5`},ct={class:`flex flex-col items-center justify-center px-5 pb-5`};function lt(t,n,o,c,u,d){let f=l(`prompt-input`),m=l(`ratio-selector`),h=l(`resolution-selector`),_=l(`reference-images-input`),v=l(`video-input`),y=l(`consumption`),b=l(`magic-icon`),x=l(`el-button`);return g(),s(`div`,ot,[e(`div`,st,[a(f,{class:`mb-4`}),a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`})]),e(`div`,ct,[a(y,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(x,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(b,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`omni.button.generate`)),1)]),_:1},8,[`onClick`])])])}var ut=G(at,[[`render`,lt]]),dt=v({name:`OmniTaskPreview`,components:{DeleteIcon:P,ApplicationIcon:T,ChannelIcon:O,CopyToClipboard:ue,ExpandIcon:M,InfoIcon:ee,MagicIcon:L,TimeIcon:E,WarningIcon:F,ElAlert:x,VideoPlayer:he,ElTooltip:b,ElButton:V,ImagePreview:Q,ApiCodeButton:ge,ReportButton:de},props:{modelValue:{type:Object,required:!0}},data(){return{nowTs:Date.now(),timer:0}},computed:{video(){return this.modelValue?.response?.data?.[0]},inputImage(){return this.modelValue?.request?.image_urls?.[0]},pendingElapsed(){let e=parseFloat((this.modelValue?.created_at||``).toString());if(e)return Math.max(0,Math.floor(this.nowTs/1e3-e))}},watch:{"modelValue.response":{handler(e){e&&this.stopTimer()}}},mounted(){this.modelValue?.response||(this.timer=window.setInterval(()=>{this.nowTs=Date.now()},1e3))},beforeUnmount(){this.stopTimer()},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await le.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(`omni/deleteTask`,{id:e}),C.success(this.$t(`common.message.deleteTaskSuccess`))}catch{C.error(this.$t(`common.message.deleteTaskFailed`))}}},stopTimer(){this.timer&&=(window.clearInterval(this.timer),0)},onDownload(e){window.open(e,`_blank`)}}}),ft={class:`preview`},pt={class:`left`},mt={class:`main`},ht={class:`bot`},gt={class:`datetime`},_t=[`aria-label`],vt={class:`info`},yt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},bt={key:1,class:`prompt mt-2`},xt={key:0},St={key:1},Ct={key:0,class:n({content:!0})},wt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Tt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Et={key:1,class:n({content:!0})},Dt={key:0,class:`mb-4`},Ot={key:1,class:n({operations:!0,"mt-2":!0,"mb-2":!0})},kt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},jt={key:0},Mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Pt={key:2,class:n({content:!0})},Ft={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Rt={key:3,class:n({content:!0})},zt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Bt(n,c,u,d,f,m){let h=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`image-preview`),b=l(`time-icon`),x=l(`magic-icon`),S=l(`copy-to-clipboard`),C=l(`el-alert`),w=l(`video-player`),T=l(`el-button`),E=l(`api-code-button`),D=l(`report-button`),O=l(`application-icon`),k=l(`expand-icon`),A=l(`channel-icon`),j=l(`warning-icon`),M=l(`info-icon`);return g(),s(`div`,ft,[e(`div`,pt,[a(h,{capability:`omni`,part:`avatar`,class:`avatar`})]),e(`div`,mt,[e(`div`,ht,[a(h,{capability:`omni`,part:`name`}),e(`span`,gt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{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:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,_t)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,vt,[n.inputImage?(g(),s(`div`,yt,[a(y,{url:n.inputImage,name:`image`,closable:!1},null,8,[`url`])])):o(``,!0),n.modelValue?.request?.prompt?(g(),s(`p`,bt,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?n.video?.state===`processing`||n.video?.state===`pending`?(g(),s(`span`,St,` - (`+i(n.$t(`omni.status.processing`))+`) `,1)):o(``,!0):(g(),s(`span`,xt,` - (`+i(n.$t(`omni.status.pending`))+`) `,1))])):o(``,!0)]),n.modelValue?.response?n.modelValue?.response?.success===!0?(g(),s(`div`,Et,[n.video?.video_url?(g(),s(`div`,Dt,[a(w,{src:n.video?.video_url},null,8,[`src`])])):o(``,!0),n.video?.video_url?(g(),s(`div`,Ot,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`omni.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(T,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onDownload(n.video?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`omni.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(E,{path:`/gemini/videos`,body:n.modelValue?.request},null,8,[`body`]),a(D,{service:`omni`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(C,{closable:!1,class:`mt-2 success`},{default:p(()=>[n.modelValue?.request?.model?(g(),s(`p`,kt,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.model`))+`: `+i(n.modelValue?.request?.model),1)])):o(``,!0),n.modelValue?.request?.resolution?(g(),s(`p`,At,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.resolution`))+`: `+i(n.modelValue?.request?.resolution)+` `,1),n.modelValue?.request?.aspect_ratio?(g(),s(`span`,jt,` · `+i(n.modelValue?.request?.aspect_ratio),1)):o(``,!0)])):o(``,!0),e(`p`,Mt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,Nt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,$,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):n.modelValue?.response?.success===!1?(g(),s(`div`,Pt,[a(C,{closable:!1,class:`failure`},{template:p(()=>[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failure`)),1)]),default:p(()=>[e(`p`,Ft,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.modelValue?.response?.error?.message?(g(),s(`p`,It,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(S,{content:n.modelValue?.response?.error?.message,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Lt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(S,{content:n.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):(g(),s(`div`,Rt,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.status`)),1)]),default:p(()=>[e(`p`,zt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})])):(g(),s(`div`,Ct,[a(C,{closable:!1,class:`info`},{template:p(()=>[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.status.pending`)),1)]),default:p(()=>[e(`p`,wt,[a(x,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(S,{content:n.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),n.pendingElapsed===void 0?o(``,!0):(g(),s(`p`,Tt,[a(b,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`omni.name.elapsed`))+`: `+i(n.pendingElapsed)+`s `,1)]))]),_:1})]))])])}var Vt=v({name:`OmniRecentPanel`,components:{TaskPreview:G(dt,[[`render`,Bt],[`__scopeId`,`data-v-08bc502f`]]),BotPlaceholder:_e,NoTasks:j,ScrollList:k},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.omni?.tasks,items:this.$store.state.omni?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ht={key:0},Ut={key:2,class:`w-full h-full flex items-center justify-center`};function Wt(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`,Ht,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default: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`,Ut,[a(v)])):o(``,!0)],64)}var Gt=v({name:`OmniIndex`,components:{ConfigPanel:ut,Layout:Ce,RecentPanel:G(Vt,[[`render`,Wt]])},mixins:[ae],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.omni?.status?.getApplications===S.Request},tasksLoading(){return this.$store.state.omni?.status?.getTasks===S.Request||this.fetchingTasks},credential(){return this.$store.state.omni?.credential},config(){return this.$store.state.omni?.config},tasks(){return this.$store.state.omni?.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await N({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(){await this.$store.dispatch(`omni/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`omni/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!K(this.uploadTracker,e=>this.$t(e),e=>C.warning(e)))return;let e={...this.config||{}};if(typeof e?.prompt==`string`&&(e.prompt=e.prompt.trim(),e.prompt||delete e.prompt),Array.isArray(e?.image_urls)&&(e.image_urls=e.image_urls.filter(e=>typeof e==`string`&&e.trim()),e.image_urls.length||delete e.image_urls),Array.isArray(e?.video_urls)&&(e.video_urls=e.video_urls.filter(e=>typeof e==`string`&&e.trim()),e.video_urls.length||delete e.video_urls),!e?.prompt){C.warning(this.$t(`omni.message.promptRequired`));return}if(e?.video_urls&&!e?.image_urls){C.warning(this.$t(`omni.message.videoRequiresImage`));return}let t={...e,async:!0};if(!ce())return;let n=this.credential?.token;if(!n){console.error(`no token specified`);return}C.info(this.$t(`omni.message.startingTask`)),W(`omni`,H.generate(t,{token:n})).then(()=>{C.success(this.$t(`omni.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?C.error(this.$t(`omni.message.usedUp`)):C.error(this.$t(`omni.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Kt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var qt=G(Gt,[[`render`,Kt]]);export{qt 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-ChyQns32.js";import{t as x}from"./upload-DimlTiIl.js";import{t as S}from"./tooltip-pUbjR2xu.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-ClsawnaQ.js";import{t as E}from"./drawer-CpQ_k9m7.js";import{t as D}from"./clock-Varrr0Bl.js";import{a as O,c as k,n as A,o as j,r as M,t as N}from"./pagination-D-uSyaRW.js";import{t as P}from"./info-BPaOsauW.js";import{t as ee}from"./trash-2-BfVLvlm9.js";import{t as te}from"./triangle-alert-BVAKaCSW.js";import{t as F}from"./upload-CHxTlPO1.js";import{t as I}from"./wand-sparkles-Dp_e6WgR.js";import{$r as L,Jr as R,Qr as z,Xr as B,Yr as V,Zr as H,ni as U,ti as W}from"./constants-D04Y0eol.js";import{$t as G,Fi as K,Jt as q,Mr as J,O as Y,Qt as X,en as Z,in as Q,nn as ne,nr as re,pn as ie,si as ae,tn as oe,xi as se}from"./index-C_sjkBHo.js";import{t as ce}from"./CopyToClipboard-D1PN1vgU.js";import{t as le}from"./ReportButton-YWxvQv7T.js";import{t as ue}from"./ImagePreview-CN8OBvU4.js";import{n as de}from"./taskDrawerMixin-DyAUhFEq.js";import{t as fe}from"./Consumption-DiSEqNK8.js";import{t as pe}from"./VideoPlayer-Dqej3RIo.js";import{t as me}from"./ApiCodeButton-BG3uOft7.js";import{t as he}from"./BotPlaceholder-CXmOKAnD.js";var ge=v({name:`LayoutSora`,components:{MagicIcon:I,ElDrawer:E,ElButton:K},mixins:[de]}),_e={class:`main flex flex-row flex-1`},ve={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)]`},ye={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function be(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,_e,[e(`div`,ve,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ye,[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=Y(ge,[[`render`,be],[`__scopeId`,`data-v-b8cedc77`]]),Se=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:U,label:`sora-2`},{value:W,label:`sora-2-pro`}]}},computed:{value:{get(){return this.$store.state.sora?.config?.model},set(e){let t=this.$store.state.sora?.config||{},n=R[e]||[10],r=t.duration,i=r&&n.includes(r)?r:n.includes(10)?10:n[0],a={...t,model:e,duration:i,size:t.size||`small`};this.$store.commit(`sora/setConfig`,a)}}},mounted(){this.value||=H}}),Ce={class:`field`},we={class:`title font-bold`};function Te(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Ce,[e(`h2`,we,i(t.$t(`sora.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.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 Ee=Y(Se,[[`render`,Te],[`__scopeId`,`data-v-0cb7913d`]]),De=v({name:`ActionSelector`,components:{ElSelect:y,ElOption:b},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`sora.button.action1`)},{value:`image2video`,label:this.$t(`sora.button.action2`)}]},value:{get(){return this.$store.state.sora?.config?.action},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,action:e})}}},mounted(){this.value||=B}}),Oe={class:`field`},ke={class:`title font-bold`},Ae={class:`float-left`};function je(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Oe,[e(`h2`,ke,i(t.$t(`sora.name.action`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`),clearable:``},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(m,{key:t.value,label:t.label,value:t.value},{default:p(()=>[e(`span`,Ae,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Me=Y(De,[[`render`,je],[`__scopeId`,`data-v-7b82fa7f`]]),Ne=v({name:`DurationSelector`,components:{ElSelect:y,ElOption:b},computed:{model(){return this.$store.state.sora?.config?.model||`sora-2`},allowedDurations(){return R[this.model]||[10]},optionsForModel(){return this.allowedDurations.map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.sora?.config?.duration},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,duration:e})}}},watch:{allowedDurations(){let e=this.allowedDurations;if(!e.includes(this.value)){let t=e.includes(10)?10:e[0];this.value=t}}},mounted(){this.value||=10}}),Pe={class:`field`},Fe={class:`control`},Ie={class:`title font-bold`};function Le(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Pe,[e(`div`,Fe,[e(`h2`,Ie,i(t.$t(`sora.name.duration`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.optionsForModel,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])}var Re=Y(Ne,[[`render`,Le],[`__scopeId`,`data-v-c2934598`]]),ze=v({name:`OrientationSelector`,data(){return{options:[{value:`portrait`,labelKey:`sora.option.portrait`,width:13,height:25},{value:`landscape`,labelKey:`sora.option.landscape`,width:25,height:13}]}},computed:{active(){let e=this.options.findIndex(e=>e.value===this.value);return e>=0?e:0},value:{get(){return this.$store.state.sora?.config?.orientation},set(e){console.debug(`set orientation`,e),this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,orientation:e})}}},mounted(){this.value||=z}}),Be={class:`text-sm font-bold mb-2 block`},Ve={class:`items`},He=[`onClick`],Ue={class:`name`};function We(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,Be,i(t.$t(`sora.name.orientation`)),1),e(`div`,Ve,[(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.value])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,Ue,i(t.$t(r.labelKey)),1)],10,He))),128))])])}var Ge=Y(ze,[[`render`,We],[`__scopeId`,`data-v-a20be6d9`]]),Ke=v({name:`StartEndImage`,components:{UploadIcon:F,ElUpload:x,ElButton:K,InfoIcon:j,ImagePreview:ue},mixins:[ne,oe,G,q],emits:[`change`],data(){return{fileList:[],uploadUrl:ae()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.sora?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){T.warning(this.$t(`sora.message.uploadReferencesExceed`))},onError(){T.error(this.$t(`sora.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),qe={class:`relative`},Je={class:`flex justify-between`},Ye={class:`flex justify-start items-center`},Xe={class:`text-sm font-bold`};function Ze(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`,qe,[e(`div`,Je,[e(`div`,Ye,[e(`span`,Xe,i(t.$t(`sora.name.startEndImage`)),1),a(h,{content:t.$t(`sora.description.uploadStartEndImage`)},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:2,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.fileList.splice(t.fileList.indexOf(e),1)},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(`sora.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Qe=Y(Ke,[[`render`,Ze],[`__scopeId`,`data-v-01b87539`]]),$e=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),et=v({name:`SizeSelector`,components:{ElSelect:y,ElOption:b},data(){return{options:V.map(e=>({value:e,label:$e(e)}))}},computed:{value:{get(){return this.$store.state.sora?.config?.size},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,size:e})}}},mounted(){this.value||=L}}),tt={class:`field`},nt={class:`control`},rt={class:`title font-bold`};function it(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,tt,[e(`div`,nt,[e(`h2`,rt,i(t.$t(`sora.name.size`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.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 at=Y(et,[[`render`,it],[`__scopeId`,`data-v-8c485f0f`]]),ot=v({name:`PromptInput`,components:{PromptTextarea:O},computed:{prompt:{get(){return this.$store.state.sora?.config?.prompt},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,prompt:e})}}},mounted(){this.prompt||=``}});function st(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`sora.name.prompt`),info:e.$t(`sora.description.prompt`),placeholder:e.$t(`sora.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ct=v({name:`ConfigPanel`,components:{MagicIcon:I,ElButton:K,Consumption:fe,PromptInput:Y(ot,[[`render`,st]]),ModelSelector:Ee,StartEndImage:Qe,SizeSelector:at,ActionSelector:Me,OrientationSelector:Ge,DurationSelector:Re},emits:[`generate`],computed:{config(){return this.$store.state.sora?.config},consumption(){return Q(this.config,this.service?.cost)},service(){return this.$store.state.sora?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),lt={class:`flex flex-col h-full`},ut={class:`flex-1 overflow-y-auto p-5`},dt={class:`flex flex-col items-center justify-center px-5 pb-5`};function ft(t,n,o,c,d,f){let m=l(`model-selector`),h=l(`action-selector`),v=l(`duration-selector`),y=l(`size-selector`),b=l(`orientation-selector`),x=l(`prompt-input`),S=l(`start-end-image`),C=l(`consumption`),w=l(`magic-icon`),T=l(`el-button`);return g(),s(`div`,lt,[e(`div`,ut,[a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),u(a(S,{class:`mb-4`},null,512),[[_,t.config?.action===`image2video`]])]),e(`div`,dt,[a(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(w,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`sora.button.generate`)),1)]),_:1},8,[`onClick`])])])}var pt=Y(ct,[[`render`,ft]]),mt=v({name:`TaskPreview`,components:{DeleteIcon:ee,ChannelIcon:k,InfoIcon:P,MagicIcon:I,TimeIcon:D,WarningIcon:te,CopyToClipboard:ce,ElAlert:C,VideoPlayer:pe,ElTooltip:S,ElButton:K,ApiCodeButton:me,ReportButton:le},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.sora?.application},config(){return this.$store.state.sora?.config}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await se.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(`sora/deleteTask`,{id:e}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.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`)}}}),ht={class:`preview`},gt={class:`left`},_t={class:`main`},vt={class:`bot`},yt={class:`datetime`},bt=[`aria-label`],xt={class:`info`},St={key:0,class:`prompt mt-2`},Ct={key:0},wt={key:1},Tt={key:0,class:n({content:!0,failed:!0})},Et={key:0,class:`mb-4`},Dt={key:1,class:n({operations:!0,"mt-2":!0})},Ot={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},jt={key:1,class:n({content:!0})},Mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ft={key:2,class:n({content:!0})},It={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Rt(n,c,u,d,m,h){let _=l(`capability-presentation`),v=l(`delete-icon`),y=l(`el-tooltip`),b=l(`video-player`),x=l(`el-button`),S=l(`api-code-button`),C=l(`report-button`),w=l(`channel-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`time-icon`),O=l(`el-alert`),k=l(`warning-icon`),A=l(`info-icon`);return g(),s(`div`,ht,[e(`div`,gt,[a(_,{capability:`sora`,part:`avatar`,class:`avatar`})]),e(`div`,_t,[e(`div`,vt,[a(_,{capability:`sora`,part:`name`}),e(`span`,yt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(y,{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:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(v,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,bt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,xt,[n.modelValue?.request?.prompt?(g(),s(`p`,St,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(g(),s(`span`,Ct,` - (`+i(n.$t(`sora.status.pending`))+`) `,1)),n.modelValue?.response&&n.modelValue?.response?.success===void 0?(g(),s(`span`,wt,` - (`+i(n.$t(`sora.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0&&n.modelValue?.response?.data?(g(),s(`div`,Tt,[n.modelValue?.response?.data[0]?.video_url?(g(),s(`div`,Et,[a(b,{src:n.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response.success?(g(),s(`div`,Dt,[a(y,{class:`box-item`,effect:`dark`,content:n.$t(`sora.message.downloadVideo`),placement:`top-start`},{default:p(()=>[n.modelValue?.response?.data[0]?.video_url?(g(),f(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=e=>n.onDownload(e,n.modelValue?.response?.data[0]?.video_url)},{default:p(()=>[r(i(n.$t(`sora.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(S,{path:`/sora/videos`,body:n.modelValue?.request},null,8,[`body`]),a(C,{service:`sora`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(O,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,Ot,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.model`))+`: `+i(n.modelValue?.request?.model),1)]),e(`p`,kt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,At,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===!1?(g(),s(`div`,jt,[a(O,{closable:!1,class:`failure`},{template:p(()=>[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.failure`)),1)]),default:p(()=>[e(`p`,Mt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Nt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(E,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,$,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Pt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===void 0?(g(),s(`div`,Ft,[a(O,{closable:!1,class:`info`},{template:p(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`sora.status.processing`:`sora.status.pending`)),1)]),default:p(()=>[e(`p`,It,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,Lt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var zt=v({name:`RecentPanel`,components:{TaskPreview:Y(mt,[[`render`,Rt],[`__scopeId`,`data-v-808e51ba`]]),NoTasks:M,BotPlaceholder:he,ScrollList:A},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.sora?.tasks,items:this.$store.state.sora?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Bt={key:0},Vt={key:2,class:`w-full h-full flex items-center justify-center`};function Ht(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`,Bt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,(e,t)=>(g(),f(m,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Vt,[a(v)])):o(``,!0)],64)}var Ut=v({name:`SoraIndex`,components:{ConfigPanel:pt,Layout:xe,RecentPanel:Y(zt,[[`render`,Ht]])},mixins:[Z],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.sora?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.sora?.status?.getTasks===w.Request||this.fetchingTasks},credential(){return this.$store.state.sora.credential},config(){return this.$store.state.sora.config},tasks(){return this.$store.state.sora.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await N({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`sora/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`sora/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(`sora/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!X(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;let e={...this.config,async:!0};if(!ie())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}T.info(this.$t(`sora.message.startingTask`)),J(`sora`,re.generate(e,{token:t})).then(()=>{T.success(this.$t(`sora.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?T.error(this.$t(`sora.message.usedUp`)):T.error(this.$t(`sora.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Wt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Gt=Y(Ut,[[`render`,Wt]]);export{Gt 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-DBAlqBh7.js";import{t as x}from"./upload-DimlTiIl.js";import{t as S}from"./tooltip-DS2H_6sn.js";import{t as C}from"./alert-BprQRUmf.js";import{h as w,v as T}from"./models-ClsawnaQ.js";import{t as E}from"./drawer-B447BS-l.js";import{t as D}from"./clock-DiJ9741Z.js";import{a as O,c as k,n as A,o as j,r as M,t as N}from"./pagination-BEagsSLK.js";import{t as P}from"./info-DGrLjV90.js";import{t as ee}from"./trash-2-aiyl_0iW.js";import{t as te}from"./triangle-alert-D120-HZx.js";import{t as F}from"./upload-CRKN-pH5.js";import{t as I}from"./wand-sparkles-BYpsEWX0.js";import{$r as L,Jr as R,Qr as z,Xr as B,Yr as V,Zr as H,ni as U,ti as W}from"./constants-D04Y0eol.js";import{$t as G,Fi as K,Jt as q,Mr as J,O as Y,Qt as X,en as Z,in as Q,nn as ne,nr as re,pn as ie,si as ae,tn as oe,xi as se}from"./index-7B54VLaT.js";import{t as ce}from"./CopyToClipboard-DOtA8ld0.js";import{t as le}from"./ReportButton-CjFO3h6Z.js";import{t as ue}from"./ImagePreview-Hobf9iDz.js";import{n as de}from"./taskDrawerMixin-DyAUhFEq.js";import{t as fe}from"./Consumption-Cvw-XQ7S.js";import{t as pe}from"./VideoPlayer-BCs9hDNt.js";import{t as me}from"./ApiCodeButton-Da3_C3Lz.js";import{t as he}from"./BotPlaceholder-C3WTtRMA.js";var ge=v({name:`LayoutSora`,components:{MagicIcon:I,ElDrawer:E,ElButton:K},mixins:[de]}),_e={class:`main flex flex-row flex-1`},ve={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)]`},ye={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function be(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),h=l(`el-drawer`);return g(),s(`div`,_e,[e(`div`,ve,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ye,[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=Y(ge,[[`render`,be],[`__scopeId`,`data-v-b8cedc77`]]),Se=v({name:`ModelSelector`,components:{ElSelect:y,ElOption:b},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:U,label:`sora-2`},{value:W,label:`sora-2-pro`}]}},computed:{value:{get(){return this.$store.state.sora?.config?.model},set(e){let t=this.$store.state.sora?.config||{},n=R[e]||[10],r=t.duration,i=r&&n.includes(r)?r:n.includes(10)?10:n[0],a={...t,model:e,duration:i,size:t.size||`small`};this.$store.commit(`sora/setConfig`,a)}}},mounted(){this.value||=H}}),Ce={class:`field`},we={class:`title font-bold`};function Te(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Ce,[e(`h2`,we,i(t.$t(`sora.name.model`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.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 Ee=Y(Se,[[`render`,Te],[`__scopeId`,`data-v-0cb7913d`]]),De=v({name:`ActionSelector`,components:{ElSelect:y,ElOption:b},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`sora.button.action1`)},{value:`image2video`,label:this.$t(`sora.button.action2`)}]},value:{get(){return this.$store.state.sora?.config?.action},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,action:e})}}},mounted(){this.value||=B}}),Oe={class:`field`},ke={class:`title font-bold`},Ae={class:`float-left`};function je(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Oe,[e(`h2`,ke,i(t.$t(`sora.name.action`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`),clearable:``},{default:p(()=>[(g(!0),s(c,null,h(t.options,t=>(g(),f(m,{key:t.value,label:t.label,value:t.value},{default:p(()=>[e(`span`,Ae,i(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Me=Y(De,[[`render`,je],[`__scopeId`,`data-v-7b82fa7f`]]),Ne=v({name:`DurationSelector`,components:{ElSelect:y,ElOption:b},computed:{model(){return this.$store.state.sora?.config?.model||`sora-2`},allowedDurations(){return R[this.model]||[10]},optionsForModel(){return this.allowedDurations.map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.sora?.config?.duration},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,duration:e})}}},watch:{allowedDurations(){let e=this.allowedDurations;if(!e.includes(this.value)){let t=e.includes(10)?10:e[0];this.value=t}}},mounted(){this.value||=10}}),Pe={class:`field`},Fe={class:`control`},Ie={class:`title font-bold`};function Le(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,Pe,[e(`div`,Fe,[e(`h2`,Ie,i(t.$t(`sora.name.duration`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:p(()=>[(g(!0),s(c,null,h(t.optionsForModel,e=>(g(),f(m,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])}var Re=Y(Ne,[[`render`,Le],[`__scopeId`,`data-v-c2934598`]]),ze=v({name:`OrientationSelector`,data(){return{options:[{value:`portrait`,labelKey:`sora.option.portrait`,width:13,height:25},{value:`landscape`,labelKey:`sora.option.landscape`,width:25,height:13}]}},computed:{active(){let e=this.options.findIndex(e=>e.value===this.value);return e>=0?e:0},value:{get(){return this.$store.state.sora?.config?.orientation},set(e){console.debug(`set orientation`,e),this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,orientation:e})}}},mounted(){this.value||=z}}),Be={class:`text-sm font-bold mb-2 block`},Ve={class:`items`},He=[`onClick`],Ue={class:`name`};function We(t,r,a,o,l,u){return g(),s(`div`,null,[e(`span`,Be,i(t.$t(`sora.name.orientation`)),1),e(`div`,Ve,[(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.value])},[e(`div`,{class:`rect`,style:m({width:r.width+`px`,height:r.height+`px`})},null,4)],2),e(`p`,Ue,i(t.$t(r.labelKey)),1)],10,He))),128))])])}var Ge=Y(ze,[[`render`,We],[`__scopeId`,`data-v-a20be6d9`]]),Ke=v({name:`StartEndImage`,components:{UploadIcon:F,ElUpload:x,ElButton:K,InfoIcon:j,ImagePreview:ue},mixins:[ne,oe,G,q],emits:[`change`],data(){return{fileList:[],uploadUrl:ae()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.sora?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){T.warning(this.$t(`sora.message.uploadReferencesExceed`))},onError(){T.error(this.$t(`sora.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),qe={class:`relative`},Je={class:`flex justify-between`},Ye={class:`flex justify-start items-center`},Xe={class:`text-sm font-bold`};function Ze(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`,qe,[e(`div`,Je,[e(`div`,Ye,[e(`span`,Xe,i(t.$t(`sora.name.startEndImage`)),1),a(h,{content:t.$t(`sora.description.uploadStartEndImage`)},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:2,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.fileList.splice(t.fileList.indexOf(e),1)},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(`sora.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Qe=Y(Ke,[[`render`,Ze],[`__scopeId`,`data-v-01b87539`]]),$e=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),et=v({name:`SizeSelector`,components:{ElSelect:y,ElOption:b},data(){return{options:V.map(e=>({value:e,label:$e(e)}))}},computed:{value:{get(){return this.$store.state.sora?.config?.size},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,size:e})}}},mounted(){this.value||=L}}),tt={class:`field`},nt={class:`control`},rt={class:`title font-bold`};function it(t,n,r,o,u,d){let m=l(`el-option`),_=l(`el-select`);return g(),s(`div`,tt,[e(`div`,nt,[e(`h2`,rt,i(t.$t(`sora.name.size`)),1),a(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.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 at=Y(et,[[`render`,it],[`__scopeId`,`data-v-8c485f0f`]]),ot=v({name:`PromptInput`,components:{PromptTextarea:O},computed:{prompt:{get(){return this.$store.state.sora?.config?.prompt},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,prompt:e})}}},mounted(){this.prompt||=``}});function st(e,t,n,r,i,a){let o=l(`prompt-textarea`);return g(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`sora.name.prompt`),info:e.$t(`sora.description.prompt`),placeholder:e.$t(`sora.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ct=v({name:`ConfigPanel`,components:{MagicIcon:I,ElButton:K,Consumption:fe,PromptInput:Y(ot,[[`render`,st]]),ModelSelector:Ee,StartEndImage:Qe,SizeSelector:at,ActionSelector:Me,OrientationSelector:Ge,DurationSelector:Re},emits:[`generate`],computed:{config(){return this.$store.state.sora?.config},consumption(){return Q(this.config,this.service?.cost)},service(){return this.$store.state.sora?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),lt={class:`flex flex-col h-full`},ut={class:`flex-1 overflow-y-auto p-5`},dt={class:`flex flex-col items-center justify-center px-5 pb-5`};function ft(t,n,o,c,d,f){let m=l(`model-selector`),h=l(`action-selector`),v=l(`duration-selector`),y=l(`size-selector`),b=l(`orientation-selector`),x=l(`prompt-input`),S=l(`start-end-image`),C=l(`consumption`),w=l(`magic-icon`),T=l(`el-button`);return g(),s(`div`,lt,[e(`div`,ut,[a(m,{class:`mb-4`}),a(h,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),u(a(S,{class:`mb-4`},null,512),[[_,t.config?.action===`image2video`]])]),e(`div`,dt,[a(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(w,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`sora.button.generate`)),1)]),_:1},8,[`onClick`])])])}var pt=Y(ct,[[`render`,ft]]),mt=v({name:`TaskPreview`,components:{DeleteIcon:ee,ChannelIcon:k,InfoIcon:P,MagicIcon:I,TimeIcon:D,WarningIcon:te,CopyToClipboard:ce,ElAlert:C,VideoPlayer:pe,ElTooltip:S,ElButton:K,ApiCodeButton:me,ReportButton:le},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.sora?.application},config(){return this.$store.state.sora?.config}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await se.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(`sora/deleteTask`,{id:e}),T.success(this.$t(`common.message.deleteTaskSuccess`))}catch{T.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`)}}}),ht={class:`preview`},gt={class:`left`},_t={class:`main`},vt={class:`bot`},yt={class:`datetime`},bt=[`aria-label`],xt={class:`info`},St={key:0,class:`prompt mt-2`},Ct={key:0},wt={key:1},Tt={key:0,class:n({content:!0,failed:!0})},Et={key:0,class:`mb-4`},Dt={key:1,class:n({operations:!0,"mt-2":!0})},Ot={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},kt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},At={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},jt={key:1,class:n({content:!0})},Mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Pt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Ft={key:2,class:n({content:!0})},It={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Rt(n,c,u,d,m,h){let _=l(`capability-presentation`),v=l(`delete-icon`),y=l(`el-tooltip`),b=l(`video-player`),x=l(`el-button`),S=l(`api-code-button`),C=l(`report-button`),w=l(`channel-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`time-icon`),O=l(`el-alert`),k=l(`warning-icon`),A=l(`info-icon`);return g(),s(`div`,ht,[e(`div`,gt,[a(_,{capability:`sora`,part:`avatar`,class:`avatar`})]),e(`div`,_t,[e(`div`,vt,[a(_,{capability:`sora`,part:`name`}),e(`span`,yt,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(y,{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:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(v,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,bt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,xt,[n.modelValue?.request?.prompt?(g(),s(`p`,St,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(g(),s(`span`,Ct,` - (`+i(n.$t(`sora.status.pending`))+`) `,1)),n.modelValue?.response&&n.modelValue?.response?.success===void 0?(g(),s(`span`,wt,` - (`+i(n.$t(`sora.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0&&n.modelValue?.response?.data?(g(),s(`div`,Tt,[n.modelValue?.response?.data[0]?.video_url?(g(),s(`div`,Et,[a(b,{src:n.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response.success?(g(),s(`div`,Dt,[a(y,{class:`box-item`,effect:`dark`,content:n.$t(`sora.message.downloadVideo`),placement:`top-start`},{default:p(()=>[n.modelValue?.response?.data[0]?.video_url?(g(),f(x,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=e=>n.onDownload(e,n.modelValue?.response?.data[0]?.video_url)},{default:p(()=>[r(i(n.$t(`sora.button.download`)),1)]),_:1})):o(``,!0)]),_:1},8,[`content`]),a(S,{path:`/sora/videos`,body:n.modelValue?.request},null,8,[`body`]),a(C,{service:`sora`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(O,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,Ot,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.model`))+`: `+i(n.modelValue?.request?.model),1)]),e(`p`,kt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,At,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===!1?(g(),s(`div`,jt,[a(O,{closable:!1,class:`failure`},{template:p(()=>[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.failure`)),1)]),default:p(()=>[e(`p`,Mt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Nt,[a(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(E,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(g(),s(`p`,$,[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),n.modelValue?.response?.trace_id?(g(),s(`p`,Pt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.success===void 0?(g(),s(`div`,Ft,[a(O,{closable:!1,class:`info`},{template:p(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`sora.status.processing`:`sora.status.pending`)),1)]),default:p(()=>[e(`p`,It,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(E,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.response?.trace_id?(g(),s(`p`,Lt,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`sora.name.traceId`))+`: `+i(n.modelValue?.response?.trace_id)+` `,1),a(E,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var zt=v({name:`RecentPanel`,components:{TaskPreview:Y(mt,[[`render`,Rt],[`__scopeId`,`data-v-808e51ba`]]),NoTasks:M,BotPlaceholder:he,ScrollList:A},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.sora?.tasks,items:this.$store.state.sora?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Bt={key:0},Vt={key:2,class:`w-full h-full flex items-center justify-center`};function Ht(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`,Bt,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(g(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(g(!0),s(c,null,h(e.tasks?.items,(e,t)=>(g(),f(m,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(g(),s(`div`,Vt,[a(v)])):o(``,!0)],64)}var Ut=v({name:`SoraIndex`,components:{ConfigPanel:pt,Layout:xe,RecentPanel:Y(zt,[[`render`,Ht]])},mixins:[Z],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.sora?.status?.getApplications===w.Request},tasksLoading(){return this.$store.state.sora?.status?.getTasks===w.Request||this.fetchingTasks},credential(){return this.$store.state.sora.credential},config(){return this.$store.state.sora.config},tasks(){return this.$store.state.sora.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await N({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`sora/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`sora/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(`sora/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!X(this.uploadTracker,e=>this.$t(e),e=>T.warning(e)))return;let e={...this.config,async:!0};if(!ie())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}T.info(this.$t(`sora.message.startingTask`)),J(`sora`,re.generate(e,{token:t})).then(()=>{T.success(this.$t(`sora.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?T.error(this.$t(`sora.message.usedUp`)):T.error(this.$t(`sora.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Wt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return g(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Gt=Y(Ut,[[`render`,Wt]]);export{Gt as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{t as v}from"./upload-DimlTiIl.js";import{t as y}from"./tooltip-pUbjR2xu.js";import{t as b}from"./alert-BprQRUmf.js";import{h as x,v as S}from"./models-ClsawnaQ.js";import{t as C}from"./drawer-CpQ_k9m7.js";import{t as w}from"./switch-CI_r8TsE.js";import{t as T}from"./clock-Varrr0Bl.js";import{a as E,c as D,n as O,o as k,r as ee,t as A}from"./pagination-D-uSyaRW.js";import{t as j}from"./info-BPaOsauW.js";import{t as M}from"./trash-2-BfVLvlm9.js";import{t as N}from"./triangle-alert-BVAKaCSW.js";import{t as P}from"./upload-CHxTlPO1.js";import{t as F}from"./wand-sparkles-Dp_e6WgR.js";import"./constants-D04Y0eol.js";import{$t as I,Fi as L,Jt as R,Mr as te,O as z,Qt as ne,en as B,in as V,nn as H,or as U,pn as W,si as G,tn as K,xi as q}from"./index-C_sjkBHo.js";import{t as J}from"./CopyToClipboard-D1PN1vgU.js";import{t as Y}from"./ReportButton-YWxvQv7T.js";import{t as X}from"./FilePreview-tLIDSh2u.js";import{t as Z}from"./ImagePreview-CN8OBvU4.js";import{n as re}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ie}from"./Consumption-DiSEqNK8.js";import{t as Q}from"./VideoPlayer-Dqej3RIo.js";import{t as ae}from"./ApiCodeButton-BG3uOft7.js";import{t as oe}from"./BotPlaceholder-CXmOKAnD.js";var se=_({name:`LayoutLuma`,components:{MagicIcon:F,ElDrawer:C,ElButton:L},mixins:[re]}),ce={class:`main flex flex-row flex-1`},le={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)]`},ue={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function de(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,ce,[e(`div`,le,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ue,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var fe=z(se,[[`render`,de],[`__scopeId`,`data-v-d13d43a9`]]),pe=_({name:`EnhancementSelector`,components:{ElSwitch:w,InfoIcon:k},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug(`set enhancement`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=!0)}}),me={class:`relative`},he={class:`flex justify-between`},ge={class:`flex justify-start items-center`},_e={class:`text-sm font-bold`},ve={class:`flex justify-end items-center`};function ye(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,me,[e(`div`,he,[e(`div`,ge,[e(`span`,_e,i(t.$t(`luma.name.enhancement`)),1),a(d,{content:t.$t(`luma.description.enhancement`)},null,8,[`content`])]),e(`div`,ve,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var be=z(pe,[[`render`,ye]]),xe=_({name:`CustomSelector`,components:{ElSwitch:w,InfoIcon:k},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug(`set custom`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),Se={class:`relative`},Ce={class:`flex justify-between`},we={class:`flex justify-start items-center`},Te={class:`text-sm font-bold`},Ee={class:`flex justify-end items-center`};function De(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,Se,[e(`div`,Ce,[e(`div`,we,[e(`span`,Te,i(t.$t(`luma.name.custom`)),1),a(d,{content:t.$t(`luma.description.custom`)},null,8,[`content`])]),e(`div`,Ee,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Oe=z(xe,[[`render`,De]]),ke=_({name:`LoopSelector`,components:{ElSwitch:w,InfoIcon:k},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug(`set loop`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),Ae={class:`relative`},je={class:`flex justify-between`},Me={class:`flex justify-start items-center`},Ne={class:`text-sm font-bold`},Pe={class:`flex justify-end items-center`};function Fe(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,Ae,[e(`div`,je,[e(`div`,Me,[e(`span`,Ne,i(t.$t(`luma.name.loop`)),1),a(d,{content:t.$t(`luma.description.loop`)},null,8,[`content`])]),e(`div`,Pe,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ie=z(ke,[[`render`,Fe]]),Le=_({name:`EndImage`,components:{UploadIcon:P,ElUpload:v,ElButton:L,ImagePreview:Z,InfoIcon:k},mixins:[H,K,I,R],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onExceed(){S.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){S.error(this.$t(`luma.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Re={class:`relative`},ze={class:`flex justify-between`},Be={class:`flex justify-start items-center`},Ve={class:`text-sm font-bold`};function He(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`span`,Ve,i(t.$t(`luma.name.endImageUrl`)),1),a(g,{content:t.$t(`luma.description.endImageUrl`)},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:5,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?(h(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default: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(`luma.button.uploadEndImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Ue=z(Le,[[`render`,He],[`__scopeId`,`data-v-04c461bb`]]),We=_({name:`StartImage`,components:{UploadIcon:P,ElUpload:v,ElButton:L,ImagePreview:Z,InfoIcon:k},mixins:[H,K,I,R],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){S.error(this.$t(`luma.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ge={class:`relative`},Ke={class:`flex justify-between`},qe={class:`flex justify-start items-center`},Je={class:`text-sm font-bold`};function Ye(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ge,[e(`div`,Ke,[e(`div`,qe,[e(`span`,Je,i(t.$t(`luma.name.startImageUrl`)),1),a(g,{content:t.$t(`luma.description.startImageUrl`)},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:5,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.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},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(`luma.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Xe=z(We,[[`render`,Ye],[`__scopeId`,`data-v-31c07a19`]]),Ze=_({name:`UploadVideo`,components:{UploadIcon:P,ElUpload:v,ElButton:L,InfoIcon:k,FilePreview:X},mixins:[K,I],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.luma?.config?.video_url},set(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||=void 0},methods:{onExceed(){S.warning(this.$t(`luma.message.uploadVideoExceed`))},onError(){S.error(this.$t(`luma.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`,n=e.size/1024/1024<10;return t?n?!0:(S.error(this.$t(`luma.message.uploadVideoSizeExceed`)),!1):(S.error(this.$t(`luma.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e,action:`extend`})},async onSuccess(){this.onSetVideoUrl()}}}),Qe={class:`relative`},$e={class:`flex justify-between`},et={class:`flex justify-start items-center`},tt={class:`text-sm font-bold`};function nt(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Qe,[e(`div`,$e,[e(`div`,et,[e(`span`,tt,i(t.$t(`luma.name.videoUrl`)),1),a(g,{content:t.$t(`luma.description.videoUrl`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4`,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==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},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(`luma.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var rt=z(Ze,[[`render`,nt],[`__scopeId`,`data-v-2189fc52`]]),it=_({name:`PromptInput`,components:{PromptTextarea:E},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||=``}});function at(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`luma.name.prompt`),info:e.$t(`luma.description.prompt`),placeholder:e.$t(`luma.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ot=z(it,[[`render`,at]]),st=_({name:`ExtendFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.luma?.config}}}),ct={class:`relative`},lt={class:`flex mb-2`},ut={class:`text-sm font-bold`};function dt(t,n,r,a,c,u){let d=l(`video-player`);return h(),s(`div`,ct,[e(`div`,lt,[e(`span`,ut,i(t.$t(`luma.name.extend`)),1)]),e(`div`,null,[t.config?.video_url?(h(),f(d,{key:0,src:t.config?.video_url},null,8,[`src`])):o(``,!0)])])}var ft=_({name:`ConfigPanel`,components:{MagicIcon:F,LoopSelector:Ie,StartImageInput:Xe,EndImageInput:Ue,EnhancementSelector:be,ElButton:L,PromptInput:ot,ExtendFromInput:z(st,[[`render`,dt]]),CustomSelector:Oe,UploadVideo:rt,Consumption:ie},emits:[`generate`],computed:{config(){return this.$store.state.luma?.config},consumption(){return V(this.config,this.service?.cost)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),pt={class:`flex flex-col h-full`},mt={class:`flex-1 overflow-y-auto p-5`},ht={class:`flex flex-col items-center justify-center px-5 pb-5`};function gt(t,n,c,u,d,m){let g=l(`extend-from-input`),_=l(`prompt-input`),v=l(`custom-selector`),y=l(`upload-video`),b=l(`start-image-input`),x=l(`end-image-input`),S=l(`enhancement-selector`),C=l(`loop-selector`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,pt,[e(`div`,mt,[t.config?.video_id||t.config?.video_url?(h(),f(g,{key:0,class:`mb-4`})):o(``,!0),a(_,{class:`mb-4`}),t.config?.video_id?o(``,!0):(h(),f(v,{key:1,class:`mb-4`})),t.config?.custom?(h(),f(y,{key:2,class:`mb-4`})):o(``,!0),!(t.config?.video_id||t.config?.video_url)&&!t.config?.custom?(h(),f(b,{key:3,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`})]),e(`div`,ht,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(h(),f(E,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.extend`)),1)]),_:1},8,[`onClick`])):(h(),f(E,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var _t=z(ft,[[`render`,gt]]),vt=_({name:`TaskPreview`,components:{DeleteIcon:M,ChannelIcon:D,InfoIcon:j,MagicIcon:F,TimeIcon:T,WarningIcon:N,CopyToClipboard:J,ElAlert:b,VideoPlayer:Q,ElTooltip:y,ElButton:L,ApiCodeButton:ae,ReportButton:Y},props:{modelValue:{type:Object,required:!0}},emits:[`extend`],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await q.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(`luma/deleteTask`,{id:e}),S.success(this.$t(`common.message.deleteTaskSuccess`))}catch{S.error(this.$t(`common.message.deleteTaskFailed`))}}},onExtend(e,t){console.debug(`set config`,t),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_id:t.video_id,prompt:t.prompt,action:`extend`,thumbnail_url:t.thumbnail_url,video_url:t.video_url}),this.$emit(`extend`)},onDownload(e){window.open(e,`_blank`)}}}),yt={class:`preview`},bt={class:`left`},xt={class:`main`},St={class:`bot`},Ct={class:`datetime`},wt=[`aria-label`],Tt={class:`info`},Et={key:0,class:`prompt mt-2`},Dt={key:0},Ot={key:1},kt={key:0,class:n({content:!0,failed:!0})},At={key:0,class:`mb-4`},jt={key:1,class:n({operations:!0,"mt-2":!0,"mb-4":!0})},Mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:n({content:!0})},Pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Rt={key:2,class:n({content:!0})},zt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Bt(n,c,u,d,f,m){let g=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`video-player`),b=l(`el-button`),x=l(`api-code-button`),S=l(`report-button`),C=l(`magic-icon`),w=l(`copy-to-clipboard`),T=l(`time-icon`),E=l(`el-alert`),D=l(`warning-icon`),O=l(`info-icon`),k=l(`channel-icon`);return h(),s(`div`,yt,[e(`div`,bt,[a(g,{capability:`luma`,part:`avatar`,class:`avatar`})]),e(`div`,xt,[e(`div`,St,[a(g,{capability:`luma`,part:`name`}),e(`span`,Ct,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,wt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Tt,[n.modelValue?.request?.prompt?(h(),s(`p`,Et,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Dt,` - (`+i(n.$t(`luma.status.pending`))+`) `,1)),n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`span`,Ot,` - (`+i(n.$t(`luma.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,kt,[n.modelValue.response.video_url?(h(),s(`div`,At,[a(y,{src:n.modelValue.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response&&!n.config?.custom?(h(),s(`div`,jt,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.extendVideo`),placement:`top-start`},{default:p(()=>[a(b,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onExtend(e,n.modelValue?.response),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.extend`)),1)]),_:1})]),_:1},8,[`content`]),a(v,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(b,{type:`info`,size:`small`,class:`btn-action`,onClick:c[2]||=t(e=>n.onDownload(n.modelValue?.response?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(x,{path:`/luma/videos`,body:n.modelValue?.request},null,8,[`body`]),a(S,{service:`luma`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(E,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,Mt,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Nt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.state===`failed`||n.modelValue?.response?.success===!1?(h(),s(`div`,$,[a(E,{closable:!1,class:`failure`},{template:p(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.failure`)),1)]),default:p(()=>[e(`p`,Pt,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Ft,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(w,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,It,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Lt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.traceId`))+`: `+i(n.modelValue?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),!n.modelValue?.response||n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`div`,Rt,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`luma.status.processing`:`luma.status.pending`)),1)]),default:p(()=>[e(`p`,zt,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var Vt=_({name:`RecentPanel`,components:{BotPlaceholder:oe,TaskPreview:z(vt,[[`render`,Bt],[`__scopeId`,`data-v-46a32bda`]]),NoTasks:ee,ScrollList:O},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`,`extend`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ht={key:0},Ut={key:2,class:`w-full h-full flex items-center justify-center`};function Wt(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Ht,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[1]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,n=>(h(),f(g,{key:n.id,"model-value":n,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Ut,[a(v)])):o(``,!0)],64)}var Gt=_({name:`LumaIndex`,components:{ConfigPanel:_t,Layout:fe,RecentPanel:z(Vt,[[`render`,Wt]])},mixins:[B],inject:[`initialized`],emits:[`extend`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.luma?.status?.getApplications===x.Request},tasksLoading(){return this.$store.state.luma?.status?.getTasks===x.Request||this.fetchingTasks},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await A({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`luma/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`luma/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){console.debug(`scrolling down`),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(`luma/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ne(this.uploadTracker,e=>this.$t(e),e=>S.warning(e)))return;let e={...this.config,async:!0};if(!this.hasText(e.prompt)){S.error(this.$t(`luma.message.promptRequired`));return}if(e.prompt=e.prompt?.trim(),!W())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}S.info(this.$t(`luma.message.startingTask`)),te(`luma`,U.generate(e,{token:t})).then(()=>{S.success(this.$t(`luma.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?S.error(this.$t(`luma.message.usedUp`)):S.error(this.$t(`luma.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function Kt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`loading`,`onReachTop`])]),_:1})}var qt=z(Gt,[[`render`,Kt]]);export{qt as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{t as v}from"./upload-DimlTiIl.js";import{t as y}from"./tooltip-DS2H_6sn.js";import{t as b}from"./alert-BprQRUmf.js";import{h as x,v as S}from"./models-ClsawnaQ.js";import{t as C}from"./drawer-B447BS-l.js";import{t as w}from"./switch-CSqIz9Bn.js";import{t as T}from"./clock-DiJ9741Z.js";import{a as E,c as D,n as O,o as k,r as ee,t as A}from"./pagination-BEagsSLK.js";import{t as j}from"./info-DGrLjV90.js";import{t as M}from"./trash-2-aiyl_0iW.js";import{t as N}from"./triangle-alert-D120-HZx.js";import{t as P}from"./upload-CRKN-pH5.js";import{t as F}from"./wand-sparkles-BYpsEWX0.js";import"./constants-D04Y0eol.js";import{$t as I,Fi as L,Jt as R,Mr as te,O as z,Qt as ne,en as B,in as V,nn as H,or as U,pn as W,si as G,tn as K,xi as q}from"./index-7B54VLaT.js";import{t as J}from"./CopyToClipboard-DOtA8ld0.js";import{t as Y}from"./ReportButton-CjFO3h6Z.js";import{t as X}from"./FilePreview-OXl4Fg3S.js";import{t as Z}from"./ImagePreview-Hobf9iDz.js";import{n as re}from"./taskDrawerMixin-DyAUhFEq.js";import{t as ie}from"./Consumption-Cvw-XQ7S.js";import{t as Q}from"./VideoPlayer-BCs9hDNt.js";import{t as ae}from"./ApiCodeButton-Da3_C3Lz.js";import{t as oe}from"./BotPlaceholder-C3WTtRMA.js";var se=_({name:`LayoutLuma`,components:{MagicIcon:F,ElDrawer:C,ElButton:L},mixins:[re]}),ce={class:`main flex flex-row flex-1`},le={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)]`},ue={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function de(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,ce,[e(`div`,le,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,ue,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var fe=z(se,[[`render`,de],[`__scopeId`,`data-v-d13d43a9`]]),pe=_({name:`EnhancementSelector`,components:{ElSwitch:w,InfoIcon:k},computed:{value:{get(){return this.$store.state.luma?.config?.enhancement},set(e){console.debug(`set enhancement`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,enhancement:e})}}},mounted(){this.value===void 0&&(this.value=!0)}}),me={class:`relative`},he={class:`flex justify-between`},ge={class:`flex justify-start items-center`},_e={class:`text-sm font-bold`},ve={class:`flex justify-end items-center`};function ye(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,me,[e(`div`,he,[e(`div`,ge,[e(`span`,_e,i(t.$t(`luma.name.enhancement`)),1),a(d,{content:t.$t(`luma.description.enhancement`)},null,8,[`content`])]),e(`div`,ve,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var be=z(pe,[[`render`,ye]]),xe=_({name:`CustomSelector`,components:{ElSwitch:w,InfoIcon:k},computed:{value:{get(){return this.$store.state.luma?.config?.custom},set(e){console.debug(`set custom`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,custom:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),Se={class:`relative`},Ce={class:`flex justify-between`},we={class:`flex justify-start items-center`},Te={class:`text-sm font-bold`},Ee={class:`flex justify-end items-center`};function De(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,Se,[e(`div`,Ce,[e(`div`,we,[e(`span`,Te,i(t.$t(`luma.name.custom`)),1),a(d,{content:t.$t(`luma.description.custom`)},null,8,[`content`])]),e(`div`,Ee,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Oe=z(xe,[[`render`,De]]),ke=_({name:`LoopSelector`,components:{ElSwitch:w,InfoIcon:k},computed:{value:{get(){return this.$store.state.luma?.config?.loop},set(e){console.debug(`set loop`,e),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,loop:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),Ae={class:`relative`},je={class:`flex justify-between`},Me={class:`flex justify-start items-center`},Ne={class:`text-sm font-bold`},Pe={class:`flex justify-end items-center`};function Fe(t,n,r,o,c,u){let d=l(`info-icon`),f=l(`el-switch`);return h(),s(`div`,Ae,[e(`div`,je,[e(`div`,Me,[e(`span`,Ne,i(t.$t(`luma.name.loop`)),1),a(d,{content:t.$t(`luma.description.loop`)},null,8,[`content`])]),e(`div`,Pe,[a(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ie=z(ke,[[`render`,Fe]]),Le=_({name:`EndImage`,components:{UploadIcon:P,ElUpload:v,ElButton:L,ImagePreview:Z,InfoIcon:k},mixins:[H,K,I,R],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetEndImageUrl()},methods:{onExceed(){S.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){S.error(this.$t(`luma.message.uploadReferencesError`))},onSetEndImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,end_image_url:e})},async onSuccess(){this.onSetEndImageUrl()}}}),Re={class:`relative`},ze={class:`flex justify-between`},Be={class:`flex justify-start items-center`},Ve={class:`text-sm font-bold`};function He(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`span`,Ve,i(t.$t(`luma.name.endImageUrl`)),1),a(g,{content:t.$t(`luma.description.endImageUrl`)},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:5,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?(h(),f(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):o(``,!0)]),default: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(`luma.button.uploadEndImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Ue=z(Le,[[`render`,He],[`__scopeId`,`data-v-04c461bb`]]),We=_({name:`StartImage`,components:{UploadIcon:P,ElUpload:v,ElButton:L,ImagePreview:Z,InfoIcon:k},mixins:[H,K,I,R],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.luma?.config?.start_image_url},set(){}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){S.warning(this.$t(`luma.message.uploadReferencesExceed`))},onError(){S.error(this.$t(`luma.message.uploadReferencesError`))},onSetStartImageUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,start_image_url:e})},async onSuccess(){this.onSetStartImageUrl()}}}),Ge={class:`relative`},Ke={class:`flex justify-between`},qe={class:`flex justify-start items-center`},Je={class:`text-sm font-bold`};function Ye(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`image-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Ge,[e(`div`,Ke,[e(`div`,qe,[e(`span`,Je,i(t.$t(`luma.name.startImageUrl`)),1),a(g,{content:t.$t(`luma.description.startImageUrl`)},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:5,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.percentage==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},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(`luma.button.uploadStartImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`before-upload`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Xe=z(We,[[`render`,Ye],[`__scopeId`,`data-v-31c07a19`]]),Ze=_({name:`UploadVideo`,components:{UploadIcon:P,ElUpload:v,ElButton:L,InfoIcon:k,FilePreview:X},mixins:[K,I],data(){return{fileList:[],uploadUrl:G()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.luma?.config?.video_url},set(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e})}}},mounted(){this.value||=void 0},methods:{onExceed(){S.warning(this.$t(`luma.message.uploadVideoExceed`))},onError(){S.error(this.$t(`luma.message.uploadVideoError`))},beforeUpload(e){let t=e.type===`video/mp4`,n=e.size/1024/1024<10;return t?n?!0:(S.error(this.$t(`luma.message.uploadVideoSizeExceed`)),!1):(S.error(this.$t(`luma.message.uploadVideoTypeFailed`)),!1)},onSetVideoUrl(){let e=this.urls?.[0];this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_url:e,action:`extend`})},async onSuccess(){this.onSetVideoUrl()}}}),Qe={class:`relative`},$e={class:`flex justify-between`},et={class:`flex justify-start items-center`},tt={class:`text-sm font-bold`};function nt(t,n,c,u,d,m){let g=l(`info-icon`),_=l(`file-preview`),v=l(`upload-icon`),y=l(`el-button`),b=l(`el-upload`);return h(),s(`div`,Qe,[e(`div`,$e,[e(`div`,et,[e(`span`,tt,i(t.$t(`luma.name.videoUrl`)),1),a(g,{content:t.$t(`luma.description.videoUrl`)},null,8,[`content`])])]),a(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.mp4`,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==null?o(``,!0):(h(),f(_,{key:0,url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},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(`luma.button.uploadVideoUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`before-upload`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var rt=z(Ze,[[`render`,nt],[`__scopeId`,`data-v-2189fc52`]]),it=_({name:`PromptInput`,components:{PromptTextarea:E},computed:{prompt:{get(){return this.$store.state.luma?.config?.prompt},set(e){this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,prompt:e})}}},mounted(){this.prompt||=``}});function at(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`luma.name.prompt`),info:e.$t(`luma.description.prompt`),placeholder:e.$t(`luma.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var ot=z(it,[[`render`,at]]),st=_({name:`ExtendFromInput`,components:{VideoPlayer:Q},props:{modelValue:{type:Object,required:!1,default:void 0}},data(){return{options:{quality:{default:`1080p`}}}},computed:{config(){return this.$store.state.luma?.config}}}),ct={class:`relative`},lt={class:`flex mb-2`},ut={class:`text-sm font-bold`};function dt(t,n,r,a,c,u){let d=l(`video-player`);return h(),s(`div`,ct,[e(`div`,lt,[e(`span`,ut,i(t.$t(`luma.name.extend`)),1)]),e(`div`,null,[t.config?.video_url?(h(),f(d,{key:0,src:t.config?.video_url},null,8,[`src`])):o(``,!0)])])}var ft=_({name:`ConfigPanel`,components:{MagicIcon:F,LoopSelector:Ie,StartImageInput:Xe,EndImageInput:Ue,EnhancementSelector:be,ElButton:L,PromptInput:ot,ExtendFromInput:z(st,[[`render`,dt]]),CustomSelector:Oe,UploadVideo:rt,Consumption:ie},emits:[`generate`],computed:{config(){return this.$store.state.luma?.config},consumption(){return V(this.config,this.service?.cost)},service(){return this.$store.state.luma?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),pt={class:`flex flex-col h-full`},mt={class:`flex-1 overflow-y-auto p-5`},ht={class:`flex flex-col items-center justify-center px-5 pb-5`};function gt(t,n,c,u,d,m){let g=l(`extend-from-input`),_=l(`prompt-input`),v=l(`custom-selector`),y=l(`upload-video`),b=l(`start-image-input`),x=l(`end-image-input`),S=l(`enhancement-selector`),C=l(`loop-selector`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,pt,[e(`div`,mt,[t.config?.video_id||t.config?.video_url?(h(),f(g,{key:0,class:`mb-4`})):o(``,!0),a(_,{class:`mb-4`}),t.config?.video_id?o(``,!0):(h(),f(v,{key:1,class:`mb-4`})),t.config?.custom?(h(),f(y,{key:2,class:`mb-4`})):o(``,!0),!(t.config?.video_id||t.config?.video_url)&&!t.config?.custom?(h(),f(b,{key:3,class:`mb-4`})):o(``,!0),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),a(C,{class:`mb-4`})]),e(`div`,ht,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),t.config?.video_url!==void 0||t.config?.custom?(h(),f(E,{key:0,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.extend`)),1)]),_:1},8,[`onClick`])):(h(),f(E,{key:1,type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`luma.button.generate`)),1)]),_:1},8,[`onClick`]))])])}var _t=z(ft,[[`render`,gt]]),vt=_({name:`TaskPreview`,components:{DeleteIcon:M,ChannelIcon:D,InfoIcon:j,MagicIcon:F,TimeIcon:T,WarningIcon:N,CopyToClipboard:J,ElAlert:b,VideoPlayer:Q,ElTooltip:y,ElButton:L,ApiCodeButton:ae,ReportButton:Y},props:{modelValue:{type:Object,required:!0}},emits:[`extend`],data(){return{}},computed:{application(){return this.$store.state.luma?.application},config(){return this.$store.state.luma?.config}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await q.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(`luma/deleteTask`,{id:e}),S.success(this.$t(`common.message.deleteTaskSuccess`))}catch{S.error(this.$t(`common.message.deleteTaskFailed`))}}},onExtend(e,t){console.debug(`set config`,t),this.$store.commit(`luma/setConfig`,{...this.$store.state.luma?.config,video_id:t.video_id,prompt:t.prompt,action:`extend`,thumbnail_url:t.thumbnail_url,video_url:t.video_url}),this.$emit(`extend`)},onDownload(e){window.open(e,`_blank`)}}}),yt={class:`preview`},bt={class:`left`},xt={class:`main`},St={class:`bot`},Ct={class:`datetime`},wt=[`aria-label`],Tt={class:`info`},Et={key:0,class:`prompt mt-2`},Dt={key:0},Ot={key:1},kt={key:0,class:n({content:!0,failed:!0})},At={key:0,class:`mb-4`},jt={key:1,class:n({operations:!0,"mt-2":!0,"mb-4":!0})},Mt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Nt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:n({content:!0})},Pt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ft={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},It={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Lt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Rt={key:2,class:n({content:!0})},zt={class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Bt(n,c,u,d,f,m){let g=l(`capability-presentation`),_=l(`delete-icon`),v=l(`el-tooltip`),y=l(`video-player`),b=l(`el-button`),x=l(`api-code-button`),S=l(`report-button`),C=l(`magic-icon`),w=l(`copy-to-clipboard`),T=l(`time-icon`),E=l(`el-alert`),D=l(`warning-icon`),O=l(`info-icon`),k=l(`channel-icon`);return h(),s(`div`,yt,[e(`div`,bt,[a(g,{capability:`luma`,part:`avatar`,class:`avatar`})]),e(`div`,xt,[e(`div`,St,[a(g,{capability:`luma`,part:`name`}),e(`span`,Ct,i(n.$dayjs.format(``+new Date(parseFloat((n.modelValue?.created_at||``).toString())*1e3))),1),a(v,{effect:`dark`,content:n.$t(`common.button.delete`),placement:`top`},{default:p(()=>[n.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":n.$t(`common.button.delete`),onClick:c[0]||=t((...e)=>n.onDelete&&n.onDelete(...e),[`stop`])},[a(_,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,wt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Tt,[n.modelValue?.request?.prompt?(h(),s(`p`,Et,[r(i(n.modelValue?.request?.prompt)+` `,1),n.modelValue?.response?o(``,!0):(h(),s(`span`,Dt,` - (`+i(n.$t(`luma.status.pending`))+`) `,1)),n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`span`,Ot,` - (`+i(n.$t(`luma.status.processing`))+`) `,1)):o(``,!0)])):o(``,!0)]),n.modelValue?.response?.success===!0?(h(),s(`div`,kt,[n.modelValue.response.video_url?(h(),s(`div`,At,[a(y,{src:n.modelValue.response.video_url},null,8,[`src`])])):o(``,!0),n.modelValue?.response&&!n.config?.custom?(h(),s(`div`,jt,[a(v,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.extendVideo`),placement:`top-start`},{default:p(()=>[a(b,{type:`info`,size:`small`,class:`btn-action`,onClick:c[1]||=t(e=>n.onExtend(e,n.modelValue?.response),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.extend`)),1)]),_:1})]),_:1},8,[`content`]),a(v,{class:`box-item`,effect:`dark`,content:n.$t(`luma.message.downloadVideo`),placement:`top-start`},{default:p(()=>[a(b,{type:`info`,size:`small`,class:`btn-action`,onClick:c[2]||=t(e=>n.onDownload(n.modelValue?.response?.video_url),[`stop`])},{default:p(()=>[r(i(n.$t(`luma.button.download`)),1)]),_:1})]),_:1},8,[`content`]),a(x,{path:`/luma/videos`,body:n.modelValue?.request},null,8,[`body`]),a(S,{service:`luma`,"target-id":n.modelValue?.id,snapshot:{prompt:n.modelValue?.request?.prompt}},null,8,[`target-id`,`snapshot`])])):o(``,!0),a(E,{closable:!1,class:`mt-2 success`},{default:p(()=>[e(`p`,Mt,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,Nt,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0)]),_:1})])):o(``,!0),n.modelValue?.response?.state===`failed`||n.modelValue?.response?.success===!1?(h(),s(`div`,$,[a(E,{closable:!1,class:`failure`},{template:p(()=>[a(D,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.failure`)),1)]),default:p(()=>[e(`p`,Pt,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])]),e(`p`,Ft,[a(O,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.failureReason`))+`: `+i(n.modelValue?.response?.error?.message)+` `,1),a(w,{content:n.modelValue?.response?.error?.message},null,8,[`content`])]),n.modelValue?.elapsed?(h(),s(`p`,It,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.elapsed`))+`: `+i(n.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),e(`p`,Lt,[a(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.traceId`))+`: `+i(n.modelValue?.trace_id)+` `,1),a(w,{content:n.modelValue?.response?.trace_id},null,8,[`content`])])]),_:1})])):o(``,!0),!n.modelValue?.response||n.modelValue?.response?.state===`processing`||n.modelValue?.response?.state===`pending`?(h(),s(`div`,Rt,[a(E,{closable:!1,class:`info`},{template:p(()=>[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(n.modelValue?.response?`luma.status.processing`:`luma.status.pending`)),1)]),default:p(()=>[e(`p`,zt,[a(C,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(n.$t(`luma.name.taskId`))+`: `+i(n.modelValue?.id)+` `,1),a(w,{content:n.modelValue?.id},null,8,[`content`])])]),_:1})])):o(``,!0)])])}var Vt=_({name:`RecentPanel`,components:{BotPlaceholder:oe,TaskPreview:z(vt,[[`render`,Bt],[`__scopeId`,`data-v-46a32bda`]]),NoTasks:ee,ScrollList:O},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`,`extend`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.luma?.tasks,items:this.$store.state.luma?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Ht={key:0},Ut={key:2,class:`w-full h-full flex items-center justify-center`};function Wt(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Ht,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks w-full h-full overflow-y-auto`,loading:e.loading,onReachTop:t[1]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,n=>(h(),f(g,{key:n.id,"model-value":n,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,Ut,[a(v)])):o(``,!0)],64)}var Gt=_({name:`LumaIndex`,components:{ConfigPanel:_t,Layout:fe,RecentPanel:z(Vt,[[`render`,Wt]])},mixins:[B],inject:[`initialized`],emits:[`extend`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.luma?.status?.getApplications===x.Request},tasksLoading(){return this.$store.state.luma?.status?.getTasks===x.Request||this.fetchingTasks},credential(){return this.$store.state.luma.credential},config(){return this.$store.state.luma.config},application(){return this.$store.state.luma.application},tasks(){return this.$store.state.luma.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await A({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`luma/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`luma/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){console.debug(`scrolling down`),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(`luma/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ne(this.uploadTracker,e=>this.$t(e),e=>S.warning(e)))return;let e={...this.config,async:!0};if(!this.hasText(e.prompt)){S.error(this.$t(`luma.message.promptRequired`));return}if(e.prompt=e.prompt?.trim(),!W())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}S.info(this.$t(`luma.message.startingTask`)),te(`luma`,U.generate(e,{token:t})).then(()=>{S.success(this.$t(`luma.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?S.error(this.$t(`luma.message.usedUp`)):S.error(this.$t(`luma.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()},hasText(e){return typeof e==`string`&&e.trim().length>0}}});function Kt(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop,onExtend:t[0]||=t=>e.$emit(`extend`)},null,8,[`loading`,`onReachTop`])]),_:1})}var qt=z(Gt,[[`render`,Kt]]);export{qt as default};