@acedatacloud/nexior 3.335.5 → 3.336.1
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-C1prTZR8.js → ApiCodeButton-B4l1tVOr.js} +1 -1
- package/dist/assets/{Artifacts-DHfeaeAy.js → Artifacts-C7m89Fr0.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-Dla1Pa6c.js → AskUserQuestionCard-iKo1J7N9.js} +1 -1
- package/dist/assets/{AudioPreview-Crro7b0d.js → AudioPreview-BYbExLbb.js} +1 -1
- package/dist/assets/{Auth-qk6kQVyj.js → Auth-C0k6Vg99.js} +1 -1
- package/dist/assets/{Bare-DxFsZ9vq.js → Bare-MagjIu46.js} +1 -1
- package/dist/assets/{BotPlaceholder-j7c5SCba.js → BotPlaceholder-C44_0Ntn.js} +1 -1
- package/dist/assets/{BottomFooter-COvNCUpV.js → BottomFooter-bRCnDtLK.js} +1 -1
- package/dist/assets/{Callback-BkKI9IYG.js → Callback-Dj_c2ZnD.js} +1 -1
- package/dist/assets/{CodeSnippet-B6c_BnNH.js → CodeSnippet-B0VSWmDE.js} +1 -1
- package/dist/assets/{Console-Du0m1pVs.js → Console-CMBegHJD.js} +1 -1
- package/dist/assets/{Consumption-B6v__qih.js → Consumption-D7JkBL3g.js} +1 -1
- package/dist/assets/{Conversation-C8D0doot.js → Conversation-DqG4TDJR.js} +1 -1
- package/dist/assets/{Conversation-zwmHTP7n.js → Conversation-jm7SDZvn.js} +1 -1
- package/dist/assets/{CopyToClipboard-JbAG_2zY.js → CopyToClipboard-UlK2GDZ1.js} +1 -1
- package/dist/assets/{Detail-Ce69sD1p.js → Detail-ZJ01nMv0.js} +2 -2
- package/dist/assets/{Extra-BWcy1fG-.js → Extra-BiryjQ7i.js} +1 -1
- package/dist/assets/{FilePreview-Fe61h6bn.js → FilePreview-cBuGGbYT.js} +1 -1
- package/dist/assets/{Hailuo-CMrBOOJR.js → Hailuo-V2xxR84v.js} +1 -1
- package/dist/assets/{History-1vOL16Kp.js → History-D4b51CMh.js} +1 -1
- package/dist/assets/{ImagePreview-21F7rQMY.js → ImagePreview-CRW3UHm8.js} +1 -1
- package/dist/assets/{ImageWrapper-D1vqcv7B.js → ImageWrapper-BIQNX8zb.js} +1 -1
- package/dist/assets/{Index-BlX3GhWN.js → Index-3xKSb83G.js} +1 -1
- package/dist/assets/{Index-kpsB4iW6.js → Index-7hcg-Yxq.js} +1 -1
- package/dist/assets/{Index-DjswrD3Q.js → Index-B-ADQI6r.js} +1 -1
- package/dist/assets/{Index-DJ5XVDVs.js → Index-B3X0oSoo.js} +1 -1
- package/dist/assets/{Index-Duv0W0L12.js → Index-ByZz7vdC2.js} +1 -1
- package/dist/assets/{Index-s2VzyTg8.js → Index-C5W5mALc.js} +1 -1
- package/dist/assets/{Index-C_uzOLRM.js → Index-CA0y4eMx.js} +1 -1
- package/dist/assets/{Index-FN6jaA_r2.js → Index-CGLjTMlm2.js} +1 -1
- package/dist/assets/{Index-DPqgbI0e.js → Index-CS-_FUtq.js} +1 -1
- package/dist/assets/{Index-B69Q_C8n.js → Index-CcrB6emo.js} +1 -1
- package/dist/assets/{Index-C3W6d9eu.js → Index-CjW9fRnV.js} +1 -1
- package/dist/assets/{Index-C6xWXHsW.js → Index-Ck8AV1wF.js} +1 -1
- package/dist/assets/{Index-DAzA_iM5.js → Index-CoshymF6.js} +1 -1
- package/dist/assets/{Index-DporpXPl.js → Index-CuT0krUz.js} +1 -1
- package/dist/assets/{Index-CCBNOxa1.js → Index-CxtxtH1W.js} +1 -1
- package/dist/assets/{Index-a1tThWVc.js → Index-DNBejuK6.js} +1 -1
- package/dist/assets/{Index-CXA_FZeT.js → Index-DRt6fU6O.js} +1 -1
- package/dist/assets/{Index-DCUdqkxD.js → Index-DUXlDF6h.js} +1 -1
- package/dist/assets/{Index-CP8OBFgU2.js → Index-DVZbaW0R2.js} +1 -1
- package/dist/assets/{Index-DuOlffys.js → Index-DaahqTQ9.js} +1 -1
- package/dist/assets/{Index-C4nHb5b52.js → Index-DdnexpU62.js} +1 -1
- package/dist/assets/{Index-DNeUbOb32.js → Index-DrCJMP1w2.js} +1 -1
- package/dist/assets/{Index-DWw68Ffj.js → Index-DrmjPNk0.js} +1 -1
- package/dist/assets/{Index-CWmyTuPX2.js → Index-Dt4DZnvq2.js} +1 -1
- package/dist/assets/{Index-DtrJDjgZ.js → Index-IxXAz5ZE.js} +1 -1
- package/dist/assets/{Index-CNMci9Hh.js → Index-LepB-oJD.js} +1 -1
- package/dist/assets/{Index-DQByZtGQ2.js → Index-PXGccZdy2.js} +1 -1
- package/dist/assets/{Index-Dtgjt-hC.js → Index-pIeZW9Wl.js} +1 -1
- package/dist/assets/{Index-ukswYCsc.js → Index-pO-Ofr6z.js} +1 -1
- package/dist/assets/{Index-BsTV4ozD.js → Index-wEYp7QgE.js} +1 -1
- package/dist/assets/{Invitees-zujxEWdu.js → Invitees-aJ-MKoye.js} +1 -1
- package/dist/assets/{List-BnH9O8j9.js → List-DOzth64L.js} +1 -1
- package/dist/assets/{List-c8sWu1SD.js → List-DfksnY8F.js} +1 -1
- package/dist/assets/{List-BVwt59lx.js → List-kdKY47SQ.js} +1 -1
- package/dist/assets/{LocalTools-BL9h-LIy.js → LocalTools-Cguxk6HX.js} +1 -1
- package/dist/assets/{LocalTools-CsdKkua8.js → LocalTools-mA4qi1R9.js} +1 -1
- package/dist/assets/{Main-C7Ye1b-V.js → Main-Chc8vW7j.js} +1 -1
- package/dist/assets/{Message-DvJoRqE5.js → Message-BVyTN4hs.js} +1 -1
- package/dist/assets/{Model-BsMcHTxr.js → Model-B3W0Qiqw.js} +1 -1
- package/dist/assets/{Navigator-DB6Ps79A.js → Navigator-DYdlpuiT.js} +3 -3
- package/dist/assets/{NotFound-CDM3Mxti.js → NotFound-iSjs67y2.js} +1 -1
- package/dist/assets/{Pay-BHOEsivu.js → Pay-BnL-P72n.js} +1 -1
- package/dist/assets/{Player-CayrOA5T.js → Player-DE0PLM1u.js} +1 -1
- package/dist/assets/{Poivelle-tKpdLKbo.js → Poivelle-D2YwHOKp.js} +1 -1
- package/dist/assets/{PromptTextarea-73jKA0TY.js → PromptTextarea-bkyHuBBi.js} +1 -1
- package/dist/assets/{RealtimeCall-DmuI0qxr.js → RealtimeCall-Awjw1dRy.js} +1 -1
- package/dist/assets/ScheduledTasks-CcwR9n4c.js +2 -0
- package/dist/assets/ScheduledTasks-DGIsLmDx.css +1 -0
- package/dist/assets/{Status-DdJfXqii.js → Status-BOIkP48G.js} +1 -1
- package/dist/assets/{Subscribe-CzTOm3ky.js → Subscribe-BdP5FyXB.js} +1 -1
- package/dist/assets/{TabSwitcher-BgMfDJT8.js → TabSwitcher-QNcJdpZi.js} +1 -1
- package/dist/assets/{Tts-Dbu-NdQ1.js → Tts-ChZMPBMS.js} +1 -1
- package/dist/assets/{VideoPlayer-bAVlQvSo.js → VideoPlayer-CBQ5wjBb.js} +1 -1
- package/dist/assets/{alert-CPMxc_VQ.js → alert-DlbJ70nF.js} +1 -1
- package/dist/assets/arrow-down-DamfD3bh.js +1 -0
- package/dist/assets/{arrow-down-wide-narrow-DMYSRouH.js → arrow-down-wide-narrow-9072-YD_.js} +1 -1
- package/dist/assets/arrow-left-D9daoc-O.js +1 -0
- package/dist/assets/arrow-right-CAU0_rYv.js +1 -0
- package/dist/assets/arrow-up-uKzSHEUb.js +1 -0
- package/dist/assets/{avatar-CMBc9K0q.js → avatar-Cd7tHiGS.js} +1 -1
- package/dist/assets/{basic-CTHhE1tu.js → basic-gBVraDla.js} +1 -1
- package/dist/assets/{box-BR-nqyA-.js → box-BnmqC9Hb.js} +1 -1
- package/dist/assets/{boxes-BOasP2Uf.js → boxes-D9CjHyPy.js} +1 -1
- package/dist/assets/{brain-C-WO1S9h.js → brain-BQtF4WyF.js} +1 -1
- package/dist/assets/{chart-no-axes-combined-CFNb_B2u.js → chart-no-axes-combined-C6a3Jfmv.js} +1 -1
- package/dist/assets/{chat-BLTxILLN.js → chat-4vCG-pBv.js} +1 -1
- package/dist/assets/{chat-CMAmKF8r.js → chat-5DHtfSjs.js} +1 -1
- package/dist/assets/{chat-BIqfR8cs.js → chat-BGTplTgP.js} +1 -1
- package/dist/assets/{chat-DdZ5ymCe.js → chat-BS0G8LYI.js} +1 -1
- package/dist/assets/{chat-BlcxfF76.js → chat-BgGqKHoW.js} +1 -1
- package/dist/assets/{chat-DW2jd-d6.js → chat-CGKSznil.js} +1 -1
- package/dist/assets/{chat-nKDRVHvT.js → chat-CKt_ulVA.js} +1 -1
- package/dist/assets/{chat-BNNc9BAl.js → chat-CYUlxCUP.js} +1 -1
- package/dist/assets/{chat-Dtvn7hRi.js → chat-ClKQCbP7.js} +1 -1
- package/dist/assets/{chat-DnXSHlhm.js → chat-CzCdLTfT.js} +1 -1
- package/dist/assets/{chat-SD9teH7Z.js → chat-D6TO-wix.js} +1 -1
- package/dist/assets/{chat-C_aGpUD4.js → chat-DD_RExH8.js} +1 -1
- package/dist/assets/{chat-CakjJ4DP.js → chat-DI0vEBmP.js} +1 -1
- package/dist/assets/{chat-DVAwsfzj.js → chat-DJPUulFU.js} +1 -1
- package/dist/assets/chat-DNwL1QEi.js +1 -0
- package/dist/assets/{chat-D0sBL8JD.js → chat-DgeBaoFP.js} +1 -1
- package/dist/assets/{chat-BqqRrrTq.js → chat-UlncvA7m.js} +1 -1
- package/dist/assets/{chat-Dti6T7d1.js → chat-hE0UxNXN.js} +1 -1
- package/dist/assets/{chat-BagOtsUQ.js → chat-uKODVAmK.js} +1 -1
- package/dist/assets/check-Cc-gtMK9.js +1 -0
- package/dist/assets/chevron-down-5l02buns.js +1 -0
- package/dist/assets/chevron-right-BJjM2BPw.js +1 -0
- package/dist/assets/circle-check-CVci65aA.js +1 -0
- package/dist/assets/clock-Zko38AEz.js +1 -0
- package/dist/assets/{codingBridge-CFP8iYVV.js → codingBridge-BOLGhVbN.js} +1 -1
- package/dist/assets/{codingBridgeNotify-DHwuFUTs.js → codingBridgeNotify-Bh5E_WIu.js} +2 -2
- package/dist/assets/{coins-D02Zc6bQ.js → coins-D2UaeE3W.js} +1 -1
- package/dist/assets/{collapse-B8YnkTbi.js → collapse-BBdps8Cp.js} +1 -1
- package/dist/assets/{console-D8T3FTmC.js → console-8-llNzpt.js} +1 -1
- package/dist/assets/{console-ChtK8IZU.js → console-BYoXY7Mq.js} +1 -1
- package/dist/assets/{console-C-Y79VuI.js → console-BjHupo1H.js} +1 -1
- package/dist/assets/{console-BV-s4k9R.js → console-BlE18AsL.js} +1 -1
- package/dist/assets/{console-BneERGsN.js → console-ByVCHa7B.js} +1 -1
- package/dist/assets/{console-D76Q7sWr.js → console-C0U5ZaLj.js} +1 -1
- package/dist/assets/{console-DzSCokV6.js → console-CHl5cKPo.js} +1 -1
- package/dist/assets/{console-YNgq2ll_.js → console-CTaNoQRw.js} +1 -1
- package/dist/assets/{console-CXSvfRbE.js → console-CdE3x2I2.js} +1 -1
- package/dist/assets/{console-CRmsXfEv.js → console-CoLSqTi8.js} +1 -1
- package/dist/assets/{console-C6ISka3K.js → console-CwijIfDn.js} +1 -1
- package/dist/assets/{console-CmIeODv1.js → console-DA-7dvFw.js} +1 -1
- package/dist/assets/{console-CJACeOji.js → console-DG6gSR35.js} +1 -1
- package/dist/assets/{console-CgJU1YfY.js → console-Dmz4CZnP.js} +1 -1
- package/dist/assets/{console-DL1RVKKl.js → console-EwB--fdG.js} +1 -1
- package/dist/assets/{console-CfWt5-zM.js → console-TykBxenh.js} +1 -1
- package/dist/assets/{console-DevcRfeI.js → console-dN-jBMvk.js} +1 -1
- package/dist/assets/{console-BPJC3f2G.js → console-edJQ5l-h.js} +1 -1
- package/dist/assets/{constants-B7y9pxL6.js → constants-C45zS9hd.js} +1 -1
- package/dist/assets/{copy-DCq9IJPO.js → copy-fPtchUBf.js} +1 -1
- package/dist/assets/{createTaskActions-DH_w7PHH.js → createTaskActions-wTIQ_1Hj.js} +1 -1
- package/dist/assets/{digitalhuman-eG1DhjdQ.js → digitalhuman-CxK5rfiO.js} +1 -1
- package/dist/assets/{dollar-sign-DTrp2CR-.js → dollar-sign-C1xhgwfY.js} +1 -1
- package/dist/assets/{download-C91z3UAa.js → download-C6_Lkc27.js} +1 -1
- package/dist/assets/{drawer-CZm7p6ws.js → drawer-xHfVA3B7.js} +1 -1
- package/dist/assets/{dropdown-CrB0e-Wn.js → dropdown-CYQeIt3k.js} +1 -1
- package/dist/assets/{dropdown-BxIAdTG6.js → dropdown-s7FVCJOU.js} +1 -1
- package/dist/assets/{ellipsis-BxpxgMzW.js → ellipsis-Bj2fDILI.js} +1 -1
- package/dist/assets/{esm-BlUwyCPm.js → esm-BvgKU_ih.js} +1 -1
- package/dist/assets/{esm-CJMKIdcP.js → esm-Ci_LAIiK.js} +1 -1
- package/dist/assets/{esm-CPykfSxz.js → esm-D8gUqLRy.js} +2 -2
- package/dist/assets/{esm-Bai1ds9s.js → esm-DHMPJTAz.js} +2 -2
- package/dist/assets/esm-DZqbl0IO.js +1 -0
- package/dist/assets/{esm-BDHccfCY.js → esm-DyVJibwn.js} +1 -1
- package/dist/assets/{esm-C7holhBZ.js → esm-YDO_Ul4a.js} +3 -3
- package/dist/assets/{external-link-Bpj3zQsB.js → external-link-CaRCPH3m.js} +1 -1
- package/dist/assets/{eye-Bj_MYt86.js → eye-BMmxz2ya.js} +1 -1
- package/dist/assets/{file-output-C6m-P9uv.js → file-output-CXhW1Vlg.js} +1 -1
- package/dist/assets/{file-text-C-1EpFHP.js → file-text-BYLy-sPD.js} +1 -1
- package/dist/assets/{fish-BgrqaTOf.js → fish-DmJKFFyz.js} +1 -1
- package/dist/assets/{flux-CQkeeEk-.js → flux-D2HppgI3.js} +1 -1
- package/dist/assets/{folder-Br8glyb6.js → folder-DZT47PmT.js} +1 -1
- package/dist/assets/gauge-TOoz29Pt.js +1 -0
- package/dist/assets/{globe-MR9_A_SI.js → globe-3iT6oet3.js} +1 -1
- package/dist/assets/{grokvideo-BH3aUM9p.js → grokvideo-abFDVZBJ.js} +1 -1
- package/dist/assets/{hailuo-DNMC0M2j.js → hailuo-BI6BL6J9.js} +1 -1
- package/dist/assets/{headphones-99kxvAbE.js → headphones-BnsSNzpR.js} +1 -1
- package/dist/assets/{history-_3eSXVF_.js → history-CdtMUGT2.js} +1 -1
- package/dist/assets/{house-DfVZv_vY.js → house-DysWxNX3.js} +1 -1
- package/dist/assets/{i18n-CTzo1oyX.js → i18n-oacXripk.js} +1 -1
- package/dist/assets/{image-C9dUkTCq.js → image-DTRMQnYU.js} +1 -1
- package/dist/assets/{index-suPyrMld.js → index-DqO3RKoH.js} +4 -4
- package/dist/assets/{index.browser.esm-D22TmECZ.js → index.browser.esm-CY96Hxd1.js} +1 -1
- package/dist/assets/{index.es-Crpkjxh_.js → index.es-XDuz6GZk.js} +1 -1
- package/dist/assets/{info-A5v3l0In.js → info-TLZ25BWo.js} +1 -1
- package/dist/assets/{input-number-DevINDGA.js → input-number-BClb9pco.js} +1 -1
- package/dist/assets/{key-round-DTKfZARF.js → key-round-7qf2d4ub.js} +1 -1
- package/dist/assets/{kling-BuroQ-Mv.js → kling-DT0ZggG_.js} +1 -1
- package/dist/assets/{languages-CTzB5s_j.js → languages-CgpwU7KZ.js} +1 -1
- package/dist/assets/{laptop-COi5xI9B.js → laptop-DfepbFs_.js} +1 -1
- package/dist/assets/{lightbulb-B31To7_F.js → lightbulb-9Lfam6gx.js} +1 -1
- package/dist/assets/{link-Buxrib6k.js → link-Bq0lkWio.js} +1 -1
- package/dist/assets/loader-circle-BfC4dqBW.js +1 -0
- package/dist/assets/{luma-Cm_Cht4-.js → luma-Bhdn0_zD.js} +1 -1
- package/dist/assets/{maestro-C4F0Pvaa.js → maestro-BW6hX9jy.js} +1 -1
- package/dist/assets/{maestro-CL8l072f.js → maestro-DOHvvowT.js} +1 -1
- package/dist/assets/{mail-D-Mr272S.js → mail-BTt4f0LZ.js} +1 -1
- package/dist/assets/{message-circle-Br2fsi1O.js → message-circle-BtSdY30x.js} +1 -1
- package/dist/assets/{mic-Cz6lKCSS.js → mic-DylLkdjl.js} +1 -1
- package/dist/assets/{midjourney-CIugrnYu.js → midjourney-D4g-dBCy.js} +1 -1
- package/dist/assets/{mobileLocalExec-BQdEW4_C.js → mobileLocalExec-00PZAOE8.js} +2 -2
- package/dist/assets/{mouse-pointer-2-D8G86izG.js → mouse-pointer-2-GULNpi4q.js} +1 -1
- package/dist/assets/music-2-in3kjurP.js +1 -0
- package/dist/assets/{nanobanana-725-Oy5l.js → nanobanana-B3T8V1hX.js} +1 -1
- package/dist/assets/{omni-OwXTZSJ6.js → omni-k14fnhha.js} +1 -1
- package/dist/assets/{openaiimage-CWzseZ6G.js → openaiimage-Bd9BkP3f.js} +1 -1
- package/dist/assets/{pagination-BXKKsIUG.js → pagination-CeYQWqTe.js} +1 -1
- package/dist/assets/{pagination-OYVQdfTy.js → pagination-XVsSjZIU.js} +1 -1
- package/dist/assets/{palette-DMSZgIex.js → palette-D8WDZIQ6.js} +1 -1
- package/dist/assets/{paperclip-BJrPgMmT.js → paperclip-BljsVJv_.js} +1 -1
- package/dist/assets/{pause-DQXwGExW.js → pause-BeFeR6SN.js} +1 -1
- package/dist/assets/{pencil-DJuXURuW.js → pencil-DAHD3MGa.js} +1 -1
- package/dist/assets/{pika-CRmwNCcF.js → pika-D8TvnsSN.js} +1 -1
- package/dist/assets/{pixverse-yEpT07ts.js → pixverse-COT6HNBd.js} +1 -1
- package/dist/assets/play-C9EcgCez.js +1 -0
- package/dist/assets/plus-B9ZI1sUd.js +1 -0
- package/dist/assets/{poivelle-Ct3g8hgz.js → poivelle-DPHMM_nd.js} +1 -1
- package/dist/assets/{popover-Bi9db4c3.js → popover-C1MUt-sq.js} +1 -1
- package/dist/assets/{producer-B-vH-bg5.js → producer-Clgne1rR.js} +1 -1
- package/dist/assets/{qrart-D4z51dae.js → qrart-Cw5rgoVv.js} +1 -1
- package/dist/assets/{realtime-BThU7Bqh.js → realtime-B3Ym4V7w.js} +1 -1
- package/dist/assets/{refresh-cw-Be8y3azU.js → refresh-cw-CORK6QMI.js} +1 -1
- package/dist/assets/rotate-ccw-RuQy-Dd3.js +1 -0
- package/dist/assets/rotate-cw-Dq-JDoxI.js +1 -0
- package/dist/assets/{row-DzBNdvwT.js → row-CyazZ63X.js} +1 -1
- package/dist/assets/search-DrSfiz8p.js +1 -0
- package/dist/assets/{seedance-CbVE9-E1.js → seedance-ftho0Cab.js} +1 -1
- package/dist/assets/{seedream-Bo-_Dqki.js → seedream-C7OYor2M.js} +1 -1
- package/dist/assets/{select-B-0w-lnr.js → select-Ahh1HtiI.js} +1 -1
- package/dist/assets/{serp-Bs-BIzlY.js → serp-BAur_r7x.js} +1 -1
- package/dist/assets/{shield-BYUqAK8t.js → shield-pXoBoWKG.js} +1 -1
- package/dist/assets/{shuffle-UoWxJc_f.js → shuffle-DYxLUWPX.js} +1 -1
- package/dist/assets/{slider-CtU2kt6F.js → slider-oG7zTf6G.js} +1 -1
- package/dist/assets/{sliders-horizontal-vJv-JpCL.js → sliders-horizontal-C1Mpn9mt.js} +1 -1
- package/dist/assets/{solana-wallets-Did-yJEI.js → solana-wallets-DZUKVi2b.js} +2 -2
- package/dist/assets/{solana-wallets-vue-BnsLnZIr.js → solana-wallets-vue-Bc9dzzHl.js} +1 -1
- package/dist/assets/{sora-HfSt64AZ.js → sora-CR0H6Q0o.js} +1 -1
- package/dist/assets/{sparkles-Di5XKsYy.js → sparkles-BazFXY9U.js} +1 -1
- package/dist/assets/square-DK7CrPHW.js +1 -0
- package/dist/assets/{suno-CdNBxUQq.js → suno-aCu9Hrh8.js} +1 -1
- package/dist/assets/{switch-DznsotcK.js → switch-BRhNWQBv.js} +1 -1
- package/dist/assets/{table-Blx50ajn.js → table-DD9gDMtN.js} +1 -1
- package/dist/assets/{tabs-Txs7sJeM.js → tabs-Qw07hKJ5.js} +1 -1
- package/dist/assets/{tag-CiwsnN_C.js → tag-DuHozyIF.js} +1 -1
- package/dist/assets/{taskDrawerMixin-C9NBskM9.js → taskDrawerMixin-DD5y0W4q.js} +1 -1
- package/dist/assets/terminal-CVTwU1By.js +1 -0
- package/dist/assets/{time-picker-TsCU_Pqk.js → time-picker-WD99cn3x.js} +1 -1
- package/dist/assets/{tooltip-CJbvbxG2.js → tooltip-CWf3RfDZ.js} +1 -1
- package/dist/assets/{trash-2-yf3LOXdo.js → trash-2-CYUFgSIW.js} +1 -1
- package/dist/assets/{triangle-alert-DNLhbtsl.js → triangle-alert-C0xzbNpO.js} +1 -1
- package/dist/assets/{upload-BgKAgBum.js → upload-DjXw6Rtx.js} +1 -1
- package/dist/assets/{upload-OPIFGjfu.js → upload-Tb1Jm-HV.js} +1 -1
- package/dist/assets/user-CGRKXtHA.js +1 -0
- package/dist/assets/{veo-w6pMS8tS.js → veo-pyIdrCwz.js} +1 -1
- package/dist/assets/{video-CU9Ew6Mb.js → video-DNJWM6rT.js} +1 -1
- package/dist/assets/{volume-2-D3fyHyuL.js → volume-2-Cm44Sohp.js} +1 -1
- package/dist/assets/{wallet-CvUeACqH.js → wallet-DO9-OGI8.js} +1 -1
- package/dist/assets/{wan-C2NLBBiR.js → wan-BVCgN14M.js} +1 -1
- package/dist/assets/{wand-sparkles-Rd8qSrdr.js → wand-sparkles-DYow-1ZH.js} +1 -1
- package/dist/assets/{web-C3GWndNM.js → web-BaaqEdcZ.js} +1 -1
- package/dist/assets/{web-Dja4x9bd.js → web-BjXxW3pG.js} +1 -1
- package/dist/assets/{web-QOExVgHF.js → web-CAGRzgHb.js} +1 -1
- package/dist/assets/{web-Cb2JiItF.js → web-Cb7qSPfu.js} +1 -1
- package/dist/assets/{web-Bi0BDSRE.js → web-Rm3Qia_u.js} +1 -1
- package/dist/assets/{webextrator-_u8gC8Sa.js → webextrator-j6UOnkgo.js} +1 -1
- package/dist/assets/{zap-BrKD08Fz.js → zap-BiFSDO6A.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/dist/assets/ScheduledTasks-BDatrndO.css +0 -1
- package/dist/assets/ScheduledTasks-Mhbtik9i.js +0 -2
- package/dist/assets/arrow-down-Dkbf61NQ.js +0 -1
- package/dist/assets/arrow-left-C1x7N3xi.js +0 -1
- package/dist/assets/arrow-right-DFc8Htfv.js +0 -1
- package/dist/assets/arrow-up-DINhziQu.js +0 -1
- package/dist/assets/chat-DbJ01won.js +0 -1
- package/dist/assets/check-D4UxIiKJ.js +0 -1
- package/dist/assets/chevron-down-CfxcDgqu.js +0 -1
- package/dist/assets/chevron-right-D-OyM_k_.js +0 -1
- package/dist/assets/circle-check-BzGLOmyv.js +0 -1
- package/dist/assets/clock-vhFCjsKg.js +0 -1
- package/dist/assets/esm-C5-vEeTH.js +0 -1
- package/dist/assets/gauge-CgzErVCg.js +0 -1
- package/dist/assets/loader-circle-CzsY4U4K.js +0 -1
- package/dist/assets/music-2-VepUqB81.js +0 -1
- package/dist/assets/play-ZL7gYQUU.js +0 -1
- package/dist/assets/plus-D9bpTW1Y.js +0 -1
- package/dist/assets/rotate-ccw-Bhdd30R7.js +0 -1
- package/dist/assets/rotate-cw-TcBKWxiG.js +0 -1
- package/dist/assets/search-Blh4b4He.js +0 -1
- package/dist/assets/square-CRpSbCk2.js +0 -1
- package/dist/assets/terminal-CDg3WIny.js +0 -1
- package/dist/assets/user-B9KuS1ce.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt 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,tt as d,z as f}from"./vendor-chart-Dw-P17PN.js";import{t as p}from"./arrow-left-C1x7N3xi.js";import{t as ee}from"./download-C91z3UAa.js";import{t as te}from"./info-A5v3l0In.js";import{at as m,it as h,nt as g,rt as _}from"./constants-B7y9pxL6.js";import{E as v,Fi as y,It as b,a as x,o as S,u as C,y as w}from"./index-suPyrMld.js";import{t as T}from"./index.es-Crpkjxh_.js";var E=f({name:`DownloadIndex`,components:{BackIcon:p,DownloadIcon:ee,ElButton:y,InfoIcon:te,QrCode:b,FontAwesomeIcon:T},data(){return{faAndroid:x,faApple:S,faGooglePlay:C,faWindows:w}},computed:{brandTitle(){return this.$store.state.site?.title||`AceData`},brandLogo(){return this.$store.state.site?.logo||`/assets/logo-CDy94G52.png`},androidDownloadUrl(){return _},hasAndroidDownload(){return!!_},playStoreUrl(){return h},hasPlayStore(){return!!h},appStoreUrl(){return m},hasAppStore(){return!!m},iosDownloadUrl(){return``},iosFallbackUrl(){return``},hasIosDownload(){return!1},hasIos(){return this.hasAppStore||this.hasIosDownload},desktopReleasesUrl(){return g}},methods:{goBack(){window.history.length>1?this.$router.back():this.$router.push(`/`)},openSupport(){window.open(`https://platform.acedata.cloud/support`,`_blank`)}}}),D={class:`download-page`},O={class:`download-page__inner`},k={class:`hero`},A={class:`hero__brand`},j=[`src`,`alt`],M={class:`hero__eyebrow`},N={class:`hero__title`},P={class:`hero__subtitle`},F={class:`hero__badges`},I={class:`badge badge--live`},L={class:`badge`},R={class:`hero__actions`},z={class:`platforms`},B={class:`platform platform--android`},V={class:`platform__head`},H={class:`platform__os`},U={class:`chip chip--live`},W={class:`platform__title`},G={class:`platform__text`},K={key:0,class:`qr`},q={class:`qr__hint`},J={class:`platform__foot platform__foot--stack`},Y={key:0,class:`platform__fallback`},X={class:`platform__meta`},Z={class:`platform__meta`},Q={class:`platform platform--ios`},ne={class:`platform__head`},re={class:`platform__os`},ie={class:`platform__title`},ae={class:`platform__text`},oe={key:0,class:`qr`},se={class:`qr__hint`},ce={key:1,class:`platform__foot platform__foot--stack`},le={class:`btn-row`},ue={class:`platform__meta`},de={class:`ios-soon`},fe={class:`ios-soon__text`},pe={class:`platform__foot platform__foot--stack`},me={class:`platform platform--windows`},he={class:`platform__head`},ge={class:`platform__os`},_e={class:`platform__title`},ve={class:`platform__text`},ye={class:`platform__foot platform__foot--stack`},be={class:`platform platform--mac`},xe={class:`platform__head`},Se={class:`platform__os`},Ce={class:`platform__title`},we={class:`platform__text`},Te={class:`platform__foot platform__foot--stack`},Ee={class:`advantages`},De={class:`advantage`},$={class:`advantage__title`},Oe={class:`advantage__text`},ke={class:`advantage`},Ae={class:`advantage__title`},je={class:`advantage__text`},Me={class:`advantage`},Ne={class:`advantage__title`},Pe={class:`advantage__text`},Fe={key:0,class:`note`},Ie={class:`note__text`},Le={class:`note`},Re={class:`note__text`};function ze(f,p,ee,te,m,h){let g=c(`back-icon`),_=c(`font-awesome-icon`),v=c(`el-button`),y=c(`qr-code`),b=c(`download-icon`),x=c(`info-icon`);return d(),o(`div`,D,[p[15]||=e(`div`,{class:`download-page__glow`,"aria-hidden":`true`},null,-1),e(`div`,O,[e(`button`,{type:`button`,class:`download-back`,onClick:p[0]||=(...e)=>f.goBack&&f.goBack(...e)},[i(g,{class:`download-back__icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`span`,null,r(f.$t(`common.button.goBack`)),1)]),e(`header`,k,[e(`span`,A,[e(`img`,{src:f.brandLogo,alt:f.brandTitle,class:`hero__logo`},null,8,j)]),e(`p`,M,r(f.brandTitle)+` · `+r(f.$t(`common.nav.mobileApp`)),1),e(`h1`,N,r(f.$t(`common.title.mobileApp`)),1),e(`p`,P,r(f.$t(`common.message.mobileAppDescription`)),1),e(`div`,F,[e(`span`,I,[p[1]||=e(`span`,{class:`badge__dot`},null,-1),n(r(f.$t(`common.message.mobileAvailableNow`)),1)]),e(`span`,L,r(f.$t(`common.message.mobileSharedAccount`)),1)]),e(`div`,R,[f.hasPlayStore?(d(),l(v,{key:0,type:`primary`,round:``,size:`large`,tag:`a`,href:f.playStoreUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faGooglePlay,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.getOnGooglePlay`)),1)]),_:1},8,[`href`])):f.hasAndroidDownload?(d(),l(v,{key:1,type:`primary`,round:``,size:`large`,tag:`a`,href:f.androidDownloadUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faAndroid,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.downloadAndroid`)),1)]),_:1},8,[`href`])):a(``,!0),f.hasAppStore?(d(),l(v,{key:2,round:``,size:`large`,tag:`a`,href:f.appStoreUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faApple,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.getOnAppStore`)),1)]),_:1},8,[`href`])):a(``,!0),i(v,{round:``,size:`large`,class:`btn-ghost`,onClick:f.openSupport},{default:u(()=>[n(r(f.$t(`common.nav.support`)),1)]),_:1},8,[`onClick`])])]),e(`section`,z,[e(`article`,B,[e(`div`,V,[e(`span`,H,[i(_,{icon:f.faAndroid,class:`platform__os-icon`},null,8,[`icon`]),p[2]||=n(` Android `,-1)]),e(`span`,U,[p[3]||=e(`span`,{class:`chip__dot`},null,-1),n(r(f.$t(`common.message.mobileAvailableNow`)),1)])]),e(`h2`,W,r(f.$t(`common.button.downloadAndroid`)),1),e(`p`,G,r(f.$t(`common.message.mobileAndroidHint`)),1),f.hasPlayStore||f.hasAndroidDownload?(d(),o(`div`,K,[i(y,{value:f.hasPlayStore?f.playStoreUrl:f.androidDownloadUrl,width:184,height:184,class:`qr__img`,type:`image/png`,color:{dark:`#0e2a33ff`,light:`#ffffffff`}},null,8,[`value`]),e(`p`,q,r(f.hasPlayStore?f.$t(`common.message.mobilePlayStoreHint`):f.$t(`common.message.mobileSecureDelivery`)),1)])):a(``,!0),e(`div`,J,[f.hasPlayStore?(d(),l(v,{key:0,type:`primary`,round:``,size:`large`,tag:`a`,href:f.playStoreUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faGooglePlay,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.getOnGooglePlay`)),1)]),_:1},8,[`href`])):a(``,!0),f.hasAndroidDownload?(d(),o(s,{key:1},[f.hasPlayStore?(d(),o(`div`,Y,[i(v,{round:``,tag:`a`,href:f.androidDownloadUrl,target:`_blank`,class:`btn-ghost`},{default:u(()=>[i(b,{class:`btn-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(f.$t(`common.button.downloadAndroid`)),1)]),_:1},8,[`href`]),e(`span`,X,r(f.$t(`common.message.mobileApkFallback`)),1)])):(d(),o(s,{key:1},[i(v,{type:`primary`,round:``,size:`large`,tag:`a`,href:f.androidDownloadUrl,target:`_blank`},{default:u(()=>[i(b,{class:`btn-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(f.$t(`common.button.downloadAndroid`)),1)]),_:1},8,[`href`]),e(`span`,Z,r(f.$t(`common.message.mobileDirectInstall`)),1)],64))],64)):a(``,!0)])]),e(`article`,Q,[e(`div`,ne,[e(`span`,re,[i(_,{icon:f.faApple,class:`platform__os-icon`},null,8,[`icon`]),p[4]||=n(` iOS `,-1)]),e(`span`,{class:t([`chip`,f.hasIos?`chip--live`:`chip--pending`])},[p[5]||=e(`span`,{class:`chip__dot`},null,-1),n(` `+r(f.hasIos?f.$t(`common.message.mobileNowOnAppStore`):f.$t(`common.message.mobileComingSoon`)),1)],2)]),e(`h2`,ie,r(f.$t(`common.button.downloadIos`)),1),e(`p`,ae,r(f.hasIos?f.$t(`common.message.mobileIosHint`):f.$t(`common.message.mobileIosPending`)),1),f.hasAppStore?(d(),o(`div`,oe,[i(y,{value:f.appStoreUrl,width:184,height:184,class:`qr__img`,type:`image/png`,color:{dark:`#0e2a33ff`,light:`#ffffffff`}},null,8,[`value`]),e(`p`,se,r(f.$t(`common.message.mobileAppStoreHint`)),1)])):a(``,!0),f.hasIos?(d(),o(`div`,ce,[f.hasAppStore?(d(),l(v,{key:0,type:`primary`,round:``,size:`large`,tag:`a`,href:f.appStoreUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faApple,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.getOnAppStore`)),1)]),_:1},8,[`href`])):a(``,!0),f.hasIosDownload?(d(),o(s,{key:1},[e(`div`,le,[i(v,{type:f.hasAppStore?`default`:`primary`,round:``,size:f.hasAppStore?`default`:`large`,class:t({"btn-ghost":f.hasAppStore}),tag:`a`,href:f.iosDownloadUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faApple,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.installIos`)),1)]),_:1},8,[`type`,`size`,`class`,`href`]),i(v,{round:``,size:`large`,class:`btn-ghost`,tag:`a`,href:f.iosFallbackUrl,target:`_blank`},{default:u(()=>[n(r(f.$t(`common.button.downloadIos`)),1)]),_:1},8,[`href`])]),e(`span`,ue,r(f.$t(`common.message.mobileInstallNote`)),1)],64)):a(``,!0)])):(d(),o(s,{key:2},[e(`div`,de,[i(_,{icon:f.faApple,class:`ios-soon__icon`},null,8,[`icon`]),e(`p`,fe,r(f.$t(`common.message.mobileComingSoon`)),1)]),e(`div`,pe,[i(v,{round:``,size:`large`,class:`btn-ghost`,onClick:f.openSupport},{default:u(()=>[n(r(f.$t(`common.nav.support`)),1)]),_:1},8,[`onClick`])])],64))]),e(`article`,me,[e(`div`,he,[e(`span`,ge,[i(_,{icon:f.faWindows,class:`platform__os-icon`},null,8,[`icon`]),p[6]||=n(` Windows `,-1)]),p[7]||=e(`span`,{class:`chip chip--beta`},[e(`span`,{class:`chip__dot`}),n(`Beta `)],-1)]),e(`h2`,_e,r(f.$t(`common.button.downloadWindows`)),1),e(`p`,ve,r(f.$t(`common.message.desktopWindowsHint`)),1),e(`div`,ye,[i(v,{type:`primary`,round:``,size:`large`,tag:`a`,href:f.desktopReleasesUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faWindows,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.downloadWindows`)),1)]),_:1},8,[`href`]),p[8]||=e(`span`,{class:`platform__meta`},`Beta`,-1)])]),e(`article`,be,[e(`div`,xe,[e(`span`,Se,[i(_,{icon:f.faApple,class:`platform__os-icon`},null,8,[`icon`]),p[9]||=n(` macOS `,-1)]),p[10]||=e(`span`,{class:`chip chip--beta`},[e(`span`,{class:`chip__dot`}),n(`Beta `)],-1)]),e(`h2`,Ce,r(f.$t(`common.button.downloadMac`)),1),e(`p`,we,r(f.$t(`common.message.desktopMacHint`)),1),e(`div`,Te,[i(v,{type:`primary`,round:``,size:`large`,tag:`a`,href:f.desktopReleasesUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faApple,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.downloadMac`)),1)]),_:1},8,[`href`]),p[11]||=e(`span`,{class:`platform__meta`},`Beta · Apple Silicon & Intel`,-1)])])]),e(`section`,Ee,[e(`article`,De,[p[12]||=e(`span`,{class:`advantage__num`},`01`,-1),e(`h3`,$,r(f.$t(`common.title.mobileFastAccess`)),1),e(`p`,Oe,r(f.$t(`common.message.mobileFastAccess`)),1)]),e(`article`,ke,[p[13]||=e(`span`,{class:`advantage__num`},`02`,-1),e(`h3`,Ae,r(f.$t(`common.title.mobileTrustedRelease`)),1),e(`p`,je,r(f.$t(`common.message.mobileTrustedRelease`)),1)]),e(`article`,Me,[p[14]||=e(`span`,{class:`advantage__num`},`03`,-1),e(`h3`,Ne,r(f.$t(`common.title.mobileUnifiedExperience`)),1),e(`p`,Pe,r(f.$t(`common.message.mobileUnifiedExperience`)),1)])]),f.hasIosDownload?(d(),o(`aside`,Fe,[i(x,{class:`note__icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,Ie,r(f.$t(`common.message.mobileInstallNote`)),1)])):a(``,!0),e(`aside`,Le,[i(x,{class:`note__icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,Re,r(f.$t(`common.message.desktopUnsignedNote`)),1)])])])}var Be=v(E,[[`render`,ze],[`__scopeId`,`data-v-b5175e82`]]);export{Be as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt 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,tt as d,z as f}from"./vendor-chart-Dw-P17PN.js";import{t as p}from"./arrow-left-D9daoc-O.js";import{t as ee}from"./download-C6_Lkc27.js";import{t as te}from"./info-TLZ25BWo.js";import{at as m,it as h,nt as g,rt as _}from"./constants-C45zS9hd.js";import{E as v,Fi as y,It as b,a as x,o as S,u as C,y as w}from"./index-DqO3RKoH.js";import{t as T}from"./index.es-XDuz6GZk.js";var E=f({name:`DownloadIndex`,components:{BackIcon:p,DownloadIcon:ee,ElButton:y,InfoIcon:te,QrCode:b,FontAwesomeIcon:T},data(){return{faAndroid:x,faApple:S,faGooglePlay:C,faWindows:w}},computed:{brandTitle(){return this.$store.state.site?.title||`AceData`},brandLogo(){return this.$store.state.site?.logo||`/assets/logo-CDy94G52.png`},androidDownloadUrl(){return _},hasAndroidDownload(){return!!_},playStoreUrl(){return h},hasPlayStore(){return!!h},appStoreUrl(){return m},hasAppStore(){return!!m},iosDownloadUrl(){return``},iosFallbackUrl(){return``},hasIosDownload(){return!1},hasIos(){return this.hasAppStore||this.hasIosDownload},desktopReleasesUrl(){return g}},methods:{goBack(){window.history.length>1?this.$router.back():this.$router.push(`/`)},openSupport(){window.open(`https://platform.acedata.cloud/support`,`_blank`)}}}),D={class:`download-page`},O={class:`download-page__inner`},k={class:`hero`},A={class:`hero__brand`},j=[`src`,`alt`],M={class:`hero__eyebrow`},N={class:`hero__title`},P={class:`hero__subtitle`},F={class:`hero__badges`},I={class:`badge badge--live`},L={class:`badge`},R={class:`hero__actions`},z={class:`platforms`},B={class:`platform platform--android`},V={class:`platform__head`},H={class:`platform__os`},U={class:`chip chip--live`},W={class:`platform__title`},G={class:`platform__text`},K={key:0,class:`qr`},q={class:`qr__hint`},J={class:`platform__foot platform__foot--stack`},Y={key:0,class:`platform__fallback`},X={class:`platform__meta`},Z={class:`platform__meta`},Q={class:`platform platform--ios`},ne={class:`platform__head`},re={class:`platform__os`},ie={class:`platform__title`},ae={class:`platform__text`},oe={key:0,class:`qr`},se={class:`qr__hint`},ce={key:1,class:`platform__foot platform__foot--stack`},le={class:`btn-row`},ue={class:`platform__meta`},de={class:`ios-soon`},fe={class:`ios-soon__text`},pe={class:`platform__foot platform__foot--stack`},me={class:`platform platform--windows`},he={class:`platform__head`},ge={class:`platform__os`},_e={class:`platform__title`},ve={class:`platform__text`},ye={class:`platform__foot platform__foot--stack`},be={class:`platform platform--mac`},xe={class:`platform__head`},Se={class:`platform__os`},Ce={class:`platform__title`},we={class:`platform__text`},Te={class:`platform__foot platform__foot--stack`},Ee={class:`advantages`},De={class:`advantage`},$={class:`advantage__title`},Oe={class:`advantage__text`},ke={class:`advantage`},Ae={class:`advantage__title`},je={class:`advantage__text`},Me={class:`advantage`},Ne={class:`advantage__title`},Pe={class:`advantage__text`},Fe={key:0,class:`note`},Ie={class:`note__text`},Le={class:`note`},Re={class:`note__text`};function ze(f,p,ee,te,m,h){let g=c(`back-icon`),_=c(`font-awesome-icon`),v=c(`el-button`),y=c(`qr-code`),b=c(`download-icon`),x=c(`info-icon`);return d(),o(`div`,D,[p[15]||=e(`div`,{class:`download-page__glow`,"aria-hidden":`true`},null,-1),e(`div`,O,[e(`button`,{type:`button`,class:`download-back`,onClick:p[0]||=(...e)=>f.goBack&&f.goBack(...e)},[i(g,{class:`download-back__icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`span`,null,r(f.$t(`common.button.goBack`)),1)]),e(`header`,k,[e(`span`,A,[e(`img`,{src:f.brandLogo,alt:f.brandTitle,class:`hero__logo`},null,8,j)]),e(`p`,M,r(f.brandTitle)+` · `+r(f.$t(`common.nav.mobileApp`)),1),e(`h1`,N,r(f.$t(`common.title.mobileApp`)),1),e(`p`,P,r(f.$t(`common.message.mobileAppDescription`)),1),e(`div`,F,[e(`span`,I,[p[1]||=e(`span`,{class:`badge__dot`},null,-1),n(r(f.$t(`common.message.mobileAvailableNow`)),1)]),e(`span`,L,r(f.$t(`common.message.mobileSharedAccount`)),1)]),e(`div`,R,[f.hasPlayStore?(d(),l(v,{key:0,type:`primary`,round:``,size:`large`,tag:`a`,href:f.playStoreUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faGooglePlay,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.getOnGooglePlay`)),1)]),_:1},8,[`href`])):f.hasAndroidDownload?(d(),l(v,{key:1,type:`primary`,round:``,size:`large`,tag:`a`,href:f.androidDownloadUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faAndroid,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.downloadAndroid`)),1)]),_:1},8,[`href`])):a(``,!0),f.hasAppStore?(d(),l(v,{key:2,round:``,size:`large`,tag:`a`,href:f.appStoreUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faApple,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.getOnAppStore`)),1)]),_:1},8,[`href`])):a(``,!0),i(v,{round:``,size:`large`,class:`btn-ghost`,onClick:f.openSupport},{default:u(()=>[n(r(f.$t(`common.nav.support`)),1)]),_:1},8,[`onClick`])])]),e(`section`,z,[e(`article`,B,[e(`div`,V,[e(`span`,H,[i(_,{icon:f.faAndroid,class:`platform__os-icon`},null,8,[`icon`]),p[2]||=n(` Android `,-1)]),e(`span`,U,[p[3]||=e(`span`,{class:`chip__dot`},null,-1),n(r(f.$t(`common.message.mobileAvailableNow`)),1)])]),e(`h2`,W,r(f.$t(`common.button.downloadAndroid`)),1),e(`p`,G,r(f.$t(`common.message.mobileAndroidHint`)),1),f.hasPlayStore||f.hasAndroidDownload?(d(),o(`div`,K,[i(y,{value:f.hasPlayStore?f.playStoreUrl:f.androidDownloadUrl,width:184,height:184,class:`qr__img`,type:`image/png`,color:{dark:`#0e2a33ff`,light:`#ffffffff`}},null,8,[`value`]),e(`p`,q,r(f.hasPlayStore?f.$t(`common.message.mobilePlayStoreHint`):f.$t(`common.message.mobileSecureDelivery`)),1)])):a(``,!0),e(`div`,J,[f.hasPlayStore?(d(),l(v,{key:0,type:`primary`,round:``,size:`large`,tag:`a`,href:f.playStoreUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faGooglePlay,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.getOnGooglePlay`)),1)]),_:1},8,[`href`])):a(``,!0),f.hasAndroidDownload?(d(),o(s,{key:1},[f.hasPlayStore?(d(),o(`div`,Y,[i(v,{round:``,tag:`a`,href:f.androidDownloadUrl,target:`_blank`,class:`btn-ghost`},{default:u(()=>[i(b,{class:`btn-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(f.$t(`common.button.downloadAndroid`)),1)]),_:1},8,[`href`]),e(`span`,X,r(f.$t(`common.message.mobileApkFallback`)),1)])):(d(),o(s,{key:1},[i(v,{type:`primary`,round:``,size:`large`,tag:`a`,href:f.androidDownloadUrl,target:`_blank`},{default:u(()=>[i(b,{class:`btn-icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(f.$t(`common.button.downloadAndroid`)),1)]),_:1},8,[`href`]),e(`span`,Z,r(f.$t(`common.message.mobileDirectInstall`)),1)],64))],64)):a(``,!0)])]),e(`article`,Q,[e(`div`,ne,[e(`span`,re,[i(_,{icon:f.faApple,class:`platform__os-icon`},null,8,[`icon`]),p[4]||=n(` iOS `,-1)]),e(`span`,{class:t([`chip`,f.hasIos?`chip--live`:`chip--pending`])},[p[5]||=e(`span`,{class:`chip__dot`},null,-1),n(` `+r(f.hasIos?f.$t(`common.message.mobileNowOnAppStore`):f.$t(`common.message.mobileComingSoon`)),1)],2)]),e(`h2`,ie,r(f.$t(`common.button.downloadIos`)),1),e(`p`,ae,r(f.hasIos?f.$t(`common.message.mobileIosHint`):f.$t(`common.message.mobileIosPending`)),1),f.hasAppStore?(d(),o(`div`,oe,[i(y,{value:f.appStoreUrl,width:184,height:184,class:`qr__img`,type:`image/png`,color:{dark:`#0e2a33ff`,light:`#ffffffff`}},null,8,[`value`]),e(`p`,se,r(f.$t(`common.message.mobileAppStoreHint`)),1)])):a(``,!0),f.hasIos?(d(),o(`div`,ce,[f.hasAppStore?(d(),l(v,{key:0,type:`primary`,round:``,size:`large`,tag:`a`,href:f.appStoreUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faApple,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.getOnAppStore`)),1)]),_:1},8,[`href`])):a(``,!0),f.hasIosDownload?(d(),o(s,{key:1},[e(`div`,le,[i(v,{type:f.hasAppStore?`default`:`primary`,round:``,size:f.hasAppStore?`default`:`large`,class:t({"btn-ghost":f.hasAppStore}),tag:`a`,href:f.iosDownloadUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faApple,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.installIos`)),1)]),_:1},8,[`type`,`size`,`class`,`href`]),i(v,{round:``,size:`large`,class:`btn-ghost`,tag:`a`,href:f.iosFallbackUrl,target:`_blank`},{default:u(()=>[n(r(f.$t(`common.button.downloadIos`)),1)]),_:1},8,[`href`])]),e(`span`,ue,r(f.$t(`common.message.mobileInstallNote`)),1)],64)):a(``,!0)])):(d(),o(s,{key:2},[e(`div`,de,[i(_,{icon:f.faApple,class:`ios-soon__icon`},null,8,[`icon`]),e(`p`,fe,r(f.$t(`common.message.mobileComingSoon`)),1)]),e(`div`,pe,[i(v,{round:``,size:`large`,class:`btn-ghost`,onClick:f.openSupport},{default:u(()=>[n(r(f.$t(`common.nav.support`)),1)]),_:1},8,[`onClick`])])],64))]),e(`article`,me,[e(`div`,he,[e(`span`,ge,[i(_,{icon:f.faWindows,class:`platform__os-icon`},null,8,[`icon`]),p[6]||=n(` Windows `,-1)]),p[7]||=e(`span`,{class:`chip chip--beta`},[e(`span`,{class:`chip__dot`}),n(`Beta `)],-1)]),e(`h2`,_e,r(f.$t(`common.button.downloadWindows`)),1),e(`p`,ve,r(f.$t(`common.message.desktopWindowsHint`)),1),e(`div`,ye,[i(v,{type:`primary`,round:``,size:`large`,tag:`a`,href:f.desktopReleasesUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faWindows,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.downloadWindows`)),1)]),_:1},8,[`href`]),p[8]||=e(`span`,{class:`platform__meta`},`Beta`,-1)])]),e(`article`,be,[e(`div`,xe,[e(`span`,Se,[i(_,{icon:f.faApple,class:`platform__os-icon`},null,8,[`icon`]),p[9]||=n(` macOS `,-1)]),p[10]||=e(`span`,{class:`chip chip--beta`},[e(`span`,{class:`chip__dot`}),n(`Beta `)],-1)]),e(`h2`,Ce,r(f.$t(`common.button.downloadMac`)),1),e(`p`,we,r(f.$t(`common.message.desktopMacHint`)),1),e(`div`,Te,[i(v,{type:`primary`,round:``,size:`large`,tag:`a`,href:f.desktopReleasesUrl,target:`_blank`},{default:u(()=>[i(_,{icon:f.faApple,class:`btn-icon`},null,8,[`icon`]),n(` `+r(f.$t(`common.button.downloadMac`)),1)]),_:1},8,[`href`]),p[11]||=e(`span`,{class:`platform__meta`},`Beta · Apple Silicon & Intel`,-1)])])]),e(`section`,Ee,[e(`article`,De,[p[12]||=e(`span`,{class:`advantage__num`},`01`,-1),e(`h3`,$,r(f.$t(`common.title.mobileFastAccess`)),1),e(`p`,Oe,r(f.$t(`common.message.mobileFastAccess`)),1)]),e(`article`,ke,[p[13]||=e(`span`,{class:`advantage__num`},`02`,-1),e(`h3`,Ae,r(f.$t(`common.title.mobileTrustedRelease`)),1),e(`p`,je,r(f.$t(`common.message.mobileTrustedRelease`)),1)]),e(`article`,Me,[p[14]||=e(`span`,{class:`advantage__num`},`03`,-1),e(`h3`,Ne,r(f.$t(`common.title.mobileUnifiedExperience`)),1),e(`p`,Pe,r(f.$t(`common.message.mobileUnifiedExperience`)),1)])]),f.hasIosDownload?(d(),o(`aside`,Fe,[i(x,{class:`note__icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,Ie,r(f.$t(`common.message.mobileInstallNote`)),1)])):a(``,!0),e(`aside`,Le,[i(x,{class:`note__icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),e(`p`,Re,r(f.$t(`common.message.desktopUnsignedNote`)),1)])])])}var Be=v(E,[[`render`,ze],[`__scopeId`,`data-v-b5175e82`]]);export{Be as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-B-0w-lnr.js";import{t as x}from"./upload-BgKAgBum.js";import{t as S}from"./tooltip-CJbvbxG2.js";import{t as C}from"./alert-CPMxc_VQ.js";import{t as w}from"./drawer-CZm7p6ws.js";import{t as T}from"./input-number-DevINDGA.js";import{n as E}from"./taskDrawerMixin-C9NBskM9.js";import{t as D}from"./box-BR-nqyA-.js";import{t as O}from"./clock-vhFCjsKg.js";import{r as k,t as A}from"./PromptTextarea-73jKA0TY.js";import{t as j}from"./image-C9dUkTCq.js";import{t as M}from"./info-A5v3l0In.js";import{t as N}from"./trash-2-yf3LOXdo.js";import{t as P}from"./triangle-alert-DNLhbtsl.js";import{t as F}from"./upload-OPIFGjfu.js";import{t as I}from"./wand-sparkles-Rd8qSrdr.js";import{t as ee}from"./zap-BrKD08Fz.js";import{Cn as L,En as te,On as ne,Sn as R,Tn as re,_n as z,bn as B,gn as ie,kn as V,wn as H,xn as U,yn as W}from"./constants-B7y9pxL6.js";import{Bt as ae,E as G,En as oe,Fi as K,Ht as se,Kt as ce,Ut as le,Vt as ue,Wt as de,ai as q,bi as J,ci as fe,tn as pe,xi as Y,yr as me}from"./index-suPyrMld.js";import{t as he}from"./CopyToClipboard-JbAG_2zY.js";import{t as X}from"./ImagePreview-21F7rQMY.js";import{t as ge}from"./Consumption-B6v__qih.js";import{a as Z,n as _e,r as ve,t as ye}from"./pagination-OYVQdfTy.js";import{t as be}from"./ApiCodeButton-C1prTZR8.js";import{t as xe}from"./BotPlaceholder-j7c5SCba.js";import{t as Se}from"./ImageWrapper-D1vqcv7B.js";var Ce=_({name:`LayoutSeedream`,components:{MagicIcon:I,ElDrawer:w,ElButton:K},mixins:[E]}),we={class:`main flex flex-row flex-1`},Te={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ee={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function De(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,we,[e(`div`,Te,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ee,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Oe=G(Ce,[[`render`,De],[`__scopeId`,`data-v-c10167d0`]]),ke=_({name:`SeedreamPromptInput`,components:{PromptTextarea:A},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ae(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var je=G(ke,[[`render`,Ae]]),Me={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case L:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case R:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case U:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case B:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case W:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:z[W],outputFormat:!1,tools:!1};case H:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:z[H],outputFormat:!1,tools:!1};default:return Me}}function Ne(e,t){let n=Q(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Pe=[`1K`,`2K`,`3K`,`4K`];function Fe(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(Pe.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function Ie(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var Le=_({name:`SeedreamImageInput`,components:{UploadIcon:F,ElUpload:x,ElButton:K,InfoIcon:Z,ImagePreview:X},mixins:[de,le,ue],data(){return{fileList:[],uploadUrl:fe()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){Y.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){Y.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Re={key:0},ze={class:`field`},Be={class:`label`},Ve={class:`box`},He={class:`title font-bold`},Ue={class:`value`},We={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ge(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ue,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,We,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Ke=G(Le,[[`render`,Ge],[`__scopeId`,`data-v-fef518c4`]]),qe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0,options:[{value:L,label:this.$t(`seedream.model.seedream50pro`)},{value:R,label:this.$t(`seedream.model.seedream50`)},{value:U,label:this.$t(`seedream.model.seedream45`)},{value:B,label:this.$t(`seedream.model.seedream40`)},{value:W,label:this.$t(`seedream.model.seedream30t2i`)},{value:H,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(ie)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Fe(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await J.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=Ie({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),Y.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Je={class:`field`},Ye={class:`label`},Xe={class:`box`},Ze={class:`title font-bold`};function Qe(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var $e=G(qe,[[`render`,Qe],[`__scopeId`,`data-v-6413c179`]]),et=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:ne,pixelOptions:te}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),tt={class:`field`},nt={class:`label`},rt={class:`box`},it={class:`title font-bold`};function at(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`h2`,it,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var ot=G(et,[[`render`,at],[`__scopeId`,`data-v-dd7bd021`]]),st=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),ct={key:0,class:`field`},lt={class:`label`},ut={class:`box`},dt={class:`title font-bold`},ft={class:`value`};function pt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,ct,[e(`div`,lt,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var mt=G(st,[[`render`,pt],[`__scopeId`,`data-v-f079fd20`]]),ht=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[...re]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`};function bt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,gt,[e(`div`,_t,[e(`div`,vt,[e(`h2`,yt,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var xt=G(ht,[[`render`,bt],[`__scopeId`,`data-v-69ea4c07`]]),St=_({name:`SeedreamSeedInput`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),Ct={key:0,class:`field`},wt={class:`label`},Tt={class:`box`},Et={class:`title font-bold`},Dt={class:`value`};function Ot(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Ct,[e(`div`,wt,[e(`div`,Tt,[e(`h2`,Et,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Dt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var kt=G(St,[[`render`,Ot],[`__scopeId`,`data-v-10cdc1e0`]]),At=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),jt={key:0,class:`field`},Mt={class:`label`},Nt={class:`box`},Pt={class:`title font-bold`},Ft={class:`value`};function It(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`h2`,Pt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Lt=G(At,[[`render`,It],[`__scopeId`,`data-v-7386f064`]]),$=e=>{let t={...e||{}},n=Ne(t.model,t.image);return delete t.action,t.watermark=!1,(n!==`edit`||!t.image?.length)&&delete t.image,t.size||delete t.size,t.sequential_image_generation!==`auto`&&delete t.sequential_image_generation_options,{...t,async:!0}},Rt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:I,ElButton:K,PromptInput:je,Consumption:ge,ImageInput:Ke,ModelSelector:$e,SizeSelector:ot,MaxImagesSelector:mt,OutputFormatSelector:xt,SeedInput:kt,GuidanceScaleInput:Lt},emits:[`generate`],computed:{action(){return Ne(this.config?.model,this.config?.image)},capabilities(){return Q(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=$(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return ce({...e,action:this.action,model:V(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),zt={class:`flex flex-col h-full`},Bt={class:`flex-1 overflow-y-auto p-5`},Vt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ht(t,n,c,u,d,m){let g=l(`model-selector`),_=l(`size-selector`),v=l(`max-images-selector`),y=l(`output-format-selector`),b=l(`seed-input`),x=l(`guidance-scale-input`),S=l(`prompt-input`),C=l(`image-input`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,zt,[e(`div`,Bt,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),t.capabilities.image?(h(),f(C,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,Vt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(E,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ut=G(Rt,[[`render`,Ht]]),Wt=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:N,ApplicationIcon:D,ChannelIcon:k,ImageIcon:j,InfoIcon:M,LightningIcon:ee,MagicIcon:I,TimeIcon:O,WarningIcon:P,CopyToClipboard:he,ElAlert:C,ImageWrapper:Se,ElButton:K,ElTooltip:S,ImagePreview:X,ApiCodeButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return $(this.modelValue?.request)},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await J.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`seedream/deleteTask`,{id:e}),Y.success(this.$t(`common.message.deleteTaskSuccess`))}catch{Y.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return V(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Gt={class:`preview`},Kt={class:`left`},qt={class:`main`},Jt={class:`bot`},Yt={class:`datetime`},Xt=[`aria-label`],Zt={class:`info`},Qt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},$t={key:1,class:`prompt mt-2`},en={key:0},tn={key:0,class:n({content:!0})},nn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},rn={key:1,class:n({content:!0,failed:!0})},an={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},on={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},pn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bn={key:3,class:n({content:!0})},xn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Cn(u,d,g,_,v,y){let b=l(`capability-presentation`),x=l(`delete-icon`),S=l(`el-tooltip`),C=l(`image-preview`),w=l(`time-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`el-alert`),O=l(`image-wrapper`),k=l(`el-button`),A=l(`api-code-button`),j=l(`application-icon`),M=l(`image-icon`),N=l(`lightning-icon`),P=l(`channel-icon`),F=l(`warning-icon`),I=l(`info-icon`);return h(),s(`div`,Gt,[e(`div`,Kt,[a(b,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,qt,[e(`div`,Jt,[a(b,{capability:`seedream`,part:`name`}),e(`span`,Yt,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1),a(S,{effect:`dark`,content:u.$t(`common.button.delete`),placement:`top`},{default:p(()=>[u.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":u.$t(`common.button.delete`),onClick:d[0]||=t((...e)=>u.onDelete&&u.onDelete(...e),[`stop`])},[a(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Xt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Zt,[Array.isArray(u.modelValue?.request?.image)&&u.modelValue?.request?.image.length>0?(h(),s(`div`,Qt,[(h(!0),s(c,null,m(u.modelValue?.request?.image,(e,t)=>(h(),f(C,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(h(),s(`p`,$t,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(h(),s(`span`,en,` - (`+i(u.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),u.modelValue?.response?u.modelValue?.response?.success===!0?(h(),s(`div`,rn,[e(`div`,an,[(h(!0),s(c,null,m(u.images,(e,t)=>(h(),f(O,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,on,[a(S,{class:`box-item`,effect:`dark`,content:u.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(k,{type:`info`,size:`small`,class:`btn-action`,onClick:d[1]||=t(e=>u.onEdit(u.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(u.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(A,{path:`/seedream/images`,body:u.apiRequest},null,8,[`body`])]),a(D,{closable:!1,class:`mt-2 success`},{default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,sn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,cn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,un,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(h(),s(`p`,dn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,fn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):u.modelValue?.response?.success===!1?(h(),s(`div`,{key:2,class:n({content:!0,"mt-[15px]":!u.modelValue?.request?.prompt})},[a(D,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failure`)),1)]),default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,pn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,mn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,hn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,gn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.error?.message?(h(),s(`p`,_n,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(E,{content:u.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),u.modelValue?.elapsed?(h(),s(`p`,vn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})],2)):(h(),s(`div`,bn,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,xn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,tn,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,nn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var wn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Wt,[[`render`,Cn],[`__scopeId`,`data-v-394e4796`]]),BotPlaceholder:xe,NoTasks:ve,ScrollList:_e},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Tn={key:0},En={key:2,class:`w-full h-full flex items-center justify-center`};function Dn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Tn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,En,[a(v)])):o(``,!0)],64)}var On=_({name:`SeedreamIndex`,components:{ConfigPanel:Ut,Layout:Oe,RecentPanel:G(wn,[[`render`,Dn]])},mixins:[se],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===q.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ye({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ae(this.uploadTracker,e=>this.$t(e),e=>Y.warning(e)))return;if(Q(this.config?.model).imageRequired&&!this.config?.image?.length){Y.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=$(this.config);if(!pe())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}Y.info(this.$t(`seedream.message.startingTask`)),me(`seedream`,oe.generate(e,{token:t})).then(()=>{Y.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?Y.error(this.$t(`seedream.message.usedUp`)):Y.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function kn(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var An=G(On,[[`render`,kn]]);export{An as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,T as c,at as l,ht as u,it as d,j as f,mt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{n as v,r as y,t as b}from"./select-Ahh1HtiI.js";import{t as x}from"./upload-DjXw6Rtx.js";import{t as S}from"./tooltip-CWf3RfDZ.js";import{t as C}from"./alert-DlbJ70nF.js";import{t as w}from"./drawer-xHfVA3B7.js";import{t as T}from"./input-number-BClb9pco.js";import{n as E}from"./taskDrawerMixin-DD5y0W4q.js";import{t as D}from"./box-BnmqC9Hb.js";import{t as O}from"./clock-Zko38AEz.js";import{r as k,t as A}from"./PromptTextarea-bkyHuBBi.js";import{t as j}from"./image-DTRMQnYU.js";import{t as M}from"./info-TLZ25BWo.js";import{t as N}from"./trash-2-CYUFgSIW.js";import{t as P}from"./triangle-alert-C0xzbNpO.js";import{t as F}from"./upload-Tb1Jm-HV.js";import{t as I}from"./wand-sparkles-DYow-1ZH.js";import{t as ee}from"./zap-BiFSDO6A.js";import{Cn as L,En as te,On as ne,Sn as R,Tn as re,_n as z,bn as B,gn as ie,kn as V,wn as H,xn as U,yn as W}from"./constants-C45zS9hd.js";import{Bt as ae,E as G,En as oe,Fi as K,Ht as se,Kt as ce,Ut as le,Vt as ue,Wt as de,ai as q,bi as J,ci as fe,tn as pe,xi as Y,yr as me}from"./index-DqO3RKoH.js";import{t as he}from"./CopyToClipboard-UlK2GDZ1.js";import{t as X}from"./ImagePreview-CRW3UHm8.js";import{t as ge}from"./Consumption-D7JkBL3g.js";import{a as Z,n as _e,r as ve,t as ye}from"./pagination-XVsSjZIU.js";import{t as be}from"./ApiCodeButton-B4l1tVOr.js";import{t as xe}from"./BotPlaceholder-C44_0Ntn.js";import{t as Se}from"./ImageWrapper-BIQNX8zb.js";var Ce=_({name:`LayoutSeedream`,components:{MagicIcon:I,ElDrawer:w,ElButton:K},mixins:[E]}),we={class:`main flex flex-row flex-1`},Te={class:`config w-[320px] flex-none h-full min-h-0 overflow-hidden flex flex-col bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ee={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function De(t,n,r,i,o,c){let f=l(`magic-icon`),m=l(`el-button`),_=l(`el-drawer`);return h(),s(`div`,we,[e(`div`,Te,[d(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ee,[d(t.$slots,`result`,{},void 0,!0)]),u(a(m,{circle:``,class:`menu`,"aria-label":t.$t(`common.button.openMenu`),title:t.$t(`common.button.openMenu`),onClick:n[0]||=e=>t.drawer=!0},{default:p(()=>[a(f,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),_:1},8,[`aria-label`,`title`]),[[g,!t.tasksEmpty]]),a(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`340px`,class:`drawer generator-drawer`},{default:p(()=>[d(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Oe=G(Ce,[[`render`,De],[`__scopeId`,`data-v-c10167d0`]]),ke=_({name:`SeedreamPromptInput`,components:{PromptTextarea:A},computed:{prompt:{get(){return this.$store.state.seedream?.config?.prompt},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ae(e,t,n,r,i,a){let o=l(`prompt-textarea`);return h(),f(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`seedream.name.prompt`),info:e.$t(`seedream.description.prompt`),placeholder:e.$t(`seedream.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var je=G(ke,[[`render`,Ae]]),Me={image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,sizePixelDefault:void 0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};function Q(e){switch(e){case L:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!1,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!1};case R:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`3K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!0,tools:!0};case U:return{image:!0,imageRequired:!1,sizeTiers:[`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case B:return{image:!0,imageRequired:!1,sizeTiers:[`1K`,`2K`,`4K`],sizeAdaptive:!0,sizePixel:!0,groupGeneration:!0,seed:!1,guidanceScale:!1,outputFormat:!1,tools:!1};case W:return{image:!1,imageRequired:!1,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!0,guidanceScale:!0,guidanceScaleDefault:z[W],outputFormat:!1,tools:!1};case H:return{image:!0,imageRequired:!0,sizeTiers:[],sizeAdaptive:!1,sizePixel:!0,sizePixelDefault:`1024x1024`,groupGeneration:!1,seed:!1,guidanceScale:!0,guidanceScaleDefault:z[H],outputFormat:!1,tools:!1};default:return Me}}function Ne(e,t){let n=Q(e);return n.imageRequired||n.image&&t?.length?`edit`:`generate`}var Pe=[`1K`,`2K`,`3K`,`4K`];function Fe(e,t){if(!e)return[];let n=t.model??e.model;if(!n)return[];let r=Q(n),i=[];Array.isArray(e.image)&&e.image.length>0&&!r.image&&i.push({field:`image`,i18nLabel:`seedream.name.imageUrls`});let a=typeof e.size==`string`?e.size:void 0;if(a){let e=a.toUpperCase();(Pe.includes(e)&&!r.sizeTiers.includes(e)||a===`adaptive`&&!r.sizeAdaptive)&&i.push({field:`size`,i18nLabel:`seedream.name.size`})}return e.sequential_image_generation===`auto`&&!r.groupGeneration&&i.push({field:`sequential_image_generation`,i18nLabel:`seedream.name.maxImages`}),e.seed!==void 0&&e.seed!==null&&!r.seed&&i.push({field:`seed`,i18nLabel:`seedream.name.seed`}),e.guidance_scale!==void 0&&e.guidance_scale!==null&&!r.guidanceScale&&i.push({field:`guidance_scale`,i18nLabel:`seedream.name.guidanceScale`}),e.output_format&&!r.outputFormat&&i.push({field:`output_format`,i18nLabel:`seedream.name.outputFormat`}),Array.isArray(e.tools)&&e.tools.length>0&&!r.tools&&i.push({field:`tools`,i18nLabel:`seedream.name.tools`}),i}function Ie(e,t,n){let r={...e},i=Q(n.model??e.model);for(let e of t)switch(e.field){case`image`:delete r.image;break;case`size`:i.sizePixelDefault?r.size=i.sizePixelDefault:delete r.size;break;case`sequential_image_generation`:r.sequential_image_generation=`disabled`,delete r.sequential_image_generation_options;break;case`seed`:delete r.seed;break;case`guidance_scale`:delete r.guidance_scale;break;case`output_format`:delete r.output_format;break;case`tools`:delete r.tools;break}return r}var Le=_({name:`SeedreamImageInput`,components:{UploadIcon:F,ElUpload:x,ElButton:K,InfoIcon:Z,ImagePreview:X},mixins:[de,le,ue],data(){return{fileList:[],uploadUrl:fe()+`/api/v1/files/`,suppressWatch:!1}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url).filter(e=>!!e)},value(){return this.$store.state.seedream?.config?.image},model(){return this.$store.state.seedream?.config?.model},supported(){return Q(this.model).image}},watch:{value:{immediate:!0,handler(e){if(this.suppressWatch)return;if(!e||e.length===0){let e=(this.fileList||[]).filter(e=>!e?.response?.file_url);this.fileList=e.length?e:[];return}let t=[];e.forEach(e=>{let n=this.fileList.find(t=>t?.response?.file_url===e||t?.url===e);n?t.push(n):t.push({name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}})}),(this.fileList||[]).filter(e=>!e?.response?.file_url).forEach(e=>{t.some(t=>t===e||t?.url===e?.url||t?.response?.file_url===e?.response?.file_url)||t.push(e)}),this.fileList=t}}},methods:{onChange(e){if(!e?.url&&e?.raw)try{e.url=URL.createObjectURL(e.raw)}catch{}},onRemove(e){if(e?.url&&typeof e.url==`string`&&e.url.startsWith(`blob:`))try{URL.revokeObjectURL(e.url)}catch{}this.onSetImages()},onExceed(){Y.warning(this.$t(`seedream.message.uploadImageExceed`))},onError(){Y.error(this.$t(`seedream.message.uploadImageError`))},onSetImages(){let e=this.urls;this.suppressWatch=!0,this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,image:e}),this.$nextTick(()=>{this.suppressWatch=!1})},async onSuccess(e,t){e?.file_url&&(t.url=e.file_url,t.response=e),this.onSetImages()},onRemovePreview(e,t){if(this.fileList.splice(e,1),t?.url&&typeof t.url==`string`&&t.url.startsWith(`blob:`))try{URL.revokeObjectURL(t.url)}catch{}this.onSetImages()}}}),Re={key:0},ze={class:`field`},Be={class:`label`},Ve={class:`box`},He={class:`title font-bold`},Ue={class:`value`},We={class:`file-list mt-2 flex flex-wrap gap-[10px]`};function Ge(t,n,u,d,g,_){let v=l(`info-icon`),y=l(`upload-icon`),b=l(`el-button`),x=l(`el-upload`),S=l(`image-preview`);return t.supported?(h(),s(`div`,Re,[e(`div`,ze,[e(`div`,Be,[e(`div`,Ve,[e(`h2`,He,i(t.$t(`seedream.name.imageUrls`)),1),a(v,{content:t.$t(`seedream.description.imageUrls`),class:`info`},null,8,[`content`])])]),e(`div`,Ue,[a(x,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":n[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,limit:14,multiple:!0,"show-file-list":!1,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,"on-change":t.onChange,"on-remove":t.onRemove,headers:t.headers},{default:p(()=>[a(b,{size:`small`,type:`primary`,round:``},{default:p(()=>[a(y,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.uploadImageUrls`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`on-change`,`on-remove`,`headers`])])]),e(`div`,We,[(h(!0),s(c,null,m(t.fileList,(e,n)=>(h(),f(S,{key:e.uid||e?.response?.file_url||e.url||n,url:e.url||e?.response?.file_url,name:e.name,percentage:e.percentage,onRemove:r=>t.onRemovePreview(n,e)},null,8,[`url`,`name`,`percentage`,`onRemove`]))),128))])])):o(``,!0)}var Ke=G(Le,[[`render`,Ge],[`__scopeId`,`data-v-fef518c4`]]),qe=_({name:`SeedreamModelSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{revertKey:0,options:[{value:L,label:this.$t(`seedream.model.seedream50pro`)},{value:R,label:this.$t(`seedream.model.seedream50`)},{value:U,label:this.$t(`seedream.model.seedream45`)},{value:B,label:this.$t(`seedream.model.seedream40`)},{value:W,label:this.$t(`seedream.model.seedream30t2i`)},{value:H,label:this.$t(`seedream.model.seededit30i2i`)}]}},computed:{value(){return this.$store.state.seedream?.config?.model}},mounted(){this.value||this.applyModel(ie)},methods:{async onChange(e){let t=this.$store.state.seedream?.config||{},n=Fe(t,{model:e});if(n.length===0){this.applyModel(e);return}let r=n.map(e=>this.$t(e.i18nLabel)).join(`、`);try{await J.confirm(this.$t(`seedream.message.featureNotSupportedBody`,{fields:r}),this.$t(`seedream.message.featureNotSupportedTitle`),{confirmButtonText:this.$t(`seedream.button.confirmContinue`),cancelButtonText:this.$t(`seedream.button.cancelSwitch`),type:`warning`});let i=Ie({...t,model:e},n,{model:e});this.$store.commit(`seedream/setConfig`,i),Y.success(this.$t(`seedream.message.featureRemovedNotice`,{fields:r}))}catch{this.revertKey+=1}},applyModel(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,model:e})}}}),Je={class:`field`},Ye={class:`label`},Xe={class:`box`},Ze={class:`title font-bold`};function Qe(t,n,r,o,u,d){let g=l(`info-icon`),_=l(`el-option`),v=l(`el-select`);return h(),s(`div`,Je,[e(`div`,Ye,[e(`div`,Xe,[e(`h2`,Ze,i(t.$t(`seedream.name.model`)),1),a(g,{content:t.$t(`seedream.description.model`),class:`info`},null,8,[`content`])])]),(h(),f(v,{key:t.revertKey,"model-value":t.value,class:`value`,placeholder:t.$t(`seedream.placeholder.select`),onChange:t.onChange},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(_,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`model-value`,`placeholder`,`onChange`]))])}var $e=G(qe,[[`render`,Qe],[`__scopeId`,`data-v-6413c179`]]),et=_({name:`SeedreamSizeSelector`,components:{ElSelect:y,ElOption:b,ElOptionGroup:v,InfoIcon:Z},data(){return{SEEDREAM_SIZE_ADAPTIVE:ne,pixelOptions:te}},computed:{model(){return this.$store.state.seedream?.config?.model},capabilities(){return Q(this.model)},value:{get(){return this.$store.state.seedream?.config?.size},set(e){this.$store.commit(`seedream/setConfig`,{...this.$store.state.seedream?.config,size:e})}}},watch:{model:{immediate:!0,handler(){if(this.value)return;let e=this.capabilities;e.sizeTiers.length?this.value=e.sizeTiers.includes(`2K`)?`2K`:e.sizeTiers[0]:e.sizePixelDefault&&(this.value=e.sizePixelDefault)}}}}),tt={class:`field`},nt={class:`label`},rt={class:`box`},it={class:`title font-bold`};function at(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-option-group`),b=l(`el-select`);return h(),s(`div`,tt,[e(`div`,nt,[e(`div`,rt,[e(`h2`,it,i(t.$t(`seedream.name.size`)),1),a(_,{content:t.$t(`seedream.description.size`),class:`info`},null,8,[`content`])])]),a(b,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.size`),filterable:``,"allow-create":``,"default-first-option":``},{default:p(()=>[t.capabilities.sizeTiers.length?(h(),f(y,{key:0,label:t.$t(`seedream.size.group.tier`)},{default:p(()=>[(h(!0),s(c,null,m(t.capabilities.sizeTiers,e=>(h(),f(v,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])):o(``,!0),t.capabilities.sizeAdaptive?(h(),f(y,{key:1,label:t.$t(`seedream.size.group.adaptive`)},{default:p(()=>[(h(),f(v,{key:t.SEEDREAM_SIZE_ADAPTIVE,label:t.$t(`seedream.size.adaptive`),value:t.SEEDREAM_SIZE_ADAPTIVE},null,8,[`label`,`value`]))]),_:1},8,[`label`])):o(``,!0),a(y,{label:t.$t(`seedream.size.group.pixel`)},{default:p(()=>[(h(!0),s(c,null,m(t.pixelOptions,e=>(h(),f(v,{key:e.value,label:`${e.value} (${e.ratio})`,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`label`])]),_:1},8,[`modelValue`,`placeholder`])])}var ot=G(et,[[`render`,at],[`__scopeId`,`data-v-dd7bd021`]]),st=_({name:`SeedreamMaxImagesSelector`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).groupGeneration},referenceImageCount(){let e=this.config?.image;return Array.isArray(e)?e.length:0},effectiveMax(){let e=15-this.referenceImageCount;return Math.max(1,Math.min(15,e))},value:{get(){let e=this.config?.sequential_image_generation_options?.max_images;return typeof e==`number`&&e>=1?e:1},set(e){let t={...this.config||{}},n=Math.max(1,Math.min(this.effectiveMax,Math.floor(e||1)));n>1?(t.sequential_image_generation=`auto`,t.sequential_image_generation_options={...t.sequential_image_generation_options||{},max_images:n}):(t.sequential_image_generation=`disabled`,t.sequential_image_generation_options&&delete t.sequential_image_generation_options),this.$store.commit(`seedream/setConfig`,t)}}},watch:{effectiveMax(e){this.value>e&&(this.value=e)}}}),ct={key:0,class:`field`},lt={class:`label`},ut={class:`box`},dt={class:`title font-bold`},ft={class:`value`};function pt(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,ct,[e(`div`,lt,[e(`div`,ut,[e(`h2`,dt,i(t.$t(`seedream.name.maxImages`)),1),a(f,{content:t.$t(`seedream.description.maxImages`),class:`info`},null,8,[`content`])])]),e(`div`,ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:t.effectiveMax,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`,`max`])])])):o(``,!0)}var mt=G(st,[[`render`,pt],[`__scopeId`,`data-v-f079fd20`]]),ht=_({name:`SeedreamOutputFormatSelector`,components:{ElSelect:y,ElOption:b,InfoIcon:Z},data(){return{options:[...re]}},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).outputFormat},value:{get(){return this.config?.output_format},set(e){let t={...this.config||{}};t.output_format=e,this.$store.commit(`seedream/setConfig`,t)}}}}),gt={key:0,class:`field`},_t={class:`label`},vt={class:`box`},yt={class:`title font-bold`};function bt(t,n,r,u,d,g){let _=l(`info-icon`),v=l(`el-option`),y=l(`el-select`);return t.supported?(h(),s(`div`,gt,[e(`div`,_t,[e(`div`,vt,[e(`h2`,yt,i(t.$t(`seedream.name.outputFormat`)),1),a(_,{content:t.$t(`seedream.description.outputFormat`),class:`info`},null,8,[`content`])])]),a(y,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`seedream.placeholder.select`)},{default:p(()=>[(h(!0),s(c,null,m(t.options,e=>(h(),f(v,{key:e,label:e.toUpperCase(),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])):o(``,!0)}var xt=G(ht,[[`render`,bt],[`__scopeId`,`data-v-69ea4c07`]]),St=_({name:`SeedreamSeedInput`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).seed},value:{get(){let e=this.config?.seed;return typeof e==`number`?e:-1},set(e){let t={...this.config||{}};t.seed=typeof e==`number`&&Number.isInteger(e)?e:-1,this.$store.commit(`seedream/setConfig`,t)}}}}),Ct={key:0,class:`field`},wt={class:`label`},Tt={class:`box`},Et={class:`title font-bold`},Dt={class:`value`};function Ot(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,Ct,[e(`div`,wt,[e(`div`,Tt,[e(`h2`,Et,i(t.$t(`seedream.name.seed`)),1),a(f,{content:t.$t(`seedream.description.seed`),class:`info`},null,8,[`content`])])]),e(`div`,Dt,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:-1,max:2147483647,step:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var kt=G(St,[[`render`,Ot],[`__scopeId`,`data-v-10cdc1e0`]]),At=_({name:`SeedreamGuidanceScaleInput`,components:{ElInputNumber:T,InfoIcon:Z},computed:{config(){return this.$store.state.seedream?.config||{}},supported(){return Q(this.config?.model).guidanceScale},defaultValue(){return Q(this.config?.model).guidanceScaleDefault??2.5},value:{get(){let e=this.config?.guidance_scale;return typeof e==`number`?e:this.defaultValue},set(e){let t={...this.config||{}};t.guidance_scale=typeof e==`number`&&e>=1&&e<=10?e:this.defaultValue,this.$store.commit(`seedream/setConfig`,t)}}}}),jt={key:0,class:`field`},Mt={class:`label`},Nt={class:`box`},Pt={class:`title font-bold`},Ft={class:`value`};function It(t,n,r,c,u,d){let f=l(`info-icon`),p=l(`el-input-number`);return t.supported?(h(),s(`div`,jt,[e(`div`,Mt,[e(`div`,Nt,[e(`h2`,Pt,i(t.$t(`seedream.name.guidanceScale`)),1),a(f,{content:t.$t(`seedream.description.guidanceScale`),class:`info`},null,8,[`content`])])]),e(`div`,Ft,[a(p,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,min:1,max:10,step:.1,precision:1,size:`default`,"controls-position":`right`,class:`counter`},null,8,[`modelValue`])])])):o(``,!0)}var Lt=G(At,[[`render`,It],[`__scopeId`,`data-v-7386f064`]]),$=e=>{let t={...e||{}},n=Ne(t.model,t.image);return delete t.action,t.watermark=!1,(n!==`edit`||!t.image?.length)&&delete t.image,t.size||delete t.size,t.sequential_image_generation!==`auto`&&delete t.sequential_image_generation_options,{...t,async:!0}},Rt=_({name:`SeedreamConfigPanel`,components:{MagicIcon:I,ElButton:K,PromptInput:je,Consumption:ge,ImageInput:Ke,ModelSelector:$e,SizeSelector:ot,MaxImagesSelector:mt,OutputFormatSelector:xt,SeedInput:kt,GuidanceScaleInput:Lt},emits:[`generate`],computed:{action(){return Ne(this.config?.model,this.config?.image)},capabilities(){return Q(this.config?.model)},config(){return this.$store.state.seedream?.config},consumption(){let e=$(this.config),t=e.sequential_image_generation===`auto`?Math.max(1,Math.floor(e.sequential_image_generation_options?.max_images||1)):1;return ce({...e,action:this.action,model:V(e.model),input_image_count:e.image?.length||0,count:t},this.service?.cost)},service(){return this.$store.state.seedream?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),zt={class:`flex flex-col h-full`},Bt={class:`flex-1 overflow-y-auto p-5`},Vt={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ht(t,n,c,u,d,m){let g=l(`model-selector`),_=l(`size-selector`),v=l(`max-images-selector`),y=l(`output-format-selector`),b=l(`seed-input`),x=l(`guidance-scale-input`),S=l(`prompt-input`),C=l(`image-input`),w=l(`consumption`),T=l(`magic-icon`),E=l(`el-button`);return h(),s(`div`,zt,[e(`div`,Bt,[a(g,{class:`mb-4`}),a(_,{class:`mb-4`}),a(v,{class:`mb-4`}),a(y,{class:`mb-4`}),a(b,{class:`mb-4`}),a(x,{class:`mb-4`}),a(S,{class:`mb-4`}),t.capabilities.image?(h(),f(C,{key:0,class:`mb-4`})):o(``,!0)]),e(`div`,Vt,[a(w,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),a(E,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:p(()=>[a(T,{class:`mr-2`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(t.$t(`seedream.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Ut=G(Rt,[[`render`,Ht]]),Wt=_({name:`SeedreamTaskPreview`,components:{DeleteIcon:N,ApplicationIcon:D,ChannelIcon:k,ImageIcon:j,InfoIcon:M,LightningIcon:ee,MagicIcon:I,TimeIcon:O,WarningIcon:P,CopyToClipboard:he,ElAlert:C,ImageWrapper:Se,ElButton:K,ElTooltip:S,ImagePreview:X,ApiCodeButton:be},props:{modelValue:{type:Object,required:!0}},computed:{apiRequest(){return $(this.modelValue?.request)},isEdit(){return Array.isArray(this.modelValue?.request?.image)&&(this.modelValue?.request?.image?.length||0)>0},images(){let e=[];return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(t=>{e.push(t)}),e}},methods:{async onDelete(){let e=this.modelValue?.id;if(e){try{await J.confirm(this.$t(`common.message.deleteTaskConfirm`),this.$t(`common.button.delete`),{type:`warning`,confirmButtonText:this.$t(`common.button.delete`),cancelButtonText:this.$t(`common.button.cancel`),confirmButtonClass:`el-button--danger`})}catch{return}try{await this.$store.dispatch(`seedream/deleteTask`,{id:e}),Y.success(this.$t(`common.message.deleteTaskSuccess`))}catch{Y.error(this.$t(`common.message.deleteTaskFailed`))}}},shortModel(e){return V(e)||e},onEdit(e){if(!e)return;console.debug(`Edit image:`,e);let t={...this.$store.state.seedream?.config||{}};t.image=[e],this.$store.commit(`seedream/setConfig`,t)}}}),Gt={class:`preview`},Kt={class:`left`},qt={class:`main`},Jt={class:`bot`},Yt={class:`datetime`},Xt=[`aria-label`],Zt={class:`info`},Qt={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},$t={key:1,class:`prompt mt-2`},en={key:0},tn={key:0,class:n({content:!0})},nn={class:`text-[var(--el-text-color-regular)] text-xs mb-0`},rn={key:1,class:n({content:!0,failed:!0})},an={class:`flex justify-start items-center gap-4 w-full overflow-x-auto`},on={class:n({operations:!0,"mt-2":!0,"mb-2":!0})},sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},cn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ln={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},un={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},dn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},fn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},pn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},hn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:3,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:4,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},bn={key:3,class:n({content:!0})},xn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Cn(u,d,g,_,v,y){let b=l(`capability-presentation`),x=l(`delete-icon`),S=l(`el-tooltip`),C=l(`image-preview`),w=l(`time-icon`),T=l(`magic-icon`),E=l(`copy-to-clipboard`),D=l(`el-alert`),O=l(`image-wrapper`),k=l(`el-button`),A=l(`api-code-button`),j=l(`application-icon`),M=l(`image-icon`),N=l(`lightning-icon`),P=l(`channel-icon`),F=l(`warning-icon`),I=l(`info-icon`);return h(),s(`div`,Gt,[e(`div`,Kt,[a(b,{capability:`seedream`,part:`avatar`,class:`avatar`})]),e(`div`,qt,[e(`div`,Jt,[a(b,{capability:`seedream`,part:`name`}),e(`span`,Yt,i(u.$dayjs.format(``+new Date(parseFloat((u.modelValue?.created_at||``).toString())*1e3))),1),a(S,{effect:`dark`,content:u.$t(`common.button.delete`),placement:`top`},{default:p(()=>[u.modelValue?.id?(h(),s(`button`,{key:0,type:`button`,class:`btn-delete`,"aria-label":u.$t(`common.button.delete`),onClick:d[0]||=t((...e)=>u.onDelete&&u.onDelete(...e),[`stop`])},[a(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})],8,Xt)):o(``,!0)]),_:1},8,[`content`])]),e(`div`,Zt,[Array.isArray(u.modelValue?.request?.image)&&u.modelValue?.request?.image.length>0?(h(),s(`div`,Qt,[(h(!0),s(c,null,m(u.modelValue?.request?.image,(e,t)=>(h(),f(C,{key:t,url:e,name:`image-${t+1}`,closable:!1},null,8,[`url`,`name`]))),128))])):o(``,!0),u.modelValue?.request?.prompt?(h(),s(`p`,$t,[r(i(u.modelValue?.request?.prompt)+` `,1),u.modelValue?.response?o(``,!0):(h(),s(`span`,en,` - (`+i(u.$t(`seedream.status.pending`))+`) `,1))])):o(``,!0)]),u.modelValue?.response?u.modelValue?.response?.success===!0?(h(),s(`div`,rn,[e(`div`,an,[(h(!0),s(c,null,m(u.images,(e,t)=>(h(),f(O,{key:t,src:e?.image_url,"raw-src":e?.image_url},null,8,[`src`,`raw-src`]))),128))]),e(`div`,on,[a(S,{class:`box-item`,effect:`dark`,content:u.$t(`common.button.edit`),placement:`top-start`},{default:p(()=>[a(k,{type:`info`,size:`small`,class:`btn-action`,onClick:d[1]||=t(e=>u.onEdit(u.images?.[0]?.image_url),[`stop`])},{default:p(()=>[r(i(u.$t(`common.button.edit`)),1)]),_:1})]),_:1},8,[`content`]),a(A,{path:`/seedream/images`,body:u.apiRequest},null,8,[`body`])]),a(D,{closable:!1,class:`mt-2 success`},{default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,sn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,cn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,ln,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,un,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])]),u.modelValue?.elapsed?(h(),s(`p`,dn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,fn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy inline-block`},null,8,[`content`])])):o(``,!0)]),_:1})])):u.modelValue?.response?.success===!1?(h(),s(`div`,{key:2,class:n({content:!0,"mt-[15px]":!u.modelValue?.request?.prompt})},[a(D,{closable:!1,class:`failure`},{template:p(()=>[a(F,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failure`)),1)]),default:p(()=>[u.modelValue?.request?.model?(h(),s(`p`,pn,[a(j,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.model`))+`: `+i(u.shortModel(u.modelValue?.request?.model)),1)])):o(``,!0),u.modelValue?.request?.size?(h(),s(`p`,mn,[a(M,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.size`))+`: `+i(u.modelValue?.request?.size),1)])):o(``,!0),e(`p`,hn,[a(N,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.task`))+`: `+i(u.isEdit?u.$t(`seedream.name.edits`):u.$t(`seedream.name.generate`)),1)]),e(`p`,gn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.error?.message?(h(),s(`p`,_n,[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.failureReason`))+`: `+i(u.modelValue?.response?.error?.message)+` `,1),a(E,{content:u.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])])):o(``,!0),u.modelValue?.elapsed?(h(),s(`p`,vn,[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.elapsed`))+`: `+i(u.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),u.modelValue?.response?.trace_id?(h(),s(`p`,yn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})],2)):(h(),s(`div`,bn,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(I,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.status`)),1)]),default:p(()=>[e(`p`,xn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),u.modelValue?.response?.trace_id?(h(),s(`p`,Sn,[a(P,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.traceId`))+`: `+i(u.modelValue?.response?.trace_id)+` `,1),a(E,{content:u.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])):o(``,!0)]),_:1})])):(h(),s(`div`,tn,[a(D,{closable:!1,class:`info`},{template:p(()=>[a(w,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.status.pending`)),1)]),default:p(()=>[e(`p`,nn,[a(T,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),r(` `+i(u.$t(`seedream.name.taskId`))+`: `+i(u.modelValue?.id)+` `,1),a(E,{content:u.modelValue?.id,class:`btn-copy inline-block`},null,8,[`content`])])]),_:1})]))])])}var wn=_({name:`SeedreamRecentPanel`,components:{TaskPreview:G(Wt,[[`render`,Cn],[`__scopeId`,`data-v-394e4796`]]),BotPlaceholder:xe,NoTasks:ve,ScrollList:_e},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.seedream?.tasks,items:this.$store.state.seedream?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Tn={key:0},En={key:2,class:`w-full h-full flex items-center justify-center`};function Dn(e,t,n,r,i,u){let d=l(`bot-placeholder`),g=l(`task-preview`),_=l(`scroll-list`),v=l(`no-tasks`);return h(),s(c,null,[e.tasks?.items===void 0?(h(),s(`div`,Tn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),f(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:p(()=>[(h(!0),s(c,null,m(e.tasks?.items,e=>(h(),f(g,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(h(),s(`div`,En,[a(v)])):o(``,!0)],64)}var On=_({name:`SeedreamIndex`,components:{ConfigPanel:Ut,Layout:Oe,RecentPanel:G(wn,[[`render`,Dn]])},mixins:[se],inject:[`initialized`],data(){return{task:void 0,job:0,loading:!1}},computed:{applicationsLoading(){return this.$store.state.seedream?.status?.getApplications===q.Request},tasksLoading(){return this.$store.state.seedream?.status?.getTasks===q.Request},credential(){return this.$store.state.seedream?.credential},config(){return this.$store.state.seedream?.config},application(){return this.$store.state.seedream?.application},tasks(){return this.$store.state.seedream?.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await ye({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loading,setLoading:e=>this.loading=e,isBlocked:()=>this.tasksLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`seedream/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`seedream/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.tasksLoading){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=20,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),await this.$store.dispatch(`seedream/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})},async onGenerate(){if(!ae(this.uploadTracker,e=>this.$t(e),e=>Y.warning(e)))return;if(Q(this.config?.model).imageRequired&&!this.config?.image?.length){Y.warning(this.$t(`seedream.message.referenceImageRequired`));return}let e=$(this.config);if(!pe())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}Y.info(this.$t(`seedream.message.startingTask`)),me(`seedream`,oe.generate(e,{token:t})).then(()=>{Y.success(this.$t(`seedream.message.startTaskSuccess`))}).catch(e=>{let t=e?.response?.data;t?.error?.code===`used_up`?Y.error(this.$t(`seedream.message.usedUp`)):Y.error(this.$t(`seedream.message.startTaskFailed`)+(t?.error?.message||``))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function kn(e,t,n,r,i,o){let s=l(`config-panel`),c=l(`recent-panel`),u=l(`layout`);return h(),f(u,null,{config:p(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:p(()=>[a(c,{ref:`recentPanel`,loading:e.loading,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var An=G(On,[[`render`,kn]]);export{An 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-DD9gDMtN.js";import{t as f}from"./card-D-4S-l7a.js";import{n as p,t as m}from"./row-CyazZ63X.js";import{t as h}from"./pagination-CeYQWqTe.js";import{E as g,dr as _}from"./index-DqO3RKoH.js";import{t as v}from"./CopyToClipboard-UlK2GDZ1.js";var y=l({name:`ConsoleDistributionInvitees`,components:{Pagination:h,CopyToClipboard:v,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 _.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=g(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,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 ee,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{n as m,t as te}from"./table-Blx50ajn.js";import{t as h}from"./card-D-4S-l7a.js";import{n as g,t as _}from"./row-DzBNdvwT.js";import{t as v}from"./empty-B1wenOj5.js";import{t as y}from"./pagination-BXKKsIUG.js";import{t as b}from"./skeleton-B3LIGUiE.js";import{t as x}from"./switch-DznsotcK.js";import{t as S}from"./boxes-BOasP2Uf.js";import{t as C}from"./chart-no-axes-combined-CFNb_B2u.js";import{t as w}from"./coins-D02Zc6bQ.js";import{t as T}from"./wallet-CvUeACqH.js";import{B as E,E as D,Fi as O,K as k,Ni as A,Xr as j,Yr as M,fi as N,fr as P,hn as F,ni as I,ri as L,xi as R}from"./index-suPyrMld.js";import{t as z}from"./CopyToClipboard-JbAG_2zY.js";var B=p({name:`ConsoleApplicationList`,components:{AnalyticsIcon:C,ApplicationsIcon:S,CreditsIcon:w,WalletIcon:T,Pagination:y,CopyToClipboard:z,ElTable:te,ElRow:_,ElButton:O,ElCol:g,ElTag:A,ElSkeleton:b,ElSwitch:x,ElEmpty:v,ElTableColumn:m,ElCard:h},data(){return{credentialType:M,serviceType:j,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!F(this.$store.getters.site)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{rowCanPay(e){return F(this.$store.getters.site)?!1:N()?(e?.packages||[]).some(e=>e?.metadata?.apple_product_id):!0},updateAllowConsumeGlobal(e,t){!e||!e.id||P.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{R.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{R.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:E,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=I.INDIVIDUAL){return new Promise((t,n)=>{P.getAll({limit:this.limit,...e===I.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:L.USAGE,scope:e}).then(({data:n})=>{e===I.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{R.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(I.INDIVIDUAL),this.onFetchApplications(I.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){P.create({type:L.USAGE,scope:I.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(I.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}`}}}),V={class:`title`},H={key:1,class:`summary-card`},U={class:`icon-wrapper`},W={class:`label`},G={class:`value`},K={class:`description`},q={key:1,class:`flex flex-row justify-between items-center gap-3`},J={class:`summary-card min-w-0 flex-1`},Y={class:`flex justify-start items-center gap-2 mb-2 w-full`},X={class:`icon-wrapper !mb-0`},Z={class:`text-[var(--el-text-color-regular)] text-[14px] truncate`},Q={class:`label`},ne={class:`value`},re={class:`description`},ie={class:`flex flex-col items-end gap-2 shrink-0`},ae={class:`copy`},oe={key:0,class:`expired-at`},se={class:`flex flex-wrap items-center justify-end gap-1`},ce={class:`application-cards block sm:hidden`},le={class:`flex items-center gap-2 flex-wrap`},ue={class:`application-card__name`},de={class:`application-card__id`},fe={class:`truncate`},pe={class:`application-card__row`},$={class:`label`},me={class:`value`},he={key:0,class:`application-card__row`},ge={class:`label`},_e={class:`value`},ve={key:1,class:`application-card__row`},ye={class:`label`},be={class:`flex items-center justify-end gap-2 mt-3`},xe={class:`pagination`};function Se(p,m,te,h,g,_){let v=s(`el-col`),y=s(`el-row`),b=s(`el-skeleton`),x=s(`applications-icon`),S=s(`el-card`),C=s(`wallet-icon`),w=s(`copy-to-clipboard`),T=s(`analytics-icon`),E=s(`el-button`),D=s(`credits-icon`),O=s(`el-table-column`),k=s(`el-tag`),A=s(`el-switch`),j=s(`el-table`),M=s(`el-empty`),N=s(`pagination`),P=d(`loading`);return f(),l(y,{class:`application-list`},{default:u(()=>[r(v,{span:24},{default:u(()=>[r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[e(`h2`,V,n(p.$t(`common.title.allApplications`)),1)]),_:1})]),_:1}),r(y,{gutter:15,class:`mb-3`},{default:u(()=>[r(v,{md:12,xs:24},{default:u(()=>[r(S,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[p.loading?(f(),l(b,{key:0})):(f(),a(`div`,H,[e(`div`,U,[r(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,W,n(p.$t(`application.title.count`)),1),e(`p`,G,n(p.individualApplicationsTotal),1),e(`p`,K,n(p.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),p.showGlobalPayment&&p.globalApplications?.length>0?(f(),l(v,{key:0,md:12,xs:24},{default:u(()=>[r(S,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[p.loading?(f(),l(b,{key:0})):(f(),a(`div`,q,[e(`div`,J,[e(`div`,Y,[e(`div`,X,[r(C,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`span`,Z,[t(n(p.$t(`application.field.id`))+`: `+n(p.globalApplications?.[0]?.id)+` `,1),p.globalApplications?.[0]?.id?(f(),l(w,{key:0,content:p.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),e(`p`,Q,n(p.$t(`application.title.globalBalance`)),1),e(`p`,ne,n(p.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+n(p.$t(`service.unit.credits`)),1),e(`p`,re,n(p.$t(`application.message.globalBalanceDescription`)),1)]),e(`div`,ie,[r(E,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:m[0]||=e=>p.onGoUsage(p.globalApplications?.[0])},{default:u(()=>[r(T,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1}),p.showGlobalPayment?(f(),l(E,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:m[1]||=e=>p.onBuyMore(p.globalApplications?.[0])},{default:u(()=>[r(D,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1})):i(``,!0)])]))]),_:1})]),_:1})):i(``,!0)]),_:1}),r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[r(S,{shadow:`hover`,class:`applications-table-card hidden sm:block`},{default:u(()=>[c((f(),l(j,{data:p.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":p.$t(`common.message.noData`)},{default:u(()=>[r(O,{prop:`id`,label:p.$t(`application.field.id`),width:`200px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(t.row.id),1),e(`span`,ae,[r(w,{content:t?.row?.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(O,{label:p.$t(`application.field.type`),width:`90px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row?.type===`Period`?(f(),l(k,{key:0,type:`success`,effect:`dark`,round:``},{default:u(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):e.row?.type===`Usage`?(f(),l(k,{key:1,effect:`dark`,round:``},{default:u(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(O,{label:p.$t(`application.field.name`),width:`180px`},{default:u(r=>[e(`span`,null,n(r.row?.service?.title),1),r.row?.role===`grantee`?(f(),l(k,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:u(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(O,{prop:`remaining_amount`,label:p.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(p.getRemainingAmount(t.row)),1)]),_:1},8,[`label`]),r(O,{prop:`used_amount`,label:p.$t(`application.field.usedAmount`),width:`150px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(t=>[e(`span`,null,n(p.getUsedAmount(t.row)),1)]),_:1},8,[`label`]),r(O,{prop:`allow_consume_global`,label:p.$t(`application.field.allowConsumeGlobal`),width:`120px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.service?.type===p.serviceType.API?(f(),l(A,{key:0,modelValue:e.row.allow_consume_global,"onUpdate:modelValue":t=>e.row.allow_consume_global=t,"active-value":!0,"inactive-value":!1,onChange:t=>p.updateAllowConsumeGlobal(e.row,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])):i(``,!0)]),_:1},8,[`label`]),r(O,{label:p.$t(`application.field.expiredAt`),width:`180px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.expired_at?(f(),a(`span`,oe,n(p.$dayjs.format(e.row.expired_at)),1)):i(``,!0)]),_:1},8,[`label`]),r(O,{fixed:`right`,width:`200px`},{default:u(a=>[e(`div`,se,[r(E,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:e=>p.onGoUsage(a?.row)},{default:u(()=>[r(T,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(a?.row)?(f(),l(E,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(a?.row)},{default:u(()=>[r(D,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[P,p.loading]])]),_:1}),e(`div`,ce,[p.loading?(f(),l(b,{key:0,rows:4,animated:``})):(f(),a(o,{key:1},[p.individualApplications?.length?(f(!0),a(o,{key:1},ee(p.individualApplications,o=>(f(),l(S,{key:o.id,shadow:`hover`,class:`application-card mb-2`,"body-style":{padding:`14px 16px`}},{default:u(()=>[e(`div`,le,[e(`span`,ue,n(o?.service?.title),1),o?.type===`Period`?(f(),l(k,{key:0,type:`success`,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):o?.type===`Usage`?(f(),l(k,{key:1,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0),o?.role===`grantee`?(f(),l(k,{key:2,type:`info`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),e(`div`,de,[e(`span`,fe,n(p.$t(`application.field.id`))+`: `+n(o.id),1),r(w,{content:o.id,class:`inline-block shrink-0`},null,8,[`content`])]),e(`div`,pe,[e(`span`,$,n(p.$t(`application.field.remainingAmount`)),1),e(`span`,me,n(p.getRemainingAmount(o)),1)]),o?.expired_at?(f(),a(`div`,he,[e(`span`,ge,n(p.$t(`application.field.expiredAt`)),1),e(`span`,_e,n(p.$dayjs.format(o.expired_at)),1)])):i(``,!0),o.service?.type===p.serviceType.API?(f(),a(`div`,ve,[e(`span`,ye,n(p.$t(`application.field.allowConsumeGlobal`)),1),r(A,{modelValue:o.allow_consume_global,"onUpdate:modelValue":e=>o.allow_consume_global=e,"active-value":!0,"inactive-value":!1,onChange:e=>p.updateAllowConsumeGlobal(o,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])])):i(``,!0),e(`div`,be,[r(E,{class:`!m-0 !px-3`,size:`small`,round:``,onClick:e=>p.onGoUsage(o)},{default:u(()=>[r(T,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(o)?(f(),l(E,{key:0,class:`!m-0 !px-3`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(o)},{default:u(()=>[r(D,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:2},1024))),128)):(f(),l(M,{key:0,description:p.$t(`common.message.noData`)},null,8,[`description`]))],64))])]),_:1})]),_:1}),r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[e(`div`,xe,[r(N,{"current-page":p.page,"page-size":p.limit,total:p.individualApplicationsTotal,onChange:p.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Ce=D(B,[[`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 ee,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{n as m,t as te}from"./table-DD9gDMtN.js";import{t as h}from"./card-D-4S-l7a.js";import{n as g,t as _}from"./row-CyazZ63X.js";import{t as v}from"./empty-B1wenOj5.js";import{t as y}from"./pagination-CeYQWqTe.js";import{t as b}from"./skeleton-B3LIGUiE.js";import{t as x}from"./switch-BRhNWQBv.js";import{t as S}from"./boxes-D9CjHyPy.js";import{t as C}from"./chart-no-axes-combined-C6a3Jfmv.js";import{t as w}from"./coins-D2UaeE3W.js";import{t as T}from"./wallet-DO9-OGI8.js";import{B as E,E as D,Fi as O,K as k,Ni as A,Xr as j,Yr as M,fi as N,fr as P,hn as F,ni as I,ri as L,xi as R}from"./index-DqO3RKoH.js";import{t as z}from"./CopyToClipboard-UlK2GDZ1.js";var B=p({name:`ConsoleApplicationList`,components:{AnalyticsIcon:C,ApplicationsIcon:S,CreditsIcon:w,WalletIcon:T,Pagination:y,CopyToClipboard:z,ElTable:te,ElRow:_,ElButton:O,ElCol:g,ElTag:A,ElSkeleton:b,ElSwitch:x,ElEmpty:v,ElTableColumn:m,ElCard:h},data(){return{credentialType:M,serviceType:j,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!F(this.$store.getters.site)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{rowCanPay(e){return F(this.$store.getters.site)?!1:N()?(e?.packages||[]).some(e=>e?.metadata?.apple_product_id):!0},updateAllowConsumeGlobal(e,t){!e||!e.id||P.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{R.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{R.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:E,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=I.INDIVIDUAL){return new Promise((t,n)=>{P.getAll({limit:this.limit,...e===I.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:L.USAGE,scope:e}).then(({data:n})=>{e===I.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{R.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(I.INDIVIDUAL),this.onFetchApplications(I.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){P.create({type:L.USAGE,scope:I.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(I.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}`}}}),V={class:`title`},H={key:1,class:`summary-card`},U={class:`icon-wrapper`},W={class:`label`},G={class:`value`},K={class:`description`},q={key:1,class:`flex flex-row justify-between items-center gap-3`},J={class:`summary-card min-w-0 flex-1`},Y={class:`flex justify-start items-center gap-2 mb-2 w-full`},X={class:`icon-wrapper !mb-0`},Z={class:`text-[var(--el-text-color-regular)] text-[14px] truncate`},Q={class:`label`},ne={class:`value`},re={class:`description`},ie={class:`flex flex-col items-end gap-2 shrink-0`},ae={class:`copy`},oe={key:0,class:`expired-at`},se={class:`flex flex-wrap items-center justify-end gap-1`},ce={class:`application-cards block sm:hidden`},le={class:`flex items-center gap-2 flex-wrap`},ue={class:`application-card__name`},de={class:`application-card__id`},fe={class:`truncate`},pe={class:`application-card__row`},$={class:`label`},me={class:`value`},he={key:0,class:`application-card__row`},ge={class:`label`},_e={class:`value`},ve={key:1,class:`application-card__row`},ye={class:`label`},be={class:`flex items-center justify-end gap-2 mt-3`},xe={class:`pagination`};function Se(p,m,te,h,g,_){let v=s(`el-col`),y=s(`el-row`),b=s(`el-skeleton`),x=s(`applications-icon`),S=s(`el-card`),C=s(`wallet-icon`),w=s(`copy-to-clipboard`),T=s(`analytics-icon`),E=s(`el-button`),D=s(`credits-icon`),O=s(`el-table-column`),k=s(`el-tag`),A=s(`el-switch`),j=s(`el-table`),M=s(`el-empty`),N=s(`pagination`),P=d(`loading`);return f(),l(y,{class:`application-list`},{default:u(()=>[r(v,{span:24},{default:u(()=>[r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[e(`h2`,V,n(p.$t(`common.title.allApplications`)),1)]),_:1})]),_:1}),r(y,{gutter:15,class:`mb-3`},{default:u(()=>[r(v,{md:12,xs:24},{default:u(()=>[r(S,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[p.loading?(f(),l(b,{key:0})):(f(),a(`div`,H,[e(`div`,U,[r(x,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,W,n(p.$t(`application.title.count`)),1),e(`p`,G,n(p.individualApplicationsTotal),1),e(`p`,K,n(p.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),p.showGlobalPayment&&p.globalApplications?.length>0?(f(),l(v,{key:0,md:12,xs:24},{default:u(()=>[r(S,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[p.loading?(f(),l(b,{key:0})):(f(),a(`div`,q,[e(`div`,J,[e(`div`,Y,[e(`div`,X,[r(C,{size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`span`,Z,[t(n(p.$t(`application.field.id`))+`: `+n(p.globalApplications?.[0]?.id)+` `,1),p.globalApplications?.[0]?.id?(f(),l(w,{key:0,content:p.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),e(`p`,Q,n(p.$t(`application.title.globalBalance`)),1),e(`p`,ne,n(p.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+n(p.$t(`service.unit.credits`)),1),e(`p`,re,n(p.$t(`application.message.globalBalanceDescription`)),1)]),e(`div`,ie,[r(E,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:m[0]||=e=>p.onGoUsage(p.globalApplications?.[0])},{default:u(()=>[r(T,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1}),p.showGlobalPayment?(f(),l(E,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:m[1]||=e=>p.onBuyMore(p.globalApplications?.[0])},{default:u(()=>[r(D,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1})):i(``,!0)])]))]),_:1})]),_:1})):i(``,!0)]),_:1}),r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[r(S,{shadow:`hover`,class:`applications-table-card hidden sm:block`},{default:u(()=>[c((f(),l(j,{data:p.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":p.$t(`common.message.noData`)},{default:u(()=>[r(O,{prop:`id`,label:p.$t(`application.field.id`),width:`200px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(t.row.id),1),e(`span`,ae,[r(w,{content:t?.row?.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(O,{label:p.$t(`application.field.type`),width:`90px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row?.type===`Period`?(f(),l(k,{key:0,type:`success`,effect:`dark`,round:``},{default:u(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):e.row?.type===`Usage`?(f(),l(k,{key:1,effect:`dark`,round:``},{default:u(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(O,{label:p.$t(`application.field.name`),width:`180px`},{default:u(r=>[e(`span`,null,n(r.row?.service?.title),1),r.row?.role===`grantee`?(f(),l(k,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:u(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(O,{prop:`remaining_amount`,label:p.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:u(t=>[e(`span`,null,n(p.getRemainingAmount(t.row)),1)]),_:1},8,[`label`]),r(O,{prop:`used_amount`,label:p.$t(`application.field.usedAmount`),width:`150px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(t=>[e(`span`,null,n(p.getUsedAmount(t.row)),1)]),_:1},8,[`label`]),r(O,{prop:`allow_consume_global`,label:p.$t(`application.field.allowConsumeGlobal`),width:`120px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.service?.type===p.serviceType.API?(f(),l(A,{key:0,modelValue:e.row.allow_consume_global,"onUpdate:modelValue":t=>e.row.allow_consume_global=t,"active-value":!0,"inactive-value":!1,onChange:t=>p.updateAllowConsumeGlobal(e.row,t)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])):i(``,!0)]),_:1},8,[`label`]),r(O,{label:p.$t(`application.field.expiredAt`),width:`180px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.expired_at?(f(),a(`span`,oe,n(p.$dayjs.format(e.row.expired_at)),1)):i(``,!0)]),_:1},8,[`label`]),r(O,{fixed:`right`,width:`200px`},{default:u(a=>[e(`div`,se,[r(E,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:e=>p.onGoUsage(a?.row)},{default:u(()=>[r(T,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(a?.row)?(f(),l(E,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(a?.row)},{default:u(()=>[r(D,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[P,p.loading]])]),_:1}),e(`div`,ce,[p.loading?(f(),l(b,{key:0,rows:4,animated:``})):(f(),a(o,{key:1},[p.individualApplications?.length?(f(!0),a(o,{key:1},ee(p.individualApplications,o=>(f(),l(S,{key:o.id,shadow:`hover`,class:`application-card mb-2`,"body-style":{padding:`14px 16px`}},{default:u(()=>[e(`div`,le,[e(`span`,ue,n(o?.service?.title),1),o?.type===`Period`?(f(),l(k,{key:0,type:`success`,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):o?.type===`Usage`?(f(),l(k,{key:1,effect:`dark`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0),o?.role===`grantee`?(f(),l(k,{key:2,type:`info`,size:`small`,round:``},{default:u(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),e(`div`,de,[e(`span`,fe,n(p.$t(`application.field.id`))+`: `+n(o.id),1),r(w,{content:o.id,class:`inline-block shrink-0`},null,8,[`content`])]),e(`div`,pe,[e(`span`,$,n(p.$t(`application.field.remainingAmount`)),1),e(`span`,me,n(p.getRemainingAmount(o)),1)]),o?.expired_at?(f(),a(`div`,he,[e(`span`,ge,n(p.$t(`application.field.expiredAt`)),1),e(`span`,_e,n(p.$dayjs.format(o.expired_at)),1)])):i(``,!0),o.service?.type===p.serviceType.API?(f(),a(`div`,ve,[e(`span`,ye,n(p.$t(`application.field.allowConsumeGlobal`)),1),r(A,{modelValue:o.allow_consume_global,"onUpdate:modelValue":e=>o.allow_consume_global=e,"active-value":!0,"inactive-value":!1,onChange:e=>p.updateAllowConsumeGlobal(o,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])])):i(``,!0),e(`div`,be,[r(E,{class:`!m-0 !px-3`,size:`small`,round:``,onClick:e=>p.onGoUsage(o)},{default:u(()=>[r(T,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(o)?(f(),l(E,{key:0,class:`!m-0 !px-3`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(o)},{default:u(()=>[r(D,{class:`mr-1 text-[12px]`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:2},1024))),128)):(f(),l(M,{key:0,description:p.$t(`common.message.noData`)},null,8,[`description`]))],64))])]),_:1})]),_:1}),r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[e(`div`,xe,[r(N,{"current-page":p.page,"page-size":p.limit,total:p.individualApplicationsTotal,onChange:p.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Ce=D(B,[[`render`,Se],[`__scopeId`,`data-v-d88616c5`]]);export{Ce 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 ee,qt as y,r as b,rt as x,s as S,t as C,tt as w,u as T,x as te,z as E}from"./vendor-chart-Dw-P17PN.js";import{r as D,t as O}from"./select-B-0w-lnr.js";import{n as k,t as A}from"./table-Blx50ajn.js";import{n as j,t as M}from"./tabs-Txs7sJeM.js";import{t as N}from"./card-D-4S-l7a.js";import{n as P,r as F}from"./radio-DgDgyT2l.js";import{n as I,t as L}from"./file-output-C6m-P9uv.js";import{n as R,t as z}from"./row-DzBNdvwT.js";import{t as B}from"./empty-B1wenOj5.js";import{t as V}from"./pagination-BXKKsIUG.js";import{n as H,t as U}from"./skeleton-B3LIGUiE.js";import{t as W}from"./switch-DznsotcK.js";import{t as G}from"./boxes-BOasP2Uf.js";import{E as ne,Ei as re,Fi as ie,Ni as ae,Xr as K,Yr as q,_r as J,ci as oe,fr as se,ir as ce,nr as le,ri as ue,rr as Y,xi as X}from"./index-suPyrMld.js";import{t as de}from"./CopyToClipboard-JbAG_2zY.js";var fe=e(J());v.register(c,u,p,b,S,T,d,h);var Z=[`#5B8FF9`,`#5AD8A6`,`#5D7092`,`#F6BD16`,`#6F5EF9`,`#6DC8EC`,`#945FB9`,`#FF9845`,`#1E9493`,`#FF99C3`],Q=`#C0C4CC`,pe=.01,me=20;function he(e){return e<=Z.length?Z.slice(0,e):Array.from({length:e},(t,n)=>`hsl(${Math.round(n*360/e)}, 62%, ${n%2==0?55:45}%)`)}var ge=15e3,_e=E({name:`ConsoleUsageList`,components:{ApplicationsIcon:G,ExportIcon:L,Pagination:V,ElTag:ae,ElDatePicker:I,ElTable:A,ElSelect:D,ElOption:O,CopyToClipboard:de,ElRow:z,ElCol:R,ElTableColumn:k,ElCard:N,ElRadioButton:P,ElRadioGroup:F,ElSkeleton:U,ElSkeletonItem:H,ElDialog:re,ElTabs:j,ElTabPane:M,ElButton:ie,ElEmpty:B,ElSwitch:W,BarChart:C,DoughnutChart:_},data(){return{applicationIds:this.$route.query.application_id?.toString()?this.$route.query.application_id?.toString().split(`,`):[],apiIds:this.$route.query.api_id?.toString()?this.$route.query.api_id?.toString().split(`,`):[],applications:[],apis:[],apisLoading:!1,credentialType:q,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 Y.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&&Y.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(){se.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:ue.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,le.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;Y.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){X.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=`${oe()}/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{X.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 Y.getAggregate(e);this.totalUsed=t.total||0;let n=Array.from(new Set((t.items||[]).map(e=>e.date))).sort(),r={},i={};(t.items||[]).forEach(e=>{let t=e.amount||0;(r[e.date]||(r[e.date]={}))[e.api_id]=(r[e.date]?.[e.api_id]||0)+t,i[e.api_id]=(i[e.api_id]||0)+t});let a=Object.keys(i).sort((e,t)=>i[t]-i[e]),o=a.reduce((e,t)=>e+i[t],0),s=a.length;if(o>0){let e=o*(1-pe),t=0;for(let n=0;n<a.length;n++)if(t+=i[a[n]],t>=e){s=n+1;break}s=Math.min(s,me)}a.length-s===1&&(s=a.length);let c=a.slice(0,s),l=new Set(c),u=he(c.length),d=a.slice(s),f=`${this.$t(`usage.value.others`)} (${d.length})`,p=c.map((e,i)=>({key:e,label:t.apis?.[e]?.title||e,data:n.map(t=>r[t]?.[e]||0),color:u[i]}));if(d.length){let e=n.map(e=>Object.entries(r[e]||{}).reduce((e,[t,n])=>l.has(t)?e:e+n,0));e.some(e=>e>0)&&p.push({key:`__others__`,label:f,data:e,color:Q})}this.apiBreakdown=a.map((e,n)=>({key:e,label:t.apis?.[e]?.title||e,amount:i[e],color:n<c.length?u[n]:Q,share:o>0?i[e]/o:0}));let m=[],h=[],g=[];c.forEach((e,n)=>{m.push(t.apis?.[e]?.title||e),h.push(i[e]),g.push(u[n])});let _=d.reduce((e,t)=>e+i[t],0);_>0&&(m.push(f),h.push(_),g.push(Q)),this.pieLabels=m,this.pieData=h,this.pieColors=g,this.barChartLabels=n,this.barChartSeries=p}finally{this.aggLoading=!1}}}}),ve={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},ye={class:`inline-block w-9`},be={class:`inline-block`},xe={key:1,class:`summary-card`},Se={class:`icon-wrapper`},Ce={class:`text-left`},we={class:`description`},Te={class:`value`},Ee={class:`flex flex-wrap items-center justify-between gap-2`},De={class:`text-[15px] font-medium text-[var(--el-text-color-primary)]`},Oe={class:`chart-wrapper`},ke={class:`share-cell`},Ae={class:`share-bar`},je={class:`share-pct`},Me={class:`flex items-center justify-end gap-2 mb-4`},Ne={class:`text-sm text-[var(--el-text-color-regular)]`},Pe={key:0},Fe={key:0},Ie={key:1},Le={class:`flex flex-wrap gap-2`},Re={class:`key`},ze={key:0,class:`cursor-pointer`},Be={class:`key`},Ve={key:0,class:`cursor-pointer`},$={class:`created-at`},He={class:`key`},Ue={key:0,class:`cursor-pointer`},We={class:`created-at`},Ge={key:1,class:`detail-json`},Ke={key:2,class:`text-gray-400`},qe={key:1,class:`detail-json`},Je={key:2,class:`text-gray-400`},Ye={class:`float-right`};function Xe(e,c,u,d,p,h){let _=l(`el-col`),v=l(`el-row`),b=l(`el-radio-button`),S=l(`el-radio-group`),C=l(`el-option`),T=l(`el-select`),E=l(`el-skeleton-item`),D=l(`el-skeleton`),O=l(`el-date-picker`),k=l(`export-icon`),A=l(`el-button`),j=l(`applications-icon`),M=l(`el-card`),N=l(`bar-chart`),P=l(`el-empty`),F=l(`doughnut-chart`),I=l(`el-table-column`),L=l(`el-table`),R=l(`el-switch`),z=l(`el-tag`),B=l(`copy-to-clipboard`),V=l(`el-tab-pane`),H=l(`el-tabs`),U=l(`el-dialog`),W=l(`pagination`),G=ee(`loading`);return w(),m(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[t(`h2`,ve,r(e.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),i(v,null,{default:g(()=>[i(_,{md:4,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,null,r(e.$t(`application.field.type`)),1),i(S,{modelValue:e.type,"onUpdate:modelValue":c[0]||=t=>e.type=t},{default:g(()=>[i(b,{value:e.serviceType.API,label:e.$t(`application.field.api`)},null,8,[`value`,`label`]),i(b,{value:e.serviceType.Proxy,label:e.$t(`application.field.proxy`)},null,8,[`value`,`label`])]),_:1},8,[`modelValue`])]),_:1}),f(i(_,{md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,ye,r(e.$t(`usage.field.application`)),1),i(T,{modelValue:e.applicationIds,"onUpdate:modelValue":c[1]||=t=>e.applicationIds=t,placeholder:e.$t(`usage.field.application`),clearable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApplicationsChange},{default:g(()=>[(w(!0),o(s,null,x(e.applications,e=>(w(),m(C,{key:e.id,label:e.service?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[te,!1]]),e.type===e.serviceType.API?(w(),m(_,{key:0,md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,be,r(e.$t(`usage.field.api`)),1),e.apisLoading?(w(),m(D,{key:0,animated:``,class:`w-full`},{template:g(()=>[i(E,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(w(),m(T,{key:1,modelValue:e.apiIds,"onUpdate:modelValue":c[2]||=t=>e.apiIds=t,placeholder:e.$t(`usage.field.api`),clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApisChange},{default:g(()=>[(w(!0),o(s,null,x(e.apis,e=>(w(),m(C,{key:e?.id,label:e?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]))]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(O,{modelValue:e.createdAtRange,"onUpdate:modelValue":c[3]||=t=>e.createdAtRange=t,type:`datetimerange`,class:`w-full`,shortcuts:e.shortcuts,"range-separator":e.$t(`usage.placeholder.to`),"start-placeholder":e.$t(`usage.placeholder.startDate`),"end-placeholder":e.$t(`usage.placeholder.endDate`),onChange:e.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(T,{modelValue:e.statusCodeFilter,"onUpdate:modelValue":c[4]||=t=>e.statusCodeFilter=t,placeholder:e.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:e.statusCodeOptionsLoading,onChange:e.onStatusCodeChange},{default:g(()=>[(w(!0),o(s,null,x(e.statusCodeOptions,e=>(w(),m(C,{key:e,label:String(e),value:String(e)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:g(()=>[i(A,{type:`primary`,plain:``,loading:e.exporting,class:`w-full whitespace-nowrap`,onClick:e.onExport},{default:g(()=>[i(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(e.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):a(``,!0)]),_:1}),i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[e.type===e.serviceType.API?(w(),m(v,{key:0,gutter:24,class:`mb-5`},{default:g(()=>[i(_,{md:6,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{default:g(()=>[e.aggLoading?(w(),m(D,{key:0})):(w(),o(`div`,xe,[t(`div`,Se,[i(j,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),t(`div`,Ce,[t(`p`,we,r(e.$t(`usage.title.totalUsed`)),1),t(`p`,Te,r(e.totalUsedString),1)])]))]),_:1})]),_:1}),i(_,{md:18,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{header:g(()=>[t(`div`,Ee,[t(`span`,De,r(e.$t(`usage.title.usageAnalytics`)),1),i(S,{modelValue:e.chartView,"onUpdate:modelValue":c[5]||=t=>e.chartView=t,size:`small`},{default:g(()=>[i(b,{value:`trend`,label:e.$t(`usage.view.trend`)},null,8,[`label`]),i(b,{value:`distribution`,label:e.$t(`usage.view.distribution`)},null,8,[`label`]),i(b,{value:`breakdown`,label:e.$t(`usage.view.breakdown`)},null,8,[`label`])]),_:1},8,[`modelValue`])])]),default:g(()=>[t(`div`,Oe,[e.aggLoading?(w(),m(D,{key:0,class:`w-full`})):e.chartView===`trend`?(w(),o(s,{key:1},[e.barChartSeries.length?(w(),m(N,{key:0,data:e.barChartData,options:e.barChartOptions,class:`chart`},null,8,[`data`,`options`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):e.chartView===`distribution`?(w(),o(s,{key:2},[e.pieData.length?(w(),m(F,{key:0,data:e.doughnutChartData,options:e.doughnutChartOptions,class:`chart`},null,8,[`data`,`options`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):(w(),o(s,{key:3},[e.apiBreakdown.length?(w(),m(L,{key:0,data:e.apiBreakdown,size:`small`,height:`300`,class:`w-full`},{default:g(()=>[i(I,{label:e.$t(`usage.field.api`),"min-width":`160`},{default:g(e=>[t(`span`,{class:`color-dot`,style:y({backgroundColor:e.row.color})},null,4),t(`span`,null,r(e.row.label),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.consumed`),width:`120`,align:`right`},{default:g(n=>[t(`span`,null,r(e.fmtAmount(n.row.amount)),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.share`),width:`150`},{default:g(e=>[t(`div`,ke,[t(`div`,Ae,[t(`div`,{class:`share-bar-fill`,style:y({width:e.row.share*100+`%`,backgroundColor:e.row.color})},null,4)]),t(`span`,je,r((e.row.share*100).toFixed(1))+`%`,1)])]),_:1},8,[`label`])]),_:1},8,[`data`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64))])]),_:1})]),_:1})]),_:1})):a(``,!0),i(M,{shadow:`hover`},{default:g(()=>[t(`div`,Me,[t(`span`,Ne,r(e.$t(`usage.field.autoRefresh`)),1),i(R,{modelValue:e.autoRefresh,"onUpdate:modelValue":c[6]||=t=>e.autoRefresh=t},null,8,[`modelValue`])]),e.type===e.serviceType.API?f((w(),m(L,{key:0,data:e.apiUsages,stripe:``,"table-layout":`fixed`,"empty-text":e.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:g(()=>[i(I,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.api?.title),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.statusCode`),width:`120px`},{default:g(t=>[t.row.status_code?(w(),o(`span`,Pe,r(t.row.status_code),1)):(w(),m(z,{key:1,type:`warning`,size:`small`},{default:g(()=>[n(r(e.$t(`usage.value.processing`)),1)]),_:1}))]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.elapsed`),width:`120px`},{default:g(n=>[t(`span`,null,r(e.formatElapsed(n.row.elapsed)),1)]),_:1},8,[`label`]),i(I,{prop:`deducted_amount`,label:e.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:g(n=>[e.getDeductedAmount(n.row)===e.getOriginalAmount(n.row)?(w(),o(`div`,Fe,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)])):(w(),o(`div`,Ie,[c[9]||=t(`p`,null,null,-1),t(`p`,null,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)]),t(`p`,null,[t(`del`,null,r(e.getOriginalAmount(n.row)),1)])]))]),_:1},8,[`label`]),i(I,{prop:`remaining_amount`,label:e.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`260px`,"class-name":`text-center`},{default:g(i=>[t(`div`,Le,[i.row.original_amount>i.row.deducted_amount&&i.row.original_amount>0?(w(),m(z,{key:0,type:`success`,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:g(()=>[n(r(((i.row.original_amount-i.row.deducted_amount)*100/i.row.original_amount).toFixed(0)+`% OFF`),1)]),_:2},1024)):a(``,!0),(w(!0),o(s,null,x(e.getSimpleMetadata(i.row.metadata),(e,t)=>(w(),m(z,{key:t,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))])]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:g(t=>[t.row.id?(w(),m(A,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:n=>e.onShowDetail(t.row)},{default:g(()=>[n(r(e.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:1},8,[`label`]),i(I,{prop:`trace_id`,label:e.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:g(e=>[t(`span`,Re,r(e.row.trace_id),1),e.row.trace_id?(w(),o(`span`,ze,[i(B,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{prop:`credential_id`,label:e.$t(`usage.field.credential`),width:`200px`,"class-name":`text-center`},{default:g(n=>[t(`span`,Be,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(w(),o(`span`,Ve,[i(B,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.createdAt`),width:`200px`},{default:g(n=>[t(`span`,$,r(e.$dayjs.format(n.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[G,e.loading]]):a(``,!0),e.type===e.serviceType.Proxy?f((w(),m(L,{key:1,data:e.proxyUsages,stripe:``,"table-layout":`fixed`,"empty-text":e.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:g(()=>[i(I,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.service?.title),1)]),_:1},8,[`label`]),i(I,{prop:`remaining_amount`,label:e.$t(`usage.field.remainingAmount`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1),t(`span`,null,r(e.getOriginalAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`deducted_amount`,label:e.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getDeductedAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:g(e=>[(w(!0),o(s,null,x(e.row.metadata,(e,t)=>(w(),m(z,{key:t,class:`mb-2`},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))]),_:1},8,[`label`]),i(I,{prop:`credential_id`,label:e.$t(`usage.field.credential`),width:`200px`,"class-name":`text-center`},{default:g(n=>[t(`span`,He,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(w(),o(`span`,Ue,[i(B,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.createdAt`),width:`200px`},{default:g(n=>[t(`span`,We,r(e.$dayjs.format(n.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[G,e.loading]]):a(``,!0)]),_:1})]),_:1})]),_:1}),i(U,{modelValue:e.detailDialogVisible,"onUpdate:modelValue":c[8]||=t=>e.detailDialogVisible=t,title:e.$t(`usage.dialog.detailTitle`),width:`70%`,top:`5vh`,"destroy-on-close":``},{default:g(()=>[i(H,{modelValue:e.detailActiveTab,"onUpdate:modelValue":c[7]||=t=>e.detailActiveTab=t},{default:g(()=>[i(V,{label:e.$t(`usage.dialog.request`),name:`request`},{default:g(()=>[e.detailLoading?(w(),m(D,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.request?(w(),o(`pre`,Ge,r(e.formatJson(e.detailRow.metadata.request)),1)):(w(),o(`p`,Ke,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),i(V,{label:e.$t(`usage.dialog.response`),name:`response`},{default:g(()=>[e.detailLoading?(w(),m(D,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.response?(w(),o(`pre`,qe,r(e.formatJson(e.detailRow.metadata.response)),1)):(w(),o(`p`,Je,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`]),i(v,null,{default:g(()=>[i(_,{span:10,offset:14},{default:g(()=>[t(`div`,Ye,[i(W,{"current-page":e.page,"page-size":e.limit,total:e.total,onChange:e.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Ze=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 ee,qt as y,r as b,rt as x,s as S,t as C,tt as w,u as T,x as te,z as E}from"./vendor-chart-Dw-P17PN.js";import{r as D,t as O}from"./select-Ahh1HtiI.js";import{n as k,t as A}from"./table-DD9gDMtN.js";import{n as j,t as M}from"./tabs-Qw07hKJ5.js";import{t as N}from"./card-D-4S-l7a.js";import{n as P,r as F}from"./radio-DgDgyT2l.js";import{n as I,t as L}from"./file-output-CXhW1Vlg.js";import{n as R,t as z}from"./row-CyazZ63X.js";import{t as B}from"./empty-B1wenOj5.js";import{t as V}from"./pagination-CeYQWqTe.js";import{n as H,t as U}from"./skeleton-B3LIGUiE.js";import{t as W}from"./switch-BRhNWQBv.js";import{t as G}from"./boxes-D9CjHyPy.js";import{E as ne,Ei as re,Fi as ie,Ni as ae,Xr as K,Yr as q,_r as J,ci as oe,fr as se,ir as ce,nr as le,ri as ue,rr as Y,xi as X}from"./index-DqO3RKoH.js";import{t as de}from"./CopyToClipboard-UlK2GDZ1.js";var fe=e(J());v.register(c,u,p,b,S,T,d,h);var Z=[`#5B8FF9`,`#5AD8A6`,`#5D7092`,`#F6BD16`,`#6F5EF9`,`#6DC8EC`,`#945FB9`,`#FF9845`,`#1E9493`,`#FF99C3`],Q=`#C0C4CC`,pe=.01,me=20;function he(e){return e<=Z.length?Z.slice(0,e):Array.from({length:e},(t,n)=>`hsl(${Math.round(n*360/e)}, 62%, ${n%2==0?55:45}%)`)}var ge=15e3,_e=E({name:`ConsoleUsageList`,components:{ApplicationsIcon:G,ExportIcon:L,Pagination:V,ElTag:ae,ElDatePicker:I,ElTable:A,ElSelect:D,ElOption:O,CopyToClipboard:de,ElRow:z,ElCol:R,ElTableColumn:k,ElCard:N,ElRadioButton:P,ElRadioGroup:F,ElSkeleton:U,ElSkeletonItem:H,ElDialog:re,ElTabs:j,ElTabPane:M,ElButton:ie,ElEmpty:B,ElSwitch:W,BarChart:C,DoughnutChart:_},data(){return{applicationIds:this.$route.query.application_id?.toString()?this.$route.query.application_id?.toString().split(`,`):[],apiIds:this.$route.query.api_id?.toString()?this.$route.query.api_id?.toString().split(`,`):[],applications:[],apis:[],apisLoading:!1,credentialType:q,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 Y.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&&Y.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(){se.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:ue.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,le.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;Y.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){X.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=`${oe()}/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{X.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 Y.getAggregate(e);this.totalUsed=t.total||0;let n=Array.from(new Set((t.items||[]).map(e=>e.date))).sort(),r={},i={};(t.items||[]).forEach(e=>{let t=e.amount||0;(r[e.date]||(r[e.date]={}))[e.api_id]=(r[e.date]?.[e.api_id]||0)+t,i[e.api_id]=(i[e.api_id]||0)+t});let a=Object.keys(i).sort((e,t)=>i[t]-i[e]),o=a.reduce((e,t)=>e+i[t],0),s=a.length;if(o>0){let e=o*(1-pe),t=0;for(let n=0;n<a.length;n++)if(t+=i[a[n]],t>=e){s=n+1;break}s=Math.min(s,me)}a.length-s===1&&(s=a.length);let c=a.slice(0,s),l=new Set(c),u=he(c.length),d=a.slice(s),f=`${this.$t(`usage.value.others`)} (${d.length})`,p=c.map((e,i)=>({key:e,label:t.apis?.[e]?.title||e,data:n.map(t=>r[t]?.[e]||0),color:u[i]}));if(d.length){let e=n.map(e=>Object.entries(r[e]||{}).reduce((e,[t,n])=>l.has(t)?e:e+n,0));e.some(e=>e>0)&&p.push({key:`__others__`,label:f,data:e,color:Q})}this.apiBreakdown=a.map((e,n)=>({key:e,label:t.apis?.[e]?.title||e,amount:i[e],color:n<c.length?u[n]:Q,share:o>0?i[e]/o:0}));let m=[],h=[],g=[];c.forEach((e,n)=>{m.push(t.apis?.[e]?.title||e),h.push(i[e]),g.push(u[n])});let _=d.reduce((e,t)=>e+i[t],0);_>0&&(m.push(f),h.push(_),g.push(Q)),this.pieLabels=m,this.pieData=h,this.pieColors=g,this.barChartLabels=n,this.barChartSeries=p}finally{this.aggLoading=!1}}}}),ve={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},ye={class:`inline-block w-9`},be={class:`inline-block`},xe={key:1,class:`summary-card`},Se={class:`icon-wrapper`},Ce={class:`text-left`},we={class:`description`},Te={class:`value`},Ee={class:`flex flex-wrap items-center justify-between gap-2`},De={class:`text-[15px] font-medium text-[var(--el-text-color-primary)]`},Oe={class:`chart-wrapper`},ke={class:`share-cell`},Ae={class:`share-bar`},je={class:`share-pct`},Me={class:`flex items-center justify-end gap-2 mb-4`},Ne={class:`text-sm text-[var(--el-text-color-regular)]`},Pe={key:0},Fe={key:0},Ie={key:1},Le={class:`flex flex-wrap gap-2`},Re={class:`key`},ze={key:0,class:`cursor-pointer`},Be={class:`key`},Ve={key:0,class:`cursor-pointer`},$={class:`created-at`},He={class:`key`},Ue={key:0,class:`cursor-pointer`},We={class:`created-at`},Ge={key:1,class:`detail-json`},Ke={key:2,class:`text-gray-400`},qe={key:1,class:`detail-json`},Je={key:2,class:`text-gray-400`},Ye={class:`float-right`};function Xe(e,c,u,d,p,h){let _=l(`el-col`),v=l(`el-row`),b=l(`el-radio-button`),S=l(`el-radio-group`),C=l(`el-option`),T=l(`el-select`),E=l(`el-skeleton-item`),D=l(`el-skeleton`),O=l(`el-date-picker`),k=l(`export-icon`),A=l(`el-button`),j=l(`applications-icon`),M=l(`el-card`),N=l(`bar-chart`),P=l(`el-empty`),F=l(`doughnut-chart`),I=l(`el-table-column`),L=l(`el-table`),R=l(`el-switch`),z=l(`el-tag`),B=l(`copy-to-clipboard`),V=l(`el-tab-pane`),H=l(`el-tabs`),U=l(`el-dialog`),W=l(`pagination`),G=ee(`loading`);return w(),m(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[t(`h2`,ve,r(e.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),i(v,null,{default:g(()=>[i(_,{md:4,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,null,r(e.$t(`application.field.type`)),1),i(S,{modelValue:e.type,"onUpdate:modelValue":c[0]||=t=>e.type=t},{default:g(()=>[i(b,{value:e.serviceType.API,label:e.$t(`application.field.api`)},null,8,[`value`,`label`]),i(b,{value:e.serviceType.Proxy,label:e.$t(`application.field.proxy`)},null,8,[`value`,`label`])]),_:1},8,[`modelValue`])]),_:1}),f(i(_,{md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,ye,r(e.$t(`usage.field.application`)),1),i(T,{modelValue:e.applicationIds,"onUpdate:modelValue":c[1]||=t=>e.applicationIds=t,placeholder:e.$t(`usage.field.application`),clearable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApplicationsChange},{default:g(()=>[(w(!0),o(s,null,x(e.applications,e=>(w(),m(C,{key:e.id,label:e.service?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[te,!1]]),e.type===e.serviceType.API?(w(),m(_,{key:0,md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,be,r(e.$t(`usage.field.api`)),1),e.apisLoading?(w(),m(D,{key:0,animated:``,class:`w-full`},{template:g(()=>[i(E,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(w(),m(T,{key:1,modelValue:e.apiIds,"onUpdate:modelValue":c[2]||=t=>e.apiIds=t,placeholder:e.$t(`usage.field.api`),clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApisChange},{default:g(()=>[(w(!0),o(s,null,x(e.apis,e=>(w(),m(C,{key:e?.id,label:e?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]))]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(O,{modelValue:e.createdAtRange,"onUpdate:modelValue":c[3]||=t=>e.createdAtRange=t,type:`datetimerange`,class:`w-full`,shortcuts:e.shortcuts,"range-separator":e.$t(`usage.placeholder.to`),"start-placeholder":e.$t(`usage.placeholder.startDate`),"end-placeholder":e.$t(`usage.placeholder.endDate`),onChange:e.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(T,{modelValue:e.statusCodeFilter,"onUpdate:modelValue":c[4]||=t=>e.statusCodeFilter=t,placeholder:e.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:e.statusCodeOptionsLoading,onChange:e.onStatusCodeChange},{default:g(()=>[(w(!0),o(s,null,x(e.statusCodeOptions,e=>(w(),m(C,{key:e,label:String(e),value:String(e)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(w(),m(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:g(()=>[i(A,{type:`primary`,plain:``,loading:e.exporting,class:`w-full whitespace-nowrap`,onClick:e.onExport},{default:g(()=>[i(k,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),n(` `+r(e.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):a(``,!0)]),_:1}),i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[e.type===e.serviceType.API?(w(),m(v,{key:0,gutter:24,class:`mb-5`},{default:g(()=>[i(_,{md:6,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{default:g(()=>[e.aggLoading?(w(),m(D,{key:0})):(w(),o(`div`,xe,[t(`div`,Se,[i(j,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),t(`div`,Ce,[t(`p`,we,r(e.$t(`usage.title.totalUsed`)),1),t(`p`,Te,r(e.totalUsedString),1)])]))]),_:1})]),_:1}),i(_,{md:18,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{header:g(()=>[t(`div`,Ee,[t(`span`,De,r(e.$t(`usage.title.usageAnalytics`)),1),i(S,{modelValue:e.chartView,"onUpdate:modelValue":c[5]||=t=>e.chartView=t,size:`small`},{default:g(()=>[i(b,{value:`trend`,label:e.$t(`usage.view.trend`)},null,8,[`label`]),i(b,{value:`distribution`,label:e.$t(`usage.view.distribution`)},null,8,[`label`]),i(b,{value:`breakdown`,label:e.$t(`usage.view.breakdown`)},null,8,[`label`])]),_:1},8,[`modelValue`])])]),default:g(()=>[t(`div`,Oe,[e.aggLoading?(w(),m(D,{key:0,class:`w-full`})):e.chartView===`trend`?(w(),o(s,{key:1},[e.barChartSeries.length?(w(),m(N,{key:0,data:e.barChartData,options:e.barChartOptions,class:`chart`},null,8,[`data`,`options`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):e.chartView===`distribution`?(w(),o(s,{key:2},[e.pieData.length?(w(),m(F,{key:0,data:e.doughnutChartData,options:e.doughnutChartOptions,class:`chart`},null,8,[`data`,`options`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):(w(),o(s,{key:3},[e.apiBreakdown.length?(w(),m(L,{key:0,data:e.apiBreakdown,size:`small`,height:`300`,class:`w-full`},{default:g(()=>[i(I,{label:e.$t(`usage.field.api`),"min-width":`160`},{default:g(e=>[t(`span`,{class:`color-dot`,style:y({backgroundColor:e.row.color})},null,4),t(`span`,null,r(e.row.label),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.consumed`),width:`120`,align:`right`},{default:g(n=>[t(`span`,null,r(e.fmtAmount(n.row.amount)),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.share`),width:`150`},{default:g(e=>[t(`div`,ke,[t(`div`,Ae,[t(`div`,{class:`share-bar-fill`,style:y({width:e.row.share*100+`%`,backgroundColor:e.row.color})},null,4)]),t(`span`,je,r((e.row.share*100).toFixed(1))+`%`,1)])]),_:1},8,[`label`])]),_:1},8,[`data`])):(w(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64))])]),_:1})]),_:1})]),_:1})):a(``,!0),i(M,{shadow:`hover`},{default:g(()=>[t(`div`,Me,[t(`span`,Ne,r(e.$t(`usage.field.autoRefresh`)),1),i(R,{modelValue:e.autoRefresh,"onUpdate:modelValue":c[6]||=t=>e.autoRefresh=t},null,8,[`modelValue`])]),e.type===e.serviceType.API?f((w(),m(L,{key:0,data:e.apiUsages,stripe:``,"table-layout":`fixed`,"empty-text":e.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:g(()=>[i(I,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.api?.title),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.statusCode`),width:`120px`},{default:g(t=>[t.row.status_code?(w(),o(`span`,Pe,r(t.row.status_code),1)):(w(),m(z,{key:1,type:`warning`,size:`small`},{default:g(()=>[n(r(e.$t(`usage.value.processing`)),1)]),_:1}))]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.elapsed`),width:`120px`},{default:g(n=>[t(`span`,null,r(e.formatElapsed(n.row.elapsed)),1)]),_:1},8,[`label`]),i(I,{prop:`deducted_amount`,label:e.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:g(n=>[e.getDeductedAmount(n.row)===e.getOriginalAmount(n.row)?(w(),o(`div`,Fe,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)])):(w(),o(`div`,Ie,[c[9]||=t(`p`,null,null,-1),t(`p`,null,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)]),t(`p`,null,[t(`del`,null,r(e.getOriginalAmount(n.row)),1)])]))]),_:1},8,[`label`]),i(I,{prop:`remaining_amount`,label:e.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`260px`,"class-name":`text-center`},{default:g(i=>[t(`div`,Le,[i.row.original_amount>i.row.deducted_amount&&i.row.original_amount>0?(w(),m(z,{key:0,type:`success`,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:g(()=>[n(r(((i.row.original_amount-i.row.deducted_amount)*100/i.row.original_amount).toFixed(0)+`% OFF`),1)]),_:2},1024)):a(``,!0),(w(!0),o(s,null,x(e.getSimpleMetadata(i.row.metadata),(e,t)=>(w(),m(z,{key:t,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))])]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:g(t=>[t.row.id?(w(),m(A,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:n=>e.onShowDetail(t.row)},{default:g(()=>[n(r(e.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:1},8,[`label`]),i(I,{prop:`trace_id`,label:e.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:g(e=>[t(`span`,Re,r(e.row.trace_id),1),e.row.trace_id?(w(),o(`span`,ze,[i(B,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{prop:`credential_id`,label:e.$t(`usage.field.credential`),width:`200px`,"class-name":`text-center`},{default:g(n=>[t(`span`,Be,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(w(),o(`span`,Ve,[i(B,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.createdAt`),width:`200px`},{default:g(n=>[t(`span`,$,r(e.$dayjs.format(n.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[G,e.loading]]):a(``,!0),e.type===e.serviceType.Proxy?f((w(),m(L,{key:1,data:e.proxyUsages,stripe:``,"table-layout":`fixed`,"empty-text":e.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:g(()=>[i(I,{label:e.$t(`application.field.name`),width:`160px`},{default:g(e=>[t(`span`,null,r(e.row?.service?.title),1)]),_:1},8,[`label`]),i(I,{prop:`remaining_amount`,label:e.$t(`usage.field.remainingAmount`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1),t(`span`,null,r(e.getOriginalAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`deducted_amount`,label:e.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getDeductedAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:g(n=>[t(`span`,null,r(e.getRemainingAmount(n.row)),1)]),_:1},8,[`label`]),i(I,{prop:`metadata`,label:e.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:g(e=>[(w(!0),o(s,null,x(e.row.metadata,(e,t)=>(w(),m(z,{key:t,class:`mb-2`},{default:g(()=>[n(r(t)+`: `+r(e),1)]),_:2},1024))),128))]),_:1},8,[`label`]),i(I,{prop:`credential_id`,label:e.$t(`usage.field.credential`),width:`200px`,"class-name":`text-center`},{default:g(n=>[t(`span`,He,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(w(),o(`span`,Ue,[i(B,{content:n.row.credential?.id||n.row.credential_id,class:`inline-block`},null,8,[`content`])])):a(``,!0)]),_:1},8,[`label`]),i(I,{label:e.$t(`usage.field.createdAt`),width:`200px`},{default:g(n=>[t(`span`,We,r(e.$dayjs.format(n.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[G,e.loading]]):a(``,!0)]),_:1})]),_:1})]),_:1}),i(U,{modelValue:e.detailDialogVisible,"onUpdate:modelValue":c[8]||=t=>e.detailDialogVisible=t,title:e.$t(`usage.dialog.detailTitle`),width:`70%`,top:`5vh`,"destroy-on-close":``},{default:g(()=>[i(H,{modelValue:e.detailActiveTab,"onUpdate:modelValue":c[7]||=t=>e.detailActiveTab=t},{default:g(()=>[i(V,{label:e.$t(`usage.dialog.request`),name:`request`},{default:g(()=>[e.detailLoading?(w(),m(D,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.request?(w(),o(`pre`,Ge,r(e.formatJson(e.detailRow.metadata.request)),1)):(w(),o(`p`,Ke,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),i(V,{label:e.$t(`usage.dialog.response`),name:`response`},{default:g(()=>[e.detailLoading?(w(),m(D,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.response?(w(),o(`pre`,qe,r(e.formatJson(e.detailRow.metadata.response)),1)):(w(),o(`p`,Je,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`]),i(v,null,{default:g(()=>[i(_,{span:10,offset:14},{default:g(()=>[t(`div`,Ye,[i(W,{"current-page":e.page,"page-size":e.limit,total:e.total,onChange:e.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var Ze=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,N as i,T as a,at as o,ht as s,j as c,mt as l,ot as u,rt as d,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{r as m,t as h}from"./select-B-0w-lnr.js";import{n as g,t as _}from"./table-Blx50ajn.js";import{t as v}from"./card-D-4S-l7a.js";import{n as y,t as b}from"./file-output-C6m-P9uv.js";import{n as x,t as S}from"./row-DzBNdvwT.js";import{t as C}from"./pagination-BXKKsIUG.js";import{t as w}from"./skeleton-B3LIGUiE.js";import{t as T}from"./circle-check-BzGLOmyv.js";import{t as E}from"./clock-vhFCjsKg.js";import{t as D}from"./dollar-sign-DTrp2CR-.js";import{E as O,Fi as k,Ni as A,Zr as j,qt as M,tr as N,yi as P}from"./index-suPyrMld.js";import{t as F}from"./CopyToClipboard-JbAG_2zY.js";var I=P(`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`}]]),L={total_count:0,total_spent:0,state_counts:{}},R=p({name:`ConsoleOrderList`,components:{ExportIcon:b,MoneyIcon:D,ReceiptIcon:I,SuccessIcon:T,TimeIcon:E,Pagination:C,CopyToClipboard:F,ElRow:S,ElCol:x,ElTable:_,ElTableColumn:g,ElButton:k,ElTag:A,ElCard:v,ElSelect:m,ElOption:h,ElDatePicker:y,ElSkeleton:w},data(){return{OrderState:j,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:{...L},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:j.PENDING,label:this.$t(`order.state.pending`)},{value:j.FINISHED,label:this.$t(`order.state.finished`)},{value:j.PAID,label:this.$t(`order.state.paid`)},{value:j.EXPIRED,label:this.$t(`order.state.expired`)},{value:j.FAILED,label:this.$t(`order.state.failed`)},{value:j.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:M,stateTagType(e){return e===j.FINISHED||e===j.PAID?`success`:e===j.EXPIRED||e===j.FAILED?`danger`:e===j.REFUNDED?`warning`:`info`},stateLabel(e){return{[j.PENDING]:this.$t(`order.state.pending`),[j.PAID]:this.$t(`order.state.paid`),[j.FINISHED]:this.$t(`order.state.finished`),[j.EXPIRED]:this.$t(`order.state.expired`),[j.FAILED]:this.$t(`order.state.failed`),[j.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==j.PAID&&e!==j.FINISHED&&e!==j.EXPIRED&&e!==j.FAILED&&e!==j.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,N.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,N.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...L}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,N.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})}}}),z={class:`title`},B={key:1,class:`card-content`},V={class:`icon-wrapper`},H={class:`description`},U={class:`value`},W={key:1,class:`card-content`},G={class:`icon-wrapper`},K={class:`description`},q={class:`value`},J={key:1,class:`card-content`},ee={class:`icon-wrapper`},Y={class:`description`},X={class:`value`},Z={key:1,class:`card-content`},Q={class:`icon-wrapper`},$={class:`description`},te={class:`value`},ne={class:`filter-row mb-3`},re={class:`key`},ie={class:`cursor-pointer`},ae={class:`price`},oe={class:`description`},se={class:`text-gray-500`},ce={class:`created-at`},le={class:`flex items-center justify-center flex-wrap`},ue={class:`float-right`};function de(p,m,h,g,_,v){let y=o(`el-col`),b=o(`el-row`),x=o(`el-skeleton`),S=o(`receipt-icon`),C=o(`el-card`),w=o(`money-icon`),T=o(`success-icon`),E=o(`time-icon`),D=o(`el-option`),O=o(`el-select`),k=o(`el-date-picker`),A=o(`export-icon`),j=o(`el-button`),M=o(`copy-to-clipboard`),N=o(`el-table-column`),P=o(`el-tag`),F=o(`el-table`),I=o(`pagination`),L=u(`loading`);return f(),c(b,{class:`panel`},{default:l(()=>[r(y,{span:24},{default:l(()=>[r(b,null,{default:l(()=>[r(y,{span:24},{default:l(()=>[e(`h2`,z,n(p.$t(`common.title.allOrders`)),1)]),_:1})]),_:1}),r(b,{gutter:16},{default:l(()=>[r(y,{md:6,sm:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(x,{key:0})):(f(),i(`div`,B,[e(`div`,V,[r(S,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,H,n(p.$t(`order.title.totalOrders`)),1),e(`p`,U,n(p.summary.total_count),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(x,{key:0})):(f(),i(`div`,W,[e(`div`,G,[r(w,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,K,n(p.$t(`order.title.totalSpent`)),1),e(`p`,q,n(p.getPriceString({value:p.summary.total_spent})),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(x,{key:0})):(f(),i(`div`,J,[e(`div`,ee,[r(T,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,Y,n(p.$t(`order.title.finishedOrders`)),1),e(`p`,X,n(p.summary.state_counts?.Finished||0),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(x,{key:0})):(f(),i(`div`,Z,[e(`div`,Q,[r(E,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,$,n(p.$t(`order.title.pendingOrders`)),1),e(`p`,te,n(p.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),e(`div`,ne,[r(O,{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(D,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(O,{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(D,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(k,{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(j,{type:`primary`,plain:``,loading:p.exporting,onClick:p.onExport},{default:l(()=>[r(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`order.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),r(b,null,{default:l(()=>[r(y,{span:24},{default:l(()=>[r(C,{shadow:`hover`},{default:l(()=>[s((f(),c(F,{data:p.orders,stripe:``,"empty-text":p.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:l(()=>[r(N,{prop:`id`,label:p.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:l(t=>[e(`span`,re,n(t.row.id),1),e(`span`,ie,[r(M,{content:t.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(N,{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(N,{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(N,{prop:`state`,label:p.$t(`order.field.state`),width:`130px`,align:`center`},{default:l(e=>[r(P,{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(N,{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(N,{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(N,{"min-width":`130px`,fixed:`right`},{default:l(r=>[e(`div`,le,[p.isPendingAction(r.row.state)?(f(),c(j,{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(j,{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`])),[[L,p.loading]])]),_:1})]),_:1})]),_:1}),r(b,null,{default:l(()=>[r(y,{span:10,offset:14},{default:l(()=>[e(`div`,ue,[r(I,{"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=O(R,[[`render`,de],[`__scopeId`,`data-v-a543d5b3`]]);export{fe as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,N as i,T as a,at as o,ht as s,j as c,mt as l,ot as u,rt as d,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{r as m,t as h}from"./select-Ahh1HtiI.js";import{n as g,t as _}from"./table-DD9gDMtN.js";import{t as v}from"./card-D-4S-l7a.js";import{n as y,t as b}from"./file-output-CXhW1Vlg.js";import{n as x,t as S}from"./row-CyazZ63X.js";import{t as C}from"./pagination-CeYQWqTe.js";import{t as w}from"./skeleton-B3LIGUiE.js";import{t as T}from"./circle-check-CVci65aA.js";import{t as E}from"./clock-Zko38AEz.js";import{t as D}from"./dollar-sign-C1xhgwfY.js";import{E as O,Fi as k,Ni as A,Zr as j,qt as M,tr as N,yi as P}from"./index-DqO3RKoH.js";import{t as F}from"./CopyToClipboard-UlK2GDZ1.js";var I=P(`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`}]]),L={total_count:0,total_spent:0,state_counts:{}},R=p({name:`ConsoleOrderList`,components:{ExportIcon:b,MoneyIcon:D,ReceiptIcon:I,SuccessIcon:T,TimeIcon:E,Pagination:C,CopyToClipboard:F,ElRow:S,ElCol:x,ElTable:_,ElTableColumn:g,ElButton:k,ElTag:A,ElCard:v,ElSelect:m,ElOption:h,ElDatePicker:y,ElSkeleton:w},data(){return{OrderState:j,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:{...L},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:j.PENDING,label:this.$t(`order.state.pending`)},{value:j.FINISHED,label:this.$t(`order.state.finished`)},{value:j.PAID,label:this.$t(`order.state.paid`)},{value:j.EXPIRED,label:this.$t(`order.state.expired`)},{value:j.FAILED,label:this.$t(`order.state.failed`)},{value:j.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:M,stateTagType(e){return e===j.FINISHED||e===j.PAID?`success`:e===j.EXPIRED||e===j.FAILED?`danger`:e===j.REFUNDED?`warning`:`info`},stateLabel(e){return{[j.PENDING]:this.$t(`order.state.pending`),[j.PAID]:this.$t(`order.state.paid`),[j.FINISHED]:this.$t(`order.state.finished`),[j.EXPIRED]:this.$t(`order.state.expired`),[j.FAILED]:this.$t(`order.state.failed`),[j.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==j.PAID&&e!==j.FINISHED&&e!==j.EXPIRED&&e!==j.FAILED&&e!==j.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,N.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,N.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...L}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,N.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})}}}),z={class:`title`},B={key:1,class:`card-content`},V={class:`icon-wrapper`},H={class:`description`},U={class:`value`},W={key:1,class:`card-content`},G={class:`icon-wrapper`},K={class:`description`},q={class:`value`},J={key:1,class:`card-content`},ee={class:`icon-wrapper`},Y={class:`description`},X={class:`value`},Z={key:1,class:`card-content`},Q={class:`icon-wrapper`},$={class:`description`},te={class:`value`},ne={class:`filter-row mb-3`},re={class:`key`},ie={class:`cursor-pointer`},ae={class:`price`},oe={class:`description`},se={class:`text-gray-500`},ce={class:`created-at`},le={class:`flex items-center justify-center flex-wrap`},ue={class:`float-right`};function de(p,m,h,g,_,v){let y=o(`el-col`),b=o(`el-row`),x=o(`el-skeleton`),S=o(`receipt-icon`),C=o(`el-card`),w=o(`money-icon`),T=o(`success-icon`),E=o(`time-icon`),D=o(`el-option`),O=o(`el-select`),k=o(`el-date-picker`),A=o(`export-icon`),j=o(`el-button`),M=o(`copy-to-clipboard`),N=o(`el-table-column`),P=o(`el-tag`),F=o(`el-table`),I=o(`pagination`),L=u(`loading`);return f(),c(b,{class:`panel`},{default:l(()=>[r(y,{span:24},{default:l(()=>[r(b,null,{default:l(()=>[r(y,{span:24},{default:l(()=>[e(`h2`,z,n(p.$t(`common.title.allOrders`)),1)]),_:1})]),_:1}),r(b,{gutter:16},{default:l(()=>[r(y,{md:6,sm:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(x,{key:0})):(f(),i(`div`,B,[e(`div`,V,[r(S,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,H,n(p.$t(`order.title.totalOrders`)),1),e(`p`,U,n(p.summary.total_count),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(x,{key:0})):(f(),i(`div`,W,[e(`div`,G,[r(w,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,K,n(p.$t(`order.title.totalSpent`)),1),e(`p`,q,n(p.getPriceString({value:p.summary.total_spent})),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(x,{key:0})):(f(),i(`div`,J,[e(`div`,ee,[r(T,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,Y,n(p.$t(`order.title.finishedOrders`)),1),e(`p`,X,n(p.summary.state_counts?.Finished||0),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:l(()=>[p.summaryLoading?(f(),c(x,{key:0})):(f(),i(`div`,Z,[e(`div`,Q,[r(E,{class:`icon`,size:`1em`,"aria-hidden":`true`,focusable:`false`})]),e(`p`,$,n(p.$t(`order.title.pendingOrders`)),1),e(`p`,te,n(p.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),e(`div`,ne,[r(O,{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(D,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(O,{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(D,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(k,{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(j,{type:`primary`,plain:``,loading:p.exporting,onClick:p.onExport},{default:l(()=>[r(A,{class:`mr-1`,size:`1em`,"aria-hidden":`true`,focusable:`false`}),t(` `+n(p.$t(`order.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),r(b,null,{default:l(()=>[r(y,{span:24},{default:l(()=>[r(C,{shadow:`hover`},{default:l(()=>[s((f(),c(F,{data:p.orders,stripe:``,"empty-text":p.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:l(()=>[r(N,{prop:`id`,label:p.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:l(t=>[e(`span`,re,n(t.row.id),1),e(`span`,ie,[r(M,{content:t.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(N,{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(N,{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(N,{prop:`state`,label:p.$t(`order.field.state`),width:`130px`,align:`center`},{default:l(e=>[r(P,{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(N,{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(N,{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(N,{"min-width":`130px`,fixed:`right`},{default:l(r=>[e(`div`,le,[p.isPendingAction(r.row.state)?(f(),c(j,{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(j,{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`])),[[L,p.loading]])]),_:1})]),_:1})]),_:1}),r(b,null,{default:l(()=>[r(y,{span:10,offset:14},{default:l(()=>[e(`div`,ue,[r(I,{"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=O(R,[[`render`,de],[`__scopeId`,`data-v-a543d5b3`]]);export{fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,Jt as t,L as n,N as r,at as i,tt as a,z as o}from"./vendor-chart-Dw-P17PN.js";import{t as s}from"./LocalTools-
|
|
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-mA4qi1R9.js";import{E as c}from"./index-DqO3RKoH.js";var l=o({name:`SettingsLocalTools`,components:{LocalToolsSetting:s}}),u={class:`local-tools-page`};function d(o,s,c,l,d,f){let p=i(`local-tools-setting`);return a(),r(`div`,u,[e(`h2`,null,t(o.$t(`common.settings.localTools`)),1),n(p)])}var f=c(l,[[`render`,d],[`__scopeId`,`data-v-ac732814`]]);export{f as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime--c01j_DQ.js";import{A as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,j as l,mt as u,rt as d,st as f,tt as p,z as m}from"./vendor-chart-Dw-P17PN.js";import{t as 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-BRhNWQBv.js";import{n as h,t as g}from"./shield-pXoBoWKG.js";import{t as _}from"./folder-DZT47PmT.js";import{t as v}from"./mouse-pointer-2-GULNpi4q.js";import{t as y}from"./pencil-DAHD3MGa.js";import{t as b}from"./plus-B9ZI1sUd.js";import{t as x}from"./terminal-CVTwU1By.js";import{t as S}from"./wand-sparkles-DYow-1ZH.js";import{E as C,Fi as w,Ni as T,O as E,Wi as te,pr as D,si as O,ui as ne,yi as k}from"./index-DqO3RKoH.js";var A=k(`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=k(`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=k(`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=k(`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:b,ElButton:w,ElTag:T,ElSwitch:ee,ElInput:te,FolderIcon:_,MagicIcon:S,SecurityIcon:g},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:[],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?.()??[];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=[];for(let e of t){if(e.startsWith(`computer.`)&&!e.includes(`:`)){n[e]=!0;continue}if(!e.includes(`:`)&&i.has(e)){r[e]=!0;continue}let t=e.indexOf(`:{`),o=t>=0?t:e.indexOf(`:`);a.push({key:e,name:o>=0?e.slice(0,o):e,input:o>=0?e.slice(o+1):``})}this.computerGrants=n,this.toolGrants=r,this.grants=a},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"./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-DYdlpuiT.js";import{t as p}from"./checkbox-CeoqKfX8.js";import{t as m}from"./divider-BNWJAaA2.js";import"./constants-C45zS9hd.js";import{E as h,Ei as g,Fi as _,Gt as v,ai as y,ci as b,fr as x,ni as S,ri as C,xi as w}from"./index-DqO3RKoH.js";import{t as T}from"./Status-BOIkP48G.js";var E=d({name:`ApplicationConfirm`,components:{ElDialog:g,ElDivider:m,ElCheckbox:p,ElButton:_},props:{visible:{type:Boolean,required:!1,default:!1}},emits:[`update:visible`,`apply`],data(){return{checked:!0}},watch:{},methods:{getBaseUrlPlatform:b,onApply(){if(!this.checked){w.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=h(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===y.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=v(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 x.create({type:C.USAGE,scope:S.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`):w.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`;w({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=h(F,[[`render`,L],[`__scopeId`,`data-v-334ded1d`]]);export{R as default};
|