@acedatacloud/nexior 3.329.2 → 3.329.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ApiCodeButton-DpyJUC7o.js → ApiCodeButton-DYEAsDAB.js} +1 -1
- package/dist/assets/{Artifacts-DT3wCVBL.js → Artifacts-1J9EJpje.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-BfBsfiHC.js → AskUserQuestionCard-IhmU5xz7.js} +1 -1
- package/dist/assets/{AudioPreview-D6-IjBIh.js → AudioPreview-CfaWG6HL.js} +1 -1
- package/dist/assets/{Auth-B-Wgb8zT.js → Auth-B_ur3sCP.js} +1 -1
- package/dist/assets/{Bare-DREZRrOE.js → Bare-BA5ErudK.js} +1 -1
- package/dist/assets/{BotPlaceholder-BWTcdFIK.js → BotPlaceholder-CshzKiK2.js} +1 -1
- package/dist/assets/{BottomFooter-B5Q49OPu.js → BottomFooter-C2Xb1WTE.js} +1 -1
- package/dist/assets/{Callback-CRuzCrWd.js → Callback-CaRTM-OF.js} +1 -1
- package/dist/assets/{CodeSnippet-CunyGGML.js → CodeSnippet-B9suHgwr.js} +1 -1
- package/dist/assets/{Console-CLWD49fm.js → Console-DQgfiOol.js} +1 -1
- package/dist/assets/{Consumption-Mwj5RjX7.js → Consumption-OOugR-e4.js} +1 -1
- package/dist/assets/{Conversation-15TOVcDO.js → Conversation-Cqi_-YMc.js} +1 -1
- package/dist/assets/{Conversation-BTD_VA4M.js → Conversation-VUNsXAUO.js} +1 -1
- package/dist/assets/{CopyToClipboard-Bk1nRi-n.js → CopyToClipboard-B6HsusZG.js} +1 -1
- package/dist/assets/{Detail-2jbPql9F.js → Detail-CYoa8NYt.js} +2 -2
- package/dist/assets/{Extra-ChGnrFK9.js → Extra-CROqN5s-.js} +1 -1
- package/dist/assets/{FilePreview-CMTQuorI.js → FilePreview-C9dXaih4.js} +1 -1
- package/dist/assets/{Hailuo-Bb7VQwkv.js → Hailuo-Cf1PqMau.js} +1 -1
- package/dist/assets/{History-CXxCG7T4.js → History-Br9sYjwh.js} +1 -1
- package/dist/assets/{ImagePreview-CbaJ2SD9.js → ImagePreview-BFEnePFT.js} +1 -1
- package/dist/assets/{ImageWrapper-BQLEPXVj.js → ImageWrapper-Ddv3p9BH.js} +1 -1
- package/dist/assets/{Index-CALRyNnV.js → Index-B1GYdIv1.js} +1 -1
- package/dist/assets/{Index-CbesAGvB2.js → Index-B8DGbScD2.js} +1 -1
- package/dist/assets/{Index-CyVpxnVY.js → Index-BVrH8QYq.js} +1 -1
- package/dist/assets/{Index-CsIImPgC.js → Index-BfowYe8_.js} +1 -1
- package/dist/assets/{Index-9flP5h1j.js → Index-C-BOyDyw.js} +1 -1
- package/dist/assets/{Index-Bkv_PNoc.js → Index-C2VokLq-.js} +1 -1
- package/dist/assets/{Index-1qEXXP6g2.js → Index-C2jzwJ1n2.js} +1 -1
- package/dist/assets/{Index-DSP9EXdI.js → Index-CAuxXWIs.js} +1 -1
- package/dist/assets/{Index-BQt1cW1A.js → Index-CAxkPAlE.js} +1 -1
- package/dist/assets/{Index-BofWbs6Y2.js → Index-CEyU3DCj2.js} +1 -1
- package/dist/assets/{Index-DzlfgIbr.js → Index-CFk-Pnnx.js} +1 -1
- package/dist/assets/{Index-Di4lMl8s.js → Index-CW5xVs3S.js} +1 -1
- package/dist/assets/{Index-IhSDg1Gu2.js → Index-Cfn9jrCC2.js} +1 -1
- package/dist/assets/{Index-CgdIQ0Kh.js → Index-Cj0vNEoh.js} +1 -1
- package/dist/assets/{Index-Bu2sN3Ap.js → Index-CjnFXlcf.js} +1 -1
- package/dist/assets/{Index-CxSe_3IY.js → Index-CmFT-g6s.js} +1 -1
- package/dist/assets/{Index-Db1I-_sC.js → Index-CrS2dHDB.js} +1 -1
- package/dist/assets/{Index-3R_wKBp4.js → Index-CtF7oC1A.js} +1 -1
- package/dist/assets/{Index-CzclUObJ2.js → Index-DALysv5Q2.js} +1 -1
- package/dist/assets/{Index-Byb2v5z2.js → Index-DDwEXRY5.js} +1 -1
- package/dist/assets/{Index-DPDedaCl2.js → Index-DELfoPST2.js} +1 -1
- package/dist/assets/{Index-D7PnJ80S2.js → Index-D_MhsqRZ2.js} +1 -1
- package/dist/assets/{Index-BXXGLJrg.js → Index-DeoaxFNt.js} +1 -1
- package/dist/assets/{Index-DMj_04zq.js → Index-DkQoFYPY.js} +1 -1
- package/dist/assets/{Index-CaCCM6EW.js → Index-Dkm2dpsx.js} +1 -1
- package/dist/assets/{Index-O9lnW9H8.js → Index-FEeM0Vh4.js} +1 -1
- package/dist/assets/{Index-DZ6JZkAY.js → Index-K7MIOQcH.js} +1 -1
- package/dist/assets/{Index-n8CrivCG.js → Index-KIFO9Ncn.js} +1 -1
- package/dist/assets/{Index-Ccc9ea1S.js → Index-LgNlMecI.js} +1 -1
- package/dist/assets/{Index-CvvAULqH.js → Index-ZDpyNLhi.js} +1 -1
- package/dist/assets/{Invitees-BW3erziF.js → Invitees-DC1B14Hg.js} +1 -1
- package/dist/assets/{List-CwhgRNLS.js → List-B7ZsLYho.js} +1 -1
- package/dist/assets/{List-DViUqd9y.js → List-C3eielzk.js} +1 -1
- package/dist/assets/{List-BXbcCN-f.js → List-C8u3cFOE.js} +1 -1
- package/dist/assets/{LocalTools-D_wbqvvS.js → LocalTools-hx8nGfre.js} +1 -1
- package/dist/assets/{LocalTools-DwuhLEJv.js → LocalTools-jyNjH-zv.js} +1 -1
- package/dist/assets/{Logo-HhJ0MW7v.js → Logo-Da04kY9l.js} +1 -1
- package/dist/assets/{Main-CVBJB8TA.js → Main-DzYGCPS7.js} +1 -1
- package/dist/assets/{Message-DyLP9tkw.js → Message-D30dTHrl.js} +1 -1
- package/dist/assets/{Model-FCXV8UZG.js → Model-DMzeksc5.js} +1 -1
- package/dist/assets/Navigator-BwmJzSDQ.css +1 -0
- package/dist/assets/Navigator-C8W-E8HW.js +8 -0
- package/dist/assets/{NoTasks-BwTq2H9w.js → NoTasks-CkWyHQ7m.js} +1 -1
- package/dist/assets/{NotFound-BFZuoU2i.js → NotFound-BLuhP6fJ.js} +1 -1
- package/dist/assets/{Pay-BBBATHah.js → Pay-DeBqiala.js} +1 -1
- package/dist/assets/{Player-BYSf72YA.js → Player-DVIMTHm3.js} +1 -1
- package/dist/assets/{PromptTextarea-D7Fwzr_Y.js → PromptTextarea-CWjobThE.js} +1 -1
- package/dist/assets/{RealtimeCall-CajilFCh.js → RealtimeCall-yEje5bgS.js} +1 -1
- package/dist/assets/{ScheduledTasks-sqSeTZU9.js → ScheduledTasks-DCtvvHer.js} +1 -1
- package/dist/assets/{Status-BOy_2Cie.js → Status-BJGtNUh3.js} +1 -1
- package/dist/assets/{Subscribe-B_DB9lwi.js → Subscribe-C_HAS05G.js} +1 -1
- package/dist/assets/{TabSwitcher-CnRyc2my.js → TabSwitcher-D6o_Vhoz.js} +1 -1
- package/dist/assets/{Tts-DaYM4Mqs.js → Tts-Cwppv-dV.js} +1 -1
- package/dist/assets/{VideoPlayer-FouX7LHv.js → VideoPlayer-BghNES0-.js} +1 -1
- package/dist/assets/{alert-_xJIX9qr.js → alert-r5eyCYMk.js} +1 -1
- package/dist/assets/{basic-C2HYPtLG.js → basic-B4tcqGdl.js} +1 -1
- package/dist/assets/{chat-CfQknnqH.js → chat-iYE0So9O.js} +1 -1
- package/dist/assets/{codingBridge-bwOPU8tL.js → codingBridge-Cpi_T_0H.js} +1 -1
- package/dist/assets/{codingBridgeNotify-DO0hOI9C.js → codingBridgeNotify-6SfVVXUj.js} +2 -2
- package/dist/assets/{collapse-C3lFxKRG.js → collapse-DM4CFqEB.js} +1 -1
- package/dist/assets/{common-BPLiRCoF.js → common-7Q5o6gM-.js} +1 -1
- package/dist/assets/{common-D2tuBQCN.js → common-B-ohYxCX.js} +1 -1
- package/dist/assets/{common-DMhCLoSb.js → common-B1FHfW9v.js} +1 -1
- package/dist/assets/{common-oPoLs4in.js → common-Bd72w7MH.js} +1 -1
- package/dist/assets/{common-DIlsYjfU.js → common-C5ZmmHrA.js} +1 -1
- package/dist/assets/{common-Bi-9QQmh.js → common-Cf9CFOaz.js} +1 -1
- package/dist/assets/{common-4eWst1C6.js → common-CleVQgOe.js} +1 -1
- package/dist/assets/{common-iT6JmqME.js → common-CooYdLX1.js} +1 -1
- package/dist/assets/{common-CueiUtkx.js → common-Cs7AuUVP.js} +1 -1
- package/dist/assets/common-CtP4rahV.js +1 -0
- package/dist/assets/{common-Bk1l4VlZ.js → common-DEQEJoSQ.js} +1 -1
- package/dist/assets/{common-LP3eXUPq.js → common-DGTJNjb0.js} +1 -1
- package/dist/assets/{common-CrRsEu05.js → common-DGm_Ys8S.js} +1 -1
- package/dist/assets/{common-BeHbm3PH.js → common-Dgxvbj6q.js} +1 -1
- package/dist/assets/{common-BsKVFQp3.js → common-Din9qyzk.js} +1 -1
- package/dist/assets/{common-CHTz8m3E.js → common-DlQq8PNu.js} +1 -1
- package/dist/assets/{common-C8zseZhj.js → common-DuhIgjlk.js} +1 -1
- package/dist/assets/{common-ZUHlETmx.js → common-ZewnhqmB.js} +1 -1
- package/dist/assets/{constants-BYU0Mi8o.js → constants-D8dwgBQJ.js} +1 -1
- package/dist/assets/{createTaskActions-BC5j7kXt.js → createTaskActions-CzI1YE1u.js} +1 -1
- package/dist/assets/{date-picker-BL8VEdss.js → date-picker-CCW3QD58.js} +1 -1
- package/dist/assets/{digitalhuman-B850Z8JR.js → digitalhuman-Cog3Uxc3.js} +1 -1
- package/dist/assets/{drawer-DPh8Fl2E.js → drawer-nKUsNUqU.js} +1 -1
- package/dist/assets/{dropdown-BBqH0BFX.js → dropdown-CE3OnWHD.js} +1 -1
- package/dist/assets/{dropdown-BYgx8f2W.js → dropdown-DtxdOj7U.js} +1 -1
- package/dist/assets/{esm-fFUkarvh.js → esm-5UYqGz4K.js} +3 -3
- package/dist/assets/{esm-ZQptvXr4.js → esm-B8J6K146.js} +2 -2
- package/dist/assets/{esm-BgHbHgg8.js → esm-BFkaaWQL.js} +1 -1
- package/dist/assets/{esm-CMMJ2Gtl.js → esm-CeDDQAvK.js} +1 -1
- package/dist/assets/{esm-BZog_s2-.js → esm-CftRDIGa.js} +1 -1
- package/dist/assets/esm-D4-PA1wl.js +1 -0
- package/dist/assets/{esm-bTzyoOYV.js → esm-olbJxGuc.js} +2 -2
- package/dist/assets/{fish-wcvY8Yhh.js → fish-B0HCuEta.js} +1 -1
- package/dist/assets/{flux-DcsN3CAR.js → flux-CC2ReYJZ.js} +1 -1
- package/dist/assets/{grokvideo-Ckhxu_ye.js → grokvideo-BORaOUPh.js} +1 -1
- package/dist/assets/{hailuo-CUlnVVrg.js → hailuo-62EUGC6_.js} +1 -1
- package/dist/assets/{headshots-CNl98iOn.js → headshots-DQTDV6wL.js} +1 -1
- package/dist/assets/{i18n-CczuUNCK.js → i18n-BSdsVp0O.js} +1 -1
- package/dist/assets/{image-BjapOX8j.js → image-DaPFm5t3.js} +1 -1
- package/dist/assets/{index-s1lrp6nN.js → index-BrXcZpB0.js} +4 -4
- package/dist/assets/{index.browser.esm-B8hNRw1I.js → index.browser.esm-ht6Mtr3d.js} +1 -1
- package/dist/assets/{index.es-BtwnN9TZ.js → index.es-Cd6zh83v.js} +1 -1
- package/dist/assets/{input-number-B8yYDeUw.js → input-number-BmoiWw1O.js} +1 -1
- package/dist/assets/{kling-YaEqW24j.js → kling-CL0ENiY0.js} +1 -1
- package/dist/assets/{luma-B6swXiir.js → luma-DhXr4qaQ.js} +1 -1
- package/dist/assets/{maestro-DuAZI6qA.js → maestro-BYaN2I-_.js} +1 -1
- package/dist/assets/{maestro-BSA31vV2.js → maestro-DGSCGfJU.js} +1 -1
- package/dist/assets/{midjourney-Bun_rIWX.js → midjourney-0q7WYWKq.js} +1 -1
- package/dist/assets/{mobileLocalExec-DXKg5x1k.js → mobileLocalExec-BBXq2Mlq.js} +2 -2
- package/dist/assets/{nanobanana-1aJuNjuV.js → nanobanana-DfnHdYel.js} +1 -1
- package/dist/assets/{omni-pDIQ9Abh.js → omni-B1-GXSEt.js} +1 -1
- package/dist/assets/{openaiimage-BViQ9P0Z.js → openaiimage-C-4khEqI.js} +1 -1
- package/dist/assets/{pagination-q6_CA9Ta.js → pagination-B5FgucN9.js} +1 -1
- package/dist/assets/{pagination-BCc6JgI2.js → pagination-CJ-K0_n9.js} +1 -1
- package/dist/assets/{pika-BuUZEsCD.js → pika-BI9TROfU.js} +1 -1
- package/dist/assets/{pixverse-AJl_otVM.js → pixverse-CJ1qoHz1.js} +1 -1
- package/dist/assets/{popover-CQqNDogj.js → popover-DqyI0a54.js} +1 -1
- package/dist/assets/{producer-Dghy2j1o.js → producer-CLiHn7s2.js} +1 -1
- package/dist/assets/{qrart-zdV5UKk_.js → qrart-DAY7F-vK.js} +1 -1
- package/dist/assets/{realtime-2WByq0Uw.js → realtime-DHnYvIAZ.js} +1 -1
- package/dist/assets/{row-C_5ub9kH.js → row-BN4KFxVt.js} +1 -1
- package/dist/assets/{seedance-B62zKgZ0.js → seedance-BOUABcS1.js} +1 -1
- package/dist/assets/{seedream-6x0K87O3.js → seedream-DU6l_6kz.js} +1 -1
- package/dist/assets/{select-B-w4TTjR.js → select-D2kXNiIn.js} +1 -1
- package/dist/assets/{serp-BCz-oRoZ.js → serp-Ca2m5l4-.js} +1 -1
- package/dist/assets/{slider-Di9hdrCO.js → slider-4GcnH9S-.js} +1 -1
- package/dist/assets/{solana-wallets-C0YMX0g4.js → solana-wallets-Dwm69-NK.js} +2 -2
- package/dist/assets/{solana-wallets-vue-kJgRlNLC.js → solana-wallets-vue-xLXrngdf.js} +1 -1
- package/dist/assets/{sora-BrXEK2Gj.js → sora-D9i3p3Sj.js} +1 -1
- package/dist/assets/{suno-BTnmcB86.js → suno-D5dK8c0h.js} +1 -1
- package/dist/assets/{switch-FLE178ww.js → switch-Bk4IAKzq.js} +1 -1
- package/dist/assets/{table-Db9R06on.js → table-GkjhOaoE.js} +1 -1
- package/dist/assets/{tabs-CKJWx47c.js → tabs-DBYVHf_-.js} +1 -1
- package/dist/assets/{time-picker-Cw98mYlw.js → time-picker-M05wUVUl.js} +1 -1
- package/dist/assets/{tooltip-DAEtFoXl.js → tooltip-Bs8w_vsQ.js} +1 -1
- package/dist/assets/{upload-B6JNld1O.js → upload-CybC7d-7.js} +1 -1
- package/dist/assets/{veo-CKw5P1Qs.js → veo-iYlxkOPW.js} +1 -1
- package/dist/assets/{wan-B-arNjuC.js → wan-CXgib97M.js} +1 -1
- package/dist/assets/{web-rxpnQ8Rk.js → web-Baq1uXuL.js} +1 -1
- package/dist/assets/{web-BqqNjbPq.js → web-BsQW3qcn.js} +1 -1
- package/dist/assets/{web-CXMCfO-f.js → web-Cs2t72Ej.js} +1 -1
- package/dist/assets/{web-CLCqhn5u.js → web-JxZEpV2P.js} +1 -1
- package/dist/assets/{web-DHbVHDDZ.js → web-j71rnUTQ.js} +1 -1
- package/dist/assets/{webextrator-BhS9H8hF.js → webextrator-DcfhTP97.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/dist/assets/Navigator-CDnWLupN.css +0 -1
- package/dist/assets/Navigator-boGtYPk_.js +0 -8
- package/dist/assets/common-DoX6Rkj9.js +0 -1
- package/dist/assets/esm-BfOQELBi.js +0 -1
|
@@ -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 ee,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{n as m,t as h}from"./table-Db9R06on.js";import{t as g}from"./card-D-4S-l7a.js";import{n as _,t as v}from"./row-C_5ub9kH.js";import{t as y}from"./empty-xCRn_5sX.js";import{t as b}from"./pagination-BCc6JgI2.js";import{t as x}from"./skeleton-CoheJz5x.js";import{t as S}from"./switch-FLE178ww.js";import{An as C,G as w,Mi as T,Ti as E,Tr as D,Ui as O,Vi as k,ci as A,gi as j,hi as M,it as N,li as P,ut as F}from"./index-s1lrp6nN.js";import{t as I}from"./index.es-BtwnN9TZ.js";import{t as L}from"./CopyToClipboard-Bk1nRi-n.js";var R=p({name:`ConsoleApplicationList`,components:{Pagination:b,CopyToClipboard:L,ElTable:h,ElRow:v,ElButton:O,ElCol:_,ElTag:k,ElSkeleton:x,ElSwitch:S,ElEmpty:y,ElTableColumn:m,ElCard:g,FontAwesomeIcon:I},data(){return{credentialType:A,serviceType:P,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!C(this.$store.getters.site)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{rowCanPay(e){return C(this.$store.getters.site)?!1:E()?(e?.packages||[]).some(e=>e?.metadata?.apple_product_id):!0},updateAllowConsumeGlobal(e,t){!e||!e.id||D.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{T.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{T.error(this.$t(`application.message.updateFailed`).toString())})},onGoUsage(e){this.$router.push({name:F,query:{application_id:e.id,type:e?.service?.type}})},onBuyMore(e){e?.id&&this.$router.push({name:N,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=M.INDIVIDUAL){return new Promise((t,n)=>{D.getAll({limit:this.limit,...e===M.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:j.USAGE,scope:e}).then(({data:n})=>{e===M.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{T.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(M.INDIVIDUAL),this.onFetchApplications(M.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){D.create({type:j.USAGE,scope:M.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(M.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}`}}}),z={class:`title`},B={key:1,class:`summary-card`},V={class:`icon-wrapper`},H={class:`label`},U={class:`value`},W={class:`description`},G={key:1,class:`flex flex-row justify-between items-center gap-3`},K={class:`summary-card min-w-0 flex-1`},te={class:`flex justify-start items-center gap-2 mb-2 w-full`},q={class:`icon-wrapper !mb-0`},J={class:`text-[var(--el-text-color-regular)] text-[14px] truncate`},Y={class:`label`},X={class:`value`},Z={class:`description`},Q={class:`flex flex-col items-end gap-2 shrink-0`},ne={class:`copy`},re={key:0,class:`expired-at`},ie={class:`flex flex-wrap items-center justify-end gap-1`},ae={class:`application-cards block sm:hidden`},oe={class:`flex items-center gap-2 flex-wrap`},se={class:`application-card__name`},ce={class:`application-card__id`},le={class:`truncate`},ue={class:`application-card__row`},de={class:`label`},fe={class:`value`},pe={key:0,class:`application-card__row`},$={class:`label`},me={class:`value`},he={key:1,class:`application-card__row`},ge={class:`label`},_e={class:`flex items-center justify-end gap-2 mt-3`},ve={class:`pagination`};function ye(p,m,h,g,_,v){let y=s(`el-col`),b=s(`el-row`),x=s(`el-skeleton`),S=s(`font-awesome-icon`),C=s(`el-card`),w=s(`copy-to-clipboard`),T=s(`el-button`),E=s(`el-table-column`),D=s(`el-tag`),O=s(`el-switch`),k=s(`el-table`),A=s(`el-empty`),j=s(`pagination`),M=u(`loading`);return f(),c(b,{class:`application-list`},{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.allApplications`)),1)]),_:1})]),_:1}),r(b,{gutter:15,class:`mb-3`},{default:l(()=>[r(y,{md:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:l(()=>[p.loading?(f(),c(x,{key:0})):(f(),a(`div`,B,[e(`div`,V,[r(S,{icon:`fa-solid fa-cubes-stacked`})]),e(`p`,H,n(p.$t(`application.title.count`)),1),e(`p`,U,n(p.individualApplicationsTotal),1),e(`p`,W,n(p.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),p.showGlobalPayment&&p.globalApplications?.length>0?(f(),c(y,{key:0,md:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:l(()=>[p.loading?(f(),c(x,{key:0})):(f(),a(`div`,G,[e(`div`,K,[e(`div`,te,[e(`div`,q,[r(S,{icon:`fa-solid fa-wallet`})]),e(`span`,J,[t(n(p.$t(`application.field.id`))+`: `+n(p.globalApplications?.[0]?.id)+` `,1),p.globalApplications?.[0]?.id?(f(),c(w,{key:0,content:p.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),e(`p`,Y,n(p.$t(`application.title.globalBalance`)),1),e(`p`,X,n(p.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+n(p.$t(`service.unit.credits`)),1),e(`p`,Z,n(p.$t(`application.message.globalBalanceDescription`)),1)]),e(`div`,Q,[r(T,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:m[0]||=e=>p.onGoUsage(p.globalApplications?.[0])},{default:l(()=>[r(S,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1}),p.showGlobalPayment?(f(),c(T,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:m[1]||=e=>p.onBuyMore(p.globalApplications?.[0])},{default:l(()=>[r(S,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1})):i(``,!0)])]))]),_:1})]),_:1})):i(``,!0)]),_:1}),r(b,null,{default:l(()=>[r(y,{span:24},{default:l(()=>[r(C,{shadow:`hover`,class:`applications-table-card hidden sm:block`},{default:l(()=>[ee((f(),c(k,{data:p.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":p.$t(`common.message.noData`)},{default:l(()=>[r(E,{prop:`id`,label:p.$t(`application.field.id`),width:`200px`,"class-name":`text-center`},{default:l(t=>[e(`span`,null,n(t.row.id),1),e(`span`,ne,[r(w,{content:t?.row?.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(E,{label:p.$t(`application.field.type`),width:`90px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:l(e=>[e.row?.type===`Period`?(f(),c(D,{key:0,type:`success`,effect:`dark`,round:``},{default:l(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):e.row?.type===`Usage`?(f(),c(D,{key:1,effect:`dark`,round:``},{default:l(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(E,{label:p.$t(`application.field.name`),width:`180px`},{default:l(r=>[e(`span`,null,n(r.row?.service?.title),1),r.row?.role===`grantee`?(f(),c(D,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:l(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(E,{prop:`remaining_amount`,label:p.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:l(t=>[e(`span`,null,n(p.getRemainingAmount(t.row)),1)]),_:1},8,[`label`]),r(E,{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:l(t=>[e(`span`,null,n(p.getUsedAmount(t.row)),1)]),_:1},8,[`label`]),r(E,{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:l(e=>[e.row.service?.type===p.serviceType.API?(f(),c(O,{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(E,{label:p.$t(`application.field.expiredAt`),width:`180px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:l(e=>[e.row.expired_at?(f(),a(`span`,re,n(p.$dayjs.format(e.row.expired_at)),1)):i(``,!0)]),_:1},8,[`label`]),r(E,{fixed:`right`,width:`200px`},{default:l(a=>[e(`div`,ie,[r(T,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:e=>p.onGoUsage(a?.row)},{default:l(()=>[r(S,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(a?.row)?(f(),c(T,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(a?.row)},{default:l(()=>[r(S,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[M,p.loading]])]),_:1}),e(`div`,ae,[p.loading?(f(),c(x,{key:0,rows:4,animated:``})):(f(),a(o,{key:1},[p.individualApplications?.length?(f(!0),a(o,{key:1},d(p.individualApplications,o=>(f(),c(C,{key:o.id,shadow:`hover`,class:`application-card mb-2`,"body-style":{padding:`14px 16px`}},{default:l(()=>[e(`div`,oe,[e(`span`,se,n(o?.service?.title),1),o?.type===`Period`?(f(),c(D,{key:0,type:`success`,effect:`dark`,size:`small`,round:``},{default:l(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):o?.type===`Usage`?(f(),c(D,{key:1,effect:`dark`,size:`small`,round:``},{default:l(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0),o?.role===`grantee`?(f(),c(D,{key:2,type:`info`,size:`small`,round:``},{default:l(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),e(`div`,ce,[e(`span`,le,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`,ue,[e(`span`,de,n(p.$t(`application.field.remainingAmount`)),1),e(`span`,fe,n(p.getRemainingAmount(o)),1)]),o?.expired_at?(f(),a(`div`,pe,[e(`span`,$,n(p.$t(`application.field.expiredAt`)),1),e(`span`,me,n(p.$dayjs.format(o.expired_at)),1)])):i(``,!0),o.service?.type===p.serviceType.API?(f(),a(`div`,he,[e(`span`,ge,n(p.$t(`application.field.allowConsumeGlobal`)),1),r(O,{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`,_e,[r(T,{class:`!m-0 !px-3`,size:`small`,round:``,onClick:e=>p.onGoUsage(o)},{default:l(()=>[r(S,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(o)?(f(),c(T,{key:0,class:`!m-0 !px-3`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(o)},{default:l(()=>[r(S,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:2},1024))),128)):(f(),c(A,{key:0,description:p.$t(`common.message.noData`)},null,8,[`description`]))],64))])]),_:1})]),_:1}),r(b,null,{default:l(()=>[r(y,{span:24},{default:l(()=>[e(`div`,ve,[r(j,{"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 be=w(R,[[`render`,ye],[`__scopeId`,`data-v-29e1e6d7`]]);export{be 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 ee,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{n as m,t as h}from"./table-GkjhOaoE.js";import{t as g}from"./card-D-4S-l7a.js";import{n as _,t as v}from"./row-BN4KFxVt.js";import{t as y}from"./empty-xCRn_5sX.js";import{t as b}from"./pagination-CJ-K0_n9.js";import{t as x}from"./skeleton-CoheJz5x.js";import{t as S}from"./switch-Bk4IAKzq.js";import{An as C,G as w,Mi as T,Ti as E,Tr as D,Ui as O,Vi as k,ci as A,gi as j,hi as M,it as N,li as P,ut as F}from"./index-BrXcZpB0.js";import{t as I}from"./index.es-Cd6zh83v.js";import{t as L}from"./CopyToClipboard-B6HsusZG.js";var R=p({name:`ConsoleApplicationList`,components:{Pagination:b,CopyToClipboard:L,ElTable:h,ElRow:v,ElButton:O,ElCol:_,ElTag:k,ElSkeleton:x,ElSwitch:S,ElEmpty:y,ElTableColumn:m,ElCard:g,FontAwesomeIcon:I},data(){return{credentialType:A,serviceType:P,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!C(this.$store.getters.site)}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{rowCanPay(e){return C(this.$store.getters.site)?!1:E()?(e?.packages||[]).some(e=>e?.metadata?.apple_product_id):!0},updateAllowConsumeGlobal(e,t){!e||!e.id||D.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{T.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{T.error(this.$t(`application.message.updateFailed`).toString())})},onGoUsage(e){this.$router.push({name:F,query:{application_id:e.id,type:e?.service?.type}})},onBuyMore(e){e?.id&&this.$router.push({name:N,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=M.INDIVIDUAL){return new Promise((t,n)=>{D.getAll({limit:this.limit,...e===M.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:j.USAGE,scope:e}).then(({data:n})=>{e===M.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{T.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(M.INDIVIDUAL),this.onFetchApplications(M.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){D.create({type:j.USAGE,scope:M.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(M.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}`}}}),z={class:`title`},B={key:1,class:`summary-card`},V={class:`icon-wrapper`},H={class:`label`},U={class:`value`},W={class:`description`},G={key:1,class:`flex flex-row justify-between items-center gap-3`},K={class:`summary-card min-w-0 flex-1`},te={class:`flex justify-start items-center gap-2 mb-2 w-full`},q={class:`icon-wrapper !mb-0`},J={class:`text-[var(--el-text-color-regular)] text-[14px] truncate`},Y={class:`label`},X={class:`value`},Z={class:`description`},Q={class:`flex flex-col items-end gap-2 shrink-0`},ne={class:`copy`},re={key:0,class:`expired-at`},ie={class:`flex flex-wrap items-center justify-end gap-1`},ae={class:`application-cards block sm:hidden`},oe={class:`flex items-center gap-2 flex-wrap`},se={class:`application-card__name`},ce={class:`application-card__id`},le={class:`truncate`},ue={class:`application-card__row`},de={class:`label`},fe={class:`value`},pe={key:0,class:`application-card__row`},$={class:`label`},me={class:`value`},he={key:1,class:`application-card__row`},ge={class:`label`},_e={class:`flex items-center justify-end gap-2 mt-3`},ve={class:`pagination`};function ye(p,m,h,g,_,v){let y=s(`el-col`),b=s(`el-row`),x=s(`el-skeleton`),S=s(`font-awesome-icon`),C=s(`el-card`),w=s(`copy-to-clipboard`),T=s(`el-button`),E=s(`el-table-column`),D=s(`el-tag`),O=s(`el-switch`),k=s(`el-table`),A=s(`el-empty`),j=s(`pagination`),M=u(`loading`);return f(),c(b,{class:`application-list`},{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.allApplications`)),1)]),_:1})]),_:1}),r(b,{gutter:15,class:`mb-3`},{default:l(()=>[r(y,{md:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:l(()=>[p.loading?(f(),c(x,{key:0})):(f(),a(`div`,B,[e(`div`,V,[r(S,{icon:`fa-solid fa-cubes-stacked`})]),e(`p`,H,n(p.$t(`application.title.count`)),1),e(`p`,U,n(p.individualApplicationsTotal),1),e(`p`,W,n(p.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),p.showGlobalPayment&&p.globalApplications?.length>0?(f(),c(y,{key:0,md:12,xs:24},{default:l(()=>[r(C,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:l(()=>[p.loading?(f(),c(x,{key:0})):(f(),a(`div`,G,[e(`div`,K,[e(`div`,te,[e(`div`,q,[r(S,{icon:`fa-solid fa-wallet`})]),e(`span`,J,[t(n(p.$t(`application.field.id`))+`: `+n(p.globalApplications?.[0]?.id)+` `,1),p.globalApplications?.[0]?.id?(f(),c(w,{key:0,content:p.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),e(`p`,Y,n(p.$t(`application.title.globalBalance`)),1),e(`p`,X,n(p.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+n(p.$t(`service.unit.credits`)),1),e(`p`,Z,n(p.$t(`application.message.globalBalanceDescription`)),1)]),e(`div`,Q,[r(T,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:m[0]||=e=>p.onGoUsage(p.globalApplications?.[0])},{default:l(()=>[r(S,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1}),p.showGlobalPayment?(f(),c(T,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:m[1]||=e=>p.onBuyMore(p.globalApplications?.[0])},{default:l(()=>[r(S,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1})):i(``,!0)])]))]),_:1})]),_:1})):i(``,!0)]),_:1}),r(b,null,{default:l(()=>[r(y,{span:24},{default:l(()=>[r(C,{shadow:`hover`,class:`applications-table-card hidden sm:block`},{default:l(()=>[ee((f(),c(k,{data:p.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":p.$t(`common.message.noData`)},{default:l(()=>[r(E,{prop:`id`,label:p.$t(`application.field.id`),width:`200px`,"class-name":`text-center`},{default:l(t=>[e(`span`,null,n(t.row.id),1),e(`span`,ne,[r(w,{content:t?.row?.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(E,{label:p.$t(`application.field.type`),width:`90px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:l(e=>[e.row?.type===`Period`?(f(),c(D,{key:0,type:`success`,effect:`dark`,round:``},{default:l(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):e.row?.type===`Usage`?(f(),c(D,{key:1,effect:`dark`,round:``},{default:l(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(E,{label:p.$t(`application.field.name`),width:`180px`},{default:l(r=>[e(`span`,null,n(r.row?.service?.title),1),r.row?.role===`grantee`?(f(),c(D,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:l(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(E,{prop:`remaining_amount`,label:p.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:l(t=>[e(`span`,null,n(p.getRemainingAmount(t.row)),1)]),_:1},8,[`label`]),r(E,{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:l(t=>[e(`span`,null,n(p.getUsedAmount(t.row)),1)]),_:1},8,[`label`]),r(E,{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:l(e=>[e.row.service?.type===p.serviceType.API?(f(),c(O,{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(E,{label:p.$t(`application.field.expiredAt`),width:`180px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:l(e=>[e.row.expired_at?(f(),a(`span`,re,n(p.$dayjs.format(e.row.expired_at)),1)):i(``,!0)]),_:1},8,[`label`]),r(E,{fixed:`right`,width:`200px`},{default:l(a=>[e(`div`,ie,[r(T,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:e=>p.onGoUsage(a?.row)},{default:l(()=>[r(S,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(a?.row)?(f(),c(T,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(a?.row)},{default:l(()=>[r(S,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[M,p.loading]])]),_:1}),e(`div`,ae,[p.loading?(f(),c(x,{key:0,rows:4,animated:``})):(f(),a(o,{key:1},[p.individualApplications?.length?(f(!0),a(o,{key:1},d(p.individualApplications,o=>(f(),c(C,{key:o.id,shadow:`hover`,class:`application-card mb-2`,"body-style":{padding:`14px 16px`}},{default:l(()=>[e(`div`,oe,[e(`span`,se,n(o?.service?.title),1),o?.type===`Period`?(f(),c(D,{key:0,type:`success`,effect:`dark`,size:`small`,round:``},{default:l(()=>[t(n(p.$t(`application.type.period`)),1)]),_:1})):o?.type===`Usage`?(f(),c(D,{key:1,effect:`dark`,size:`small`,round:``},{default:l(()=>[t(n(p.$t(`application.type.usage`)),1)]),_:1})):i(``,!0),o?.role===`grantee`?(f(),c(D,{key:2,type:`info`,size:`small`,round:``},{default:l(()=>[t(n(p.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),e(`div`,ce,[e(`span`,le,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`,ue,[e(`span`,de,n(p.$t(`application.field.remainingAmount`)),1),e(`span`,fe,n(p.getRemainingAmount(o)),1)]),o?.expired_at?(f(),a(`div`,pe,[e(`span`,$,n(p.$t(`application.field.expiredAt`)),1),e(`span`,me,n(p.$dayjs.format(o.expired_at)),1)])):i(``,!0),o.service?.type===p.serviceType.API?(f(),a(`div`,he,[e(`span`,ge,n(p.$t(`application.field.allowConsumeGlobal`)),1),r(O,{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`,_e,[r(T,{class:`!m-0 !px-3`,size:`small`,round:``,onClick:e=>p.onGoUsage(o)},{default:l(()=>[r(S,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),p.rowCanPay(o)?(f(),c(T,{key:0,class:`!m-0 !px-3`,type:`primary`,round:``,size:`small`,onClick:e=>p.onBuyMore(o)},{default:l(()=>[r(S,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),t(` `+n(p.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:2},1024))),128)):(f(),c(A,{key:0,description:p.$t(`common.message.noData`)},null,8,[`description`]))],64))])]),_:1})]),_:1}),r(b,null,{default:l(()=>[r(y,{span:24},{default:l(()=>[e(`div`,ve,[r(j,{"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 be=w(R,[[`render`,ye],[`__scopeId`,`data-v-29e1e6d7`]]);export{be 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-w4TTjR.js";import{n as g,t as _}from"./table-Db9R06on.js";import{t as v}from"./card-D-4S-l7a.js";import{t as y}from"./date-picker-BL8VEdss.js";import{n as b,t as x}from"./row-C_5ub9kH.js";import{t as S}from"./pagination-BCc6JgI2.js";import{t as C}from"./skeleton-CoheJz5x.js";import{G as w,Ui as T,Vi as E,hr as D,ln as O,ui as k}from"./index-s1lrp6nN.js";import{t as A}from"./index.es-BtwnN9TZ.js";import{t as j}from"./CopyToClipboard-Bk1nRi-n.js";var M={total_count:0,total_spent:0,state_counts:{}},N=p({name:`ConsoleOrderList`,components:{Pagination:S,CopyToClipboard:j,ElRow:x,ElCol:b,ElTable:_,ElTableColumn:g,ElButton:T,ElTag:E,ElCard:v,ElSelect:m,ElOption:h,ElDatePicker:y,ElSkeleton:C,FontAwesomeIcon:A},data(){return{OrderState:k,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:{...M},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:k.PENDING,label:this.$t(`order.state.pending`)},{value:k.FINISHED,label:this.$t(`order.state.finished`)},{value:k.PAID,label:this.$t(`order.state.paid`)},{value:k.EXPIRED,label:this.$t(`order.state.expired`)},{value:k.FAILED,label:this.$t(`order.state.failed`)},{value:k.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:`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:O,stateTagType(e){return e===k.FINISHED||e===k.PAID?`success`:e===k.EXPIRED||e===k.FAILED?`danger`:e===k.REFUNDED?`warning`:`info`},stateLabel(e){return{[k.PENDING]:this.$t(`order.state.pending`),[k.PAID]:this.$t(`order.state.paid`),[k.FINISHED]:this.$t(`order.state.finished`),[k.EXPIRED]:this.$t(`order.state.expired`),[k.FAILED]:this.$t(`order.state.failed`),[k.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==k.PAID&&e!==k.FINISHED&&e!==k.EXPIRED&&e!==k.FAILED&&e!==k.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,D.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,D.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...M}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,D.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})}}}),P={class:`title`},F={key:1,class:`card-content`},I={class:`icon-wrapper`},L={class:`description`},R={class:`value`},z={key:1,class:`card-content`},B={class:`icon-wrapper`},V={class:`description`},H={class:`value`},U={key:1,class:`card-content`},W={class:`icon-wrapper`},ee={class:`description`},G={class:`value`},K={key:1,class:`card-content`},q={class:`icon-wrapper`},J={class:`description`},Y={class:`value`},X={class:`filter-row mb-3`},Z={class:`key`},Q={class:`cursor-pointer`},$={class:`price`},te={class:`description`},ne={class:`text-gray-500`},re={class:`created-at`},ie={class:`flex items-center justify-center flex-wrap`},ae={class:`float-right`};function oe(p,m,h,g,_,v){let y=o(`el-col`),b=o(`el-row`),x=o(`el-skeleton`),S=o(`font-awesome-icon`),C=o(`el-card`),w=o(`el-option`),T=o(`el-select`),E=o(`el-date-picker`),D=o(`el-button`),O=o(`copy-to-clipboard`),k=o(`el-table-column`),A=o(`el-tag`),j=o(`el-table`),M=o(`pagination`),N=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`,P,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`,F,[e(`div`,I,[r(S,{icon:`fa-solid fa-receipt`,class:`icon`})]),e(`p`,L,n(p.$t(`order.title.totalOrders`)),1),e(`p`,R,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`,z,[e(`div`,B,[r(S,{icon:`fa-solid fa-dollar-sign`,class:`icon`})]),e(`p`,V,n(p.$t(`order.title.totalSpent`)),1),e(`p`,H,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`,U,[e(`div`,W,[r(S,{icon:`fa-solid fa-check-circle`,class:`icon`})]),e(`p`,ee,n(p.$t(`order.title.finishedOrders`)),1),e(`p`,G,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`,K,[e(`div`,q,[r(S,{icon:`fa-solid fa-clock`,class:`icon`})]),e(`p`,J,n(p.$t(`order.title.pendingOrders`)),1),e(`p`,Y,n(p.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),e(`div`,X,[r(T,{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(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(T,{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(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(E,{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(D,{type:`primary`,plain:``,loading:p.exporting,onClick:p.onExport},{default:l(()=>[r(S,{icon:`fa-solid fa-file-export`,class:`mr-1`}),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(j,{data:p.orders,stripe:``,"empty-text":p.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:l(()=>[r(k,{prop:`id`,label:p.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:l(t=>[e(`span`,Z,n(t.row.id),1),e(`span`,Q,[r(O,{content:t.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(k,{label:p.$t(`order.field.price`),width:`110px`,align:`center`},{default:l(t=>[e(`span`,$,n(p.getPriceString({value:t.row?.price})),1)]),_:1},8,[`label`]),r(k,{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`,te,n(t.row.description),1)]),_:1},8,[`label`]),r(k,{prop:`state`,label:p.$t(`order.field.state`),width:`130px`,align:`center`},{default:l(e=>[r(A,{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(k,{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`,ne,n(t.row.pay_way||`-`),1)]),_:1},8,[`label`]),r(k,{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`,re,n(p.$dayjs.format(t.row.created_at)),1)]),_:1},8,[`label`]),r(k,{"min-width":`130px`,fixed:`right`},{default:l(r=>[e(`div`,ie,[p.isPendingAction(r.row.state)?(f(),c(D,{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(D,{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`])),[[N,p.loading]])]),_:1})]),_:1})]),_:1}),r(b,null,{default:l(()=>[r(y,{span:10,offset:14},{default:l(()=>[e(`div`,ae,[r(M,{"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 se=w(N,[[`render`,oe],[`__scopeId`,`data-v-452d97b9`]]);export{se 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-D2kXNiIn.js";import{n as g,t as _}from"./table-GkjhOaoE.js";import{t as v}from"./card-D-4S-l7a.js";import{t as y}from"./date-picker-CCW3QD58.js";import{n as b,t as x}from"./row-BN4KFxVt.js";import{t as S}from"./pagination-CJ-K0_n9.js";import{t as C}from"./skeleton-CoheJz5x.js";import{G as w,Ui as T,Vi as E,hr as D,ln as O,ui as k}from"./index-BrXcZpB0.js";import{t as A}from"./index.es-Cd6zh83v.js";import{t as j}from"./CopyToClipboard-B6HsusZG.js";var M={total_count:0,total_spent:0,state_counts:{}},N=p({name:`ConsoleOrderList`,components:{Pagination:S,CopyToClipboard:j,ElRow:x,ElCol:b,ElTable:_,ElTableColumn:g,ElButton:T,ElTag:E,ElCard:v,ElSelect:m,ElOption:h,ElDatePicker:y,ElSkeleton:C,FontAwesomeIcon:A},data(){return{OrderState:k,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:{...M},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:k.PENDING,label:this.$t(`order.state.pending`)},{value:k.FINISHED,label:this.$t(`order.state.finished`)},{value:k.PAID,label:this.$t(`order.state.paid`)},{value:k.EXPIRED,label:this.$t(`order.state.expired`)},{value:k.FAILED,label:this.$t(`order.state.failed`)},{value:k.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:`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:O,stateTagType(e){return e===k.FINISHED||e===k.PAID?`success`:e===k.EXPIRED||e===k.FAILED?`danger`:e===k.REFUNDED?`warning`:`info`},stateLabel(e){return{[k.PENDING]:this.$t(`order.state.pending`),[k.PAID]:this.$t(`order.state.paid`),[k.FINISHED]:this.$t(`order.state.finished`),[k.EXPIRED]:this.$t(`order.state.expired`),[k.FAILED]:this.$t(`order.state.failed`),[k.REFUNDED]:this.$t(`order.state.refunded`)}[e]||e},isPendingAction(e){return e!==k.PAID&&e!==k.FINISHED&&e!==k.EXPIRED&&e!==k.FAILED&&e!==k.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,D.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,D.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...M}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,D.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})}}}),P={class:`title`},F={key:1,class:`card-content`},I={class:`icon-wrapper`},L={class:`description`},R={class:`value`},z={key:1,class:`card-content`},B={class:`icon-wrapper`},V={class:`description`},H={class:`value`},U={key:1,class:`card-content`},W={class:`icon-wrapper`},ee={class:`description`},G={class:`value`},K={key:1,class:`card-content`},q={class:`icon-wrapper`},J={class:`description`},Y={class:`value`},X={class:`filter-row mb-3`},Z={class:`key`},Q={class:`cursor-pointer`},$={class:`price`},te={class:`description`},ne={class:`text-gray-500`},re={class:`created-at`},ie={class:`flex items-center justify-center flex-wrap`},ae={class:`float-right`};function oe(p,m,h,g,_,v){let y=o(`el-col`),b=o(`el-row`),x=o(`el-skeleton`),S=o(`font-awesome-icon`),C=o(`el-card`),w=o(`el-option`),T=o(`el-select`),E=o(`el-date-picker`),D=o(`el-button`),O=o(`copy-to-clipboard`),k=o(`el-table-column`),A=o(`el-tag`),j=o(`el-table`),M=o(`pagination`),N=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`,P,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`,F,[e(`div`,I,[r(S,{icon:`fa-solid fa-receipt`,class:`icon`})]),e(`p`,L,n(p.$t(`order.title.totalOrders`)),1),e(`p`,R,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`,z,[e(`div`,B,[r(S,{icon:`fa-solid fa-dollar-sign`,class:`icon`})]),e(`p`,V,n(p.$t(`order.title.totalSpent`)),1),e(`p`,H,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`,U,[e(`div`,W,[r(S,{icon:`fa-solid fa-check-circle`,class:`icon`})]),e(`p`,ee,n(p.$t(`order.title.finishedOrders`)),1),e(`p`,G,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`,K,[e(`div`,q,[r(S,{icon:`fa-solid fa-clock`,class:`icon`})]),e(`p`,J,n(p.$t(`order.title.pendingOrders`)),1),e(`p`,Y,n(p.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),e(`div`,X,[r(T,{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(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(T,{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(w,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(E,{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(D,{type:`primary`,plain:``,loading:p.exporting,onClick:p.onExport},{default:l(()=>[r(S,{icon:`fa-solid fa-file-export`,class:`mr-1`}),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(j,{data:p.orders,stripe:``,"empty-text":p.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:l(()=>[r(k,{prop:`id`,label:p.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:l(t=>[e(`span`,Z,n(t.row.id),1),e(`span`,Q,[r(O,{content:t.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(k,{label:p.$t(`order.field.price`),width:`110px`,align:`center`},{default:l(t=>[e(`span`,$,n(p.getPriceString({value:t.row?.price})),1)]),_:1},8,[`label`]),r(k,{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`,te,n(t.row.description),1)]),_:1},8,[`label`]),r(k,{prop:`state`,label:p.$t(`order.field.state`),width:`130px`,align:`center`},{default:l(e=>[r(A,{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(k,{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`,ne,n(t.row.pay_way||`-`),1)]),_:1},8,[`label`]),r(k,{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`,re,n(p.$dayjs.format(t.row.created_at)),1)]),_:1},8,[`label`]),r(k,{"min-width":`130px`,fixed:`right`},{default:l(r=>[e(`div`,ie,[p.isPendingAction(r.row.state)?(f(),c(D,{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(D,{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`])),[[N,p.loading]])]),_:1})]),_:1})]),_:1}),r(b,null,{default:l(()=>[r(y,{span:10,offset:14},{default:l(()=>[e(`div`,ae,[r(M,{"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 se=w(N,[[`render`,oe],[`__scopeId`,`data-v-452d97b9`]]);export{se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime--c01j_DQ.js";import{A as t,I as n,Jt as r,L as i,M as a,N as o,T as s,a as c,at as l,c as u,d,ht as f,i as p,j as m,l as h,mt as g,n as _,o as v,ot as y,qt as b,r as x,rt as S,s as C,t as w,tt as T,u as E,x as ee,z as D}from"./vendor-chart-Dw-P17PN.js";import{r as O,t as k}from"./select-B-w4TTjR.js";import{n as A,t as j}from"./table-Db9R06on.js";import{n as M,t as N}from"./tabs-CKJWx47c.js";import{t as P}from"./card-D-4S-l7a.js";import{n as F,r as I}from"./radio-Bj0tEwH8.js";import{t as L}from"./date-picker-BL8VEdss.js";import{n as R,t as z}from"./row-C_5ub9kH.js";import{t as B}from"./empty-xCRn_5sX.js";import{t as V}from"./pagination-BCc6JgI2.js";import{n as H,t as U}from"./skeleton-CoheJz5x.js";import{t as W}from"./switch-FLE178ww.js";import{Fi as G,G as te,Mi as K,Tr as ne,Ui as re,Vi as ie,_r as q,ci as J,gi as Y,gr as ae,kr as oe,li as X,vr as se,xi as ce}from"./index-s1lrp6nN.js";import{t as le}from"./index.es-BtwnN9TZ.js";import{t as ue}from"./CopyToClipboard-Bk1nRi-n.js";var de=e(oe());v.register(c,u,p,x,C,E,d,h);var Z=[`#5B8FF9`,`#5AD8A6`,`#5D7092`,`#F6BD16`,`#6F5EF9`,`#6DC8EC`,`#945FB9`,`#FF9845`,`#1E9493`,`#FF99C3`],Q=`#C0C4CC`,fe=.01,pe=20;function me(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 he=15e3,ge=D({name:`ConsoleUsageList`,components:{Pagination:V,ElTag:ie,ElDatePicker:L,ElTable:j,ElSelect:O,ElOption:k,CopyToClipboard:ue,ElRow:z,ElCol:R,ElTableColumn:A,ElCard:P,ElRadioButton:F,ElRadioGroup:I,ElSkeleton:U,ElSkeletonItem:H,ElDialog:G,ElTabs:M,ElTabPane:N,ElButton:re,ElEmpty:B,ElSwitch:W,FontAwesomeIcon:le,BarChart:w,DoughnutChart:_},data(){return{applicationIds:this.$route.query.application_id?.toString()?this.$route.query.application_id?.toString().split(`,`):[],apiIds:this.$route.query.api_id?.toString()?this.$route.query.api_id?.toString().split(`,`):[],applications:[],apis:[],apisLoading:!1,credentialType:J,serviceType:X,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()||X.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===X.API?this.onFetchApiUsages(e):this.type===X.Proxy&&this.onFetchProxyUsages(e)},startAutoRefresh(){this.stopAutoRefresh(),this.autoRefreshTimer=window.setInterval(()=>{document.hidden||this.onFetchUsages(!0)},he)},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 q.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&&q.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(){ne.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:Y.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,ae.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;q.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{},...this.traceId?{trace_id:this.traceId}:{}}).then(({data:e})=>{t===this.fetchSeq&&(this.apiUsages=e.items,this.total=e.count)}).catch(()=>{}).finally(()=>{e||(this.loading=!1)})},onFetchProxyUsages(e=!1){e||(this.loading=!0);let t=++this.fetchSeq;se.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{}}).then(({data:e})=>{t===this.fetchSeq&&(this.proxyUsages=e.items,this.total=e.count)}).catch(()=>{}).finally(()=>{e||(this.loading=!1)})},async onExport(){let e=this.$store.state.token?.access;if(!e){K.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=`${ce()}/api/v1/usage/apis/export/?${de.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{K.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 q.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-fe),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,pe)}a.length-s===1&&(s=a.length);let c=a.slice(0,s),l=new Set(c),u=me(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}}}}),_e={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},ve={class:`inline-block w-9`},ye={class:`inline-block`},be={key:1,class:`summary-card`},xe={class:`icon-wrapper`},Se={class:`text-left`},Ce={class:`description`},we={class:`value`},Te={class:`flex flex-wrap items-center justify-between gap-2`},Ee={class:`text-[15px] font-medium text-[var(--el-text-color-primary)]`},De={class:`chart-wrapper`},Oe={class:`share-cell`},ke={class:`share-bar`},Ae={class:`share-pct`},je={class:`flex items-center justify-end gap-2 mb-4`},Me={class:`text-sm text-[var(--el-text-color-regular)]`},Ne={key:0},Pe={key:0},Fe={key:1},Ie={class:`flex flex-wrap gap-2`},Le={class:`key`},Re={key:0,class:`cursor-pointer`},ze={class:`key`},Be={key:0,class:`cursor-pointer`},Ve={class:`created-at`},$={class:`key`},He={key:0,class:`cursor-pointer`},Ue={class:`created-at`},We={key:1,class:`detail-json`},Ge={key:2,class:`text-gray-400`},Ke={key:1,class:`detail-json`},qe={key:2,class:`text-gray-400`},Je={class:`float-right`};function Ye(e,c,u,d,p,h){let _=l(`el-col`),v=l(`el-row`),x=l(`el-radio-button`),C=l(`el-radio-group`),w=l(`el-option`),E=l(`el-select`),D=l(`el-skeleton-item`),O=l(`el-skeleton`),k=l(`el-date-picker`),A=l(`font-awesome-icon`),j=l(`el-button`),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=y(`loading`);return T(),m(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[t(`h2`,_e,r(e.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),i(v,null,{default:g(()=>[i(_,{md:4,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,null,r(e.$t(`application.field.type`)),1),i(C,{modelValue:e.type,"onUpdate:modelValue":c[0]||=t=>e.type=t},{default:g(()=>[i(x,{value:e.serviceType.API,label:e.$t(`application.field.api`)},null,8,[`value`,`label`]),i(x,{value:e.serviceType.Proxy,label:e.$t(`application.field.proxy`)},null,8,[`value`,`label`])]),_:1},8,[`modelValue`])]),_:1}),f(i(_,{md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,ve,r(e.$t(`usage.field.application`)),1),i(E,{modelValue:e.applicationIds,"onUpdate:modelValue":c[1]||=t=>e.applicationIds=t,placeholder:e.$t(`usage.field.application`),clearable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApplicationsChange},{default:g(()=>[(T(!0),o(s,null,S(e.applications,e=>(T(),m(w,{key:e.id,label:e.service?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[ee,!1]]),e.type===e.serviceType.API?(T(),m(_,{key:0,md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,ye,r(e.$t(`usage.field.api`)),1),e.apisLoading?(T(),m(O,{key:0,animated:``,class:`w-full`},{template:g(()=>[i(D,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(T(),m(E,{key:1,modelValue:e.apiIds,"onUpdate:modelValue":c[2]||=t=>e.apiIds=t,placeholder:e.$t(`usage.field.api`),clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApisChange},{default:g(()=>[(T(!0),o(s,null,S(e.apis,e=>(T(),m(w,{key:e?.id,label:e?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]))]),_:1})):a(``,!0),e.type===e.serviceType.API?(T(),m(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(k,{modelValue:e.createdAtRange,"onUpdate:modelValue":c[3]||=t=>e.createdAtRange=t,type:`datetimerange`,class:`w-full`,shortcuts:e.shortcuts,"range-separator":e.$t(`usage.placeholder.to`),"start-placeholder":e.$t(`usage.placeholder.startDate`),"end-placeholder":e.$t(`usage.placeholder.endDate`),onChange:e.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(T(),m(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(E,{modelValue:e.statusCodeFilter,"onUpdate:modelValue":c[4]||=t=>e.statusCodeFilter=t,placeholder:e.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:e.statusCodeOptionsLoading,onChange:e.onStatusCodeChange},{default:g(()=>[(T(!0),o(s,null,S(e.statusCodeOptions,e=>(T(),m(w,{key:e,label:String(e),value:String(e)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(T(),m(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:g(()=>[i(j,{type:`primary`,plain:``,loading:e.exporting,class:`w-full whitespace-nowrap`,onClick:e.onExport},{default:g(()=>[i(A,{icon:`fa-solid fa-file-export`,class:`mr-1`}),n(` `+r(e.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):a(``,!0)]),_:1}),i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[e.type===e.serviceType.API?(T(),m(v,{key:0,gutter:24,class:`mb-5`},{default:g(()=>[i(_,{md:6,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{default:g(()=>[e.aggLoading?(T(),m(O,{key:0})):(T(),o(`div`,be,[t(`div`,xe,[i(A,{icon:`fa-solid fa-cubes`,class:`icon`})]),t(`div`,Se,[t(`p`,Ce,r(e.$t(`usage.title.totalUsed`)),1),t(`p`,we,r(e.totalUsedString),1)])]))]),_:1})]),_:1}),i(_,{md:18,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{header:g(()=>[t(`div`,Te,[t(`span`,Ee,r(e.$t(`usage.title.usageAnalytics`)),1),i(C,{modelValue:e.chartView,"onUpdate:modelValue":c[5]||=t=>e.chartView=t,size:`small`},{default:g(()=>[i(x,{value:`trend`,label:e.$t(`usage.view.trend`)},null,8,[`label`]),i(x,{value:`distribution`,label:e.$t(`usage.view.distribution`)},null,8,[`label`]),i(x,{value:`breakdown`,label:e.$t(`usage.view.breakdown`)},null,8,[`label`])]),_:1},8,[`modelValue`])])]),default:g(()=>[t(`div`,De,[e.aggLoading?(T(),m(O,{key:0,class:`w-full`})):e.chartView===`trend`?(T(),o(s,{key:1},[e.barChartSeries.length?(T(),m(N,{key:0,data:e.barChartData,options:e.barChartOptions,class:`chart`},null,8,[`data`,`options`])):(T(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):e.chartView===`distribution`?(T(),o(s,{key:2},[e.pieData.length?(T(),m(F,{key:0,data:e.doughnutChartData,options:e.doughnutChartOptions,class:`chart`},null,8,[`data`,`options`])):(T(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):(T(),o(s,{key:3},[e.apiBreakdown.length?(T(),m(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:b({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`,Oe,[t(`div`,ke,[t(`div`,{class:`share-bar-fill`,style:b({width:e.row.share*100+`%`,backgroundColor:e.row.color})},null,4)]),t(`span`,Ae,r((e.row.share*100).toFixed(1))+`%`,1)])]),_:1},8,[`label`])]),_:1},8,[`data`])):(T(),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`,je,[t(`span`,Me,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((T(),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?(T(),o(`span`,Ne,r(t.row.status_code),1)):(T(),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)?(T(),o(`div`,Pe,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)])):(T(),o(`div`,Fe,[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`,Ie,[i.row.original_amount>i.row.deducted_amount&&i.row.original_amount>0?(T(),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),(T(!0),o(s,null,S(e.getSimpleMetadata(i.row.metadata),(e,t)=>(T(),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?(T(),m(j,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:n=>e.onShowDetail(t.row)},{default:g(()=>[n(r(e.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:1},8,[`label`]),i(I,{prop:`trace_id`,label:e.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:g(e=>[t(`span`,Le,r(e.row.trace_id),1),e.row.trace_id?(T(),o(`span`,Re,[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`,ze,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(T(),o(`span`,Be,[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`,Ve,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((T(),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=>[(T(!0),o(s,null,S(e.row.metadata,(e,t)=>(T(),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`,$,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(T(),o(`span`,He,[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`,Ue,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?(T(),m(O,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.request?(T(),o(`pre`,We,r(e.formatJson(e.detailRow.metadata.request)),1)):(T(),o(`p`,Ge,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),i(V,{label:e.$t(`usage.dialog.response`),name:`response`},{default:g(()=>[e.detailLoading?(T(),m(O,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.response?(T(),o(`pre`,Ke,r(e.formatJson(e.detailRow.metadata.response)),1)):(T(),o(`p`,qe,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`,Je,[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 Xe=te(ge,[[`render`,Ye],[`__scopeId`,`data-v-7028d194`]]);export{Xe as default};
|
|
1
|
+
import{o as e}from"./rolldown-runtime--c01j_DQ.js";import{A as t,I as n,Jt as r,L as i,M as a,N as o,T as s,a as c,at as l,c as u,d,ht as f,i as p,j as m,l as h,mt as g,n as _,o as v,ot as y,qt as b,r as x,rt as S,s as C,t as w,tt as T,u as E,x as ee,z as D}from"./vendor-chart-Dw-P17PN.js";import{r as O,t as k}from"./select-D2kXNiIn.js";import{n as A,t as j}from"./table-GkjhOaoE.js";import{n as M,t as N}from"./tabs-DBYVHf_-.js";import{t as P}from"./card-D-4S-l7a.js";import{n as F,r as I}from"./radio-Bj0tEwH8.js";import{t as L}from"./date-picker-CCW3QD58.js";import{n as R,t as z}from"./row-BN4KFxVt.js";import{t as B}from"./empty-xCRn_5sX.js";import{t as V}from"./pagination-CJ-K0_n9.js";import{n as H,t as U}from"./skeleton-CoheJz5x.js";import{t as W}from"./switch-Bk4IAKzq.js";import{Fi as G,G as te,Mi as K,Tr as ne,Ui as re,Vi as ie,_r as q,ci as J,gi as Y,gr as ae,kr as oe,li as X,vr as se,xi as ce}from"./index-BrXcZpB0.js";import{t as le}from"./index.es-Cd6zh83v.js";import{t as ue}from"./CopyToClipboard-B6HsusZG.js";var de=e(oe());v.register(c,u,p,x,C,E,d,h);var Z=[`#5B8FF9`,`#5AD8A6`,`#5D7092`,`#F6BD16`,`#6F5EF9`,`#6DC8EC`,`#945FB9`,`#FF9845`,`#1E9493`,`#FF99C3`],Q=`#C0C4CC`,fe=.01,pe=20;function me(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 he=15e3,ge=D({name:`ConsoleUsageList`,components:{Pagination:V,ElTag:ie,ElDatePicker:L,ElTable:j,ElSelect:O,ElOption:k,CopyToClipboard:ue,ElRow:z,ElCol:R,ElTableColumn:A,ElCard:P,ElRadioButton:F,ElRadioGroup:I,ElSkeleton:U,ElSkeletonItem:H,ElDialog:G,ElTabs:M,ElTabPane:N,ElButton:re,ElEmpty:B,ElSwitch:W,FontAwesomeIcon:le,BarChart:w,DoughnutChart:_},data(){return{applicationIds:this.$route.query.application_id?.toString()?this.$route.query.application_id?.toString().split(`,`):[],apiIds:this.$route.query.api_id?.toString()?this.$route.query.api_id?.toString().split(`,`):[],applications:[],apis:[],apisLoading:!1,credentialType:J,serviceType:X,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()||X.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===X.API?this.onFetchApiUsages(e):this.type===X.Proxy&&this.onFetchProxyUsages(e)},startAutoRefresh(){this.stopAutoRefresh(),this.autoRefreshTimer=window.setInterval(()=>{document.hidden||this.onFetchUsages(!0)},he)},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 q.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&&q.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(){ne.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:Y.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,ae.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;q.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.createdAtRange?.[0]?{created_at_from:this.createdAtRange[0]}:{},...this.createdAtRange?.[1]?{created_at_to:this.createdAtRange[1]}:{},...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{},...this.apiIds&&this.apiIds.length?{api_id:this.apiIds}:{},...this.statusCodeFilter?{status_code:this.statusCodeFilter}:{},...this.traceId?{trace_id:this.traceId}:{}}).then(({data:e})=>{t===this.fetchSeq&&(this.apiUsages=e.items,this.total=e.count)}).catch(()=>{}).finally(()=>{e||(this.loading=!1)})},onFetchProxyUsages(e=!1){e||(this.loading=!0);let t=++this.fetchSeq;se.getAll({limit:this.limit,offset:(this.page-1)*this.limit,user_id:this.$store.getters.user.id,ordering:`-created_at`,...this.applicationIds&&this.applicationIds.length?{application_id:this.applicationIds}:{}}).then(({data:e})=>{t===this.fetchSeq&&(this.proxyUsages=e.items,this.total=e.count)}).catch(()=>{}).finally(()=>{e||(this.loading=!1)})},async onExport(){let e=this.$store.state.token?.access;if(!e){K.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=`${ce()}/api/v1/usage/apis/export/?${de.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{K.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 q.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-fe),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,pe)}a.length-s===1&&(s=a.length);let c=a.slice(0,s),l=new Set(c),u=me(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}}}}),_e={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},ve={class:`inline-block w-9`},ye={class:`inline-block`},be={key:1,class:`summary-card`},xe={class:`icon-wrapper`},Se={class:`text-left`},Ce={class:`description`},we={class:`value`},Te={class:`flex flex-wrap items-center justify-between gap-2`},Ee={class:`text-[15px] font-medium text-[var(--el-text-color-primary)]`},De={class:`chart-wrapper`},Oe={class:`share-cell`},ke={class:`share-bar`},Ae={class:`share-pct`},je={class:`flex items-center justify-end gap-2 mb-4`},Me={class:`text-sm text-[var(--el-text-color-regular)]`},Ne={key:0},Pe={key:0},Fe={key:1},Ie={class:`flex flex-wrap gap-2`},Le={class:`key`},Re={key:0,class:`cursor-pointer`},ze={class:`key`},Be={key:0,class:`cursor-pointer`},Ve={class:`created-at`},$={class:`key`},He={key:0,class:`cursor-pointer`},Ue={class:`created-at`},We={key:1,class:`detail-json`},Ge={key:2,class:`text-gray-400`},Ke={key:1,class:`detail-json`},qe={key:2,class:`text-gray-400`},Je={class:`float-right`};function Ye(e,c,u,d,p,h){let _=l(`el-col`),v=l(`el-row`),x=l(`el-radio-button`),C=l(`el-radio-group`),w=l(`el-option`),E=l(`el-select`),D=l(`el-skeleton-item`),O=l(`el-skeleton`),k=l(`el-date-picker`),A=l(`font-awesome-icon`),j=l(`el-button`),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=y(`loading`);return T(),m(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[t(`h2`,_e,r(e.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),i(v,null,{default:g(()=>[i(_,{md:4,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,null,r(e.$t(`application.field.type`)),1),i(C,{modelValue:e.type,"onUpdate:modelValue":c[0]||=t=>e.type=t},{default:g(()=>[i(x,{value:e.serviceType.API,label:e.$t(`application.field.api`)},null,8,[`value`,`label`]),i(x,{value:e.serviceType.Proxy,label:e.$t(`application.field.proxy`)},null,8,[`value`,`label`])]),_:1},8,[`modelValue`])]),_:1}),f(i(_,{md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,ve,r(e.$t(`usage.field.application`)),1),i(E,{modelValue:e.applicationIds,"onUpdate:modelValue":c[1]||=t=>e.applicationIds=t,placeholder:e.$t(`usage.field.application`),clearable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApplicationsChange},{default:g(()=>[(T(!0),o(s,null,S(e.applications,e=>(T(),m(w,{key:e.id,label:e.service?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[ee,!1]]),e.type===e.serviceType.API?(T(),m(_,{key:0,md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[t(`span`,ye,r(e.$t(`usage.field.api`)),1),e.apisLoading?(T(),m(O,{key:0,animated:``,class:`w-full`},{template:g(()=>[i(D,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(T(),m(E,{key:1,modelValue:e.apiIds,"onUpdate:modelValue":c[2]||=t=>e.apiIds=t,placeholder:e.$t(`usage.field.api`),clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:e.onApisChange},{default:g(()=>[(T(!0),o(s,null,S(e.apis,e=>(T(),m(w,{key:e?.id,label:e?.title,value:e?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]))]),_:1})):a(``,!0),e.type===e.serviceType.API?(T(),m(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(k,{modelValue:e.createdAtRange,"onUpdate:modelValue":c[3]||=t=>e.createdAtRange=t,type:`datetimerange`,class:`w-full`,shortcuts:e.shortcuts,"range-separator":e.$t(`usage.placeholder.to`),"start-placeholder":e.$t(`usage.placeholder.startDate`),"end-placeholder":e.$t(`usage.placeholder.endDate`),onChange:e.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(T(),m(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:g(()=>[i(E,{modelValue:e.statusCodeFilter,"onUpdate:modelValue":c[4]||=t=>e.statusCodeFilter=t,placeholder:e.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:e.statusCodeOptionsLoading,onChange:e.onStatusCodeChange},{default:g(()=>[(T(!0),o(s,null,S(e.statusCodeOptions,e=>(T(),m(w,{key:e,label:String(e),value:String(e)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):a(``,!0),e.type===e.serviceType.API?(T(),m(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:g(()=>[i(j,{type:`primary`,plain:``,loading:e.exporting,class:`w-full whitespace-nowrap`,onClick:e.onExport},{default:g(()=>[i(A,{icon:`fa-solid fa-file-export`,class:`mr-1`}),n(` `+r(e.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):a(``,!0)]),_:1}),i(v,null,{default:g(()=>[i(_,{span:24},{default:g(()=>[e.type===e.serviceType.API?(T(),m(v,{key:0,gutter:24,class:`mb-5`},{default:g(()=>[i(_,{md:6,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{default:g(()=>[e.aggLoading?(T(),m(O,{key:0})):(T(),o(`div`,be,[t(`div`,xe,[i(A,{icon:`fa-solid fa-cubes`,class:`icon`})]),t(`div`,Se,[t(`p`,Ce,r(e.$t(`usage.title.totalUsed`)),1),t(`p`,we,r(e.totalUsedString),1)])]))]),_:1})]),_:1}),i(_,{md:18,xs:24},{default:g(()=>[i(M,{shadow:`hover`,class:`h-full`},{header:g(()=>[t(`div`,Te,[t(`span`,Ee,r(e.$t(`usage.title.usageAnalytics`)),1),i(C,{modelValue:e.chartView,"onUpdate:modelValue":c[5]||=t=>e.chartView=t,size:`small`},{default:g(()=>[i(x,{value:`trend`,label:e.$t(`usage.view.trend`)},null,8,[`label`]),i(x,{value:`distribution`,label:e.$t(`usage.view.distribution`)},null,8,[`label`]),i(x,{value:`breakdown`,label:e.$t(`usage.view.breakdown`)},null,8,[`label`])]),_:1},8,[`modelValue`])])]),default:g(()=>[t(`div`,De,[e.aggLoading?(T(),m(O,{key:0,class:`w-full`})):e.chartView===`trend`?(T(),o(s,{key:1},[e.barChartSeries.length?(T(),m(N,{key:0,data:e.barChartData,options:e.barChartOptions,class:`chart`},null,8,[`data`,`options`])):(T(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):e.chartView===`distribution`?(T(),o(s,{key:2},[e.pieData.length?(T(),m(F,{key:0,data:e.doughnutChartData,options:e.doughnutChartOptions,class:`chart`},null,8,[`data`,`options`])):(T(),m(P,{key:1,description:e.$t(`common.message.noData`),"image-size":70,class:`w-full`},null,8,[`description`]))],64)):(T(),o(s,{key:3},[e.apiBreakdown.length?(T(),m(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:b({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`,Oe,[t(`div`,ke,[t(`div`,{class:`share-bar-fill`,style:b({width:e.row.share*100+`%`,backgroundColor:e.row.color})},null,4)]),t(`span`,Ae,r((e.row.share*100).toFixed(1))+`%`,1)])]),_:1},8,[`label`])]),_:1},8,[`data`])):(T(),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`,je,[t(`span`,Me,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((T(),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?(T(),o(`span`,Ne,r(t.row.status_code),1)):(T(),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)?(T(),o(`div`,Pe,[t(`span`,null,r(e.getDeductedAmount(n.row)),1)])):(T(),o(`div`,Fe,[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`,Ie,[i.row.original_amount>i.row.deducted_amount&&i.row.original_amount>0?(T(),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),(T(!0),o(s,null,S(e.getSimpleMetadata(i.row.metadata),(e,t)=>(T(),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?(T(),m(j,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:n=>e.onShowDetail(t.row)},{default:g(()=>[n(r(e.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:1},8,[`label`]),i(I,{prop:`trace_id`,label:e.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:g(e=>[t(`span`,Le,r(e.row.trace_id),1),e.row.trace_id?(T(),o(`span`,Re,[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`,ze,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(T(),o(`span`,Be,[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`,Ve,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((T(),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=>[(T(!0),o(s,null,S(e.row.metadata,(e,t)=>(T(),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`,$,r(e.getCredentialLabel(n.row)),1),n.row.credential?.id||n.row.credential_id?(T(),o(`span`,He,[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`,Ue,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?(T(),m(O,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.request?(T(),o(`pre`,We,r(e.formatJson(e.detailRow.metadata.request)),1)):(T(),o(`p`,Ge,r(e.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),i(V,{label:e.$t(`usage.dialog.response`),name:`response`},{default:g(()=>[e.detailLoading?(T(),m(O,{key:0,rows:6,animated:``})):e.detailRow?.metadata?.response?(T(),o(`pre`,Ke,r(e.formatJson(e.detailRow.metadata.response)),1)):(T(),o(`p`,qe,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`,Je,[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 Xe=te(ge,[[`render`,Ye],[`__scopeId`,`data-v-7028d194`]]);export{Xe 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{G as s}from"./index-
|
|
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{G as s}from"./index-BrXcZpB0.js";import{t as c}from"./LocalTools-jyNjH-zv.js";var l=o({name:`SettingsLocalTools`,components:{LocalToolsSetting:c}}),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=s(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,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{H as ee}from"./use-deprecated-B-uvyrTL.js";import{t as te}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,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{H as ee}from"./use-deprecated-B-uvyrTL.js";import{t as te}from"./switch-Bk4IAKzq.js";import{Ci as ne,Er as m,G as h,Qi as g,Ui as _,Vi as v,bi as y,q as b}from"./index-BrXcZpB0.js";import{t as x}from"./index.es-Cd6zh83v.js";var S=p({name:`LocalToolsSetting`,components:{ElButton:_,ElTag:v,ElSwitch:te,ElInput:g,FontAwesomeIcon:x},data(){return{Plus:ee,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!!b()},android(){return ne()},canInstallXhs(){return this.a11yEnabled&&this.computerUse}},async mounted(){let e=b();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 b()?.perm?.status();this.a11yEnabled=e?.accessibility===!0}finally{this.refreshingA11y=!1}}},async openAndroidAccessibility(){await b()?.perm?.openPane(`accessibility`)},async fetchXhsSkill(){this.xhsLoading=!0,this.xhsError=``;try{let e=await m.get(`/skills/`,{baseURL:`${y()}/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 m.post(`/skills/${e.id}/install/`,{},{baseURL:`${y()}/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=b();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 b()?.pickFolder();e&&!this.roots.includes(e)&&this.roots.push(e)},removeRoot(e){this.roots.splice(e,1)},addMcp(){this.mcpServers.push({_uid:this.mcpUid++,id:``,command:``,argsText:``,envText:``,enabled:!0})},removeMcp(e){this.mcpServers.splice(e,1)},mcpStatusFor(e){let t=e.trim();return this.mcpStatuses.find(e=>e.id===t)},mcpBadgeType(e){let t=this.mcpStatusFor(e)?.status;return t===`connected`?`success`:t===`failed`?`danger`:`info`},mcpBadgeText(e){let t=this.mcpStatusFor(e);return this.mcpBusy===e.trim()?this.$t(`common.settings.localToolsMcpConnecting`):t?t.status===`connected`?this.$t(`common.settings.localToolsMcpConnected`,{n:t.toolCount}):t.status===`disabled`?this.$t(`common.settings.localToolsMcpDisabled`):this.$t(`common.settings.localToolsMcpFailed`):this.$t(`common.settings.localToolsMcpNotSaved`)},mcpErrorFor(e){let t=this.mcpStatusFor(e);return t?.status===`failed`&&t.error?t.error:``},buildMcpPayload(){this.mcpError=``;let e=[],t=new Set;for(let n of this.mcpServers){let r=n.id.trim(),i=n.command.trim();if(!r||!i)return this.mcpError=this.$t(`common.settings.localToolsMcpNameRequired`),null;if(!/^[A-Za-z0-9_-]+$/.test(r))return this.mcpError=this.$t(`common.settings.localToolsMcpNameInvalid`),null;if(t.has(r))return this.mcpError=this.$t(`common.settings.localToolsMcpDuplicateName`),null;t.add(r);let a=n.argsText.split(`
|
|
4
4
|
`).map(e=>e.trim()).filter(Boolean),o={};for(let e of n.envText.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,B as t,G as n,Gt as r,H as i,I as a,Jt as o,K as s,Mt as c,N as l,Ot as u,Q as d,Rt as f,St as p,T as m,U as h,Vt as g,Wt as _,Y as v,ft as y,ht as b,it as x,j as S,k as C,mt as w,nt as T,p as E,pt as D,tt as O,wt as k,x as ee,z as A}from"./vendor-chart-Dw-P17PN.js";import{a as j,c as M,i as N,t as P}from"./install-Cn-SLM3u.js";import{c as te,d as F,n as I,r as L,u as R}from"./runtime-BTM7t9of.js";import{At as ne,Ct as z,R as B,_ as re,h as ie,m as V,nt as ae,ot as H,rt as U,st as W,wt as G,zt as oe}from"./use-deprecated-B-uvyrTL.js";import{t as se}from"./tooltip-DAEtFoXl.js";import{r as K}from"./aria-8oQuUBWy.js";import{n as ce}from"./vnode-tCZAUc1D.js";import{t as q}from"./click-outside-CPwvCpQu.js";import{t as le}from"./collapse-transition-BUGXhx7B.js";import{G as J,Gi as Y,Yi as X,ra as ue}from"./index-s1lrp6nN.js";var de=class{constructor(e,t){this.parent=e,this.domNode=t,this.subIndex=0,this.subIndex=0,this.init()}init(){this.subMenuItems=this.domNode.querySelectorAll(`li`),this.addListeners()}gotoSubIndex(e){e===this.subMenuItems.length?e=0:e<0&&(e=this.subMenuItems.length-1),this.subMenuItems[e].focus(),this.subIndex=e}addListeners(){let e=this.parent.domNode;Array.prototype.forEach.call(this.subMenuItems,t=>{t.addEventListener(`keydown`,t=>{let n=!1;switch(t.code){case X.down:this.gotoSubIndex(this.subIndex+1),n=!0;break;case X.up:this.gotoSubIndex(this.subIndex-1),n=!0;break;case X.tab:K(e,`mouseleave`);break;case X.enter:case X.numpadEnter:case X.space:n=!0,t.currentTarget.click();break}return n&&(t.preventDefault(),t.stopPropagation()),!1})})}},fe=class{constructor(e,t){this.domNode=e,this.submenu=null,this.submenu=null,this.init(t)}init(e){this.domNode.setAttribute(`tabindex`,`0`);let t=this.domNode.querySelector(`.${e}-menu`);t&&(this.submenu=new de(this,t)),this.addListeners()}addListeners(){this.domNode.addEventListener(`keydown`,e=>{let t=!1;switch(e.code){case X.down:K(e.currentTarget,`mouseenter`),this.submenu&&this.submenu.gotoSubIndex(0),t=!0;break;case X.up:K(e.currentTarget,`mouseenter`),this.submenu&&this.submenu.gotoSubIndex(this.submenu.subMenuItems.length-1),t=!0;break;case X.tab:K(e.currentTarget,`mouseleave`);break;case X.enter:case X.numpadEnter:case X.space:t=!0,e.currentTarget.click();break}t&&e.preventDefault()})}},pe=class{constructor(e,t){this.domNode=e,this.init(t)}init(e){let t=this.domNode.childNodes;Array.from(t).forEach(t=>{t.nodeType===1&&new fe(t,e)})}},me=j(A({...A({name:`ElMenuCollapseTransition`}),setup(e){let t=M(`menu`),r={onBeforeEnter:e=>e.style.opacity=`0.2`,onEnter(e,n){U(e,`${t.namespace.value}-opacity-transition`),e.style.opacity=`1`,n()},onAfterEnter(e){W(e,`${t.namespace.value}-opacity-transition`),e.style.opacity=``},onBeforeLeave(e){e.dataset||={},H(e,t.m(`collapse`))?(W(e,t.m(`collapse`)),e.dataset.oldOverflow=e.style.overflow,e.dataset.scrollWidth=e.clientWidth.toString(),U(e,t.m(`collapse`))):(U(e,t.m(`collapse`)),e.dataset.oldOverflow=e.style.overflow,e.dataset.scrollWidth=e.clientWidth.toString(),W(e,t.m(`collapse`))),e.style.width=`${e.scrollWidth}px`,e.style.overflow=`hidden`},onLeave(e){U(e,`horizontal-collapse-transition`),e.style.width=`${e.dataset.scrollWidth}px`}};return(e,t)=>(O(),S(E,n({mode:`out-in`},c(r)),{default:w(()=>[x(e.$slots,`default`)]),_:3},16))}}),[[`__file`,`menu-collapse-transition.vue`]]);function he(e,t){let n=C(()=>{let n=e.parent,r=[t.value];for(;n.type.name!==`ElMenu`;)n.props.index&&r.unshift(n.props.index),n=n.parent;return r});return{parentMenu:C(()=>{let t=e.parent;for(;t&&![`ElMenu`,`ElSubMenu`].includes(t.type.name);)t=t.parent;return t}),indexPath:n}}function ge(e){return C(()=>{let t=e.backgroundColor;return t?new Y(t).shade(20).toString():``})}var _e=(e,t)=>{let n=M(`menu`);return C(()=>n.cssVarBlock({"text-color":e.textColor||``,"hover-text-color":e.textColor||``,"bg-color":e.backgroundColor||``,"hover-bg-color":ge(e).value||``,"active-color":e.activeTextColor||``,level:`${t}`}))},Z=`rootMenu`,Q=`subMenu:`,ve=I({index:{type:String,required:!0},showTimeout:Number,hideTimeout:Number,popperClass:String,disabled:Boolean,teleported:{type:Boolean,default:void 0},popperOffset:Number,expandCloseIcon:{type:V},expandOpenIcon:{type:V},collapseCloseIcon:{type:V},collapseOpenIcon:{type:V}}),ye=`ElSubMenu`,be=A({name:ye,props:ve,setup(e,{slots:n,expose:r}){let a=t(),{indexPath:o,parentMenu:s}=he(a,C(()=>e.index)),c=M(`menu`),l=M(`sub-menu`),u=h(Z);u||G(ye,`can not inject root menu`);let f=h(`${Q}${s.value.uid}`);f||G(ye,`can not inject sub menu`);let g=k({}),x=k({}),S,w=k(!1),E=k(),D=k(),O=C(()=>L.value===`horizontal`&&j.value?`bottom-start`:`right-start`),A=C(()=>L.value===`horizontal`&&j.value||L.value===`vertical`&&!u.props.collapse?e.expandCloseIcon&&e.expandOpenIcon?F.value?e.expandOpenIcon:e.expandCloseIcon:ie:e.collapseCloseIcon&&e.collapseOpenIcon?F.value?e.collapseOpenIcon:e.collapseCloseIcon:re),j=C(()=>f.level===0),N=C(()=>{let t=e.teleported;return R(t)?j.value:t}),P=C(()=>u.props.collapse?`${c.namespace.value}-zoom-in-left`:`${c.namespace.value}-zoom-in-top`),te=C(()=>L.value===`horizontal`&&j.value?[`bottom-start`,`bottom-end`,`top-start`,`top-end`,`right-start`,`left-start`]:[`right-start`,`right`,`right-end`,`left-start`,`bottom-start`,`bottom-end`,`top-start`,`top-end`]),F=C(()=>u.openedMenus.includes(e.index)),I=C(()=>[...Object.values(g.value),...Object.values(x.value)].some(({active:e})=>e)),L=C(()=>u.props.mode),ne=C(()=>u.props.persistent),z=p({index:e.index,indexPath:o,active:I}),B=_e(u.props,f.level+1),V=C(()=>e.popperOffset??u.props.popperOffset),H=C(()=>e.popperClass??u.props.popperClass),U=C(()=>e.showTimeout??u.props.showTimeout),W=C(()=>e.hideTimeout??u.props.hideTimeout),K=()=>(D.value?.popperRef?.popperInstanceRef)?.destroy(),ce=e=>{e||K()},q=()=>{u.props.menuTrigger===`hover`&&u.props.mode===`horizontal`||u.props.collapse&&u.props.mode===`vertical`||e.disabled||u.handleSubMenuClick({index:e.index,indexPath:o.value,active:I.value})},J=(t,n=U.value)=>{var r;if(t.type!==`focus`){if(u.props.menuTrigger===`click`&&u.props.mode===`horizontal`||!u.props.collapse&&u.props.mode===`vertical`||e.disabled){f.mouseInChild.value=!0;return}f.mouseInChild.value=!0,S?.(),{stop:S}=oe(()=>{u.openMenu(e.index,o.value)},n),N.value&&((r=s.value.vnode.el)==null||r.dispatchEvent(new MouseEvent(`mouseenter`)))}},Y=(t=!1)=>{var n;if(u.props.menuTrigger===`click`&&u.props.mode===`horizontal`||!u.props.collapse&&u.props.mode===`vertical`){f.mouseInChild.value=!1;return}S?.(),f.mouseInChild.value=!1,{stop:S}=oe(()=>!w.value&&u.closeMenu(e.index,o.value),W.value),N.value&&t&&((n=f.handleMouseleave)==null||n.call(f,!0))};return y(()=>u.props.collapse,e=>ce(!!e)),T(`${Q}${a.uid}`,{addSubMenu:e=>{x.value[e.index]=e},removeSubMenu:e=>{delete x.value[e.index]},handleMouseleave:Y,mouseInChild:w,level:f.level+1}),r({opened:F}),d(()=>{u.addSubMenu(z),f.addSubMenu(z)}),v(()=>{f.removeSubMenu(z),u.removeSubMenu(z)}),()=>{let t=[n.title?.call(n),i(ae,{class:l.e(`icon-arrow`),style:{transform:F.value?e.expandCloseIcon&&e.expandOpenIcon||e.collapseCloseIcon&&e.collapseOpenIcon&&u.props.collapse?`none`:`rotateZ(180deg)`:`none`}},{default:()=>_(A.value)?i(a.appContext.components[A.value]):i(A.value)})],r=u.isMenuPopup?i(se,{ref:D,visible:F.value,effect:`light`,pure:!0,offset:V.value,showArrow:!1,persistent:ne.value,popperClass:H.value,placement:O.value,teleported:N.value,fallbackPlacements:te.value,transition:P.value,gpuAcceleration:!1},{content:()=>i(`div`,{class:[c.m(L.value),c.m(`popup-container`),H.value],onMouseenter:e=>J(e,100),onMouseleave:()=>Y(!0),onFocus:e=>J(e,100)},[i(`ul`,{class:[c.b(),c.m(`popup`),c.m(`popup-${O.value}`)],style:B.value},[n.default?.call(n)])]),default:()=>i(`div`,{class:l.e(`title`),onClick:q},t)}):i(m,{},[i(`div`,{class:l.e(`title`),ref:E,onClick:q},t),i(le,{},{default:()=>b(i(`ul`,{role:`menu`,class:[c.b(),c.m(`inline`)],style:B.value},[n.default?.call(n)]),[[ee,F.value]])})]);return i(`li`,{class:[l.b(),l.is(`active`,I.value),l.is(`opened`,F.value),l.is(`disabled`,e.disabled)],role:`menuitem`,ariaHaspopup:!0,ariaExpanded:F.value,onMouseenter:J,onMouseleave:()=>Y(),onFocus:J},[r])}}}),xe=I({mode:{type:String,values:[`horizontal`,`vertical`],default:`vertical`},defaultActive:{type:String,default:``},defaultOpeneds:{type:L(Array),default:()=>ue([])},uniqueOpened:Boolean,router:Boolean,menuTrigger:{type:String,values:[`hover`,`click`],default:`hover`},collapse:Boolean,backgroundColor:String,textColor:String,activeTextColor:String,closeOnClickOutside:Boolean,collapseTransition:{type:Boolean,default:!0},ellipsis:{type:Boolean,default:!0},popperOffset:{type:Number,default:6},ellipsisIcon:{type:V,default:()=>B},popperEffect:{type:L(String),default:`dark`},popperClass:String,showTimeout:{type:Number,default:300},hideTimeout:{type:Number,default:300},persistent:{type:Boolean,default:!0}}),Se=e=>f(e)&&e.every(e=>_(e)),Ce=A({name:`ElMenu`,props:xe,emits:{close:(e,t)=>_(e)&&Se(t),open:(e,t)=>_(e)&&Se(t),select:(e,t,n,r)=>_(e)&&Se(t)&&g(n)&&(R(r)||r instanceof Promise)},setup(e,{emit:n,slots:r,expose:a}){let o=t(),c=o.appContext.config.globalProperties.$router,l=k(),u=M(`menu`),f=M(`sub-menu`),m=k(-1),h=k(e.defaultOpeneds&&!e.collapse?e.defaultOpeneds.slice(0):[]),g=k(e.defaultActive),_=k({}),v=k({}),x=C(()=>e.mode===`horizontal`||e.mode===`vertical`&&e.collapse),S=()=>{let t=g.value&&_.value[g.value];!t||e.mode===`horizontal`||e.collapse||t.indexPath.forEach(e=>{let t=v.value[e];t&&w(e,t.indexPath)})},w=(t,r)=>{h.value.includes(t)||(e.uniqueOpened&&(h.value=h.value.filter(e=>r.includes(e))),h.value.push(t),n(`open`,t,r))},E=e=>{let t=h.value.indexOf(e);t!==-1&&h.value.splice(t,1)},O=(e,t)=>{E(e),n(`close`,e,t)},ee=({index:e,indexPath:t})=>{h.value.includes(e)?O(e,t):w(e,t)},A=t=>{(e.mode===`horizontal`||e.collapse)&&(h.value=[]);let{index:r,indexPath:i}=t;if(!(F(r)||F(i)))if(e.router&&c){let e=t.route||r,a=c.push(e).then(e=>(e||(g.value=r),e));n(`select`,r,i,{index:r,indexPath:i,route:e},a)}else g.value=r,n(`select`,r,i,{index:r,indexPath:i})},j=t=>{let n=_.value;g.value=(n[t]||g.value&&n[g.value]||n[e.defaultActive])?.index??t},N=e=>{let t=getComputedStyle(e),n=Number.parseInt(t.marginLeft,10),r=Number.parseInt(t.marginRight,10);return e.offsetWidth+n+r||0},P=()=>{if(!l.value)return-1;let e=Array.from(l.value?.childNodes??[]).filter(e=>e.nodeName!==`#text`||e.nodeValue),t=getComputedStyle(l.value),n=Number.parseInt(t.paddingLeft,10),r=Number.parseInt(t.paddingRight,10),i=l.value.clientWidth-n-r,a=0,o=0;return e.forEach((e,t)=>{e.nodeName!==`#comment`&&(a+=N(e),a<=i-64&&(o=t+1))}),o===e.length?-1:o},te=e=>v.value[e].indexPath,I=(e,t=33.34)=>{let n;return()=>{n&&clearTimeout(n),n=setTimeout(()=>{e()},t)}},L=!0,R=()=>{if(m.value===P())return;let e=()=>{m.value=-1,s(()=>{m.value=P()})};L?e():I(e)(),L=!1};y(()=>e.defaultActive,e=>{_.value[e]||(g.value=``),j(e)}),y(()=>e.collapse,e=>{e&&(h.value=[])}),y(_.value,S);let z;D(()=>{e.mode===`horizontal`&&e.ellipsis?z=ne(l,R).stop:z?.()});let B=k(!1);{let t=e=>{v.value[e.index]=e},n=e=>{delete v.value[e.index]};T(Z,p({props:e,openedMenus:h,items:_,subMenus:v,activeIndex:g,isMenuPopup:x,addMenuItem:e=>{_.value[e.index]=e},removeMenuItem:e=>{delete _.value[e.index]},addSubMenu:t,removeSubMenu:n,openMenu:w,closeMenu:O,handleMenuItemClick:A,handleSubMenuClick:ee})),T(`${Q}${o.uid}`,{addSubMenu:t,removeSubMenu:n,mouseInChild:B,level:0})}d(()=>{e.mode===`horizontal`&&new pe(o.vnode.el,u.namespace.value)}),a({open:e=>{let{indexPath:t}=v.value[e];t.forEach(e=>w(e,t))},close:E,updateActiveIndex:j,handleResize:R});let re=_e(e,0);return()=>{let t=r.default?.call(r)??[],a=[];if(e.mode===`horizontal`&&l.value){let n=ce(t),r=m.value===-1?n:n.slice(0,m.value),o=m.value===-1?[]:n.slice(m.value);o?.length&&e.ellipsis&&(t=r,a.push(i(be,{index:`sub-menu-more`,class:f.e(`hide-arrow`),popperOffset:e.popperOffset},{title:()=>i(ae,{class:f.e(`icon-more`)},{default:()=>i(e.ellipsisIcon)}),default:()=>o})))}let o=e.closeOnClickOutside?[[q,()=>{h.value.length&&(B.value||(h.value.forEach(e=>n(`close`,e,te(e))),h.value=[]))}]]:[],s=b(i(`ul`,{key:String(e.collapse),role:`menubar`,ref:l,style:re.value,class:{[u.b()]:!0,[u.m(e.mode)]:!0,[u.m(`collapse`)]:e.collapse}},[...t,...a]),o);return e.collapseTransition&&e.mode===`vertical`?i(me,()=>s):s}}}),we=I({index:{type:L([String,null]),default:null},route:{type:L([String,Object])},disabled:Boolean}),Te={click:e=>_(e.index)&&f(e.indexPath)},$=`ElMenuItem`,Ee=j(A({...A({name:$}),props:we,emits:Te,setup(n,{expose:i,emit:a}){let o=n;te(o.index)&&z($,`Missing required prop: "index"`);let s=t(),f=h(Z),g=M(`menu`),_=M(`menu-item`);f||G($,`can not inject root menu`);let{parentMenu:y,indexPath:b}=he(s,u(o,`index`)),T=h(`${Q}${y.value.uid}`);T||G($,`can not inject sub menu`);let E=C(()=>o.index===f.activeIndex),D=p({index:o.index,indexPath:b,active:E}),k=()=>{o.disabled||(f.handleMenuItemClick({index:o.index,indexPath:b.value,route:o.route}),a(`click`,D))};return d(()=>{T.addSubMenu(D),f.addMenuItem(D)}),v(()=>{T.removeSubMenu(D),f.removeMenuItem(D)}),i({parentMenu:y,rootMenu:f,active:E,nsMenu:g,nsMenuItem:_,handleClick:k}),(t,n)=>(O(),l(`li`,{class:r([c(_).b(),c(_).is(`active`,c(E)),c(_).is(`disabled`,t.disabled)]),role:`menuitem`,tabindex:`-1`,onClick:k},[c(y).type.name===`ElMenu`&&c(f).props.collapse&&t.$slots.title?(O(),S(c(se),{key:0,effect:c(f).props.popperEffect,placement:`right`,"fallback-placements":[`left`],persistent:c(f).props.persistent},{content:w(()=>[x(t.$slots,`title`)]),default:w(()=>[e(`div`,{class:r(c(g).be(`tooltip`,`trigger`))},[x(t.$slots,`default`)],2)]),_:3},8,[`effect`,`persistent`])):(O(),l(m,{key:1},[x(t.$slots,`default`),x(t.$slots,`title`)],64))],2))}}),[[`__file`,`menu-item.vue`]]),De={title:String},Oe=j(A({...A({name:`ElMenuItemGroup`}),props:De,setup(t){let n=M(`menu-item-group`);return(t,i)=>(O(),l(`li`,{class:r(c(n).b())},[e(`div`,{class:r(c(n).e(`title`))},[t.$slots.title?x(t.$slots,`title`,{key:1}):(O(),l(m,{key:0},[a(o(t.title),1)],64))],2),e(`ul`,null,[x(t.$slots,`default`)])],2))}}),[[`__file`,`menu-item-group.vue`]]),ke=P(Ce,{MenuItem:Ee,MenuItemGroup:Oe,SubMenu:be}),Ae=N(Ee);N(Oe);var je=N(be),Me=A({props:{collapsed:{type:Boolean,default:!1}},emits:[`click`],computed:{siteTitle(){return this.$store.state.site?.title||`AceData`},url(){let e=this.$store.state.site,t=`https://platform.acedata.cloud/favicon.ico`;return this.collapsed?e?.favicon||e?.logo||t:e?.logo||e?.favicon||t}}}),Ne=[`aria-label`],Pe=[`src`,`alt`];function Fe(t,n,r,i,a,o){return O(),l(`button`,{type:`button`,class:`brand-logo`,"aria-label":t.siteTitle,onClick:n[0]||=e=>t.$emit(`click`)},[e(`img`,{src:t.url,class:`brand-logo__image`,alt:t.siteTitle},null,8,Pe)],8,Ne)}var Ie=J(Me,[[`render`,Fe],[`__scopeId`,`data-v-fefbbe27`]]);export{je as i,ke as n,Ae as r,Ie as t};
|
|
1
|
+
import{A as e,B as t,G as n,Gt as r,H as i,I as a,Jt as o,K as s,Mt as c,N as l,Ot as u,Q as d,Rt as f,St as p,T as m,U as h,Vt as g,Wt as _,Y as v,ft as y,ht as b,it as x,j as S,k as C,mt as w,nt as T,p as E,pt as D,tt as O,wt as k,x as ee,z as A}from"./vendor-chart-Dw-P17PN.js";import{a as j,c as M,i as N,t as P}from"./install-Cn-SLM3u.js";import{c as te,d as F,n as I,r as L,u as R}from"./runtime-BTM7t9of.js";import{At as ne,Ct as z,R as B,_ as re,h as ie,m as V,nt as ae,ot as H,rt as U,st as W,wt as G,zt as oe}from"./use-deprecated-B-uvyrTL.js";import{t as se}from"./tooltip-Bs8w_vsQ.js";import{r as K}from"./aria-8oQuUBWy.js";import{n as ce}from"./vnode-tCZAUc1D.js";import{t as q}from"./click-outside-CPwvCpQu.js";import{t as le}from"./collapse-transition-BUGXhx7B.js";import{G as J,Gi as Y,Yi as X,ra as ue}from"./index-BrXcZpB0.js";var de=class{constructor(e,t){this.parent=e,this.domNode=t,this.subIndex=0,this.subIndex=0,this.init()}init(){this.subMenuItems=this.domNode.querySelectorAll(`li`),this.addListeners()}gotoSubIndex(e){e===this.subMenuItems.length?e=0:e<0&&(e=this.subMenuItems.length-1),this.subMenuItems[e].focus(),this.subIndex=e}addListeners(){let e=this.parent.domNode;Array.prototype.forEach.call(this.subMenuItems,t=>{t.addEventListener(`keydown`,t=>{let n=!1;switch(t.code){case X.down:this.gotoSubIndex(this.subIndex+1),n=!0;break;case X.up:this.gotoSubIndex(this.subIndex-1),n=!0;break;case X.tab:K(e,`mouseleave`);break;case X.enter:case X.numpadEnter:case X.space:n=!0,t.currentTarget.click();break}return n&&(t.preventDefault(),t.stopPropagation()),!1})})}},fe=class{constructor(e,t){this.domNode=e,this.submenu=null,this.submenu=null,this.init(t)}init(e){this.domNode.setAttribute(`tabindex`,`0`);let t=this.domNode.querySelector(`.${e}-menu`);t&&(this.submenu=new de(this,t)),this.addListeners()}addListeners(){this.domNode.addEventListener(`keydown`,e=>{let t=!1;switch(e.code){case X.down:K(e.currentTarget,`mouseenter`),this.submenu&&this.submenu.gotoSubIndex(0),t=!0;break;case X.up:K(e.currentTarget,`mouseenter`),this.submenu&&this.submenu.gotoSubIndex(this.submenu.subMenuItems.length-1),t=!0;break;case X.tab:K(e.currentTarget,`mouseleave`);break;case X.enter:case X.numpadEnter:case X.space:t=!0,e.currentTarget.click();break}t&&e.preventDefault()})}},pe=class{constructor(e,t){this.domNode=e,this.init(t)}init(e){let t=this.domNode.childNodes;Array.from(t).forEach(t=>{t.nodeType===1&&new fe(t,e)})}},me=j(A({...A({name:`ElMenuCollapseTransition`}),setup(e){let t=M(`menu`),r={onBeforeEnter:e=>e.style.opacity=`0.2`,onEnter(e,n){U(e,`${t.namespace.value}-opacity-transition`),e.style.opacity=`1`,n()},onAfterEnter(e){W(e,`${t.namespace.value}-opacity-transition`),e.style.opacity=``},onBeforeLeave(e){e.dataset||={},H(e,t.m(`collapse`))?(W(e,t.m(`collapse`)),e.dataset.oldOverflow=e.style.overflow,e.dataset.scrollWidth=e.clientWidth.toString(),U(e,t.m(`collapse`))):(U(e,t.m(`collapse`)),e.dataset.oldOverflow=e.style.overflow,e.dataset.scrollWidth=e.clientWidth.toString(),W(e,t.m(`collapse`))),e.style.width=`${e.scrollWidth}px`,e.style.overflow=`hidden`},onLeave(e){U(e,`horizontal-collapse-transition`),e.style.width=`${e.dataset.scrollWidth}px`}};return(e,t)=>(O(),S(E,n({mode:`out-in`},c(r)),{default:w(()=>[x(e.$slots,`default`)]),_:3},16))}}),[[`__file`,`menu-collapse-transition.vue`]]);function he(e,t){let n=C(()=>{let n=e.parent,r=[t.value];for(;n.type.name!==`ElMenu`;)n.props.index&&r.unshift(n.props.index),n=n.parent;return r});return{parentMenu:C(()=>{let t=e.parent;for(;t&&![`ElMenu`,`ElSubMenu`].includes(t.type.name);)t=t.parent;return t}),indexPath:n}}function ge(e){return C(()=>{let t=e.backgroundColor;return t?new Y(t).shade(20).toString():``})}var _e=(e,t)=>{let n=M(`menu`);return C(()=>n.cssVarBlock({"text-color":e.textColor||``,"hover-text-color":e.textColor||``,"bg-color":e.backgroundColor||``,"hover-bg-color":ge(e).value||``,"active-color":e.activeTextColor||``,level:`${t}`}))},Z=`rootMenu`,Q=`subMenu:`,ve=I({index:{type:String,required:!0},showTimeout:Number,hideTimeout:Number,popperClass:String,disabled:Boolean,teleported:{type:Boolean,default:void 0},popperOffset:Number,expandCloseIcon:{type:V},expandOpenIcon:{type:V},collapseCloseIcon:{type:V},collapseOpenIcon:{type:V}}),ye=`ElSubMenu`,be=A({name:ye,props:ve,setup(e,{slots:n,expose:r}){let a=t(),{indexPath:o,parentMenu:s}=he(a,C(()=>e.index)),c=M(`menu`),l=M(`sub-menu`),u=h(Z);u||G(ye,`can not inject root menu`);let f=h(`${Q}${s.value.uid}`);f||G(ye,`can not inject sub menu`);let g=k({}),x=k({}),S,w=k(!1),E=k(),D=k(),O=C(()=>L.value===`horizontal`&&j.value?`bottom-start`:`right-start`),A=C(()=>L.value===`horizontal`&&j.value||L.value===`vertical`&&!u.props.collapse?e.expandCloseIcon&&e.expandOpenIcon?F.value?e.expandOpenIcon:e.expandCloseIcon:ie:e.collapseCloseIcon&&e.collapseOpenIcon?F.value?e.collapseOpenIcon:e.collapseCloseIcon:re),j=C(()=>f.level===0),N=C(()=>{let t=e.teleported;return R(t)?j.value:t}),P=C(()=>u.props.collapse?`${c.namespace.value}-zoom-in-left`:`${c.namespace.value}-zoom-in-top`),te=C(()=>L.value===`horizontal`&&j.value?[`bottom-start`,`bottom-end`,`top-start`,`top-end`,`right-start`,`left-start`]:[`right-start`,`right`,`right-end`,`left-start`,`bottom-start`,`bottom-end`,`top-start`,`top-end`]),F=C(()=>u.openedMenus.includes(e.index)),I=C(()=>[...Object.values(g.value),...Object.values(x.value)].some(({active:e})=>e)),L=C(()=>u.props.mode),ne=C(()=>u.props.persistent),z=p({index:e.index,indexPath:o,active:I}),B=_e(u.props,f.level+1),V=C(()=>e.popperOffset??u.props.popperOffset),H=C(()=>e.popperClass??u.props.popperClass),U=C(()=>e.showTimeout??u.props.showTimeout),W=C(()=>e.hideTimeout??u.props.hideTimeout),K=()=>(D.value?.popperRef?.popperInstanceRef)?.destroy(),ce=e=>{e||K()},q=()=>{u.props.menuTrigger===`hover`&&u.props.mode===`horizontal`||u.props.collapse&&u.props.mode===`vertical`||e.disabled||u.handleSubMenuClick({index:e.index,indexPath:o.value,active:I.value})},J=(t,n=U.value)=>{var r;if(t.type!==`focus`){if(u.props.menuTrigger===`click`&&u.props.mode===`horizontal`||!u.props.collapse&&u.props.mode===`vertical`||e.disabled){f.mouseInChild.value=!0;return}f.mouseInChild.value=!0,S?.(),{stop:S}=oe(()=>{u.openMenu(e.index,o.value)},n),N.value&&((r=s.value.vnode.el)==null||r.dispatchEvent(new MouseEvent(`mouseenter`)))}},Y=(t=!1)=>{var n;if(u.props.menuTrigger===`click`&&u.props.mode===`horizontal`||!u.props.collapse&&u.props.mode===`vertical`){f.mouseInChild.value=!1;return}S?.(),f.mouseInChild.value=!1,{stop:S}=oe(()=>!w.value&&u.closeMenu(e.index,o.value),W.value),N.value&&t&&((n=f.handleMouseleave)==null||n.call(f,!0))};return y(()=>u.props.collapse,e=>ce(!!e)),T(`${Q}${a.uid}`,{addSubMenu:e=>{x.value[e.index]=e},removeSubMenu:e=>{delete x.value[e.index]},handleMouseleave:Y,mouseInChild:w,level:f.level+1}),r({opened:F}),d(()=>{u.addSubMenu(z),f.addSubMenu(z)}),v(()=>{f.removeSubMenu(z),u.removeSubMenu(z)}),()=>{let t=[n.title?.call(n),i(ae,{class:l.e(`icon-arrow`),style:{transform:F.value?e.expandCloseIcon&&e.expandOpenIcon||e.collapseCloseIcon&&e.collapseOpenIcon&&u.props.collapse?`none`:`rotateZ(180deg)`:`none`}},{default:()=>_(A.value)?i(a.appContext.components[A.value]):i(A.value)})],r=u.isMenuPopup?i(se,{ref:D,visible:F.value,effect:`light`,pure:!0,offset:V.value,showArrow:!1,persistent:ne.value,popperClass:H.value,placement:O.value,teleported:N.value,fallbackPlacements:te.value,transition:P.value,gpuAcceleration:!1},{content:()=>i(`div`,{class:[c.m(L.value),c.m(`popup-container`),H.value],onMouseenter:e=>J(e,100),onMouseleave:()=>Y(!0),onFocus:e=>J(e,100)},[i(`ul`,{class:[c.b(),c.m(`popup`),c.m(`popup-${O.value}`)],style:B.value},[n.default?.call(n)])]),default:()=>i(`div`,{class:l.e(`title`),onClick:q},t)}):i(m,{},[i(`div`,{class:l.e(`title`),ref:E,onClick:q},t),i(le,{},{default:()=>b(i(`ul`,{role:`menu`,class:[c.b(),c.m(`inline`)],style:B.value},[n.default?.call(n)]),[[ee,F.value]])})]);return i(`li`,{class:[l.b(),l.is(`active`,I.value),l.is(`opened`,F.value),l.is(`disabled`,e.disabled)],role:`menuitem`,ariaHaspopup:!0,ariaExpanded:F.value,onMouseenter:J,onMouseleave:()=>Y(),onFocus:J},[r])}}}),xe=I({mode:{type:String,values:[`horizontal`,`vertical`],default:`vertical`},defaultActive:{type:String,default:``},defaultOpeneds:{type:L(Array),default:()=>ue([])},uniqueOpened:Boolean,router:Boolean,menuTrigger:{type:String,values:[`hover`,`click`],default:`hover`},collapse:Boolean,backgroundColor:String,textColor:String,activeTextColor:String,closeOnClickOutside:Boolean,collapseTransition:{type:Boolean,default:!0},ellipsis:{type:Boolean,default:!0},popperOffset:{type:Number,default:6},ellipsisIcon:{type:V,default:()=>B},popperEffect:{type:L(String),default:`dark`},popperClass:String,showTimeout:{type:Number,default:300},hideTimeout:{type:Number,default:300},persistent:{type:Boolean,default:!0}}),Se=e=>f(e)&&e.every(e=>_(e)),Ce=A({name:`ElMenu`,props:xe,emits:{close:(e,t)=>_(e)&&Se(t),open:(e,t)=>_(e)&&Se(t),select:(e,t,n,r)=>_(e)&&Se(t)&&g(n)&&(R(r)||r instanceof Promise)},setup(e,{emit:n,slots:r,expose:a}){let o=t(),c=o.appContext.config.globalProperties.$router,l=k(),u=M(`menu`),f=M(`sub-menu`),m=k(-1),h=k(e.defaultOpeneds&&!e.collapse?e.defaultOpeneds.slice(0):[]),g=k(e.defaultActive),_=k({}),v=k({}),x=C(()=>e.mode===`horizontal`||e.mode===`vertical`&&e.collapse),S=()=>{let t=g.value&&_.value[g.value];!t||e.mode===`horizontal`||e.collapse||t.indexPath.forEach(e=>{let t=v.value[e];t&&w(e,t.indexPath)})},w=(t,r)=>{h.value.includes(t)||(e.uniqueOpened&&(h.value=h.value.filter(e=>r.includes(e))),h.value.push(t),n(`open`,t,r))},E=e=>{let t=h.value.indexOf(e);t!==-1&&h.value.splice(t,1)},O=(e,t)=>{E(e),n(`close`,e,t)},ee=({index:e,indexPath:t})=>{h.value.includes(e)?O(e,t):w(e,t)},A=t=>{(e.mode===`horizontal`||e.collapse)&&(h.value=[]);let{index:r,indexPath:i}=t;if(!(F(r)||F(i)))if(e.router&&c){let e=t.route||r,a=c.push(e).then(e=>(e||(g.value=r),e));n(`select`,r,i,{index:r,indexPath:i,route:e},a)}else g.value=r,n(`select`,r,i,{index:r,indexPath:i})},j=t=>{let n=_.value;g.value=(n[t]||g.value&&n[g.value]||n[e.defaultActive])?.index??t},N=e=>{let t=getComputedStyle(e),n=Number.parseInt(t.marginLeft,10),r=Number.parseInt(t.marginRight,10);return e.offsetWidth+n+r||0},P=()=>{if(!l.value)return-1;let e=Array.from(l.value?.childNodes??[]).filter(e=>e.nodeName!==`#text`||e.nodeValue),t=getComputedStyle(l.value),n=Number.parseInt(t.paddingLeft,10),r=Number.parseInt(t.paddingRight,10),i=l.value.clientWidth-n-r,a=0,o=0;return e.forEach((e,t)=>{e.nodeName!==`#comment`&&(a+=N(e),a<=i-64&&(o=t+1))}),o===e.length?-1:o},te=e=>v.value[e].indexPath,I=(e,t=33.34)=>{let n;return()=>{n&&clearTimeout(n),n=setTimeout(()=>{e()},t)}},L=!0,R=()=>{if(m.value===P())return;let e=()=>{m.value=-1,s(()=>{m.value=P()})};L?e():I(e)(),L=!1};y(()=>e.defaultActive,e=>{_.value[e]||(g.value=``),j(e)}),y(()=>e.collapse,e=>{e&&(h.value=[])}),y(_.value,S);let z;D(()=>{e.mode===`horizontal`&&e.ellipsis?z=ne(l,R).stop:z?.()});let B=k(!1);{let t=e=>{v.value[e.index]=e},n=e=>{delete v.value[e.index]};T(Z,p({props:e,openedMenus:h,items:_,subMenus:v,activeIndex:g,isMenuPopup:x,addMenuItem:e=>{_.value[e.index]=e},removeMenuItem:e=>{delete _.value[e.index]},addSubMenu:t,removeSubMenu:n,openMenu:w,closeMenu:O,handleMenuItemClick:A,handleSubMenuClick:ee})),T(`${Q}${o.uid}`,{addSubMenu:t,removeSubMenu:n,mouseInChild:B,level:0})}d(()=>{e.mode===`horizontal`&&new pe(o.vnode.el,u.namespace.value)}),a({open:e=>{let{indexPath:t}=v.value[e];t.forEach(e=>w(e,t))},close:E,updateActiveIndex:j,handleResize:R});let re=_e(e,0);return()=>{let t=r.default?.call(r)??[],a=[];if(e.mode===`horizontal`&&l.value){let n=ce(t),r=m.value===-1?n:n.slice(0,m.value),o=m.value===-1?[]:n.slice(m.value);o?.length&&e.ellipsis&&(t=r,a.push(i(be,{index:`sub-menu-more`,class:f.e(`hide-arrow`),popperOffset:e.popperOffset},{title:()=>i(ae,{class:f.e(`icon-more`)},{default:()=>i(e.ellipsisIcon)}),default:()=>o})))}let o=e.closeOnClickOutside?[[q,()=>{h.value.length&&(B.value||(h.value.forEach(e=>n(`close`,e,te(e))),h.value=[]))}]]:[],s=b(i(`ul`,{key:String(e.collapse),role:`menubar`,ref:l,style:re.value,class:{[u.b()]:!0,[u.m(e.mode)]:!0,[u.m(`collapse`)]:e.collapse}},[...t,...a]),o);return e.collapseTransition&&e.mode===`vertical`?i(me,()=>s):s}}}),we=I({index:{type:L([String,null]),default:null},route:{type:L([String,Object])},disabled:Boolean}),Te={click:e=>_(e.index)&&f(e.indexPath)},$=`ElMenuItem`,Ee=j(A({...A({name:$}),props:we,emits:Te,setup(n,{expose:i,emit:a}){let o=n;te(o.index)&&z($,`Missing required prop: "index"`);let s=t(),f=h(Z),g=M(`menu`),_=M(`menu-item`);f||G($,`can not inject root menu`);let{parentMenu:y,indexPath:b}=he(s,u(o,`index`)),T=h(`${Q}${y.value.uid}`);T||G($,`can not inject sub menu`);let E=C(()=>o.index===f.activeIndex),D=p({index:o.index,indexPath:b,active:E}),k=()=>{o.disabled||(f.handleMenuItemClick({index:o.index,indexPath:b.value,route:o.route}),a(`click`,D))};return d(()=>{T.addSubMenu(D),f.addMenuItem(D)}),v(()=>{T.removeSubMenu(D),f.removeMenuItem(D)}),i({parentMenu:y,rootMenu:f,active:E,nsMenu:g,nsMenuItem:_,handleClick:k}),(t,n)=>(O(),l(`li`,{class:r([c(_).b(),c(_).is(`active`,c(E)),c(_).is(`disabled`,t.disabled)]),role:`menuitem`,tabindex:`-1`,onClick:k},[c(y).type.name===`ElMenu`&&c(f).props.collapse&&t.$slots.title?(O(),S(c(se),{key:0,effect:c(f).props.popperEffect,placement:`right`,"fallback-placements":[`left`],persistent:c(f).props.persistent},{content:w(()=>[x(t.$slots,`title`)]),default:w(()=>[e(`div`,{class:r(c(g).be(`tooltip`,`trigger`))},[x(t.$slots,`default`)],2)]),_:3},8,[`effect`,`persistent`])):(O(),l(m,{key:1},[x(t.$slots,`default`),x(t.$slots,`title`)],64))],2))}}),[[`__file`,`menu-item.vue`]]),De={title:String},Oe=j(A({...A({name:`ElMenuItemGroup`}),props:De,setup(t){let n=M(`menu-item-group`);return(t,i)=>(O(),l(`li`,{class:r(c(n).b())},[e(`div`,{class:r(c(n).e(`title`))},[t.$slots.title?x(t.$slots,`title`,{key:1}):(O(),l(m,{key:0},[a(o(t.title),1)],64))],2),e(`ul`,null,[x(t.$slots,`default`)])],2))}}),[[`__file`,`menu-item-group.vue`]]),ke=P(Ce,{MenuItem:Ee,MenuItemGroup:Oe,SubMenu:be}),Ae=N(Ee);N(Oe);var je=N(be),Me=A({props:{collapsed:{type:Boolean,default:!1}},emits:[`click`],computed:{siteTitle(){return this.$store.state.site?.title||`AceData`},url(){let e=this.$store.state.site,t=`https://platform.acedata.cloud/favicon.ico`;return this.collapsed?e?.favicon||e?.logo||t:e?.logo||e?.favicon||t}}}),Ne=[`aria-label`],Pe=[`src`,`alt`];function Fe(t,n,r,i,a,o){return O(),l(`button`,{type:`button`,class:`brand-logo`,"aria-label":t.siteTitle,onClick:n[0]||=e=>t.$emit(`click`)},[e(`img`,{src:t.url,class:`brand-logo__image`,alt:t.siteTitle},null,8,Pe)],8,Ne)}var Ie=J(Me,[[`render`,Fe],[`__scopeId`,`data-v-fefbbe27`]]);export{je as i,ke as n,Ae as r,Ie as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,at as o,j as s,k as c,mt as l,tt as u,z as d}from"./vendor-chart-Dw-P17PN.js";import{t as f}from"./Navigator-
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,I as t,Jt as n,L as r,M as i,N as a,at as o,j as s,k as c,mt as l,tt as u,z as d}from"./vendor-chart-Dw-P17PN.js";import{t as f}from"./Navigator-C8W-E8HW.js";import{t as p}from"./checkbox-ChInsWN4.js";import{t as m}from"./divider-BNWJAaA2.js";import"./constants-D8dwgBQJ.js";import{Fi as h,G as g,Mi as _,Tr as v,Ui as y,gi as b,hi as x,sn as S,vi as C,xi as w}from"./index-BrXcZpB0.js";import{t as T}from"./Status-BJGtNUh3.js";var E=d({name:`ApplicationConfirm`,components:{ElDialog:h,ElDivider:m,ElCheckbox:p,ElButton:y},props:{visible:{type:Boolean,required:!1,default:!1}},emits:[`update:visible`,`apply`],data(){return{checked:!0}},watch:{},methods:{getBaseUrlPlatform:w,onApply(){if(!this.checked){_.error(this.$t(`application.message.notAgreePolicy`));return}this.$emit(`apply`)}}}),D={class:`content py-[10px] px-[40px]`},O={class:`my-4`},k={class:`policy mb-[10px]`},A={class:`policy-title text-[12px] relative -bottom-[3px]`},j=[`href`];function M(i,a,c,d,f,p){let m=o(`el-divider`),h=o(`el-checkbox`),g=o(`el-button`),_=o(`el-dialog`);return u(),s(_,{"model-value":i.visible,width:`500px`,title:i.$t(`application.message.welcome`),center:``,onClose:a[1]||=e=>i.$emit(`update:visible`,!1)},{default:l(()=>[e(`div`,D,[e(`p`,O,n(i.$t(`application.message.notApplied`)),1),r(m,{class:`my-2`}),e(`div`,k,[r(h,{modelValue:i.checked,"onUpdate:modelValue":a[0]||=e=>i.checked=e,size:`large`,class:`policy-checkbox mr-[10px]`},null,8,[`modelValue`]),e(`span`,A,n(i.$t(`application.message.readPolicy`)),1),e(`a`,{class:`policy-title text-[12px] relative -bottom-[3px] text-[var(--el-color-primary)] cursor-pointer no-underline`,target:`_blank`,href:i.getBaseUrlPlatform()+`/terms`},` \xA0`+n(i.$t(`application.message.policy`)),9,j)]),r(g,{round:``,type:`primary`,onClick:i.onApply},{default:l(()=>[t(n(i.$t(`common.button.start`)),1)]),_:1},8,[`onClick`])])]),_:1},8,[`model-value`,`title`])}var N=g(E,[[`render`,M]]),P=15e3,F=d({name:`LayoutMain`,components:{Navigator:f,ApplicationStatus:T,ApplicationConfirm:N},provide(){return{initialized:c(()=>this.initialized)}},data(){return{initialized:!1,applying:!1,mobile:typeof window<`u`&&window.innerWidth<768,initializeRunId:0,balanceTimer:0}},computed:{appName(){return this.$route.meta.appName},application(){return this.$store.state[this.appName]?.application},applications(){let e=this.$store.state[this.appName]?.applications??[];console.debug(`individualApplications`,e);let t=this.$store.state.applications??[];return console.debug(`globalApplications`,t),t.concat(e)},loading(){return this.$store.state[this.appName]?.status?.getApplications===C.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=S(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 v.create({type:b.USAGE,scope:x.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`):_.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`;_({message:t>0?this.$t(`application.message.welcomeWithCredits`,{credits:t,brand:n}):this.$t(`application.message.welcomeNoCredits`,{brand:n}),type:`success`,duration:6e3,showClose:!0})}}}),I={class:`wrapper`};function L(e,t,n,c,l,d){let f=o(`router-view`),p=o(`navigator`),m=o(`application-status`),h=o(`application-confirm`);return u(),a(`div`,I,[r(f,{class:`main`}),r(p,{class:`navigator`,direction:e.mobile?`row`:`column`},null,8,[`direction`]),e.application?(u(),s(m,{key:0,class:`status-floating fixed right-2 z-[200]`,application:e.application,applications:e.applications,"show-price":!1,authenticated:!!e.$store.state.token.access,service:e.service,onSelect:t[0]||=t=>e.$store.dispatch(`${e.appName}/setApplication`,t)},null,8,[`application`,`applications`,`authenticated`,`service`])):i(``,!0),r(h,{modelValue:e.applying,"onUpdate:modelValue":t[1]||=t=>e.applying=t,modelModifiers:{visible:!0},onApply:e.onApply},null,8,[`modelValue`,`onApply`])])}var R=g(F,[[`render`,L],[`__scopeId`,`data-v-334ded1d`]]);export{R as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
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,S as c,T as l,at as u,ft as d,ht as f,j as p,k as m,mt as h,ot as g,rt as _,tt as v,wt as y,x as b,z as x}from"./vendor-chart-Dw-P17PN.js";import{I as S,S as C,_ as w,nt as T,w as E}from"./use-deprecated-B-uvyrTL.js";import{t as D}from"./tooltip-DAEtFoXl.js";import{t as O}from"./image-BjapOX8j.js";import{n as k,t as A}from"./checkbox-ChInsWN4.js";import{t as j}from"./popover-CQqNDogj.js";import{_a as M,da as N,fa as P,ga as F,ha as I,la as L,pa as R,ua as z,va as ee,ya as te}from"./constants-BYU0Mi8o.js";import{o as ne}from"./i18n-CczuUNCK.js";import{An as re,Cr as ie,Er as B,Fi as ae,G as V,Mi as oe,Qi as se,Ti as ce,Ui as H,bi as U,dn as le,it as ue,mi as de,un as fe,xr as pe}from"./index-s1lrp6nN.js";import"./vendor-highlight-BtIeKitL.js";import{t as W}from"./index.es-BtwnN9TZ.js";import{t as me}from"./CopyToClipboard-Bk1nRi-n.js";import{n as he,t as ge}from"./AskUserQuestionCard-BfBsfiHC.js";import{t as _e}from"./FilePreview-CMTQuorI.js";var ve=x({name:`AnsweringMark`,data(){return{}},computed:{conversationId(){return this.$route.params?.id?.toString()}}}),ye={class:`mark`};function be(e,t,n,r,i,a){return v(),s(`div`,ye)}var xe=V(ve,[[`render`,be]]),Se=x({name:`CitationCard`,components:{FontAwesomeIcon:W},props:{citation:{type:Object,required:!0}},data(){return{iconFailed:!1}},computed:{displayUrl(){try{let e=new URL(this.citation.url);return e.host+(e.pathname&&e.pathname!==`/`?e.pathname:``)}catch{return this.citation.url}},hostLabel(){try{return new URL(this.citation.url).host.replace(/^www\./,``)}catch{return``}},resolvedIcon(){if(this.iconFailed)return``;if(this.citation.icon)return this.citation.icon;try{let e=new URL(this.citation.url).host;return e?`https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=64`:``}catch{return``}},fallbackIcon(){let e=(this.citation.type||``).toLowerCase();return e===`file`?`fa-solid fa-file-lines`:e===`page`?`fa-solid fa-file`:e===`issue`?`fa-solid fa-circle-dot`:e===`email`?`fa-solid fa-envelope`:e===`message`?`fa-solid fa-message`:e===`web`?`fa-solid fa-globe`:`fa-solid fa-link`}},methods:{onIconError(){this.iconFailed=!0}}}),Ce=[`href`],we={class:`head`},Te=[`src`,`alt`],Ee={key:2,class:`source`},De={key:0,class:`title`},Oe={key:1,class:`snippet`},ke={class:`url`};function Ae(t,n,r,a,c,l){let d=u(`font-awesome-icon`);return v(),s(`a`,{class:`citation-card`,href:t.citation.url,target:`_blank`,rel:`noopener noreferrer`},[e(`div`,we,[t.resolvedIcon?(v(),s(`img`,{key:0,src:t.resolvedIcon,alt:t.citation.source||``,class:`icon`,referrerpolicy:`no-referrer`,loading:`lazy`,onError:n[0]||=(...e)=>t.onIconError&&t.onIconError(...e)},null,40,Te)):(v(),p(d,{key:1,icon:t.fallbackIcon,class:`icon-fallback`},null,8,[`icon`])),t.citation.source||t.hostLabel?(v(),s(`span`,Ee,i(t.citation.source||t.hostLabel),1)):o(``,!0)]),t.citation.title?(v(),s(`div`,De,i(t.citation.title),1)):o(``,!0),t.citation.snippet?(v(),s(`div`,Oe,i(t.citation.snippet),1)):o(``,!0),e(`div`,ke,i(t.displayUrl),1)],8,Ce)}var je=V(Se,[[`render`,Ae],[`__scopeId`,`data-v-36c9d5dc`]]),Me=/\[\^acite:([A-Za-z0-9_-]{1,32})\]/g,Ne=x({name:`MarkdownRenderer`,directives:{highlight:fe},components:{VueMarkdown:he,CitationCard:je,ElPopover:j},props:{content:{type:String,required:!1,default:``},citations:{type:Object,required:!1,default:()=>({})}},data(){return{hoveredCitation:null,popoverAnchor:null,popoverVisible:!1}},computed:{enrichedContent(){let e=this.content||``;if(!e.includes(`[^acite:`))return e;let t=this.citations||{};return e.replace(Me,(e,n)=>{let r=t[n];return r?Fe(n,r):``})}},methods:{onChipHover(e){let t=e.target;if(!t)return;let n=t.closest(`.citation-chip`);if(!n){this.popoverVisible=!1;return}let r=n.dataset.citationId;if(!r)return;let i=(this.citations||{})[r];i&&(this.hoveredCitation=i,this.popoverAnchor=n,this.popoverVisible=!0)},onChipLeave(){this.popoverVisible=!1}}});function Pe(e){let t=e.source||(()=>{try{return new URL(e.url).host.replace(/^www\./,``)}catch{return``}})()||e.title||`source`;return t.length>24?t.slice(0,23)+`…`:t}function G(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/</g,`<`).replace(/>/g,`>`)}function Fe(e,t){let n=G(e),r=G(t.title||t.source||t.url||e),i=G(Pe(t)),a=t.url?` href="${G(t.url)}"`:``;return[`<span class="citation-chip" data-citation-id="${n}" title="${r}">`,`<a class="citation-chip__link"${a} target="_blank" rel="noopener noreferrer" tabindex="-1">`,`<span class="citation-chip__label">${i}</span>`,`</a>`,`</span>`].join(``)}var Ie={class:`markdown-with-citations`};function Le(e,t,n,r,i,c){let l=u(`vue-markdown`),d=u(`citation-card`),m=u(`el-popover`),_=g(`highlight`);return v(),s(`div`,Ie,[f(a(l,{source:e.enrichedContent,class:`markdown-body bg-transparent pt-[3px] text-[inherit]`,onMouseover:e.onChipHover,onMouseleave:e.onChipLeave},null,8,[`source`,`onMouseover`,`onMouseleave`]),[[_]]),e.hoveredCitation&&e.popoverAnchor?(v(),p(m,{key:0,"virtual-ref":e.popoverAnchor,"virtual-triggering":``,trigger:`hover`,visible:e.popoverVisible,placement:`top`,width:340,"popper-class":`citation-popover`,"show-arrow":!0,"hide-after":120},{default:h(()=>[a(d,{citation:e.hoveredCitation},null,8,[`citation`])]),_:1},8,[`virtual-ref`,`visible`])):o(``,!0)])}var K=V(Ne,[[`render`,Le],[`__scopeId`,`data-v-f3f2e7ba`]]),Re=x({name:`CopyToClipboard`,components:{FontAwesomeIcon:W,ElTooltip:D},props:{messages:{type:Array,required:!1,default:()=>[]}},emits:[`restart`],data(){return{copied:!1}},methods:{onRestart(){this.$emit(`restart`)}}});function ze(e,t,n,r,i,o){let s=u(`font-awesome-icon`),c=u(`el-tooltip`);return v(),p(c,{effect:`dark`,content:e.$t(`common.button.restart`),placement:`bottom`},{default:h(()=>[a(s,{icon:`fa-solid fa-sync`,class:`icon-sync`,onClick:e.onRestart},null,8,[`onClick`])]),_:1},8,[`content`])}var Be=V(Re,[[`render`,ze],[`__scopeId`,`data-v-90e169cb`]]),Ve=x({name:`EditMessage`,components:{FontAwesomeIcon:W,ElTooltip:D},props:{messages:{type:Array,required:!1,default:()=>[]}},emits:[`click`],data(){return{copied:!1}},methods:{onEdit(){this.$emit(`click`)}}});function He(e,t,n,r,i,o){let c=u(`font-awesome-icon`),l=u(`el-tooltip`);return v(),s(`span`,null,[a(l,{effect:`dark`,content:e.$t(`common.button.restart`),placement:`bottom`},{default:h(()=>[a(c,{icon:`fa-solid fa-edit`,class:`icon icon-edit`,onClick:e.onEdit},null,8,[`onClick`])]),_:1},8,[`content`])])}var Ue=V(Ve,[[`render`,He],[`__scopeId`,`data-v-8e947e8f`]]),We={code_execute:`Running code`,web_search:`Searching the web`,image_generate:`Generating image`,video_generate:`Generating video`,music_generate:`Generating music`},Ge=x({name:`ToolActivity`,components:{Loading:S,CircleCheckFilled:C,CircleCloseFilled:E,ArrowRight:w},props:{item:{type:Object,required:!0}},data(){return{expanded:!1}},computed:{displayName(){if(this.item.tool_display_name)return this.item.tool_display_name;let e=this.item.tool_name||``;return We[e]||e.replace(/_/g,` `)},inputText(){let e=this.item.input;return e&&Object.keys(e).length>0?this.item.tool_name===`code_execute`?e.code||``:this.item.tool_name===`web_search`?e.query||``:JSON.stringify(e,null,2):this.item.input_stream||``}}}),Ke={class:`tool-icon`},qe={class:`tool-name`},Je={key:0,class:`tool-duration`},Ye={key:0,class:`tool-body`},Xe={key:0,class:`tool-section`},Ze={class:`tool-code`},Qe={key:1,class:`tool-section`},$e={class:`tool-code`};function et(t,r,c,l,d,f){let m=u(`Loading`),g=u(`el-icon`),_=u(`CircleCloseFilled`),y=u(`CircleCheckFilled`),b=u(`ArrowRight`);return v(),s(`div`,{class:n([`tool-activity`,{"is-error":t.item.is_error,"is-running":t.item.status===`running`}])},[e(`div`,{class:`tool-header`,onClick:r[0]||=e=>t.expanded=!t.expanded},[e(`span`,Ke,[t.item.status===`running`?(v(),p(g,{key:0,class:`is-loading`},{default:h(()=>[a(m)]),_:1})):t.item.is_error?(v(),p(g,{key:1,color:`var(--el-color-danger)`},{default:h(()=>[a(_)]),_:1})):(v(),p(g,{key:2,color:`var(--el-color-success)`},{default:h(()=>[a(y)]),_:1}))]),e(`span`,qe,i(t.displayName),1),t.item.duration_ms?(v(),s(`span`,Je,i(t.item.duration_ms)+`ms`,1)):o(``,!0),a(g,{class:n([`tool-expand`,{rotated:t.expanded}])},{default:h(()=>[a(b)]),_:1},8,[`class`])]),t.expanded?(v(),s(`div`,Ye,[t.inputText?(v(),s(`div`,Xe,[r[1]||=e(`div`,{class:`tool-section-label`},`Input`,-1),e(`pre`,Ze,i(t.inputText),1)])):o(``,!0),t.item.output?(v(),s(`div`,Qe,[r[2]||=e(`div`,{class:`tool-section-label`},`Output`,-1),e(`pre`,$e,i(t.item.output),1)])):o(``,!0)])):o(``,!0)],2)}var tt=V(Ge,[[`render`,et],[`__scopeId`,`data-v-cf12a99f`]]),nt=new Set([`completed`,`denied`,`expired`,`cancel_too_late`]),rt=x({name:`BrowserToolActivity`,components:{FontAwesomeIcon:W},props:{item:{type:Object,required:!0}},computed:{state(){return pe(this.item.execution_state)?this.item.execution_state:`awaiting_device`},title(){return this.item.tool_display_name||this.item.tool_name?.replace(/_/g,` `)||this.$t(`chat.browserTool.title`)},origin(){return ie(this.item.origin)},icon(){return this.state===`completed`?`fa-solid fa-check`:this.state===`denied`||this.state===`expired`?`fa-solid fa-xmark`:this.state===`executing`?`fa-solid fa-spinner`:nt.has(this.state)?`fa-solid fa-triangle-exclamation`:`fa-solid fa-globe`}}}),it={class:`activity-icon`,"aria-hidden":`true`},at={class:`activity-copy`},ot={class:`activity-title`},st={class:`activity-status`},ct={key:0,class:`activity-origin`};function lt(t,r,c,l,d,f){let p=u(`font-awesome-icon`);return v(),s(`div`,{class:n([`browser-tool-activity`,`state-${t.state}`]),role:`status`,"aria-live":`polite`},[e(`div`,it,[a(p,{icon:t.icon,spin:t.state===`executing`},null,8,[`icon`,`spin`])]),e(`div`,at,[e(`div`,ot,i(t.title),1),e(`div`,st,i(t.$t(`chat.browserTool.state.${t.state}`)),1),t.origin?(v(),s(`div`,ct,i(t.origin),1)):o(``,!0)])],2)}var ut=V(rt,[[`render`,lt],[`__scopeId`,`data-v-124994f3`]]),dt=x({name:`EntityCard`,components:{ElImage:O,FontAwesomeIcon:W},props:{card:{type:Object,required:!0}},data(){return{mediaFailed:!1}},computed:{cardType(){if(this.mediaFailed)return`file`;let e=(this.card.type||``).toLowerCase();return e===`audio`||e===`image`?e:e===`video`||e===`embed`?`video`:this.card.mimeType?.startsWith(`audio/`)?`audio`:this.card.mimeType?.startsWith(`video/`)?`video`:this.card.mimeType?.startsWith(`image/`)?`image`:`file`},mediaKey(){return[this.card.url,this.card.type,this.card.mimeType||``].join(`\0`)},videoUsesIframe(){if((this.card.type||``).toLowerCase()===`embed`)return!0;try{return new URL(this.card.url).pathname.split(`/`).includes(`embed`)}catch{return!1}},formattedDuration(){let e=this.card.duration??0;return!Number.isFinite(e)||e<=0?``:`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`},cleanFileName(){try{let e=new URL(this.card.url),t=e.pathname.split(`/`).filter(Boolean);return decodeURIComponent(t[t.length-1]||e.hostname)}catch{return this.card.url}},hostname(){try{return new URL(this.card.url).hostname}catch{return``}},fileIcon(){let e=(this.card.mimeType||``).toLowerCase();return e.includes(`pdf`)?`fa-solid fa-file-pdf`:e.includes(`word`)||e.includes(`msword`)?`fa-solid fa-file-word`:e.includes(`sheet`)||e.includes(`excel`)||e.includes(`csv`)?`fa-solid fa-file-excel`:e.includes(`zip`)||e.includes(`compressed`)?`fa-solid fa-file-zipper`:e.startsWith(`text/`)?`fa-solid fa-file-lines`:`fa-solid fa-file`}},watch:{mediaKey(){this.mediaFailed=!1}},methods:{onMediaError(){this.mediaFailed=!0}}}),ft={key:0,class:`audio-card`},pt={key:0,class:`thumb`},mt=[`src`,`alt`],ht={class:`meta`},gt=[`title`],_t={key:1,class:`sub`},vt=[`src`],yt={class:`actions`},bt=[`href`],xt={key:1,class:`video-card`},St={class:`frame`},Ct=[`src`,`title`],wt=[`src`],Tt={key:0,class:`meta`},Et=[`title`],Dt={key:1,class:`sub`},Ot={key:2,class:`image-card`},kt=[`title`],At=[`href`,`title`],jt={class:`info`},Mt={class:`title`},Nt={class:`sub`};function Pt(t,c,l,d,f,p){let m=u(`font-awesome-icon`),g=u(`el-image`);return v(),s(`div`,{class:n([`entity-card`,`entity-card--${t.cardType}`])},[t.cardType===`audio`?(v(),s(`div`,ft,[t.card.thumbnail?(v(),s(`div`,pt,[e(`img`,{src:t.card.thumbnail,alt:t.card.title||``},null,8,mt)])):o(``,!0),e(`div`,ht,[t.card.title?(v(),s(`div`,{key:0,class:`title`,title:t.card.title},i(t.card.title),9,gt)):o(``,!0),t.card.duration?(v(),s(`div`,_t,i(t.formattedDuration),1)):o(``,!0),e(`audio`,{class:`player`,controls:``,preload:`metadata`,src:t.card.url,onError:c[0]||=(...e)=>t.onMediaError&&t.onMediaError(...e)},null,40,vt),e(`div`,yt,[e(`a`,{class:`download`,href:t.card.url,target:`_blank`,rel:`noopener noreferrer`},[a(m,{icon:`fa-solid fa-arrow-down`}),r(` `+i(t.$t(`common.button.download`)),1)],8,bt)])])])):t.cardType===`video`?(v(),s(`div`,xt,[e(`div`,St,[t.videoUsesIframe?(v(),s(`iframe`,{key:0,class:`player`,src:t.card.url,title:t.card.title||``,frameborder:`0`,loading:`lazy`,referrerpolicy:`strict-origin-when-cross-origin`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowfullscreen:``,onError:c[1]||=(...e)=>t.onMediaError&&t.onMediaError(...e)},null,40,Ct)):(v(),s(`video`,{key:1,class:`player`,controls:``,preload:`metadata`,src:t.card.url,onError:c[2]||=(...e)=>t.onMediaError&&t.onMediaError(...e)},null,40,wt))]),t.card.title||t.card.duration?(v(),s(`div`,Tt,[t.card.title?(v(),s(`span`,{key:0,class:`title`,title:t.card.title},i(t.card.title),9,Et)):o(``,!0),t.card.duration?(v(),s(`span`,Dt,i(t.formattedDuration),1)):o(``,!0)])):o(``,!0)])):t.cardType===`image`?(v(),s(`div`,Ot,[a(g,{src:t.card.url,alt:t.card.alt||t.card.title||``,fit:`contain`,class:`image`,"preview-src-list":[t.card.url],"initial-index":0,"hide-on-click-modal":!0,"preview-teleported":!0,onError:t.onMediaError},{placeholder:h(()=>[...c[3]||=[e(`div`,{class:`image-placeholder`},null,-1)]]),error:h(()=>[...c[4]||=[e(`div`,{class:`image-placeholder image-placeholder--error`},null,-1)]]),_:1},8,[`src`,`alt`,`preview-src-list`,`onError`]),t.card.title?(v(),s(`div`,{key:0,class:`caption`,title:t.card.title},i(t.card.title),9,kt)):o(``,!0)])):(v(),s(`a`,{key:3,class:`file-card`,href:t.card.url,target:`_blank`,rel:`noopener noreferrer`,title:t.card.title||t.card.url},[a(m,{class:`icon`,icon:t.fileIcon},null,8,[`icon`]),e(`div`,jt,[e(`div`,Mt,i(t.card.title||t.cleanFileName),1),e(`div`,Nt,i(t.card.mimeType||t.hostname),1)]),a(m,{class:`open`,icon:`fa-solid fa-arrow-up-right-from-square`})],8,At))],2)}var Ft=V(dt,[[`render`,Pt],[`__scopeId`,`data-v-4838f46b`]]),It=x({name:`ThinkingBlock`,components:{ArrowRight:w,ElIcon:T,FontAwesomeIcon:W,MarkdownRenderer:K},props:{content:{type:String,required:!0},done:{type:Boolean,default:!1}},setup(e){let{t}=ne(),n=y(!1);return d(()=>e.done,e=>{e&&(n.value=!0)}),{collapsed:n,label:m(()=>e.done?t(`chat.thinking.done`):t(`chat.thinking.inProgress`))}}}),Lt={class:`thinking-label`},Rt={class:`thinking-content`};function zt(t,r,o,c,l,d){let p=u(`ArrowRight`),m=u(`el-icon`),g=u(`font-awesome-icon`),_=u(`markdown-renderer`);return v(),s(`div`,{class:n([`thinking-block`,{active:!t.done}])},[e(`div`,{class:`thinking-header`,onClick:r[0]||=e=>t.collapsed=!t.collapsed},[a(m,{class:n([`caret`,{"rotate-90":!t.collapsed}])},{default:h(()=>[a(p)]),_:1},8,[`class`]),a(g,{icon:`fa-solid fa-brain`,class:n([`brain`,{pulse:!t.done}])},null,8,[`class`]),e(`span`,Lt,i(t.label),1)]),f(e(`div`,Rt,[a(_,{content:t.content},null,8,[`content`])],512),[[b,!t.collapsed]])],2)}var Bt=V(It,[[`render`,zt],[`__scopeId`,`data-v-63e2d974`]]),Vt=x({name:`ConnectorEntryRow`,components:{ElButton:H,FontAwesomeIcon:W},props:{entry:{type:Object,required:!0},catalog:{type:Object,default:null},disabled:{type:Boolean,default:!1}},emits:[`authorize`],data(){return{logoError:!1}},computed:{fallbackName(){let e=this.entry.connector??``;return e.startsWith(`acedatacloud/`)?e.slice(13):e},displayName(){return this.catalog?.name?.trim()||this.fallbackName},iconUrl(){return this.logoError?``:this.catalog?.icon_url||``},secondaryText(){return this.entry.context&&this.entry.context.trim()?this.entry.context:this.catalog?.short_description||``}},watch:{"catalog.icon_url"(){this.logoError=!1}},methods:{onAuthorize(){this.$emit(`authorize`,this.entry)},onLogoError(){this.logoError=!0}}}),Ht={class:`entry-icon`,"aria-hidden":`true`},Ut=[`src`,`alt`],Wt={class:`entry-text`},Gt={class:`entry-name`},Kt={key:0,class:`entry-context`},qt={class:`entry-action`},Jt={key:0,class:`status-pill connected`},Yt={key:2,class:`status-pill unconnected`};function Xt(t,a,c,l,d,f){let m=u(`font-awesome-icon`),g=u(`el-button`);return v(),s(`div`,{class:n([`connector-entry-row`,{"is-connected":t.entry.status===`connected`}])},[e(`div`,Ht,[t.iconUrl?(v(),s(`img`,{key:0,src:t.iconUrl,class:`icon-logo`,alt:t.displayName,onError:a[0]||=(...e)=>t.onLogoError&&t.onLogoError(...e)},null,40,Ut)):t.entry.status===`connected`?(v(),p(m,{key:1,icon:`fa-solid fa-circle-check`,class:`icon-connected`})):(v(),p(m,{key:2,icon:`fa-solid fa-plug`,class:`icon-unconnected`}))]),e(`div`,Wt,[e(`div`,Gt,i(t.displayName),1),t.secondaryText?(v(),s(`div`,Kt,i(t.secondaryText),1)):o(``,!0)]),e(`div`,qt,[t.entry.status===`connected`?(v(),s(`span`,Jt,i(t.$t(`chat.consent.statusConnected`)),1)):t.entry.install_url?(v(),p(g,{key:1,type:`primary`,size:`small`,disabled:t.disabled,onClick:t.onAuthorize},{default:h(()=>[r(i(t.$t(`chat.consent.authorize`)),1)]),_:1},8,[`disabled`,`onClick`])):(v(),s(`span`,Yt,i(t.$t(`chat.consent.statusUnconnected`)),1))])],2)}var Zt=V(Vt,[[`render`,Xt],[`__scopeId`,`data-v-c9e31277`]]);function Qt(e){let t=new Set,n=[];for(let r of e.requirements??[])if(!r.satisfied)for(let e of r.entries??[])e.status===`unconnected`&&!t.has(e.connector)&&(t.add(e.connector),n.push(e.connector));return n}function q(e,t,n){return JSON.stringify({consent_request_id:e.consent_request_id,authorized:t,skipped:n})}async function $t(){let e=await B.get(`/connections/`,{baseURL:`${U()}/api/v1`});return Array.isArray(e.data)?e.data:[]}var J=new Map,Y=new Map;async function en(e){if(!e)return;let t=J.get(e);if(t)return t;let n=Y.get(e);if(n)return n;let r=(async()=>{try{let t=(await B.get(`/connectors/${e}/`,{baseURL:`${U()}/api/v1`})).data;return J.set(e,t),t}catch(t){console.warn(`connector catalog fetch failed`,e,t);return}})().finally(()=>{Y.delete(e)});return Y.set(e,r),r}var X=null,Z=null,Q=null,$=0;async function tn(e,t=!1){let n=e??null;if(n!==Z&&(Z=n,X=null,Q=null,$++),!n)return[];if(!t&&X)return X;if(!t&&Q)return Q;let r=++$,i=(async()=>{try{let e=(await B.get(`/connectors/`,{baseURL:`${U()}/api/v1`,params:{sort:`popular`,limit:200}}))?.data?.items,t=Array.isArray(e)?e.filter(e=>e?.installed&&e?.icon_url).map(e=>({id:e.id,identifier:e.identifier,name:e.name,icon_url:e.icon_url})):[];return Z===n&&$===r&&(X=t),t}catch(e){return console.warn(`enabled connectors fetch failed`,e),X??[]}})();return Q=i,i.finally(()=>{$===r&&(Q=null)}),i}async function nn(e,t){return(await B.post(`/connectors/${e}/install/`,t,{baseURL:`${U()}/api/v1`})).data}var rn=x({name:`ConnectorConsentCard`,components:{ConnectorEntryRow:Zt,ElButton:H,ElCheckbox:A,ElCheckboxGroup:k,ElDialog:ae,FontAwesomeIcon:W},props:{toolUseId:{type:String,required:!0},payload:{type:Object,required:!0},resolved:{type:Boolean,default:!1},previousOutput:{type:String,default:``}},emits:[`submit`,`authorize`],data(){return{resolvedAuthorized:[],resolvedSkipped:[],catalogs:{},scopeDialogVisible:!1,scopeDialogEntry:null,scopeDialogCatalog:null,selectedScopes:[],authorizingConnector:``,liveStatuses:{},hasCheckedStatuses:!1,refreshingStatus:!1}},computed:{requirements(){return this.payload?.requirements??[]},effectiveStatus(){return e=>this.liveStatuses[e.connector]??e.status},effectiveEntriesFor(){return e=>e.entries.map(e=>{let t=this.liveStatuses[e.connector];return!t||t===e.status?e:{...e,status:t}})},effectiveSatisfiedFor(){return e=>{let t=e.entries.map(e=>this.effectiveStatus(e));return t.length===0?e.satisfied:e.match===`all`?t.every(e=>e===`connected`):t.some(e=>e===`connected`)}},hasUnsatisfied(){return this.requirements.some(e=>!this.effectiveSatisfiedFor(e))},showContinueButton(){return this.resolved||!this.hasCheckedStatuses?!1:!this.hasUnsatisfied},resolvedSummary(){return this.resolvedAuthorized.length>0?this.$t(`chat.consent.resolvedAuthorized`,{list:this.resolvedAuthorized.join(`, `)}):this.$t(`chat.consent.resolvedSkipped`)}},watch:{resolved:{immediate:!0,handler(e){e&&this.parsePreviousOutput()}},previousOutput:{immediate:!1,handler(){this.resolved&&this.parsePreviousOutput()}},payload:{immediate:!0,deep:!1,handler(){this.refreshCatalogs()}}},mounted(){this.shouldRefreshFromReturn()&&this.refreshConnectionStatuses()},methods:{showMatchLabel(e){return e.entries.length>1&&!this.effectiveSatisfiedFor(e)},catalogFor(e){return this.catalogs[e.catalog_id]||null},async refreshCatalogs(){let e=new Set;for(let t of this.requirements)for(let n of t.entries)n.catalog_id&&e.add(n.catalog_id);await Promise.all(Array.from(e).map(async e=>{if(this.catalogs[e])return;let t=await en(e);t&&(this.catalogs={...this.catalogs,[e]:t})}))},onAuthorize(e){let t=this.catalogFor(e);if(!t||t.auth_mode===`byoc`||!t.installable){this.$emit(`authorize`,{tool_use_id:this.toolUseId,entry:e});return}let n=t.permissions||[];if(n.length>1){this.scopeDialogEntry=e,this.scopeDialogCatalog=t,this.selectedScopes=n.map(e=>e.id),this.scopeDialogVisible=!0;return}this.performInstall(e,void 0)},onConfirmScopes(){let e=this.scopeDialogEntry;if(!e){this.scopeDialogVisible=!1;return}let t=[...this.selectedScopes];this.scopeDialogVisible=!1,this.performInstall(e,t)},async performInstall(e,t){this.authorizingConnector=e.connector;try{let n=new URL(window.location.href);n.searchParams.set(`consent`,this.payload.consent_request_id),n.searchParams.delete(`connector`);let r=await nn(e.catalog_id,{scopes:t,return_url:n.toString()});if(r.type===`redirect`&&r.authorization_url){window.location.href=r.authorization_url;return}this.$emit(`authorize`,{tool_use_id:this.toolUseId,entry:e})}catch(t){console.error(`installFromCatalog failed`,t),oe.error(this.$t(`chat.consent.installFailed`)),this.$emit(`authorize`,{tool_use_id:this.toolUseId,entry:e})}finally{this.authorizingConnector=``}},onSkip(){let e=Qt(this.payload),t=q(this.payload,[],e);this.$emit(`submit`,{tool_use_id:this.toolUseId,output:t})},shouldRefreshFromReturn(){if(typeof window>`u`)return!1;try{return new URL(window.location.href).searchParams.get(`consent`)===this.payload?.consent_request_id}catch{return!1}},async refreshConnectionStatuses(){this.refreshingStatus=!0;try{let e=await $t(),t=new Set;for(let n of e){let e=n.connector_identifier;e&&String(n.status).toLowerCase()===`active`&&t.add(e)}let n={};for(let e of this.requirements)for(let r of e.entries)n[r.connector]=t.has(r.connector)?`connected`:`unconnected`;this.liveStatuses=n,this.hasCheckedStatuses=!0}catch(e){console.warn(`listMyConnections failed`,e)}finally{this.refreshingStatus=!1}},onContinue(){let e=[];for(let t of this.requirements)for(let n of t.entries)this.effectiveStatus(n)===`connected`&&e.push(n.connector);let t=q(this.payload,e,[]);this.$emit(`submit`,{tool_use_id:this.toolUseId,output:t})},parsePreviousOutput(){if(this.resolvedAuthorized=[],this.resolvedSkipped=[],this.previousOutput)try{let e=JSON.parse(this.previousOutput);Array.isArray(e.authorized)&&(this.resolvedAuthorized=e.authorized.filter(e=>typeof e==`string`)),Array.isArray(e.skipped)&&(this.resolvedSkipped=e.skipped.filter(e=>typeof e==`string`))}catch{}}}}),an={class:`ccc-header`},on={class:`header-title`},sn={key:0,class:`ccc-rationale`},cn={key:0,class:`ccc-req-match`},ln={key:1,class:`ccc-actions`},un={key:2,class:`ccc-resolved-banner`},dn={class:`ccc-scope-hint`},fn={class:`ccc-scope-label`},pn={key:0,class:`ccc-scope-desc`};function mn(t,c,d,f,m,g){let y=u(`font-awesome-icon`),b=u(`ConnectorEntryRow`),x=u(`el-button`),S=u(`el-checkbox`),C=u(`el-checkbox-group`),w=u(`el-dialog`);return v(),s(`div`,{class:n([`connector-consent-card`,{"is-resolved":t.resolved}])},[e(`div`,an,[a(y,{icon:`fa-solid fa-shield-halved`,class:`header-icon`}),e(`span`,on,i(t.$t(`chat.consent.title`)),1)]),t.payload.rationale?(v(),s(`p`,sn,i(t.payload.rationale),1)):o(``,!0),(v(!0),s(l,null,_(t.requirements,e=>(v(),s(`div`,{key:e.requirement_index,class:n([`ccc-requirement`,{"is-satisfied":t.effectiveSatisfiedFor(e)}])},[t.showMatchLabel(e)?(v(),s(`div`,cn,i(e.match===`any`?t.$t(`chat.consent.matchAny`):t.$t(`chat.consent.matchAll`)),1)):o(``,!0),(v(!0),s(l,null,_(t.effectiveEntriesFor(e),e=>(v(),p(b,{key:e.connector,entry:e,catalog:t.catalogFor(e),disabled:t.resolved||t.authorizingConnector!==``,onAuthorize:t.onAuthorize},null,8,[`entry`,`catalog`,`disabled`,`onAuthorize`]))),128))],2))),128)),!t.resolved&&(t.hasUnsatisfied||t.showContinueButton)?(v(),s(`div`,ln,[t.hasUnsatisfied?(v(),p(x,{key:0,text:``,disabled:t.authorizingConnector!==``,onClick:t.onSkip},{default:h(()=>[r(i(t.$t(`chat.consent.skip`)),1)]),_:1},8,[`disabled`,`onClick`])):o(``,!0),t.showContinueButton?(v(),p(x,{key:1,type:`primary`,loading:t.refreshingStatus,disabled:t.authorizingConnector!==``,onClick:t.onContinue},{default:h(()=>[r(i(t.$t(`chat.consent.continue`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])):o(``,!0)])):o(``,!0),t.resolved?(v(),s(`div`,un,i(t.resolvedSummary),1)):o(``,!0),a(w,{modelValue:t.scopeDialogVisible,"onUpdate:modelValue":c[2]||=e=>t.scopeDialogVisible=e,title:t.scopeDialogCatalog?t.$t(`chat.consent.selectScopes`,{provider:t.scopeDialogCatalog.name}):``,width:`480px`,"close-on-click-modal":!1,"append-to-body":``},{footer:h(()=>[a(x,{disabled:t.authorizingConnector!==``,onClick:c[1]||=e=>t.scopeDialogVisible=!1},{default:h(()=>[r(i(t.$t(`common.button.cancel`)),1)]),_:1},8,[`disabled`]),a(x,{type:`primary`,loading:t.authorizingConnector!==``,onClick:t.onConfirmScopes},{default:h(()=>[r(i(t.$t(`common.button.confirm`)),1)]),_:1},8,[`loading`,`onClick`])]),default:h(()=>[e(`p`,dn,i(t.$t(`chat.consent.selectScopesHint`)),1),a(C,{modelValue:t.selectedScopes,"onUpdate:modelValue":c[0]||=e=>t.selectedScopes=e},{default:h(()=>[(v(!0),s(l,null,_(t.scopeDialogCatalog?.permissions||[],t=>(v(),s(`div`,{key:t.id,class:`ccc-scope-row`},[a(S,{value:t.id,label:t.id},{default:h(()=>[e(`span`,fn,i(t.label||t.id),1)]),_:2},1032,[`value`,`label`]),t.desc?(v(),s(`p`,pn,i(t.desc),1)):o(``,!0)]))),128))]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`])],2)}var hn=x({name:`Message`,components:{EditMessage:Ue,CopyToClipboard:me,RestartToGenerate:Be,AnsweringMark:xe,MarkdownRenderer:K,FilePreview:_e,ToolActivity:tt,BrowserToolActivity:ut,EntityCard:Ft,ThinkingBlock:Bt,AskUserQuestionCard:ge,ConnectorConsentCard:V(rn,[[`render`,mn],[`__scopeId`,`data-v-5b00f3b0`]]),ElButton:H,ElImage:O,ElInput:se,FontAwesomeIcon:W},props:{messages:{type:Array,required:!1,default:()=>[]},message:{type:Object,required:!0},application:{type:Object,required:!0},readonly:{type:Boolean,default:!1},modelGroupOverride:{type:Object,required:!1,default:void 0}},emits:[`stop`,`edit`,`restart`,`answerAskUserQuestion`,`skipAskUserQuestion`,`respondConnectorConsent`,`authorizeConnector`],data(){return{copied:!1,isEditing:!1,questionValue:this.message.content,messageState:de}},computed:{modelGroup(){return this.modelGroupOverride||this.$store.state.chat?.modelGroup},copyableText(){let e=this.message.content;return e?typeof e==`string`?e:Array.isArray(e)?e.filter(e=>e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
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,S as c,T as l,at as u,ft as d,ht as f,j as p,k as m,mt as h,ot as g,rt as _,tt as v,wt as y,x as b,z as x}from"./vendor-chart-Dw-P17PN.js";import{I as S,S as C,_ as w,nt as T,w as E}from"./use-deprecated-B-uvyrTL.js";import{t as D}from"./tooltip-Bs8w_vsQ.js";import{t as O}from"./image-DaPFm5t3.js";import{n as k,t as A}from"./checkbox-ChInsWN4.js";import{t as j}from"./popover-DqyI0a54.js";import{_a as M,da as N,fa as P,ga as F,ha as I,la as L,pa as R,ua as z,va as ee,ya as te}from"./constants-D8dwgBQJ.js";import{o as ne}from"./i18n-BSdsVp0O.js";import{An as re,Cr as ie,Er as B,Fi as ae,G as V,Mi as oe,Qi as se,Ti as ce,Ui as H,bi as U,dn as le,it as ue,mi as de,un as fe,xr as pe}from"./index-BrXcZpB0.js";import"./vendor-highlight-BtIeKitL.js";import{t as W}from"./index.es-Cd6zh83v.js";import{t as me}from"./CopyToClipboard-B6HsusZG.js";import{n as he,t as ge}from"./AskUserQuestionCard-IhmU5xz7.js";import{t as _e}from"./FilePreview-C9dXaih4.js";var ve=x({name:`AnsweringMark`,data(){return{}},computed:{conversationId(){return this.$route.params?.id?.toString()}}}),ye={class:`mark`};function be(e,t,n,r,i,a){return v(),s(`div`,ye)}var xe=V(ve,[[`render`,be]]),Se=x({name:`CitationCard`,components:{FontAwesomeIcon:W},props:{citation:{type:Object,required:!0}},data(){return{iconFailed:!1}},computed:{displayUrl(){try{let e=new URL(this.citation.url);return e.host+(e.pathname&&e.pathname!==`/`?e.pathname:``)}catch{return this.citation.url}},hostLabel(){try{return new URL(this.citation.url).host.replace(/^www\./,``)}catch{return``}},resolvedIcon(){if(this.iconFailed)return``;if(this.citation.icon)return this.citation.icon;try{let e=new URL(this.citation.url).host;return e?`https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=64`:``}catch{return``}},fallbackIcon(){let e=(this.citation.type||``).toLowerCase();return e===`file`?`fa-solid fa-file-lines`:e===`page`?`fa-solid fa-file`:e===`issue`?`fa-solid fa-circle-dot`:e===`email`?`fa-solid fa-envelope`:e===`message`?`fa-solid fa-message`:e===`web`?`fa-solid fa-globe`:`fa-solid fa-link`}},methods:{onIconError(){this.iconFailed=!0}}}),Ce=[`href`],we={class:`head`},Te=[`src`,`alt`],Ee={key:2,class:`source`},De={key:0,class:`title`},Oe={key:1,class:`snippet`},ke={class:`url`};function Ae(t,n,r,a,c,l){let d=u(`font-awesome-icon`);return v(),s(`a`,{class:`citation-card`,href:t.citation.url,target:`_blank`,rel:`noopener noreferrer`},[e(`div`,we,[t.resolvedIcon?(v(),s(`img`,{key:0,src:t.resolvedIcon,alt:t.citation.source||``,class:`icon`,referrerpolicy:`no-referrer`,loading:`lazy`,onError:n[0]||=(...e)=>t.onIconError&&t.onIconError(...e)},null,40,Te)):(v(),p(d,{key:1,icon:t.fallbackIcon,class:`icon-fallback`},null,8,[`icon`])),t.citation.source||t.hostLabel?(v(),s(`span`,Ee,i(t.citation.source||t.hostLabel),1)):o(``,!0)]),t.citation.title?(v(),s(`div`,De,i(t.citation.title),1)):o(``,!0),t.citation.snippet?(v(),s(`div`,Oe,i(t.citation.snippet),1)):o(``,!0),e(`div`,ke,i(t.displayUrl),1)],8,Ce)}var je=V(Se,[[`render`,Ae],[`__scopeId`,`data-v-36c9d5dc`]]),Me=/\[\^acite:([A-Za-z0-9_-]{1,32})\]/g,Ne=x({name:`MarkdownRenderer`,directives:{highlight:fe},components:{VueMarkdown:he,CitationCard:je,ElPopover:j},props:{content:{type:String,required:!1,default:``},citations:{type:Object,required:!1,default:()=>({})}},data(){return{hoveredCitation:null,popoverAnchor:null,popoverVisible:!1}},computed:{enrichedContent(){let e=this.content||``;if(!e.includes(`[^acite:`))return e;let t=this.citations||{};return e.replace(Me,(e,n)=>{let r=t[n];return r?Fe(n,r):``})}},methods:{onChipHover(e){let t=e.target;if(!t)return;let n=t.closest(`.citation-chip`);if(!n){this.popoverVisible=!1;return}let r=n.dataset.citationId;if(!r)return;let i=(this.citations||{})[r];i&&(this.hoveredCitation=i,this.popoverAnchor=n,this.popoverVisible=!0)},onChipLeave(){this.popoverVisible=!1}}});function Pe(e){let t=e.source||(()=>{try{return new URL(e.url).host.replace(/^www\./,``)}catch{return``}})()||e.title||`source`;return t.length>24?t.slice(0,23)+`…`:t}function G(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/</g,`<`).replace(/>/g,`>`)}function Fe(e,t){let n=G(e),r=G(t.title||t.source||t.url||e),i=G(Pe(t)),a=t.url?` href="${G(t.url)}"`:``;return[`<span class="citation-chip" data-citation-id="${n}" title="${r}">`,`<a class="citation-chip__link"${a} target="_blank" rel="noopener noreferrer" tabindex="-1">`,`<span class="citation-chip__label">${i}</span>`,`</a>`,`</span>`].join(``)}var Ie={class:`markdown-with-citations`};function Le(e,t,n,r,i,c){let l=u(`vue-markdown`),d=u(`citation-card`),m=u(`el-popover`),_=g(`highlight`);return v(),s(`div`,Ie,[f(a(l,{source:e.enrichedContent,class:`markdown-body bg-transparent pt-[3px] text-[inherit]`,onMouseover:e.onChipHover,onMouseleave:e.onChipLeave},null,8,[`source`,`onMouseover`,`onMouseleave`]),[[_]]),e.hoveredCitation&&e.popoverAnchor?(v(),p(m,{key:0,"virtual-ref":e.popoverAnchor,"virtual-triggering":``,trigger:`hover`,visible:e.popoverVisible,placement:`top`,width:340,"popper-class":`citation-popover`,"show-arrow":!0,"hide-after":120},{default:h(()=>[a(d,{citation:e.hoveredCitation},null,8,[`citation`])]),_:1},8,[`virtual-ref`,`visible`])):o(``,!0)])}var K=V(Ne,[[`render`,Le],[`__scopeId`,`data-v-f3f2e7ba`]]),Re=x({name:`CopyToClipboard`,components:{FontAwesomeIcon:W,ElTooltip:D},props:{messages:{type:Array,required:!1,default:()=>[]}},emits:[`restart`],data(){return{copied:!1}},methods:{onRestart(){this.$emit(`restart`)}}});function ze(e,t,n,r,i,o){let s=u(`font-awesome-icon`),c=u(`el-tooltip`);return v(),p(c,{effect:`dark`,content:e.$t(`common.button.restart`),placement:`bottom`},{default:h(()=>[a(s,{icon:`fa-solid fa-sync`,class:`icon-sync`,onClick:e.onRestart},null,8,[`onClick`])]),_:1},8,[`content`])}var Be=V(Re,[[`render`,ze],[`__scopeId`,`data-v-90e169cb`]]),Ve=x({name:`EditMessage`,components:{FontAwesomeIcon:W,ElTooltip:D},props:{messages:{type:Array,required:!1,default:()=>[]}},emits:[`click`],data(){return{copied:!1}},methods:{onEdit(){this.$emit(`click`)}}});function He(e,t,n,r,i,o){let c=u(`font-awesome-icon`),l=u(`el-tooltip`);return v(),s(`span`,null,[a(l,{effect:`dark`,content:e.$t(`common.button.restart`),placement:`bottom`},{default:h(()=>[a(c,{icon:`fa-solid fa-edit`,class:`icon icon-edit`,onClick:e.onEdit},null,8,[`onClick`])]),_:1},8,[`content`])])}var Ue=V(Ve,[[`render`,He],[`__scopeId`,`data-v-8e947e8f`]]),We={code_execute:`Running code`,web_search:`Searching the web`,image_generate:`Generating image`,video_generate:`Generating video`,music_generate:`Generating music`},Ge=x({name:`ToolActivity`,components:{Loading:S,CircleCheckFilled:C,CircleCloseFilled:E,ArrowRight:w},props:{item:{type:Object,required:!0}},data(){return{expanded:!1}},computed:{displayName(){if(this.item.tool_display_name)return this.item.tool_display_name;let e=this.item.tool_name||``;return We[e]||e.replace(/_/g,` `)},inputText(){let e=this.item.input;return e&&Object.keys(e).length>0?this.item.tool_name===`code_execute`?e.code||``:this.item.tool_name===`web_search`?e.query||``:JSON.stringify(e,null,2):this.item.input_stream||``}}}),Ke={class:`tool-icon`},qe={class:`tool-name`},Je={key:0,class:`tool-duration`},Ye={key:0,class:`tool-body`},Xe={key:0,class:`tool-section`},Ze={class:`tool-code`},Qe={key:1,class:`tool-section`},$e={class:`tool-code`};function et(t,r,c,l,d,f){let m=u(`Loading`),g=u(`el-icon`),_=u(`CircleCloseFilled`),y=u(`CircleCheckFilled`),b=u(`ArrowRight`);return v(),s(`div`,{class:n([`tool-activity`,{"is-error":t.item.is_error,"is-running":t.item.status===`running`}])},[e(`div`,{class:`tool-header`,onClick:r[0]||=e=>t.expanded=!t.expanded},[e(`span`,Ke,[t.item.status===`running`?(v(),p(g,{key:0,class:`is-loading`},{default:h(()=>[a(m)]),_:1})):t.item.is_error?(v(),p(g,{key:1,color:`var(--el-color-danger)`},{default:h(()=>[a(_)]),_:1})):(v(),p(g,{key:2,color:`var(--el-color-success)`},{default:h(()=>[a(y)]),_:1}))]),e(`span`,qe,i(t.displayName),1),t.item.duration_ms?(v(),s(`span`,Je,i(t.item.duration_ms)+`ms`,1)):o(``,!0),a(g,{class:n([`tool-expand`,{rotated:t.expanded}])},{default:h(()=>[a(b)]),_:1},8,[`class`])]),t.expanded?(v(),s(`div`,Ye,[t.inputText?(v(),s(`div`,Xe,[r[1]||=e(`div`,{class:`tool-section-label`},`Input`,-1),e(`pre`,Ze,i(t.inputText),1)])):o(``,!0),t.item.output?(v(),s(`div`,Qe,[r[2]||=e(`div`,{class:`tool-section-label`},`Output`,-1),e(`pre`,$e,i(t.item.output),1)])):o(``,!0)])):o(``,!0)],2)}var tt=V(Ge,[[`render`,et],[`__scopeId`,`data-v-cf12a99f`]]),nt=new Set([`completed`,`denied`,`expired`,`cancel_too_late`]),rt=x({name:`BrowserToolActivity`,components:{FontAwesomeIcon:W},props:{item:{type:Object,required:!0}},computed:{state(){return pe(this.item.execution_state)?this.item.execution_state:`awaiting_device`},title(){return this.item.tool_display_name||this.item.tool_name?.replace(/_/g,` `)||this.$t(`chat.browserTool.title`)},origin(){return ie(this.item.origin)},icon(){return this.state===`completed`?`fa-solid fa-check`:this.state===`denied`||this.state===`expired`?`fa-solid fa-xmark`:this.state===`executing`?`fa-solid fa-spinner`:nt.has(this.state)?`fa-solid fa-triangle-exclamation`:`fa-solid fa-globe`}}}),it={class:`activity-icon`,"aria-hidden":`true`},at={class:`activity-copy`},ot={class:`activity-title`},st={class:`activity-status`},ct={key:0,class:`activity-origin`};function lt(t,r,c,l,d,f){let p=u(`font-awesome-icon`);return v(),s(`div`,{class:n([`browser-tool-activity`,`state-${t.state}`]),role:`status`,"aria-live":`polite`},[e(`div`,it,[a(p,{icon:t.icon,spin:t.state===`executing`},null,8,[`icon`,`spin`])]),e(`div`,at,[e(`div`,ot,i(t.title),1),e(`div`,st,i(t.$t(`chat.browserTool.state.${t.state}`)),1),t.origin?(v(),s(`div`,ct,i(t.origin),1)):o(``,!0)])],2)}var ut=V(rt,[[`render`,lt],[`__scopeId`,`data-v-124994f3`]]),dt=x({name:`EntityCard`,components:{ElImage:O,FontAwesomeIcon:W},props:{card:{type:Object,required:!0}},data(){return{mediaFailed:!1}},computed:{cardType(){if(this.mediaFailed)return`file`;let e=(this.card.type||``).toLowerCase();return e===`audio`||e===`image`?e:e===`video`||e===`embed`?`video`:this.card.mimeType?.startsWith(`audio/`)?`audio`:this.card.mimeType?.startsWith(`video/`)?`video`:this.card.mimeType?.startsWith(`image/`)?`image`:`file`},mediaKey(){return[this.card.url,this.card.type,this.card.mimeType||``].join(`\0`)},videoUsesIframe(){if((this.card.type||``).toLowerCase()===`embed`)return!0;try{return new URL(this.card.url).pathname.split(`/`).includes(`embed`)}catch{return!1}},formattedDuration(){let e=this.card.duration??0;return!Number.isFinite(e)||e<=0?``:`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`},cleanFileName(){try{let e=new URL(this.card.url),t=e.pathname.split(`/`).filter(Boolean);return decodeURIComponent(t[t.length-1]||e.hostname)}catch{return this.card.url}},hostname(){try{return new URL(this.card.url).hostname}catch{return``}},fileIcon(){let e=(this.card.mimeType||``).toLowerCase();return e.includes(`pdf`)?`fa-solid fa-file-pdf`:e.includes(`word`)||e.includes(`msword`)?`fa-solid fa-file-word`:e.includes(`sheet`)||e.includes(`excel`)||e.includes(`csv`)?`fa-solid fa-file-excel`:e.includes(`zip`)||e.includes(`compressed`)?`fa-solid fa-file-zipper`:e.startsWith(`text/`)?`fa-solid fa-file-lines`:`fa-solid fa-file`}},watch:{mediaKey(){this.mediaFailed=!1}},methods:{onMediaError(){this.mediaFailed=!0}}}),ft={key:0,class:`audio-card`},pt={key:0,class:`thumb`},mt=[`src`,`alt`],ht={class:`meta`},gt=[`title`],_t={key:1,class:`sub`},vt=[`src`],yt={class:`actions`},bt=[`href`],xt={key:1,class:`video-card`},St={class:`frame`},Ct=[`src`,`title`],wt=[`src`],Tt={key:0,class:`meta`},Et=[`title`],Dt={key:1,class:`sub`},Ot={key:2,class:`image-card`},kt=[`title`],At=[`href`,`title`],jt={class:`info`},Mt={class:`title`},Nt={class:`sub`};function Pt(t,c,l,d,f,p){let m=u(`font-awesome-icon`),g=u(`el-image`);return v(),s(`div`,{class:n([`entity-card`,`entity-card--${t.cardType}`])},[t.cardType===`audio`?(v(),s(`div`,ft,[t.card.thumbnail?(v(),s(`div`,pt,[e(`img`,{src:t.card.thumbnail,alt:t.card.title||``},null,8,mt)])):o(``,!0),e(`div`,ht,[t.card.title?(v(),s(`div`,{key:0,class:`title`,title:t.card.title},i(t.card.title),9,gt)):o(``,!0),t.card.duration?(v(),s(`div`,_t,i(t.formattedDuration),1)):o(``,!0),e(`audio`,{class:`player`,controls:``,preload:`metadata`,src:t.card.url,onError:c[0]||=(...e)=>t.onMediaError&&t.onMediaError(...e)},null,40,vt),e(`div`,yt,[e(`a`,{class:`download`,href:t.card.url,target:`_blank`,rel:`noopener noreferrer`},[a(m,{icon:`fa-solid fa-arrow-down`}),r(` `+i(t.$t(`common.button.download`)),1)],8,bt)])])])):t.cardType===`video`?(v(),s(`div`,xt,[e(`div`,St,[t.videoUsesIframe?(v(),s(`iframe`,{key:0,class:`player`,src:t.card.url,title:t.card.title||``,frameborder:`0`,loading:`lazy`,referrerpolicy:`strict-origin-when-cross-origin`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,allowfullscreen:``,onError:c[1]||=(...e)=>t.onMediaError&&t.onMediaError(...e)},null,40,Ct)):(v(),s(`video`,{key:1,class:`player`,controls:``,preload:`metadata`,src:t.card.url,onError:c[2]||=(...e)=>t.onMediaError&&t.onMediaError(...e)},null,40,wt))]),t.card.title||t.card.duration?(v(),s(`div`,Tt,[t.card.title?(v(),s(`span`,{key:0,class:`title`,title:t.card.title},i(t.card.title),9,Et)):o(``,!0),t.card.duration?(v(),s(`span`,Dt,i(t.formattedDuration),1)):o(``,!0)])):o(``,!0)])):t.cardType===`image`?(v(),s(`div`,Ot,[a(g,{src:t.card.url,alt:t.card.alt||t.card.title||``,fit:`contain`,class:`image`,"preview-src-list":[t.card.url],"initial-index":0,"hide-on-click-modal":!0,"preview-teleported":!0,onError:t.onMediaError},{placeholder:h(()=>[...c[3]||=[e(`div`,{class:`image-placeholder`},null,-1)]]),error:h(()=>[...c[4]||=[e(`div`,{class:`image-placeholder image-placeholder--error`},null,-1)]]),_:1},8,[`src`,`alt`,`preview-src-list`,`onError`]),t.card.title?(v(),s(`div`,{key:0,class:`caption`,title:t.card.title},i(t.card.title),9,kt)):o(``,!0)])):(v(),s(`a`,{key:3,class:`file-card`,href:t.card.url,target:`_blank`,rel:`noopener noreferrer`,title:t.card.title||t.card.url},[a(m,{class:`icon`,icon:t.fileIcon},null,8,[`icon`]),e(`div`,jt,[e(`div`,Mt,i(t.card.title||t.cleanFileName),1),e(`div`,Nt,i(t.card.mimeType||t.hostname),1)]),a(m,{class:`open`,icon:`fa-solid fa-arrow-up-right-from-square`})],8,At))],2)}var Ft=V(dt,[[`render`,Pt],[`__scopeId`,`data-v-4838f46b`]]),It=x({name:`ThinkingBlock`,components:{ArrowRight:w,ElIcon:T,FontAwesomeIcon:W,MarkdownRenderer:K},props:{content:{type:String,required:!0},done:{type:Boolean,default:!1}},setup(e){let{t}=ne(),n=y(!1);return d(()=>e.done,e=>{e&&(n.value=!0)}),{collapsed:n,label:m(()=>e.done?t(`chat.thinking.done`):t(`chat.thinking.inProgress`))}}}),Lt={class:`thinking-label`},Rt={class:`thinking-content`};function zt(t,r,o,c,l,d){let p=u(`ArrowRight`),m=u(`el-icon`),g=u(`font-awesome-icon`),_=u(`markdown-renderer`);return v(),s(`div`,{class:n([`thinking-block`,{active:!t.done}])},[e(`div`,{class:`thinking-header`,onClick:r[0]||=e=>t.collapsed=!t.collapsed},[a(m,{class:n([`caret`,{"rotate-90":!t.collapsed}])},{default:h(()=>[a(p)]),_:1},8,[`class`]),a(g,{icon:`fa-solid fa-brain`,class:n([`brain`,{pulse:!t.done}])},null,8,[`class`]),e(`span`,Lt,i(t.label),1)]),f(e(`div`,Rt,[a(_,{content:t.content},null,8,[`content`])],512),[[b,!t.collapsed]])],2)}var Bt=V(It,[[`render`,zt],[`__scopeId`,`data-v-63e2d974`]]),Vt=x({name:`ConnectorEntryRow`,components:{ElButton:H,FontAwesomeIcon:W},props:{entry:{type:Object,required:!0},catalog:{type:Object,default:null},disabled:{type:Boolean,default:!1}},emits:[`authorize`],data(){return{logoError:!1}},computed:{fallbackName(){let e=this.entry.connector??``;return e.startsWith(`acedatacloud/`)?e.slice(13):e},displayName(){return this.catalog?.name?.trim()||this.fallbackName},iconUrl(){return this.logoError?``:this.catalog?.icon_url||``},secondaryText(){return this.entry.context&&this.entry.context.trim()?this.entry.context:this.catalog?.short_description||``}},watch:{"catalog.icon_url"(){this.logoError=!1}},methods:{onAuthorize(){this.$emit(`authorize`,this.entry)},onLogoError(){this.logoError=!0}}}),Ht={class:`entry-icon`,"aria-hidden":`true`},Ut=[`src`,`alt`],Wt={class:`entry-text`},Gt={class:`entry-name`},Kt={key:0,class:`entry-context`},qt={class:`entry-action`},Jt={key:0,class:`status-pill connected`},Yt={key:2,class:`status-pill unconnected`};function Xt(t,a,c,l,d,f){let m=u(`font-awesome-icon`),g=u(`el-button`);return v(),s(`div`,{class:n([`connector-entry-row`,{"is-connected":t.entry.status===`connected`}])},[e(`div`,Ht,[t.iconUrl?(v(),s(`img`,{key:0,src:t.iconUrl,class:`icon-logo`,alt:t.displayName,onError:a[0]||=(...e)=>t.onLogoError&&t.onLogoError(...e)},null,40,Ut)):t.entry.status===`connected`?(v(),p(m,{key:1,icon:`fa-solid fa-circle-check`,class:`icon-connected`})):(v(),p(m,{key:2,icon:`fa-solid fa-plug`,class:`icon-unconnected`}))]),e(`div`,Wt,[e(`div`,Gt,i(t.displayName),1),t.secondaryText?(v(),s(`div`,Kt,i(t.secondaryText),1)):o(``,!0)]),e(`div`,qt,[t.entry.status===`connected`?(v(),s(`span`,Jt,i(t.$t(`chat.consent.statusConnected`)),1)):t.entry.install_url?(v(),p(g,{key:1,type:`primary`,size:`small`,disabled:t.disabled,onClick:t.onAuthorize},{default:h(()=>[r(i(t.$t(`chat.consent.authorize`)),1)]),_:1},8,[`disabled`,`onClick`])):(v(),s(`span`,Yt,i(t.$t(`chat.consent.statusUnconnected`)),1))])],2)}var Zt=V(Vt,[[`render`,Xt],[`__scopeId`,`data-v-c9e31277`]]);function Qt(e){let t=new Set,n=[];for(let r of e.requirements??[])if(!r.satisfied)for(let e of r.entries??[])e.status===`unconnected`&&!t.has(e.connector)&&(t.add(e.connector),n.push(e.connector));return n}function q(e,t,n){return JSON.stringify({consent_request_id:e.consent_request_id,authorized:t,skipped:n})}async function $t(){let e=await B.get(`/connections/`,{baseURL:`${U()}/api/v1`});return Array.isArray(e.data)?e.data:[]}var J=new Map,Y=new Map;async function en(e){if(!e)return;let t=J.get(e);if(t)return t;let n=Y.get(e);if(n)return n;let r=(async()=>{try{let t=(await B.get(`/connectors/${e}/`,{baseURL:`${U()}/api/v1`})).data;return J.set(e,t),t}catch(t){console.warn(`connector catalog fetch failed`,e,t);return}})().finally(()=>{Y.delete(e)});return Y.set(e,r),r}var X=null,Z=null,Q=null,$=0;async function tn(e,t=!1){let n=e??null;if(n!==Z&&(Z=n,X=null,Q=null,$++),!n)return[];if(!t&&X)return X;if(!t&&Q)return Q;let r=++$,i=(async()=>{try{let e=(await B.get(`/connectors/`,{baseURL:`${U()}/api/v1`,params:{sort:`popular`,limit:200}}))?.data?.items,t=Array.isArray(e)?e.filter(e=>e?.installed&&e?.icon_url).map(e=>({id:e.id,identifier:e.identifier,name:e.name,icon_url:e.icon_url})):[];return Z===n&&$===r&&(X=t),t}catch(e){return console.warn(`enabled connectors fetch failed`,e),X??[]}})();return Q=i,i.finally(()=>{$===r&&(Q=null)}),i}async function nn(e,t){return(await B.post(`/connectors/${e}/install/`,t,{baseURL:`${U()}/api/v1`})).data}var rn=x({name:`ConnectorConsentCard`,components:{ConnectorEntryRow:Zt,ElButton:H,ElCheckbox:A,ElCheckboxGroup:k,ElDialog:ae,FontAwesomeIcon:W},props:{toolUseId:{type:String,required:!0},payload:{type:Object,required:!0},resolved:{type:Boolean,default:!1},previousOutput:{type:String,default:``}},emits:[`submit`,`authorize`],data(){return{resolvedAuthorized:[],resolvedSkipped:[],catalogs:{},scopeDialogVisible:!1,scopeDialogEntry:null,scopeDialogCatalog:null,selectedScopes:[],authorizingConnector:``,liveStatuses:{},hasCheckedStatuses:!1,refreshingStatus:!1}},computed:{requirements(){return this.payload?.requirements??[]},effectiveStatus(){return e=>this.liveStatuses[e.connector]??e.status},effectiveEntriesFor(){return e=>e.entries.map(e=>{let t=this.liveStatuses[e.connector];return!t||t===e.status?e:{...e,status:t}})},effectiveSatisfiedFor(){return e=>{let t=e.entries.map(e=>this.effectiveStatus(e));return t.length===0?e.satisfied:e.match===`all`?t.every(e=>e===`connected`):t.some(e=>e===`connected`)}},hasUnsatisfied(){return this.requirements.some(e=>!this.effectiveSatisfiedFor(e))},showContinueButton(){return this.resolved||!this.hasCheckedStatuses?!1:!this.hasUnsatisfied},resolvedSummary(){return this.resolvedAuthorized.length>0?this.$t(`chat.consent.resolvedAuthorized`,{list:this.resolvedAuthorized.join(`, `)}):this.$t(`chat.consent.resolvedSkipped`)}},watch:{resolved:{immediate:!0,handler(e){e&&this.parsePreviousOutput()}},previousOutput:{immediate:!1,handler(){this.resolved&&this.parsePreviousOutput()}},payload:{immediate:!0,deep:!1,handler(){this.refreshCatalogs()}}},mounted(){this.shouldRefreshFromReturn()&&this.refreshConnectionStatuses()},methods:{showMatchLabel(e){return e.entries.length>1&&!this.effectiveSatisfiedFor(e)},catalogFor(e){return this.catalogs[e.catalog_id]||null},async refreshCatalogs(){let e=new Set;for(let t of this.requirements)for(let n of t.entries)n.catalog_id&&e.add(n.catalog_id);await Promise.all(Array.from(e).map(async e=>{if(this.catalogs[e])return;let t=await en(e);t&&(this.catalogs={...this.catalogs,[e]:t})}))},onAuthorize(e){let t=this.catalogFor(e);if(!t||t.auth_mode===`byoc`||!t.installable){this.$emit(`authorize`,{tool_use_id:this.toolUseId,entry:e});return}let n=t.permissions||[];if(n.length>1){this.scopeDialogEntry=e,this.scopeDialogCatalog=t,this.selectedScopes=n.map(e=>e.id),this.scopeDialogVisible=!0;return}this.performInstall(e,void 0)},onConfirmScopes(){let e=this.scopeDialogEntry;if(!e){this.scopeDialogVisible=!1;return}let t=[...this.selectedScopes];this.scopeDialogVisible=!1,this.performInstall(e,t)},async performInstall(e,t){this.authorizingConnector=e.connector;try{let n=new URL(window.location.href);n.searchParams.set(`consent`,this.payload.consent_request_id),n.searchParams.delete(`connector`);let r=await nn(e.catalog_id,{scopes:t,return_url:n.toString()});if(r.type===`redirect`&&r.authorization_url){window.location.href=r.authorization_url;return}this.$emit(`authorize`,{tool_use_id:this.toolUseId,entry:e})}catch(t){console.error(`installFromCatalog failed`,t),oe.error(this.$t(`chat.consent.installFailed`)),this.$emit(`authorize`,{tool_use_id:this.toolUseId,entry:e})}finally{this.authorizingConnector=``}},onSkip(){let e=Qt(this.payload),t=q(this.payload,[],e);this.$emit(`submit`,{tool_use_id:this.toolUseId,output:t})},shouldRefreshFromReturn(){if(typeof window>`u`)return!1;try{return new URL(window.location.href).searchParams.get(`consent`)===this.payload?.consent_request_id}catch{return!1}},async refreshConnectionStatuses(){this.refreshingStatus=!0;try{let e=await $t(),t=new Set;for(let n of e){let e=n.connector_identifier;e&&String(n.status).toLowerCase()===`active`&&t.add(e)}let n={};for(let e of this.requirements)for(let r of e.entries)n[r.connector]=t.has(r.connector)?`connected`:`unconnected`;this.liveStatuses=n,this.hasCheckedStatuses=!0}catch(e){console.warn(`listMyConnections failed`,e)}finally{this.refreshingStatus=!1}},onContinue(){let e=[];for(let t of this.requirements)for(let n of t.entries)this.effectiveStatus(n)===`connected`&&e.push(n.connector);let t=q(this.payload,e,[]);this.$emit(`submit`,{tool_use_id:this.toolUseId,output:t})},parsePreviousOutput(){if(this.resolvedAuthorized=[],this.resolvedSkipped=[],this.previousOutput)try{let e=JSON.parse(this.previousOutput);Array.isArray(e.authorized)&&(this.resolvedAuthorized=e.authorized.filter(e=>typeof e==`string`)),Array.isArray(e.skipped)&&(this.resolvedSkipped=e.skipped.filter(e=>typeof e==`string`))}catch{}}}}),an={class:`ccc-header`},on={class:`header-title`},sn={key:0,class:`ccc-rationale`},cn={key:0,class:`ccc-req-match`},ln={key:1,class:`ccc-actions`},un={key:2,class:`ccc-resolved-banner`},dn={class:`ccc-scope-hint`},fn={class:`ccc-scope-label`},pn={key:0,class:`ccc-scope-desc`};function mn(t,c,d,f,m,g){let y=u(`font-awesome-icon`),b=u(`ConnectorEntryRow`),x=u(`el-button`),S=u(`el-checkbox`),C=u(`el-checkbox-group`),w=u(`el-dialog`);return v(),s(`div`,{class:n([`connector-consent-card`,{"is-resolved":t.resolved}])},[e(`div`,an,[a(y,{icon:`fa-solid fa-shield-halved`,class:`header-icon`}),e(`span`,on,i(t.$t(`chat.consent.title`)),1)]),t.payload.rationale?(v(),s(`p`,sn,i(t.payload.rationale),1)):o(``,!0),(v(!0),s(l,null,_(t.requirements,e=>(v(),s(`div`,{key:e.requirement_index,class:n([`ccc-requirement`,{"is-satisfied":t.effectiveSatisfiedFor(e)}])},[t.showMatchLabel(e)?(v(),s(`div`,cn,i(e.match===`any`?t.$t(`chat.consent.matchAny`):t.$t(`chat.consent.matchAll`)),1)):o(``,!0),(v(!0),s(l,null,_(t.effectiveEntriesFor(e),e=>(v(),p(b,{key:e.connector,entry:e,catalog:t.catalogFor(e),disabled:t.resolved||t.authorizingConnector!==``,onAuthorize:t.onAuthorize},null,8,[`entry`,`catalog`,`disabled`,`onAuthorize`]))),128))],2))),128)),!t.resolved&&(t.hasUnsatisfied||t.showContinueButton)?(v(),s(`div`,ln,[t.hasUnsatisfied?(v(),p(x,{key:0,text:``,disabled:t.authorizingConnector!==``,onClick:t.onSkip},{default:h(()=>[r(i(t.$t(`chat.consent.skip`)),1)]),_:1},8,[`disabled`,`onClick`])):o(``,!0),t.showContinueButton?(v(),p(x,{key:1,type:`primary`,loading:t.refreshingStatus,disabled:t.authorizingConnector!==``,onClick:t.onContinue},{default:h(()=>[r(i(t.$t(`chat.consent.continue`)),1)]),_:1},8,[`loading`,`disabled`,`onClick`])):o(``,!0)])):o(``,!0),t.resolved?(v(),s(`div`,un,i(t.resolvedSummary),1)):o(``,!0),a(w,{modelValue:t.scopeDialogVisible,"onUpdate:modelValue":c[2]||=e=>t.scopeDialogVisible=e,title:t.scopeDialogCatalog?t.$t(`chat.consent.selectScopes`,{provider:t.scopeDialogCatalog.name}):``,width:`480px`,"close-on-click-modal":!1,"append-to-body":``},{footer:h(()=>[a(x,{disabled:t.authorizingConnector!==``,onClick:c[1]||=e=>t.scopeDialogVisible=!1},{default:h(()=>[r(i(t.$t(`common.button.cancel`)),1)]),_:1},8,[`disabled`]),a(x,{type:`primary`,loading:t.authorizingConnector!==``,onClick:t.onConfirmScopes},{default:h(()=>[r(i(t.$t(`common.button.confirm`)),1)]),_:1},8,[`loading`,`onClick`])]),default:h(()=>[e(`p`,dn,i(t.$t(`chat.consent.selectScopesHint`)),1),a(C,{modelValue:t.selectedScopes,"onUpdate:modelValue":c[0]||=e=>t.selectedScopes=e},{default:h(()=>[(v(!0),s(l,null,_(t.scopeDialogCatalog?.permissions||[],t=>(v(),s(`div`,{key:t.id,class:`ccc-scope-row`},[a(S,{value:t.id,label:t.id},{default:h(()=>[e(`span`,fn,i(t.label||t.id),1)]),_:2},1032,[`value`,`label`]),t.desc?(v(),s(`p`,pn,i(t.desc),1)):o(``,!0)]))),128))]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`])],2)}var hn=x({name:`Message`,components:{EditMessage:Ue,CopyToClipboard:me,RestartToGenerate:Be,AnsweringMark:xe,MarkdownRenderer:K,FilePreview:_e,ToolActivity:tt,BrowserToolActivity:ut,EntityCard:Ft,ThinkingBlock:Bt,AskUserQuestionCard:ge,ConnectorConsentCard:V(rn,[[`render`,mn],[`__scopeId`,`data-v-5b00f3b0`]]),ElButton:H,ElImage:O,ElInput:se,FontAwesomeIcon:W},props:{messages:{type:Array,required:!1,default:()=>[]},message:{type:Object,required:!0},application:{type:Object,required:!0},readonly:{type:Boolean,default:!1},modelGroupOverride:{type:Object,required:!1,default:void 0}},emits:[`stop`,`edit`,`restart`,`answerAskUserQuestion`,`skipAskUserQuestion`,`respondConnectorConsent`,`authorizeConnector`],data(){return{copied:!1,isEditing:!1,questionValue:this.message.content,messageState:de}},computed:{modelGroup(){return this.modelGroupOverride||this.$store.state.chat?.modelGroup},copyableText(){let e=this.message.content;return e?typeof e==`string`?e:Array.isArray(e)?e.filter(e=>e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
2
2
|
|
|
3
3
|
`).trim():``:``},errorText(){if(console.debug(`error`,this.message.error),!(!this.message.error||!this.message.error?.code)){if(this.message.error?.message)return this.message.error.message;switch(this.message.error?.code){case te:return this.$t(`chat.message.errorUsedUp`);case L:return this.$t(`chat.message.errorApiError`);case z:return this.$t(`chat.message.errorBadRequest`);case F:return this.$t(`chat.message.errorTimeout`);case N:return this.$t(`chat.message.errorBusy`);case R:return this.$t(`chat.message.errorContentTooLarge`);case M:return this.$t(`chat.message.errorTooManyRequests`);case I:return this.$t(`chat.message.errorNotApplied`);case P:return;case ee:default:return this.$t(`chat.message.errorUnknown`)}}},showBuyMore(){return re(this.$store.getters.site)?!1:!ce()&&this.message.role===`assistant`&&this.message.error?.code===`used_up`}},watch:{},methods:{startEditing(){this.isEditing=!0,this.questionValue=this.message.content,console.debug(`start to get answer`,this.message)},cancelEdit(){this.isEditing=!1},onRestart(){this.$emit(`restart`,this.message)},onEdit(){this.isEditing=!1,this.onSubmit()},onEditEnterKey(e){let t=e;t.isComposing||t.keyCode===229||(t.preventDefault(),this.onEdit())},onSubmit(){this.$emit(`edit`,this.message,this.questionValue)},onCopy(){le(this.message.content.toString(),{debug:!0}),this.copied=!0,setTimeout(()=>{this.copied=!1},3e3)},onBuyMore(){this.$router.push({name:ue,params:{id:this.application?.id}})},onAskUserQuestionSubmit(e){this.$emit(`answerAskUserQuestion`,e)},onAskUserQuestionSkip(e){this.$emit(`skipAskUserQuestion`,e)},askUserQuestionPayloadFromBlock(e){return e.pending_question?e.pending_question:{questions:e.input?.questions||[]}},onConnectorConsentSubmit(e){this.$emit(`respondConnectorConsent`,e)},onConnectorConsentAuthorize(e){this.$emit(`authorizeConnector`,e)},consentPayloadFromBlock(e){return e.pending_consent_request??null}}}),gn=[`role`],_n={class:`author`},vn={key:0,class:`main`},yn={initial:{opacity:0,y:5},enter:{opacity:1,y:0,scale:1},delay:300,duration:400,layout:!0,transition:{enter:{delay:.3,duration:.5},layout:{duration:.4,easing:`ease-in-out`}},class:`content`},bn={key:0,class:`message-content`},xn={key:1},Sn={key:1,class:`whitespace-pre-wrap break-words w-fit max-w-full py-1`},Cn={key:2},wn=[`src`],Tn={key:2},En={key:1,class:`whitespace-pre-wrap break-words w-fit max-w-full py-1`},Dn={key:1,class:`edits`},On={class:`flex justify-end`},kn={initial:{opacity:0,y:5},enter:{opacity:1,y:0,scale:1},delay:300,duration:400,layout:!0,transition:{enter:{delay:.3,duration:.5},layout:{duration:.4,easing:`ease-in-out`}},class:`operations`},An={key:1,class:`error-card`},jn={class:`error-content`},Mn={class:`error-text`};function Nn(d,m,y,b,x,S){let C=u(`el-image`),w=u(`thinking-block`),T=u(`markdown-renderer`),E=u(`file-preview`),D=u(`tool-activity`),O=u(`browser-tool-activity`),k=u(`ask-user-question-card`),A=u(`connector-consent-card`),j=u(`entity-card`),M=u(`el-input`),N=u(`el-button`),P=u(`answering-mark`),F=u(`edit-message`),I=u(`copy-to-clipboard`),L=u(`restart-to-generate`),R=u(`font-awesome-icon`),z=g(`motion`);return v(),s(`div`,{class:n({message:!0,[d.message.role]:!0}),role:d.message.role},[e(`div`,_n,[d.message.role===`assistant`?(v(),p(C,{key:0,src:d.modelGroup?.icon,fit:`cover`,class:`avatar`},null,8,[`src`])):o(``,!0)]),d.errorText?(v(),s(`div`,An,[e(`div`,jn,[a(R,{icon:`fa-solid fa-circle-exclamation`,class:`error-icon`}),e(`span`,Mn,i(d.errorText),1)]),d.showBuyMore&&!d.readonly?(v(),p(N,{key:0,round:``,type:`primary`,class:`btn-topup`,size:`small`,onClick:d.onBuyMore},{default:h(()=>[r(i(d.$t(`common.button.buyMore`)),1)]),_:1},8,[`onClick`])):o(``,!0)])):(v(),s(`div`,vn,[f((v(),s(`div`,yn,[d.isEditing?(v(),s(`div`,Dn,[a(M,{modelValue:d.questionValue,"onUpdate:modelValue":m[0]||=e=>d.questionValue=e,type:`textarea`,class:`mb-2`,onKeydown:c(t(d.onEditEnterKey,[`exact`]),[`enter`])},null,8,[`modelValue`,`onKeydown`]),e(`div`,On,[a(N,{round:``,onClick:d.cancelEdit},{default:h(()=>[r(i(d.$t(`common.button.cancel`)),1)]),_:1},8,[`onClick`]),a(N,{type:`primary`,class:`btn-confirm`,round:``,onClick:d.onEdit},{default:h(()=>[r(i(d.$t(`common.button.confirm`)),1)]),_:1},8,[`onClick`])])])):(v(),s(`div`,bn,[d.message.role===`assistant`&&d.message.thinking?(v(),p(w,{key:0,content:d.message.thinking,done:d.message.state===d.messageState.FINISHED||d.message.state===d.messageState.FAILED},null,8,[`content`,`done`])):o(``,!0),Array.isArray(d.message.content)?(v(),s(`div`,Cn,[(v(!0),s(l,null,_(d.message.content,(e,t)=>(v(),s(`div`,{key:t},[e.type===`image_url`?(v(),s(`img`,{key:0,src:typeof e?.image_url==`string`?e.image_url:e.image_url?.url,fit:`cover`,class:`image`},null,8,wn)):o(``,!0),e.file_url?(v(),p(E,{key:1,name:e.name||(typeof e?.file_url==`string`?e.file_url:e.file_url?.url),percentage:0,closable:!1,class:`mt-2`},null,8,[`name`])):o(``,!0),e.type===`text`?(v(),s(`div`,Tn,[d.message.role===`assistant`?(v(),p(T,{key:0,content:e.text,citations:d.message.citations},null,8,[`content`,`citations`])):(v(),s(`pre`,En,i(e.text?.trim()),1))])):o(``,!0),e.type===`tool_use`&&e.execution!==`browser`&&!(e.tool_name===`ask_user_question`&&(e.status===`awaiting_input`||e.status===`done`))&&!(e.tool_name===`request_user_consent`&&(e.status===`awaiting_input`||e.status===`done`))?(v(),p(D,{key:3,item:e},null,8,[`item`])):o(``,!0),e.type===`tool_use`&&e.execution===`browser`?(v(),p(O,{key:4,item:e},null,8,[`item`])):o(``,!0),e.type===`tool_use`&&e.tool_name===`ask_user_question`&&e.status===`awaiting_input`&&e.pending_question?(v(),p(k,{key:5,"tool-use-id":e.tool_id||``,payload:e.pending_question,collapsed:!1,onSubmit:d.onAskUserQuestionSubmit,onSkip:d.onAskUserQuestionSkip},null,8,[`tool-use-id`,`payload`,`onSubmit`,`onSkip`])):o(``,!0),e.type===`tool_use`&&e.tool_name===`ask_user_question`&&e.status===`done`?(v(),p(k,{key:6,"tool-use-id":e.tool_id||``,payload:d.askUserQuestionPayloadFromBlock(e),collapsed:!0,"previous-output":e.output||``},null,8,[`tool-use-id`,`payload`,`previous-output`])):o(``,!0),e.type===`tool_use`&&e.tool_name===`request_user_consent`&&e.status===`awaiting_input`&&e.pending_consent_request?(v(),p(A,{key:7,"tool-use-id":e.tool_id||``,payload:e.pending_consent_request,resolved:!1,onSubmit:d.onConnectorConsentSubmit,onAuthorize:d.onConnectorConsentAuthorize},null,8,[`tool-use-id`,`payload`,`onSubmit`,`onAuthorize`])):o(``,!0),e.type===`tool_use`&&e.tool_name===`request_user_consent`&&e.status===`done`&&d.consentPayloadFromBlock(e)?(v(),p(A,{key:8,"tool-use-id":e.tool_id||``,payload:d.consentPayloadFromBlock(e),resolved:!0,"previous-output":e.output||``},null,8,[`tool-use-id`,`payload`,`previous-output`])):o(``,!0),e.type===`card`&&e.card?(v(),p(j,{key:9,card:e.card},null,8,[`card`])):o(``,!0)]))),128))])):(v(),s(`div`,xn,[d.message.role===`assistant`?(v(),p(T,{key:0,content:d.message?.content,citations:d.message.citations},null,8,[`content`,`citations`])):(v(),s(`pre`,Sn,i(d.message.content),1))]))])),d.message.state===d.messageState.PENDING?(v(),p(P,{key:2})):o(``,!0)])),[[z]]),f((v(),s(`div`,kn,[!d.readonly&&d.message.role===`user`&&!d.isEditing&&!Array.isArray(d.message.content)?(v(),p(F,{key:0,class:`btn-edit`,onClick:d.startEditing},null,8,[`onClick`])):o(``,!0),d.copyableText&&d.message.state!==d.messageState.PENDING&&d.message.state!==d.messageState.ANSWERING?(v(),p(I,{key:1,content:d.copyableText,class:`btn-copy`},null,8,[`content`])):o(``,!0),!d.readonly&&(d.message.state===d.messageState.FINISHED||d.message.state===d.messageState.FAILED)&&d.message.role===`assistant`&&d.message===d.messages[d.messages.length-1]?(v(),p(L,{key:2,class:`btn-restart`,messages:d.messages,onRestart:d.onRestart},null,8,[`messages`,`onRestart`])):o(``,!0)])),[[z]])]))],10,gn)}var Pn=V(hn,[[`render`,Nn],[`__scopeId`,`data-v-edea23b0`]]);export{tn as n,q as r,Pn as t};
|