@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{o as e}from"./rolldown-runtime--c01j_DQ.js";import{A as t,I as n,Jt as r,L as i,M as a,N as o,T as s,a as c,at as l,c as u,d,ht as f,i as p,j as m,l as h,mt as g,n as _,o as v,ot as ee,qt as y,r as b,rt as x,s as S,t as C,tt as w,u as T,x as te,z as E}from"./vendor-chart-Dw-P17PN.js";import{r as D,t as O}from"./select-ChyQns32.js";import{n as k,t as A}from"./table-B5uHA9cN.js";import{n as j,t as M}from"./tabs-BY90FIeI.js";import{a as N,i as P,p as F,v as I}from"./models-ClsawnaQ.js";import{t as L}from"./card-IQwqnRJR.js";import{n as R,r as z}from"./radio-BNhFzeBO.js";import{n as B,t as V}from"./file-output-CJCqrTiV.js";import{n as H,t as U}from"./row-BlBs21oD.js";import{t as W}from"./empty-C5KjRN0h.js";import{n as G,t as ne}from"./skeleton-Dj_a_iIP.js";import{t as re}from"./switch-CI_r8TsE.js";import{t as ie}from"./boxes-WbbO39Z7.js";import{Ar as K,Ei as q,Fi as J,Ni as Y,O as ae,Tr as oe,_r as se,gr as X,hr as ce,si as le}from"./index-C_sjkBHo.js";import{t as ue}from"./CopyToClipboard-D1PN1vgU.js";import{t as de}from"./pagination-BM4GJ-Sf.js";var fe=e(K());v.register(c,u,p,b,S,T,d,h);var Z=[`#5B8FF9`,`#5AD8A6`,`#5D7092`,`#F6BD16`,`#6F5EF9`,`#6DC8EC`,`#945FB9`,`#FF9845`,`#1E9493`,`#FF99C3`],Q=`#C0C4CC`,pe=.01,me=20;function he(e){return e<=Z.length?Z.slice(0,e):Array.from({length:e},(t,n)=>`hsl(${Math.round(n*360/e)}, 62%, ${n%2==0?55:45}%)`)}var ge=15e3,_e=E({name:`ConsoleUsageList`,components:{ApplicationsIcon:ie,ExportIcon:V,Pagination:de,ElTag:Y,ElDatePicker:B,ElTable:A,ElSelect:D,ElOption:O,CopyToClipboard:ue,ElRow:U,ElCol:H,ElTableColumn:k,ElCard:L,ElRadioButton:R,ElRadioGroup:z,ElSkeleton:ne,ElSkeletonItem:G,ElDialog:q,ElTabs:j,ElTabPane:M,ElButton:J,ElEmpty:W,ElSwitch:re,BarChart:C,DoughnutChart:_},data(){return{applicationIds:this.$route.query.application_id?.toString()?this.$route.query.application_id?.toString().split(`,`):[],apiIds:this.$route.query.api_id?.toString()?this.$route.query.api_id?.toString().split(`,`):[],applications:[],apis:[],apisLoading:!1,credentialType:P,serviceType:N,apiUsages:[],proxyUsages:[],createdAtRange:(()=>{let e=this.$route.query.created_at_to?.toString(),t=this.$route.query.created_at_from?.toString();if(t&&e)return[new Date(t),new Date(e)];let n=new Date,r=new Date;return r.setDate(1),r.setHours(0,0,0,0),[r,n]})(),shortcuts:[{text:this.$t(`usage.shortcuts.thisMonth`),value:()=>{let e=new Date,t=new Date;return t.setDate(1),t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.today`),value:()=>{let e=new Date,t=new Date;return t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.last1Day`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-1),[t,e]}},{text:this.$t(`usage.shortcuts.last3Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-3),[t,e]}},{text:this.$t(`usage.shortcuts.last7Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-7),[t,e]}},{text:this.$t(`usage.shortcuts.last1Month`),value:()=>{let e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),[t,e]}}],type:this.$route.query.type?.toString()||N.API,loading:!1,total:void 0,limit:15,totalUsed:0,barChartLabels:[],barChartSeries:[],chartView:`trend`,apiBreakdown:[],pieLabels:[],pieData:[],pieColors:[],aggLoading:!1,detailDialogVisible:!1,detailRow:null,detailActiveTab:`request`,detailLoading:!1,exporting:!1,statusCodeFilter:this.$route.query.status_code?.toString()||``,traceId:this.$route.query.trace_id?.toString()||``,statusCodeOptions:[],statusCodeOptionsLoading:!1,autoRefresh:!0,autoRefreshTimer:null,fetchSeq:0}},computed:{redirect(){return this.$route.query?.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},totalUsedString(){return`${(this.totalUsed||0).toFixed(2)}`},barChartData(){return{labels:this.barChartLabels,datasets:this.barChartSeries.map(e=>({label:e.label,data:e.data,backgroundColor:e.color,maxBarThickness:36,borderRadius:2,borderSkipped:!1}))}},barChartOptions(){let e=e=>new Intl.NumberFormat().format(Math.round(((e||0)+2**-52)*100)/100);return{responsive:!0,maintainAspectRatio:!1,interaction:{mode:`index`,intersect:!1},plugins:{legend:{position:`bottom`,labels:{usePointStyle:!0,pointStyle:`circle`,boxWidth:8,boxHeight:8,padding:14},onClick:(e,t,n)=>{let r=n?.chart;if(!r||t?.datasetIndex===void 0)return;let i=t.datasetIndex,a=r.data?.datasets||[];a.some((e,t)=>t!==i&&r.isDatasetVisible(t))?a.forEach((e,t)=>r.setDatasetVisibility(t,t===i)):a.forEach((e,t)=>r.setDatasetVisibility(t,!0)),r.update()}},title:{display:!1},tooltip:{itemSort:(e,t)=>(t.parsed?.y||0)-(e.parsed?.y||0),callbacks:{label:t=>` ${t.dataset.label}: ${e(t.parsed.y)}`,footer:t=>`${this.$t(`usage.title.totalUsed`)}: ${e(t.reduce((e,t)=>e+(t.parsed?.y||0),0))}`}}},scales:{x:{stacked:!0,grid:{display:!1},ticks:{maxRotation:0,autoSkip:!0,autoSkipPadding:16}},y:{stacked:!0,beginAtZero:!0,border:{display:!1},grid:{color:`rgba(128, 128, 128, 0.15)`},ticks:{callback:t=>e(Number(t))}}}}},doughnutChartData(){return{labels:this.pieLabels,datasets:[{data:this.pieData,backgroundColor:this.pieColors,borderWidth:0,hoverOffset:6}]}},doughnutChartOptions(){let e=e=>this.fmtAmount(e),t=this.pieData.reduce((e,t)=>e+(t||0),0);return{responsive:!0,maintainAspectRatio:!1,cutout:`58%`,plugins:{legend:{position:`right`,labels:{usePointStyle:!0,pointStyle:`circle`,boxWidth:8,boxHeight:8,padding:12}},title:{display:!1},tooltip:{callbacks:{label:n=>{let r=n.parsed||0,i=t>0?(r/t*100).toFixed(1):`0`;return` ${n.label}: ${e(r)} (${i}%)`}}}}}}},watch:{page:{handler(){this.onFetchUsages()}},type:{handler(){this.applicationIds=[],this.apiIds=[],this.onApplicationsChange(this.applicationIds),this.onFetchApplications(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()}},autoRefresh:{handler(e){e?this.startAutoRefresh():this.stopAutoRefresh()}}},mounted(){this.onFetchApplications(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions(),this.autoRefresh&&this.startAutoRefresh()},beforeUnmount(){this.stopAutoRefresh()},methods:{async onFetchUsages(e=!1){this.type===N.API?this.onFetchApiUsages(e):this.type===N.Proxy&&this.onFetchProxyUsages(e)},startAutoRefresh(){this.stopAutoRefresh(),this.autoRefreshTimer=window.setInterval(()=>{document.hidden||this.onFetchUsages(!0)},ge)},stopAutoRefresh(){this.autoRefreshTimer!==null&&(clearInterval(this.autoRefreshTimer),this.autoRefreshTimer=null)},async onApiChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,api_id:e}}),this.onFetchApiUsages(),this.onFetchAggregate()},async onApisChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,api_id:e&&e.length?e.join(`,`):``}}),this.onFetchApiUsages(),this.onFetchAggregate()},async onTimeRangeChanged(){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,created_at_from:this.createdAtRange?this.$dayjs.format(this.createdAtRange[0].toString(),`YYYY-MM-DDTHH:mm:ss.SSSSSSZ`):``,created_at_to:this.createdAtRange?this.$dayjs.format(this.createdAtRange[1].toString(),`YYYY-MM-DDTHH:mm:ss.SSSSSSZ`):``}}),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()},async onApplicationChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,application_id:e}}),this.onFetchUsages(),this.onFetchAggregate()},async onApplicationsChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,application_id:e&&e.length?e.join(`,`):``}}),this.onFetchUsages(),this.onFetchAggregate()},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},getRemainingAmount(e){if(e.remaining_amount===void 0||e.remaining_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.remaining_amount?.toFixed(6)} ${t}`},getUsedAmount(e){if(e.used_amount===void 0||e.used_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.used_amount?.toFixed(6)} ${t}`},getDeductedAmount(e){if(e?.deducted_amount===void 0||e?.deducted_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.deducted_amount?.toFixed(6)} ${t}`},getOriginalAmount(e){if(e?.original_amount===void 0||e?.original_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.original_amount?.toFixed(6)} ${t}`},onStatusCodeChange(e){let t={...this.$route.query},n=(e||``).trim();n?t.status_code=n:delete t.status_code,delete t.status_code_filter,this.$router.push({name:this.$route.name?.toString(),query:t}),this.onFetchUsages(),this.onFetchAggregate()},async onFetchStatusCodeOptions(){this.statusCodeOptionsLoading=!0;try{let{data:e}=await X.getStatusCodes({user_id:this.$store.getters.user.id,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{}});this.statusCodeOptions=(e?.items||[]).slice().sort((e,t)=>e-t)}catch{this.statusCodeOptions=[]}finally{this.statusCodeOptionsLoading=!1}},formatElapsed(e){return e==null||Number.isNaN(e)?`-`:e<1?`${Math.round(e*1e3)} ms`:`${e.toFixed(2)} s`},getSimpleMetadata(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))n===`request`||n===`response`||typeof r==`object`&&r||(t[n]=r);return t},getCredentialLabel(e){return e.credential?.name?.trim()||e.credential?.id||e.credential_id||`-`},onShowDetail(e){this.detailRow={...e,metadata:void 0},this.detailActiveTab=`request`,this.detailDialogVisible=!0,this.detailLoading=!0,e.id&&X.get(e.id).then(e=>{this.detailRow=e.data}).finally(()=>{this.detailLoading=!1})},formatJson(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}},onFetchApplications(){oe.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:F.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,ce.getAll({limit:1e3,offset:0,ordering:`-created_at`}).then(({data:e})=>{this.apis=e.items}).catch(()=>{}).finally(()=>{this.apisLoading=!1})},onFetchApiUsages(e=!1){e||(this.loading=!0);let t=++this.fetchSeq;X.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{},...this.traceId?{trace_id:this.traceId}:{}}).then(({data:e})=>{t===this.fetchSeq&&(this.apiUsages=e.items,this.total=e.count)}).catch(()=>{}).finally(()=>{e||(this.loading=!1)})},onFetchProxyUsages(e=!1){e||(this.loading=!0);let t=++this.fetchSeq;se.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{}}).then(({data:e})=>{t===this.fetchSeq&&(this.proxyUsages=e.items,this.total=e.count)}).catch(()=>{}).finally(()=>{e||(this.loading=!1)})},async onExport(){let e=this.$store.state.token?.access;if(!e){I.error(this.$t(`usage.message.exportFailed`));return}let t={user_id:this.$store.getters.user.id,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{}},n=`${le()}/api/v1/usage/apis/export/?${fe.default.stringify(t,{arrayFormat:`repeat`})}`,r=null,i=window.showSaveFilePicker;if(typeof i==`function`)try{r=await i({suggestedName:`usages.csv`,types:[{description:`CSV`,accept:{"text/csv":[`.csv`]}}]})}catch(e){if(e?.name===`AbortError`)return;r=null}this.exporting=!0;try{let t=await fetch(n,{headers:{authorization:`Bearer ${e}`}});if(!t.ok||!t.body)throw Error(`export failed: ${t.status}`);if(r)await t.body.pipeTo(await r.createWritable());else{let e=await t.blob(),n=window.URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`usages.csv`,r.click(),window.URL.revokeObjectURL(n)}}catch{I.error(this.$t(`usage.message.exportFailed`))}finally{this.exporting=!1}},fmtAmount(e){return new Intl.NumberFormat().format(Math.round(((e||0)+2**-52)*100)/100)},async onFetchAggregate(){if(this.type!==this.serviceType.API)return;this.aggLoading=!0;let e={user_id:this.$store.getters.user.id,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},timezone:Intl.DateTimeFormat().resolvedOptions().timeZone};try{let{data:t}=await X.getAggregate(e);this.totalUsed=t.total||0;let n=Array.from(new Set((t.items||[]).map(e=>e.date))).sort(),r={},i={};(t.items||[]).forEach(e=>{let t=e.amount||0;(r[e.date]||(r[e.date]={}))[e.api_id]=(r[e.date]?.[e.api_id]||0)+t,i[e.api_id]=(i[e.api_id]||0)+t});let a=Object.keys(i).sort((e,t)=>i[t]-i[e]),o=a.reduce((e,t)=>e+i[t],0),s=a.length;if(o>0){let e=o*(1-pe),t=0;for(let n=0;n<a.length;n++)if(t+=i[a[n]],t>=e){s=n+1;break}s=Math.min(s,me)}a.length-s===1&&(s=a.length);let c=a.slice(0,s),l=new Set(c),u=he(c.length),d=a.slice(s),f=`${this.$t(`usage.value.others`)} (${d.length})`,p=c.map((e,i)=>({key:e,label:t.apis?.[e]?.title||e,data:n.map(t=>r[t]?.[e]||0),color:u[i]}));if(d.length){let e=n.map(e=>Object.entries(r[e]||{}).reduce((e,[t,n])=>l.has(t)?e:e+n,0));e.some(e=>e>0)&&p.push({key:`__others__`,label:f,data:e,color:Q})}this.apiBreakdown=a.map((e,n)=>({key:e,label:t.apis?.[e]?.title||e,amount:i[e],color:n<c.length?u[n]:Q,share:o>0?i[e]/o:0}));let m=[],h=[],g=[];c.forEach((e,n)=>{m.push(t.apis?.[e]?.title||e),h.push(i[e]),g.push(u[n])});let _=d.reduce((e,t)=>e+i[t],0);_>0&&(m.push(f),h.push(_),g.push(Q)),this.pieLabels=m,this.pieData=h,this.pieColors=g,this.barChartLabels=n,this.barChartSeries=p}finally{this.aggLoading=!1}}}}),ve={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},ye={class:`inline-block w-9`},be={class:`inline-block`},xe={key:1,class:`summary-card`},Se={class:`icon-wrapper`},Ce={class:`text-left`},we={class:`description`},Te={class:`value`},Ee={class:`flex flex-wrap items-center justify-between gap-2`},De={class:`text-[15px] font-medium text-[var(--el-text-color-primary)]`},Oe={class:`chart-wrapper`},ke={class:`share-cell`},Ae={class:`share-bar`},je={class:`share-pct`},Me={class:`flex items-center justify-end gap-2 mb-4`},Ne={class:`text-sm text-[var(--el-text-color-regular)]`},Pe={key:0},Fe={key:0},Ie={key:1},Le={class:`flex flex-wrap gap-2`},Re={class:`key`},ze={key:0,class:`cursor-pointer`},Be={class:`key`},Ve={key:0,class:`cursor-pointer`},$={class:`created-at`},He={class:`key`},Ue={key:0,class:`cursor-pointer`},We={class:`created-at`},Ge={key:1,class:`detail-json`},Ke={key:2,class:`text-gray-400`},qe={key:1,class:`detail-json`},Je={key:2,class:`text-gray-400`},Ye={class:`float-right`};function Xe(e,c,u,d,p,h){let _=l(`el-col`),v=l(`el-row`),b=l(`el-radio-button`),S=l(`el-radio-group`),C=l(`el-option`),T=l(`el-select`),E=l(`el-skeleton-item`),D=l(`el-skeleton`),O=l(`el-date-picker`),k=l(`export-icon`),A=l(`el-button`),j=l(`applications-icon`),M=l(`el-card`),N=l(`bar-chart`),P=l(`el-empty`),F=l(`doughnut-chart`),I=l(`el-table-column`),L=l(`el-table`),R=l(`el-switch`),z=l(`el-tag`),B=l(`copy-to-clipboard`),V=l(`el-tab-pane`),H=l(`el-tabs`),U=l(`el-dialog`),W=l(`pagination`),G=ee(`loading`);return w(),m(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[t(`h2`,ve,r(e.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),i(v,null,{default:g(()=>[i(_,{md:4,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,null,r(e.$t(`application.field.type`)),1),i(S,{modelValue:e.type,"onUpdate:modelValue":c[0]||=t=>e.type=t},{default:g(()=>[i(b,{value:e.serviceType.API,label:e.$t(`application.field.api`)},null,8,[`value`,`label`]),i(b,{value:e.serviceType.Proxy,label:e.$t(`application.field.proxy`)},null,8,[`value`,`label`])]),_:1},8,[`modelValue`])]),_:1}),f(i(_,{md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,ye,r(e.$t(`usage.field.application`)),1),i(T,{modelValue:e.applicationIds,"onUpdate:modelValue":c[1]||=t=>e.applicationIds=t,placeholder:e.$t(`usage.field.application`),clearable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApplicationsChange},{default:g(()=>[(w(!0),o(s,null,x(e.applications,e=>(w(),m(C,{key:e.id,label:e.service?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[te,!1]]),e.type===e.serviceType.API?(w(),m(_,{key:0,md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,be,r(e.$t(`usage.field.api`)),1),e.apisLoading?(w(),m(D,{key:0,animated:``,class:`w-full`},{template:g(()=>[i(E,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(w(),m(T,{key:1,modelValue:e.apiIds,"onUpdate:modelValue":c[2]||=t=>e.apiIds=t,placeholder:e.$t(`usage.field.api`),clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApisChange},{default:g(()=>[(w(!0),o(s,null,x(e.apis,e=>(w(),m(C,{key:e?.id,label:e?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]))]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(O,{modelValue:e.createdAtRange,"onUpdate:modelValue":c[3]||=t=>e.createdAtRange=t,type:`datetimerange`,class:`w-full`,shortcuts:e.shortcuts,"range-separator":e.$t(`usage.placeholder.to`),"start-placeholder":e.$t(`usage.placeholder.startDate`),"end-placeholder":e.$t(`usage.placeholder.endDate`),onChange:e.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(T,{modelValue:e.statusCodeFilter,"onUpdate:modelValue":c[4]||=t=>e.statusCodeFilter=t,placeholder:e.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:e.statusCodeOptionsLoading,onChange:e.onStatusCodeChange},{default:g(()=>[(w(!0),o(s,null,x(e.statusCodeOptions,e=>(w(),m(C,{key:e,label:String(e),value:String(e)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:g(()=>[i(A,{type:`primary`,plain:``,loading:e.exporting,class:`w-full whitespace-nowrap`,onClick:e.onExport},{default:g(()=>[i(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(e.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):a(``,!0)]),_:1}),i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[e.type===e.serviceType.API?(w(),m(v,{key:0,gutter:24,class:`mb-5`},{default:g(()=>[i(_,{md:6,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{default:g(()=>[e.aggLoading?(w(),m(D,{key:0})):(w(),o(`div`,xe,[t(`div`,Se,[i(j,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),t(`div`,Ce,[t(`p`,we,r(e.$t(`usage.title.totalUsed`)),1),t(`p`,Te,r(e.totalUsedString),1)])]))]),_:1})]),_:1}),i(_,{md:18,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{header:g(()=>[t(`div`,Ee,[t(`span`,De,r(e.$t(`usage.title.usageAnalytics`)),1),i(S,{modelValue:e.chartView,"onUpdate:modelValue":c[5]||=t=>e.chartView=t,size:`small`},{default:g(()=>[i(b,{value:`trend`,label:e.$t(`usage.view.trend`)},null,8,[`label`]),i(b,{value:`distribution`,label:e.$t(`usage.view.distribution`)},null,8,[`label`]),i(b,{value:`breakdown`,label:e.$t(`usage.view.breakdown`)},null,8,[`label`])]),_:1},8,[`modelValue`])])]),default:g(()=>[t(`div`,Oe,[e.aggLoading?(w(),m(D,{key:0,class:`w-full`})):e.chartView===`trend`?(w(),o(s,{key:1},[e.barChartSeries.length?(w(),m(N,{key:0,data:e.barChartData,options:e.barChartOptions,class:`chart`},null,8,[`data`,`options`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):e.chartView===`distribution`?(w(),o(s,{key:2},[e.pieData.length?(w(),m(F,{key:0,data:e.doughnutChartData,options:e.doughnutChartOptions,class:`chart`},null,8,[`data`,`options`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):(w(),o(s,{key:3},[e.apiBreakdown.length?(w(),m(L,{key:0,data:e.apiBreakdown,size:`small`,height:`300`,class:`w-full`},{default:g(()=>[i(I,{label:e.$t(`usage.field.api`),"min-width":`160`},{default:g(e=>[t(`span`,{class:`color-dot`,style:y({backgroundColor:e.row.color})},null,4),t(`span`,null,r(e.row.label),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.consumed`),width:`120`,align:`right`},{default:g(n=>[t(`span`,null,r(e.fmtAmount(n.row.amount)),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.share`),width:`150`},{default:g(e=>[t(`div`,ke,[t(`div`,Ae,[t(`div`,{class:`share-bar-fill`,style:y({width:e.row.share*100+`%`,backgroundColor:e.row.color})},null,4)]),t(`span`,je,r((e.row.share*100).toFixed(1))+`%`,1)])]),_:1},8,[`label`])]),_:1},8,[`data`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64))])]),_:1})]),_:1})]),_:1})):a(``,!0),i(M,{shadow:`hover`},{default:g(()=>[t(`div`,Me,[t(`span`,Ne,r(e.$t(`usage.field.autoRefresh`)),1),i(R,{modelValue:e.autoRefresh,"onUpdate:modelValue":c[6]||=t=>e.autoRefresh=t},null,8,[`modelValue`])]),e.type===e.serviceType.API?f((w(),m(L,{key:0,data:e.apiUsages,stripe:``,"table-layout":`fixed`,"empty-text":e.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:g(()=>[i(I,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.api?.title),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.statusCode`),width:`120px`},{default:g(t=>[t.row.status_code?(w(),o(`span`,Pe,r(t.row.status_code),1)):(w(),m(z,{key:1,type:`warning`,size:`small`},{default:g(()=>[n(r(e.$t(`usage.value.processing`)),1)]),_:1}))]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.elapsed`),width:`120px`},{default:g(n=>[t(`span`,null,r(e.formatElapsed(n.row.elapsed)),1)]),_:1},8,[`label`]),i(I,{prop:`deducted_amount`,label:e.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:g(n=>[e.getDeductedAmount(n.row)===e.getOriginalAmount(n.row)?(w(),o(`div`,Fe,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)])):(w(),o(`div`,Ie,[c[9]||=t(`p`,null,null,-1),t(`p`,null,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)]),t(`p`,null,[t(`del`,null,r(e.getOriginalAmount(n.row)),1)])]))]),_:1},8,[`label`]),i(I,{prop:`remaining_amount`,label:e.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`260px`,"class-name":`text-center`},{default:g(i=>[t(`div`,Le,[i.row.original_amount>i.row.deducted_amount&&i.row.original_amount>0?(w(),m(z,{key:0,type:`success`,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:g(()=>[n(r(((i.row.original_amount-i.row.deducted_amount)*100/i.row.original_amount).toFixed(0)+`% OFF`),1)]),_:2},1024)):a(``,!0),(w(!0),o(s,null,x(e.getSimpleMetadata(i.row.metadata),(e,t)=>(w(),m(z,{key:t,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))])]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:g(t=>[t.row.id?(w(),m(A,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:n=>e.onShowDetail(t.row)},{default:g(()=>[n(r(e.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:1},8,[`label`]),i(I,{prop:`trace_id`,label:e.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:g(e=>[t(`span`,Re,r(e.row.trace_id),1),e.row.trace_id?(w(),o(`span`,ze,[i(B,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{prop:`credential_id`,label:e.$t(`usage.field.credential`),width:`200px`,"class-name":`text-center`},{default:g(n=>[t(`span`,Be,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(w(),o(`span`,Ve,[i(B,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.createdAt`),width:`200px`},{default:g(n=>[t(`span`,$,r(e.$dayjs.format(n.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[G,e.loading]]):a(``,!0),e.type===e.serviceType.Proxy?f((w(),m(L,{key:1,data:e.proxyUsages,stripe:``,"table-layout":`fixed`,"empty-text":e.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:g(()=>[i(I,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.service?.title),1)]),_:1},8,[`label`]),i(I,{prop:`remaining_amount`,label:e.$t(`usage.field.remainingAmount`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1),t(`span`,null,r(e.getOriginalAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`deducted_amount`,label:e.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getDeductedAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:g(e=>[(w(!0),o(s,null,x(e.row.metadata,(e,t)=>(w(),m(z,{key:t,class:`mb-2`},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))]),_:1},8,[`label`]),i(I,{prop:`credential_id`,label:e.$t(`usage.field.credential`),width:`200px`,"class-name":`text-center`},{default:g(n=>[t(`span`,He,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(w(),o(`span`,Ue,[i(B,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.createdAt`),width:`200px`},{default:g(n=>[t(`span`,We,r(e.$dayjs.format(n.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[G,e.loading]]):a(``,!0)]),_:1})]),_:1})]),_:1}),i(U,{modelValue:e.detailDialogVisible,"onUpdate:modelValue":c[8]||=t=>e.detailDialogVisible=t,title:e.$t(`usage.dialog.detailTitle`),width:`70%`,top:`5vh`,"destroy-on-close":``},{default:g(()=>[i(H,{modelValue:e.detailActiveTab,"onUpdate:modelValue":c[7]||=t=>e.detailActiveTab=t},{default:g(()=>[i(V,{label:e.$t(`usage.dialog.request`),name:`request`},{default:g(()=>[e.detailLoading?(w(),m(D,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.request?(w(),o(`pre`,Ge,r(e.formatJson(e.detailRow.metadata.request)),1)):(w(),o(`p`,Ke,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),i(V,{label:e.$t(`usage.dialog.response`),name:`response`},{default:g(()=>[e.detailLoading?(w(),m(D,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.response?(w(),o(`pre`,qe,r(e.formatJson(e.detailRow.metadata.response)),1)):(w(),o(`p`,Je,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`]),i(v,null,{default:g(()=>[i(_,{span:10,offset:14},{default:g(()=>[t(`div`,Ye,[i(W,{"current-page":e.page,"page-size":e.limit,total:e.total,onChange:e.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Ze=ae(_e,[[`render`,Xe],[`__scopeId`,`data-v-81b0a3c5`]]);export{Ze as default};
1
+ import{o as e}from"./rolldown-runtime--c01j_DQ.js";import{A as t,I as n,Jt as r,L as i,M as a,N as o,T as s,a as c,at as l,c as u,d,ht as f,i as p,j as m,l as h,mt as g,n as _,o as v,ot as ee,qt as y,r as b,rt as x,s as S,t as C,tt as w,u as T,x as te,z as E}from"./vendor-chart-Dw-P17PN.js";import{r as D,t as O}from"./select-DBAlqBh7.js";import{n as k,t as A}from"./table-C1vM8njh.js";import{n as j,t as M}from"./tabs-BY90FIeI.js";import{a as N,i as P,p as F,v as I}from"./models-ClsawnaQ.js";import{t as L}from"./card-IQwqnRJR.js";import{n as R,r as z}from"./radio-BNhFzeBO.js";import{n as B,t as V}from"./file-output-DhLnUzfl.js";import{n as H,t as U}from"./row-BlBs21oD.js";import{t as W}from"./empty-C5KjRN0h.js";import{n as G,t as ne}from"./skeleton-Dj_a_iIP.js";import{t as re}from"./switch-CSqIz9Bn.js";import{t as ie}from"./boxes-DavlRUoK.js";import{Ar as K,Ei as q,Fi as J,Ni as Y,O as ae,Tr as oe,_r as se,gr as X,hr as ce,si as le}from"./index-7B54VLaT.js";import{t as ue}from"./CopyToClipboard-DOtA8ld0.js";import{t as de}from"./pagination-CuiF_2-G.js";var fe=e(K());v.register(c,u,p,b,S,T,d,h);var Z=[`#5B8FF9`,`#5AD8A6`,`#5D7092`,`#F6BD16`,`#6F5EF9`,`#6DC8EC`,`#945FB9`,`#FF9845`,`#1E9493`,`#FF99C3`],Q=`#C0C4CC`,pe=.01,me=20;function he(e){return e<=Z.length?Z.slice(0,e):Array.from({length:e},(t,n)=>`hsl(${Math.round(n*360/e)}, 62%, ${n%2==0?55:45}%)`)}var ge=15e3,_e=E({name:`ConsoleUsageList`,components:{ApplicationsIcon:ie,ExportIcon:V,Pagination:de,ElTag:Y,ElDatePicker:B,ElTable:A,ElSelect:D,ElOption:O,CopyToClipboard:ue,ElRow:U,ElCol:H,ElTableColumn:k,ElCard:L,ElRadioButton:R,ElRadioGroup:z,ElSkeleton:ne,ElSkeletonItem:G,ElDialog:q,ElTabs:j,ElTabPane:M,ElButton:J,ElEmpty:W,ElSwitch:re,BarChart:C,DoughnutChart:_},data(){return{applicationIds:this.$route.query.application_id?.toString()?this.$route.query.application_id?.toString().split(`,`):[],apiIds:this.$route.query.api_id?.toString()?this.$route.query.api_id?.toString().split(`,`):[],applications:[],apis:[],apisLoading:!1,credentialType:P,serviceType:N,apiUsages:[],proxyUsages:[],createdAtRange:(()=>{let e=this.$route.query.created_at_to?.toString(),t=this.$route.query.created_at_from?.toString();if(t&&e)return[new Date(t),new Date(e)];let n=new Date,r=new Date;return r.setDate(1),r.setHours(0,0,0,0),[r,n]})(),shortcuts:[{text:this.$t(`usage.shortcuts.thisMonth`),value:()=>{let e=new Date,t=new Date;return t.setDate(1),t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.today`),value:()=>{let e=new Date,t=new Date;return t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.last1Day`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-1),[t,e]}},{text:this.$t(`usage.shortcuts.last3Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-3),[t,e]}},{text:this.$t(`usage.shortcuts.last7Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-7),[t,e]}},{text:this.$t(`usage.shortcuts.last1Month`),value:()=>{let e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),[t,e]}}],type:this.$route.query.type?.toString()||N.API,loading:!1,total:void 0,limit:15,totalUsed:0,barChartLabels:[],barChartSeries:[],chartView:`trend`,apiBreakdown:[],pieLabels:[],pieData:[],pieColors:[],aggLoading:!1,detailDialogVisible:!1,detailRow:null,detailActiveTab:`request`,detailLoading:!1,exporting:!1,statusCodeFilter:this.$route.query.status_code?.toString()||``,traceId:this.$route.query.trace_id?.toString()||``,statusCodeOptions:[],statusCodeOptionsLoading:!1,autoRefresh:!0,autoRefreshTimer:null,fetchSeq:0}},computed:{redirect(){return this.$route.query?.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},totalUsedString(){return`${(this.totalUsed||0).toFixed(2)}`},barChartData(){return{labels:this.barChartLabels,datasets:this.barChartSeries.map(e=>({label:e.label,data:e.data,backgroundColor:e.color,maxBarThickness:36,borderRadius:2,borderSkipped:!1}))}},barChartOptions(){let e=e=>new Intl.NumberFormat().format(Math.round(((e||0)+2**-52)*100)/100);return{responsive:!0,maintainAspectRatio:!1,interaction:{mode:`index`,intersect:!1},plugins:{legend:{position:`bottom`,labels:{usePointStyle:!0,pointStyle:`circle`,boxWidth:8,boxHeight:8,padding:14},onClick:(e,t,n)=>{let r=n?.chart;if(!r||t?.datasetIndex===void 0)return;let i=t.datasetIndex,a=r.data?.datasets||[];a.some((e,t)=>t!==i&&r.isDatasetVisible(t))?a.forEach((e,t)=>r.setDatasetVisibility(t,t===i)):a.forEach((e,t)=>r.setDatasetVisibility(t,!0)),r.update()}},title:{display:!1},tooltip:{itemSort:(e,t)=>(t.parsed?.y||0)-(e.parsed?.y||0),callbacks:{label:t=>` ${t.dataset.label}: ${e(t.parsed.y)}`,footer:t=>`${this.$t(`usage.title.totalUsed`)}: ${e(t.reduce((e,t)=>e+(t.parsed?.y||0),0))}`}}},scales:{x:{stacked:!0,grid:{display:!1},ticks:{maxRotation:0,autoSkip:!0,autoSkipPadding:16}},y:{stacked:!0,beginAtZero:!0,border:{display:!1},grid:{color:`rgba(128, 128, 128, 0.15)`},ticks:{callback:t=>e(Number(t))}}}}},doughnutChartData(){return{labels:this.pieLabels,datasets:[{data:this.pieData,backgroundColor:this.pieColors,borderWidth:0,hoverOffset:6}]}},doughnutChartOptions(){let e=e=>this.fmtAmount(e),t=this.pieData.reduce((e,t)=>e+(t||0),0);return{responsive:!0,maintainAspectRatio:!1,cutout:`58%`,plugins:{legend:{position:`right`,labels:{usePointStyle:!0,pointStyle:`circle`,boxWidth:8,boxHeight:8,padding:12}},title:{display:!1},tooltip:{callbacks:{label:n=>{let r=n.parsed||0,i=t>0?(r/t*100).toFixed(1):`0`;return` ${n.label}: ${e(r)} (${i}%)`}}}}}}},watch:{page:{handler(){this.onFetchUsages()}},type:{handler(){this.applicationIds=[],this.apiIds=[],this.onApplicationsChange(this.applicationIds),this.onFetchApplications(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()}},autoRefresh:{handler(e){e?this.startAutoRefresh():this.stopAutoRefresh()}}},mounted(){this.onFetchApplications(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions(),this.autoRefresh&&this.startAutoRefresh()},beforeUnmount(){this.stopAutoRefresh()},methods:{async onFetchUsages(e=!1){this.type===N.API?this.onFetchApiUsages(e):this.type===N.Proxy&&this.onFetchProxyUsages(e)},startAutoRefresh(){this.stopAutoRefresh(),this.autoRefreshTimer=window.setInterval(()=>{document.hidden||this.onFetchUsages(!0)},ge)},stopAutoRefresh(){this.autoRefreshTimer!==null&&(clearInterval(this.autoRefreshTimer),this.autoRefreshTimer=null)},async onApiChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,api_id:e}}),this.onFetchApiUsages(),this.onFetchAggregate()},async onApisChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,api_id:e&&e.length?e.join(`,`):``}}),this.onFetchApiUsages(),this.onFetchAggregate()},async onTimeRangeChanged(){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,created_at_from:this.createdAtRange?this.$dayjs.format(this.createdAtRange[0].toString(),`YYYY-MM-DDTHH:mm:ss.SSSSSSZ`):``,created_at_to:this.createdAtRange?this.$dayjs.format(this.createdAtRange[1].toString(),`YYYY-MM-DDTHH:mm:ss.SSSSSSZ`):``}}),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()},async onApplicationChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,application_id:e}}),this.onFetchUsages(),this.onFetchAggregate()},async onApplicationsChange(e){await this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,application_id:e&&e.length?e.join(`,`):``}}),this.onFetchUsages(),this.onFetchAggregate()},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},getRemainingAmount(e){if(e.remaining_amount===void 0||e.remaining_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.remaining_amount?.toFixed(6)} ${t}`},getUsedAmount(e){if(e.used_amount===void 0||e.used_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.used_amount?.toFixed(6)} ${t}`},getDeductedAmount(e){if(e?.deducted_amount===void 0||e?.deducted_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.deducted_amount?.toFixed(6)} ${t}`},getOriginalAmount(e){if(e?.original_amount===void 0||e?.original_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.original_amount?.toFixed(6)} ${t}`},onStatusCodeChange(e){let t={...this.$route.query},n=(e||``).trim();n?t.status_code=n:delete t.status_code,delete t.status_code_filter,this.$router.push({name:this.$route.name?.toString(),query:t}),this.onFetchUsages(),this.onFetchAggregate()},async onFetchStatusCodeOptions(){this.statusCodeOptionsLoading=!0;try{let{data:e}=await X.getStatusCodes({user_id:this.$store.getters.user.id,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{}});this.statusCodeOptions=(e?.items||[]).slice().sort((e,t)=>e-t)}catch{this.statusCodeOptions=[]}finally{this.statusCodeOptionsLoading=!1}},formatElapsed(e){return e==null||Number.isNaN(e)?`-`:e<1?`${Math.round(e*1e3)} ms`:`${e.toFixed(2)} s`},getSimpleMetadata(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))n===`request`||n===`response`||typeof r==`object`&&r||(t[n]=r);return t},getCredentialLabel(e){return e.credential?.name?.trim()||e.credential?.id||e.credential_id||`-`},onShowDetail(e){this.detailRow={...e,metadata:void 0},this.detailActiveTab=`request`,this.detailDialogVisible=!0,this.detailLoading=!0,e.id&&X.get(e.id).then(e=>{this.detailRow=e.data}).finally(()=>{this.detailLoading=!1})},formatJson(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}},onFetchApplications(){oe.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:F.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,ce.getAll({limit:1e3,offset:0,ordering:`-created_at`}).then(({data:e})=>{this.apis=e.items}).catch(()=>{}).finally(()=>{this.apisLoading=!1})},onFetchApiUsages(e=!1){e||(this.loading=!0);let t=++this.fetchSeq;X.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{},...this.traceId?{trace_id:this.traceId}:{}}).then(({data:e})=>{t===this.fetchSeq&&(this.apiUsages=e.items,this.total=e.count)}).catch(()=>{}).finally(()=>{e||(this.loading=!1)})},onFetchProxyUsages(e=!1){e||(this.loading=!0);let t=++this.fetchSeq;se.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{}}).then(({data:e})=>{t===this.fetchSeq&&(this.proxyUsages=e.items,this.total=e.count)}).catch(()=>{}).finally(()=>{e||(this.loading=!1)})},async onExport(){let e=this.$store.state.token?.access;if(!e){I.error(this.$t(`usage.message.exportFailed`));return}let t={user_id:this.$store.getters.user.id,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{}},n=`${le()}/api/v1/usage/apis/export/?${fe.default.stringify(t,{arrayFormat:`repeat`})}`,r=null,i=window.showSaveFilePicker;if(typeof i==`function`)try{r=await i({suggestedName:`usages.csv`,types:[{description:`CSV`,accept:{"text/csv":[`.csv`]}}]})}catch(e){if(e?.name===`AbortError`)return;r=null}this.exporting=!0;try{let t=await fetch(n,{headers:{authorization:`Bearer ${e}`}});if(!t.ok||!t.body)throw Error(`export failed: ${t.status}`);if(r)await t.body.pipeTo(await r.createWritable());else{let e=await t.blob(),n=window.URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`usages.csv`,r.click(),window.URL.revokeObjectURL(n)}}catch{I.error(this.$t(`usage.message.exportFailed`))}finally{this.exporting=!1}},fmtAmount(e){return new Intl.NumberFormat().format(Math.round(((e||0)+2**-52)*100)/100)},async onFetchAggregate(){if(this.type!==this.serviceType.API)return;this.aggLoading=!0;let e={user_id:this.$store.getters.user.id,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},timezone:Intl.DateTimeFormat().resolvedOptions().timeZone};try{let{data:t}=await X.getAggregate(e);this.totalUsed=t.total||0;let n=Array.from(new Set((t.items||[]).map(e=>e.date))).sort(),r={},i={};(t.items||[]).forEach(e=>{let t=e.amount||0;(r[e.date]||(r[e.date]={}))[e.api_id]=(r[e.date]?.[e.api_id]||0)+t,i[e.api_id]=(i[e.api_id]||0)+t});let a=Object.keys(i).sort((e,t)=>i[t]-i[e]),o=a.reduce((e,t)=>e+i[t],0),s=a.length;if(o>0){let e=o*(1-pe),t=0;for(let n=0;n<a.length;n++)if(t+=i[a[n]],t>=e){s=n+1;break}s=Math.min(s,me)}a.length-s===1&&(s=a.length);let c=a.slice(0,s),l=new Set(c),u=he(c.length),d=a.slice(s),f=`${this.$t(`usage.value.others`)} (${d.length})`,p=c.map((e,i)=>({key:e,label:t.apis?.[e]?.title||e,data:n.map(t=>r[t]?.[e]||0),color:u[i]}));if(d.length){let e=n.map(e=>Object.entries(r[e]||{}).reduce((e,[t,n])=>l.has(t)?e:e+n,0));e.some(e=>e>0)&&p.push({key:`__others__`,label:f,data:e,color:Q})}this.apiBreakdown=a.map((e,n)=>({key:e,label:t.apis?.[e]?.title||e,amount:i[e],color:n<c.length?u[n]:Q,share:o>0?i[e]/o:0}));let m=[],h=[],g=[];c.forEach((e,n)=>{m.push(t.apis?.[e]?.title||e),h.push(i[e]),g.push(u[n])});let _=d.reduce((e,t)=>e+i[t],0);_>0&&(m.push(f),h.push(_),g.push(Q)),this.pieLabels=m,this.pieData=h,this.pieColors=g,this.barChartLabels=n,this.barChartSeries=p}finally{this.aggLoading=!1}}}}),ve={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},ye={class:`inline-block w-9`},be={class:`inline-block`},xe={key:1,class:`summary-card`},Se={class:`icon-wrapper`},Ce={class:`text-left`},we={class:`description`},Te={class:`value`},Ee={class:`flex flex-wrap items-center justify-between gap-2`},De={class:`text-[15px] font-medium text-[var(--el-text-color-primary)]`},Oe={class:`chart-wrapper`},ke={class:`share-cell`},Ae={class:`share-bar`},je={class:`share-pct`},Me={class:`flex items-center justify-end gap-2 mb-4`},Ne={class:`text-sm text-[var(--el-text-color-regular)]`},Pe={key:0},Fe={key:0},Ie={key:1},Le={class:`flex flex-wrap gap-2`},Re={class:`key`},ze={key:0,class:`cursor-pointer`},Be={class:`key`},Ve={key:0,class:`cursor-pointer`},$={class:`created-at`},He={class:`key`},Ue={key:0,class:`cursor-pointer`},We={class:`created-at`},Ge={key:1,class:`detail-json`},Ke={key:2,class:`text-gray-400`},qe={key:1,class:`detail-json`},Je={key:2,class:`text-gray-400`},Ye={class:`float-right`};function Xe(e,c,u,d,p,h){let _=l(`el-col`),v=l(`el-row`),b=l(`el-radio-button`),S=l(`el-radio-group`),C=l(`el-option`),T=l(`el-select`),E=l(`el-skeleton-item`),D=l(`el-skeleton`),O=l(`el-date-picker`),k=l(`export-icon`),A=l(`el-button`),j=l(`applications-icon`),M=l(`el-card`),N=l(`bar-chart`),P=l(`el-empty`),F=l(`doughnut-chart`),I=l(`el-table-column`),L=l(`el-table`),R=l(`el-switch`),z=l(`el-tag`),B=l(`copy-to-clipboard`),V=l(`el-tab-pane`),H=l(`el-tabs`),U=l(`el-dialog`),W=l(`pagination`),G=ee(`loading`);return w(),m(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[t(`h2`,ve,r(e.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),i(v,null,{default:g(()=>[i(_,{md:4,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,null,r(e.$t(`application.field.type`)),1),i(S,{modelValue:e.type,"onUpdate:modelValue":c[0]||=t=>e.type=t},{default:g(()=>[i(b,{value:e.serviceType.API,label:e.$t(`application.field.api`)},null,8,[`value`,`label`]),i(b,{value:e.serviceType.Proxy,label:e.$t(`application.field.proxy`)},null,8,[`value`,`label`])]),_:1},8,[`modelValue`])]),_:1}),f(i(_,{md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,ye,r(e.$t(`usage.field.application`)),1),i(T,{modelValue:e.applicationIds,"onUpdate:modelValue":c[1]||=t=>e.applicationIds=t,placeholder:e.$t(`usage.field.application`),clearable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApplicationsChange},{default:g(()=>[(w(!0),o(s,null,x(e.applications,e=>(w(),m(C,{key:e.id,label:e.service?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[te,!1]]),e.type===e.serviceType.API?(w(),m(_,{key:0,md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,be,r(e.$t(`usage.field.api`)),1),e.apisLoading?(w(),m(D,{key:0,animated:``,class:`w-full`},{template:g(()=>[i(E,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(w(),m(T,{key:1,modelValue:e.apiIds,"onUpdate:modelValue":c[2]||=t=>e.apiIds=t,placeholder:e.$t(`usage.field.api`),clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApisChange},{default:g(()=>[(w(!0),o(s,null,x(e.apis,e=>(w(),m(C,{key:e?.id,label:e?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]))]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(O,{modelValue:e.createdAtRange,"onUpdate:modelValue":c[3]||=t=>e.createdAtRange=t,type:`datetimerange`,class:`w-full`,shortcuts:e.shortcuts,"range-separator":e.$t(`usage.placeholder.to`),"start-placeholder":e.$t(`usage.placeholder.startDate`),"end-placeholder":e.$t(`usage.placeholder.endDate`),onChange:e.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(T,{modelValue:e.statusCodeFilter,"onUpdate:modelValue":c[4]||=t=>e.statusCodeFilter=t,placeholder:e.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:e.statusCodeOptionsLoading,onChange:e.onStatusCodeChange},{default:g(()=>[(w(!0),o(s,null,x(e.statusCodeOptions,e=>(w(),m(C,{key:e,label:String(e),value:String(e)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:g(()=>[i(A,{type:`primary`,plain:``,loading:e.exporting,class:`w-full whitespace-nowrap`,onClick:e.onExport},{default:g(()=>[i(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(e.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):a(``,!0)]),_:1}),i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[e.type===e.serviceType.API?(w(),m(v,{key:0,gutter:24,class:`mb-5`},{default:g(()=>[i(_,{md:6,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{default:g(()=>[e.aggLoading?(w(),m(D,{key:0})):(w(),o(`div`,xe,[t(`div`,Se,[i(j,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),t(`div`,Ce,[t(`p`,we,r(e.$t(`usage.title.totalUsed`)),1),t(`p`,Te,r(e.totalUsedString),1)])]))]),_:1})]),_:1}),i(_,{md:18,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{header:g(()=>[t(`div`,Ee,[t(`span`,De,r(e.$t(`usage.title.usageAnalytics`)),1),i(S,{modelValue:e.chartView,"onUpdate:modelValue":c[5]||=t=>e.chartView=t,size:`small`},{default:g(()=>[i(b,{value:`trend`,label:e.$t(`usage.view.trend`)},null,8,[`label`]),i(b,{value:`distribution`,label:e.$t(`usage.view.distribution`)},null,8,[`label`]),i(b,{value:`breakdown`,label:e.$t(`usage.view.breakdown`)},null,8,[`label`])]),_:1},8,[`modelValue`])])]),default:g(()=>[t(`div`,Oe,[e.aggLoading?(w(),m(D,{key:0,class:`w-full`})):e.chartView===`trend`?(w(),o(s,{key:1},[e.barChartSeries.length?(w(),m(N,{key:0,data:e.barChartData,options:e.barChartOptions,class:`chart`},null,8,[`data`,`options`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):e.chartView===`distribution`?(w(),o(s,{key:2},[e.pieData.length?(w(),m(F,{key:0,data:e.doughnutChartData,options:e.doughnutChartOptions,class:`chart`},null,8,[`data`,`options`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):(w(),o(s,{key:3},[e.apiBreakdown.length?(w(),m(L,{key:0,data:e.apiBreakdown,size:`small`,height:`300`,class:`w-full`},{default:g(()=>[i(I,{label:e.$t(`usage.field.api`),"min-width":`160`},{default:g(e=>[t(`span`,{class:`color-dot`,style:y({backgroundColor:e.row.color})},null,4),t(`span`,null,r(e.row.label),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.consumed`),width:`120`,align:`right`},{default:g(n=>[t(`span`,null,r(e.fmtAmount(n.row.amount)),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.share`),width:`150`},{default:g(e=>[t(`div`,ke,[t(`div`,Ae,[t(`div`,{class:`share-bar-fill`,style:y({width:e.row.share*100+`%`,backgroundColor:e.row.color})},null,4)]),t(`span`,je,r((e.row.share*100).toFixed(1))+`%`,1)])]),_:1},8,[`label`])]),_:1},8,[`data`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64))])]),_:1})]),_:1})]),_:1})):a(``,!0),i(M,{shadow:`hover`},{default:g(()=>[t(`div`,Me,[t(`span`,Ne,r(e.$t(`usage.field.autoRefresh`)),1),i(R,{modelValue:e.autoRefresh,"onUpdate:modelValue":c[6]||=t=>e.autoRefresh=t},null,8,[`modelValue`])]),e.type===e.serviceType.API?f((w(),m(L,{key:0,data:e.apiUsages,stripe:``,"table-layout":`fixed`,"empty-text":e.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:g(()=>[i(I,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.api?.title),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.statusCode`),width:`120px`},{default:g(t=>[t.row.status_code?(w(),o(`span`,Pe,r(t.row.status_code),1)):(w(),m(z,{key:1,type:`warning`,size:`small`},{default:g(()=>[n(r(e.$t(`usage.value.processing`)),1)]),_:1}))]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.elapsed`),width:`120px`},{default:g(n=>[t(`span`,null,r(e.formatElapsed(n.row.elapsed)),1)]),_:1},8,[`label`]),i(I,{prop:`deducted_amount`,label:e.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:g(n=>[e.getDeductedAmount(n.row)===e.getOriginalAmount(n.row)?(w(),o(`div`,Fe,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)])):(w(),o(`div`,Ie,[c[9]||=t(`p`,null,null,-1),t(`p`,null,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)]),t(`p`,null,[t(`del`,null,r(e.getOriginalAmount(n.row)),1)])]))]),_:1},8,[`label`]),i(I,{prop:`remaining_amount`,label:e.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`260px`,"class-name":`text-center`},{default:g(i=>[t(`div`,Le,[i.row.original_amount>i.row.deducted_amount&&i.row.original_amount>0?(w(),m(z,{key:0,type:`success`,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:g(()=>[n(r(((i.row.original_amount-i.row.deducted_amount)*100/i.row.original_amount).toFixed(0)+`% OFF`),1)]),_:2},1024)):a(``,!0),(w(!0),o(s,null,x(e.getSimpleMetadata(i.row.metadata),(e,t)=>(w(),m(z,{key:t,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))])]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:g(t=>[t.row.id?(w(),m(A,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:n=>e.onShowDetail(t.row)},{default:g(()=>[n(r(e.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:1},8,[`label`]),i(I,{prop:`trace_id`,label:e.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:g(e=>[t(`span`,Re,r(e.row.trace_id),1),e.row.trace_id?(w(),o(`span`,ze,[i(B,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{prop:`credential_id`,label:e.$t(`usage.field.credential`),width:`200px`,"class-name":`text-center`},{default:g(n=>[t(`span`,Be,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(w(),o(`span`,Ve,[i(B,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.createdAt`),width:`200px`},{default:g(n=>[t(`span`,$,r(e.$dayjs.format(n.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[G,e.loading]]):a(``,!0),e.type===e.serviceType.Proxy?f((w(),m(L,{key:1,data:e.proxyUsages,stripe:``,"table-layout":`fixed`,"empty-text":e.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:g(()=>[i(I,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.service?.title),1)]),_:1},8,[`label`]),i(I,{prop:`remaining_amount`,label:e.$t(`usage.field.remainingAmount`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1),t(`span`,null,r(e.getOriginalAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`deducted_amount`,label:e.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getDeductedAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:g(e=>[(w(!0),o(s,null,x(e.row.metadata,(e,t)=>(w(),m(z,{key:t,class:`mb-2`},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))]),_:1},8,[`label`]),i(I,{prop:`credential_id`,label:e.$t(`usage.field.credential`),width:`200px`,"class-name":`text-center`},{default:g(n=>[t(`span`,He,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(w(),o(`span`,Ue,[i(B,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.createdAt`),width:`200px`},{default:g(n=>[t(`span`,We,r(e.$dayjs.format(n.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[G,e.loading]]):a(``,!0)]),_:1})]),_:1})]),_:1}),i(U,{modelValue:e.detailDialogVisible,"onUpdate:modelValue":c[8]||=t=>e.detailDialogVisible=t,title:e.$t(`usage.dialog.detailTitle`),width:`70%`,top:`5vh`,"destroy-on-close":``},{default:g(()=>[i(H,{modelValue:e.detailActiveTab,"onUpdate:modelValue":c[7]||=t=>e.detailActiveTab=t},{default:g(()=>[i(V,{label:e.$t(`usage.dialog.request`),name:`request`},{default:g(()=>[e.detailLoading?(w(),m(D,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.request?(w(),o(`pre`,Ge,r(e.formatJson(e.detailRow.metadata.request)),1)):(w(),o(`p`,Ke,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),i(V,{label:e.$t(`usage.dialog.response`),name:`response`},{default:g(()=>[e.detailLoading?(w(),m(D,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.response?(w(),o(`pre`,qe,r(e.formatJson(e.detailRow.metadata.response)),1)):(w(),o(`p`,Je,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`]),i(v,null,{default:g(()=>[i(_,{span:10,offset:14},{default:g(()=>[t(`div`,Ye,[i(W,{"current-page":e.page,"page-size":e.limit,total:e.total,onChange:e.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Ze=ae(_e,[[`render`,Xe],[`__scopeId`,`data-v-81b0a3c5`]]);export{Ze as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,T as o,at as s,ht as c,j as l,mt as u,ot as ee,rt as d,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{n as m,t as h}from"./table-B5uHA9cN.js";import{a as g,f as _,i as v,p as y,v as b}from"./models-ClsawnaQ.js";import{t as x}from"./card-IQwqnRJR.js";import{n as S,t as C}from"./row-BlBs21oD.js";import{t as w}from"./empty-C5KjRN0h.js";import{t as T}from"./skeleton-Dj_a_iIP.js";import{t as E}from"./switch-CI_r8TsE.js";import{t as D}from"./boxes-WbbO39Z7.js";import{t as O}from"./chart-no-axes-combined-BLVOA658.js";import{t as k}from"./coins-B09dASJj.js";import{t as A}from"./wallet-eAa1xyTv.js";import{Dn as j,Fi as M,G as N,Ni as P,O as F,Tr as I,et as L,pi as R}from"./index-C_sjkBHo.js";import{t as z}from"./CopyToClipboard-D1PN1vgU.js";import{t as B}from"./pagination-BM4GJ-Sf.js";var V=p({name:`ConsoleApplicationList`,components:{AnalyticsIcon:O,ApplicationsIcon:D,CreditsIcon:k,WalletIcon:A,Pagination:B,CopyToClipboard:z,ElTable:h,ElRow:C,ElButton:M,ElCol:S,ElTag:P,ElSkeleton:T,ElSwitch:E,ElEmpty:w,ElTableColumn:m,ElCard:x},data(){return{credentialType:v,serviceType:g,individualApplications:[],globalApplications:[],individualApplicationsTotal:void 0,globalApplicationsTotal:void 0,loading:!1,buying:!1,limit:10,form:{amount:1},active:{service:void 0,application:void 0}}},computed:{redirect(){return this.$route.query?.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},showGlobalPayment(){return!j(this.$store.getters.site)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{rowCanPay(e){return j(this.$store.getters.site)?!1:R()?(e?.packages||[]).some(e=>e?.metadata?.apple_product_id):!0},updateAllowConsumeGlobal(e,t){!e||!e.id||I.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{b.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{b.error(this.$t(`application.message.updateFailed`).toString())})},onGoUsage(e){this.$router.push({name:L,query:{application_id:e.id,type:e?.service?.type}})},onBuyMore(e){e?.id&&this.$router.push({name:N,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=_.INDIVIDUAL){return new Promise((t,n)=>{I.getAll({limit:this.limit,...e===_.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:y.USAGE,scope:e}).then(({data:n})=>{e===_.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{b.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(_.INDIVIDUAL),this.onFetchApplications(_.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){I.create({type:y.USAGE,scope:_.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(_.GLOBAL)})},getRemainingAmount(e){if(e.remaining_amount===void 0||e.remaining_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.remaining_amount?.toFixed(6)} ${t}`},getUsedAmount(e){if(e.used_amount===void 0||e.used_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.used_amount?.toFixed(6)} ${t}`}}}),H={class:`title`},U={key:1,class:`summary-card`},W={class:`icon-wrapper`},G={class:`label`},K={class:`value`},q={class:`description`},J={key:1,class:`flex flex-row justify-between items-center gap-3`},Y={class:`summary-card min-w-0 flex-1`},X={class:`flex justify-start items-center gap-2 mb-2 w-full`},Z={class:`icon-wrapper !mb-0`},te={class:`text-[var(--el-text-color-regular)] text-[14px] truncate`},Q={class:`label`},ne={class:`value`},re={class:`description`},ie={class:`flex flex-col items-end gap-2 shrink-0`},ae={class:`copy`},oe={key:0,class:`expired-at`},se={class:`flex flex-wrap items-center justify-end gap-1`},ce={class:`application-cards block sm:hidden`},le={class:`flex items-center gap-2 flex-wrap`},ue={class:`application-card__name`},de={class:`application-card__id`},fe={class:`truncate`},pe={class:`application-card__row`},$={class:`label`},me={class:`value`},he={key:0,class:`application-card__row`},ge={class:`label`},_e={class:`value`},ve={key:1,class:`application-card__row`},ye={class:`label`},be={class:`flex items-center justify-end gap-2 mt-3`},xe={class:`pagination`};function Se(p,m,h,g,_,v){let y=s(`el-col`),b=s(`el-row`),x=s(`el-skeleton`),S=s(`applications-icon`),C=s(`el-card`),w=s(`wallet-icon`),T=s(`copy-to-clipboard`),E=s(`analytics-icon`),D=s(`el-button`),O=s(`credits-icon`),k=s(`el-table-column`),A=s(`el-tag`),j=s(`el-switch`),M=s(`el-table`),N=s(`el-empty`),P=s(`pagination`),F=ee(`loading`);return f(),l(b,{class:`application-list`},{default:u(()=>[r(y,{span:24},{default:u(()=>[r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[e(`h2`,H,n(p.$t(`common.title.allApplications`)),1)]),_:1})]),_:1}),r(b,{gutter:15,class:`mb-3`},{default:u(()=>[r(y,{md:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[p.loading?(f(),l(x,{key:0})):(f(),a(`div`,U,[e(`div`,W,[r(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,G,n(p.$t(`application.title.count`)),1),e(`p`,K,n(p.individualApplicationsTotal),1),e(`p`,q,n(p.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),p.showGlobalPayment&&p.globalApplications?.length>0?(f(),l(y,{key:0,md:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[p.loading?(f(),l(x,{key:0})):(f(),a(`div`,J,[e(`div`,Y,[e(`div`,X,[e(`div`,Z,[r(w,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`span`,te,[t(n(p.$t(`application.field.id`))+`: `+n(p.globalApplications?.[0]?.id)+` `,1),p.globalApplications?.[0]?.id?(f(),l(T,{key:0,content:p.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),e(`p`,Q,n(p.$t(`application.title.globalBalance`)),1),e(`p`,ne,n(p.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+n(p.$t(`service.unit.credits`)),1),e(`p`,re,n(p.$t(`application.message.globalBalanceDescription`)),1)]),e(`div`,ie,[r(D,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:m[0]||=e=>p.onGoUsage(p.globalApplications?.[0])},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1}),p.showGlobalPayment?(f(),l(D,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:m[1]||=e=>p.onBuyMore(p.globalApplications?.[0])},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1})):i(``,!0)])]))]),_:1})]),_:1})):i(``,!0)]),_:1}),r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[r(C,{shadow:`hover`,class:`applications-table-card hidden sm:block`},{default:u(()=>[c((f(),l(M,{data:p.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":p.$t(`common.message.noData`)},{default:u(()=>[r(k,{prop:`id`,label:p.$t(`application.field.id`),width:`200px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(t.row.id),1),e(`span`,ae,[r(T,{content:t?.row?.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(k,{label:p.$t(`application.field.type`),width:`90px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row?.type===`Period`?(f(),l(A,{key:0,type:`success`,effect:`dark`,round:``},{default:u(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):e.row?.type===`Usage`?(f(),l(A,{key:1,effect:`dark`,round:``},{default:u(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(k,{label:p.$t(`application.field.name`),width:`180px`},{default:u(r=>[e(`span`,null,n(r.row?.service?.title),1),r.row?.role===`grantee`?(f(),l(A,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:u(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(k,{prop:`remaining_amount`,label:p.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(p.getRemainingAmount(t.row)),1)]),_:1},8,[`label`]),r(k,{prop:`used_amount`,label:p.$t(`application.field.usedAmount`),width:`150px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(t=>[e(`span`,null,n(p.getUsedAmount(t.row)),1)]),_:1},8,[`label`]),r(k,{prop:`allow_consume_global`,label:p.$t(`application.field.allowConsumeGlobal`),width:`120px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.service?.type===p.serviceType.API?(f(),l(j,{key:0,modelValue:e.row.allow_consume_global,"onUpdate:modelValue":t=>e.row.allow_consume_global=t,"active-value":!0,"inactive-value":!1,onChange:t=>p.updateAllowConsumeGlobal(e.row,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])):i(``,!0)]),_:1},8,[`label`]),r(k,{label:p.$t(`application.field.expiredAt`),width:`180px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.expired_at?(f(),a(`span`,oe,n(p.$dayjs.format(e.row.expired_at)),1)):i(``,!0)]),_:1},8,[`label`]),r(k,{fixed:`right`,width:`200px`},{default:u(a=>[e(`div`,se,[r(D,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:e=>p.onGoUsage(a?.row)},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(a?.row)?(f(),l(D,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(a?.row)},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[F,p.loading]])]),_:1}),e(`div`,ce,[p.loading?(f(),l(x,{key:0,rows:4,animated:``})):(f(),a(o,{key:1},[p.individualApplications?.length?(f(!0),a(o,{key:1},d(p.individualApplications,o=>(f(),l(C,{key:o.id,shadow:`hover`,class:`application-card mb-2`,"body-style":{padding:`14px 16px`}},{default:u(()=>[e(`div`,le,[e(`span`,ue,n(o?.service?.title),1),o?.type===`Period`?(f(),l(A,{key:0,type:`success`,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):o?.type===`Usage`?(f(),l(A,{key:1,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0),o?.role===`grantee`?(f(),l(A,{key:2,type:`info`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),e(`div`,de,[e(`span`,fe,n(p.$t(`application.field.id`))+`: `+n(o.id),1),r(T,{content:o.id,class:`inline-block shrink-0`},null,8,[`content`])]),e(`div`,pe,[e(`span`,$,n(p.$t(`application.field.remainingAmount`)),1),e(`span`,me,n(p.getRemainingAmount(o)),1)]),o?.expired_at?(f(),a(`div`,he,[e(`span`,ge,n(p.$t(`application.field.expiredAt`)),1),e(`span`,_e,n(p.$dayjs.format(o.expired_at)),1)])):i(``,!0),o.service?.type===p.serviceType.API?(f(),a(`div`,ve,[e(`span`,ye,n(p.$t(`application.field.allowConsumeGlobal`)),1),r(j,{modelValue:o.allow_consume_global,"onUpdate:modelValue":e=>o.allow_consume_global=e,"active-value":!0,"inactive-value":!1,onChange:e=>p.updateAllowConsumeGlobal(o,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])])):i(``,!0),e(`div`,be,[r(D,{class:`!m-0 !px-3`,size:`small`,round:``,onClick:e=>p.onGoUsage(o)},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(o)?(f(),l(D,{key:0,class:`!m-0 !px-3`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(o)},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:2},1024))),128)):(f(),l(N,{key:0,description:p.$t(`common.message.noData`)},null,8,[`description`]))],64))])]),_:1})]),_:1}),r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[e(`div`,xe,[r(P,{"current-page":p.page,"page-size":p.limit,total:p.individualApplicationsTotal,onChange:p.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Ce=F(V,[[`render`,Se],[`__scopeId`,`data-v-d88616c5`]]);export{Ce as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,T as o,at as s,ht as c,j as l,mt as u,ot as ee,rt as d,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{n as m,t as h}from"./table-C1vM8njh.js";import{a as g,f as _,i as v,p as y,v as b}from"./models-ClsawnaQ.js";import{t as x}from"./card-IQwqnRJR.js";import{n as S,t as C}from"./row-BlBs21oD.js";import{t as w}from"./empty-C5KjRN0h.js";import{t as T}from"./skeleton-Dj_a_iIP.js";import{t as E}from"./switch-CSqIz9Bn.js";import{t as D}from"./boxes-DavlRUoK.js";import{t as O}from"./chart-no-axes-combined-BfoTJT5M.js";import{t as k}from"./coins-BY3jXSEG.js";import{t as A}from"./wallet-BcaYe3O4.js";import{Dn as j,Fi as M,G as N,Ni as P,O as F,Tr as I,et as L,pi as R}from"./index-7B54VLaT.js";import{t as z}from"./CopyToClipboard-DOtA8ld0.js";import{t as B}from"./pagination-CuiF_2-G.js";var V=p({name:`ConsoleApplicationList`,components:{AnalyticsIcon:O,ApplicationsIcon:D,CreditsIcon:k,WalletIcon:A,Pagination:B,CopyToClipboard:z,ElTable:h,ElRow:C,ElButton:M,ElCol:S,ElTag:P,ElSkeleton:T,ElSwitch:E,ElEmpty:w,ElTableColumn:m,ElCard:x},data(){return{credentialType:v,serviceType:g,individualApplications:[],globalApplications:[],individualApplicationsTotal:void 0,globalApplicationsTotal:void 0,loading:!1,buying:!1,limit:10,form:{amount:1},active:{service:void 0,application:void 0}}},computed:{redirect(){return this.$route.query?.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},showGlobalPayment(){return!j(this.$store.getters.site)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{rowCanPay(e){return j(this.$store.getters.site)?!1:R()?(e?.packages||[]).some(e=>e?.metadata?.apple_product_id):!0},updateAllowConsumeGlobal(e,t){!e||!e.id||I.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{b.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{b.error(this.$t(`application.message.updateFailed`).toString())})},onGoUsage(e){this.$router.push({name:L,query:{application_id:e.id,type:e?.service?.type}})},onBuyMore(e){e?.id&&this.$router.push({name:N,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=_.INDIVIDUAL){return new Promise((t,n)=>{I.getAll({limit:this.limit,...e===_.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:y.USAGE,scope:e}).then(({data:n})=>{e===_.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{b.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(_.INDIVIDUAL),this.onFetchApplications(_.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){I.create({type:y.USAGE,scope:_.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(_.GLOBAL)})},getRemainingAmount(e){if(e.remaining_amount===void 0||e.remaining_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.remaining_amount?.toFixed(6)} ${t}`},getUsedAmount(e){if(e.used_amount===void 0||e.used_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.used_amount?.toFixed(6)} ${t}`}}}),H={class:`title`},U={key:1,class:`summary-card`},W={class:`icon-wrapper`},G={class:`label`},K={class:`value`},q={class:`description`},J={key:1,class:`flex flex-row justify-between items-center gap-3`},Y={class:`summary-card min-w-0 flex-1`},X={class:`flex justify-start items-center gap-2 mb-2 w-full`},Z={class:`icon-wrapper !mb-0`},te={class:`text-[var(--el-text-color-regular)] text-[14px] truncate`},Q={class:`label`},ne={class:`value`},re={class:`description`},ie={class:`flex flex-col items-end gap-2 shrink-0`},ae={class:`copy`},oe={key:0,class:`expired-at`},se={class:`flex flex-wrap items-center justify-end gap-1`},ce={class:`application-cards block sm:hidden`},le={class:`flex items-center gap-2 flex-wrap`},ue={class:`application-card__name`},de={class:`application-card__id`},fe={class:`truncate`},pe={class:`application-card__row`},$={class:`label`},me={class:`value`},he={key:0,class:`application-card__row`},ge={class:`label`},_e={class:`value`},ve={key:1,class:`application-card__row`},ye={class:`label`},be={class:`flex items-center justify-end gap-2 mt-3`},xe={class:`pagination`};function Se(p,m,h,g,_,v){let y=s(`el-col`),b=s(`el-row`),x=s(`el-skeleton`),S=s(`applications-icon`),C=s(`el-card`),w=s(`wallet-icon`),T=s(`copy-to-clipboard`),E=s(`analytics-icon`),D=s(`el-button`),O=s(`credits-icon`),k=s(`el-table-column`),A=s(`el-tag`),j=s(`el-switch`),M=s(`el-table`),N=s(`el-empty`),P=s(`pagination`),F=ee(`loading`);return f(),l(b,{class:`application-list`},{default:u(()=>[r(y,{span:24},{default:u(()=>[r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[e(`h2`,H,n(p.$t(`common.title.allApplications`)),1)]),_:1})]),_:1}),r(b,{gutter:15,class:`mb-3`},{default:u(()=>[r(y,{md:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[p.loading?(f(),l(x,{key:0})):(f(),a(`div`,U,[e(`div`,W,[r(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,G,n(p.$t(`application.title.count`)),1),e(`p`,K,n(p.individualApplicationsTotal),1),e(`p`,q,n(p.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),p.showGlobalPayment&&p.globalApplications?.length>0?(f(),l(y,{key:0,md:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[p.loading?(f(),l(x,{key:0})):(f(),a(`div`,J,[e(`div`,Y,[e(`div`,X,[e(`div`,Z,[r(w,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`span`,te,[t(n(p.$t(`application.field.id`))+`: `+n(p.globalApplications?.[0]?.id)+` `,1),p.globalApplications?.[0]?.id?(f(),l(T,{key:0,content:p.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),e(`p`,Q,n(p.$t(`application.title.globalBalance`)),1),e(`p`,ne,n(p.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+n(p.$t(`service.unit.credits`)),1),e(`p`,re,n(p.$t(`application.message.globalBalanceDescription`)),1)]),e(`div`,ie,[r(D,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:m[0]||=e=>p.onGoUsage(p.globalApplications?.[0])},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1}),p.showGlobalPayment?(f(),l(D,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:m[1]||=e=>p.onBuyMore(p.globalApplications?.[0])},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1})):i(``,!0)])]))]),_:1})]),_:1})):i(``,!0)]),_:1}),r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[r(C,{shadow:`hover`,class:`applications-table-card hidden sm:block`},{default:u(()=>[c((f(),l(M,{data:p.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":p.$t(`common.message.noData`)},{default:u(()=>[r(k,{prop:`id`,label:p.$t(`application.field.id`),width:`200px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(t.row.id),1),e(`span`,ae,[r(T,{content:t?.row?.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(k,{label:p.$t(`application.field.type`),width:`90px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row?.type===`Period`?(f(),l(A,{key:0,type:`success`,effect:`dark`,round:``},{default:u(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):e.row?.type===`Usage`?(f(),l(A,{key:1,effect:`dark`,round:``},{default:u(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(k,{label:p.$t(`application.field.name`),width:`180px`},{default:u(r=>[e(`span`,null,n(r.row?.service?.title),1),r.row?.role===`grantee`?(f(),l(A,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:u(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(k,{prop:`remaining_amount`,label:p.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(p.getRemainingAmount(t.row)),1)]),_:1},8,[`label`]),r(k,{prop:`used_amount`,label:p.$t(`application.field.usedAmount`),width:`150px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(t=>[e(`span`,null,n(p.getUsedAmount(t.row)),1)]),_:1},8,[`label`]),r(k,{prop:`allow_consume_global`,label:p.$t(`application.field.allowConsumeGlobal`),width:`120px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.service?.type===p.serviceType.API?(f(),l(j,{key:0,modelValue:e.row.allow_consume_global,"onUpdate:modelValue":t=>e.row.allow_consume_global=t,"active-value":!0,"inactive-value":!1,onChange:t=>p.updateAllowConsumeGlobal(e.row,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])):i(``,!0)]),_:1},8,[`label`]),r(k,{label:p.$t(`application.field.expiredAt`),width:`180px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.expired_at?(f(),a(`span`,oe,n(p.$dayjs.format(e.row.expired_at)),1)):i(``,!0)]),_:1},8,[`label`]),r(k,{fixed:`right`,width:`200px`},{default:u(a=>[e(`div`,se,[r(D,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:e=>p.onGoUsage(a?.row)},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(a?.row)?(f(),l(D,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(a?.row)},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[F,p.loading]])]),_:1}),e(`div`,ce,[p.loading?(f(),l(x,{key:0,rows:4,animated:``})):(f(),a(o,{key:1},[p.individualApplications?.length?(f(!0),a(o,{key:1},d(p.individualApplications,o=>(f(),l(C,{key:o.id,shadow:`hover`,class:`application-card mb-2`,"body-style":{padding:`14px 16px`}},{default:u(()=>[e(`div`,le,[e(`span`,ue,n(o?.service?.title),1),o?.type===`Period`?(f(),l(A,{key:0,type:`success`,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):o?.type===`Usage`?(f(),l(A,{key:1,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0),o?.role===`grantee`?(f(),l(A,{key:2,type:`info`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),e(`div`,de,[e(`span`,fe,n(p.$t(`application.field.id`))+`: `+n(o.id),1),r(T,{content:o.id,class:`inline-block shrink-0`},null,8,[`content`])]),e(`div`,pe,[e(`span`,$,n(p.$t(`application.field.remainingAmount`)),1),e(`span`,me,n(p.getRemainingAmount(o)),1)]),o?.expired_at?(f(),a(`div`,he,[e(`span`,ge,n(p.$t(`application.field.expiredAt`)),1),e(`span`,_e,n(p.$dayjs.format(o.expired_at)),1)])):i(``,!0),o.service?.type===p.serviceType.API?(f(),a(`div`,ve,[e(`span`,ye,n(p.$t(`application.field.allowConsumeGlobal`)),1),r(j,{modelValue:o.allow_consume_global,"onUpdate:modelValue":e=>o.allow_consume_global=e,"active-value":!0,"inactive-value":!1,onChange:e=>p.updateAllowConsumeGlobal(o,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])])):i(``,!0),e(`div`,be,[r(D,{class:`!m-0 !px-3`,size:`small`,round:``,onClick:e=>p.onGoUsage(o)},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(o)?(f(),l(D,{key:0,class:`!m-0 !px-3`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(o)},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:2},1024))),128)):(f(),l(N,{key:0,description:p.$t(`common.message.noData`)},null,8,[`description`]))],64))])]),_:1})]),_:1}),r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[e(`div`,xe,[r(P,{"current-page":p.page,"page-size":p.limit,total:p.individualApplicationsTotal,onChange:p.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Ce=F(V,[[`render`,Se],[`__scopeId`,`data-v-d88616c5`]]);export{Ce as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,N as i,T as a,at as o,ht as s,j as c,mt as l,ot as u,rt as d,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{r as m,t as h}from"./select-ChyQns32.js";import{n as ee,t as g}from"./table-B5uHA9cN.js";import{o as _}from"./models-ClsawnaQ.js";import{t as v}from"./card-IQwqnRJR.js";import{n as y,t as b}from"./file-output-CJCqrTiV.js";import{n as x,t as S}from"./row-BlBs21oD.js";import{t as C}from"./skeleton-Dj_a_iIP.js";import{t as w}from"./circle-check-DaxMxK1P.js";import{t as T}from"./clock-Varrr0Bl.js";import{t as E}from"./dollar-sign-rKY0qNJp.js";import{Fi as D,Ni as O,O as k,an as A,bi as j,mr as M}from"./index-C_sjkBHo.js";import{t as N}from"./CopyToClipboard-D1PN1vgU.js";import{t as P}from"./pagination-BM4GJ-Sf.js";var F=j(`receipt`,[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]),I={total_count:0,total_spent:0,state_counts:{}},L=p({name:`ConsoleOrderList`,components:{ExportIcon:b,MoneyIcon:E,ReceiptIcon:F,SuccessIcon:w,TimeIcon:T,Pagination:P,CopyToClipboard:N,ElRow:S,ElCol:x,ElTable:g,ElTableColumn:ee,ElButton:D,ElTag:O,ElCard:v,ElSelect:m,ElOption:h,ElDatePicker:y,ElSkeleton:C},data(){return{OrderState:_,orders:[],loading:!1,total:void 0,limit:10,filterState:this.$route.query.state?.toString()||``,filterPayWay:this.$route.query.pay_way?.toString()||``,createdAtRange:(()=>{let e=this.$route.query.created_at_from?.toString(),t=this.$route.query.created_at_to?.toString();if(e&&t)return[new Date(e),new Date(t)]})(),summary:{...I},summaryLoading:!1,exporting:!1,shortcuts:[{text:this.$t(`usage.shortcuts.today`),value:()=>{let e=new Date,t=new Date;return t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.last7Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-7),[t,e]}},{text:this.$t(`usage.shortcuts.last1Month`),value:()=>{let e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),[t,e]}}]}},computed:{page(){return parseInt(this.$route.query.page?.toString()||`1`)},stateOptions(){return[{value:_.PENDING,label:this.$t(`order.state.pending`)},{value:_.FINISHED,label:this.$t(`order.state.finished`)},{value:_.PAID,label:this.$t(`order.state.paid`)},{value:_.EXPIRED,label:this.$t(`order.state.expired`)},{value:_.FAILED,label:this.$t(`order.state.failed`)},{value:_.REFUNDED,label:this.$t(`order.state.refunded`)}]},payWayOptions(){return[{value:`WechatPay`,label:this.$t(`order.title.wechatPay`)},{value:`Stripe`,label:this.$t(`order.title.stripe`)},{value:`Card`,label:this.$t(`order.title.card`)},{value:`AliPay`,label:this.$t(`order.title.aliPay`)},{value:`X402`,label:this.$t(`order.title.x402`)},{value:`PayPal`,label:this.$t(`order.title.paypal`)}]},filterQuery(){let e={user_id:this.$store.getters.user?.id};return this.filterState&&(e.state=this.filterState),this.filterPayWay&&(e.pay_way=this.filterPayWay),this.createdAtRange?.[0]&&(e.created_at_from=this.createdAtRange[0]),this.createdAtRange?.[1]&&(e.created_at_to=this.createdAtRange[1]),e}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onFetchData(),this.onFetchSummary()},methods:{getPriceString:A,stateTagType(e){return e===_.FINISHED||e===_.PAID?`success`:e===_.EXPIRED||e===_.FAILED?`danger`:e===_.REFUNDED?`warning`:`info`},stateLabel(e){return{[_.PENDING]:this.$t(`order.state.pending`),[_.PAID]:this.$t(`order.state.paid`),[_.FINISHED]:this.$t(`order.state.finished`),[_.EXPIRED]:this.$t(`order.state.expired`),[_.FAILED]:this.$t(`order.state.failed`),[_.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==_.PAID&&e!==_.FINISHED&&e!==_.EXPIRED&&e!==_.FAILED&&e!==_.REFUNDED},goToDetail(e){this.$router.push({name:`console-order-detail`,params:{id:e}})},async onFilterChange(){await this.$router.push({name:this.$route.name?.toString(),query:{page:1,...this.filterState?{state:this.filterState}:{},...this.filterPayWay?{pay_way:this.filterPayWay}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0].toISOString()}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1].toISOString()}:{}}}),this.onFetchData(),this.onFetchSummary()},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchData(){this.loading=!0,M.getAll({ordering:`-created_at`,limit:this.limit,offset:(this.page-1)*this.limit,...this.filterQuery}).then(({data:e})=>{this.orders=e.items,this.total=e.count}).catch(()=>{}).finally(()=>{this.loading=!1})},onFetchSummary(){this.summaryLoading=!0,M.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...I}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,M.exportCsv(this.filterQuery).then(({data:e})=>{let t=window.URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`orders.csv`,n.click(),window.URL.revokeObjectURL(t)}).catch(()=>{}).finally(()=>{this.exporting=!1})}}}),R={class:`title`},z={key:1,class:`card-content`},B={class:`icon-wrapper`},V={class:`description`},H={class:`value`},U={key:1,class:`card-content`},W={class:`icon-wrapper`},G={class:`description`},K={class:`value`},q={key:1,class:`card-content`},J={class:`icon-wrapper`},te={class:`description`},Y={class:`value`},X={key:1,class:`card-content`},Z={class:`icon-wrapper`},Q={class:`description`},ne={class:`value`},re={class:`filter-row mb-3`},$={class:`key`},ie={class:`cursor-pointer`},ae={class:`price`},oe={class:`description`},se={class:`text-gray-500`},ce={class:`created-at`},le={class:`flex items-center justify-center flex-wrap`},ue={class:`float-right`};function de(p,m,h,ee,g,_){let v=o(`el-col`),y=o(`el-row`),b=o(`el-skeleton`),x=o(`receipt-icon`),S=o(`el-card`),C=o(`money-icon`),w=o(`success-icon`),T=o(`time-icon`),E=o(`el-option`),D=o(`el-select`),O=o(`el-date-picker`),k=o(`export-icon`),A=o(`el-button`),j=o(`copy-to-clipboard`),M=o(`el-table-column`),N=o(`el-tag`),P=o(`el-table`),F=o(`pagination`),I=u(`loading`);return f(),c(y,{class:`panel`},{default:l(()=>[r(v,{span:24},{default:l(()=>[r(y,null,{default:l(()=>[r(v,{span:24},{default:l(()=>[e(`h2`,R,n(p.$t(`common.title.allOrders`)),1)]),_:1})]),_:1}),r(y,{gutter:16},{default:l(()=>[r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,z,[e(`div`,B,[r(x,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,V,n(p.$t(`order.title.totalOrders`)),1),e(`p`,H,n(p.summary.total_count),1)]))]),_:1})]),_:1}),r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,U,[e(`div`,W,[r(C,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,G,n(p.$t(`order.title.totalSpent`)),1),e(`p`,K,n(p.getPriceString({value:p.summary.total_spent})),1)]))]),_:1})]),_:1}),r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,q,[e(`div`,J,[r(w,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,te,n(p.$t(`order.title.finishedOrders`)),1),e(`p`,Y,n(p.summary.state_counts?.Finished||0),1)]))]),_:1})]),_:1}),r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,X,[e(`div`,Z,[r(T,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,Q,n(p.$t(`order.title.pendingOrders`)),1),e(`p`,ne,n(p.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),e(`div`,re,[r(D,{modelValue:p.filterState,"onUpdate:modelValue":m[0]||=e=>p.filterState=e,clearable:``,placeholder:p.$t(`order.field.allStates`),class:`filter-select`,onChange:p.onFilterChange},{default:l(()=>[(f(!0),i(a,null,d(p.stateOptions,e=>(f(),c(E,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(D,{modelValue:p.filterPayWay,"onUpdate:modelValue":m[1]||=e=>p.filterPayWay=e,clearable:``,placeholder:p.$t(`order.field.allPayWays`),class:`filter-select`,onChange:p.onFilterChange},{default:l(()=>[(f(!0),i(a,null,d(p.payWayOptions,e=>(f(),c(E,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(O,{modelValue:p.createdAtRange,"onUpdate:modelValue":m[2]||=e=>p.createdAtRange=e,type:`datetimerange`,shortcuts:p.shortcuts,"range-separator":p.$t(`usage.placeholder.to`),"start-placeholder":p.$t(`usage.placeholder.startDate`),"end-placeholder":p.$t(`usage.placeholder.endDate`),onChange:p.onFilterChange},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`]),r(A,{type:`primary`,plain:``,loading:p.exporting,onClick:p.onExport},{default:l(()=>[r(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`order.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),r(y,null,{default:l(()=>[r(v,{span:24},{default:l(()=>[r(S,{shadow:`hover`},{default:l(()=>[s((f(),c(P,{data:p.orders,stripe:``,"empty-text":p.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:l(()=>[r(M,{prop:`id`,label:p.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:l(t=>[e(`span`,$,n(t.row.id),1),e(`span`,ie,[r(j,{content:t.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.price`),width:`110px`,align:`center`},{default:l(t=>[e(`span`,ae,n(p.getPriceString({value:t.row?.price})),1)]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.description`),"min-width":`220px`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:l(t=>[e(`span`,oe,n(t.row.description),1)]),_:1},8,[`label`]),r(M,{prop:`state`,label:p.$t(`order.field.state`),width:`130px`,align:`center`},{default:l(e=>[r(N,{type:p.stateTagType(e.row.state),class:`mx-1`,effect:`dark`,round:``,size:`small`},{default:l(()=>[t(n(p.stateLabel(e.row.state)),1)]),_:2},1032,[`type`])]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.payWay`),width:`120px`,align:`center`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:l(t=>[e(`span`,se,n(t.row.pay_way||`-`),1)]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.createdAt`),width:`200px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:l(t=>[e(`span`,ce,n(p.$dayjs.format(t.row.created_at)),1)]),_:1},8,[`label`]),r(M,{"min-width":`130px`,fixed:`right`},{default:l(r=>[e(`div`,le,[p.isPendingAction(r.row.state)?(f(),c(A,{key:0,type:`primary`,size:`small`,onClick:e=>p.goToDetail(r.row.id)},{default:l(()=>[t(n(p.$t(`order.button.continuePay`)),1)]),_:1},8,[`onClick`])):(f(),c(A,{key:1,size:`small`,onClick:e=>p.goToDetail(r.row.id)},{default:l(()=>[t(n(p.$t(`order.button.checkDetail`)),1)]),_:1},8,[`onClick`]))])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[I,p.loading]])]),_:1})]),_:1})]),_:1}),r(y,null,{default:l(()=>[r(v,{span:10,offset:14},{default:l(()=>[e(`div`,ue,[r(F,{"current-page":p.page,"page-size":p.limit,total:p.total,onChange:p.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var fe=k(L,[[`render`,de],[`__scopeId`,`data-v-a543d5b3`]]);export{fe as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,N as i,T as a,at as o,ht as s,j as c,mt as l,ot as u,rt as d,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{r as m,t as h}from"./select-DBAlqBh7.js";import{n as ee,t as g}from"./table-C1vM8njh.js";import{o as _}from"./models-ClsawnaQ.js";import{t as v}from"./card-IQwqnRJR.js";import{n as y,t as b}from"./file-output-DhLnUzfl.js";import{n as x,t as S}from"./row-BlBs21oD.js";import{t as C}from"./skeleton-Dj_a_iIP.js";import{t as w}from"./circle-check-DPDNVpIH.js";import{t as T}from"./clock-DiJ9741Z.js";import{t as E}from"./dollar-sign-CywLXTmf.js";import{Fi as D,Ni as O,O as k,an as A,bi as j,mr as M}from"./index-7B54VLaT.js";import{t as N}from"./CopyToClipboard-DOtA8ld0.js";import{t as P}from"./pagination-CuiF_2-G.js";var F=j(`receipt`,[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]),I={total_count:0,total_spent:0,state_counts:{}},L=p({name:`ConsoleOrderList`,components:{ExportIcon:b,MoneyIcon:E,ReceiptIcon:F,SuccessIcon:w,TimeIcon:T,Pagination:P,CopyToClipboard:N,ElRow:S,ElCol:x,ElTable:g,ElTableColumn:ee,ElButton:D,ElTag:O,ElCard:v,ElSelect:m,ElOption:h,ElDatePicker:y,ElSkeleton:C},data(){return{OrderState:_,orders:[],loading:!1,total:void 0,limit:10,filterState:this.$route.query.state?.toString()||``,filterPayWay:this.$route.query.pay_way?.toString()||``,createdAtRange:(()=>{let e=this.$route.query.created_at_from?.toString(),t=this.$route.query.created_at_to?.toString();if(e&&t)return[new Date(e),new Date(t)]})(),summary:{...I},summaryLoading:!1,exporting:!1,shortcuts:[{text:this.$t(`usage.shortcuts.today`),value:()=>{let e=new Date,t=new Date;return t.setHours(0,0,0,0),[t,e]}},{text:this.$t(`usage.shortcuts.last7Days`),value:()=>{let e=new Date,t=new Date;return t.setDate(t.getDate()-7),[t,e]}},{text:this.$t(`usage.shortcuts.last1Month`),value:()=>{let e=new Date,t=new Date;return t.setMonth(t.getMonth()-1),[t,e]}}]}},computed:{page(){return parseInt(this.$route.query.page?.toString()||`1`)},stateOptions(){return[{value:_.PENDING,label:this.$t(`order.state.pending`)},{value:_.FINISHED,label:this.$t(`order.state.finished`)},{value:_.PAID,label:this.$t(`order.state.paid`)},{value:_.EXPIRED,label:this.$t(`order.state.expired`)},{value:_.FAILED,label:this.$t(`order.state.failed`)},{value:_.REFUNDED,label:this.$t(`order.state.refunded`)}]},payWayOptions(){return[{value:`WechatPay`,label:this.$t(`order.title.wechatPay`)},{value:`Stripe`,label:this.$t(`order.title.stripe`)},{value:`Card`,label:this.$t(`order.title.card`)},{value:`AliPay`,label:this.$t(`order.title.aliPay`)},{value:`X402`,label:this.$t(`order.title.x402`)},{value:`PayPal`,label:this.$t(`order.title.paypal`)}]},filterQuery(){let e={user_id:this.$store.getters.user?.id};return this.filterState&&(e.state=this.filterState),this.filterPayWay&&(e.pay_way=this.filterPayWay),this.createdAtRange?.[0]&&(e.created_at_from=this.createdAtRange[0]),this.createdAtRange?.[1]&&(e.created_at_to=this.createdAtRange[1]),e}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onFetchData(),this.onFetchSummary()},methods:{getPriceString:A,stateTagType(e){return e===_.FINISHED||e===_.PAID?`success`:e===_.EXPIRED||e===_.FAILED?`danger`:e===_.REFUNDED?`warning`:`info`},stateLabel(e){return{[_.PENDING]:this.$t(`order.state.pending`),[_.PAID]:this.$t(`order.state.paid`),[_.FINISHED]:this.$t(`order.state.finished`),[_.EXPIRED]:this.$t(`order.state.expired`),[_.FAILED]:this.$t(`order.state.failed`),[_.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==_.PAID&&e!==_.FINISHED&&e!==_.EXPIRED&&e!==_.FAILED&&e!==_.REFUNDED},goToDetail(e){this.$router.push({name:`console-order-detail`,params:{id:e}})},async onFilterChange(){await this.$router.push({name:this.$route.name?.toString(),query:{page:1,...this.filterState?{state:this.filterState}:{},...this.filterPayWay?{pay_way:this.filterPayWay}:{},...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0].toISOString()}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1].toISOString()}:{}}}),this.onFetchData(),this.onFetchSummary()},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchData(){this.loading=!0,M.getAll({ordering:`-created_at`,limit:this.limit,offset:(this.page-1)*this.limit,...this.filterQuery}).then(({data:e})=>{this.orders=e.items,this.total=e.count}).catch(()=>{}).finally(()=>{this.loading=!1})},onFetchSummary(){this.summaryLoading=!0,M.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...I}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,M.exportCsv(this.filterQuery).then(({data:e})=>{let t=window.URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`orders.csv`,n.click(),window.URL.revokeObjectURL(t)}).catch(()=>{}).finally(()=>{this.exporting=!1})}}}),R={class:`title`},z={key:1,class:`card-content`},B={class:`icon-wrapper`},V={class:`description`},H={class:`value`},U={key:1,class:`card-content`},W={class:`icon-wrapper`},G={class:`description`},K={class:`value`},q={key:1,class:`card-content`},J={class:`icon-wrapper`},te={class:`description`},Y={class:`value`},X={key:1,class:`card-content`},Z={class:`icon-wrapper`},Q={class:`description`},ne={class:`value`},re={class:`filter-row mb-3`},$={class:`key`},ie={class:`cursor-pointer`},ae={class:`price`},oe={class:`description`},se={class:`text-gray-500`},ce={class:`created-at`},le={class:`flex items-center justify-center flex-wrap`},ue={class:`float-right`};function de(p,m,h,ee,g,_){let v=o(`el-col`),y=o(`el-row`),b=o(`el-skeleton`),x=o(`receipt-icon`),S=o(`el-card`),C=o(`money-icon`),w=o(`success-icon`),T=o(`time-icon`),E=o(`el-option`),D=o(`el-select`),O=o(`el-date-picker`),k=o(`export-icon`),A=o(`el-button`),j=o(`copy-to-clipboard`),M=o(`el-table-column`),N=o(`el-tag`),P=o(`el-table`),F=o(`pagination`),I=u(`loading`);return f(),c(y,{class:`panel`},{default:l(()=>[r(v,{span:24},{default:l(()=>[r(y,null,{default:l(()=>[r(v,{span:24},{default:l(()=>[e(`h2`,R,n(p.$t(`common.title.allOrders`)),1)]),_:1})]),_:1}),r(y,{gutter:16},{default:l(()=>[r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,z,[e(`div`,B,[r(x,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,V,n(p.$t(`order.title.totalOrders`)),1),e(`p`,H,n(p.summary.total_count),1)]))]),_:1})]),_:1}),r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,U,[e(`div`,W,[r(C,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,G,n(p.$t(`order.title.totalSpent`)),1),e(`p`,K,n(p.getPriceString({value:p.summary.total_spent})),1)]))]),_:1})]),_:1}),r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,q,[e(`div`,J,[r(w,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,te,n(p.$t(`order.title.finishedOrders`)),1),e(`p`,Y,n(p.summary.state_counts?.Finished||0),1)]))]),_:1})]),_:1}),r(v,{md:6,sm:12,xs:24},{default:l(()=>[r(S,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(b,{key:0})):(f(),i(`div`,X,[e(`div`,Z,[r(T,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,Q,n(p.$t(`order.title.pendingOrders`)),1),e(`p`,ne,n(p.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),e(`div`,re,[r(D,{modelValue:p.filterState,"onUpdate:modelValue":m[0]||=e=>p.filterState=e,clearable:``,placeholder:p.$t(`order.field.allStates`),class:`filter-select`,onChange:p.onFilterChange},{default:l(()=>[(f(!0),i(a,null,d(p.stateOptions,e=>(f(),c(E,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(D,{modelValue:p.filterPayWay,"onUpdate:modelValue":m[1]||=e=>p.filterPayWay=e,clearable:``,placeholder:p.$t(`order.field.allPayWays`),class:`filter-select`,onChange:p.onFilterChange},{default:l(()=>[(f(!0),i(a,null,d(p.payWayOptions,e=>(f(),c(E,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(O,{modelValue:p.createdAtRange,"onUpdate:modelValue":m[2]||=e=>p.createdAtRange=e,type:`datetimerange`,shortcuts:p.shortcuts,"range-separator":p.$t(`usage.placeholder.to`),"start-placeholder":p.$t(`usage.placeholder.startDate`),"end-placeholder":p.$t(`usage.placeholder.endDate`),onChange:p.onFilterChange},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`]),r(A,{type:`primary`,plain:``,loading:p.exporting,onClick:p.onExport},{default:l(()=>[r(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`order.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),r(y,null,{default:l(()=>[r(v,{span:24},{default:l(()=>[r(S,{shadow:`hover`},{default:l(()=>[s((f(),c(P,{data:p.orders,stripe:``,"empty-text":p.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:l(()=>[r(M,{prop:`id`,label:p.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:l(t=>[e(`span`,$,n(t.row.id),1),e(`span`,ie,[r(j,{content:t.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.price`),width:`110px`,align:`center`},{default:l(t=>[e(`span`,ae,n(p.getPriceString({value:t.row?.price})),1)]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.description`),"min-width":`220px`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:l(t=>[e(`span`,oe,n(t.row.description),1)]),_:1},8,[`label`]),r(M,{prop:`state`,label:p.$t(`order.field.state`),width:`130px`,align:`center`},{default:l(e=>[r(N,{type:p.stateTagType(e.row.state),class:`mx-1`,effect:`dark`,round:``,size:`small`},{default:l(()=>[t(n(p.stateLabel(e.row.state)),1)]),_:2},1032,[`type`])]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.payWay`),width:`120px`,align:`center`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:l(t=>[e(`span`,se,n(t.row.pay_way||`-`),1)]),_:1},8,[`label`]),r(M,{label:p.$t(`order.field.createdAt`),width:`200px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:l(t=>[e(`span`,ce,n(p.$dayjs.format(t.row.created_at)),1)]),_:1},8,[`label`]),r(M,{"min-width":`130px`,fixed:`right`},{default:l(r=>[e(`div`,le,[p.isPendingAction(r.row.state)?(f(),c(A,{key:0,type:`primary`,size:`small`,onClick:e=>p.goToDetail(r.row.id)},{default:l(()=>[t(n(p.$t(`order.button.continuePay`)),1)]),_:1},8,[`onClick`])):(f(),c(A,{key:1,size:`small`,onClick:e=>p.goToDetail(r.row.id)},{default:l(()=>[t(n(p.$t(`order.button.checkDetail`)),1)]),_:1},8,[`onClick`]))])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[I,p.loading]])]),_:1})]),_:1})]),_:1}),r(y,null,{default:l(()=>[r(v,{span:10,offset:14},{default:l(()=>[e(`div`,ue,[r(F,{"current-page":p.page,"page-size":p.limit,total:p.total,onChange:p.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var fe=k(L,[[`render`,de],[`__scopeId`,`data-v-a543d5b3`]]);export{fe as default};
@@ -1 +1 @@
1
- import{A as e,Jt as t,L as n,N as r,at as i,tt as a,z as o}from"./vendor-chart-Dw-P17PN.js";import{t as s}from"./LocalTools-Bn7my_3W.js";import{O as c}from"./index-C_sjkBHo.js";var l=o({name:`SettingsLocalTools`,components:{LocalToolsSetting:s}}),u={class:`local-tools-page`};function d(o,s,c,l,d,f){let p=i(`local-tools-setting`);return a(),r(`div`,u,[e(`h2`,null,t(o.$t(`common.settings.localTools`)),1),n(p)])}var f=c(l,[[`render`,d],[`__scopeId`,`data-v-ac732814`]]);export{f as default};
1
+ import{A as e,Jt as t,L as n,N as r,at as i,tt as a,z as o}from"./vendor-chart-Dw-P17PN.js";import{t as s}from"./LocalTools-C-4USNTM.js";import{O as c}from"./index-7B54VLaT.js";var l=o({name:`SettingsLocalTools`,components:{LocalToolsSetting:s}}),u={class:`local-tools-page`};function d(o,s,c,l,d,f){let p=i(`local-tools-setting`);return a(),r(`div`,u,[e(`h2`,null,t(o.$t(`common.settings.localTools`)),1),n(p)])}var f=c(l,[[`render`,d],[`__scopeId`,`data-v-ac732814`]]);export{f as default};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime--c01j_DQ.js";import{A as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,j as l,mt as u,rt as d,st as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{t as h}from"./switch-CI_r8TsE.js";import{t as ee}from"./file-DOjVowKo.js";import{t as g}from"./folder-BnpdAdOx.js";import{t as _}from"./mouse-pointer-2-o0odj8fp.js";import{t as v}from"./pencil-CHl88iig.js";import{t as y}from"./plus-C2LaXZld.js";import{t as b}from"./shield-DGhAiApq.js";import{t as x}from"./terminal-BVFIc0Qz.js";import{t as S}from"./wand-sparkles-Dp_e6WgR.js";import{A as C,Er as w,Fi as T,Ni as E,O as te,Ui as ne,bi as D,di as O,oi as k}from"./index-C_sjkBHo.js";var A=D(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),j=D(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),M=D(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),N=D(`move`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]),P=m({name:`LocalToolsSetting`,components:{AddIcon:y,ElButton:T,ElTag:E,ElSwitch:h,ElInput:ne,FolderIcon:g,MagicIcon:S,SecurityIcon:b},data(){return{roots:[],workingDir:``,pickingWorkingDir:!1,tools:[],mcpServers:[],mcpUid:0,mcpStatuses:[],mcpBusy:null,savingMcp:!1,mcpSavedTip:!1,mcpError:``,grants:null,perm:null,computerUse:!1,computerTools:[],computerGrants:{},cuBusy:null,builtinTools:[],mcpTools:[],toolGrants:{},builtinBusy:null,savingCU:!1,preauthorizing:!1,saving:!1,savedTip:!1,a11yEnabled:!1,xhsSkill:null,xhsLoading:!1,xhsInstalling:!1,xhsError:``,onFocus:null,cuOff:null,a11yPoll:null,refreshingA11y:!1}},computed:{desktop(){return!!C()},android(){return O()},canInstallXhs(){return this.a11yEnabled&&this.computerUse}},async mounted(){let e=C();if(!e)return;let t=await e.getConfig();this.roots=t.roots,this.workingDir=t.workingDir??``,this.computerUse=t.computerUse===!0,this.mcpServers=(t.mcp??[]).map(e=>({_uid:this.mcpUid++,id:e.id,command:e.command,argsText:(e.args??[]).join(`
1
+ import{r as e}from"./rolldown-runtime--c01j_DQ.js";import{A as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,j as l,mt as u,rt as d,st as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{t as h}from"./switch-CSqIz9Bn.js";import{t as ee}from"./file-LnGz9WRY.js";import{t as g}from"./folder-Dr7ed_3M.js";import{t as _}from"./mouse-pointer-2-BBn4GKTK.js";import{t as v}from"./pencil-I6_OZ6iL.js";import{t as y}from"./plus-C0xbPTZz.js";import{t as b}from"./shield-AmkRPSzW.js";import{t as x}from"./terminal-n5_CpByL.js";import{t as S}from"./wand-sparkles-BYpsEWX0.js";import{A as C,Er as w,Fi as T,Ni as E,O as te,Ui as ne,bi as D,di as O,oi as k}from"./index-7B54VLaT.js";var A=D(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),j=D(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),M=D(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),N=D(`move`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]),P=m({name:`LocalToolsSetting`,components:{AddIcon:y,ElButton:T,ElTag:E,ElSwitch:h,ElInput:ne,FolderIcon:g,MagicIcon:S,SecurityIcon:b},data(){return{roots:[],workingDir:``,pickingWorkingDir:!1,tools:[],mcpServers:[],mcpUid:0,mcpStatuses:[],mcpBusy:null,savingMcp:!1,mcpSavedTip:!1,mcpError:``,grants:null,perm:null,computerUse:!1,computerTools:[],computerGrants:{},cuBusy:null,builtinTools:[],mcpTools:[],toolGrants:{},builtinBusy:null,savingCU:!1,preauthorizing:!1,saving:!1,savedTip:!1,a11yEnabled:!1,xhsSkill:null,xhsLoading:!1,xhsInstalling:!1,xhsError:``,onFocus:null,cuOff:null,a11yPoll:null,refreshingA11y:!1}},computed:{desktop(){return!!C()},android(){return O()},canInstallXhs(){return this.a11yEnabled&&this.computerUse}},async mounted(){let e=C();if(!e)return;let t=await e.getConfig();this.roots=t.roots,this.workingDir=t.workingDir??``,this.computerUse=t.computerUse===!0,this.mcpServers=(t.mcp??[]).map(e=>({_uid:this.mcpUid++,id:e.id,command:e.command,argsText:(e.args??[]).join(`
2
2
  `),envText:Object.entries(e.env??{}).map(([e,t])=>`${e}=${t}`).join(`
3
3
  `),enabled:e.enabled!==!1})),this.mcpStatuses=await e.mcp?.status()??[],this.tools=(await e.listTools()).map(e=>e.name),this.computerTools=await e.computerTools?.()??[],this.builtinTools=await e.builtinTools?.()??[],this.mcpTools=await e.mcpTools?.()??[];let n=await e.perm?.status();n?.mac&&(this.perm=n),await this.loadGrants(),this.android&&(await this.refreshA11y(),this.fetchXhsSkill(),this.onFocus=()=>{document.visibilityState===`visible`&&this.refreshA11y()},document.addEventListener(`visibilitychange`,this.onFocus),this.a11yPoll=window.setInterval(()=>{document.visibilityState===`visible`&&this.refreshA11y()},3e3)),this.cuOff=e.onComputerUseDisabled?.(()=>{this.computerUse=!1})??null},beforeUnmount(){this.cuOff?.(),this.onFocus&&document.removeEventListener(`visibilitychange`,this.onFocus),this.a11yPoll&&clearInterval(this.a11yPoll)},methods:{async refreshA11y(){if(!this.refreshingA11y){this.refreshingA11y=!0;try{let e=await C()?.perm?.status();this.a11yEnabled=e?.accessibility===!0}finally{this.refreshingA11y=!1}}},async openAndroidAccessibility(){await C()?.perm?.openPane(`accessibility`)},async fetchXhsSkill(){this.xhsLoading=!0,this.xhsError=``;try{let e=await w.get(`/skills/`,{baseURL:`${k()}/api/v1`,params:{q:`xhs-dm`,limit:10}}),t=Array.isArray(e.data?.items)?e.data.items:[];this.xhsSkill=t.find(e=>e.identifier?.endsWith(`/xhs-dm`))??null}catch(e){console.warn(`[LocalTools] fetch xhs skill failed`,e),this.xhsSkill=null,this.xhsError=this.$t(`common.settings.localToolsAndroidSkillsLoadFailed`)}finally{this.xhsLoading=!1}},async installXhs(){let e=this.xhsSkill;if(!(!e||e.installed)){this.xhsInstalling=!0,this.xhsError=``;try{await w.post(`/skills/${e.id}/install/`,{},{baseURL:`${k()}/api/v1`}),e.installed=!0}catch(t){t?.response?.status===409?e.installed=!0:this.xhsError=this.$t(`common.settings.localToolsAndroidSkillsInstallFailed`)}finally{this.xhsInstalling=!1}}},async loadGrants(){let e=C();if(!e?.grants){this.grants=null;return}let t=await e.grants.list(),n={},r={},i=new Set(this.builtinTools.map(e=>e.name)),a=new Set(this.mcpTools.map(e=>e.name)),o=[];for(let e of t){if(e.startsWith(`computer.`)&&!e.includes(`:`)){n[e]=!0;continue}if(!e.includes(`:`)&&(i.has(e)||a.has(e))){r[e]=!0;continue}if(e.startsWith(`dir:`)){let t=e.slice(4),n=t.indexOf(`:`);if(n>0){o.push({key:e,name:t.slice(0,n),input:`📁 ${t.slice(n+1)}`});continue}}let t=e.indexOf(`:{`),s=t>=0?t:e.indexOf(`:`);o.push({key:e,name:s>=0?e.slice(0,s):e,input:s>=0?e.slice(s+1):``})}this.computerGrants=n,this.toolGrants=r,this.grants=o},async chooseWorkingDir(){if(!this.pickingWorkingDir){this.pickingWorkingDir=!0;try{let e=await C()?.pickFolder();if(!e)return;let t=await C()?.getConfig();await C()?.saveConfig({roots:t?.roots??this.roots,mcp:t?.mcp??[],computerUse:this.computerUse,workingDir:e}),this.workingDir=e}finally{this.pickingWorkingDir=!1}}},async addFolder(){let e=await C()?.pickFolder();e&&!this.roots.includes(e)&&this.roots.push(e)},removeRoot(e){this.roots.splice(e,1)},addMcp(){this.mcpServers.push({_uid:this.mcpUid++,id:``,command:``,argsText:``,envText:``,enabled:!0})},removeMcp(e){this.mcpServers.splice(e,1)},mcpStatusFor(e){let t=e.trim();return this.mcpStatuses.find(e=>e.id===t)},mcpBadgeType(e){let t=this.mcpStatusFor(e)?.status;return t===`connected`?`success`:t===`failed`?`danger`:`info`},mcpBadgeText(e){let t=this.mcpStatusFor(e);return this.mcpBusy===e.trim()?this.$t(`common.settings.localToolsMcpConnecting`):t?t.status===`connected`?this.$t(`common.settings.localToolsMcpConnected`,{n:t.toolCount}):t.status===`disabled`?this.$t(`common.settings.localToolsMcpDisabled`):this.$t(`common.settings.localToolsMcpFailed`):this.$t(`common.settings.localToolsMcpNotSaved`)},mcpErrorFor(e){let t=this.mcpStatusFor(e);return t?.status===`failed`&&t.error?t.error:``},buildMcpPayload(){this.mcpError=``;let e=[],t=new Set;for(let n of this.mcpServers){let r=n.id.trim(),i=n.command.trim();if(!r||!i)return this.mcpError=this.$t(`common.settings.localToolsMcpNameRequired`),null;if(!/^[A-Za-z0-9_-]+$/.test(r))return this.mcpError=this.$t(`common.settings.localToolsMcpNameInvalid`),null;if(t.has(r))return this.mcpError=this.$t(`common.settings.localToolsMcpDuplicateName`),null;t.add(r);let a=n.argsText.split(`
4
4
  `).map(e=>e.trim()).filter(Boolean),o={};for(let e of n.envText.split(`
@@ -1 +1 @@
1
- import{A as e,N as t,qt as n,tt as r,z as i}from"./vendor-chart-Dw-P17PN.js";import{O as a}from"./index-C_sjkBHo.js";var o=`/assets/acedata-mark-l2r40Kh8.png`,s=`/assets/acedata-wordmark-mask-BIn-5zkq.png`,c=i({props:{collapsed:{type:Boolean,default:!1}},emits:[`click`],data(){return{logoMark:o}},computed:{siteTitle(){return this.$store.state.site?.title||`AceData`},tenantLogo(){let e=this.$store.state.site;return this.collapsed?e?.favicon||e?.logo||``:e?.logo||e?.favicon||``},wordmarkStyle(){return{"--logo-wordmark-mask":`url(${s})`}}}}),l=[`aria-label`],u=[`src`,`alt`],d=[`src`],f={key:2,class:`brand-logo__wordmark`},p={class:`brand-logo__wordmark-inner`},m=[`src`];function h(i,a,o,s,c,h){return r(),t(`button`,{type:`button`,class:`brand-logo`,"aria-label":i.siteTitle,onClick:a[0]||=e=>i.$emit(`click`)},[i.tenantLogo?(r(),t(`img`,{key:0,src:i.tenantLogo,class:`brand-logo__image`,alt:i.siteTitle},null,8,u)):i.collapsed?(r(),t(`img`,{key:1,src:i.logoMark,class:`brand-logo__mark`,alt:``,"aria-hidden":`true`},null,8,d)):(r(),t(`span`,f,[e(`span`,p,[e(`img`,{src:i.logoMark,class:`brand-logo__wordmark-mark`,alt:``,"aria-hidden":`true`},null,8,m),e(`span`,{class:`brand-logo__wordmark-text`,style:n(i.wordmarkStyle),"aria-hidden":`true`},null,4)])]))],8,l)}var g=a(c,[[`render`,h],[`__scopeId`,`data-v-424e80af`]]);export{g as t};
1
+ import{A as e,N as t,qt as n,tt as r,z as i}from"./vendor-chart-Dw-P17PN.js";import{O as a}from"./index-7B54VLaT.js";var o=`/assets/acedata-mark-l2r40Kh8.png`,s=`/assets/acedata-wordmark-mask-BIn-5zkq.png`,c=i({props:{collapsed:{type:Boolean,default:!1}},emits:[`click`],data(){return{logoMark:o}},computed:{siteTitle(){return this.$store.state.site?.title||`AceData`},tenantLogo(){let e=this.$store.state.site;return this.collapsed?e?.favicon||e?.logo||``:e?.logo||e?.favicon||``},wordmarkStyle(){return{"--logo-wordmark-mask":`url(${s})`}}}}),l=[`aria-label`],u=[`src`,`alt`],d=[`src`],f={key:2,class:`brand-logo__wordmark`},p={class:`brand-logo__wordmark-inner`},m=[`src`];function h(i,a,o,s,c,h){return r(),t(`button`,{type:`button`,class:`brand-logo`,"aria-label":i.siteTitle,onClick:a[0]||=e=>i.$emit(`click`)},[i.tenantLogo?(r(),t(`img`,{key:0,src:i.tenantLogo,class:`brand-logo__image`,alt:i.siteTitle},null,8,u)):i.collapsed?(r(),t(`img`,{key:1,src:i.logoMark,class:`brand-logo__mark`,alt:``,"aria-hidden":`true`},null,8,d)):(r(),t(`span`,f,[e(`span`,p,[e(`img`,{src:i.logoMark,class:`brand-logo__wordmark-mark`,alt:``,"aria-hidden":`true`},null,8,m),e(`span`,{class:`brand-logo__wordmark-text`,style:n(i.wordmarkStyle),"aria-hidden":`true`},null,4)])]))],8,l)}var g=a(c,[[`render`,h],[`__scopeId`,`data-v-424e80af`]]);export{g as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,at as o,j as s,k as c,mt as l,tt as u,z as d}from"./vendor-chart-Dw-P17PN.js";import{f,h as p,p as m,v as h}from"./models-ClsawnaQ.js";import{t as g}from"./Navigator-CSJ0YFuP.js";import{t as _}from"./checkbox-DXMDpaxv.js";import{t as v}from"./divider-Du_3kymg.js";import"./constants-D04Y0eol.js";import{Ei as y,Fi as b,O as x,Tr as S,rn as C,si as w}from"./index-C_sjkBHo.js";import{t as T}from"./Status-BM8T5G6r.js";var E=d({name:`ApplicationConfirm`,components:{ElDialog:y,ElDivider:v,ElCheckbox:_,ElButton:b},props:{visible:{type:Boolean,required:!1,default:!1}},emits:[`update:visible`,`apply`],data(){return{checked:!0}},watch:{},methods:{getBaseUrlPlatform:w,onApply(){if(!this.checked){h.error(this.$t(`application.message.notAgreePolicy`));return}this.$emit(`apply`)}}}),D={class:`content py-[10px] px-[40px]`},O={class:`my-4`},k={class:`policy mb-[10px]`},A={class:`policy-title text-[12px] relative -bottom-[3px]`},j=[`href`];function M(i,a,c,d,f,p){let m=o(`el-divider`),h=o(`el-checkbox`),g=o(`el-button`),_=o(`el-dialog`);return u(),s(_,{"model-value":i.visible,width:`500px`,title:i.$t(`application.message.welcome`),center:``,onClose:a[1]||=e=>i.$emit(`update:visible`,!1)},{default:l(()=>[e(`div`,D,[e(`p`,O,n(i.$t(`application.message.notApplied`)),1),r(m,{class:`my-2`}),e(`div`,k,[r(h,{modelValue:i.checked,"onUpdate:modelValue":a[0]||=e=>i.checked=e,size:`large`,class:`policy-checkbox mr-[10px]`},null,8,[`modelValue`]),e(`span`,A,n(i.$t(`application.message.readPolicy`)),1),e(`a`,{class:`policy-title text-[12px] relative -bottom-[3px] text-[var(--el-color-primary)] cursor-pointer no-underline`,target:`_blank`,href:i.getBaseUrlPlatform()+`/terms`},` \xA0`+n(i.$t(`application.message.policy`)),9,j)]),r(g,{round:``,type:`primary`,onClick:i.onApply},{default:l(()=>[t(n(i.$t(`common.button.start`)),1)]),_:1},8,[`onClick`])])]),_:1},8,[`model-value`,`title`])}var N=x(E,[[`render`,M]]),P=15e3,F=d({name:`LayoutMain`,components:{Navigator:g,ApplicationStatus:T,ApplicationConfirm:N},provide(){return{initialized:c(()=>this.initialized)}},data(){return{initialized:!1,applying:!1,mobile:typeof window<`u`&&window.innerWidth<768,initializeRunId:0,balanceTimer:0}},computed:{appName(){return this.$route.meta.appName},application(){return this.$store.state[this.appName]?.application},applications(){let e=this.$store.state[this.appName]?.applications??[];console.debug(`individualApplications`,e);let t=this.$store.state.applications??[];return console.debug(`globalApplications`,t),t.concat(e)},loading(){return this.$store.state[this.appName]?.status?.getApplications===p.Request},service(){return this.$store.state[this.appName]?.service},userId(){return this.$store.state.user?.id}},watch:{appName(){this.initialize()},userId(e,t){e&&e!==t&&this.initialize()}},mounted(){this.initialize(),window.addEventListener(`resize`,this.onResize),this.balanceTimer=window.setInterval(this.refreshBalances,P),document.addEventListener(`visibilitychange`,this.onVisibility)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize),window.clearInterval(this.balanceTimer),document.removeEventListener(`visibilitychange`,this.onVisibility)},methods:{onResize(){this.mobile=window.innerWidth<768},onVisibility(){typeof document<`u`&&!document.hidden&&this.refreshBalances()},async refreshBalances(){if(!this.appName||!this.$store.state.token?.access||typeof document<`u`&&document.hidden||this.loading)return;await Promise.allSettled([this.$store.dispatch(`getApplications`),this.$store.dispatch(`${this.appName}/getApplications`)]);let e=this.$store.state[this.appName]?.application;if(!e)return;let t=this.applications?.find(t=>t.id===e.id);t&&t!==e&&this.$store.commit(`${this.appName}/setApplication`,t)},async initialize(){let e=++this.initializeRunId;if(this.initialized=!1,!this.$store.state.token?.access||(console.debug(`Fetching all individual and global applications for`,this.appName),await Promise.allSettled([this.$store.dispatch(`getApplications`),this.$store.dispatch(`${this.appName}/getApplications`)]),e!==this.initializeRunId))return;console.debug(`Fetched all applications`,this.applications),this.$store.state.applications?.length===0&&await this.onAutoApply();let t=this.$store.state[this.appName]?.application;console.debug(`current application`,t);let n=C(this.applications,t);console.debug(`final application`,n),n&&(console.debug(`set final application`,n,n?.type),await this.$store.dispatch(`${this.appName}/setApplication`,n)),console.debug(`finished initialization`),this.initialized=!0},onApply(){this.onAutoApply()},async onAutoApply(){try{await S.create({type:m.USAGE,scope:f.GLOBAL,user_id:this.$store.getters.user.id}),this.applying=!1,await this.$store.dispatch(`getApplications`),this.showWelcomeToast()}catch(e){e?.response?.data?.code===`duplication`?await this.$store.dispatch(`getApplications`):h.error(this.$t(`application.message.applyFailed`))}},showWelcomeToast(){let e=this.$store.state.applications?.[0],t=Math.floor(e?.remaining_amount??0),n=this.$store.state.site?.title||`AceData`;h({message:t>0?this.$t(`application.message.welcomeWithCredits`,{credits:t,brand:n}):this.$t(`application.message.welcomeNoCredits`,{brand:n}),type:`success`,duration:6e3,showClose:!0})}}}),I={class:`wrapper`};function L(e,t,n,c,l,d){let f=o(`router-view`),p=o(`navigator`),m=o(`application-status`),h=o(`application-confirm`);return u(),a(`div`,I,[r(f,{class:`main`}),r(p,{class:`navigator`,direction:e.mobile?`row`:`column`},null,8,[`direction`]),e.application?(u(),s(m,{key:0,class:`status-floating fixed right-2 z-[200]`,application:e.application,applications:e.applications,"show-price":!1,authenticated:!!e.$store.state.token.access,service:e.service,onSelect:t[0]||=t=>e.$store.dispatch(`${e.appName}/setApplication`,t)},null,8,[`application`,`applications`,`authenticated`,`service`])):i(``,!0),r(h,{modelValue:e.applying,"onUpdate:modelValue":t[1]||=t=>e.applying=t,modelModifiers:{visible:!0},onApply:e.onApply},null,8,[`modelValue`,`onApply`])])}var R=x(F,[[`render`,L],[`__scopeId`,`data-v-16185df9`]]);export{R as default};
1
+ import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,at as o,j as s,k as c,mt as l,tt as u,z as d}from"./vendor-chart-Dw-P17PN.js";import{f,h as p,p as m,v as h}from"./models-ClsawnaQ.js";import{t as g}from"./Navigator-BKP8pbED.js";import{t as _}from"./checkbox-DXMDpaxv.js";import{t as v}from"./divider-Du_3kymg.js";import"./constants-D04Y0eol.js";import{Ei as y,Fi as b,O as x,Tr as S,rn as C,si as w}from"./index-7B54VLaT.js";import{t as T}from"./Status-KUCUEyHr.js";var E=d({name:`ApplicationConfirm`,components:{ElDialog:y,ElDivider:v,ElCheckbox:_,ElButton:b},props:{visible:{type:Boolean,required:!1,default:!1}},emits:[`update:visible`,`apply`],data(){return{checked:!0}},watch:{},methods:{getBaseUrlPlatform:w,onApply(){if(!this.checked){h.error(this.$t(`application.message.notAgreePolicy`));return}this.$emit(`apply`)}}}),D={class:`content py-[10px] px-[40px]`},O={class:`my-4`},k={class:`policy mb-[10px]`},A={class:`policy-title text-[12px] relative -bottom-[3px]`},j=[`href`];function M(i,a,c,d,f,p){let m=o(`el-divider`),h=o(`el-checkbox`),g=o(`el-button`),_=o(`el-dialog`);return u(),s(_,{"model-value":i.visible,width:`500px`,title:i.$t(`application.message.welcome`),center:``,onClose:a[1]||=e=>i.$emit(`update:visible`,!1)},{default:l(()=>[e(`div`,D,[e(`p`,O,n(i.$t(`application.message.notApplied`)),1),r(m,{class:`my-2`}),e(`div`,k,[r(h,{modelValue:i.checked,"onUpdate:modelValue":a[0]||=e=>i.checked=e,size:`large`,class:`policy-checkbox mr-[10px]`},null,8,[`modelValue`]),e(`span`,A,n(i.$t(`application.message.readPolicy`)),1),e(`a`,{class:`policy-title text-[12px] relative -bottom-[3px] text-[var(--el-color-primary)] cursor-pointer no-underline`,target:`_blank`,href:i.getBaseUrlPlatform()+`/terms`},` \xA0`+n(i.$t(`application.message.policy`)),9,j)]),r(g,{round:``,type:`primary`,onClick:i.onApply},{default:l(()=>[t(n(i.$t(`common.button.start`)),1)]),_:1},8,[`onClick`])])]),_:1},8,[`model-value`,`title`])}var N=x(E,[[`render`,M]]),P=15e3,F=d({name:`LayoutMain`,components:{Navigator:g,ApplicationStatus:T,ApplicationConfirm:N},provide(){return{initialized:c(()=>this.initialized)}},data(){return{initialized:!1,applying:!1,mobile:typeof window<`u`&&window.innerWidth<768,initializeRunId:0,balanceTimer:0}},computed:{appName(){return this.$route.meta.appName},application(){return this.$store.state[this.appName]?.application},applications(){let e=this.$store.state[this.appName]?.applications??[];console.debug(`individualApplications`,e);let t=this.$store.state.applications??[];return console.debug(`globalApplications`,t),t.concat(e)},loading(){return this.$store.state[this.appName]?.status?.getApplications===p.Request},service(){return this.$store.state[this.appName]?.service},userId(){return this.$store.state.user?.id}},watch:{appName(){this.initialize()},userId(e,t){e&&e!==t&&this.initialize()}},mounted(){this.initialize(),window.addEventListener(`resize`,this.onResize),this.balanceTimer=window.setInterval(this.refreshBalances,P),document.addEventListener(`visibilitychange`,this.onVisibility)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize),window.clearInterval(this.balanceTimer),document.removeEventListener(`visibilitychange`,this.onVisibility)},methods:{onResize(){this.mobile=window.innerWidth<768},onVisibility(){typeof document<`u`&&!document.hidden&&this.refreshBalances()},async refreshBalances(){if(!this.appName||!this.$store.state.token?.access||typeof document<`u`&&document.hidden||this.loading)return;await Promise.allSettled([this.$store.dispatch(`getApplications`),this.$store.dispatch(`${this.appName}/getApplications`)]);let e=this.$store.state[this.appName]?.application;if(!e)return;let t=this.applications?.find(t=>t.id===e.id);t&&t!==e&&this.$store.commit(`${this.appName}/setApplication`,t)},async initialize(){let e=++this.initializeRunId;if(this.initialized=!1,!this.$store.state.token?.access||(console.debug(`Fetching all individual and global applications for`,this.appName),await Promise.allSettled([this.$store.dispatch(`getApplications`),this.$store.dispatch(`${this.appName}/getApplications`)]),e!==this.initializeRunId))return;console.debug(`Fetched all applications`,this.applications),this.$store.state.applications?.length===0&&await this.onAutoApply();let t=this.$store.state[this.appName]?.application;console.debug(`current application`,t);let n=C(this.applications,t);console.debug(`final application`,n),n&&(console.debug(`set final application`,n,n?.type),await this.$store.dispatch(`${this.appName}/setApplication`,n)),console.debug(`finished initialization`),this.initialized=!0},onApply(){this.onAutoApply()},async onAutoApply(){try{await S.create({type:m.USAGE,scope:f.GLOBAL,user_id:this.$store.getters.user.id}),this.applying=!1,await this.$store.dispatch(`getApplications`),this.showWelcomeToast()}catch(e){e?.response?.data?.code===`duplication`?await this.$store.dispatch(`getApplications`):h.error(this.$t(`application.message.applyFailed`))}},showWelcomeToast(){let e=this.$store.state.applications?.[0],t=Math.floor(e?.remaining_amount??0),n=this.$store.state.site?.title||`AceData`;h({message:t>0?this.$t(`application.message.welcomeWithCredits`,{credits:t,brand:n}):this.$t(`application.message.welcomeNoCredits`,{brand:n}),type:`success`,duration:6e3,showClose:!0})}}}),I={class:`wrapper`};function L(e,t,n,c,l,d){let f=o(`router-view`),p=o(`navigator`),m=o(`application-status`),h=o(`application-confirm`);return u(),a(`div`,I,[r(f,{class:`main`}),r(p,{class:`navigator`,direction:e.mobile?`row`:`column`},null,8,[`direction`]),e.application?(u(),s(m,{key:0,class:`status-floating fixed right-2 z-[200]`,application:e.application,applications:e.applications,"show-price":!1,authenticated:!!e.$store.state.token.access,service:e.service,onSelect:t[0]||=t=>e.$store.dispatch(`${e.appName}/setApplication`,t)},null,8,[`application`,`applications`,`authenticated`,`service`])):i(``,!0),r(h,{modelValue:e.applying,"onUpdate:modelValue":t[1]||=t=>e.applying=t,modelModifiers:{visible:!0},onApply:e.onApply},null,8,[`modelValue`,`onApply`])])}var R=x(F,[[`render`,L],[`__scopeId`,`data-v-16185df9`]]);export{R as default};