@acedatacloud/nexior 3.356.2 → 3.356.3

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 (294) hide show
  1. package/dist/assets/{ApiCodeButton-CiYVI-BW.js → ApiCodeButton-DnW2mEEl.js} +1 -1
  2. package/dist/assets/{Artifacts-oV-cxX6-.js → Artifacts-BbXNE0MY.js} +1 -1
  3. package/dist/assets/{AskUserQuestionCard-BJ5H7v3C.js → AskUserQuestionCard-Cbw3Hxlr.js} +1 -1
  4. package/dist/assets/{Auth-DmbX4IcG.js → Auth-Csf5NVN-.js} +1 -1
  5. package/dist/assets/{Bare-CKC6gxoC.js → Bare-CtV6pjUP.js} +1 -1
  6. package/dist/assets/{BotPlaceholder-CWVuEjbL.js → BotPlaceholder-hcIRfy3i.js} +1 -1
  7. package/dist/assets/{BottomFooter-C80gDUXR.js → BottomFooter-DzQdavFJ.js} +1 -1
  8. package/dist/assets/{BrowserPairingDialog-NGsMVfzJ.js → BrowserPairingDialog-Cl__jmX7.js} +1 -1
  9. package/dist/assets/{Callback-CEITpQWh.js → Callback-CaJlsIlI.js} +1 -1
  10. package/dist/assets/{CodeSnippet-BUumFIYE.js → CodeSnippet-PjDE_CEu.js} +1 -1
  11. package/dist/assets/{Console-DaKR60hu.js → Console-B2Ek4SCM.js} +1 -1
  12. package/dist/assets/{Consumption-64yHTpsG.js → Consumption-C1nuDweL.js} +1 -1
  13. package/dist/assets/{Conversation-fDmuX-NP.js → Conversation-BMSIKWqv.js} +1 -1
  14. package/dist/assets/{Conversation-Br3QCbxZ.js → Conversation-inS0U5qq.js} +1 -1
  15. package/dist/assets/{CopyToClipboard-BoetcLMP.js → CopyToClipboard-CLVp5I29.js} +1 -1
  16. package/dist/assets/{Detail-xLit1ZcQ.js → Detail-4_enJ6qH.js} +2 -2
  17. package/dist/assets/{Extra-C2v1moyP.js → Extra-Ce7_Kba0.js} +1 -1
  18. package/dist/assets/{FilePreview-CL9QnaXZ.js → FilePreview-BlCzWGSp.js} +1 -1
  19. package/dist/assets/{Hailuo-BgKkSb1Z.js → Hailuo-CRu4cYR4.js} +1 -1
  20. package/dist/assets/{History-Csx7tGHq.js → History-CyDH3_w6.js} +1 -1
  21. package/dist/assets/{ImagePreview-Bc9stSGF.js → ImagePreview-DIR230rQ.js} +1 -1
  22. package/dist/assets/{ImageWrapper-BU9rTzRE.js → ImageWrapper-DTMYPBbG.js} +1 -1
  23. package/dist/assets/{Index-CbYgQHvA.js → Index-7-jB-rrs.js} +1 -1
  24. package/dist/assets/{Index-CxtAOMuR2.js → Index-B5t18uMS2.js} +1 -1
  25. package/dist/assets/{Index-BLkVvuW1.js → Index-B8Wivqji.js} +1 -1
  26. package/dist/assets/Index-BU-Jt2iC.css +1 -0
  27. package/dist/assets/{Index-Dp4r7Gxt.js → Index-BXIajqur.js} +1 -1
  28. package/dist/assets/{Index-C7sDNFdr.js → Index-Bh0MSga2.js} +1 -1
  29. package/dist/assets/{Index-MJKawRgO.js → Index-Bhge0Ye3.js} +1 -1
  30. package/dist/assets/{Index-BZIytdwE.js → Index-BjUC4Qy2.js} +1 -1
  31. package/dist/assets/{Index-Dy27xVwA.js → Index-BlIY8K2y.js} +1 -1
  32. package/dist/assets/{Index-B1r3Gul3.js → Index-Bp4mYiWT.js} +1 -1
  33. package/dist/assets/{Index-CFxfsEB3.js → Index-Bpv_QguW.js} +1 -1
  34. package/dist/assets/{Index-ip9nThQe.js → Index-BrILi0-c.js} +1 -1
  35. package/dist/assets/{Index-D29WuERC.js → Index-C-wEZgIN.js} +1 -1
  36. package/dist/assets/Index-CBybAWmy.js +1 -0
  37. package/dist/assets/{Index-ByElOcMX.js → Index-CGHYkqjO.js} +1 -1
  38. package/dist/assets/{Index-fb0d5Ij8.js → Index-CMihZ-nT.js} +1 -1
  39. package/dist/assets/{Index-D1kTVn4v.js → Index-CNdFXrFF.js} +1 -1
  40. package/dist/assets/{Index-CUKoS2jG2.js → Index-CVhzkBCU2.js} +1 -1
  41. package/dist/assets/{Index-CzZIKZir.js → Index-CWPkVAGu.js} +1 -1
  42. package/dist/assets/{Index-fCMXDMdR.js → Index-CbuI24qA.js} +1 -1
  43. package/dist/assets/{Index-BSOYkVrY2.js → Index-CyI5B5Iw2.js} +1 -1
  44. package/dist/assets/{Index-cmED8Wf82.js → Index-D2n66vom2.js} +1 -1
  45. package/dist/assets/{Index-DVZYw8Ti.js → Index-D5cJIMqk.js} +1 -1
  46. package/dist/assets/{Index-D1mfppvZ.js → Index-D89ynFEG.js} +1 -1
  47. package/dist/assets/{Index-BWKAgE_L.js → Index-DExxCDca.js} +1 -1
  48. package/dist/assets/{Index-BMvzcOYA.js → Index-DYxSLsTm.js} +1 -1
  49. package/dist/assets/{Index-BbpkGoZb.js → Index-DZ8exWOg.js} +1 -1
  50. package/dist/assets/{Index-C79dNjpN.js → Index-DgR8EjvG.js} +1 -1
  51. package/dist/assets/{Index-BzEW9qOH.js → Index-F5FVH4XA.js} +1 -1
  52. package/dist/assets/{Index-B7ZIhLPz.js → Index-IWedAkVJ.js} +1 -1
  53. package/dist/assets/{Index-DVb4v3oF.js → Index-KWeUZuBG.js} +1 -1
  54. package/dist/assets/{Index-EXzPO3cH.js → Index-KigOtr6Q.js} +1 -1
  55. package/dist/assets/{Index-d0Ax26tm.js → Index-Q9SnXeG5.js} +1 -1
  56. package/dist/assets/{Index-CHjMy5ex2.js → Index-b_bVC-2v2.js} +1 -1
  57. package/dist/assets/{Index-DHDKggl22.js → Index-fAKzMOZY2.js} +1 -1
  58. package/dist/assets/{Invitees-Cjh_HkSH.js → Invitees-t8LjUtox.js} +1 -1
  59. package/dist/assets/{List-pfCsf92F.js → List-BcdTB0xZ.js} +1 -1
  60. package/dist/assets/{List-dw1Xv1Kt.js → List-CiRlLqQi.js} +1 -1
  61. package/dist/assets/{List-Dj0wsQZF.js → List-D0ppoVM_.js} +1 -1
  62. package/dist/assets/{LocalTools-Dz6pS18B.js → LocalTools-8f1nIu1i.js} +1 -1
  63. package/dist/assets/{LocalTools-L1Z9CYWz.js → LocalTools-TuBOV-fy.js} +1 -1
  64. package/dist/assets/{Logo-IS52iyq3.js → Logo-BIQjmFe8.js} +1 -1
  65. package/dist/assets/{Main-CKzyMm5n.js → Main-BM7WSyw6.js} +1 -1
  66. package/dist/assets/{Message-CYvcKMlp.js → Message-CrGhKWMq.js} +2 -2
  67. package/dist/assets/{Model-C2N_nPmj.js → Model-BDoRG1y3.js} +1 -1
  68. package/dist/assets/{Navigator-DbZtnb_p.js → Navigator-Uk0XBf21.js} +3 -3
  69. package/dist/assets/{NotFound-P7fqDiGG.js → NotFound-BxmMuusa.js} +1 -1
  70. package/dist/assets/{PageHeader-SdNvT1p3.js → PageHeader-B7aH63od.js} +1 -1
  71. package/dist/assets/{Pay-CkRLPLzC.js → Pay-a8uYoEfm.js} +1 -1
  72. package/dist/assets/{Player-cWxD5Tss.js → Player-tEjbz8km.js} +1 -1
  73. package/dist/assets/{Poivelle-BnqjulQy.js → Poivelle-D2Pg88fJ.js} +1 -1
  74. package/dist/assets/{RealtimeCall-Bp8EL62t.js → RealtimeCall-Dh_EECLN.js} +1 -1
  75. package/dist/assets/{ReportButton-D7JGzuC6.js → ReportButton-CYa13w8h.js} +1 -1
  76. package/dist/assets/{ReportDialog-DmMuOP3a.js → ReportDialog-BdPWn65b.js} +1 -1
  77. package/dist/assets/{ScheduledTasks-DTSyAEUZ.js → ScheduledTasks-d52JFkP6.js} +1 -1
  78. package/dist/assets/{Status-CSRYA8fU.js → Status-xxs4gXOB.js} +1 -1
  79. package/dist/assets/{Subscribe-Ci1vhdb7.js → Subscribe-DgrTtF4n.js} +1 -1
  80. package/dist/assets/{TabSwitcher-ClLXbedz.js → TabSwitcher-C_N_7W5M.js} +1 -1
  81. package/dist/assets/{Tts-BtFmYfFd.js → Tts-ZE4EzLsJ.js} +1 -1
  82. package/dist/assets/{VideoPlayer-DZajGyHg.js → VideoPlayer-C44SsSWU.js} +1 -1
  83. package/dist/assets/{VideoPreview-yy9EIf_l.js → VideoPreview-D2JHTDU8.js} +1 -1
  84. package/dist/assets/arrow-down-DfZZ6O9V.js +1 -0
  85. package/dist/assets/{arrow-down-wide-narrow-Bh9l3U0_.js → arrow-down-wide-narrow-CXsartjU.js} +1 -1
  86. package/dist/assets/arrow-left-uQ2QSI6E.js +1 -0
  87. package/dist/assets/arrow-right-DLK8H_c3.js +1 -0
  88. package/dist/assets/arrow-up-CySfbL5G.js +1 -0
  89. package/dist/assets/{authorizeFlow-B9aZMxfA.js → authorizeFlow-qoRgSMcK.js} +1 -1
  90. package/dist/assets/{avatar-D8dj7T0j.js → avatar-B9amXRqx.js} +1 -1
  91. package/dist/assets/{basic-BRAq7Qs_.js → basic-POh0fuWQ.js} +1 -1
  92. package/dist/assets/{book-open-Bgt2CzJP.js → book-open-DJntghzP.js} +1 -1
  93. package/dist/assets/{box-K1AOg2Dt.js → box-BgafcOxN.js} +1 -1
  94. package/dist/assets/{boxes-nkCCYn_H.js → boxes-BxwF-h52.js} +1 -1
  95. package/dist/assets/{brain-OfFe2iNh.js → brain-DRAL5UnC.js} +1 -1
  96. package/dist/assets/{chart-no-axes-combined-NmmizHnk.js → chart-no-axes-combined-C2XBdAJR.js} +1 -1
  97. package/dist/assets/{chat-fmefJyfA.js → chat-C-QhdNDG.js} +1 -1
  98. package/dist/assets/check-C1SSXE37.js +1 -0
  99. package/dist/assets/chevron-down-D54yUG_W.js +1 -0
  100. package/dist/assets/chevron-right-kcQrk7a4.js +1 -0
  101. package/dist/assets/circle-check-B7M0eLJf.js +1 -0
  102. package/dist/assets/{circle-question-mark-J5LrgC7z.js → circle-question-mark-CkrnC9TN.js} +1 -1
  103. package/dist/assets/{clipboard-list-D6rxrE8d.js → clipboard-list-BQu_m5lA.js} +1 -1
  104. package/dist/assets/clock-DcgPnVJa.js +1 -0
  105. package/dist/assets/code-Cx-HLyjl.js +1 -0
  106. package/dist/assets/{codingBridge-CWXTjgaq.js → codingBridge-5Younw34.js} +2 -2
  107. package/dist/assets/{codingBridgeNotify-CNQGGqEk.js → codingBridgeNotify-dNV0kJQ8.js} +2 -2
  108. package/dist/assets/{coins-CA8lophH.js → coins-gBDFWv_r.js} +1 -1
  109. package/dist/assets/{collapse-LIyzteME.js → collapse-B_99IkFQ.js} +1 -1
  110. package/dist/assets/{constants-CQR8cCBL.js → constants-C44cV5UH.js} +1 -1
  111. package/dist/assets/{copy-B489PY7H.js → copy-DpODTAxb.js} +1 -1
  112. package/dist/assets/{createTaskActions-hQu69zYP.js → createTaskActions-bHjJf96C.js} +1 -1
  113. package/dist/assets/{digitalhuman-C-m4TlWk.js → digitalhuman-DgSMt73W.js} +1 -1
  114. package/dist/assets/{dollar-sign-d8zK5thl.js → dollar-sign-BGeaa3gL.js} +1 -1
  115. package/dist/assets/{download-CoMPboZJ.js → download-CZLXh4-2.js} +1 -1
  116. package/dist/assets/{drawer-BMRGHI-3.js → drawer-CL63mgQu.js} +1 -1
  117. package/dist/assets/{dropdown-DzzmAJqH.js → dropdown-B8Z-l-iE.js} +1 -1
  118. package/dist/assets/{dropdown-fFM8TrPr.js → dropdown-kUTe8e-9.js} +1 -1
  119. package/dist/assets/{ellipsis-Cxuin38H.js → ellipsis-Du3lY52z.js} +1 -1
  120. package/dist/assets/esm-B1tUH8kr.js +1 -0
  121. package/dist/assets/{esm-DWKsBcY1.js → esm-BGOjVEnk.js} +3 -3
  122. package/dist/assets/{esm-DlTz8W4O.js → esm-DHZANs_t.js} +2 -2
  123. package/dist/assets/{esm-xG4UB0yZ.js → esm-DOo7uPDb.js} +2 -2
  124. package/dist/assets/{esm-DtlST3qG.js → esm-DTElW73d.js} +1 -1
  125. package/dist/assets/{esm-BDC0wUT8.js → esm-aYaknvQ1.js} +1 -1
  126. package/dist/assets/{esm-E98t4dD8.js → esm-j1DgBTjx.js} +1 -1
  127. package/dist/assets/{external-link-CgEa7yis.js → external-link-dZgWEqL4.js} +1 -1
  128. package/dist/assets/{eye-C4SyrpXf.js → eye-DFp2jfce.js} +1 -1
  129. package/dist/assets/{file-BNfEG5IF.js → file-DvOzOx_P.js} +1 -1
  130. package/dist/assets/{file-output-DNvvFeOx.js → file-output-19dlKJBf.js} +1 -1
  131. package/dist/assets/{file-text--Qjz57wL.js → file-text-mDCcsztI.js} +1 -1
  132. package/dist/assets/{fish-BhaYIY2P.js → fish-D60Al1yj.js} +1 -1
  133. package/dist/assets/{flux-SeBD2b5R.js → flux-d_SeQnk9.js} +1 -1
  134. package/dist/assets/{folder-DcItLXw1.js → folder-DbyunSbX.js} +1 -1
  135. package/dist/assets/gauge-CdYwce4s.js +1 -0
  136. package/dist/assets/{globe-DcRbETD-.js → globe-BhHHcHQD.js} +1 -1
  137. package/dist/assets/{grokvideo-CwVElxKX.js → grokvideo-S1pCi5Tr.js} +1 -1
  138. package/dist/assets/{hailuo-maOTnYd1.js → hailuo-M_qwVpNw.js} +1 -1
  139. package/dist/assets/{headphones-DCnnsYrD.js → headphones-Dr9_CJTJ.js} +1 -1
  140. package/dist/assets/{history-5dWDE2j4.js → history-CCILjiNN.js} +1 -1
  141. package/dist/assets/{house-BIolUNvl.js → house-BTwHBckD.js} +1 -1
  142. package/dist/assets/{i18n-D69rWLe_.js → i18n-Cqi3MO17.js} +1 -1
  143. package/dist/assets/{image-l7GEfh5m.js → image-ltLE0_B2.js} +1 -1
  144. package/dist/assets/{index-DIgS5Gvp.js → index-CREYJmGZ.js} +6 -6
  145. package/dist/assets/{index.browser.esm-BglHW4F-.js → index.browser.esm-NRFegStZ.js} +1 -1
  146. package/dist/assets/{index.es-Ci-Vjlrb.js → index.es-Dp5oaXS7.js} +1 -1
  147. package/dist/assets/{info-C40CnPeL.js → info-B6zz-sKo.js} +1 -1
  148. package/dist/assets/{input-number-ByXVBT4t.js → input-number-u0MGro2n.js} +1 -1
  149. package/dist/assets/intro-2CIeLa4V.js +1 -0
  150. package/dist/assets/intro-BQHGX5HW.js +1 -0
  151. package/dist/assets/intro-BTSbJEHO.js +1 -0
  152. package/dist/assets/intro-BuaD45ZB.js +1 -0
  153. package/dist/assets/intro-CVqOAs0d.js +1 -0
  154. package/dist/assets/intro-CX-tVM1n.js +1 -0
  155. package/dist/assets/intro-CumGy2RC.js +1 -0
  156. package/dist/assets/intro-D26BGrp9.js +1 -0
  157. package/dist/assets/intro-D7SWXPm3.js +1 -0
  158. package/dist/assets/intro-DFfBLUfo.js +1 -0
  159. package/dist/assets/intro-Dq8aF71M.js +1 -0
  160. package/dist/assets/intro-HirJwSQO.js +1 -0
  161. package/dist/assets/intro-JkrATbbK.js +1 -0
  162. package/dist/assets/intro-Y10dLinG.js +1 -0
  163. package/dist/assets/intro-Z5WuhH2a.js +1 -0
  164. package/dist/assets/intro-bo9fZbK4.js +1 -0
  165. package/dist/assets/intro-msK-p0lY.js +1 -0
  166. package/dist/assets/intro-zxCwJqFb.js +1 -0
  167. package/dist/assets/{key-round-D4yW8b4H.js → key-round-CgK5ul3S.js} +1 -1
  168. package/dist/assets/{kling-BBObHQ4y.js → kling-DdPnVX2L.js} +1 -1
  169. package/dist/assets/{languages-DPAWujhs.js → languages-CVKa6GSx.js} +1 -1
  170. package/dist/assets/{laptop-CkMMUQQ5.js → laptop-C1UtQchD.js} +1 -1
  171. package/dist/assets/{lightbulb-BYkyNQBq.js → lightbulb-DMMH-itQ.js} +1 -1
  172. package/dist/assets/{link-DKCPP9JK.js → link-Ck182LqI.js} +1 -1
  173. package/dist/assets/loader-circle-BJdKG6dp.js +1 -0
  174. package/dist/assets/{lock-D-SCAKKf.js → lock-DGLRMLsk.js} +1 -1
  175. package/dist/assets/{luma-CWo2eJhn.js → luma-D08kYXX2.js} +1 -1
  176. package/dist/assets/{maestro-D6pCMVdC.js → maestro-BSTyCJsV.js} +1 -1
  177. package/dist/assets/{maestro-Dk0xw1uy.js → maestro-wC6egBQw.js} +1 -1
  178. package/dist/assets/{mail-DsWU4MNx.js → mail-Dte9tFt2.js} +1 -1
  179. package/dist/assets/{message-circle-PQt0Q2mh.js → message-circle-DWzinnDO.js} +1 -1
  180. package/dist/assets/{mic-CrSotd0p.js → mic-Dow6VrJE.js} +1 -1
  181. package/dist/assets/{midjourney-w3B_dqpl.js → midjourney-BPtltduI.js} +1 -1
  182. package/dist/assets/{mobileLocalExec-CN1GlgN2.js → mobileLocalExec-DaDhbwJt.js} +2 -2
  183. package/dist/assets/{models-CwEjR6Nf.js → models-DcpkDkjF.js} +1 -1
  184. package/dist/assets/{monitor-BHx1oad3.js → monitor-DkCq84E2.js} +1 -1
  185. package/dist/assets/{mouse-pointer-2-BSu7sguX.js → mouse-pointer-2-9VJBV_22.js} +1 -1
  186. package/dist/assets/music-2-iJ0GWVrl.js +1 -0
  187. package/dist/assets/{nanobanana-CtkE9yDF.js → nanobanana-CYmgToNy.js} +1 -1
  188. package/dist/assets/{omni-DXnPbKHE.js → omni-CldP_ZwX.js} +1 -1
  189. package/dist/assets/{openaiimage-6vtOuJFv.js → openaiimage-d3GjQIMh.js} +1 -1
  190. package/dist/assets/{pagination-CebMKB63.js → pagination-BbFTEjBg.js} +1 -1
  191. package/dist/assets/{pagination-CP5QlGv2.js → pagination-IckkXpUO.js} +1 -1
  192. package/dist/assets/{pagination-BNPMPfyr.js → pagination-uq23xZEg.js} +1 -1
  193. package/dist/assets/{palette-DGHTNrTx.js → palette-D_hzvJDa.js} +1 -1
  194. package/dist/assets/{paperclip-D7VNr9Qq.js → paperclip-BYNr5XFL.js} +1 -1
  195. package/dist/assets/{pause-Ck2Rq3YJ.js → pause-BWpPJP_R.js} +1 -1
  196. package/dist/assets/{pencil-Djn9Hc9z.js → pencil-BhwkvOrn.js} +1 -1
  197. package/dist/assets/{pika-HczyW99B.js → pika-CLJeCDA-.js} +1 -1
  198. package/dist/assets/{pixverse-b652Co6y.js → pixverse-CmbNyRQT.js} +1 -1
  199. package/dist/assets/play-CJx7xQc1.js +1 -0
  200. package/dist/assets/{plug-B6e7XxKm.js → plug-Bm5lTQdF.js} +1 -1
  201. package/dist/assets/plus--lrUTaV9.js +1 -0
  202. package/dist/assets/{poivelle-BkvmnyzU.js → poivelle-BCa_2ckb.js} +1 -1
  203. package/dist/assets/{popover-Br-sCBHH.js → popover-s9P5QTaN.js} +1 -1
  204. package/dist/assets/{producer-D0wRhvwS.js → producer-CJpFQFtR.js} +1 -1
  205. package/dist/assets/{qrart-BrgI_rXw.js → qrart-j4X6G25p.js} +1 -1
  206. package/dist/assets/{realtime-mVqPss9r.js → realtime-DGslBgjF.js} +1 -1
  207. package/dist/assets/{refresh-cw-DqyQYIrN.js → refresh-cw-DsZHH-ne.js} +1 -1
  208. package/dist/assets/rotate-ccw-CwG8Tr4q.js +1 -0
  209. package/dist/assets/rotate-cw-is7J0f7E.js +1 -0
  210. package/dist/assets/{row-Cbv7FLTy.js → row-DQqpuvYH.js} +1 -1
  211. package/dist/assets/search-B-v-GhMv.js +1 -0
  212. package/dist/assets/{seedance-K37GcyFq.js → seedance-DyH2BqTs.js} +1 -1
  213. package/dist/assets/{seedream-DHdTsMrg.js → seedream-LGwBa99t.js} +1 -1
  214. package/dist/assets/{select-CUw_YhcY.js → select-jRFQ1Hzk.js} +1 -1
  215. package/dist/assets/{serp-b5iBdcvx.js → serp-BdAsrKwn.js} +1 -1
  216. package/dist/assets/{shield-CzPrLCPw.js → shield-41WYVrpG.js} +1 -1
  217. package/dist/assets/{shuffle-DI8PXiNu.js → shuffle-bmih4UqZ.js} +1 -1
  218. package/dist/assets/{slider-508i2Vb5.js → slider-B_xhGTdh.js} +1 -1
  219. package/dist/assets/{solana-wallets-DLq6-GrY.js → solana-wallets-DYmoNImk.js} +2 -2
  220. package/dist/assets/{solana-wallets-vue-Crh7p7UD.js → solana-wallets-vue-B5OBaahJ.js} +1 -1
  221. package/dist/assets/{sora-D5EIXmmO.js → sora-o-5xigw-.js} +1 -1
  222. package/dist/assets/{sparkles-BFNqXTZL.js → sparkles-BIuDjfQg.js} +1 -1
  223. package/dist/assets/square-OXtSEmlD.js +1 -0
  224. package/dist/assets/{store-BaH2jfBX.js → store-Co9jwnq8.js} +1 -1
  225. package/dist/assets/{suno-BuLDW1Vh.js → suno-FRCRn1YL.js} +1 -1
  226. package/dist/assets/{switch-BHE5VSJC.js → switch-CP09CWeK.js} +1 -1
  227. package/dist/assets/{table-C42opMok.js → table-Cg2N5b5E.js} +1 -1
  228. package/dist/assets/{tabs-BFs4t-aK.js → tabs-DsmI05G2.js} +1 -1
  229. package/dist/assets/{tag-CScqQXGX.js → tag-YwN0l1gW.js} +1 -1
  230. package/dist/assets/terminal-D9ZMN0k5.js +1 -0
  231. package/dist/assets/{time-picker-CEYuPPVi.js → time-picker-BqcqHMtN.js} +1 -1
  232. package/dist/assets/{tooltip-xGYGkgTR.js → tooltip-bfg-03mE.js} +1 -1
  233. package/dist/assets/{trash-2-xb-Jm4i0.js → trash-2-CDz5PwCk.js} +1 -1
  234. package/dist/assets/{triangle-alert-COLtfogn.js → triangle-alert-Z8DwGNFK.js} +1 -1
  235. package/dist/assets/{upload-Bu37nR-5.js → upload-CYgk_oSr.js} +1 -1
  236. package/dist/assets/{upload-CI1ZP51F.js → upload-DerPm8IS.js} +1 -1
  237. package/dist/assets/user-C8SZiVQC.js +1 -0
  238. package/dist/assets/{veo-Bl64NYd7.js → veo-DUuufx00.js} +1 -1
  239. package/dist/assets/{video-CYTJ80IP.js → video-Brn0_a8G.js} +1 -1
  240. package/dist/assets/{volume-2-Cd9jV3NX.js → volume-2-ovELC7ze.js} +1 -1
  241. package/dist/assets/{wallet-g88KrNyB.js → wallet-9ymkHmqV.js} +1 -1
  242. package/dist/assets/{wan-a4X7kt1x.js → wan-Bw9kZwn9.js} +1 -1
  243. package/dist/assets/{wand-sparkles-DDyMsIR4.js → wand-sparkles-yU_7R4u-.js} +1 -1
  244. package/dist/assets/{web-BK1giVaU.js → web-BHLJMImD.js} +1 -1
  245. package/dist/assets/{web-Bk36mANR.js → web-BoThAuaz.js} +1 -1
  246. package/dist/assets/{web-BrXDDpbD.js → web-BzrH1Vlj.js} +1 -1
  247. package/dist/assets/{web-BSXd6Enl.js → web-Dc_YylFI.js} +1 -1
  248. package/dist/assets/{web-CN5hmZ5J.js → web-Dgy8v0wC.js} +1 -1
  249. package/dist/assets/{webextrator-J-SZn-nF.js → webextrator-D-jr1MFk.js} +1 -1
  250. package/dist/assets/{zap-UpSN-PKO.js → zap-C0PdDJso.js} +1 -1
  251. package/dist/index.html +4 -4
  252. package/package.json +1 -1
  253. package/dist/assets/Index-DNp3_EIy.js +0 -1
  254. package/dist/assets/Index-Dt0MGZVR.css +0 -1
  255. package/dist/assets/arrow-down-D1ze7Zz7.js +0 -1
  256. package/dist/assets/arrow-left-i-SsgbVR.js +0 -1
  257. package/dist/assets/arrow-right-HPaEW4ct.js +0 -1
  258. package/dist/assets/arrow-up-DPsaJu0u.js +0 -1
  259. package/dist/assets/check-D7wYAXxh.js +0 -1
  260. package/dist/assets/chevron-down-7kJMC2ch.js +0 -1
  261. package/dist/assets/chevron-right-BaNlttpH.js +0 -1
  262. package/dist/assets/circle-check-BlfTJ16z.js +0 -1
  263. package/dist/assets/clock-CS3ZX4nf.js +0 -1
  264. package/dist/assets/code-C18Pb5Rt.js +0 -1
  265. package/dist/assets/esm-BL-lS1AO.js +0 -1
  266. package/dist/assets/gauge-DMrbDCVd.js +0 -1
  267. package/dist/assets/intro-7jC51zyA.js +0 -1
  268. package/dist/assets/intro-B4j8G6Wn.js +0 -1
  269. package/dist/assets/intro-B7ZR6MnR.js +0 -1
  270. package/dist/assets/intro-B_1eX0NN.js +0 -1
  271. package/dist/assets/intro-Bcw1QD06.js +0 -1
  272. package/dist/assets/intro-C9lKNVJp.js +0 -1
  273. package/dist/assets/intro-CIqtCCxn.js +0 -1
  274. package/dist/assets/intro-CSc4mVpE.js +0 -1
  275. package/dist/assets/intro-CuHGodEn.js +0 -1
  276. package/dist/assets/intro-CzRUcQTo.js +0 -1
  277. package/dist/assets/intro-D-bQZq5n.js +0 -1
  278. package/dist/assets/intro-D3xF3uFy.js +0 -1
  279. package/dist/assets/intro-DhjBVTet.js +0 -1
  280. package/dist/assets/intro-SJ6J3iZY.js +0 -1
  281. package/dist/assets/intro-eclZL9RF.js +0 -1
  282. package/dist/assets/intro-mc9fOYHH.js +0 -1
  283. package/dist/assets/intro-mnSZn8oq.js +0 -1
  284. package/dist/assets/intro-tDJyt_-M.js +0 -1
  285. package/dist/assets/loader-circle-DC7tP4px.js +0 -1
  286. package/dist/assets/music-2-C2YDBG9V.js +0 -1
  287. package/dist/assets/play-DFR_GqpJ.js +0 -1
  288. package/dist/assets/plus-lIyMOEZf.js +0 -1
  289. package/dist/assets/rotate-ccw-D9mZ9lfD.js +0 -1
  290. package/dist/assets/rotate-cw-CwiEEFRc.js +0 -1
  291. package/dist/assets/search-iterppMr.js +0 -1
  292. package/dist/assets/square-Bl9we4gC.js +0 -1
  293. package/dist/assets/terminal-BlBAbz4X.js +0 -1
  294. package/dist/assets/user-DV5LrGq4.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-CUw_YhcY.js";import{n as k,t as A}from"./table-C42opMok.js";import{n as j,t as M}from"./tabs-BFs4t-aK.js";import{a as N,i as P,p as F,v as I}from"./models-CwEjR6Nf.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-DNvvFeOx.js";import{n as H,t as U}from"./row-Cbv7FLTy.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-BHE5VSJC.js";import{t as ie}from"./boxes-nkCCYn_H.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-DIgS5Gvp.js";import{t as ue}from"./CopyToClipboard-BoetcLMP.js";import{t as de}from"./pagination-BNPMPfyr.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-jRFQ1Hzk.js";import{n as k,t as A}from"./table-Cg2N5b5E.js";import{n as j,t as M}from"./tabs-DsmI05G2.js";import{a as N,i as P,p as F,v as I}from"./models-DcpkDkjF.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-19dlKJBf.js";import{n as H,t as U}from"./row-DQqpuvYH.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-CP09CWeK.js";import{t as ie}from"./boxes-BxwF-h52.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-CREYJmGZ.js";import{t as ue}from"./CopyToClipboard-CLVp5I29.js";import{t as de}from"./pagination-uq23xZEg.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,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-CUw_YhcY.js";import{n as ee,t as g}from"./table-C42opMok.js";import{o as _}from"./models-CwEjR6Nf.js";import{t as v}from"./card-IQwqnRJR.js";import{n as y,t as b}from"./file-output-DNvvFeOx.js";import{n as x,t as S}from"./row-Cbv7FLTy.js";import{t as C}from"./skeleton-Dj_a_iIP.js";import{t as w}from"./circle-check-BlfTJ16z.js";import{t as T}from"./clock-CS3ZX4nf.js";import{t as E}from"./dollar-sign-d8zK5thl.js";import{Fi as D,Ni as O,O as k,an as A,bi as j,mr as M}from"./index-DIgS5Gvp.js";import{t as N}from"./CopyToClipboard-BoetcLMP.js";import{t as P}from"./pagination-BNPMPfyr.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-jRFQ1Hzk.js";import{n as ee,t as g}from"./table-Cg2N5b5E.js";import{o as _}from"./models-DcpkDkjF.js";import{t as v}from"./card-IQwqnRJR.js";import{n as y,t as b}from"./file-output-19dlKJBf.js";import{n as x,t as S}from"./row-DQqpuvYH.js";import{t as C}from"./skeleton-Dj_a_iIP.js";import{t as w}from"./circle-check-B7M0eLJf.js";import{t as T}from"./clock-DcgPnVJa.js";import{t as E}from"./dollar-sign-BGeaa3gL.js";import{Fi as D,Ni as O,O as k,an as A,bi as j,mr as M}from"./index-CREYJmGZ.js";import{t as N}from"./CopyToClipboard-CLVp5I29.js";import{t as P}from"./pagination-uq23xZEg.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"./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-C42opMok.js";import{a as g,f as _,i as v,p as y,v as b}from"./models-CwEjR6Nf.js";import{t as x}from"./card-IQwqnRJR.js";import{n as S,t as C}from"./row-Cbv7FLTy.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-BHE5VSJC.js";import{t as D}from"./boxes-nkCCYn_H.js";import{t as O}from"./chart-no-axes-combined-NmmizHnk.js";import{t as k}from"./coins-CA8lophH.js";import{t as A}from"./wallet-g88KrNyB.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-DIgS5Gvp.js";import{t as z}from"./CopyToClipboard-BoetcLMP.js";import{t as B}from"./pagination-BNPMPfyr.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-Cg2N5b5E.js";import{a as g,f as _,i as v,p as y,v as b}from"./models-DcpkDkjF.js";import{t as x}from"./card-IQwqnRJR.js";import{n as S,t as C}from"./row-DQqpuvYH.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-CP09CWeK.js";import{t as D}from"./boxes-BxwF-h52.js";import{t as O}from"./chart-no-axes-combined-C2XBdAJR.js";import{t as k}from"./coins-gBDFWv_r.js";import{t as A}from"./wallet-9ymkHmqV.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-CREYJmGZ.js";import{t as z}from"./CopyToClipboard-CLVp5I29.js";import{t as B}from"./pagination-uq23xZEg.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,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-BHE5VSJC.js";import{t as ee}from"./file-BNfEG5IF.js";import{t as g}from"./folder-DcItLXw1.js";import{t as _}from"./mouse-pointer-2-BSu7sguX.js";import{t as v}from"./pencil-Djn9Hc9z.js";import{t as y}from"./plus-lIyMOEZf.js";import{t as b}from"./shield-CzPrLCPw.js";import{t as x}from"./terminal-BlBAbz4X.js";import{t as S}from"./wand-sparkles-DDyMsIR4.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-DIgS5Gvp.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-CP09CWeK.js";import{t as ee}from"./file-DvOzOx_P.js";import{t as g}from"./folder-DbyunSbX.js";import{t as _}from"./mouse-pointer-2-9VJBV_22.js";import{t as v}from"./pencil-BhwkvOrn.js";import{t as y}from"./plus--lrUTaV9.js";import{t as b}from"./shield-41WYVrpG.js";import{t as x}from"./terminal-D9ZMN0k5.js";import{t as S}from"./wand-sparkles-yU_7R4u-.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-CREYJmGZ.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,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-Dz6pS18B.js";import{O as c}from"./index-DIgS5Gvp.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-8f1nIu1i.js";import{O as c}from"./index-CREYJmGZ.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 +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,vn as o}from"./index-DIgS5Gvp.js";var s=`/assets/acedata-mark-l2r40Kh8.png`,c=`/assets/acedata-wordmark-mask-BIn-5zkq.png`,l=i({props:{collapsed:{type:Boolean,default:!1}},emits:[`click`],data(){return{logoMark:s}},computed:{siteTitle(){return this.$store.state.site?.title||`AceData`},tenantLogo(){if(o())return``;let e=this.$store.state.site,t=`https://platform.acedata.cloud/favicon.ico`;return this.collapsed?e?.favicon||e?.logo||t:e?.logo||e?.favicon||t},wordmarkStyle(){return{"--logo-wordmark-mask":`url(${c})`}}}}),u=[`aria-label`],d=[`src`,`alt`],f=[`src`],p={key:2,class:`brand-logo__wordmark`},m={class:`brand-logo__wordmark-inner`},h=[`src`];function g(i,a,o,s,c,l){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,d)):i.collapsed?(r(),t(`img`,{key:1,src:i.logoMark,class:`brand-logo__mark`,alt:``,"aria-hidden":`true`},null,8,f)):(r(),t(`span`,p,[e(`span`,m,[e(`img`,{src:i.logoMark,class:`brand-logo__wordmark-mark`,alt:``,"aria-hidden":`true`},null,8,h),e(`span`,{class:`brand-logo__wordmark-text`,style:n(i.wordmarkStyle),"aria-hidden":`true`},null,4)])]))],8,u)}var _=a(l,[[`render`,g],[`__scopeId`,`data-v-592566e2`]]);export{_ 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,vn as o}from"./index-CREYJmGZ.js";var s=`/assets/acedata-mark-l2r40Kh8.png`,c=`/assets/acedata-wordmark-mask-BIn-5zkq.png`,l=i({props:{collapsed:{type:Boolean,default:!1}},emits:[`click`],data(){return{logoMark:s}},computed:{siteTitle(){return this.$store.state.site?.title||`AceData`},tenantLogo(){if(o())return``;let e=this.$store.state.site,t=`https://platform.acedata.cloud/favicon.ico`;return this.collapsed?e?.favicon||e?.logo||t:e?.logo||e?.favicon||t},wordmarkStyle(){return{"--logo-wordmark-mask":`url(${c})`}}}}),u=[`aria-label`],d=[`src`,`alt`],f=[`src`],p={key:2,class:`brand-logo__wordmark`},m={class:`brand-logo__wordmark-inner`},h=[`src`];function g(i,a,o,s,c,l){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,d)):i.collapsed?(r(),t(`img`,{key:1,src:i.logoMark,class:`brand-logo__mark`,alt:``,"aria-hidden":`true`},null,8,f)):(r(),t(`span`,p,[e(`span`,m,[e(`img`,{src:i.logoMark,class:`brand-logo__wordmark-mark`,alt:``,"aria-hidden":`true`},null,8,h),e(`span`,{class:`brand-logo__wordmark-text`,style:n(i.wordmarkStyle),"aria-hidden":`true`},null,4)])]))],8,u)}var _=a(l,[[`render`,g],[`__scopeId`,`data-v-592566e2`]]);export{_ 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-CwEjR6Nf.js";import{t as g}from"./Navigator-DbZtnb_p.js";import{t as _}from"./checkbox-DXMDpaxv.js";import{t as v}from"./divider-Du_3kymg.js";import"./constants-CQR8cCBL.js";import{Ei as y,Fi as b,O as x,Tr as S,rn as C,si as w}from"./index-DIgS5Gvp.js";import{t as T}from"./Status-CSRYA8fU.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-DcpkDkjF.js";import{t as g}from"./Navigator-Uk0XBf21.js";import{t as _}from"./checkbox-DXMDpaxv.js";import{t as v}from"./divider-Du_3kymg.js";import"./constants-C44cV5UH.js";import{Ei as y,Fi as b,O as x,Tr as S,rn as C,si as w}from"./index-CREYJmGZ.js";import{t as T}from"./Status-xxs4gXOB.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};