@acedatacloud/nexior 3.349.2 → 3.350.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ApiCodeButton-Ck-LkZnA.js → ApiCodeButton-nUA4iGNl.js} +1 -1
- package/dist/assets/{Artifacts-BgIY0V5w.js → Artifacts-BNpkmRJH.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-BHIzmvpA.js → AskUserQuestionCard-CWgKrRpn.js} +1 -1
- package/dist/assets/{AudioPreview-B-vGM5ZE.js → AudioPreview-XDhwGk3A.js} +1 -1
- package/dist/assets/{Auth-BSB5j2IR.js → Auth-v6axG8lj.js} +1 -1
- package/dist/assets/{Bare-CGpzlaiP.js → Bare-g2VQEcBP.js} +1 -1
- package/dist/assets/{BotPlaceholder-SAI3U7Vk.js → BotPlaceholder-DQbI2r9r.js} +1 -1
- package/dist/assets/{BottomFooter-BPu8gJnO.js → BottomFooter-C_dyyPiZ.js} +1 -1
- package/dist/assets/{Callback-DI7I7e9o.js → Callback-BdIYD9BC.js} +1 -1
- package/dist/assets/{CodeSnippet-nfL3VN6b.js → CodeSnippet-kiHj1cis.js} +1 -1
- package/dist/assets/{Console-C1p-WtRP.js → Console-CiOsc7Rr.js} +1 -1
- package/dist/assets/{Consumption-JN0X0f8c.js → Consumption-CJEO0Oqt.js} +1 -1
- package/dist/assets/{Conversation-C2YzpBK3.js → Conversation-BGie9_l2.js} +1 -1
- package/dist/assets/{Conversation-C348UZiO.js → Conversation-BtDPU_pU.js} +1 -1
- package/dist/assets/{CopyToClipboard-DOx2-KTG.js → CopyToClipboard-DPVMD9O4.js} +1 -1
- package/dist/assets/{Detail-MUwXxjGI.js → Detail-D4rxpWwt.js} +2 -2
- package/dist/assets/{Extra-DefQxg0y.js → Extra-ojB-cRvO.js} +1 -1
- package/dist/assets/{FilePreview-CibPHhpy.js → FilePreview-BxmED-xP.js} +1 -1
- package/dist/assets/{Hailuo-CE5R8cCt.js → Hailuo-BiU_khhZ.js} +1 -1
- package/dist/assets/{History-CQt5uXkC.js → History-DNPkD8is.js} +1 -1
- package/dist/assets/{ImagePreview-CSSReHgL.js → ImagePreview-3Js4rEnR.js} +1 -1
- package/dist/assets/{ImageWrapper-DkF7PVGL.js → ImageWrapper-DV-01ruL.js} +1 -1
- package/dist/assets/{Index-B5TInMYN.js → Index-7a5TStnA.js} +1 -1
- package/dist/assets/{Index-BIEqYgeq.js → Index-B3KGfGU3.js} +1 -1
- package/dist/assets/{Index-C82TTXNf.js → Index-B6rdwKWw.js} +1 -1
- package/dist/assets/{Index-G-IlVG_I.js → Index-B9-sIplU.js} +1 -1
- package/dist/assets/{Index-BDnHLDfB2.js → Index-B90zsIkd2.js} +1 -1
- package/dist/assets/{Index-i5okuoPn.js → Index-BK1Aqubx.js} +1 -1
- package/dist/assets/{Index-CCfbH63M.js → Index-BQvyO9gR.js} +1 -1
- package/dist/assets/{Index-DNo4I4BL.js → Index-BeE6Bnt2.js} +1 -1
- package/dist/assets/{Index-DxD497tW.js → Index-Beul2qdK.js} +1 -1
- package/dist/assets/{Index-FNMBrHbM.js → Index-BgGoihXp.js} +1 -1
- package/dist/assets/{Index-BmXYmlZt.js → Index-BljxBpY1.js} +1 -1
- package/dist/assets/{Index-Bo9HAK0V.js → Index-Bn2XRx9Z.js} +1 -1
- package/dist/assets/{Index-DZx0iwsI.js → Index-BvqoqesT.js} +1 -1
- package/dist/assets/{Index-DYteu8It2.js → Index-Bz_PxRFe2.js} +1 -1
- package/dist/assets/{Index-ByI27Xqj.js → Index-CAcF77mU.js} +1 -1
- package/dist/assets/{Index-iKaft8ke.js → Index-CGvrT5tM.js} +1 -1
- package/dist/assets/{Index-Cg-dC_Jb.js → Index-CM1gLJAo.js} +1 -1
- package/dist/assets/{Index-wD6dVDos.js → Index-CV6m41if.js} +1 -1
- package/dist/assets/{Index-BxkXq-kP.js → Index-CjQ6bXz9.js} +1 -1
- package/dist/assets/{Index-DpbjqT2k.js → Index-CtXCoGJv.js} +1 -1
- package/dist/assets/{Index-CBRHBLT-.js → Index-Cv3SfbmG.js} +1 -1
- package/dist/assets/{Index-DfVd1UkS.js → Index-CvSm-INl.js} +1 -1
- package/dist/assets/{Index-B7vEEPhg.js → Index-CyvZsUHZ.js} +1 -1
- package/dist/assets/{Index-Do3syugm.js → Index-DJ-t9DOm.js} +1 -1
- package/dist/assets/{Index-B_o8lp612.js → Index-DZJDbfiH2.js} +1 -1
- package/dist/assets/{Index-CETeiJqR.js → Index-Dc44H2u6.js} +1 -1
- package/dist/assets/{Index-NTeyVOvk2.js → Index-IJTL4RQc2.js} +1 -1
- package/dist/assets/{Index-Cr4TQ-xE.js → Index-W1u-ZLDF.js} +1 -1
- package/dist/assets/{Index-DaXmhISA.js → Index-_ZKyljVJ.js} +1 -1
- package/dist/assets/{Index-q8_pYIR6.js → Index-hW9V8rau.js} +1 -1
- package/dist/assets/{Index-FQ4q5-hl.js → Index-nLGQEQ_Y.js} +1 -1
- package/dist/assets/{Index-DDUzpZ0O.js → Index-tnwTr93h.js} +1 -1
- package/dist/assets/{Invitees-DS4bwsvn.js → Invitees-CPz5stX-.js} +1 -1
- package/dist/assets/{List-C9Z8Wip0.js → List-37R-TEQg.js} +1 -1
- package/dist/assets/{List-Bpu2Pidt.js → List-DytbTxOZ.js} +1 -1
- package/dist/assets/{List-DAeJuNL1.js → List-qW5Kya5D.js} +1 -1
- package/dist/assets/{LocalTools-CHjjKZLq.js → LocalTools-D-1MGMXO.js} +1 -1
- package/dist/assets/{LocalTools-CDaNo5_1.js → LocalTools-YQiSD3B2.js} +1 -1
- package/dist/assets/{Logo-DdeUQOfD.js → Logo-CCiNBtgs.js} +1 -1
- package/dist/assets/{Main-DwWx37vb.js → Main-DOASARfc.js} +1 -1
- package/dist/assets/{Message-HtQyFDWX.js → Message-CTs5YRgy.js} +1 -1
- package/dist/assets/{Model-BVtu2MqI.js → Model-DiWutwCe.js} +1 -1
- package/dist/assets/{Navigator-D4znkCq3.js → Navigator-Cf9dv3dJ.js} +3 -3
- package/dist/assets/{NotFound-DUFo-kbQ.js → NotFound-D-PhrwZ3.js} +1 -1
- package/dist/assets/{Pay-BGp7Pc6d.js → Pay-_viNfD3j.js} +1 -1
- package/dist/assets/{Player-DPDc2wPX.js → Player-BHrJ0Eem.js} +1 -1
- package/dist/assets/{Poivelle-DYy7nBfz.js → Poivelle-V4O1ww6G.js} +1 -1
- package/dist/assets/{PromptTextarea-O8KxwMGn.js → PromptTextarea-CjqyhQn4.js} +1 -1
- package/dist/assets/{RealtimeCall-BamozLji.js → RealtimeCall-DZoZmAnB.js} +1 -1
- package/dist/assets/{ScheduledTasks-DawIJs2a.js → ScheduledTasks-f43gX3LL.js} +1 -1
- package/dist/assets/{Status-DIFSbgzO.js → Status-SQ6bR-7G.js} +1 -1
- package/dist/assets/{Subscribe-DBMALSdv.js → Subscribe-CSI2XvDZ.js} +1 -1
- package/dist/assets/{TabSwitcher-BtIo_WJk.js → TabSwitcher-BXqr52YP.js} +1 -1
- package/dist/assets/{Tts-BFhwi7Nm.js → Tts-CLB93SPL.js} +1 -1
- package/dist/assets/{VideoPlayer-BnwIjt1E.js → VideoPlayer-DTaZaNPe.js} +1 -1
- package/dist/assets/{alert-G37GiXIg.js → alert-CjaV4VyH.js} +1 -1
- package/dist/assets/arrow-down-Cq5K81XA.js +1 -0
- package/dist/assets/{arrow-down-wide-narrow-Bw3-m9uw.js → arrow-down-wide-narrow-DYoXwuOP.js} +1 -1
- package/dist/assets/arrow-left-BS9IzPRe.js +1 -0
- package/dist/assets/arrow-right-CL2_B7BZ.js +1 -0
- package/dist/assets/arrow-up-vmJ6KcdY.js +1 -0
- package/dist/assets/{avatar-BsiZaXKt.js → avatar-5M6peroW.js} +1 -1
- package/dist/assets/{basic-CUD9ixpS.js → basic-CmWp21US.js} +1 -1
- package/dist/assets/{book-open-VOA-qRz-.js → book-open-RqJbNzPy.js} +1 -1
- package/dist/assets/{box-BTYdpeSs.js → box-BEEkIbso.js} +1 -1
- package/dist/assets/{boxes-wDC71gk_.js → boxes-JieFrmM4.js} +1 -1
- package/dist/assets/{brain-CVKUI3Ty.js → brain-wBdsAYss.js} +1 -1
- package/dist/assets/{chart-no-axes-combined-Css_xsI4.js → chart-no-axes-combined-B8sKdzP9.js} +1 -1
- package/dist/assets/{chat-Cluz0DyK.js → chat-B_GVbkSP.js} +1 -1
- package/dist/assets/check-BA_RbR_g.js +1 -0
- package/dist/assets/chevron-down-Bo3W4e-Z.js +1 -0
- package/dist/assets/chevron-right-7VFX4u3I.js +1 -0
- package/dist/assets/circle-check-9HkCp0kN.js +1 -0
- package/dist/assets/{circle-question-mark-PRKtc95j.js → circle-question-mark-Cl2Lm-5E.js} +1 -1
- package/dist/assets/{clipboard-list-DS2oQz8T.js → clipboard-list-ilQQMwkX.js} +1 -1
- package/dist/assets/clock-BurpmIb0.js +1 -0
- package/dist/assets/code-9oBQJ6Kj.js +1 -0
- package/dist/assets/{codingBridge-Bfu7FDAD.js → codingBridge-BvaMrSGk.js} +1 -1
- package/dist/assets/{codingBridgeNotify--CrnyiFc.js → codingBridgeNotify-CKklEa8P.js} +2 -2
- package/dist/assets/{coins-CbJVFUNa.js → coins-DoRhV5HR.js} +1 -1
- package/dist/assets/{collapse-D-Az5Y1x.js → collapse-CvjzZBFy.js} +1 -1
- package/dist/assets/{copy-BV2l4S4i.js → copy-CIPzrXII.js} +1 -1
- package/dist/assets/{createTaskActions-Dc-9CHrk.js → createTaskActions-SabaluBw.js} +1 -1
- package/dist/assets/{digitalhuman-Dz67yLQj.js → digitalhuman-B-Vp-K7b.js} +1 -1
- package/dist/assets/{dollar-sign-C1g65vkD.js → dollar-sign-BsstGHbZ.js} +1 -1
- package/dist/assets/{download-DH4XAzhp.js → download-CX-M-1p7.js} +1 -1
- package/dist/assets/{drawer-BF8tPGkj.js → drawer-VnK7t36W.js} +1 -1
- package/dist/assets/{dropdown-Dxiw3zEy.js → dropdown-DXoh2CnL.js} +1 -1
- package/dist/assets/{dropdown-BPFUku-f.js → dropdown-j3knQBHD.js} +1 -1
- package/dist/assets/{ellipsis-Dne0PaxK.js → ellipsis-CRlBlm5I.js} +1 -1
- package/dist/assets/{esm-BLmcHm-_.js → esm-BIIIq0k6.js} +1 -1
- package/dist/assets/{esm-D3RGWycH.js → esm-BnjB1a-w.js} +1 -1
- package/dist/assets/{esm-D2EUd9-p.js → esm-DDysbSQY.js} +2 -2
- package/dist/assets/{esm-VF3xOK5d.js → esm-DWYXDiE1.js} +2 -2
- package/dist/assets/esm-LibIVarD.js +1 -0
- package/dist/assets/{esm-D48kK9Ia.js → esm-UTZ8SL6O.js} +3 -3
- package/dist/assets/{esm-DcMLRHGU.js → esm-Z60DZAoG.js} +1 -1
- package/dist/assets/{external-link-Y1fuqa_d.js → external-link-DRY9MBhg.js} +1 -1
- package/dist/assets/{eye-uumNqt6F.js → eye-DZkCrKJ_.js} +1 -1
- package/dist/assets/{file-B6BY8JCh.js → file-Yc-6a-e-.js} +1 -1
- package/dist/assets/{file-output-BRGppmHm.js → file-output-B8Tlktgm.js} +1 -1
- package/dist/assets/{file-text-BD_ZgyAJ.js → file-text-B9gevd-U.js} +1 -1
- package/dist/assets/{fish-D0SCi3ei.js → fish-BoQX54S5.js} +1 -1
- package/dist/assets/{flux-QvdaqKdp.js → flux-D_4i_-FC.js} +1 -1
- package/dist/assets/{folder-D8OqMpU-.js → folder-D28_V3sU.js} +1 -1
- package/dist/assets/gauge-BxJMhEjF.js +1 -0
- package/dist/assets/{globe-DogeYs6l.js → globe-lcGcyJ-S.js} +1 -1
- package/dist/assets/{grokvideo-DyWrWpO4.js → grokvideo-sSSLYi-n.js} +1 -1
- package/dist/assets/{hailuo-m02yWO8T.js → hailuo-v7jkrRK0.js} +1 -1
- package/dist/assets/{headphones-B24PnKmj.js → headphones-B2uibmS9.js} +1 -1
- package/dist/assets/{history-hh_iVs0t.js → history-Df5RJ_mT.js} +1 -1
- package/dist/assets/{house-DMuPgP0K.js → house-CGVOZdy7.js} +1 -1
- package/dist/assets/{image-4hDRDwRY.js → image-N4s0X2er.js} +1 -1
- package/dist/assets/{index-dzU0SACS.js → index-tKADgCY9.js} +3 -3
- package/dist/assets/{index.browser.esm-DEBg8Czw.js → index.browser.esm-BoJWDrUY.js} +1 -1
- package/dist/assets/{index.es-B_JRhb1z.js → index.es-DpUSIKd4.js} +1 -1
- package/dist/assets/{info-C7eq8W70.js → info-DTQ5Jj3H.js} +1 -1
- package/dist/assets/{input-number-DwjoHB_t.js → input-number-Bx2nlQp3.js} +1 -1
- package/dist/assets/{key-round-CbX1QjS3.js → key-round-CcMsFvcS.js} +1 -1
- package/dist/assets/{kling-Uz16T18I.js → kling-DE0R41ac.js} +1 -1
- package/dist/assets/{languages-kMgQhORN.js → languages-D1gPeJMk.js} +1 -1
- package/dist/assets/{laptop--KTFz907.js → laptop-DyL8Al1f.js} +1 -1
- package/dist/assets/{lightbulb-Btwo92TP.js → lightbulb-Cj8gYh-P.js} +1 -1
- package/dist/assets/{link-BHUi4UzQ.js → link-CI8y8JCR.js} +1 -1
- package/dist/assets/loader-circle-YN1fZjAA.js +1 -0
- package/dist/assets/{lock-HFF7LqQ6.js → lock-BePuXV1t.js} +1 -1
- package/dist/assets/{luma-B8gBcwfK.js → luma-QtePWfgh.js} +1 -1
- package/dist/assets/{maestro-DtHatUjf.js → maestro-DrvckkxS.js} +1 -1
- package/dist/assets/{mail-Cf8LFguX.js → mail-CqHkXfXh.js} +1 -1
- package/dist/assets/{message-circle-75uDV2HU.js → message-circle-Bep3nmcN.js} +1 -1
- package/dist/assets/{mic-U9HFofCv.js → mic-u_R_52zb.js} +1 -1
- package/dist/assets/{midjourney-DLsZDLHN.js → midjourney-BZITzhWe.js} +1 -1
- package/dist/assets/{mobileLocalExec-Jy6peL1O.js → mobileLocalExec-DPtGECym.js} +2 -2
- package/dist/assets/{monitor-CaLaxqsl.js → monitor-V1k4Wt17.js} +1 -1
- package/dist/assets/{mouse-pointer-2-OdaCocrT.js → mouse-pointer-2-CR02XkBx.js} +1 -1
- package/dist/assets/music-2-B1iWI6gb.js +1 -0
- package/dist/assets/{nanobanana-Dl-ipICX.js → nanobanana-BZN628q2.js} +1 -1
- package/dist/assets/{omni-CI7RALc3.js → omni-BP9bGSBs.js} +1 -1
- package/dist/assets/{openaiimage-x5VnybkH.js → openaiimage-BohTCOHS.js} +1 -1
- package/dist/assets/{pagination-C5nrzUF9.js → pagination-BnQgCM-x.js} +1 -1
- package/dist/assets/{pagination-DZKa3-YT.js → pagination-D99zvqj0.js} +1 -1
- package/dist/assets/{pagination-Bzi2EMHv.js → pagination-DYnUbk8K.js} +1 -1
- package/dist/assets/{palette-Dcz8R07T.js → palette-CvQ1FazR.js} +1 -1
- package/dist/assets/{paperclip-C9CPT-QH.js → paperclip-BWPa3VpV.js} +1 -1
- package/dist/assets/{pause-B7nZk56m.js → pause-DMZUztb6.js} +1 -1
- package/dist/assets/{pencil-DjYsRqzY.js → pencil-D5dsgh1k.js} +1 -1
- package/dist/assets/{pika-JthT3pXY.js → pika-Sw9xUd5h.js} +1 -1
- package/dist/assets/{pixverse-BdQw9oon.js → pixverse-B-JoN4G6.js} +1 -1
- package/dist/assets/play-CpF6eLfy.js +1 -0
- package/dist/assets/{plug-Pqr_YrfP.js → plug-wX_bvKAP.js} +1 -1
- package/dist/assets/plus-CK2JFYNP.js +1 -0
- package/dist/assets/{poivelle-BhoxBCwR.js → poivelle-DISA8VD4.js} +1 -1
- package/dist/assets/{popover-vu3TWrhj.js → popover-DUgpvcBG.js} +1 -1
- package/dist/assets/{producer-DqmOMlav.js → producer-BDNg0tcR.js} +1 -1
- package/dist/assets/{qrart-wpmoj2Md.js → qrart-ZUQz3J4q.js} +1 -1
- package/dist/assets/{realtime-Ce9utybp.js → realtime-CadXak-M.js} +1 -1
- package/dist/assets/{refresh-cw-CfsQ44rr.js → refresh-cw-DQ1-meTS.js} +1 -1
- package/dist/assets/rotate-ccw-CF8N1p9v.js +1 -0
- package/dist/assets/rotate-cw-DOllsvYy.js +1 -0
- package/dist/assets/{row-ig5nVOkc.js → row-B6o6HQls.js} +1 -1
- package/dist/assets/search-7Ly3KYfT.js +1 -0
- package/dist/assets/{seedance-tg7fYegi.js → seedance-DY7_nuMa.js} +1 -1
- package/dist/assets/{seedream-BN7uBnTq.js → seedream-CSuVYQvD.js} +1 -1
- package/dist/assets/{select--z-fac6_.js → select-CaXJ36xG.js} +1 -1
- package/dist/assets/{serp-B6cjTPwx.js → serp-ggTDzIHo.js} +1 -1
- package/dist/assets/{shield-DTxeqQnl.js → shield-BiAfGNET.js} +1 -1
- package/dist/assets/{shuffle-BGv-o6iw.js → shuffle-D4lblkpM.js} +1 -1
- package/dist/assets/{slider-7iC9uVCH.js → slider-pmMW-cMB.js} +1 -1
- package/dist/assets/{sliders-horizontal-BJThi7W3.js → sliders-horizontal-DaIPZ1NK.js} +1 -1
- package/dist/assets/{solana-wallets-BOOwBWgF.js → solana-wallets-DhqluL4O.js} +2 -2
- package/dist/assets/{solana-wallets-vue-CeTGdA4N.js → solana-wallets-vue-B4-fa4iq.js} +1 -1
- package/dist/assets/{sora-CmhEupYX.js → sora-MV08E5lI.js} +1 -1
- package/dist/assets/{sparkles-BXttUKHs.js → sparkles-Bs6XZiy8.js} +1 -1
- package/dist/assets/square-CqBdciij.js +1 -0
- package/dist/assets/{store-f5a0TlJm.js → store-BHbgBPeW.js} +1 -1
- package/dist/assets/{suno-CMpuwwKN.js → suno-CfI4CLgZ.js} +1 -1
- package/dist/assets/{switch-CU7Lbydn.js → switch-DGps_uPH.js} +1 -1
- package/dist/assets/{table-B1ktVOIV.js → table-C9iSQAZO.js} +1 -1
- package/dist/assets/{tabs-CMeHhbQd.js → tabs-Cv60oJMx.js} +1 -1
- package/dist/assets/{tag-D88Sfg4N.js → tag-CnEt0kh3.js} +1 -1
- package/dist/assets/terminal-CxpLlw3l.js +1 -0
- package/dist/assets/{time-picker-D3G4t_oE.js → time-picker-Dx9ubGKI.js} +1 -1
- package/dist/assets/{tooltip-CVVApYjJ.js → tooltip-kiynJmu_.js} +1 -1
- package/dist/assets/{trash-2-B7h9iX5Q.js → trash-2-NVpkdW0R.js} +1 -1
- package/dist/assets/{triangle-alert-C_NcfP7e.js → triangle-alert-DNESykEp.js} +1 -1
- package/dist/assets/{upload-DRjQvPEd.js → upload-B3hX6Wjm.js} +1 -1
- package/dist/assets/{upload-GC5EGmwp.js → upload-CtyDOjCb.js} +1 -1
- package/dist/assets/user-B_ZZzZTH.js +1 -0
- package/dist/assets/{veo-aFwNCFqW.js → veo-CoWKIJHu.js} +1 -1
- package/dist/assets/{video-DzECS7d8.js → video-CSc-7aSG.js} +1 -1
- package/dist/assets/{volume-2-P5c2kRYc.js → volume-2-D42rEd54.js} +1 -1
- package/dist/assets/{wallet-Dx1JWzUk.js → wallet-Cu4DWt4b.js} +1 -1
- package/dist/assets/{wan-BSz5Kzfp.js → wan-6VXEyQE5.js} +1 -1
- package/dist/assets/{wand-sparkles-BQfGRD0P.js → wand-sparkles-Dhrc68i4.js} +1 -1
- package/dist/assets/{web-CQd8Y7AZ.js → web-B29N341h.js} +1 -1
- package/dist/assets/{web-bobTX3fT.js → web-B8G4NzPr.js} +1 -1
- package/dist/assets/{web-sGhtaPRt.js → web-CyftV12H.js} +1 -1
- package/dist/assets/{web-Bd7fTTXa.js → web-ML2EoPjo.js} +1 -1
- package/dist/assets/{web-Jqmx6K36.js → web-_subBsVB.js} +1 -1
- package/dist/assets/{webextrator-Blj-ynVW.js → webextrator-DEMQXwei.js} +1 -1
- package/dist/assets/{zap-BAyq1MAX.js → zap-BayDgLEm.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/arrow-down-B47oLEZg.js +0 -1
- package/dist/assets/arrow-left-xCa4y53k.js +0 -1
- package/dist/assets/arrow-right-ZB-S5Hdw.js +0 -1
- package/dist/assets/arrow-up-BeYMyDMK.js +0 -1
- package/dist/assets/check-D47LmiyR.js +0 -1
- package/dist/assets/chevron-down-BumkMWkr.js +0 -1
- package/dist/assets/chevron-right-DJAkv6gb.js +0 -1
- package/dist/assets/circle-check-D5h_jiB2.js +0 -1
- package/dist/assets/clock-BbOTrjoQ.js +0 -1
- package/dist/assets/code-DIu2zrn0.js +0 -1
- package/dist/assets/esm-VeU-Svd3.js +0 -1
- package/dist/assets/gauge-kqBdc9W1.js +0 -1
- package/dist/assets/loader-circle-Chlmw50N.js +0 -1
- package/dist/assets/music-2-Bntsr1pc.js +0 -1
- package/dist/assets/play-D4UKBipL.js +0 -1
- package/dist/assets/plus-Yte47cek.js +0 -1
- package/dist/assets/rotate-ccw-C2vE6W20.js +0 -1
- package/dist/assets/rotate-cw-B3ZTq3Bo.js +0 -1
- package/dist/assets/search-Dd9GL0kL.js +0 -1
- package/dist/assets/square-DUN4iYgL.js +0 -1
- package/dist/assets/terminal-BXyA_hw_.js +0 -1
- package/dist/assets/user-DAcxFEzJ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,K as a,L as o,M as s,N as c,S as l,T as u,at as d,b as f,ht as p,j as m,mt as h,ot as g,qt as _,rt as v,st as y,tt as b,z as x}from"./vendor-chart-Dw-P17PN.js";import{r as S,t as C}from"./select--z-fac6_.js";import{n as w,t as T}from"./tabs-CMeHhbQd.js";import{t as E}from"./tooltip-CVVApYjJ.js";import{n as D,r as O,t as k}from"./dropdown-Dxiw3zEy.js";import{t as A}from"./pagination-Bzi2EMHv.js";import{t as j}from"./switch-CU7Lbydn.js";import{t as M}from"./arrow-down-B47oLEZg.js";import{t as N}from"./arrow-left-xCa4y53k.js";import{t as P}from"./book-open-VOA-qRz-.js";import{t as F}from"./chevron-down-BumkMWkr.js";import{t as I}from"./chevron-right-DJAkv6gb.js";import{t as L}from"./circle-check-D5h_jiB2.js";import{t as ee}from"./circle-question-mark-PRKtc95j.js";import{t as te}from"./clipboard-list-DS2oQz8T.js";import{t as ne}from"./code-DIu2zrn0.js";import{t as R}from"./copy-BV2l4S4i.js";import{t as re}from"./ellipsis-Dne0PaxK.js";import{t as ie}from"./eye-uumNqt6F.js";import{t as ae}from"./file-text-BD_ZgyAJ.js";import{t as z}from"./file-B6BY8JCh.js";import{t as B}from"./folder-D8OqMpU-.js";import{t as oe}from"./image-4hDRDwRY.js";import{t as se}from"./lock-HFF7LqQ6.js";import{t as ce}from"./plus-Yte47cek.js";import{n as le,t as ue}from"./store-f5a0TlJm.js";import{t as de}from"./search-Dd9GL0kL.js";import{t as fe}from"./trash-2-B7h9iX5Q.js";import{t as pe}from"./triangle-alert-C_NcfP7e.js";import{t as me}from"./upload-DRjQvPEd.js";import{t as he}from"./wand-sparkles-BQfGRD0P.js";import{Ai as V,Ci as H,E as U,Ei as W,Ji as G,Li as ge,Si as _e,Ti as K,bi as ve,fi as ye,gi as be,gr as q,hi as xe,mi as Se,ui as Ce,wi as we,zi as J}from"./index-dzU0SACS.js";import{a as Te,c as Ee,d as De,f as Oe,i as ke,l as Ae,m as Y,n as je,o as Me,p as Ne,r as Pe,s as Fe,t as Ie,u as Le}from"./vendor-highlight-BHrfT4-E.js";import{t as Re}from"./index.es-B_JRhb1z.js";import{t as ze}from"./VueMarkdown-CiiRjbWs.js";var Be=H(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Ve=H(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),He=H(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),Ue=H(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),We=H(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),X=()=>({baseURL:`${Ce()}/api/v1`}),Z=new class{key=`skills/installed`;async list(){return q.get(`/${this.key}/`,X())}async get(e){return q.get(`/${this.key}/${e}/`,X())}async createMarkdown(e){return q.post(`/${this.key}/`,e,X())}async createTarball(e){let t=new FormData;return t.append(`tarball`,e),q.post(`/${this.key}/`,t,{...X(),headers:{"Content-Type":`multipart/form-data`}})}async update(e,t){return q.patch(`/${this.key}/${e}/`,t,X())}async remove(e){return q.delete(`/${this.key}/${e}/`,X())}async enable(e){return q.post(`/${this.key}/${e}/enable/`,void 0,X())}async disable(e){return q.post(`/${this.key}/${e}/disable/`,void 0,X())}async fetchFile(e,t){let n=await q.get(`/${this.key}/${e}/files/`,{...X(),params:{path:t},responseType:`arraybuffer`}),r=n.headers[`content-type`]||`application/octet-stream`;return{blob:new Blob([n.data],{type:r}),contentType:r}}},Q=new class{key=`skills`;async list(e={}){return q.get(`/${this.key}/`,{...X(),params:e})}async get(e){return q.get(`/${this.key}/${e}/`,X())}async categories(){return q.get(`/${this.key}/categories/`,X())}async install(e,t={}){return q.post(`/${this.key}/${e}/install/`,t,X())}};function Ge(){let e=new Set;xe()&&e.add(`desktop`),be()&&e.add(`ios`),Se()&&e.add(`android`),ve()&&e.add(`web`);let t=ye();if(t===`mac`)e.add(`mac`);else if(t===`windows`)e.add(`windows`);else if(typeof navigator<`u`){let t=navigator.userAgent||``,n=navigator.userAgentData?.platform,r=/macintosh/i.test(t)&&(navigator.maxTouchPoints||0)>1;!be()&&!r&&(n===`macOS`||/mac os x|macintosh/i.test(t))&&e.add(`mac`),(n===`Windows`||/windows nt/i.test(t))&&e.add(`windows`)}return e}var Ke=new Set([`mac`,`windows`,`desktop`,`web`,`ios`,`android`]);function qe(e){let t=e.filter(e=>Ke.has(e));if(!t.length)return!0;let n=Ge();return t.some(e=>n.has(e))}Y.registerLanguage(`bash`,Ne),Y.registerLanguage(`json`,Oe),Y.registerLanguage(`markdown`,De),Y.registerLanguage(`python`,Le),Y.registerLanguage(`shell`,Ae),Y.registerLanguage(`yaml`,Ee),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var Je=12,Ye=x({name:`BrowseSkillsDialog`,components:{VueMarkdown:ze,ElDialog:V,ElInput:G,ElButton:J,ElPagination:A,ElSelect:S,ElOption:C,FontAwesomeIcon:Re,AddIcon:ce,BackIcon:N,DownIcon:M,InstallIcon:Be,LockIcon:se,SearchIcon:de,SuccessIcon:L},directives:{loading:W},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`installed`],data(){return{loading:!1,installing:!1,items:[],total:0,currentPage:1,searchQuery:``,namespaceFilter:``,sortBy:`popular`,selectedItem:null,searchTimer:null,knownNamespaces:[],publisherByNamespace:{}}},computed:{pageSize(){return Je},namespaceOptions(){let e=new Set(this.knownNamespaces);for(let t of this.items)e.add(t.namespace);return Array.from(e).sort().map(e=>({value:e,label:this.publisherForNamespace(e)}))},detailBody(){return this.selectedItem?this.selectedItem.content.replace(/^---\n[\s\S]*?\n---\n?/,``):``}},methods:{onOpen(){this.selectedItem=null,this.searchQuery=``,this.namespaceFilter=``,this.sortBy=`popular`,this.currentPage=1,this.knownNamespaces=[],this.publisherByNamespace={},this.loadFacets(),this.reload()},openDetail(e){this.selectedItem=e},async loadFacets(){try{let{data:e}=await Q.categories(),t=new Set;for(let n of e.namespaces)t.add(n.namespace);this.knownNamespaces=Array.from(t).sort()}catch(e){console.warn(`failed to load skill catalog facets`,e)}},reloadFromFirstPage(){this.currentPage=1,this.reload()},onPageChange(e){this.currentPage=e,this.reload(),this.$nextTick(()=>{let e=this.$el.querySelector(`.directory-grid-wrapper`);e&&(e.scrollTop=0)})},onSearchInput(){this.searchTimer!==null&&window.clearTimeout(this.searchTimer),this.searchTimer=window.setTimeout(()=>{this.searchTimer=null,this.reloadFromFirstPage()},250)},async reload(){this.loading=!0;try{let{data:e}=await Q.list({q:this.searchQuery.trim()||void 0,namespace:this.namespaceFilter||void 0,sort:this.sortBy,limit:this.pageSize,offset:(this.currentPage-1)*this.pageSize});this.items=e.items,this.total=e.total;for(let t of e.items)t.publisher&&(this.publisherByNamespace[t.namespace]=t.publisher)}catch(e){console.error(e),K.error(this.$t(`skill.directory.loadFailed`))}finally{this.loading=!1}},async onInstall(e){if(!this.installing&&!e.installed){if(!this.canInstallOnSurface(e)){K.warning(this.$t(`skill.directory.surfaceBlocked`,{platforms:this.surfaceLabels(e)}));return}this.installing=!0;try{let{data:t}=await Q.install(e.id);K.success(this.$t(`skill.directory.installSuccess`,{name:e.slug})),this.$emit(`installed`,t.id),e.installed=!0,e.install_count+=1}catch(t){let n=this.extractError(t);n.includes(`already exists`)?(e.installed=!0,K.warning(this.$t(`skill.directory.alreadyInstalled`,{name:e.slug}))):K.error(this.$t(`skill.directory.installFailed`,{detail:n}))}finally{this.installing=!1}}},extractError(e){return e?.response?.data?.detail||String(e)||`unknown error`},formatCount(e){return e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)},publisherForNamespace(e){if(this.publisherByNamespace[e])return this.publisherByNamespace[e];let t=this.items.find(t=>t.namespace===e);return t?t.publisher:e},restrictedSurfaces(e){let t=e.frontmatter?.surfaces;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim().toLowerCase()):[]},surfaceLabel(e){let t=`skill.directory.surface.${e}`,n=this.$t(t);return n===t?e:n},surfaceLabels(e){return this.restrictedSurfaces(e).map(e=>this.surfaceLabel(e)).join(` / `)},canInstallOnSurface(e){return qe(this.restrictedSurfaces(e))}}}),Xe={class:`directory`},Ze={class:`directory-main`},Qe={class:`directory-header`},$e={class:`directory-controls`},et={class:`directory-grid-wrapper`},tt={key:0,class:`directory-empty`},nt={key:1,class:`directory-grid`},rt=[`onClick`],it={class:`directory-card-head`},at={class:`directory-card-title`},ot=[`title`],st=[`title`],ct=[`aria-label`,`title`,`onClick`],lt=[`title`],ut={class:`directory-card-meta`},dt={class:`directory-card-publisher`},ft={key:0,class:`directory-card-count`},pt=[`title`],mt={class:`directory-card-desc`},ht={key:0,class:`directory-footer`},gt={class:`directory-detail-head`},_t={class:`directory-detail-actions`},vt=[`href`],yt={class:`directory-detail-body`},bt={class:`directory-detail-title`},xt={class:`directory-detail-meta`},St={key:0},Ct={key:1},wt=[`title`],Tt={class:`directory-detail-desc`};function Et(a,l,f,_,y,x){let S=d(`search-icon`),C=d(`el-input`),w=d(`el-option`),T=d(`el-select`),E=d(`success-icon`),D=d(`lock-icon`),O=d(`add-icon`),k=d(`down-icon`),A=d(`el-pagination`),j=d(`back-icon`),M=d(`font-awesome-icon`),N=d(`el-button`),P=d(`install-icon`),F=d(`vue-markdown`),I=d(`el-dialog`),L=g(`loading`);return b(),m(I,{"model-value":a.modelValue,title:a.$t(`skill.dialog.directoryTitle`),width:`min(960px, 94vw)`,"align-center":``,class:`directory-dialog`,"close-on-click-modal":!a.installing,"show-close":!a.installing,"onUpdate:modelValue":l[5]||=e=>a.$emit(`update:modelValue`,e),onOpen:a.onOpen},{default:h(()=>[e(`div`,Xe,[e(`main`,Ze,[a.selectedItem?(b(),c(u,{key:1},[e(`header`,gt,[e(`button`,{class:`directory-back-btn`,onClick:l[3]||=e=>a.selectedItem=null},[o(j,{size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.back`)),1)]),e(`div`,_t,[a.selectedItem.source_url?(b(),c(`a`,{key:0,href:a.selectedItem.source_url,target:`_blank`,class:`directory-link`},[o(M,{icon:`fa-brands fa-github`}),r(` `+i(a.$t(`skill.directory.viewSource`)),1)],8,vt)):s(``,!0),a.selectedItem.installed?(b(),m(N,{key:1,disabled:``,type:`success`,plain:``},{default:h(()=>[o(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.installed`)),1)]),_:1})):a.selectedItem.installable&&!a.canInstallOnSurface(a.selectedItem)?(b(),m(N,{key:2,disabled:``,title:a.$t(`skill.directory.surfaceBlocked`,{platforms:a.surfaceLabels(a.selectedItem)})},{default:h(()=>[o(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.surfaceUnavailable`)),1)]),_:1},8,[`title`])):a.selectedItem.installable?(b(),m(N,{key:3,type:`primary`,loading:a.installing,onClick:l[4]||=e=>a.onInstall(a.selectedItem)},{default:h(()=>[o(P,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.install`)),1)]),_:1},8,[`loading`])):(b(),m(N,{key:4,disabled:``,title:a.selectedItem.license},{default:h(()=>[o(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.selectedItem.license||a.$t(`skill.directory.notInstallable`)),1)]),_:1},8,[`title`]))])]),e(`div`,yt,[e(`h2`,bt,`/`+i(a.selectedItem.slug),1),e(`div`,xt,[e(`span`,null,[e(`strong`,null,i(a.$t(`skill.meta.addedBy`))+`:`,1),r(` `+i(a.selectedItem.publisher),1)]),a.selectedItem.license?(b(),c(`span`,St,[e(`strong`,null,i(a.$t(`skill.directory.license`))+`:`,1),r(` `+i(a.selectedItem.license),1)])):s(``,!0),a.selectedItem.version?(b(),c(`span`,Ct,`v`+i(a.selectedItem.version),1)):s(``,!0),a.surfaceLabels(a.selectedItem)?(b(),c(`span`,{key:2,class:`directory-detail-surface`,title:a.$t(`skill.directory.surfaceHint`)},i(a.$t(`skill.directory.surfaceOnly`,{platforms:a.surfaceLabels(a.selectedItem)})),9,wt)):s(``,!0)]),e(`p`,Tt,i(a.selectedItem.description),1),o(F,{class:`directory-detail-content`,source:a.detailBody,sanitize:``},null,8,[`source`])])],64)):(b(),c(u,{key:0},[e(`header`,Qe,[o(C,{modelValue:a.searchQuery,"onUpdate:modelValue":l[0]||=e=>a.searchQuery=e,class:`directory-search`,size:`default`,clearable:``,placeholder:a.$t(`skill.directory.searchPlaceholder`),onInput:a.onSearchInput},{prefix:h(()=>[o(S,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`,`onInput`]),e(`div`,$e,[o(T,{modelValue:a.namespaceFilter,"onUpdate:modelValue":l[1]||=e=>a.namespaceFilter=e,class:`directory-select`,placeholder:a.$t(`skill.directory.allPublishers`),clearable:``,size:`default`,onChange:a.reloadFromFirstPage},{default:h(()=>[(b(!0),c(u,null,v(a.namespaceOptions,e=>(b(),m(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),o(T,{modelValue:a.sortBy,"onUpdate:modelValue":l[2]||=e=>a.sortBy=e,class:`directory-select directory-select-sm`,size:`default`,onChange:a.reloadFromFirstPage},{default:h(()=>[o(w,{label:a.$t(`skill.directory.sort.popular`),value:`popular`},null,8,[`label`]),o(w,{label:a.$t(`skill.directory.sort.recent`),value:`recent`},null,8,[`label`]),o(w,{label:a.$t(`skill.directory.sort.name`),value:`name`},null,8,[`label`])]),_:1},8,[`modelValue`,`onChange`])])]),p((b(),c(`div`,et,[!a.loading&&a.total===0?(b(),c(`p`,tt,i(a.$t(`skill.directory.empty`)),1)):(b(),c(`div`,nt,[(b(!0),c(u,null,v(a.items,l=>(b(),c(`article`,{key:l.id,class:n([`directory-card`,{"is-installed":l.installed}]),onClick:e=>a.openDetail(l)},[e(`div`,it,[e(`span`,at,`/`+i(l.slug),1),l.installed?(b(),c(`span`,{key:0,class:`directory-card-action is-installed`,title:a.$t(`skill.directory.installed`)},[o(E,{size:16,"aria-hidden":`true`,focusable:`false`})],8,ot)):l.installable&&!a.canInstallOnSurface(l)?(b(),c(`span`,{key:1,class:`directory-card-locked`,title:a.$t(`skill.directory.surfaceBlocked`,{platforms:a.surfaceLabels(l)})},[o(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,st)):l.installable?(b(),c(`button`,{key:2,class:`directory-card-action`,"aria-label":a.$t(`skill.directory.install`),title:a.$t(`skill.directory.install`),onClick:t(e=>a.onInstall(l),[`stop`])},[o(O,{size:16,"aria-hidden":`true`,focusable:`false`})],8,ct)):(b(),c(`span`,{key:3,class:`directory-card-locked`,title:l.license},[o(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,lt))]),e(`div`,ut,[e(`span`,dt,i(l.publisher),1),l.install_count>0?(b(),c(`span`,ft,[o(k,{size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.formatCount(l.install_count)),1)])):s(``,!0),a.surfaceLabels(l)?(b(),c(`span`,{key:1,class:`directory-card-surface`,title:a.$t(`skill.directory.surfaceHint`)},i(a.surfaceLabels(l)),9,pt)):s(``,!0)]),e(`p`,mt,i(l.description),1)],10,rt))),128))]))])),[[L,a.loading]]),a.total>a.pageSize?(b(),c(`footer`,ht,[o(A,{"current-page":a.currentPage,"page-size":a.pageSize,total:a.total,"pager-count":5,background:``,layout:`prev, pager, next, total`,onCurrentChange:a.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onCurrentChange`])])):s(``,!0)],64))])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`show-close`,`onOpen`])}var Dt=U(Ye,[[`render`,Et],[`__scopeId`,`data-v-d346d23f`]]);Y.registerLanguage(`bash`,Ne),Y.registerLanguage(`css`,Fe),Y.registerLanguage(`go`,Me),Y.registerLanguage(`javascript`,Te),Y.registerLanguage(`json`,Oe),Y.registerLanguage(`markdown`,De),Y.registerLanguage(`python`,Le),Y.registerLanguage(`rust`,ke),Y.registerLanguage(`shell`,Ae),Y.registerLanguage(`sql`,Pe),Y.registerLanguage(`typescript`,je),Y.registerLanguage(`xml`,Ie),Y.registerLanguage(`html`,Ie),Y.registerLanguage(`yaml`,Ee),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),Y.registerAliases([`js`,`jsx`],{languageName:`javascript`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`rs`],{languageName:`rust`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var $=1e6;function Ot(e,t){let n=(e.split(`.`).pop()||``).toLowerCase();return n===`md`||t.startsWith(`text/markdown`)?`markdown`:n===`html`||n===`htm`||t.startsWith(`text/html`)?`html`:t.startsWith(`image/`)||[`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`].includes(n)?`image`:t.startsWith(`text/`)||[`json`,`application/json`].includes(t.split(`;`)[0])?n?`code`:`text`:`binary`}function kt(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Y.getLanguage(t)?t:`plain`}var At=x({name:`SkillFilePreview`,components:{ElButton:J,ElTooltip:E,ElTabs:w,ElTabPane:T,CodeIcon:ne,CopyIcon:R,FileIcon:z,SaveIcon:Ue,ViewIcon:ie,WarningIcon:pe,VueMarkdown:ze},directives:{loading:W},props:{skillId:{type:String,required:!0},path:{type:String,required:!0},editable:{type:Boolean,default:!1}},emits:[`save`],data(){return{MAX_PREVIEW_BYTES:$,loading:!1,error:``,contentType:``,size:0,textContent:``,imageUrl:``,truncated:!1,viewMode:`rendered`,dirty:!1,saving:!1}},computed:{kind(){return this.path?Ot(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${kt(this.path)}`},truncatedText(){return this.textContent}},watch:{path:{handler(){this.fetch()},immediate:!0}},beforeUnmount(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl)},methods:{humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},async fetch(){if(this.path){this.loading=!0,this.error=``,this.textContent=``,this.truncated=!1,this.dirty=!1,this.imageUrl&&=(URL.revokeObjectURL(this.imageUrl),``);try{let{blob:e,contentType:t}=await Z.fetchFile(this.skillId,this.path);this.contentType=t,this.size=e.size;let n=Ot(this.path,t);if(n===`image`)this.imageUrl=URL.createObjectURL(e);else if(n!==`binary`){let t=await e.text();t.length>$&&(t=t.slice(0,$),this.truncated=!0),this.textContent=t,this.viewMode=n===`markdown`||n===`html`?`rendered`:`source`}}catch(e){let t=e,n=t?.response?.status,r=t?.response?.data?.detail||String(e);this.error=n?`(${n}) ${r}`:r}finally{this.loading=!1,this.$nextTick(()=>this.applyHighlight())}}},applyHighlight(){let e=this.$refs.codeEl;e&&this.kind===`code`&&this.viewMode!==`rendered`&&(delete e.dataset.highlighted,Y.highlightElement(e))},async onCopy(){if(this.textContent)try{await navigator.clipboard.writeText(this.textContent),K.success(this.$t(`skill.preview.copied`))}catch{K.error(this.$t(`skill.preview.copyFailed`))}},async onSave(){this.saving=!0;try{await new Promise((e,t)=>{this.$emit(`save`,this.textContent,{resolve:e,reject:t})}),this.dirty=!1}catch{}finally{this.saving=!1}}}}),jt={class:`preview-root`},Mt={class:`toolbar`},Nt={class:`path-display`},Pt={key:0,class:`size-display`},Ft={class:`body`},It={key:0,class:`error`},Lt=[`srcdoc`],Rt={key:3,class:`image-pane`},zt=[`src`,`alt`],Bt={key:4,class:`binary`},Vt=[`placeholder`],Ht={key:6,class:`source-pane`},Ut={key:7,class:`truncated-warning`};function Wt(t,a,l,u,_,v){let y=d(`save-icon`),x=d(`el-button`),S=d(`copy-icon`),C=d(`el-tooltip`),w=d(`view-icon`),T=d(`el-tab-pane`),E=d(`code-icon`),D=d(`el-tabs`),O=d(`warning-icon`),k=d(`vue-markdown`),A=d(`file-icon`),j=g(`loading`);return p((b(),c(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.path||`—`),1),t.size?(b(),c(`span`,Pt,i(t.humanSize(t.size)),1)):s(``,!0),a[3]||=e(`span`,{class:`toolbar-spacer`},null,-1),t.editable?(b(),m(x,{key:1,type:`primary`,size:`small`,disabled:!t.dirty||t.saving,loading:t.saving,onClick:t.onSave},{default:h(()=>[o(y,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.save`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])):s(``,!0),o(C,{content:t.$t(`skill.preview.copy`),placement:`bottom`},{default:h(()=>[o(x,{size:`small`,circle:``,disabled:!t.textContent,"aria-label":t.$t(`skill.preview.copy`),title:t.$t(`skill.preview.copy`),onClick:t.onCopy},{default:h(()=>[o(S,{size:16,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`disabled`,`aria-label`,`title`,`onClick`])]),_:1},8,[`content`])]),t.canRender?(b(),m(D,{key:0,modelValue:t.viewMode,"onUpdate:modelValue":a[0]||=e=>t.viewMode=e,class:`view-tabs`},{default:h(()=>[o(T,{name:`rendered`},{label:h(()=>[o(w,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewRendered`)),1)]),_:1}),o(T,{name:`source`},{label:h(()=>[o(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewSource`)),1)]),_:1})]),_:1},8,[`modelValue`])):s(``,!0),e(`div`,Ft,[t.error?(b(),c(`div`,It,[o(O,{class:`mr-2`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.error),1)])):t.kind===`markdown`&&t.viewMode===`rendered`?(b(),m(k,{key:1,class:`markdown-rendered`,source:t.textContent,sanitize:``},null,8,[`source`])):t.kind===`html`&&t.viewMode===`rendered`?(b(),c(`iframe`,{key:2,ref:`htmlFrame`,class:`html-frame`,sandbox:``,srcdoc:t.textContent},null,8,Lt)):t.kind===`image`?(b(),c(`div`,Rt,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,zt)])):t.kind===`binary`?(b(),c(`div`,Bt,[o(A,{class:`binary-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.binary`,{type:t.contentType})),1)])):t.editable?p((b(),c(`textarea`,{key:5,"onUpdate:modelValue":a[1]||=e=>t.textContent=e,class:`source-editor`,spellcheck:`false`,placeholder:t.$t(`skill.placeholder.content`),onInput:a[2]||=e=>t.dirty=!0},null,40,Vt)),[[f,t.textContent]]):(b(),c(`pre`,Ht,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(b(),c(`p`,Ut,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):s(``,!0)])])),[[j,t.loading]])}var Gt=U(At,[[`render`,Wt],[`__scopeId`,`data-v-ec0a447e`]]),Kt=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),qt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Jt(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?P:n===`md`?ae:qt.has(n)?oe:Kt.has(n)?He:z}function Yt(e){let t=new Map;t.set(``,new Map);let n=(e,n)=>{let r=t.get(e);r||(r=new Map,t.set(e,r));let i=e?`${e}/${n}`:n,a=r.get(n);return a||(a={label:n,path:i,isLeaf:!1,children:[]},r.set(n,a),t.set(i,new Map)),a};for(let r of e){let e=r.split(`/`).filter(Boolean);if(e.length===0)continue;let i=e[e.length-1],a=e.slice(0,-1),o=``;for(let e of a)o=n(o,e).path;let s={label:i,path:r,isLeaf:!0},c=t.get(o);c||(c=new Map,t.set(o,c)),c.set(i,s)}let r=e=>{let n=t.get(e);if(!n)return[];let i=Array.from(n.values());for(let e of i)e.isLeaf||(e.children=r(e.path));return i.sort((e,t)=>e.path===`SKILL.md`?-1:t.path===`SKILL.md`?1:e.isLeaf===t.isLeaf?e.label.localeCompare(t.label):e.isLeaf?1:-1)};return r(``)}var Xt=x({name:`FileNode`,components:{ExpandDownIcon:F,ExpandRightIcon:I,FontAwesomeIcon:Re},props:{node:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},skill:{type:Object,required:!0},depth:{type:Number,default:1}},emits:[`select-file`],data(){return{open:!0}},computed:{indent(){return 8+this.depth*16},isActive(){return this.node.isLeaf&&this.selectedSkillId===this.skill.id&&this.selectedPath===this.node.path}},methods:{isHtmlFile(e){return e.isLeaf&&e.path.toLowerCase().endsWith(`.html`)},iconFor(e){return e.isLeaf?Jt(e.path):B},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),Zt=[`aria-label`,`title`],Qt={key:1,class:`node-chevron-spacer`},$t={class:`node-label`},en={key:0,class:`children`};function tn(r,a,o,l,f,p){let h=d(`expand-down-icon`),g=d(`expand-right-icon`),x=d(`font-awesome-icon`),S=d(`file-node`,!0);return b(),c(`li`,null,[e(`div`,{class:n([`file-node`,{active:r.isActive}]),style:_({paddingLeft:r.indent+`px`}),onClick:a[1]||=(...e)=>r.onClick&&r.onClick(...e)},[r.node.isLeaf?(b(),c(`span`,Qt)):(b(),c(`button`,{key:0,class:`node-chevron`,"aria-label":r.$t(r.open?`common.button.collapse`:`common.button.expand`),title:r.$t(r.open?`common.button.collapse`:`common.button.expand`),onClick:a[0]||=t(e=>r.open=!r.open,[`stop`])},[r.open?(b(),m(h,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(b(),m(g,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,Zt)),r.isHtmlFile(r.node)?(b(),m(x,{key:2,icon:`fa-brands fa-html5`,class:`node-icon`})):(b(),m(y(r.iconFor(r.node)),{key:3,class:`node-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),e(`span`,$t,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(b(),c(`ul`,en,[(b(!0),c(u,null,v(r.node.children||[],e=>(b(),m(S,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:r.depth+1,onSelectFile:a[2]||=e=>r.$emit(`select-file`,e)},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`depth`]))),128))])):s(``,!0)])}var nn=x({name:`SkillRow`,components:{ExpandDownIcon:F,ExpandRightIcon:I,SkillIcon:le,FileNode:U(Xt,[[`render`,tn],[`__scopeId`,`data-v-5240087b`]])},props:{skill:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:[`toggle-expand`,`select-skill`,`select-file`],computed:{tree(){return Yt(this.skill.asset_bundle_files)},hasChildren(){return this.skill.asset_bundle_files.length>1},isSkillSelected(){return this.selectedSkillId===this.skill.id&&!this.selectedPath}},methods:{onSelectFile(e){this.$emit(`select-file`,this.skill,e)}}}),rn={class:`skill-row-wrapper`},an=[`aria-label`,`title`],on={key:1,class:`row-chevron-spacer`},sn=[`title`],cn={key:0,class:`file-list`};function ln(r,a,l,f,p,h){let g=d(`expand-down-icon`),_=d(`expand-right-icon`),y=d(`skill-icon`),x=d(`file-node`);return b(),c(`li`,rn,[e(`div`,{class:n([`skill-row`,{active:r.isSkillSelected}]),onClick:a[1]||=e=>r.$emit(`select-skill`,r.skill)},[r.hasChildren?(b(),c(`button`,{key:0,class:`row-chevron`,"aria-label":r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),title:r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),onClick:a[0]||=t(e=>r.$emit(`toggle-expand`,r.skill),[`stop`])},[r.expanded?(b(),m(g,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(b(),m(_,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,an)):(b(),c(`span`,on)),o(y,{class:`row-icon`,size:16,"aria-hidden":`true`,focusable:`false`}),e(`span`,{class:`row-label`,title:r.skill.name},i(r.skill.slug),9,sn)],2),r.expanded&&r.hasChildren?(b(),c(`ul`,cn,[(b(!0),c(u,null,v(r.tree,e=>(b(),m(x,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:1,onSelectFile:r.onSelectFile},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`onSelectFile`]))),128))])):s(``,!0)])}var un=U(nn,[[`render`,ln],[`__scopeId`,`data-v-231c2ce1`]]),dn=10*1024*1024,fn=/\.(tar\.gz|tgz|tar|zip|md)$/i,pn=x({name:`UploadSkillDialog`,components:{ElDialog:V,ElButton:J,AddFileIcon:We,CloudUploadIcon:Ve},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{file:null,isDragging:!1,uploading:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.uploading||this.$emit(`update:modelValue`,!1)},reset(){this.file=null,this.isDragging=!1;let e=this.$refs.fileInput;e&&(e.value=``)},humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},onPickFile(){this.uploading||this.$refs.fileInput?.click()},onFilePicked(e){let t=e.target.files?.[0]||null;this.acceptFile(t)},onDrop(e){this.isDragging=!1;let t=e.dataTransfer?.files?.[0]||null;this.acceptFile(t)},acceptFile(e){if(!e){this.file=null;return}if(e.size>dn){K.error(this.$t(`skill.message.fileTooLarge`));return}if(!fn.test(e.name)){K.error(this.$t(`skill.message.fileTypeWrong`));return}this.file=e},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.file){this.uploading=!0;try{if(/\.md$/i.test(this.file.name)){let e=await this.file.text(),{data:t}=await Z.createMarkdown({content:e});K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,t.id)}else{let{data:e}=await Z.createTarball(this.file);K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id)}this.$emit(`update:modelValue`,!1)}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.uploading=!1}}}}}),mn={key:0,class:`dropzone-hint`},hn={key:1,class:`dropzone-file`},gn={class:`dropzone-file-name`},_n={class:`dropzone-file-size`},vn={class:`requirements`},yn={class:`requirements-title`};function bn(a,s,l,u,f,p){let g=d(`add-file-icon`),_=d(`el-button`),v=d(`cloud-upload-icon`),y=d(`el-dialog`);return b(),m(y,{"model-value":a.modelValue,title:a.$t(`skill.dialog.uploadTitle`),width:`min(520px, 94vw)`,"align-center":``,"close-on-click-modal":!a.uploading,"close-on-press-escape":!a.uploading,"show-close":!a.uploading,"onUpdate:modelValue":a.onVisibleChange,onClosed:a.reset},{footer:h(()=>[o(_,{disabled:a.uploading,onClick:a.onClose},{default:h(()=>[r(i(a.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),o(_,{type:`primary`,loading:a.uploading,disabled:!a.file,onClick:a.onSubmit},{default:h(()=>[o(v,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:h(()=>[e(`input`,{ref:`fileInput`,type:`file`,accept:`.tar.gz,.tgz,.tar,.zip,.md,application/gzip,application/zip,application/x-tar,text/markdown`,hidden:``,onChange:s[0]||=(...e)=>a.onFilePicked&&a.onFilePicked(...e)},null,544),e(`div`,{class:n([`dropzone`,{"is-dragging":a.isDragging,"has-file":!!a.file}]),onClick:s[1]||=(...e)=>a.onPickFile&&a.onPickFile(...e),onDragover:s[2]||=t(e=>a.isDragging=!0,[`prevent`]),onDragleave:s[3]||=t(e=>a.isDragging=!1,[`prevent`]),onDrop:s[4]||=t((...e)=>a.onDrop&&a.onDrop(...e),[`prevent`])},[o(g,{class:`dropzone-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),a.file?(b(),c(`p`,hn,[e(`span`,gn,i(a.file.name),1),e(`span`,_n,i(a.humanSize(a.file.size)),1)])):(b(),c(`p`,mn,i(a.$t(`skill.dialog.uploadDrop`)),1))],34),e(`div`,vn,[e(`p`,yn,i(a.$t(`skill.dialog.fileRequirements`)),1),e(`ul`,null,[e(`li`,null,i(a.$t(`skill.dialog.requirementMd`)),1),e(`li`,null,i(a.$t(`skill.dialog.requirementArchive`)),1)])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var xn=U(pn,[[`render`,bn],[`__scopeId`,`data-v-01ead824`]]),Sn=x({name:`WriteSkillDialog`,components:{ElDialog:V,ElButton:J,ElInput:G,CloudUploadIcon:Ve},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{content:``,saving:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.saving||this.$emit(`update:modelValue`,!1)},reset(){this.content=``},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.content.trim()){this.saving=!0;try{let{data:e}=await Z.createMarkdown({content:this.content});K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id),this.$emit(`update:modelValue`,!1)}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.saving=!1}}}}}),Cn={class:`hint`};function wn(t,n,a,s,c,l){let u=d(`el-input`),f=d(`el-button`),p=d(`cloud-upload-icon`),g=d(`el-dialog`);return b(),m(g,{"model-value":t.modelValue,title:t.$t(`skill.dialog.writeTitle`),width:`min(720px, 94vw)`,"align-center":``,"close-on-click-modal":!t.saving,"close-on-press-escape":!t.saving,"show-close":!t.saving,"onUpdate:modelValue":t.onVisibleChange,onClosed:t.reset},{footer:h(()=>[o(f,{disabled:t.saving,onClick:t.onClose},{default:h(()=>[r(i(t.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),o(f,{type:`primary`,loading:t.saving,disabled:!t.content.trim(),onClick:t.onSubmit},{default:h(()=>[o(p,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:h(()=>[e(`p`,Cn,i(t.$t(`skill.dialog.writeHint`)),1),o(u,{modelValue:t.content,"onUpdate:modelValue":n[0]||=e=>t.content=e,type:`textarea`,rows:18,placeholder:t.$t(`skill.placeholder.content`),spellcheck:`false`,class:`editor`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var Tn=x({name:`UserSkills`,components:{ElInput:G,ElSwitch:j,ElTag:ge,ElTooltip:E,ElDropdown:k,ElDropdownMenu:O,ElDropdownItem:D,AddIcon:ce,AiCreateIcon:he,CloseIcon:_e,DeleteIcon:fe,ExpandDownIcon:F,ExpandRightIcon:I,HelpIcon:ee,MarketplaceIcon:ue,MoreIcon:re,SearchIcon:de,SkillIcon:le,UploadIcon:me,WriteIcon:te,BrowseSkillsDialog:Dt,SkillFilePreview:Gt,SkillRow:un,UploadSkillDialog:xn,WriteSkillDialog:U(Sn,[[`render`,wn],[`__scopeId`,`data-v-f39aab5d`]])},directives:{loading:W},data(){return{loading:!1,skills:[],togglingId:null,selectedSkillId:``,selectedPath:``,expandedSkillIds:[],personalOpen:!0,globalsOpen:!0,searchOpen:!1,searchQuery:``,uploadVisible:!1,writeVisible:!1,browseVisible:!1}},computed:{personalSkills(){return this.skills.filter(e=>e.source!==`global`)},globalSkills(){return this.skills.filter(e=>e.source===`global`)},filteredPersonal(){return this.applyFilter(this.personalSkills)},filteredGlobal(){return this.applyFilter(this.globalSkills)},selectedSkill(){return this.skills.find(e=>e.id===this.selectedSkillId)||null}},mounted(){this.fetchSkills()},methods:{applyFilter(e){let t=this.searchQuery.trim().toLowerCase();return t?e.filter(e=>e.slug.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)):e},async fetchSkills(){this.loading=!0;try{let{data:e}=await Z.list();if(this.skills=e||[],!this.selectedSkillId&&this.skills.length){let e=this.personalSkills[0]||this.skills[0];this.selectedSkillId=e.id}else this.selectedSkillId&&!this.skills.find(e=>e.id===this.selectedSkillId)&&(this.selectedSkillId=``,this.selectedPath=``)}catch(e){console.error(e),K.error(this.$t(`skill.message.loadFailed`))}finally{this.loading=!1}},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},selectSkill(e){this.selectedSkillId=e.id,this.selectedPath=``},selectFile(e,t){this.selectedSkillId=e.id,this.selectedPath=t},toggleExpand(e){let t=this.expandedSkillIds.indexOf(e.id);t>=0?this.expandedSkillIds.splice(t,1):this.expandedSkillIds.push(e.id)},openSearch(){this.searchOpen=!0,a(()=>{this.$refs.searchInput?.focus?.()})},closeSearch(){this.searchOpen=!1,this.searchQuery=``},openUpload(){this.uploadVisible=!0},openWrite(){this.writeVisible=!0},onBrowse(){this.browseVisible=!0},async onCreated(e){await this.fetchSkills();let t=this.skills.find(t=>t.id===e);t&&(this.selectedSkillId=t.id,this.selectedPath=``,this.personalOpen=!0)},async onSaveContent(e,t){if(!this.selectedSkill){t.reject();return}try{let{data:n}=await Z.update(this.selectedSkill.id,{content:e});K.success(this.$t(`skill.message.updateSuccess`));let r=this.skills.findIndex(e=>e.id===n.id);r>=0&&this.skills.splice(r,1,n),t.resolve()}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)})),t.reject(e)}},async onDelete(e){try{await we.confirm(this.$t(`skill.message.deleteConfirm`,{slug:e.slug}),this.$t(`skill.button.delete`),{type:`warning`})}catch{return}try{await Z.remove(e.id),K.success(this.$t(`skill.message.deleteSuccess`)),this.selectedSkillId===e.id&&(this.selectedSkillId=``,this.selectedPath=``),await this.fetchSkills()}catch(e){K.error(this.extractError(e))}},async onToggleSkill(e,t){this.togglingId=e.id;try{t?(await Z.enable(e.id),K.success(this.$t(`skill.message.enableSuccess`))):(await Z.disable(e.id),K.success(this.$t(`skill.message.disableSuccess`))),e.enabled=t}catch(e){K.error(this.extractError(e))}finally{this.togglingId=null}}}}),En={class:`page-shell`},Dn={class:`page-heading`},On={class:`page-title`},kn={class:`page-subtitle`},An={class:`skills-shell`},jn={class:`left-pane`},Mn={class:`left-header`},Nn={class:`left-actions`},Pn=[`aria-label`,`title`],Fn=[`aria-label`,`title`],In={class:`submenu-trigger`},Ln={class:`badge-soon`},Rn={key:0,class:`search-row`},zn=[`aria-label`,`title`],Bn={class:`left-body`},Vn={class:`section`},Hn={key:0,class:`skill-list`},Un={key:0,class:`empty-row`},Wn={key:0,class:`section`},Gn={key:0,class:`skill-list`},Kn={class:`right-pane`},qn={class:`right-header`},Jn={class:`right-title`},Yn={class:`right-actions`},Xn=[`aria-label`,`title`],Zn={class:`meta-card`},Qn={class:`meta-grid`},$n={class:`meta-cell`},er={class:`meta-label`},tr={class:`meta-value`},nr={class:`meta-cell`},rr={class:`meta-label`},ir={class:`meta-value`},ar={key:0,class:`meta-cell`},or={class:`meta-label`},sr={class:`meta-tags`},cr={key:0,class:`meta-description`},lr={class:`meta-description-label`},ur={class:`meta-label`},dr={class:`preview-card`},fr={key:2,class:`right-empty`};function pr(t,n,a,f,_,y){let x=d(`search-icon`),S=d(`add-icon`),C=d(`marketplace-icon`),w=d(`el-dropdown-item`),T=d(`expand-right-icon`),E=d(`ai-create-icon`),D=d(`write-icon`),O=d(`upload-icon`),k=d(`el-dropdown-menu`),A=d(`el-dropdown`),j=d(`el-input`),M=d(`close-icon`),N=d(`expand-down-icon`),P=d(`skill-row`),F=d(`el-switch`),I=d(`more-icon`),L=d(`delete-icon`),ee=d(`el-tag`),te=d(`help-icon`),ne=d(`el-tooltip`),R=d(`skill-file-preview`),re=d(`skill-icon`),ie=d(`upload-skill-dialog`),ae=d(`write-skill-dialog`),z=d(`browse-skills-dialog`),B=g(`loading`);return b(),c(`div`,En,[e(`div`,Dn,[e(`h2`,On,i(t.$t(`skill.title.skills`)),1),e(`p`,kn,i(t.$t(`skill.message.pageDescription`)),1)]),e(`div`,An,[e(`aside`,jn,[e(`header`,Mn,[e(`div`,Nn,[t.searchOpen?s(``,!0):(b(),c(`button`,{key:0,class:`icon-btn`,"aria-label":t.$t(`skill.button.search`),title:t.$t(`skill.button.search`),onClick:n[0]||=(...e)=>t.openSearch&&t.openSearch(...e)},[o(x,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Pn)),o(A,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:h(()=>[o(k,{class:`add-menu`},{default:h(()=>[o(w,{onClick:t.onBrowse},{default:h(()=>[o(C,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),o(w,{divided:``},{default:h(()=>[o(A,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:h(()=>[o(k,{class:`add-menu`},{default:h(()=>[o(w,{disabled:``},{default:h(()=>[o(E,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),e(`span`,Ln,i(t.$t(`skill.menu.soon`)),1)]),_:1}),o(w,{onClick:t.openWrite},{default:h(()=>[o(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),o(w,{onClick:t.openUpload},{default:h(()=>[o(O,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.upload`)),1)]),_:1},8,[`onClick`])]),_:1})]),default:h(()=>[e(`span`,In,[o(S,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),o(T,{class:`submenu-arrow`,size:14,"aria-hidden":`true`,focusable:`false`})])]),_:1})]),_:1})]),_:1})]),default:h(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.add`),title:t.$t(`skill.button.add`)},[o(S,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Fn)]),_:1})])]),t.searchOpen?(b(),c(`div`,Rn,[o(j,{ref:`searchInput`,modelValue:t.searchQuery,"onUpdate:modelValue":n[1]||=e=>t.searchQuery=e,class:`search-input`,size:`default`,placeholder:t.$t(`skill.placeholder.search`),onKeydown:l(t.closeSearch,[`escape`])},{prefix:h(()=>[o(x,{size:13,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`,`onKeydown`]),e(`button`,{class:`icon-btn icon-btn-sm`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:n[2]||=(...e)=>t.closeSearch&&t.closeSearch(...e)},[o(M,{size:14,"aria-hidden":`true`,focusable:`false`})],8,zn)])):s(``,!0),p((b(),c(`div`,Bn,[e(`section`,Vn,[e(`button`,{class:`section-header`,onClick:n[3]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(T,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.personal`)),1)]),t.personalOpen?(b(),c(`ul`,Hn,[!t.loading&&t.filteredPersonal.length===0?(b(),c(`li`,Un,i(t.searchQuery?t.$t(`skill.empty.search`):t.$t(`skill.message.noSkills`)),1)):s(``,!0),(b(!0),c(u,null,v(t.filteredPersonal,e=>(b(),m(P,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):s(``,!0)]),t.globalSkills.length>0?(b(),c(`section`,Wn,[e(`button`,{class:`section-header`,onClick:n[4]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(T,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.platform`)),1)]),t.globalsOpen?(b(),c(`ul`,Gn,[(b(!0),c(u,null,v(t.filteredGlobal,e=>(b(),m(P,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):s(``,!0)])):s(``,!0)])),[[B,t.loading]])]),e(`main`,Kn,[t.selectedSkill&&!t.selectedPath?(b(),c(u,{key:0},[e(`header`,qn,[e(`h3`,Jn,i(t.selectedSkill.slug),1),e(`div`,Yn,[o(F,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:n[5]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?s(``,!0):(b(),m(A,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:h(()=>[o(k,null,{default:h(()=>[o(w,{onClick:n[6]||=e=>t.onDelete(t.selectedSkill)},{default:h(()=>[o(L,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.delete`)),1)]),_:1})]),_:1})]),default:h(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.more`),title:t.$t(`skill.button.more`)},[o(I,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Xn)]),_:1}))])]),e(`div`,Zn,[e(`div`,Qn,[e(`div`,$n,[e(`span`,er,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,tr,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,nr,[e(`span`,rr,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,ir,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(b(),c(`div`,ar,[e(`span`,or,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,sr,[(b(!0),c(u,null,v(t.selectedSkill.required_connections,e=>(b(),m(ee,{key:e,size:`small`,type:`info`},{default:h(()=>[r(i(e),1)]),_:2},1024))),128))])])):s(``,!0)]),t.selectedSkill.description?(b(),c(`div`,cr,[e(`div`,lr,[e(`span`,ur,i(t.$t(`skill.field.description`)),1),t.selectedSkill.when_to_use?(b(),m(ne,{key:0,content:t.selectedSkill.when_to_use,placement:`top`},{default:h(()=>[o(te,{class:`meta-info-icon`,size:12,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`content`])):s(``,!0)]),e(`p`,null,i(t.selectedSkill.description),1)])):s(``,!0)]),e(`div`,dr,[(b(),m(R,{key:`${t.selectedSkill.id}:SKILL.md`,"skill-id":t.selectedSkill.id,path:`SKILL.md`,editable:t.selectedSkill.source===`upload`,onSave:t.onSaveContent},null,8,[`skill-id`,`editable`,`onSave`]))])],64)):t.selectedSkill&&t.selectedPath?(b(),m(R,{key:`${t.selectedSkill.id}:${t.selectedPath}`,"skill-id":t.selectedSkill.id,path:t.selectedPath,editable:!1},null,8,[`skill-id`,`path`])):(b(),c(`div`,fr,[o(re,{class:`right-empty-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.selectSkill`)),1)]))])]),o(ie,{modelValue:t.uploadVisible,"onUpdate:modelValue":n[7]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(ae,{modelValue:t.writeVisible,"onUpdate:modelValue":n[8]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(z,{modelValue:t.browseVisible,"onUpdate:modelValue":n[9]||=e=>t.browseVisible=e,onInstalled:t.onCreated},null,8,[`modelValue`,`onInstalled`])])}var mr=U(Tn,[[`render`,pr],[`__scopeId`,`data-v-da68d0c2`]]);export{mr as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,K as a,L as o,M as s,N as c,S as l,T as u,at as d,b as f,ht as p,j as m,mt as h,ot as g,qt as _,rt as v,st as y,tt as b,z as x}from"./vendor-chart-Dw-P17PN.js";import{r as S,t as C}from"./select-CaXJ36xG.js";import{n as w,t as T}from"./tabs-Cv60oJMx.js";import{t as E}from"./tooltip-kiynJmu_.js";import{n as D,r as O,t as k}from"./dropdown-DXoh2CnL.js";import{t as A}from"./pagination-DYnUbk8K.js";import{t as j}from"./switch-DGps_uPH.js";import{t as M}from"./arrow-down-Cq5K81XA.js";import{t as N}from"./arrow-left-BS9IzPRe.js";import{t as P}from"./book-open-RqJbNzPy.js";import{t as F}from"./chevron-down-Bo3W4e-Z.js";import{t as I}from"./chevron-right-7VFX4u3I.js";import{t as L}from"./circle-check-9HkCp0kN.js";import{t as ee}from"./circle-question-mark-Cl2Lm-5E.js";import{t as te}from"./clipboard-list-ilQQMwkX.js";import{t as ne}from"./code-9oBQJ6Kj.js";import{t as R}from"./copy-CIPzrXII.js";import{t as re}from"./ellipsis-CRlBlm5I.js";import{t as ie}from"./eye-DZkCrKJ_.js";import{t as ae}from"./file-text-B9gevd-U.js";import{t as z}from"./file-Yc-6a-e-.js";import{t as B}from"./folder-D28_V3sU.js";import{t as oe}from"./image-N4s0X2er.js";import{t as se}from"./lock-BePuXV1t.js";import{t as ce}from"./plus-CK2JFYNP.js";import{n as le,t as ue}from"./store-BHbgBPeW.js";import{t as de}from"./search-7Ly3KYfT.js";import{t as fe}from"./trash-2-NVpkdW0R.js";import{t as pe}from"./triangle-alert-DNESykEp.js";import{t as me}from"./upload-B3hX6Wjm.js";import{t as he}from"./wand-sparkles-Dhrc68i4.js";import{Ai as V,Ci as H,E as U,Ei as W,Ji as G,Li as ge,Si as _e,Ti as K,bi as ve,fi as ye,gi as be,gr as q,hi as xe,mi as Se,ui as Ce,wi as we,zi as J}from"./index-tKADgCY9.js";import{a as Te,c as Ee,d as De,f as Oe,i as ke,l as Ae,m as Y,n as je,o as Me,p as Ne,r as Pe,s as Fe,t as Ie,u as Le}from"./vendor-highlight-BHrfT4-E.js";import{t as Re}from"./index.es-DpUSIKd4.js";import{t as ze}from"./VueMarkdown-CiiRjbWs.js";var Be=H(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Ve=H(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),He=H(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),Ue=H(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),We=H(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),X=()=>({baseURL:`${Ce()}/api/v1`}),Z=new class{key=`skills/installed`;async list(){return q.get(`/${this.key}/`,X())}async get(e){return q.get(`/${this.key}/${e}/`,X())}async createMarkdown(e){return q.post(`/${this.key}/`,e,X())}async createTarball(e){let t=new FormData;return t.append(`tarball`,e),q.post(`/${this.key}/`,t,{...X(),headers:{"Content-Type":`multipart/form-data`}})}async update(e,t){return q.patch(`/${this.key}/${e}/`,t,X())}async remove(e){return q.delete(`/${this.key}/${e}/`,X())}async enable(e){return q.post(`/${this.key}/${e}/enable/`,void 0,X())}async disable(e){return q.post(`/${this.key}/${e}/disable/`,void 0,X())}async fetchFile(e,t){let n=await q.get(`/${this.key}/${e}/files/`,{...X(),params:{path:t},responseType:`arraybuffer`}),r=n.headers[`content-type`]||`application/octet-stream`;return{blob:new Blob([n.data],{type:r}),contentType:r}}},Q=new class{key=`skills`;async list(e={}){return q.get(`/${this.key}/`,{...X(),params:e})}async get(e){return q.get(`/${this.key}/${e}/`,X())}async categories(){return q.get(`/${this.key}/categories/`,X())}async install(e,t={}){return q.post(`/${this.key}/${e}/install/`,t,X())}};function Ge(){let e=new Set;xe()&&e.add(`desktop`),be()&&e.add(`ios`),Se()&&e.add(`android`),ve()&&e.add(`web`);let t=ye();if(t===`mac`)e.add(`mac`);else if(t===`windows`)e.add(`windows`);else if(typeof navigator<`u`){let t=navigator.userAgent||``,n=navigator.userAgentData?.platform,r=/macintosh/i.test(t)&&(navigator.maxTouchPoints||0)>1;!be()&&!r&&(n===`macOS`||/mac os x|macintosh/i.test(t))&&e.add(`mac`),(n===`Windows`||/windows nt/i.test(t))&&e.add(`windows`)}return e}var Ke=new Set([`mac`,`windows`,`desktop`,`web`,`ios`,`android`]);function qe(e){let t=e.filter(e=>Ke.has(e));if(!t.length)return!0;let n=Ge();return t.some(e=>n.has(e))}Y.registerLanguage(`bash`,Ne),Y.registerLanguage(`json`,Oe),Y.registerLanguage(`markdown`,De),Y.registerLanguage(`python`,Le),Y.registerLanguage(`shell`,Ae),Y.registerLanguage(`yaml`,Ee),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var Je=12,Ye=x({name:`BrowseSkillsDialog`,components:{VueMarkdown:ze,ElDialog:V,ElInput:G,ElButton:J,ElPagination:A,ElSelect:S,ElOption:C,FontAwesomeIcon:Re,AddIcon:ce,BackIcon:N,DownIcon:M,InstallIcon:Be,LockIcon:se,SearchIcon:de,SuccessIcon:L},directives:{loading:W},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`installed`],data(){return{loading:!1,installing:!1,items:[],total:0,currentPage:1,searchQuery:``,namespaceFilter:``,sortBy:`popular`,selectedItem:null,searchTimer:null,knownNamespaces:[],publisherByNamespace:{}}},computed:{pageSize(){return Je},namespaceOptions(){let e=new Set(this.knownNamespaces);for(let t of this.items)e.add(t.namespace);return Array.from(e).sort().map(e=>({value:e,label:this.publisherForNamespace(e)}))},detailBody(){return this.selectedItem?this.selectedItem.content.replace(/^---\n[\s\S]*?\n---\n?/,``):``}},methods:{onOpen(){this.selectedItem=null,this.searchQuery=``,this.namespaceFilter=``,this.sortBy=`popular`,this.currentPage=1,this.knownNamespaces=[],this.publisherByNamespace={},this.loadFacets(),this.reload()},openDetail(e){this.selectedItem=e},async loadFacets(){try{let{data:e}=await Q.categories(),t=new Set;for(let n of e.namespaces)t.add(n.namespace);this.knownNamespaces=Array.from(t).sort()}catch(e){console.warn(`failed to load skill catalog facets`,e)}},reloadFromFirstPage(){this.currentPage=1,this.reload()},onPageChange(e){this.currentPage=e,this.reload(),this.$nextTick(()=>{let e=this.$el.querySelector(`.directory-grid-wrapper`);e&&(e.scrollTop=0)})},onSearchInput(){this.searchTimer!==null&&window.clearTimeout(this.searchTimer),this.searchTimer=window.setTimeout(()=>{this.searchTimer=null,this.reloadFromFirstPage()},250)},async reload(){this.loading=!0;try{let{data:e}=await Q.list({q:this.searchQuery.trim()||void 0,namespace:this.namespaceFilter||void 0,sort:this.sortBy,limit:this.pageSize,offset:(this.currentPage-1)*this.pageSize});this.items=e.items,this.total=e.total;for(let t of e.items)t.publisher&&(this.publisherByNamespace[t.namespace]=t.publisher)}catch(e){console.error(e),K.error(this.$t(`skill.directory.loadFailed`))}finally{this.loading=!1}},async onInstall(e){if(!this.installing&&!e.installed){if(!this.canInstallOnSurface(e)){K.warning(this.$t(`skill.directory.surfaceBlocked`,{platforms:this.surfaceLabels(e)}));return}this.installing=!0;try{let{data:t}=await Q.install(e.id);K.success(this.$t(`skill.directory.installSuccess`,{name:e.slug})),this.$emit(`installed`,t.id),e.installed=!0,e.install_count+=1}catch(t){let n=this.extractError(t);n.includes(`already exists`)?(e.installed=!0,K.warning(this.$t(`skill.directory.alreadyInstalled`,{name:e.slug}))):K.error(this.$t(`skill.directory.installFailed`,{detail:n}))}finally{this.installing=!1}}},extractError(e){return e?.response?.data?.detail||String(e)||`unknown error`},formatCount(e){return e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)},publisherForNamespace(e){if(this.publisherByNamespace[e])return this.publisherByNamespace[e];let t=this.items.find(t=>t.namespace===e);return t?t.publisher:e},restrictedSurfaces(e){let t=e.frontmatter?.surfaces;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim().toLowerCase()):[]},surfaceLabel(e){let t=`skill.directory.surface.${e}`,n=this.$t(t);return n===t?e:n},surfaceLabels(e){return this.restrictedSurfaces(e).map(e=>this.surfaceLabel(e)).join(` / `)},canInstallOnSurface(e){return qe(this.restrictedSurfaces(e))}}}),Xe={class:`directory`},Ze={class:`directory-main`},Qe={class:`directory-header`},$e={class:`directory-controls`},et={class:`directory-grid-wrapper`},tt={key:0,class:`directory-empty`},nt={key:1,class:`directory-grid`},rt=[`onClick`],it={class:`directory-card-head`},at={class:`directory-card-title`},ot=[`title`],st=[`title`],ct=[`aria-label`,`title`,`onClick`],lt=[`title`],ut={class:`directory-card-meta`},dt={class:`directory-card-publisher`},ft={key:0,class:`directory-card-count`},pt=[`title`],mt={class:`directory-card-desc`},ht={key:0,class:`directory-footer`},gt={class:`directory-detail-head`},_t={class:`directory-detail-actions`},vt=[`href`],yt={class:`directory-detail-body`},bt={class:`directory-detail-title`},xt={class:`directory-detail-meta`},St={key:0},Ct={key:1},wt=[`title`],Tt={class:`directory-detail-desc`};function Et(a,l,f,_,y,x){let S=d(`search-icon`),C=d(`el-input`),w=d(`el-option`),T=d(`el-select`),E=d(`success-icon`),D=d(`lock-icon`),O=d(`add-icon`),k=d(`down-icon`),A=d(`el-pagination`),j=d(`back-icon`),M=d(`font-awesome-icon`),N=d(`el-button`),P=d(`install-icon`),F=d(`vue-markdown`),I=d(`el-dialog`),L=g(`loading`);return b(),m(I,{"model-value":a.modelValue,title:a.$t(`skill.dialog.directoryTitle`),width:`min(960px, 94vw)`,"align-center":``,class:`directory-dialog`,"close-on-click-modal":!a.installing,"show-close":!a.installing,"onUpdate:modelValue":l[5]||=e=>a.$emit(`update:modelValue`,e),onOpen:a.onOpen},{default:h(()=>[e(`div`,Xe,[e(`main`,Ze,[a.selectedItem?(b(),c(u,{key:1},[e(`header`,gt,[e(`button`,{class:`directory-back-btn`,onClick:l[3]||=e=>a.selectedItem=null},[o(j,{size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.back`)),1)]),e(`div`,_t,[a.selectedItem.source_url?(b(),c(`a`,{key:0,href:a.selectedItem.source_url,target:`_blank`,class:`directory-link`},[o(M,{icon:`fa-brands fa-github`}),r(` `+i(a.$t(`skill.directory.viewSource`)),1)],8,vt)):s(``,!0),a.selectedItem.installed?(b(),m(N,{key:1,disabled:``,type:`success`,plain:``},{default:h(()=>[o(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.installed`)),1)]),_:1})):a.selectedItem.installable&&!a.canInstallOnSurface(a.selectedItem)?(b(),m(N,{key:2,disabled:``,title:a.$t(`skill.directory.surfaceBlocked`,{platforms:a.surfaceLabels(a.selectedItem)})},{default:h(()=>[o(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.surfaceUnavailable`)),1)]),_:1},8,[`title`])):a.selectedItem.installable?(b(),m(N,{key:3,type:`primary`,loading:a.installing,onClick:l[4]||=e=>a.onInstall(a.selectedItem)},{default:h(()=>[o(P,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.directory.install`)),1)]),_:1},8,[`loading`])):(b(),m(N,{key:4,disabled:``,title:a.selectedItem.license},{default:h(()=>[o(D,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.selectedItem.license||a.$t(`skill.directory.notInstallable`)),1)]),_:1},8,[`title`]))])]),e(`div`,yt,[e(`h2`,bt,`/`+i(a.selectedItem.slug),1),e(`div`,xt,[e(`span`,null,[e(`strong`,null,i(a.$t(`skill.meta.addedBy`))+`:`,1),r(` `+i(a.selectedItem.publisher),1)]),a.selectedItem.license?(b(),c(`span`,St,[e(`strong`,null,i(a.$t(`skill.directory.license`))+`:`,1),r(` `+i(a.selectedItem.license),1)])):s(``,!0),a.selectedItem.version?(b(),c(`span`,Ct,`v`+i(a.selectedItem.version),1)):s(``,!0),a.surfaceLabels(a.selectedItem)?(b(),c(`span`,{key:2,class:`directory-detail-surface`,title:a.$t(`skill.directory.surfaceHint`)},i(a.$t(`skill.directory.surfaceOnly`,{platforms:a.surfaceLabels(a.selectedItem)})),9,wt)):s(``,!0)]),e(`p`,Tt,i(a.selectedItem.description),1),o(F,{class:`directory-detail-content`,source:a.detailBody,sanitize:``},null,8,[`source`])])],64)):(b(),c(u,{key:0},[e(`header`,Qe,[o(C,{modelValue:a.searchQuery,"onUpdate:modelValue":l[0]||=e=>a.searchQuery=e,class:`directory-search`,size:`default`,clearable:``,placeholder:a.$t(`skill.directory.searchPlaceholder`),onInput:a.onSearchInput},{prefix:h(()=>[o(S,{size:14,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`,`onInput`]),e(`div`,$e,[o(T,{modelValue:a.namespaceFilter,"onUpdate:modelValue":l[1]||=e=>a.namespaceFilter=e,class:`directory-select`,placeholder:a.$t(`skill.directory.allPublishers`),clearable:``,size:`default`,onChange:a.reloadFromFirstPage},{default:h(()=>[(b(!0),c(u,null,v(a.namespaceOptions,e=>(b(),m(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),o(T,{modelValue:a.sortBy,"onUpdate:modelValue":l[2]||=e=>a.sortBy=e,class:`directory-select directory-select-sm`,size:`default`,onChange:a.reloadFromFirstPage},{default:h(()=>[o(w,{label:a.$t(`skill.directory.sort.popular`),value:`popular`},null,8,[`label`]),o(w,{label:a.$t(`skill.directory.sort.recent`),value:`recent`},null,8,[`label`]),o(w,{label:a.$t(`skill.directory.sort.name`),value:`name`},null,8,[`label`])]),_:1},8,[`modelValue`,`onChange`])])]),p((b(),c(`div`,et,[!a.loading&&a.total===0?(b(),c(`p`,tt,i(a.$t(`skill.directory.empty`)),1)):(b(),c(`div`,nt,[(b(!0),c(u,null,v(a.items,l=>(b(),c(`article`,{key:l.id,class:n([`directory-card`,{"is-installed":l.installed}]),onClick:e=>a.openDetail(l)},[e(`div`,it,[e(`span`,at,`/`+i(l.slug),1),l.installed?(b(),c(`span`,{key:0,class:`directory-card-action is-installed`,title:a.$t(`skill.directory.installed`)},[o(E,{size:16,"aria-hidden":`true`,focusable:`false`})],8,ot)):l.installable&&!a.canInstallOnSurface(l)?(b(),c(`span`,{key:1,class:`directory-card-locked`,title:a.$t(`skill.directory.surfaceBlocked`,{platforms:a.surfaceLabels(l)})},[o(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,st)):l.installable?(b(),c(`button`,{key:2,class:`directory-card-action`,"aria-label":a.$t(`skill.directory.install`),title:a.$t(`skill.directory.install`),onClick:t(e=>a.onInstall(l),[`stop`])},[o(O,{size:16,"aria-hidden":`true`,focusable:`false`})],8,ct)):(b(),c(`span`,{key:3,class:`directory-card-locked`,title:l.license},[o(D,{size:16,"aria-hidden":`true`,focusable:`false`})],8,lt))]),e(`div`,ut,[e(`span`,dt,i(l.publisher),1),l.install_count>0?(b(),c(`span`,ft,[o(k,{size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.formatCount(l.install_count)),1)])):s(``,!0),a.surfaceLabels(l)?(b(),c(`span`,{key:1,class:`directory-card-surface`,title:a.$t(`skill.directory.surfaceHint`)},i(a.surfaceLabels(l)),9,pt)):s(``,!0)]),e(`p`,mt,i(l.description),1)],10,rt))),128))]))])),[[L,a.loading]]),a.total>a.pageSize?(b(),c(`footer`,ht,[o(A,{"current-page":a.currentPage,"page-size":a.pageSize,total:a.total,"pager-count":5,background:``,layout:`prev, pager, next, total`,onCurrentChange:a.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onCurrentChange`])])):s(``,!0)],64))])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`show-close`,`onOpen`])}var Dt=U(Ye,[[`render`,Et],[`__scopeId`,`data-v-d346d23f`]]);Y.registerLanguage(`bash`,Ne),Y.registerLanguage(`css`,Fe),Y.registerLanguage(`go`,Me),Y.registerLanguage(`javascript`,Te),Y.registerLanguage(`json`,Oe),Y.registerLanguage(`markdown`,De),Y.registerLanguage(`python`,Le),Y.registerLanguage(`rust`,ke),Y.registerLanguage(`shell`,Ae),Y.registerLanguage(`sql`,Pe),Y.registerLanguage(`typescript`,je),Y.registerLanguage(`xml`,Ie),Y.registerLanguage(`html`,Ie),Y.registerLanguage(`yaml`,Ee),Y.registerAliases([`yml`],{languageName:`yaml`}),Y.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),Y.registerAliases([`js`,`jsx`],{languageName:`javascript`}),Y.registerAliases([`py`],{languageName:`python`}),Y.registerAliases([`rs`],{languageName:`rust`}),Y.registerAliases([`sh`,`zsh`],{languageName:`bash`});var $=1e6;function Ot(e,t){let n=(e.split(`.`).pop()||``).toLowerCase();return n===`md`||t.startsWith(`text/markdown`)?`markdown`:n===`html`||n===`htm`||t.startsWith(`text/html`)?`html`:t.startsWith(`image/`)||[`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`].includes(n)?`image`:t.startsWith(`text/`)||[`json`,`application/json`].includes(t.split(`;`)[0])?n?`code`:`text`:`binary`}function kt(e){let t=(e.split(`.`).pop()||``).toLowerCase();return Y.getLanguage(t)?t:`plain`}var At=x({name:`SkillFilePreview`,components:{ElButton:J,ElTooltip:E,ElTabs:w,ElTabPane:T,CodeIcon:ne,CopyIcon:R,FileIcon:z,SaveIcon:Ue,ViewIcon:ie,WarningIcon:pe,VueMarkdown:ze},directives:{loading:W},props:{skillId:{type:String,required:!0},path:{type:String,required:!0},editable:{type:Boolean,default:!1}},emits:[`save`],data(){return{MAX_PREVIEW_BYTES:$,loading:!1,error:``,contentType:``,size:0,textContent:``,imageUrl:``,truncated:!1,viewMode:`rendered`,dirty:!1,saving:!1}},computed:{kind(){return this.path?Ot(this.path,this.contentType):`text`},canRender(){return this.kind===`markdown`||this.kind===`html`},hljsLang(){return`language-${kt(this.path)}`},truncatedText(){return this.textContent}},watch:{path:{handler(){this.fetch()},immediate:!0}},beforeUnmount(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl)},methods:{humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},async fetch(){if(this.path){this.loading=!0,this.error=``,this.textContent=``,this.truncated=!1,this.dirty=!1,this.imageUrl&&=(URL.revokeObjectURL(this.imageUrl),``);try{let{blob:e,contentType:t}=await Z.fetchFile(this.skillId,this.path);this.contentType=t,this.size=e.size;let n=Ot(this.path,t);if(n===`image`)this.imageUrl=URL.createObjectURL(e);else if(n!==`binary`){let t=await e.text();t.length>$&&(t=t.slice(0,$),this.truncated=!0),this.textContent=t,this.viewMode=n===`markdown`||n===`html`?`rendered`:`source`}}catch(e){let t=e,n=t?.response?.status,r=t?.response?.data?.detail||String(e);this.error=n?`(${n}) ${r}`:r}finally{this.loading=!1,this.$nextTick(()=>this.applyHighlight())}}},applyHighlight(){let e=this.$refs.codeEl;e&&this.kind===`code`&&this.viewMode!==`rendered`&&(delete e.dataset.highlighted,Y.highlightElement(e))},async onCopy(){if(this.textContent)try{await navigator.clipboard.writeText(this.textContent),K.success(this.$t(`skill.preview.copied`))}catch{K.error(this.$t(`skill.preview.copyFailed`))}},async onSave(){this.saving=!0;try{await new Promise((e,t)=>{this.$emit(`save`,this.textContent,{resolve:e,reject:t})}),this.dirty=!1}catch{}finally{this.saving=!1}}}}),jt={class:`preview-root`},Mt={class:`toolbar`},Nt={class:`path-display`},Pt={key:0,class:`size-display`},Ft={class:`body`},It={key:0,class:`error`},Lt=[`srcdoc`],Rt={key:3,class:`image-pane`},zt=[`src`,`alt`],Bt={key:4,class:`binary`},Vt=[`placeholder`],Ht={key:6,class:`source-pane`},Ut={key:7,class:`truncated-warning`};function Wt(t,a,l,u,_,v){let y=d(`save-icon`),x=d(`el-button`),S=d(`copy-icon`),C=d(`el-tooltip`),w=d(`view-icon`),T=d(`el-tab-pane`),E=d(`code-icon`),D=d(`el-tabs`),O=d(`warning-icon`),k=d(`vue-markdown`),A=d(`file-icon`),j=g(`loading`);return p((b(),c(`div`,jt,[e(`div`,Mt,[e(`span`,Nt,i(t.path||`—`),1),t.size?(b(),c(`span`,Pt,i(t.humanSize(t.size)),1)):s(``,!0),a[3]||=e(`span`,{class:`toolbar-spacer`},null,-1),t.editable?(b(),m(x,{key:1,type:`primary`,size:`small`,disabled:!t.dirty||t.saving,loading:t.saving,onClick:t.onSave},{default:h(()=>[o(y,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.save`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])):s(``,!0),o(C,{content:t.$t(`skill.preview.copy`),placement:`bottom`},{default:h(()=>[o(x,{size:`small`,circle:``,disabled:!t.textContent,"aria-label":t.$t(`skill.preview.copy`),title:t.$t(`skill.preview.copy`),onClick:t.onCopy},{default:h(()=>[o(S,{size:16,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`disabled`,`aria-label`,`title`,`onClick`])]),_:1},8,[`content`])]),t.canRender?(b(),m(D,{key:0,modelValue:t.viewMode,"onUpdate:modelValue":a[0]||=e=>t.viewMode=e,class:`view-tabs`},{default:h(()=>[o(T,{name:`rendered`},{label:h(()=>[o(w,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewRendered`)),1)]),_:1}),o(T,{name:`source`},{label:h(()=>[o(E,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.preview.viewSource`)),1)]),_:1})]),_:1},8,[`modelValue`])):s(``,!0),e(`div`,Ft,[t.error?(b(),c(`div`,It,[o(O,{class:`mr-2`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.error),1)])):t.kind===`markdown`&&t.viewMode===`rendered`?(b(),m(k,{key:1,class:`markdown-rendered`,source:t.textContent,sanitize:``},null,8,[`source`])):t.kind===`html`&&t.viewMode===`rendered`?(b(),c(`iframe`,{key:2,ref:`htmlFrame`,class:`html-frame`,sandbox:``,srcdoc:t.textContent},null,8,Lt)):t.kind===`image`?(b(),c(`div`,Rt,[e(`img`,{src:t.imageUrl,alt:t.path,class:`image-content`},null,8,zt)])):t.kind===`binary`?(b(),c(`div`,Bt,[o(A,{class:`binary-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.binary`,{type:t.contentType})),1)])):t.editable?p((b(),c(`textarea`,{key:5,"onUpdate:modelValue":a[1]||=e=>t.textContent=e,class:`source-editor`,spellcheck:`false`,placeholder:t.$t(`skill.placeholder.content`),onInput:a[2]||=e=>t.dirty=!0},null,40,Vt)),[[f,t.textContent]]):(b(),c(`pre`,Ht,[e(`code`,{ref:`codeEl`,class:n(t.hljsLang)},i(t.truncatedText),3)])),t.truncated?(b(),c(`p`,Ut,i(t.$t(`skill.preview.truncated`,{size:t.humanSize(t.MAX_PREVIEW_BYTES)})),1)):s(``,!0)])])),[[j,t.loading]])}var Gt=U(At,[[`render`,Wt],[`__scopeId`,`data-v-ec0a447e`]]),Kt=new Set([`py`,`ts`,`tsx`,`js`,`jsx`,`json`,`yaml`,`yml`,`sh`,`bash`,`zsh`,`css`,`html`,`sql`,`go`,`rs`,`rb`,`java`,`cpp`,`c`,`h`,`toml`]),qt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function Jt(e){let t=e.split(`/`).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();return t===`SKILL.md`?P:n===`md`?ae:qt.has(n)?oe:Kt.has(n)?He:z}function Yt(e){let t=new Map;t.set(``,new Map);let n=(e,n)=>{let r=t.get(e);r||(r=new Map,t.set(e,r));let i=e?`${e}/${n}`:n,a=r.get(n);return a||(a={label:n,path:i,isLeaf:!1,children:[]},r.set(n,a),t.set(i,new Map)),a};for(let r of e){let e=r.split(`/`).filter(Boolean);if(e.length===0)continue;let i=e[e.length-1],a=e.slice(0,-1),o=``;for(let e of a)o=n(o,e).path;let s={label:i,path:r,isLeaf:!0},c=t.get(o);c||(c=new Map,t.set(o,c)),c.set(i,s)}let r=e=>{let n=t.get(e);if(!n)return[];let i=Array.from(n.values());for(let e of i)e.isLeaf||(e.children=r(e.path));return i.sort((e,t)=>e.path===`SKILL.md`?-1:t.path===`SKILL.md`?1:e.isLeaf===t.isLeaf?e.label.localeCompare(t.label):e.isLeaf?1:-1)};return r(``)}var Xt=x({name:`FileNode`,components:{ExpandDownIcon:F,ExpandRightIcon:I,FontAwesomeIcon:Re},props:{node:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},skill:{type:Object,required:!0},depth:{type:Number,default:1}},emits:[`select-file`],data(){return{open:!0}},computed:{indent(){return 8+this.depth*16},isActive(){return this.node.isLeaf&&this.selectedSkillId===this.skill.id&&this.selectedPath===this.node.path}},methods:{isHtmlFile(e){return e.isLeaf&&e.path.toLowerCase().endsWith(`.html`)},iconFor(e){return e.isLeaf?Jt(e.path):B},onClick(){this.node.isLeaf?this.$emit(`select-file`,this.node.path):this.open=!this.open}}}),Zt=[`aria-label`,`title`],Qt={key:1,class:`node-chevron-spacer`},$t={class:`node-label`},en={key:0,class:`children`};function tn(r,a,o,l,f,p){let h=d(`expand-down-icon`),g=d(`expand-right-icon`),x=d(`font-awesome-icon`),S=d(`file-node`,!0);return b(),c(`li`,null,[e(`div`,{class:n([`file-node`,{active:r.isActive}]),style:_({paddingLeft:r.indent+`px`}),onClick:a[1]||=(...e)=>r.onClick&&r.onClick(...e)},[r.node.isLeaf?(b(),c(`span`,Qt)):(b(),c(`button`,{key:0,class:`node-chevron`,"aria-label":r.$t(r.open?`common.button.collapse`:`common.button.expand`),title:r.$t(r.open?`common.button.collapse`:`common.button.expand`),onClick:a[0]||=t(e=>r.open=!r.open,[`stop`])},[r.open?(b(),m(h,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(b(),m(g,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,Zt)),r.isHtmlFile(r.node)?(b(),m(x,{key:2,icon:`fa-brands fa-html5`,class:`node-icon`})):(b(),m(y(r.iconFor(r.node)),{key:3,class:`node-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})),e(`span`,$t,i(r.node.label),1)],6),!r.node.isLeaf&&r.open?(b(),c(`ul`,en,[(b(!0),c(u,null,v(r.node.children||[],e=>(b(),m(S,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:r.depth+1,onSelectFile:a[2]||=e=>r.$emit(`select-file`,e)},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`depth`]))),128))])):s(``,!0)])}var nn=x({name:`SkillRow`,components:{ExpandDownIcon:F,ExpandRightIcon:I,SkillIcon:le,FileNode:U(Xt,[[`render`,tn],[`__scopeId`,`data-v-5240087b`]])},props:{skill:{type:Object,required:!0},selectedSkillId:{type:String,required:!0},selectedPath:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:[`toggle-expand`,`select-skill`,`select-file`],computed:{tree(){return Yt(this.skill.asset_bundle_files)},hasChildren(){return this.skill.asset_bundle_files.length>1},isSkillSelected(){return this.selectedSkillId===this.skill.id&&!this.selectedPath}},methods:{onSelectFile(e){this.$emit(`select-file`,this.skill,e)}}}),rn={class:`skill-row-wrapper`},an=[`aria-label`,`title`],on={key:1,class:`row-chevron-spacer`},sn=[`title`],cn={key:0,class:`file-list`};function ln(r,a,l,f,p,h){let g=d(`expand-down-icon`),_=d(`expand-right-icon`),y=d(`skill-icon`),x=d(`file-node`);return b(),c(`li`,rn,[e(`div`,{class:n([`skill-row`,{active:r.isSkillSelected}]),onClick:a[1]||=e=>r.$emit(`select-skill`,r.skill)},[r.hasChildren?(b(),c(`button`,{key:0,class:`row-chevron`,"aria-label":r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),title:r.$t(r.expanded?`common.button.collapse`:`common.button.expand`),onClick:a[0]||=t(e=>r.$emit(`toggle-expand`,r.skill),[`stop`])},[r.expanded?(b(),m(g,{key:0,size:14,"aria-hidden":`true`,focusable:`false`})):(b(),m(_,{key:1,size:14,"aria-hidden":`true`,focusable:`false`}))],8,an)):(b(),c(`span`,on)),o(y,{class:`row-icon`,size:16,"aria-hidden":`true`,focusable:`false`}),e(`span`,{class:`row-label`,title:r.skill.name},i(r.skill.slug),9,sn)],2),r.expanded&&r.hasChildren?(b(),c(`ul`,cn,[(b(!0),c(u,null,v(r.tree,e=>(b(),m(x,{key:e.path,node:e,"selected-skill-id":r.selectedSkillId,"selected-path":r.selectedPath,skill:r.skill,depth:1,onSelectFile:r.onSelectFile},null,8,[`node`,`selected-skill-id`,`selected-path`,`skill`,`onSelectFile`]))),128))])):s(``,!0)])}var un=U(nn,[[`render`,ln],[`__scopeId`,`data-v-231c2ce1`]]),dn=10*1024*1024,fn=/\.(tar\.gz|tgz|tar|zip|md)$/i,pn=x({name:`UploadSkillDialog`,components:{ElDialog:V,ElButton:J,AddFileIcon:We,CloudUploadIcon:Ve},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{file:null,isDragging:!1,uploading:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.uploading||this.$emit(`update:modelValue`,!1)},reset(){this.file=null,this.isDragging=!1;let e=this.$refs.fileInput;e&&(e.value=``)},humanSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`},onPickFile(){this.uploading||this.$refs.fileInput?.click()},onFilePicked(e){let t=e.target.files?.[0]||null;this.acceptFile(t)},onDrop(e){this.isDragging=!1;let t=e.dataTransfer?.files?.[0]||null;this.acceptFile(t)},acceptFile(e){if(!e){this.file=null;return}if(e.size>dn){K.error(this.$t(`skill.message.fileTooLarge`));return}if(!fn.test(e.name)){K.error(this.$t(`skill.message.fileTypeWrong`));return}this.file=e},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.file){this.uploading=!0;try{if(/\.md$/i.test(this.file.name)){let e=await this.file.text(),{data:t}=await Z.createMarkdown({content:e});K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,t.id)}else{let{data:e}=await Z.createTarball(this.file);K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id)}this.$emit(`update:modelValue`,!1)}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.uploading=!1}}}}}),mn={key:0,class:`dropzone-hint`},hn={key:1,class:`dropzone-file`},gn={class:`dropzone-file-name`},_n={class:`dropzone-file-size`},vn={class:`requirements`},yn={class:`requirements-title`};function bn(a,s,l,u,f,p){let g=d(`add-file-icon`),_=d(`el-button`),v=d(`cloud-upload-icon`),y=d(`el-dialog`);return b(),m(y,{"model-value":a.modelValue,title:a.$t(`skill.dialog.uploadTitle`),width:`min(520px, 94vw)`,"align-center":``,"close-on-click-modal":!a.uploading,"close-on-press-escape":!a.uploading,"show-close":!a.uploading,"onUpdate:modelValue":a.onVisibleChange,onClosed:a.reset},{footer:h(()=>[o(_,{disabled:a.uploading,onClick:a.onClose},{default:h(()=>[r(i(a.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),o(_,{type:`primary`,loading:a.uploading,disabled:!a.file,onClick:a.onSubmit},{default:h(()=>[o(v,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(a.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:h(()=>[e(`input`,{ref:`fileInput`,type:`file`,accept:`.tar.gz,.tgz,.tar,.zip,.md,application/gzip,application/zip,application/x-tar,text/markdown`,hidden:``,onChange:s[0]||=(...e)=>a.onFilePicked&&a.onFilePicked(...e)},null,544),e(`div`,{class:n([`dropzone`,{"is-dragging":a.isDragging,"has-file":!!a.file}]),onClick:s[1]||=(...e)=>a.onPickFile&&a.onPickFile(...e),onDragover:s[2]||=t(e=>a.isDragging=!0,[`prevent`]),onDragleave:s[3]||=t(e=>a.isDragging=!1,[`prevent`]),onDrop:s[4]||=t((...e)=>a.onDrop&&a.onDrop(...e),[`prevent`])},[o(g,{class:`dropzone-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),a.file?(b(),c(`p`,hn,[e(`span`,gn,i(a.file.name),1),e(`span`,_n,i(a.humanSize(a.file.size)),1)])):(b(),c(`p`,mn,i(a.$t(`skill.dialog.uploadDrop`)),1))],34),e(`div`,vn,[e(`p`,yn,i(a.$t(`skill.dialog.fileRequirements`)),1),e(`ul`,null,[e(`li`,null,i(a.$t(`skill.dialog.requirementMd`)),1),e(`li`,null,i(a.$t(`skill.dialog.requirementArchive`)),1)])])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var xn=U(pn,[[`render`,bn],[`__scopeId`,`data-v-01ead824`]]),Sn=x({name:`WriteSkillDialog`,components:{ElDialog:V,ElButton:J,ElInput:G,CloudUploadIcon:Ve},props:{modelValue:{type:Boolean,default:!1}},emits:[`update:modelValue`,`created`],data(){return{content:``,saving:!1}},methods:{onVisibleChange(e){this.$emit(`update:modelValue`,e)},onClose(){this.saving||this.$emit(`update:modelValue`,!1)},reset(){this.content=``},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},async onSubmit(){if(this.content.trim()){this.saving=!0;try{let{data:e}=await Z.createMarkdown({content:this.content});K.success(this.$t(`skill.message.createSuccess`)),this.$emit(`created`,e.id),this.$emit(`update:modelValue`,!1)}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)}))}finally{this.saving=!1}}}}}),Cn={class:`hint`};function wn(t,n,a,s,c,l){let u=d(`el-input`),f=d(`el-button`),p=d(`cloud-upload-icon`),g=d(`el-dialog`);return b(),m(g,{"model-value":t.modelValue,title:t.$t(`skill.dialog.writeTitle`),width:`min(720px, 94vw)`,"align-center":``,"close-on-click-modal":!t.saving,"close-on-press-escape":!t.saving,"show-close":!t.saving,"onUpdate:modelValue":t.onVisibleChange,onClosed:t.reset},{footer:h(()=>[o(f,{disabled:t.saving,onClick:t.onClose},{default:h(()=>[r(i(t.$t(`skill.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`]),o(f,{type:`primary`,loading:t.saving,disabled:!t.content.trim(),onClick:t.onSubmit},{default:h(()=>[o(p,{class:`mr-1`,size:16,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.create`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])]),default:h(()=>[e(`p`,Cn,i(t.$t(`skill.dialog.writeHint`)),1),o(u,{modelValue:t.content,"onUpdate:modelValue":n[0]||=e=>t.content=e,type:`textarea`,rows:18,placeholder:t.$t(`skill.placeholder.content`),spellcheck:`false`,class:`editor`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`model-value`,`title`,`close-on-click-modal`,`close-on-press-escape`,`show-close`,`onUpdate:modelValue`,`onClosed`])}var Tn=x({name:`UserSkills`,components:{ElInput:G,ElSwitch:j,ElTag:ge,ElTooltip:E,ElDropdown:k,ElDropdownMenu:O,ElDropdownItem:D,AddIcon:ce,AiCreateIcon:he,CloseIcon:_e,DeleteIcon:fe,ExpandDownIcon:F,ExpandRightIcon:I,HelpIcon:ee,MarketplaceIcon:ue,MoreIcon:re,SearchIcon:de,SkillIcon:le,UploadIcon:me,WriteIcon:te,BrowseSkillsDialog:Dt,SkillFilePreview:Gt,SkillRow:un,UploadSkillDialog:xn,WriteSkillDialog:U(Sn,[[`render`,wn],[`__scopeId`,`data-v-f39aab5d`]])},directives:{loading:W},data(){return{loading:!1,skills:[],togglingId:null,selectedSkillId:``,selectedPath:``,expandedSkillIds:[],personalOpen:!0,globalsOpen:!0,searchOpen:!1,searchQuery:``,uploadVisible:!1,writeVisible:!1,browseVisible:!1}},computed:{personalSkills(){return this.skills.filter(e=>e.source!==`global`)},globalSkills(){return this.skills.filter(e=>e.source===`global`)},filteredPersonal(){return this.applyFilter(this.personalSkills)},filteredGlobal(){return this.applyFilter(this.globalSkills)},selectedSkill(){return this.skills.find(e=>e.id===this.selectedSkillId)||null}},mounted(){this.fetchSkills()},methods:{applyFilter(e){let t=this.searchQuery.trim().toLowerCase();return t?e.filter(e=>e.slug.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)):e},async fetchSkills(){this.loading=!0;try{let{data:e}=await Z.list();if(this.skills=e||[],!this.selectedSkillId&&this.skills.length){let e=this.personalSkills[0]||this.skills[0];this.selectedSkillId=e.id}else this.selectedSkillId&&!this.skills.find(e=>e.id===this.selectedSkillId)&&(this.selectedSkillId=``,this.selectedPath=``)}catch(e){console.error(e),K.error(this.$t(`skill.message.loadFailed`))}finally{this.loading=!1}},extractError(e){let t=e;return t?.response?.data?.detail||(t?.response?.data?.content||[]).join(`; `)||String(e)||`unknown error`},selectSkill(e){this.selectedSkillId=e.id,this.selectedPath=``},selectFile(e,t){this.selectedSkillId=e.id,this.selectedPath=t},toggleExpand(e){let t=this.expandedSkillIds.indexOf(e.id);t>=0?this.expandedSkillIds.splice(t,1):this.expandedSkillIds.push(e.id)},openSearch(){this.searchOpen=!0,a(()=>{this.$refs.searchInput?.focus?.()})},closeSearch(){this.searchOpen=!1,this.searchQuery=``},openUpload(){this.uploadVisible=!0},openWrite(){this.writeVisible=!0},onBrowse(){this.browseVisible=!0},async onCreated(e){await this.fetchSkills();let t=this.skills.find(t=>t.id===e);t&&(this.selectedSkillId=t.id,this.selectedPath=``,this.personalOpen=!0)},async onSaveContent(e,t){if(!this.selectedSkill){t.reject();return}try{let{data:n}=await Z.update(this.selectedSkill.id,{content:e});K.success(this.$t(`skill.message.updateSuccess`));let r=this.skills.findIndex(e=>e.id===n.id);r>=0&&this.skills.splice(r,1,n),t.resolve()}catch(e){K.error(this.$t(`skill.message.createFailed`,{detail:this.extractError(e)})),t.reject(e)}},async onDelete(e){try{await we.confirm(this.$t(`skill.message.deleteConfirm`,{slug:e.slug}),this.$t(`skill.button.delete`),{type:`warning`})}catch{return}try{await Z.remove(e.id),K.success(this.$t(`skill.message.deleteSuccess`)),this.selectedSkillId===e.id&&(this.selectedSkillId=``,this.selectedPath=``),await this.fetchSkills()}catch(e){K.error(this.extractError(e))}},async onToggleSkill(e,t){this.togglingId=e.id;try{t?(await Z.enable(e.id),K.success(this.$t(`skill.message.enableSuccess`))):(await Z.disable(e.id),K.success(this.$t(`skill.message.disableSuccess`))),e.enabled=t}catch(e){K.error(this.extractError(e))}finally{this.togglingId=null}}}}),En={class:`page-shell`},Dn={class:`page-heading`},On={class:`page-title`},kn={class:`page-subtitle`},An={class:`skills-shell`},jn={class:`left-pane`},Mn={class:`left-header`},Nn={class:`left-actions`},Pn=[`aria-label`,`title`],Fn=[`aria-label`,`title`],In={class:`submenu-trigger`},Ln={class:`badge-soon`},Rn={key:0,class:`search-row`},zn=[`aria-label`,`title`],Bn={class:`left-body`},Vn={class:`section`},Hn={key:0,class:`skill-list`},Un={key:0,class:`empty-row`},Wn={key:0,class:`section`},Gn={key:0,class:`skill-list`},Kn={class:`right-pane`},qn={class:`right-header`},Jn={class:`right-title`},Yn={class:`right-actions`},Xn=[`aria-label`,`title`],Zn={class:`meta-card`},Qn={class:`meta-grid`},$n={class:`meta-cell`},er={class:`meta-label`},tr={class:`meta-value`},nr={class:`meta-cell`},rr={class:`meta-label`},ir={class:`meta-value`},ar={key:0,class:`meta-cell`},or={class:`meta-label`},sr={class:`meta-tags`},cr={key:0,class:`meta-description`},lr={class:`meta-description-label`},ur={class:`meta-label`},dr={class:`preview-card`},fr={key:2,class:`right-empty`};function pr(t,n,a,f,_,y){let x=d(`search-icon`),S=d(`add-icon`),C=d(`marketplace-icon`),w=d(`el-dropdown-item`),T=d(`expand-right-icon`),E=d(`ai-create-icon`),D=d(`write-icon`),O=d(`upload-icon`),k=d(`el-dropdown-menu`),A=d(`el-dropdown`),j=d(`el-input`),M=d(`close-icon`),N=d(`expand-down-icon`),P=d(`skill-row`),F=d(`el-switch`),I=d(`more-icon`),L=d(`delete-icon`),ee=d(`el-tag`),te=d(`help-icon`),ne=d(`el-tooltip`),R=d(`skill-file-preview`),re=d(`skill-icon`),ie=d(`upload-skill-dialog`),ae=d(`write-skill-dialog`),z=d(`browse-skills-dialog`),B=g(`loading`);return b(),c(`div`,En,[e(`div`,Dn,[e(`h2`,On,i(t.$t(`skill.title.skills`)),1),e(`p`,kn,i(t.$t(`skill.message.pageDescription`)),1)]),e(`div`,An,[e(`aside`,jn,[e(`header`,Mn,[e(`div`,Nn,[t.searchOpen?s(``,!0):(b(),c(`button`,{key:0,class:`icon-btn`,"aria-label":t.$t(`skill.button.search`),title:t.$t(`skill.button.search`),onClick:n[0]||=(...e)=>t.openSearch&&t.openSearch(...e)},[o(x,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Pn)),o(A,{trigger:`click`,placement:`bottom-end`,"hide-on-click":!1},{dropdown:h(()=>[o(k,{class:`add-menu`},{default:h(()=>[o(w,{onClick:t.onBrowse},{default:h(()=>[o(C,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.browse`)),1)]),_:1},8,[`onClick`]),o(w,{divided:``},{default:h(()=>[o(A,{trigger:`hover`,placement:`left-start`,"hide-on-click":!0},{dropdown:h(()=>[o(k,{class:`add-menu`},{default:h(()=>[o(w,{disabled:``},{default:h(()=>[o(E,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.createWithClaude`))+` `,1),e(`span`,Ln,i(t.$t(`skill.menu.soon`)),1)]),_:1}),o(w,{onClick:t.openWrite},{default:h(()=>[o(D,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.write`)),1)]),_:1},8,[`onClick`]),o(w,{onClick:t.openUpload},{default:h(()=>[o(O,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.upload`)),1)]),_:1},8,[`onClick`])]),_:1})]),default:h(()=>[e(`span`,In,[o(S,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.menu.create`))+` `,1),o(T,{class:`submenu-arrow`,size:14,"aria-hidden":`true`,focusable:`false`})])]),_:1})]),_:1})]),_:1})]),default:h(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.add`),title:t.$t(`skill.button.add`)},[o(S,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Fn)]),_:1})])]),t.searchOpen?(b(),c(`div`,Rn,[o(j,{ref:`searchInput`,modelValue:t.searchQuery,"onUpdate:modelValue":n[1]||=e=>t.searchQuery=e,class:`search-input`,size:`default`,placeholder:t.$t(`skill.placeholder.search`),onKeydown:l(t.closeSearch,[`escape`])},{prefix:h(()=>[o(x,{size:13,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`modelValue`,`placeholder`,`onKeydown`]),e(`button`,{class:`icon-btn icon-btn-sm`,"aria-label":t.$t(`common.button.close`),title:t.$t(`common.button.close`),onClick:n[2]||=(...e)=>t.closeSearch&&t.closeSearch(...e)},[o(M,{size:14,"aria-hidden":`true`,focusable:`false`})],8,zn)])):s(``,!0),p((b(),c(`div`,Bn,[e(`section`,Vn,[e(`button`,{class:`section-header`,onClick:n[3]||=e=>t.personalOpen=!t.personalOpen},[t.personalOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(T,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.personal`)),1)]),t.personalOpen?(b(),c(`ul`,Hn,[!t.loading&&t.filteredPersonal.length===0?(b(),c(`li`,Un,i(t.searchQuery?t.$t(`skill.empty.search`):t.$t(`skill.message.noSkills`)),1)):s(``,!0),(b(!0),c(u,null,v(t.filteredPersonal,e=>(b(),m(P,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):s(``,!0)]),t.globalSkills.length>0?(b(),c(`section`,Wn,[e(`button`,{class:`section-header`,onClick:n[4]||=e=>t.globalsOpen=!t.globalsOpen},[t.globalsOpen?(b(),m(N,{key:0,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})):(b(),m(T,{key:1,class:`section-chevron`,size:12,"aria-hidden":`true`,focusable:`false`})),e(`span`,null,i(t.$t(`skill.section.platform`)),1)]),t.globalsOpen?(b(),c(`ul`,Gn,[(b(!0),c(u,null,v(t.filteredGlobal,e=>(b(),m(P,{key:e.id,skill:e,"selected-skill-id":t.selectedSkillId,"selected-path":t.selectedPath,expanded:t.expandedSkillIds.includes(e.id),onToggleExpand:t.toggleExpand,onSelectSkill:t.selectSkill,onSelectFile:t.selectFile},null,8,[`skill`,`selected-skill-id`,`selected-path`,`expanded`,`onToggleExpand`,`onSelectSkill`,`onSelectFile`]))),128))])):s(``,!0)])):s(``,!0)])),[[B,t.loading]])]),e(`main`,Kn,[t.selectedSkill&&!t.selectedPath?(b(),c(u,{key:0},[e(`header`,qn,[e(`h3`,Jn,i(t.selectedSkill.slug),1),e(`div`,Yn,[o(F,{"model-value":t.selectedSkill.enabled,size:`default`,loading:t.togglingId===t.selectedSkill.id,onChange:n[5]||=e=>t.onToggleSkill(t.selectedSkill,!!e)},null,8,[`model-value`,`loading`]),t.selectedSkill.source===`global`?s(``,!0):(b(),m(A,{key:0,trigger:`click`,placement:`bottom-end`},{dropdown:h(()=>[o(k,null,{default:h(()=>[o(w,{onClick:n[6]||=e=>t.onDelete(t.selectedSkill)},{default:h(()=>[o(L,{class:`menu-icon`,size:14,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`skill.button.delete`)),1)]),_:1})]),_:1})]),default:h(()=>[e(`button`,{class:`icon-btn`,"aria-label":t.$t(`skill.button.more`),title:t.$t(`skill.button.more`)},[o(I,{size:16,"aria-hidden":`true`,focusable:`false`})],8,Xn)]),_:1}))])]),e(`div`,Zn,[e(`div`,Qn,[e(`div`,$n,[e(`span`,er,i(t.$t(`skill.meta.addedBy`)),1),e(`span`,tr,i(t.selectedSkill.source===`global`?t.$t(`skill.meta.platform`):t.$t(`skill.meta.you`)),1)]),e(`div`,nr,[e(`span`,rr,i(t.$t(`skill.meta.lastUpdated`)),1),e(`span`,ir,i(t.$dayjs.format(t.selectedSkill.updated_at)),1)]),t.selectedSkill.required_connections.length?(b(),c(`div`,ar,[e(`span`,or,i(t.$t(`skill.field.requiredConnections`)),1),e(`div`,sr,[(b(!0),c(u,null,v(t.selectedSkill.required_connections,e=>(b(),m(ee,{key:e,size:`small`,type:`info`},{default:h(()=>[r(i(e),1)]),_:2},1024))),128))])])):s(``,!0)]),t.selectedSkill.description?(b(),c(`div`,cr,[e(`div`,lr,[e(`span`,ur,i(t.$t(`skill.field.description`)),1),t.selectedSkill.when_to_use?(b(),m(ne,{key:0,content:t.selectedSkill.when_to_use,placement:`top`},{default:h(()=>[o(te,{class:`meta-info-icon`,size:12,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`content`])):s(``,!0)]),e(`p`,null,i(t.selectedSkill.description),1)])):s(``,!0)]),e(`div`,dr,[(b(),m(R,{key:`${t.selectedSkill.id}:SKILL.md`,"skill-id":t.selectedSkill.id,path:`SKILL.md`,editable:t.selectedSkill.source===`upload`,onSave:t.onSaveContent},null,8,[`skill-id`,`editable`,`onSave`]))])],64)):t.selectedSkill&&t.selectedPath?(b(),m(R,{key:`${t.selectedSkill.id}:${t.selectedPath}`,"skill-id":t.selectedSkill.id,path:t.selectedPath,editable:!1},null,8,[`skill-id`,`path`])):(b(),c(`div`,fr,[o(re,{class:`right-empty-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,null,i(t.$t(`skill.preview.selectSkill`)),1)]))])]),o(ie,{modelValue:t.uploadVisible,"onUpdate:modelValue":n[7]||=e=>t.uploadVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(ae,{modelValue:t.writeVisible,"onUpdate:modelValue":n[8]||=e=>t.writeVisible=e,onCreated:t.onCreated},null,8,[`modelValue`,`onCreated`]),o(z,{modelValue:t.browseVisible,"onUpdate:modelValue":n[9]||=e=>t.browseVisible=e,onInstalled:t.onCreated},null,8,[`modelValue`,`onInstalled`])])}var mr=U(Tn,[[`render`,pr],[`__scopeId`,`data-v-da68d0c2`]]);export{mr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Jt as t,L as n,at as r,ht as i,j as a,mt as o,ot as s,tt as c,z as l}from"./vendor-chart-Dw-P17PN.js";import{n as u,t as d}from"./table-
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Jt as t,L as n,at as r,ht as i,j as a,mt as o,ot as s,tt as c,z as l}from"./vendor-chart-Dw-P17PN.js";import{n as u,t as d}from"./table-C9iSQAZO.js";import{t as f}from"./card-D-4S-l7a.js";import{n as p,t as m}from"./row-B6o6HQls.js";import{E as h,mr as g}from"./index-tKADgCY9.js";import{t as _}from"./CopyToClipboard-DPVMD9O4.js";import{t as v}from"./pagination-BnQgCM-x.js";var y=l({name:`ConsoleDistributionInvitees`,components:{Pagination:v,CopyToClipboard:_,ElRow:m,ElCol:p,ElTable:d,ElTableColumn:u,ElCard:f},data(){return{invitees:[],loading:!1,total:void 0,limit:10}},computed:{redirect(){return this.$route.query.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onFetchData()},methods:{onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{page:e}})},onFetchData(){this.loading=!0,Promise.all([this.onFetchInvitees()]).finally(()=>{this.loading=!1})},async onFetchInvitees(){let{data:e}=await g.getInvitees({limit:this.limit,offset:(this.page-1)*this.limit,ordering:`-created_at`});this.invitees=e.items,this.total=e.count}}}),b={class:`title`},x={class:`key`},S={class:`copy`},C={class:`description`},w={class:`description`},T={class:`description`},E={class:`created-at`},D={class:`pagination m-v-lg`};function O(l,u,d,f,p,m){let h=r(`el-col`),g=r(`el-row`),_=r(`copy-to-clipboard`),v=r(`el-table-column`),y=r(`el-table`),O=r(`el-card`),k=r(`pagination`),A=s(`loading`);return c(),a(g,{class:`panel`},{default:o(()=>[n(h,{span:24},{default:o(()=>[n(g,null,{default:o(()=>[n(h,{span:24},{default:o(()=>[e(`h2`,b,t(l.$t(`common.title.invitee`)),1)]),_:1})]),_:1}),n(g,null,{default:o(()=>[n(h,{span:24},{default:o(()=>[n(O,{shadow:`hover`},{default:o(()=>[i((c(),a(y,{data:l.invitees,stripe:``},{default:o(()=>[n(v,{prop:`id`,label:l.$t(`user.field.id`),"class-name":`text-center`,width:`350px`},{default:o(r=>[e(`span`,x,t(r.row.id),1),e(`span`,S,[n(_,{content:r.row.id},null,8,[`content`])])]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.username`),width:`300px`},{default:o(n=>[e(`span`,C,t(n.row?.username),1)]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.email`),width:`300px`},{default:o(n=>[e(`span`,w,t(n.row?.email),1)]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.nickname`),width:`200px`},{default:o(n=>[e(`span`,T,t(n.row.nickname),1)]),_:1},8,[`label`]),n(v,{label:l.$t(`user.field.dateJoined`)},{default:o(n=>[e(`span`,E,t(l.$dayjs.format(n.row.date_joined)),1)]),_:1},8,[`label`])]),_:1},8,[`data`])),[[A,l.loading]])]),_:1})]),_:1})]),_:1}),n(g,null,{default:o(()=>[n(h,{span:10,offset:14},{default:o(()=>[e(`div`,D,[n(k,{"current-page":l.page,"page-size":l.limit,total:l.total,onChange:l.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var k=h(y,[[`render`,O],[`__scopeId`,`data-v-b2200c49`]]);export{k 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 ee}from"./select--z-fac6_.js";import{n as h,t as g}from"./table-B1ktVOIV.js";import{t as _}from"./card-D-4S-l7a.js";import{n as v,t as y}from"./file-output-BRGppmHm.js";import{n as b,t as x}from"./row-ig5nVOkc.js";import{t as S}from"./skeleton-B3LIGUiE.js";import{t as C}from"./circle-check-D5h_jiB2.js";import{t as w}from"./clock-BbOTrjoQ.js";import{t as T}from"./dollar-sign-C1g65vkD.js";import{Ci as E,E as D,Li as O,Xt as k,ei as A,ir as j,zi as M}from"./index-dzU0SACS.js";import{t as N}from"./CopyToClipboard-DOx2-KTG.js";import{t as P}from"./pagination-C5nrzUF9.js";var F=E(`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:y,MoneyIcon:T,ReceiptIcon:F,SuccessIcon:C,TimeIcon:w,Pagination:P,CopyToClipboard:N,ElRow:x,ElCol:b,ElTable:g,ElTableColumn:h,ElButton:M,ElTag:O,ElCard:_,ElSelect:m,ElOption:ee,ElDatePicker:v,ElSkeleton:S},data(){return{OrderState:A,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:A.PENDING,label:this.$t(`order.state.pending`)},{value:A.FINISHED,label:this.$t(`order.state.finished`)},{value:A.PAID,label:this.$t(`order.state.paid`)},{value:A.EXPIRED,label:this.$t(`order.state.expired`)},{value:A.FAILED,label:this.$t(`order.state.failed`)},{value:A.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:k,stateTagType(e){return e===A.FINISHED||e===A.PAID?`success`:e===A.EXPIRED||e===A.FAILED?`danger`:e===A.REFUNDED?`warning`:`info`},stateLabel(e){return{[A.PENDING]:this.$t(`order.state.pending`),[A.PAID]:this.$t(`order.state.paid`),[A.FINISHED]:this.$t(`order.state.finished`),[A.EXPIRED]:this.$t(`order.state.expired`),[A.FAILED]:this.$t(`order.state.failed`),[A.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==A.PAID&&e!==A.FINISHED&&e!==A.EXPIRED&&e!==A.FAILED&&e!==A.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,j.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,j.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...I}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,j.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`},te={class:`icon-wrapper`},J={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,ee,h,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`,te,[r(w,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,J,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=D(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 ee}from"./select-CaXJ36xG.js";import{n as h,t as g}from"./table-C9iSQAZO.js";import{t as _}from"./card-D-4S-l7a.js";import{n as v,t as y}from"./file-output-B8Tlktgm.js";import{n as b,t as x}from"./row-B6o6HQls.js";import{t as S}from"./skeleton-B3LIGUiE.js";import{t as C}from"./circle-check-9HkCp0kN.js";import{t as w}from"./clock-BurpmIb0.js";import{t as T}from"./dollar-sign-BsstGHbZ.js";import{Ci as E,E as D,Li as O,Xt as k,ei as A,ir as j,zi as M}from"./index-tKADgCY9.js";import{t as N}from"./CopyToClipboard-DPVMD9O4.js";import{t as P}from"./pagination-BnQgCM-x.js";var F=E(`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:y,MoneyIcon:T,ReceiptIcon:F,SuccessIcon:C,TimeIcon:w,Pagination:P,CopyToClipboard:N,ElRow:x,ElCol:b,ElTable:g,ElTableColumn:h,ElButton:M,ElTag:O,ElCard:_,ElSelect:m,ElOption:ee,ElDatePicker:v,ElSkeleton:S},data(){return{OrderState:A,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:A.PENDING,label:this.$t(`order.state.pending`)},{value:A.FINISHED,label:this.$t(`order.state.finished`)},{value:A.PAID,label:this.$t(`order.state.paid`)},{value:A.EXPIRED,label:this.$t(`order.state.expired`)},{value:A.FAILED,label:this.$t(`order.state.failed`)},{value:A.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:k,stateTagType(e){return e===A.FINISHED||e===A.PAID?`success`:e===A.EXPIRED||e===A.FAILED?`danger`:e===A.REFUNDED?`warning`:`info`},stateLabel(e){return{[A.PENDING]:this.$t(`order.state.pending`),[A.PAID]:this.$t(`order.state.paid`),[A.FINISHED]:this.$t(`order.state.finished`),[A.EXPIRED]:this.$t(`order.state.expired`),[A.FAILED]:this.$t(`order.state.failed`),[A.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==A.PAID&&e!==A.FINISHED&&e!==A.EXPIRED&&e!==A.FAILED&&e!==A.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,j.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,j.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...I}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,j.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`},te={class:`icon-wrapper`},J={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,ee,h,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`,te,[r(w,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,J,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=D(L,[[`render`,de],[`__scopeId`,`data-v-a543d5b3`]]);export{fe as default};
|
|
@@ -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 y,qt as b,r as x,rt as S,s as C,t as w,tt as T,u as E,x as ee,z as D}from"./vendor-chart-Dw-P17PN.js";import{r as O,t as k}from"./select--z-fac6_.js";import{n as A,t as j}from"./table-B1ktVOIV.js";import{n as M,t as N}from"./tabs-CMeHhbQd.js";import{t as P}from"./card-D-4S-l7a.js";import{n as F,r as I}from"./radio-DgDgyT2l.js";import{n as L,t as R}from"./file-output-BRGppmHm.js";import{n as z,t as B}from"./row-ig5nVOkc.js";import{t as V}from"./empty-B1wenOj5.js";import{n as H,t as U}from"./skeleton-B3LIGUiE.js";import{t as W}from"./switch-CU7Lbydn.js";import{t as G}from"./boxes-wDC71gk_.js";import{$r as K,Ai as te,E as ne,Li as re,Qr as ie,Ti as q,ar as J,br as Y,di as ae,hr as oe,oi as se,or as X,sr as ce,zi as le}from"./index-dzU0SACS.js";import{t as ue}from"./CopyToClipboard-DOx2-KTG.js";import{t as de}from"./pagination-C5nrzUF9.js";var fe=e(Y());v.register(c,u,p,x,C,E,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=D({name:`ConsoleUsageList`,components:{ApplicationsIcon:G,ExportIcon:R,Pagination:de,ElTag:re,ElDatePicker:L,ElTable:j,ElSelect:O,ElOption:k,CopyToClipboard:ue,ElRow:B,ElCol:z,ElTableColumn:A,ElCard:P,ElRadioButton:F,ElRadioGroup:I,ElSkeleton:U,ElSkeletonItem:H,ElDialog:te,ElTabs:M,ElTabPane:N,ElButton:le,ElEmpty:V,ElSwitch:W,BarChart:w,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:ie,serviceType:K,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()||K.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===K.API?this.onFetchApiUsages(e):this.type===K.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:se.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,J.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;ce.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){q.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=`${ae()}/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{q.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`),x=l(`el-radio-button`),C=l(`el-radio-group`),w=l(`el-option`),E=l(`el-select`),D=l(`el-skeleton-item`),O=l(`el-skeleton`),k=l(`el-date-picker`),A=l(`export-icon`),j=l(`el-button`),M=l(`applications-icon`),N=l(`el-card`),P=l(`bar-chart`),F=l(`el-empty`),I=l(`doughnut-chart`),L=l(`el-table-column`),R=l(`el-table`),z=l(`el-switch`),B=l(`el-tag`),V=l(`copy-to-clipboard`),H=l(`el-tab-pane`),U=l(`el-tabs`),W=l(`el-dialog`),G=l(`pagination`),K=y(`loading`);return T(),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(C,{modelValue:e.type,"onUpdate:modelValue":c[0]||=t=>e.type=t},{default:g(()=>[i(x,{value:e.serviceType.API,label:e.$t(`application.field.api`)},null,8,[`value`,`label`]),i(x,{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(E,{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(()=>[(T(!0),o(s,null,S(e.applications,e=>(T(),m(w,{key:e.id,label:e.service?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[ee,!1]]),e.type===e.serviceType.API?(T(),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?(T(),m(O,{key:0,animated:``,class:`w-full`},{template:g(()=>[i(D,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(T(),m(E,{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(()=>[(T(!0),o(s,null,S(e.apis,e=>(T(),m(w,{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?(T(),m(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(k,{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?(T(),m(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(E,{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(()=>[(T(!0),o(s,null,S(e.statusCodeOptions,e=>(T(),m(w,{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?(T(),m(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:g(()=>[i(j,{type:`primary`,plain:``,loading:e.exporting,class:`w-full whitespace-nowrap`,onClick:e.onExport},{default:g(()=>[i(A,{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?(T(),m(v,{key:0,gutter:24,class:`mb-5`},{default:g(()=>[i(_,{md:6,xs:24},{default:g(()=>[i(N,{shadow:`hover`,class:`h-full`},{default:g(()=>[e.aggLoading?(T(),m(O,{key:0})):(T(),o(`div`,xe,[t(`div`,Se,[i(M,{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(N,{shadow:`hover`,class:`h-full`},{header:g(()=>[t(`div`,Ee,[t(`span`,De,r(e.$t(`usage.title.usageAnalytics`)),1),i(C,{modelValue:e.chartView,"onUpdate:modelValue":c[5]||=t=>e.chartView=t,size:`small`},{default:g(()=>[i(x,{value:`trend`,label:e.$t(`usage.view.trend`)},null,8,[`label`]),i(x,{value:`distribution`,label:e.$t(`usage.view.distribution`)},null,8,[`label`]),i(x,{value:`breakdown`,label:e.$t(`usage.view.breakdown`)},null,8,[`label`])]),_:1},8,[`modelValue`])])]),default:g(()=>[t(`div`,Oe,[e.aggLoading?(T(),m(O,{key:0,class:`w-full`})):e.chartView===`trend`?(T(),o(s,{key:1},[e.barChartSeries.length?(T(),m(P,{key:0,data:e.barChartData,options:e.barChartOptions,class:`chart`},null,8,[`data`,`options`])):(T(),m(F,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):e.chartView===`distribution`?(T(),o(s,{key:2},[e.pieData.length?(T(),m(I,{key:0,data:e.doughnutChartData,options:e.doughnutChartOptions,class:`chart`},null,8,[`data`,`options`])):(T(),m(F,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):(T(),o(s,{key:3},[e.apiBreakdown.length?(T(),m(R,{key:0,data:e.apiBreakdown,size:`small`,height:`300`,class:`w-full`},{default:g(()=>[i(L,{label:e.$t(`usage.field.api`),"min-width":`160`},{default:g(e=>[t(`span`,{class:`color-dot`,style:b({backgroundColor:e.row.color})},null,4),t(`span`,null,r(e.row.label),1)]),_:1},8,[`label`]),i(L,{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(L,{label:e.$t(`usage.field.share`),width:`150`},{default:g(e=>[t(`div`,ke,[t(`div`,Ae,[t(`div`,{class:`share-bar-fill`,style:b({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`])):(T(),m(F,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64))])]),_:1})]),_:1})]),_:1})):a(``,!0),i(N,{shadow:`hover`},{default:g(()=>[t(`div`,Me,[t(`span`,Ne,r(e.$t(`usage.field.autoRefresh`)),1),i(z,{modelValue:e.autoRefresh,"onUpdate:modelValue":c[6]||=t=>e.autoRefresh=t},null,8,[`modelValue`])]),e.type===e.serviceType.API?f((T(),m(R,{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(L,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.api?.title),1)]),_:1},8,[`label`]),i(L,{label:e.$t(`usage.field.statusCode`),width:`120px`},{default:g(t=>[t.row.status_code?(T(),o(`span`,Pe,r(t.row.status_code),1)):(T(),m(B,{key:1,type:`warning`,size:`small`},{default:g(()=>[n(r(e.$t(`usage.value.processing`)),1)]),_:1}))]),_:1},8,[`label`]),i(L,{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(L,{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)?(T(),o(`div`,Fe,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)])):(T(),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(L,{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(L,{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?(T(),m(B,{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),(T(!0),o(s,null,S(e.getSimpleMetadata(i.row.metadata),(e,t)=>(T(),m(B,{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(L,{label:e.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:g(t=>[t.row.id?(T(),m(j,{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(L,{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?(T(),o(`span`,ze,[i(V,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(L,{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?(T(),o(`span`,Ve,[i(V,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(L,{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`])),[[K,e.loading]]):a(``,!0),e.type===e.serviceType.Proxy?f((T(),m(R,{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(L,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.service?.title),1)]),_:1},8,[`label`]),i(L,{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(L,{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(L,{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(L,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:g(e=>[(T(!0),o(s,null,S(e.row.metadata,(e,t)=>(T(),m(B,{key:t,class:`mb-2`},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))]),_:1},8,[`label`]),i(L,{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?(T(),o(`span`,Ue,[i(V,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(L,{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`])),[[K,e.loading]]):a(``,!0)]),_:1})]),_:1})]),_:1}),i(W,{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(U,{modelValue:e.detailActiveTab,"onUpdate:modelValue":c[7]||=t=>e.detailActiveTab=t},{default:g(()=>[i(H,{label:e.$t(`usage.dialog.request`),name:`request`},{default:g(()=>[e.detailLoading?(T(),m(O,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.request?(T(),o(`pre`,Ge,r(e.formatJson(e.detailRow.metadata.request)),1)):(T(),o(`p`,Ke,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),i(H,{label:e.$t(`usage.dialog.response`),name:`response`},{default:g(()=>[e.detailLoading?(T(),m(O,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.response?(T(),o(`pre`,qe,r(e.formatJson(e.detailRow.metadata.response)),1)):(T(),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(G,{"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=ne(_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 y,qt as b,r as x,rt as S,s as C,t as w,tt as T,u as E,x as ee,z as D}from"./vendor-chart-Dw-P17PN.js";import{r as O,t as k}from"./select-CaXJ36xG.js";import{n as A,t as j}from"./table-C9iSQAZO.js";import{n as M,t as N}from"./tabs-Cv60oJMx.js";import{t as P}from"./card-D-4S-l7a.js";import{n as F,r as I}from"./radio-DgDgyT2l.js";import{n as L,t as R}from"./file-output-B8Tlktgm.js";import{n as z,t as B}from"./row-B6o6HQls.js";import{t as V}from"./empty-B1wenOj5.js";import{n as H,t as U}from"./skeleton-B3LIGUiE.js";import{t as W}from"./switch-DGps_uPH.js";import{t as G}from"./boxes-JieFrmM4.js";import{$r as K,Ai as te,E as ne,Li as re,Qr as ie,Ti as q,ar as J,br as Y,di as ae,hr as oe,oi as se,or as X,sr as ce,zi as le}from"./index-tKADgCY9.js";import{t as ue}from"./CopyToClipboard-DPVMD9O4.js";import{t as de}from"./pagination-BnQgCM-x.js";var fe=e(Y());v.register(c,u,p,x,C,E,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=D({name:`ConsoleUsageList`,components:{ApplicationsIcon:G,ExportIcon:R,Pagination:de,ElTag:re,ElDatePicker:L,ElTable:j,ElSelect:O,ElOption:k,CopyToClipboard:ue,ElRow:B,ElCol:z,ElTableColumn:A,ElCard:P,ElRadioButton:F,ElRadioGroup:I,ElSkeleton:U,ElSkeletonItem:H,ElDialog:te,ElTabs:M,ElTabPane:N,ElButton:le,ElEmpty:V,ElSwitch:W,BarChart:w,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:ie,serviceType:K,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()||K.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===K.API?this.onFetchApiUsages(e):this.type===K.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:se.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,J.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;ce.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){q.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=`${ae()}/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{q.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`),x=l(`el-radio-button`),C=l(`el-radio-group`),w=l(`el-option`),E=l(`el-select`),D=l(`el-skeleton-item`),O=l(`el-skeleton`),k=l(`el-date-picker`),A=l(`export-icon`),j=l(`el-button`),M=l(`applications-icon`),N=l(`el-card`),P=l(`bar-chart`),F=l(`el-empty`),I=l(`doughnut-chart`),L=l(`el-table-column`),R=l(`el-table`),z=l(`el-switch`),B=l(`el-tag`),V=l(`copy-to-clipboard`),H=l(`el-tab-pane`),U=l(`el-tabs`),W=l(`el-dialog`),G=l(`pagination`),K=y(`loading`);return T(),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(C,{modelValue:e.type,"onUpdate:modelValue":c[0]||=t=>e.type=t},{default:g(()=>[i(x,{value:e.serviceType.API,label:e.$t(`application.field.api`)},null,8,[`value`,`label`]),i(x,{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(E,{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(()=>[(T(!0),o(s,null,S(e.applications,e=>(T(),m(w,{key:e.id,label:e.service?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[ee,!1]]),e.type===e.serviceType.API?(T(),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?(T(),m(O,{key:0,animated:``,class:`w-full`},{template:g(()=>[i(D,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(T(),m(E,{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(()=>[(T(!0),o(s,null,S(e.apis,e=>(T(),m(w,{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?(T(),m(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(k,{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?(T(),m(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(E,{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(()=>[(T(!0),o(s,null,S(e.statusCodeOptions,e=>(T(),m(w,{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?(T(),m(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:g(()=>[i(j,{type:`primary`,plain:``,loading:e.exporting,class:`w-full whitespace-nowrap`,onClick:e.onExport},{default:g(()=>[i(A,{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?(T(),m(v,{key:0,gutter:24,class:`mb-5`},{default:g(()=>[i(_,{md:6,xs:24},{default:g(()=>[i(N,{shadow:`hover`,class:`h-full`},{default:g(()=>[e.aggLoading?(T(),m(O,{key:0})):(T(),o(`div`,xe,[t(`div`,Se,[i(M,{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(N,{shadow:`hover`,class:`h-full`},{header:g(()=>[t(`div`,Ee,[t(`span`,De,r(e.$t(`usage.title.usageAnalytics`)),1),i(C,{modelValue:e.chartView,"onUpdate:modelValue":c[5]||=t=>e.chartView=t,size:`small`},{default:g(()=>[i(x,{value:`trend`,label:e.$t(`usage.view.trend`)},null,8,[`label`]),i(x,{value:`distribution`,label:e.$t(`usage.view.distribution`)},null,8,[`label`]),i(x,{value:`breakdown`,label:e.$t(`usage.view.breakdown`)},null,8,[`label`])]),_:1},8,[`modelValue`])])]),default:g(()=>[t(`div`,Oe,[e.aggLoading?(T(),m(O,{key:0,class:`w-full`})):e.chartView===`trend`?(T(),o(s,{key:1},[e.barChartSeries.length?(T(),m(P,{key:0,data:e.barChartData,options:e.barChartOptions,class:`chart`},null,8,[`data`,`options`])):(T(),m(F,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):e.chartView===`distribution`?(T(),o(s,{key:2},[e.pieData.length?(T(),m(I,{key:0,data:e.doughnutChartData,options:e.doughnutChartOptions,class:`chart`},null,8,[`data`,`options`])):(T(),m(F,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):(T(),o(s,{key:3},[e.apiBreakdown.length?(T(),m(R,{key:0,data:e.apiBreakdown,size:`small`,height:`300`,class:`w-full`},{default:g(()=>[i(L,{label:e.$t(`usage.field.api`),"min-width":`160`},{default:g(e=>[t(`span`,{class:`color-dot`,style:b({backgroundColor:e.row.color})},null,4),t(`span`,null,r(e.row.label),1)]),_:1},8,[`label`]),i(L,{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(L,{label:e.$t(`usage.field.share`),width:`150`},{default:g(e=>[t(`div`,ke,[t(`div`,Ae,[t(`div`,{class:`share-bar-fill`,style:b({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`])):(T(),m(F,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64))])]),_:1})]),_:1})]),_:1})):a(``,!0),i(N,{shadow:`hover`},{default:g(()=>[t(`div`,Me,[t(`span`,Ne,r(e.$t(`usage.field.autoRefresh`)),1),i(z,{modelValue:e.autoRefresh,"onUpdate:modelValue":c[6]||=t=>e.autoRefresh=t},null,8,[`modelValue`])]),e.type===e.serviceType.API?f((T(),m(R,{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(L,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.api?.title),1)]),_:1},8,[`label`]),i(L,{label:e.$t(`usage.field.statusCode`),width:`120px`},{default:g(t=>[t.row.status_code?(T(),o(`span`,Pe,r(t.row.status_code),1)):(T(),m(B,{key:1,type:`warning`,size:`small`},{default:g(()=>[n(r(e.$t(`usage.value.processing`)),1)]),_:1}))]),_:1},8,[`label`]),i(L,{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(L,{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)?(T(),o(`div`,Fe,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)])):(T(),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(L,{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(L,{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?(T(),m(B,{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),(T(!0),o(s,null,S(e.getSimpleMetadata(i.row.metadata),(e,t)=>(T(),m(B,{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(L,{label:e.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:g(t=>[t.row.id?(T(),m(j,{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(L,{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?(T(),o(`span`,ze,[i(V,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(L,{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?(T(),o(`span`,Ve,[i(V,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(L,{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`])),[[K,e.loading]]):a(``,!0),e.type===e.serviceType.Proxy?f((T(),m(R,{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(L,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.service?.title),1)]),_:1},8,[`label`]),i(L,{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(L,{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(L,{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(L,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:g(e=>[(T(!0),o(s,null,S(e.row.metadata,(e,t)=>(T(),m(B,{key:t,class:`mb-2`},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))]),_:1},8,[`label`]),i(L,{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?(T(),o(`span`,Ue,[i(V,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(L,{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`])),[[K,e.loading]]):a(``,!0)]),_:1})]),_:1})]),_:1}),i(W,{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(U,{modelValue:e.detailActiveTab,"onUpdate:modelValue":c[7]||=t=>e.detailActiveTab=t},{default:g(()=>[i(H,{label:e.$t(`usage.dialog.request`),name:`request`},{default:g(()=>[e.detailLoading?(T(),m(O,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.request?(T(),o(`pre`,Ge,r(e.formatJson(e.detailRow.metadata.request)),1)):(T(),o(`p`,Ke,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),i(H,{label:e.$t(`usage.dialog.response`),name:`response`},{default:g(()=>[e.detailLoading?(T(),m(O,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.response?(T(),o(`pre`,qe,r(e.formatJson(e.detailRow.metadata.response)),1)):(T(),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(G,{"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=ne(_e,[[`render`,Xe],[`__scopeId`,`data-v-81b0a3c5`]]);export{Ze as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,T as o,at as s,ht as c,j as l,mt as u,ot as d,rt as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{n as h,t as g}from"./table-B1ktVOIV.js";import{t as _}from"./card-D-4S-l7a.js";import{n as ee,t as v}from"./row-ig5nVOkc.js";import{t as y}from"./empty-B1wenOj5.js";import{t as b}from"./skeleton-B3LIGUiE.js";import{t as x}from"./switch-CU7Lbydn.js";import{t as S}from"./boxes-wDC71gk_.js";import{t as C}from"./chart-no-axes-combined-Css_xsI4.js";import{t as w}from"./coins-CbJVFUNa.js";import{t as T}from"./wallet-Dx1JWzUk.js";import{$r as E,B as D,E as O,J as k,Li as A,Qr as j,Ti as M,ai as N,gi as P,hr as F,oi as I,vn as L,zi as R}from"./index-dzU0SACS.js";import{t as z}from"./CopyToClipboard-DOx2-KTG.js";import{t as B}from"./pagination-C5nrzUF9.js";var V=m({name:`ConsoleApplicationList`,components:{AnalyticsIcon:C,ApplicationsIcon:S,CreditsIcon:w,WalletIcon:T,Pagination:B,CopyToClipboard:z,ElTable:g,ElRow:v,ElButton:R,ElCol:ee,ElTag:A,ElSkeleton:b,ElSwitch:x,ElEmpty:y,ElTableColumn:h,ElCard:_},data(){return{credentialType:j,serviceType:E,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!L(this.$store.getters.site)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{rowCanPay(e){return L(this.$store.getters.site)?!1:P()?(e?.packages||[]).some(e=>e?.metadata?.apple_product_id):!0},updateAllowConsumeGlobal(e,t){!e||!e.id||F.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{M.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{M.error(this.$t(`application.message.updateFailed`).toString())})},onGoUsage(e){this.$router.push({name:k,query:{application_id:e.id,type:e?.service?.type}})},onBuyMore(e){e?.id&&this.$router.push({name:D,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=N.INDIVIDUAL){return new Promise((t,n)=>{F.getAll({limit:this.limit,...e===N.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:I.USAGE,scope:e}).then(({data:n})=>{e===N.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{M.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(N.INDIVIDUAL),this.onFetchApplications(N.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){F.create({type:I.USAGE,scope:N.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(N.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(m,h,g,_,ee,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=d(`loading`);return p(),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(m.$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(()=>[m.loading?(p(),l(x,{key:0})):(p(),a(`div`,U,[e(`div`,W,[r(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,G,n(m.$t(`application.title.count`)),1),e(`p`,K,n(m.individualApplicationsTotal),1),e(`p`,q,n(m.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),m.showGlobalPayment&&m.globalApplications?.length>0?(p(),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(()=>[m.loading?(p(),l(x,{key:0})):(p(),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(m.$t(`application.field.id`))+`: `+n(m.globalApplications?.[0]?.id)+` `,1),m.globalApplications?.[0]?.id?(p(),l(T,{key:0,content:m.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),e(`p`,Q,n(m.$t(`application.title.globalBalance`)),1),e(`p`,ne,n(m.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+n(m.$t(`service.unit.credits`)),1),e(`p`,re,n(m.$t(`application.message.globalBalanceDescription`)),1)]),e(`div`,ie,[r(D,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:h[0]||=e=>m.onGoUsage(m.globalApplications?.[0])},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.usage`)),1)]),_:1}),m.showGlobalPayment?(p(),l(D,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:h[1]||=e=>m.onBuyMore(m.globalApplications?.[0])},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$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((p(),l(M,{data:m.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":m.$t(`common.message.noData`)},{default:u(()=>[r(k,{prop:`id`,label:m.$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:m.$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`?(p(),l(A,{key:0,type:`success`,effect:`dark`,round:``},{default:u(()=>[t(n(m.$t(`application.type.period`)),1)]),_:1})):e.row?.type===`Usage`?(p(),l(A,{key:1,effect:`dark`,round:``},{default:u(()=>[t(n(m.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(k,{label:m.$t(`application.field.name`),width:`180px`},{default:u(r=>[e(`span`,null,n(r.row?.service?.title),1),r.row?.role===`grantee`?(p(),l(A,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:u(()=>[t(n(m.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(k,{prop:`remaining_amount`,label:m.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(m.getRemainingAmount(t.row)),1)]),_:1},8,[`label`]),r(k,{prop:`used_amount`,label:m.$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(m.getUsedAmount(t.row)),1)]),_:1},8,[`label`]),r(k,{prop:`allow_consume_global`,label:m.$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===m.serviceType.API?(p(),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=>m.updateAllowConsumeGlobal(e.row,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])):i(``,!0)]),_:1},8,[`label`]),r(k,{label:m.$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?(p(),a(`span`,oe,n(m.$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=>m.onGoUsage(a?.row)},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),m.rowCanPay(a?.row)?(p(),l(D,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>m.onBuyMore(a?.row)},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[F,m.loading]])]),_:1}),e(`div`,ce,[m.loading?(p(),l(x,{key:0,rows:4,animated:``})):(p(),a(o,{key:1},[m.individualApplications?.length?(p(!0),a(o,{key:1},f(m.individualApplications,o=>(p(),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`?(p(),l(A,{key:0,type:`success`,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(m.$t(`application.type.period`)),1)]),_:1})):o?.type===`Usage`?(p(),l(A,{key:1,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(m.$t(`application.type.usage`)),1)]),_:1})):i(``,!0),o?.role===`grantee`?(p(),l(A,{key:2,type:`info`,size:`small`,round:``},{default:u(()=>[t(n(m.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),e(`div`,de,[e(`span`,fe,n(m.$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(m.$t(`application.field.remainingAmount`)),1),e(`span`,me,n(m.getRemainingAmount(o)),1)]),o?.expired_at?(p(),a(`div`,he,[e(`span`,ge,n(m.$t(`application.field.expiredAt`)),1),e(`span`,_e,n(m.$dayjs.format(o.expired_at)),1)])):i(``,!0),o.service?.type===m.serviceType.API?(p(),a(`div`,ve,[e(`span`,ye,n(m.$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=>m.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=>m.onGoUsage(o)},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),m.rowCanPay(o)?(p(),l(D,{key:0,class:`!m-0 !px-3`,type:`primary`,round:``,size:`small`,onClick:e=>m.onBuyMore(o)},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:2},1024))),128)):(p(),l(N,{key:0,description:m.$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":m.page,"page-size":m.limit,total:m.individualApplicationsTotal,onChange:m.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Ce=O(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 d,rt as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{n as h,t as g}from"./table-C9iSQAZO.js";import{t as _}from"./card-D-4S-l7a.js";import{n as ee,t as v}from"./row-B6o6HQls.js";import{t as y}from"./empty-B1wenOj5.js";import{t as b}from"./skeleton-B3LIGUiE.js";import{t as x}from"./switch-DGps_uPH.js";import{t as S}from"./boxes-JieFrmM4.js";import{t as C}from"./chart-no-axes-combined-B8sKdzP9.js";import{t as w}from"./coins-DoRhV5HR.js";import{t as T}from"./wallet-Cu4DWt4b.js";import{$r as E,B as D,E as O,J as k,Li as A,Qr as j,Ti as M,ai as N,gi as P,hr as F,oi as I,vn as L,zi as R}from"./index-tKADgCY9.js";import{t as z}from"./CopyToClipboard-DPVMD9O4.js";import{t as B}from"./pagination-BnQgCM-x.js";var V=m({name:`ConsoleApplicationList`,components:{AnalyticsIcon:C,ApplicationsIcon:S,CreditsIcon:w,WalletIcon:T,Pagination:B,CopyToClipboard:z,ElTable:g,ElRow:v,ElButton:R,ElCol:ee,ElTag:A,ElSkeleton:b,ElSwitch:x,ElEmpty:y,ElTableColumn:h,ElCard:_},data(){return{credentialType:j,serviceType:E,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!L(this.$store.getters.site)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{rowCanPay(e){return L(this.$store.getters.site)?!1:P()?(e?.packages||[]).some(e=>e?.metadata?.apple_product_id):!0},updateAllowConsumeGlobal(e,t){!e||!e.id||F.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{M.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{M.error(this.$t(`application.message.updateFailed`).toString())})},onGoUsage(e){this.$router.push({name:k,query:{application_id:e.id,type:e?.service?.type}})},onBuyMore(e){e?.id&&this.$router.push({name:D,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=N.INDIVIDUAL){return new Promise((t,n)=>{F.getAll({limit:this.limit,...e===N.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:I.USAGE,scope:e}).then(({data:n})=>{e===N.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{M.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(N.INDIVIDUAL),this.onFetchApplications(N.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){F.create({type:I.USAGE,scope:N.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(N.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(m,h,g,_,ee,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=d(`loading`);return p(),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(m.$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(()=>[m.loading?(p(),l(x,{key:0})):(p(),a(`div`,U,[e(`div`,W,[r(S,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,G,n(m.$t(`application.title.count`)),1),e(`p`,K,n(m.individualApplicationsTotal),1),e(`p`,q,n(m.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),m.showGlobalPayment&&m.globalApplications?.length>0?(p(),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(()=>[m.loading?(p(),l(x,{key:0})):(p(),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(m.$t(`application.field.id`))+`: `+n(m.globalApplications?.[0]?.id)+` `,1),m.globalApplications?.[0]?.id?(p(),l(T,{key:0,content:m.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),e(`p`,Q,n(m.$t(`application.title.globalBalance`)),1),e(`p`,ne,n(m.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+n(m.$t(`service.unit.credits`)),1),e(`p`,re,n(m.$t(`application.message.globalBalanceDescription`)),1)]),e(`div`,ie,[r(D,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:h[0]||=e=>m.onGoUsage(m.globalApplications?.[0])},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.usage`)),1)]),_:1}),m.showGlobalPayment?(p(),l(D,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:h[1]||=e=>m.onBuyMore(m.globalApplications?.[0])},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$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((p(),l(M,{data:m.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":m.$t(`common.message.noData`)},{default:u(()=>[r(k,{prop:`id`,label:m.$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:m.$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`?(p(),l(A,{key:0,type:`success`,effect:`dark`,round:``},{default:u(()=>[t(n(m.$t(`application.type.period`)),1)]),_:1})):e.row?.type===`Usage`?(p(),l(A,{key:1,effect:`dark`,round:``},{default:u(()=>[t(n(m.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(k,{label:m.$t(`application.field.name`),width:`180px`},{default:u(r=>[e(`span`,null,n(r.row?.service?.title),1),r.row?.role===`grantee`?(p(),l(A,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:u(()=>[t(n(m.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(k,{prop:`remaining_amount`,label:m.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(m.getRemainingAmount(t.row)),1)]),_:1},8,[`label`]),r(k,{prop:`used_amount`,label:m.$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(m.getUsedAmount(t.row)),1)]),_:1},8,[`label`]),r(k,{prop:`allow_consume_global`,label:m.$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===m.serviceType.API?(p(),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=>m.updateAllowConsumeGlobal(e.row,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])):i(``,!0)]),_:1},8,[`label`]),r(k,{label:m.$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?(p(),a(`span`,oe,n(m.$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=>m.onGoUsage(a?.row)},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),m.rowCanPay(a?.row)?(p(),l(D,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>m.onBuyMore(a?.row)},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[F,m.loading]])]),_:1}),e(`div`,ce,[m.loading?(p(),l(x,{key:0,rows:4,animated:``})):(p(),a(o,{key:1},[m.individualApplications?.length?(p(!0),a(o,{key:1},f(m.individualApplications,o=>(p(),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`?(p(),l(A,{key:0,type:`success`,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(m.$t(`application.type.period`)),1)]),_:1})):o?.type===`Usage`?(p(),l(A,{key:1,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(m.$t(`application.type.usage`)),1)]),_:1})):i(``,!0),o?.role===`grantee`?(p(),l(A,{key:2,type:`info`,size:`small`,round:``},{default:u(()=>[t(n(m.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),e(`div`,de,[e(`span`,fe,n(m.$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(m.$t(`application.field.remainingAmount`)),1),e(`span`,me,n(m.getRemainingAmount(o)),1)]),o?.expired_at?(p(),a(`div`,he,[e(`span`,ge,n(m.$t(`application.field.expiredAt`)),1),e(`span`,_e,n(m.$dayjs.format(o.expired_at)),1)])):i(``,!0),o.service?.type===m.serviceType.API?(p(),a(`div`,ve,[e(`span`,ye,n(m.$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=>m.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=>m.onGoUsage(o)},{default:u(()=>[r(E,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),m.rowCanPay(o)?(p(),l(D,{key:0,class:`!m-0 !px-3`,type:`primary`,round:``,size:`small`,onClick:e=>m.onBuyMore(o)},{default:u(()=>[r(O,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(m.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:2},1024))),128)):(p(),l(N,{key:0,description:m.$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":m.page,"page-size":m.limit,total:m.individualApplicationsTotal,onChange:m.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Ce=O(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 ee}from"./switch-
|
|
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 ee}from"./switch-DGps_uPH.js";import{t as h}from"./file-Yc-6a-e-.js";import{t as g}from"./folder-D28_V3sU.js";import{t as te}from"./mouse-pointer-2-CR02XkBx.js";import{t as _}from"./pencil-D5dsgh1k.js";import{t as v}from"./plus-CK2JFYNP.js";import{t as y}from"./shield-BiAfGNET.js";import{t as b}from"./terminal-CxpLlw3l.js";import{t as x}from"./wand-sparkles-Dhrc68i4.js";import{Ci as S,E as C,Ji as w,Li as T,O as E,gr as D,mi as ne,ui as O,zi as k}from"./index-tKADgCY9.js";var A=S(`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=S(`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=S(`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=S(`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:v,ElButton:k,ElTag:T,ElSwitch:ee,ElInput:w,FolderIcon:g,MagicIcon:x,SecurityIcon:y},data(){return{roots:[],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!!E()},android(){return ne()},canInstallXhs(){return this.a11yEnabled&&this.computerUse}},async mounted(){let e=E();if(!e)return;let t=await e.getConfig();this.roots=t.roots,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 E()?.perm?.status();this.a11yEnabled=e?.accessibility===!0}finally{this.refreshingA11y=!1}}},async openAndroidAccessibility(){await E()?.perm?.openPane(`accessibility`)},async fetchXhsSkill(){this.xhsLoading=!0,this.xhsError=``;try{let e=await D.get(`/skills/`,{baseURL:`${O()}/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 D.post(`/skills/${e.id}/install/`,{},{baseURL:`${O()}/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=E();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 addFolder(){let e=await E()?.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-
|
|
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-D-1MGMXO.js";import{E as c}from"./index-tKADgCY9.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{E as a,ln as o}from"./index-
|
|
1
|
+
import{A as e,N as t,qt as n,tt as r,z as i}from"./vendor-chart-Dw-P17PN.js";import{E as a,ln as o}from"./index-tKADgCY9.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{t as f}from"./Navigator-
|
|
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{t as f}from"./Navigator-Cf9dv3dJ.js";import{t as p}from"./checkbox-CeoqKfX8.js";import{t as m}from"./divider-BNWJAaA2.js";import"./constants-7uZLiijT.js";import{Ai as h,E as g,Jt as _,Ti as v,ai as y,ci as b,di as x,hr as S,oi as C,zi as w}from"./index-tKADgCY9.js";import{t as T}from"./Status-SQ6bR-7G.js";var E=d({name:`ApplicationConfirm`,components:{ElDialog:h,ElDivider:m,ElCheckbox:p,ElButton:w},props:{visible:{type:Boolean,required:!1,default:!1}},emits:[`update:visible`,`apply`],data(){return{checked:!0}},watch:{},methods:{getBaseUrlPlatform:x,onApply(){if(!this.checked){v.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=g(E,[[`render`,M]]),P=15e3,F=d({name:`LayoutMain`,components:{Navigator:f,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===b.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=_(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:C.USAGE,scope:y.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`):v.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`;v({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=g(F,[[`render`,L],[`__scopeId`,`data-v-334ded1d`]]);export{R as default};
|