@acedatacloud/nexior 3.255.3 → 3.256.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ApiCodeButton-GoAv7kVI.js → ApiCodeButton-BvAWx38J.js} +1 -1
- package/dist/assets/{Auth-C8fRVvzE.js → Auth-D1zARyMO.js} +1 -1
- package/dist/assets/{BotPlaceholder-D2Bfbs3T.js → BotPlaceholder-Dogry0Kr.js} +1 -1
- package/dist/assets/{Callback-BUoMUqDf.js → Callback-Cd66S9BK.js} +1 -1
- package/dist/assets/{Console-4yIw_bM3.js → Console-C57F3a5r.js} +1 -1
- package/dist/assets/{Consumption-BB_eHQQy.js → Consumption-BkYIuP7X.js} +1 -1
- package/dist/assets/{Conversation-YVp0QanQ.js → Conversation-lhc5kD9Z.js} +1 -1
- package/dist/assets/{CopyToClipboard-BVpxVZ_S.js → CopyToClipboard-CKQPzIHN.js} +1 -1
- package/dist/assets/{Detail-reybQ4u2.js → Detail-CX_yNLC3.js} +2 -2
- package/dist/assets/{Extra-CgneL21l.js → Extra-BpIj6C0_.js} +1 -1
- package/dist/assets/{FilePreview-aYj76HV6.js → FilePreview-DD2Kgucq.js} +1 -1
- package/dist/assets/{Hailuo-qRGeVqhW.js → Hailuo-pRBbDp0w.js} +1 -1
- package/dist/assets/{History-DOvIy7Pd.js → History-D1nk71Zp.js} +1 -1
- package/dist/assets/{ImagePreview-CvYs3vfM.js → ImagePreview-BNUi7OPj.js} +1 -1
- package/dist/assets/{ImageWrapper-DDQxxI_O.js → ImageWrapper-D2jY0PUW.js} +1 -1
- package/dist/assets/{Index-IWl8vPOs.js → Index-828i8jBW.js} +1 -1
- package/dist/assets/Index-B3bh-5gq.css +1 -0
- package/dist/assets/{Index-B7lLPPkB2.js → Index-BponzF1E2.js} +1 -1
- package/dist/assets/{Index-7DSDqYFI.js → Index-Bq2JUX6E.js} +1 -1
- package/dist/assets/{Index-BocKyQiG.js → Index-Bs-n8vO6.js} +1 -1
- package/dist/assets/{Index-B5VWWdjt.js → Index-C0keQ8pG.js} +1 -1
- package/dist/assets/{Index-C_Ps9UEH.js → Index-C7FWoYj_.js} +1 -1
- package/dist/assets/{Index-BT6V1HKH.js → Index-CHP3Utuh.js} +1 -1
- package/dist/assets/{Index-BYCfH4UQ.js → Index-CKJ9ZeIg.js} +1 -1
- package/dist/assets/{Index-DPY3dF3m.js → Index-COX6PlVH.js} +1 -1
- package/dist/assets/{Index-Cjs_FAX5.js → Index-Cb9fGvZn.js} +1 -1
- package/dist/assets/{Index-CiitiXAn.js → Index-Crykox8t.js} +1 -1
- package/dist/assets/{Index-Bqr0WSeL.js → Index-CsWFrl7m.js} +1 -1
- package/dist/assets/{Index-rIv25NTc.js → Index-D8Ax6Y5t.js} +1 -1
- package/dist/assets/{Index-BnYufk91.js → Index-DB60v4d9.js} +1 -1
- package/dist/assets/{Index-C6jQHjUG.js → Index-DHWNqA-Y.js} +1 -1
- package/dist/assets/{Index-CxEeO47n.js → Index-DLJ3LAde.js} +1 -1
- package/dist/assets/{Index-E65XENoG.js → Index-DNdZwylv.js} +1 -1
- package/dist/assets/{Index-CPRYKa7L.js → Index-DhdmIQIf.js} +1 -1
- package/dist/assets/{Index-6ln-9yad.js → Index-DoNeTxil.js} +1 -1
- package/dist/assets/{Index-C6z4Ncqg.js → Index-JuuZTyP4.js} +1 -1
- package/dist/assets/{Index-DH18DuQW2.js → Index-KTJVkiGD2.js} +1 -1
- package/dist/assets/{Index-CivqoyNj.js → Index-NH7KApOR.js} +1 -1
- package/dist/assets/{Index-BJDZCs0v.js → Index-a8hequMT.js} +1 -1
- package/dist/assets/{Index-DMdRFaI5.js → Index-kma4c-md.js} +1 -1
- package/dist/assets/Index-rnICFrbK.js +1 -0
- package/dist/assets/{Invitees-B7oXWZAi.js → Invitees-ByrCb-OA.js} +1 -1
- package/dist/assets/{List-DtSdqIkv.js → List-1kNyGZm_.js} +1 -1
- package/dist/assets/{List-CdWpu9QR.js → List-BwImgkqc.js} +1 -1
- package/dist/assets/{List-meoed4mA.js → List-CBlGtLDh.js} +1 -1
- package/dist/assets/{Main-Cwz0EKSj.js → Main-jPAHZ9M0.js} +1 -1
- package/dist/assets/{Model-Xp2yMyiQ.js → Model-Bz22M5xH.js} +1 -1
- package/dist/assets/{Navigator-D2iMaRZG.js → Navigator-DSwupf0r.js} +1 -1
- package/dist/assets/{NoTasks-BxijkVte.js → NoTasks-D5IPSO1e.js} +1 -1
- package/dist/assets/{NotFound-DU3Xys3U.js → NotFound-C6KOlkti.js} +1 -1
- package/dist/assets/{Pagination-CC7OJYmh.js → Pagination-B0U5Zo9H.js} +1 -1
- package/dist/assets/{Pay-nyq8hSEZ.js → Pay-Ch6IEu0Q.js} +1 -1
- package/dist/assets/{Player-CBYlUU2u.js → Player-B5UVAv6r.js} +1 -1
- package/dist/assets/{Status-CQVxQByQ.js → Status-B6brUD9h.js} +1 -1
- package/dist/assets/{Subscribe-CwH1QqBz.js → Subscribe-Bn_jhDNj.js} +1 -1
- package/dist/assets/{TabSwitcher-BuDPstIu.js → TabSwitcher-6yz6wBJe.js} +1 -1
- package/dist/assets/{Tts-IIoqVMQn.js → Tts-CBcpWg0h.js} +1 -1
- package/dist/assets/{VideoPlayer-BphFPtbi.js → VideoPlayer-CvDb3WYI.js} +1 -1
- package/dist/assets/{avatar-xqroI4mB.js → avatar-DlxuLw-2.js} +1 -1
- package/dist/assets/{basic-DZ1XmGih.js → basic-HIVcgyXc.js} +1 -1
- package/dist/assets/{chat-BAp_QJtR.js → chat-CKgeiuQO.js} +1 -1
- package/dist/assets/{common-FhFyQ6P9.js → common-B-85hIf6.js} +1 -1
- package/dist/assets/{common-DvYovppW.js → common-BGffpcje.js} +1 -1
- package/dist/assets/{common-BBTWWIpn.js → common-BSlcCHi9.js} +1 -1
- package/dist/assets/{common-Ds4hMENx.js → common-BW1ktl-0.js} +1 -1
- package/dist/assets/{common-B3AxESdZ.js → common-C409tH5C.js} +1 -1
- package/dist/assets/{common-ill7vctf.js → common-C68QsR1F.js} +1 -1
- package/dist/assets/{common-61RgeoLd.js → common-CDV9Evla.js} +1 -1
- package/dist/assets/{common-hWCS_vQl.js → common-CnwYKU3V.js} +1 -1
- package/dist/assets/{common-8XFakNUt.js → common-CubZdUiv.js} +1 -1
- package/dist/assets/common-D5vt52Th.js +1 -0
- package/dist/assets/{common-Cphglwx1.js → common-D6zwbvbp.js} +1 -1
- package/dist/assets/{common-BO6VwbMl.js → common-D9gssFIa.js} +1 -1
- package/dist/assets/{common-BHFbjfik.js → common-DAbrOt4b.js} +1 -1
- package/dist/assets/{common-CfIlEo28.js → common-DfZXjXL1.js} +1 -1
- package/dist/assets/{common-zF-h-m3w.js → common-Dujshi5h.js} +1 -1
- package/dist/assets/{common-HOTdQw2T.js → common-RM9mERZO.js} +1 -1
- package/dist/assets/{common-Eo1wthpw.js → common-fL3aSjYa.js} +1 -1
- package/dist/assets/{common-COtwETSs.js → common-juyL6Sek.js} +1 -1
- package/dist/assets/{constants-BjCTsJHD.js → constants-BBPmpf2e.js} +1 -1
- package/dist/assets/{createTaskActions-BMXujOBk.js → createTaskActions-CDkc7G7B.js} +1 -1
- package/dist/assets/{date-picker-BeiR5fR3.js → date-picker-Bdvha3OC.js} +1 -1
- package/dist/assets/{dropdown-SrvW8_-m.js → dropdown-BG-RGU-o.js} +1 -1
- package/dist/assets/{esm-BxOj7DRR.js → esm-CUXacB5s.js} +1 -1
- package/dist/assets/{esm-CEqncFpf.js → esm-CfV0dW7m.js} +1 -1
- package/dist/assets/{esm-CLUpq5tH.js → esm-DCAYIKfL.js} +3 -3
- package/dist/assets/{esm-DfvdUDYY.js → esm-DeDOvG4w.js} +1 -1
- package/dist/assets/{esm-Cg8kS4eu.js → esm-DpsZgMQj.js} +2 -2
- package/dist/assets/{fish-CM3NLcie.js → fish-Dv8eSyc-.js} +1 -1
- package/dist/assets/{flux-CEyeTXmt.js → flux-9RDrRl-z.js} +1 -1
- package/dist/assets/{hailuo-Ub3mjjmg.js → hailuo-Bl4fIdE0.js} +1 -1
- package/dist/assets/{headshots-BOrYaEXU.js → headshots--fYjhFdZ.js} +1 -1
- package/dist/assets/{image-O6VGxJ4Z.js → image-ZJJR3Ibj.js} +1 -1
- package/dist/assets/{index-BEH1eMIF.js → index-BlUS5P9H.js} +4 -4
- package/dist/assets/{index.browser.esm-C_vTrcNl.js → index.browser.esm-q0cD6zBm.js} +1 -1
- package/dist/assets/{index.es-Cu-xLibc.js → index.es-C3NHsxpC.js} +1 -1
- package/dist/assets/{input-number-BY8xiJw4.js → input-number-BpriDPEo.js} +1 -1
- package/dist/assets/{kling-BwRu9r7O.js → kling-CIYjnuMB.js} +1 -1
- package/dist/assets/{luma-C0iHPaWy.js → luma-CpL6fF8o.js} +1 -1
- package/dist/assets/{midjourney-DLQbuBWJ.js → midjourney-BLaXWisb.js} +1 -1
- package/dist/assets/{nanobanana-OeKCiySC.js → nanobanana-C9fUEO-o.js} +1 -1
- package/dist/assets/{openaiimage-DHude_1i.js → openaiimage-BO905rVZ.js} +1 -1
- package/dist/assets/{pagination-CmmKdLWA.js → pagination-Bo13XA_w.js} +1 -1
- package/dist/assets/{pika-D8nvcs0H.js → pika-CNVkigqK.js} +1 -1
- package/dist/assets/{pixverse-CG91aFds.js → pixverse-tUQ8d3jz.js} +1 -1
- package/dist/assets/{producer-Dr1YI5ux.js → producer-CZiDbghM.js} +1 -1
- package/dist/assets/{qrart-3YqlIyR4.js → qrart-C9PCnt44.js} +1 -1
- package/dist/assets/{seedance-O82PbFh4.js → seedance-CPqKVdZs.js} +1 -1
- package/dist/assets/{seedream-Cda6wIj6.js → seedream-BRUN53Bu.js} +1 -1
- package/dist/assets/{select-DJVdiAM5.js → select-BorFmC0p.js} +1 -1
- package/dist/assets/{serp-C2CIcJzP.js → serp-DZcs10Xa.js} +1 -1
- package/dist/assets/{slider-CSu4Seu9.js → slider-ObcWWKew.js} +1 -1
- package/dist/assets/{solana-wallets-Cwwo2oLI.js → solana-wallets-CBWqUAnv.js} +2 -2
- package/dist/assets/{solana-wallets-vue-C3uEqVar.js → solana-wallets-vue-n-DZH-zE.js} +1 -1
- package/dist/assets/{sora-lBMyyydc.js → sora-C5mimbFD.js} +1 -1
- package/dist/assets/{suno-BwgVgv5D.js → suno-gNAooVpM.js} +1 -1
- package/dist/assets/{switch-DIZDXF7V.js → switch-DJHf-mwW.js} +1 -1
- package/dist/assets/{veo-CyLabkj3.js → veo-ygKkeIbi.js} +1 -1
- package/dist/assets/{wan-bsezUp4w.js → wan-E4HoDMeD.js} +1 -1
- package/dist/assets/{web-Ds-HhzBV.js → web-9ZQl_KBJ.js} +1 -1
- package/dist/assets/{web-Bfzyz1lT.js → web-BwfFXiM2.js} +1 -1
- package/dist/assets/{web-xlk-fOO5.js → web-CYqK9msJ.js} +1 -1
- package/dist/assets/{web-DwgER7rS.js → web-DhGCaF17.js} +1 -1
- package/dist/assets/{webextrator-TxofSkE3.js → webextrator-8XpE-IYZ.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/Index-CvffvHPr.css +0 -1
- package/dist/assets/Index-lb3x9_CN.js +0 -1
- package/dist/assets/common-B8THI3k-.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,P as i,Q as a,Ut as o,X as s,et as c,k as l,lt as u,tt as d,ut as f,x as p}from"./vendor-chart-Df3WBvr0.js";import{t as m}from"./button-DgZFgZDr.js";import{r as h,t as g}from"./select-DJVdiAM5.js";import{n as _,t as v}from"./table-mXtDbICN.js";import{t as y}from"./date-picker-BeiR5fR3.js";import{t as b}from"./card-pDppUT2_.js";import{n as x,t as S}from"./row-BgYJmo3R.js";import{t as C}from"./Pagination-CC7OJYmh.js";import{t as w}from"./skeleton-k2vAVQdD.js";import{At as T,Er as E,S as D,_n as O,rr as k}from"./index-BEH1eMIF.js";import{t as A}from"./index.es-Cu-xLibc.js";import{t as j}from"./CopyToClipboard-BVpxVZ_S.js";var M={total_count:0,total_spent:0,state_counts:{}},N=i({name:`ConsoleOrderList`,components:{Pagination:C,CopyToClipboard:j,ElRow:S,ElCol:x,ElTable:v,ElTableColumn:_,ElButton:m,ElTag:E,ElCard:b,ElSelect:h,ElOption:g,ElDatePicker:y,ElSkeleton:w,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:T,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,O.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,O.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...M}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,O.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(i,m,h,g,_,v){let y=c(`el-col`),b=c(`el-row`),x=c(`el-skeleton`),S=c(`font-awesome-icon`),C=c(`el-card`),w=c(`el-option`),T=c(`el-select`),E=c(`el-date-picker`),D=c(`el-button`),O=c(`copy-to-clipboard`),k=c(`el-table-column`),A=c(`el-tag`),j=c(`el-table`),M=c(`pagination`),N=d(`loading`);return s(),e(b,{class:`panel`},{default:u(()=>[r(y,{span:24},{default:u(()=>[r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[t(`h2`,P,o(i.$t(`common.title.allOrders`)),1)]),_:1})]),_:1}),r(b,{gutter:16},{default:u(()=>[r(y,{md:6,sm:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:u(()=>[i.summaryLoading?(s(),e(x,{key:0})):(s(),l(`div`,F,[t(`div`,I,[r(S,{icon:`fa-solid fa-receipt`,class:`icon`})]),t(`p`,L,o(i.$t(`order.title.totalOrders`)),1),t(`p`,R,o(i.summary.total_count),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:u(()=>[i.summaryLoading?(s(),e(x,{key:0})):(s(),l(`div`,z,[t(`div`,B,[r(S,{icon:`fa-solid fa-dollar-sign`,class:`icon`})]),t(`p`,V,o(i.$t(`order.title.totalSpent`)),1),t(`p`,H,o(i.getPriceString({value:i.summary.total_spent})),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:u(()=>[i.summaryLoading?(s(),e(x,{key:0})):(s(),l(`div`,U,[t(`div`,W,[r(S,{icon:`fa-solid fa-check-circle`,class:`icon`})]),t(`p`,ee,o(i.$t(`order.title.finishedOrders`)),1),t(`p`,G,o(i.summary.state_counts?.Finished||0),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:u(()=>[i.summaryLoading?(s(),e(x,{key:0})):(s(),l(`div`,K,[t(`div`,q,[r(S,{icon:`fa-solid fa-clock`,class:`icon`})]),t(`p`,J,o(i.$t(`order.title.pendingOrders`)),1),t(`p`,Y,o(i.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),t(`div`,X,[r(T,{modelValue:i.filterState,"onUpdate:modelValue":m[0]||=e=>i.filterState=e,clearable:``,placeholder:i.$t(`order.field.allStates`),class:`filter-select`,onChange:i.onFilterChange},{default:u(()=>[(s(!0),l(p,null,a(i.stateOptions,t=>(s(),e(w,{key:t.value,label:t.label,value:t.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(T,{modelValue:i.filterPayWay,"onUpdate:modelValue":m[1]||=e=>i.filterPayWay=e,clearable:``,placeholder:i.$t(`order.field.allPayWays`),class:`filter-select`,onChange:i.onFilterChange},{default:u(()=>[(s(!0),l(p,null,a(i.payWayOptions,t=>(s(),e(w,{key:t.value,label:t.label,value:t.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(E,{modelValue:i.createdAtRange,"onUpdate:modelValue":m[2]||=e=>i.createdAtRange=e,type:`datetimerange`,shortcuts:i.shortcuts,"range-separator":i.$t(`usage.placeholder.to`),"start-placeholder":i.$t(`usage.placeholder.startDate`),"end-placeholder":i.$t(`usage.placeholder.endDate`),onChange:i.onFilterChange},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`]),r(D,{type:`primary`,plain:``,loading:i.exporting,onClick:i.onExport},{default:u(()=>[r(S,{icon:`fa-solid fa-file-export`,class:`mr-1`}),n(` `+o(i.$t(`order.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[r(C,{shadow:`hover`},{default:u(()=>[f((s(),e(j,{data:i.orders,stripe:``,"empty-text":i.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:u(()=>[r(k,{prop:`id`,label:i.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:u(e=>[t(`span`,Z,o(e.row.id),1),t(`span`,Q,[r(O,{content:e.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(k,{label:i.$t(`order.field.price`),width:`110px`,align:`center`},{default:u(e=>[t(`span`,$,o(i.getPriceString({value:e.row?.price})),1)]),_:1},8,[`label`]),r(k,{label:i.$t(`order.field.description`),"min-width":`220px`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:u(e=>[t(`span`,te,o(e.row.description),1)]),_:1},8,[`label`]),r(k,{prop:`state`,label:i.$t(`order.field.state`),width:`130px`,align:`center`},{default:u(e=>[r(A,{type:i.stateTagType(e.row.state),class:`mx-1`,effect:`dark`,round:``,size:`small`},{default:u(()=>[n(o(i.stateLabel(e.row.state)),1)]),_:2},1032,[`type`])]),_:1},8,[`label`]),r(k,{label:i.$t(`order.field.payWay`),width:`120px`,align:`center`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:u(e=>[t(`span`,ne,o(e.row.pay_way||`-`),1)]),_:1},8,[`label`]),r(k,{label:i.$t(`order.field.createdAt`),width:`200px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[t(`span`,re,o(i.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`]),r(k,{"min-width":`130px`,fixed:`right`},{default:u(r=>[t(`div`,ie,[i.isPendingAction(r.row.state)?(s(),e(D,{key:0,type:`primary`,size:`small`,onClick:e=>i.goToDetail(r.row.id)},{default:u(()=>[n(o(i.$t(`order.button.continuePay`)),1)]),_:1},8,[`onClick`])):(s(),e(D,{key:1,size:`small`,onClick:e=>i.goToDetail(r.row.id)},{default:u(()=>[n(o(i.$t(`order.button.checkDetail`)),1)]),_:1},8,[`onClick`]))])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[N,i.loading]])]),_:1})]),_:1})]),_:1}),r(b,null,{default:u(()=>[r(y,{span:10,offset:14},{default:u(()=>[t(`div`,ae,[r(M,{"current-page":i.page,"page-size":i.limit,total:i.total,onChange:i.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var se=D(N,[[`render`,oe],[`__scopeId`,`data-v-350ab467`]]);export{se as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,P as i,Q as a,Ut as o,X as s,et as c,k as l,lt as u,tt as d,ut as f,x as p}from"./vendor-chart-Df3WBvr0.js";import{t as m}from"./button-DgZFgZDr.js";import{r as h,t as g}from"./select-BorFmC0p.js";import{n as _,t as v}from"./table-mXtDbICN.js";import{t as y}from"./date-picker-Bdvha3OC.js";import{t as b}from"./card-pDppUT2_.js";import{n as x,t as S}from"./row-BgYJmo3R.js";import{t as C}from"./Pagination-B0U5Zo9H.js";import{t as w}from"./skeleton-k2vAVQdD.js";import{At as T,Er as E,S as D,_n as O,rr as k}from"./index-BlUS5P9H.js";import{t as A}from"./index.es-C3NHsxpC.js";import{t as j}from"./CopyToClipboard-CKQPzIHN.js";var M={total_count:0,total_spent:0,state_counts:{}},N=i({name:`ConsoleOrderList`,components:{Pagination:C,CopyToClipboard:j,ElRow:S,ElCol:x,ElTable:v,ElTableColumn:_,ElButton:m,ElTag:E,ElCard:b,ElSelect:h,ElOption:g,ElDatePicker:y,ElSkeleton:w,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:T,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,O.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,O.getSummary(this.filterQuery).then(({data:e})=>{this.summary=e}).catch(()=>{this.summary={...M}}).finally(()=>{this.summaryLoading=!1})},onExport(){this.exporting=!0,O.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(i,m,h,g,_,v){let y=c(`el-col`),b=c(`el-row`),x=c(`el-skeleton`),S=c(`font-awesome-icon`),C=c(`el-card`),w=c(`el-option`),T=c(`el-select`),E=c(`el-date-picker`),D=c(`el-button`),O=c(`copy-to-clipboard`),k=c(`el-table-column`),A=c(`el-tag`),j=c(`el-table`),M=c(`pagination`),N=d(`loading`);return s(),e(b,{class:`panel`},{default:u(()=>[r(y,{span:24},{default:u(()=>[r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[t(`h2`,P,o(i.$t(`common.title.allOrders`)),1)]),_:1})]),_:1}),r(b,{gutter:16},{default:u(()=>[r(y,{md:6,sm:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:u(()=>[i.summaryLoading?(s(),e(x,{key:0})):(s(),l(`div`,F,[t(`div`,I,[r(S,{icon:`fa-solid fa-receipt`,class:`icon`})]),t(`p`,L,o(i.$t(`order.title.totalOrders`)),1),t(`p`,R,o(i.summary.total_count),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:u(()=>[i.summaryLoading?(s(),e(x,{key:0})):(s(),l(`div`,z,[t(`div`,B,[r(S,{icon:`fa-solid fa-dollar-sign`,class:`icon`})]),t(`p`,V,o(i.$t(`order.title.totalSpent`)),1),t(`p`,H,o(i.getPriceString({value:i.summary.total_spent})),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:u(()=>[i.summaryLoading?(s(),e(x,{key:0})):(s(),l(`div`,U,[t(`div`,W,[r(S,{icon:`fa-solid fa-check-circle`,class:`icon`})]),t(`p`,ee,o(i.$t(`order.title.finishedOrders`)),1),t(`p`,G,o(i.summary.state_counts?.Finished||0),1)]))]),_:1})]),_:1}),r(y,{md:6,sm:12,xs:24},{default:u(()=>[r(C,{shadow:`hover`,class:`item-mini mb-3`},{default:u(()=>[i.summaryLoading?(s(),e(x,{key:0})):(s(),l(`div`,K,[t(`div`,q,[r(S,{icon:`fa-solid fa-clock`,class:`icon`})]),t(`p`,J,o(i.$t(`order.title.pendingOrders`)),1),t(`p`,Y,o(i.summary.state_counts?.Pending||0),1)]))]),_:1})]),_:1})]),_:1}),t(`div`,X,[r(T,{modelValue:i.filterState,"onUpdate:modelValue":m[0]||=e=>i.filterState=e,clearable:``,placeholder:i.$t(`order.field.allStates`),class:`filter-select`,onChange:i.onFilterChange},{default:u(()=>[(s(!0),l(p,null,a(i.stateOptions,t=>(s(),e(w,{key:t.value,label:t.label,value:t.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(T,{modelValue:i.filterPayWay,"onUpdate:modelValue":m[1]||=e=>i.filterPayWay=e,clearable:``,placeholder:i.$t(`order.field.allPayWays`),class:`filter-select`,onChange:i.onFilterChange},{default:u(()=>[(s(!0),l(p,null,a(i.payWayOptions,t=>(s(),e(w,{key:t.value,label:t.label,value:t.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]),r(E,{modelValue:i.createdAtRange,"onUpdate:modelValue":m[2]||=e=>i.createdAtRange=e,type:`datetimerange`,shortcuts:i.shortcuts,"range-separator":i.$t(`usage.placeholder.to`),"start-placeholder":i.$t(`usage.placeholder.startDate`),"end-placeholder":i.$t(`usage.placeholder.endDate`),onChange:i.onFilterChange},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`]),r(D,{type:`primary`,plain:``,loading:i.exporting,onClick:i.onExport},{default:u(()=>[r(S,{icon:`fa-solid fa-file-export`,class:`mr-1`}),n(` `+o(i.$t(`order.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),r(b,null,{default:u(()=>[r(y,{span:24},{default:u(()=>[r(C,{shadow:`hover`},{default:u(()=>[f((s(),e(j,{data:i.orders,stripe:``,"empty-text":i.$t(`common.message.noData`),class:`min-h-[calc(100vh-450px)] mb-[20px]`},{default:u(()=>[r(k,{prop:`id`,label:i.$t(`order.field.id`),"class-name":`text-center`,width:`200px`},{default:u(e=>[t(`span`,Z,o(e.row.id),1),t(`span`,Q,[r(O,{content:e.row.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(k,{label:i.$t(`order.field.price`),width:`110px`,align:`center`},{default:u(e=>[t(`span`,$,o(i.getPriceString({value:e.row?.price})),1)]),_:1},8,[`label`]),r(k,{label:i.$t(`order.field.description`),"min-width":`220px`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:u(e=>[t(`span`,te,o(e.row.description),1)]),_:1},8,[`label`]),r(k,{prop:`state`,label:i.$t(`order.field.state`),width:`130px`,align:`center`},{default:u(e=>[r(A,{type:i.stateTagType(e.row.state),class:`mx-1`,effect:`dark`,round:``,size:`small`},{default:u(()=>[n(o(i.stateLabel(e.row.state)),1)]),_:2},1032,[`type`])]),_:1},8,[`label`]),r(k,{label:i.$t(`order.field.payWay`),width:`120px`,align:`center`,"class-name":`hidden md:table-cell`,"label-class-name":`hidden md:table-cell`},{default:u(e=>[t(`span`,ne,o(e.row.pay_way||`-`),1)]),_:1},8,[`label`]),r(k,{label:i.$t(`order.field.createdAt`),width:`200px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[t(`span`,re,o(i.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`]),r(k,{"min-width":`130px`,fixed:`right`},{default:u(r=>[t(`div`,ie,[i.isPendingAction(r.row.state)?(s(),e(D,{key:0,type:`primary`,size:`small`,onClick:e=>i.goToDetail(r.row.id)},{default:u(()=>[n(o(i.$t(`order.button.continuePay`)),1)]),_:1},8,[`onClick`])):(s(),e(D,{key:1,size:`small`,onClick:e=>i.goToDetail(r.row.id)},{default:u(()=>[n(o(i.$t(`order.button.checkDetail`)),1)]),_:1},8,[`onClick`]))])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[N,i.loading]])]),_:1})]),_:1})]),_:1}),r(b,null,{default:u(()=>[r(y,{span:10,offset:14},{default:u(()=>[t(`div`,ae,[r(M,{"current-page":i.page,"page-size":i.limit,total:i.total,onChange:i.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var se=D(N,[[`render`,oe],[`__scopeId`,`data-v-350ab467`]]);export{se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,Ut as o,X as s,et as c,k as l,lt as u,tt as d,ut as f}from"./vendor-chart-Df3WBvr0.js";import{t as p}from"./button-DgZFgZDr.js";import{n as m,t as h}from"./table-mXtDbICN.js";import{t as g}from"./card-pDppUT2_.js";import{n as _,t as v}from"./row-BgYJmo3R.js";import{t as y}from"./Pagination-
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,Ut as o,X as s,et as c,k as l,lt as u,tt as d,ut as f}from"./vendor-chart-Df3WBvr0.js";import{t as p}from"./button-DgZFgZDr.js";import{n as m,t as h}from"./table-mXtDbICN.js";import{t as g}from"./card-pDppUT2_.js";import{n as _,t as v}from"./row-BgYJmo3R.js";import{t as y}from"./Pagination-B0U5Zo9H.js";import{t as b}from"./skeleton-k2vAVQdD.js";import{t as x}from"./switch-DJHf-mwW.js";import{Er as S,F as C,S as w,_r as T,cr as E,k as D,lr as O,nr as k,tr as A,wn as j,xr as M}from"./index-BlUS5P9H.js";import{t as N}from"./index.es-C3NHsxpC.js";import{t as P}from"./CopyToClipboard-CKQPzIHN.js";var F=a({name:`ConsoleApplicationList`,components:{Pagination:y,CopyToClipboard:P,ElTable:h,ElRow:v,ElButton:p,ElCol:_,ElTag:S,ElSkeleton:b,ElSwitch:x,ElTableColumn:m,ElCard:g,FontAwesomeIcon:N},data(){return{credentialType:A,serviceType:k,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`)},showPayment(){return!T()}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{updateAllowConsumeGlobal(e,t){!e||!e.id||j.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{M.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{M.error(this.$t(`application.message.updateFailed`).toString())})},onGoUsage(e){this.$router.push({name:C,query:{application_id:e.id,type:e?.service?.type}})},onBuyMore(e){e?.id&&this.$router.push({name:D,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=E.INDIVIDUAL){return new Promise((t,n)=>{j.getAll({limit:this.limit,...e===E.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:O.USAGE,scope:e}).then(({data:n})=>{e===E.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{M.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(E.INDIVIDUAL),this.onFetchApplications(E.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){j.create({type:O.USAGE,scope:E.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(E.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}`}}}),I={class:`title`},L={key:1,class:`summary-card`},R={class:`icon-wrapper`},z={class:`label`},B={class:`value`},V={class:`description`},H={key:1,class:`flex flex-row justify-between align-center`},U={class:`summary-card`},W={class:`flex justify-start items-center gap-2 mb-2 w-full`},G={class:`icon-wrapper !mb-0`},K={class:`text-[var(--el-text-color-regular)] text-[14px] truncate`},q={class:`label`},J={class:`value`},Y={class:`description`},X={class:`flex flex-col items-end gap-2`},Z={class:`copy`},Q={key:0,class:`expired-at`},$={class:`flex flex-wrap items-center justify-end gap-1`},ee={class:`pagination`};function te(a,p,m,h,g,_){let v=c(`el-col`),y=c(`el-row`),b=c(`el-skeleton`),x=c(`font-awesome-icon`),S=c(`el-card`),C=c(`copy-to-clipboard`),w=c(`el-button`),T=c(`el-table-column`),E=c(`el-tag`),D=c(`el-switch`),O=c(`el-table`),k=c(`pagination`),A=d(`loading`);return s(),e(y,{class:`application-list`},{default:u(()=>[r(v,{span:24},{default:u(()=>[r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[t(`h2`,I,o(a.$t(`common.title.allApplications`)),1)]),_:1})]),_:1}),r(y,{gutter:15,class:`mb-3`},{default:u(()=>[r(v,{md:12,xs:24},{default:u(()=>[r(S,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[a.loading?(s(),e(b,{key:0})):(s(),l(`div`,L,[t(`div`,R,[r(x,{icon:`fa-solid fa-cubes-stacked`})]),t(`p`,z,o(a.$t(`application.title.count`)),1),t(`p`,B,o(a.individualApplicationsTotal),1),t(`p`,V,o(a.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),a.showPayment&&a.globalApplications?.length>0?(s(),e(v,{key:0,md:12,xs:24},{default:u(()=>[r(S,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[a.loading?(s(),e(b,{key:0})):(s(),l(`div`,H,[t(`div`,U,[t(`div`,W,[t(`div`,G,[r(x,{icon:`fa-solid fa-wallet`})]),t(`span`,K,[n(o(a.$t(`application.field.id`))+`: `+o(a.globalApplications?.[0]?.id)+` `,1),a.globalApplications?.[0]?.id?(s(),e(C,{key:0,content:a.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),t(`p`,q,o(a.$t(`application.title.globalBalance`)),1),t(`p`,J,o(a.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+o(a.$t(`service.unit.credits`)),1),t(`p`,Y,o(a.$t(`application.message.globalBalanceDescription`)),1)]),t(`div`,X,[r(w,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:p[0]||=e=>a.onGoUsage(a.globalApplications?.[0])},{default:u(()=>[r(x,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),n(` `+o(a.$t(`application.button.usage`)),1)]),_:1}),a.showPayment?(s(),e(w,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:p[1]||=e=>a.onBuyMore(a.globalApplications?.[0])},{default:u(()=>[r(x,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),n(` `+o(a.$t(`application.button.buyMore`)),1)]),_:1})):i(``,!0)])]))]),_:1})]),_:1})):i(``,!0)]),_:1}),r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[r(S,{shadow:`hover`,class:`applications-table-card`},{default:u(()=>[f((s(),e(O,{data:a.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":a.$t(`common.message.noData`)},{default:u(()=>[r(T,{prop:`id`,label:a.$t(`application.field.id`),width:`200px`,"class-name":`text-center`},{default:u(e=>[t(`span`,null,o(e.row.id),1),t(`span`,Z,[r(C,{content:e?.row?.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(T,{label:a.$t(`application.field.type`),width:`90px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(t=>[t.row?.type===`Period`?(s(),e(E,{key:0,type:`success`,effect:`dark`,round:``},{default:u(()=>[n(o(a.$t(`application.type.period`)),1)]),_:1})):t.row?.type===`Usage`?(s(),e(E,{key:1,effect:`dark`,round:``},{default:u(()=>[n(o(a.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(T,{label:a.$t(`application.field.name`),width:`180px`},{default:u(r=>[t(`span`,null,o(r.row?.service?.title),1),r.row?.role===`grantee`?(s(),e(E,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:u(()=>[n(o(a.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(T,{prop:`remaining_amount`,label:a.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:u(e=>[t(`span`,null,o(a.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),r(T,{prop:`used_amount`,label:a.$t(`application.field.usedAmount`),width:`150px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[t(`span`,null,o(a.getUsedAmount(e.row)),1)]),_:1},8,[`label`]),r(T,{prop:`allow_consume_global`,label:a.$t(`application.field.allowConsumeGlobal`),width:`120px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(t=>[t.row.service?.type===a.serviceType.API?(s(),e(D,{key:0,modelValue:t.row.allow_consume_global,"onUpdate:modelValue":e=>t.row.allow_consume_global=e,"active-value":!0,"inactive-value":!1,onChange:e=>a.updateAllowConsumeGlobal(t.row,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])):i(``,!0)]),_:1},8,[`label`]),r(T,{label:a.$t(`application.field.expiredAt`),width:`180px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.expired_at?(s(),l(`span`,Q,o(a.$dayjs.format(e.row.expired_at)),1)):i(``,!0)]),_:1},8,[`label`]),r(T,{fixed:`right`,width:`200px`},{default:u(c=>[t(`div`,$,[r(w,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:e=>a.onGoUsage(c?.row)},{default:u(()=>[r(x,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),n(` `+o(a.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),a.showPayment?(s(),e(w,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>a.onBuyMore(c?.row)},{default:u(()=>[r(x,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),n(` `+o(a.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[A,a.loading]])]),_:1})]),_:1})]),_:1}),r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[t(`div`,ee,[r(k,{"current-page":a.page,"page-size":a.limit,total:a.individualApplicationsTotal,onChange:a.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var ne=w(F,[[`render`,te],[`__scopeId`,`data-v-7182b838`]]);export{ne as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,Q as o,Ut as s,X as c,_ as l,a as u,c as d,et as f,i as ee,k as p,lt as m,n as h,o as g,r as _,s as v,t as y,tt as b,ut as x,x as S}from"./vendor-chart-Df3WBvr0.js";import{t as C}from"./button-DgZFgZDr.js";import{r as w,t as T}from"./select-DJVdiAM5.js";import{n as E,t as D}from"./table-mXtDbICN.js";import{n as O,t as k}from"./tabs-DT_RvYVg.js";import{t as A}from"./date-picker-BeiR5fR3.js";import{t as j}from"./card-pDppUT2_.js";import{n as M,r as N}from"./radio-DNLlMkjf.js";import{n as P,t as F}from"./row-BgYJmo3R.js";import{t as I}from"./Pagination-CC7OJYmh.js";import{n as L,t as R}from"./skeleton-k2vAVQdD.js";import{Er as z,S as B,bn as V,lr as H,nr as U,tr as W,vn as G,wn as K,wr as q,yn as J}from"./index-BEH1eMIF.js";import{t as Y}from"./index.es-Cu-xLibc.js";import{t as X}from"./CopyToClipboard-BVpxVZ_S.js";ee.register(_,u,h,v,d,g);var Z=a({name:`ConsoleUsageList`,components:{Pagination:I,ElTag:z,ElDatePicker:A,ElTable:D,ElSelect:w,ElOption:T,CopyToClipboard:X,ElRow:F,ElCol:P,ElTableColumn:E,ElCard:j,ElRadioButton:M,ElRadioGroup:N,ElSkeleton:R,ElSkeletonItem:L,ElDialog:q,ElTabs:O,ElTabPane:k,ElButton:C,FontAwesomeIcon:Y,BarChart:y},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:W,serviceType:U,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()||U.API,loading:!1,total:void 0,limit:15,totalUsed:0,barChartLabels:[],barChartSeries:[],aggLoading:!1,detailDialogVisible:!1,detailRow:null,detailActiveTab:`request`,detailLoading:!1,exporting:!1,statusCodeFilter:this.$route.query.status_code?.toString()||``,statusCodeOptions:[],statusCodeOptionsLoading:!1}},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}))}},barChartOptions(){return{responsive:!0,plugins:{legend:{position:`top`,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:!0,text:this.$t(`usage.title.usageTrend`)}},scales:{x:{stacked:!0},y:{stacked:!0,beginAtZero:!0}}}}},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()}}},mounted(){this.onFetchApplications(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()},methods:{async onFetchUsages(){this.type===U.API?this.onFetchApiUsages():this.type===U.Proxy&&this.onFetchProxyUsages()},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(){console.log(`onTimeRangeChanged`,this.createdAtRange),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 J.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},onShowDetail(e){this.detailRow={...e,metadata:void 0},this.detailActiveTab=`request`,this.detailDialogVisible=!0,this.detailLoading=!0,e.id&&J.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(){K.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:H.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,G.getAll({limit:100,offset:0,ordering:`-created_at`}).then(({data:e})=>{this.apis=e.items}).catch(()=>{}).finally(()=>{this.apisLoading=!1})},onFetchApiUsages(){console.log(`onFetchApiUsages`,this.createdAtRange),this.loading=!0,J.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}:{}}).then(({data:e})=>{this.apiUsages=e.items,this.loading=!1,this.total=e.count}).catch(()=>{this.loading=!1})},onFetchProxyUsages(){this.loading=!0,V.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})=>{this.proxyUsages=e.items,this.loading=!1,this.total=e.count}).catch(()=>{this.loading=!1})},onExport(){this.exporting=!0,J.exportCsv({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}:{}}).then(({data:e})=>{let t=window.URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`usages.csv`,n.click(),window.URL.revokeObjectURL(t)}).catch(()=>{}).finally(()=>{this.exporting=!1})},async onFetchAggregate(){if(this.aggLoading=!0,this.type!==this.serviceType.API)return;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]}:{}};try{let{data:t}=await J.getAggregate(e);this.totalUsed=t.total||0;let n=Array.from(new Set((t.items||[]).map(e=>e.date))).sort(),r=Array.from(new Set((t.items||[]).map(e=>e.api_id))),i=e=>`hsl(${e*57%360}, 70%, 60%)`,a=r.map((e,r)=>{let a=t.apis?.[e]?.title||e,o={};return(t.items||[]).filter(t=>t.api_id===e).forEach(e=>{o[e.date]=e.amount||0}),{key:e,label:a,data:n.map(e=>o[e]||0),color:i(r)}});this.barChartLabels=n,this.barChartSeries=a}finally{this.aggLoading=!1}}}}),Q={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},$={class:`inline-block w-9`},te={class:`inline-block`},ne={key:1,class:`summary-card`},re={class:`icon-wrapper`},ie={class:`text-left`},ae={class:`description`},oe={class:`value`},se={class:`chart-wrapper`},ce={key:0},le={key:1},ue={class:`flex flex-wrap gap-2`},de={class:`key`},fe={key:0,class:`cursor-pointer`},pe={class:`created-at`},me={class:`created-at`},he={key:1,class:`detail-json`},ge={key:2,class:`text-gray-400`},_e={key:1,class:`detail-json`},ve={key:2,class:`text-gray-400`},ye={class:`float-right`};function be(a,u,d,ee,h,g){let _=f(`el-col`),v=f(`el-row`),y=f(`el-radio-button`),C=f(`el-radio-group`),w=f(`el-option`),T=f(`el-select`),E=f(`el-skeleton-item`),D=f(`el-skeleton`),O=f(`el-date-picker`),k=f(`font-awesome-icon`),A=f(`el-button`),j=f(`el-card`),M=f(`bar-chart`),N=f(`el-table-column`),P=f(`el-tag`),F=f(`copy-to-clipboard`),I=f(`el-table`),L=f(`el-tab-pane`),R=f(`el-tabs`),z=f(`el-dialog`),B=f(`pagination`),V=b(`loading`);return c(),e(v,null,{default:m(()=>[r(_,{span:24},{default:m(()=>[r(v,null,{default:m(()=>[r(_,{span:24},{default:m(()=>[t(`h2`,Q,s(a.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),r(v,null,{default:m(()=>[r(_,{md:4,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:m(()=>[t(`span`,null,s(a.$t(`application.field.type`)),1),r(C,{modelValue:a.type,"onUpdate:modelValue":u[0]||=e=>a.type=e},{default:m(()=>[r(y,{value:a.serviceType.API,label:a.$t(`application.field.api`)},null,8,[`value`,`label`]),r(y,{value:a.serviceType.Proxy,label:a.$t(`application.field.proxy`)},null,8,[`value`,`label`])]),_:1},8,[`modelValue`])]),_:1}),x(r(_,{md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:m(()=>[t(`span`,$,s(a.$t(`usage.field.application`)),1),r(T,{modelValue:a.applicationIds,"onUpdate:modelValue":u[1]||=e=>a.applicationIds=e,placeholder:a.$t(`usage.field.application`),clearable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:a.onApplicationsChange},{default:m(()=>[(c(!0),p(S,null,o(a.applications,t=>(c(),e(w,{key:t.id,label:t.service?.title,value:t?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[l,!1]]),a.type===a.serviceType.API?(c(),e(_,{key:0,md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:m(()=>[t(`span`,te,s(a.$t(`usage.field.api`)),1),a.apisLoading?(c(),e(D,{key:0,animated:``,class:`w-full`},{template:m(()=>[r(E,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(c(),e(T,{key:1,modelValue:a.apiIds,"onUpdate:modelValue":u[2]||=e=>a.apiIds=e,placeholder:a.$t(`usage.field.api`),clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:a.onApisChange},{default:m(()=>[(c(!0),p(S,null,o(a.apis,t=>(c(),e(w,{key:t?.id,label:t?.title,value:t?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]))]),_:1})):i(``,!0),a.type===a.serviceType.API?(c(),e(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:m(()=>[r(O,{modelValue:a.createdAtRange,"onUpdate:modelValue":u[3]||=e=>a.createdAtRange=e,type:`datetimerange`,class:`w-full`,shortcuts:a.shortcuts,"range-separator":a.$t(`usage.placeholder.to`),"start-placeholder":a.$t(`usage.placeholder.startDate`),"end-placeholder":a.$t(`usage.placeholder.endDate`),onChange:a.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):i(``,!0),a.type===a.serviceType.API?(c(),e(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:m(()=>[r(T,{modelValue:a.statusCodeFilter,"onUpdate:modelValue":u[4]||=e=>a.statusCodeFilter=e,placeholder:a.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:a.statusCodeOptionsLoading,onChange:a.onStatusCodeChange},{default:m(()=>[(c(!0),p(S,null,o(a.statusCodeOptions,t=>(c(),e(w,{key:t,label:String(t),value:String(t)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):i(``,!0),a.type===a.serviceType.API?(c(),e(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:m(()=>[r(A,{type:`primary`,plain:``,loading:a.exporting,class:`w-full whitespace-nowrap`,onClick:a.onExport},{default:m(()=>[r(k,{icon:`fa-solid fa-file-export`,class:`mr-1`}),n(` `+s(a.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):i(``,!0)]),_:1}),r(v,null,{default:m(()=>[r(_,{span:24},{default:m(()=>[a.type===a.serviceType.API?(c(),e(v,{key:0,gutter:24,class:`mb-5`},{default:m(()=>[r(_,{md:6,xs:24},{default:m(()=>[r(j,{shadow:`hover`,class:`h-full`},{default:m(()=>[a.aggLoading?(c(),e(D,{key:0})):(c(),p(`div`,ne,[t(`div`,re,[r(k,{icon:`fa-solid fa-cubes`,class:`icon`})]),t(`div`,ie,[t(`p`,ae,s(a.$t(`usage.title.totalUsed`)),1),t(`p`,oe,s(a.totalUsedString),1)])]))]),_:1})]),_:1}),r(_,{md:18,xs:24},{default:m(()=>[r(j,{shadow:`hover`,class:`h-full`},{default:m(()=>[t(`div`,se,[a.aggLoading?(c(),e(D,{key:0,class:`w-full`})):(c(),e(M,{key:1,data:a.barChartData,options:a.barChartOptions,class:`chart`},null,8,[`data`,`options`]))])]),_:1})]),_:1})]),_:1})):i(``,!0),r(j,{shadow:`hover`},{default:m(()=>[a.type===a.serviceType.API?x((c(),e(I,{key:0,data:a.apiUsages,stripe:``,"table-layout":`fixed`,"empty-text":a.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:m(()=>[r(N,{label:a.$t(`application.field.name`),width:`160px`},{default:m(e=>[t(`span`,null,s(e.row?.api?.title),1)]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.field.statusCode`),width:`120px`},{default:m(e=>[t(`span`,null,s(e.row.status_code),1)]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.field.elapsed`),width:`120px`},{default:m(e=>[t(`span`,null,s(a.formatElapsed(e.row.elapsed)),1)]),_:1},8,[`label`]),r(N,{prop:`deducted_amount`,label:a.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:m(e=>[a.getDeductedAmount(e.row)===a.getOriginalAmount(e.row)?(c(),p(`div`,ce,[t(`span`,null,s(a.getDeductedAmount(e.row)),1)])):(c(),p(`div`,le,[u[7]||=t(`p`,null,null,-1),t(`p`,null,[t(`span`,null,s(a.getDeductedAmount(e.row)),1)]),t(`p`,null,[t(`del`,null,s(a.getOriginalAmount(e.row)),1)])]))]),_:1},8,[`label`]),r(N,{prop:`remaining_amount`,label:a.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:m(e=>[t(`span`,null,s(a.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),r(N,{prop:`metadata`,label:a.$t(`usage.field.metadata`),width:`260px`,"class-name":`text-center`},{default:m(r=>[t(`div`,ue,[r.row.original_amount>r.row.deducted_amount&&r.row.original_amount>0?(c(),e(P,{key:0,type:`success`,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:m(()=>[n(s(((r.row.original_amount-r.row.deducted_amount)*100/r.row.original_amount).toFixed(0)+`% OFF`),1)]),_:2},1024)):i(``,!0),(c(!0),p(S,null,o(a.getSimpleMetadata(r.row.metadata),(t,r)=>(c(),e(P,{key:r,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:m(()=>[n(s(r)+`: `+s(t),1)]),_:2},1024))),128))])]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:m(t=>[t.row.id?(c(),e(A,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:e=>a.onShowDetail(t.row)},{default:m(()=>[n(s(a.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):i(``,!0)]),_:1},8,[`label`]),r(N,{prop:`trace_id`,label:a.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:m(e=>[t(`span`,de,s(e.row.trace_id),1),e.row.trace_id?(c(),p(`span`,fe,[r(F,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):i(``,!0)]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.field.createdAt`),width:`200px`},{default:m(e=>[t(`span`,pe,s(a.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[V,a.loading]]):i(``,!0),a.type===a.serviceType.Proxy?x((c(),e(I,{key:1,data:a.proxyUsages,stripe:``,"table-layout":`fixed`,"empty-text":a.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:m(()=>[r(N,{label:a.$t(`application.field.name`),width:`160px`},{default:m(e=>[t(`span`,null,s(e.row?.service?.title),1)]),_:1},8,[`label`]),r(N,{prop:`remaining_amount`,label:a.$t(`usage.field.remainingAmount`),width:`160px`,"class-name":`text-center`},{default:m(e=>[t(`span`,null,s(a.getRemainingAmount(e.row)),1),t(`span`,null,s(a.getOriginalAmount(e.row)),1)]),_:1},8,[`label`]),r(N,{prop:`deducted_amount`,label:a.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:m(e=>[t(`span`,null,s(a.getDeductedAmount(e.row)),1)]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:m(e=>[t(`span`,null,s(a.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),r(N,{prop:`metadata`,label:a.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:m(t=>[(c(!0),p(S,null,o(t.row.metadata,(t,r)=>(c(),e(P,{key:r,class:`mb-2`},{default:m(()=>[n(s(r)+`: `+s(t),1)]),_:2},1024))),128))]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.field.createdAt`),width:`200px`},{default:m(e=>[t(`span`,me,s(a.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[V,a.loading]]):i(``,!0)]),_:1})]),_:1})]),_:1}),r(z,{modelValue:a.detailDialogVisible,"onUpdate:modelValue":u[6]||=e=>a.detailDialogVisible=e,title:a.$t(`usage.dialog.detailTitle`),width:`70%`,top:`5vh`,"destroy-on-close":``},{default:m(()=>[r(R,{modelValue:a.detailActiveTab,"onUpdate:modelValue":u[5]||=e=>a.detailActiveTab=e},{default:m(()=>[r(L,{label:a.$t(`usage.dialog.request`),name:`request`},{default:m(()=>[a.detailLoading?(c(),e(D,{key:0,rows:6,animated:``})):a.detailRow?.metadata?.request?(c(),p(`pre`,he,s(a.formatJson(a.detailRow.metadata.request)),1)):(c(),p(`p`,ge,s(a.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),r(L,{label:a.$t(`usage.dialog.response`),name:`response`},{default:m(()=>[a.detailLoading?(c(),e(D,{key:0,rows:6,animated:``})):a.detailRow?.metadata?.response?(c(),p(`pre`,_e,s(a.formatJson(a.detailRow.metadata.response)),1)):(c(),p(`p`,ve,s(a.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`]),r(v,null,{default:m(()=>[r(_,{span:10,offset:14},{default:m(()=>[t(`div`,ye,[r(B,{"current-page":a.page,"page-size":a.limit,total:a.total,onChange:a.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var xe=B(Z,[[`render`,be],[`__scopeId`,`data-v-38f1845c`]]);export{xe as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,Q as o,Ut as s,X as c,_ as l,a as u,c as d,et as f,i as ee,k as p,lt as m,n as h,o as g,r as _,s as v,t as y,tt as b,ut as x,x as S}from"./vendor-chart-Df3WBvr0.js";import{t as C}from"./button-DgZFgZDr.js";import{r as w,t as T}from"./select-BorFmC0p.js";import{n as E,t as D}from"./table-mXtDbICN.js";import{n as O,t as k}from"./tabs-DT_RvYVg.js";import{t as A}from"./date-picker-Bdvha3OC.js";import{t as j}from"./card-pDppUT2_.js";import{n as M,r as N}from"./radio-DNLlMkjf.js";import{n as P,t as F}from"./row-BgYJmo3R.js";import{t as I}from"./Pagination-B0U5Zo9H.js";import{n as L,t as R}from"./skeleton-k2vAVQdD.js";import{Er as z,S as B,bn as V,lr as H,nr as U,tr as W,vn as G,wn as K,wr as q,yn as J}from"./index-BlUS5P9H.js";import{t as Y}from"./index.es-C3NHsxpC.js";import{t as X}from"./CopyToClipboard-CKQPzIHN.js";ee.register(_,u,h,v,d,g);var Z=a({name:`ConsoleUsageList`,components:{Pagination:I,ElTag:z,ElDatePicker:A,ElTable:D,ElSelect:w,ElOption:T,CopyToClipboard:X,ElRow:F,ElCol:P,ElTableColumn:E,ElCard:j,ElRadioButton:M,ElRadioGroup:N,ElSkeleton:R,ElSkeletonItem:L,ElDialog:q,ElTabs:O,ElTabPane:k,ElButton:C,FontAwesomeIcon:Y,BarChart:y},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:W,serviceType:U,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()||U.API,loading:!1,total:void 0,limit:15,totalUsed:0,barChartLabels:[],barChartSeries:[],aggLoading:!1,detailDialogVisible:!1,detailRow:null,detailActiveTab:`request`,detailLoading:!1,exporting:!1,statusCodeFilter:this.$route.query.status_code?.toString()||``,statusCodeOptions:[],statusCodeOptionsLoading:!1}},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}))}},barChartOptions(){return{responsive:!0,plugins:{legend:{position:`top`,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:!0,text:this.$t(`usage.title.usageTrend`)}},scales:{x:{stacked:!0},y:{stacked:!0,beginAtZero:!0}}}}},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()}}},mounted(){this.onFetchApplications(),this.onFetchApis(),this.onFetchUsages(),this.onFetchAggregate(),this.onFetchStatusCodeOptions()},methods:{async onFetchUsages(){this.type===U.API?this.onFetchApiUsages():this.type===U.Proxy&&this.onFetchProxyUsages()},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(){console.log(`onTimeRangeChanged`,this.createdAtRange),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 J.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},onShowDetail(e){this.detailRow={...e,metadata:void 0},this.detailActiveTab=`request`,this.detailDialogVisible=!0,this.detailLoading=!0,e.id&&J.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(){K.getAll({limit:100,offset:0,user_id:this.$store.getters.user.id,ordering:`-created_at`,type:H.USAGE}).then(({data:e})=>{this.applications=e.items.filter(e=>e?.service?.type===this.type)}).catch(()=>{})},onFetchApis(){this.apisLoading=!0,G.getAll({limit:100,offset:0,ordering:`-created_at`}).then(({data:e})=>{this.apis=e.items}).catch(()=>{}).finally(()=>{this.apisLoading=!1})},onFetchApiUsages(){console.log(`onFetchApiUsages`,this.createdAtRange),this.loading=!0,J.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}:{}}).then(({data:e})=>{this.apiUsages=e.items,this.loading=!1,this.total=e.count}).catch(()=>{this.loading=!1})},onFetchProxyUsages(){this.loading=!0,V.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})=>{this.proxyUsages=e.items,this.loading=!1,this.total=e.count}).catch(()=>{this.loading=!1})},onExport(){this.exporting=!0,J.exportCsv({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}:{}}).then(({data:e})=>{let t=window.URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`usages.csv`,n.click(),window.URL.revokeObjectURL(t)}).catch(()=>{}).finally(()=>{this.exporting=!1})},async onFetchAggregate(){if(this.aggLoading=!0,this.type!==this.serviceType.API)return;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]}:{}};try{let{data:t}=await J.getAggregate(e);this.totalUsed=t.total||0;let n=Array.from(new Set((t.items||[]).map(e=>e.date))).sort(),r=Array.from(new Set((t.items||[]).map(e=>e.api_id))),i=e=>`hsl(${e*57%360}, 70%, 60%)`,a=r.map((e,r)=>{let a=t.apis?.[e]?.title||e,o={};return(t.items||[]).filter(t=>t.api_id===e).forEach(e=>{o[e.date]=e.amount||0}),{key:e,label:a,data:n.map(e=>o[e]||0),color:i(r)}});this.barChartLabels=n,this.barChartSeries=a}finally{this.aggLoading=!1}}}}),Q={class:`text-[26px] font-bold mb-5 text-[var(--el-text-color-primary)]`},$={class:`inline-block w-9`},te={class:`inline-block`},ne={key:1,class:`summary-card`},re={class:`icon-wrapper`},ie={class:`text-left`},ae={class:`description`},oe={class:`value`},se={class:`chart-wrapper`},ce={key:0},le={key:1},ue={class:`flex flex-wrap gap-2`},de={class:`key`},fe={key:0,class:`cursor-pointer`},pe={class:`created-at`},me={class:`created-at`},he={key:1,class:`detail-json`},ge={key:2,class:`text-gray-400`},_e={key:1,class:`detail-json`},ve={key:2,class:`text-gray-400`},ye={class:`float-right`};function be(a,u,d,ee,h,g){let _=f(`el-col`),v=f(`el-row`),y=f(`el-radio-button`),C=f(`el-radio-group`),w=f(`el-option`),T=f(`el-select`),E=f(`el-skeleton-item`),D=f(`el-skeleton`),O=f(`el-date-picker`),k=f(`font-awesome-icon`),A=f(`el-button`),j=f(`el-card`),M=f(`bar-chart`),N=f(`el-table-column`),P=f(`el-tag`),F=f(`copy-to-clipboard`),I=f(`el-table`),L=f(`el-tab-pane`),R=f(`el-tabs`),z=f(`el-dialog`),B=f(`pagination`),V=b(`loading`);return c(),e(v,null,{default:m(()=>[r(_,{span:24},{default:m(()=>[r(v,null,{default:m(()=>[r(_,{span:24},{default:m(()=>[t(`h2`,Q,s(a.$t(`common.title.allUsages`)),1)]),_:1})]),_:1}),r(v,null,{default:m(()=>[r(_,{md:4,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:m(()=>[t(`span`,null,s(a.$t(`application.field.type`)),1),r(C,{modelValue:a.type,"onUpdate:modelValue":u[0]||=e=>a.type=e},{default:m(()=>[r(y,{value:a.serviceType.API,label:a.$t(`application.field.api`)},null,8,[`value`,`label`]),r(y,{value:a.serviceType.Proxy,label:a.$t(`application.field.proxy`)},null,8,[`value`,`label`])]),_:1},8,[`modelValue`])]),_:1}),x(r(_,{md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:m(()=>[t(`span`,$,s(a.$t(`usage.field.application`)),1),r(T,{modelValue:a.applicationIds,"onUpdate:modelValue":u[1]||=e=>a.applicationIds=e,placeholder:a.$t(`usage.field.application`),clearable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:a.onApplicationsChange},{default:m(()=>[(c(!0),p(S,null,o(a.applications,t=>(c(),e(w,{key:t.id,label:t.service?.title,value:t?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`])]),_:1},512),[[l,!1]]),a.type===a.serviceType.API?(c(),e(_,{key:0,md:6,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:m(()=>[t(`span`,te,s(a.$t(`usage.field.api`)),1),a.apisLoading?(c(),e(D,{key:0,animated:``,class:`w-full`},{template:m(()=>[r(E,{variant:`rect`,style:{height:`32px`,"border-radius":`4px`}})]),_:1})):(c(),e(T,{key:1,modelValue:a.apiIds,"onUpdate:modelValue":u[2]||=e=>a.apiIds=e,placeholder:a.$t(`usage.field.api`),clearable:``,filterable:``,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,class:`w-full`,onChange:a.onApisChange},{default:m(()=>[(c(!0),p(S,null,o(a.apis,t=>(c(),e(w,{key:t?.id,label:t?.title,value:t?.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`onChange`]))]),_:1})):i(``,!0),a.type===a.serviceType.API?(c(),e(_,{key:1,md:8,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:m(()=>[r(O,{modelValue:a.createdAtRange,"onUpdate:modelValue":u[3]||=e=>a.createdAtRange=e,type:`datetimerange`,class:`w-full`,shortcuts:a.shortcuts,"range-separator":a.$t(`usage.placeholder.to`),"start-placeholder":a.$t(`usage.placeholder.startDate`),"end-placeholder":a.$t(`usage.placeholder.endDate`),onChange:a.onTimeRangeChanged},null,8,[`modelValue`,`shortcuts`,`range-separator`,`start-placeholder`,`end-placeholder`,`onChange`])]),_:1})):i(``,!0),a.type===a.serviceType.API?(c(),e(_,{key:2,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center`},{default:m(()=>[r(T,{modelValue:a.statusCodeFilter,"onUpdate:modelValue":u[4]||=e=>a.statusCodeFilter=e,placeholder:a.$t(`usage.option.statusCodeAll`),class:`w-full`,clearable:``,filterable:``,"allow-create":``,"default-first-option":``,loading:a.statusCodeOptionsLoading,onChange:a.onStatusCodeChange},{default:m(()=>[(c(!0),p(S,null,o(a.statusCodeOptions,t=>(c(),e(w,{key:t,label:String(t),value:String(t)},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`loading`,`onChange`])]),_:1})):i(``,!0),a.type===a.serviceType.API?(c(),e(_,{key:3,md:3,xs:24,class:`mb-5 flex px-2 gap-2 items-center justify-end`},{default:m(()=>[r(A,{type:`primary`,plain:``,loading:a.exporting,class:`w-full whitespace-nowrap`,onClick:a.onExport},{default:m(()=>[r(k,{icon:`fa-solid fa-file-export`,class:`mr-1`}),n(` `+s(a.$t(`usage.button.export`)),1)]),_:1},8,[`loading`,`onClick`])]),_:1})):i(``,!0)]),_:1}),r(v,null,{default:m(()=>[r(_,{span:24},{default:m(()=>[a.type===a.serviceType.API?(c(),e(v,{key:0,gutter:24,class:`mb-5`},{default:m(()=>[r(_,{md:6,xs:24},{default:m(()=>[r(j,{shadow:`hover`,class:`h-full`},{default:m(()=>[a.aggLoading?(c(),e(D,{key:0})):(c(),p(`div`,ne,[t(`div`,re,[r(k,{icon:`fa-solid fa-cubes`,class:`icon`})]),t(`div`,ie,[t(`p`,ae,s(a.$t(`usage.title.totalUsed`)),1),t(`p`,oe,s(a.totalUsedString),1)])]))]),_:1})]),_:1}),r(_,{md:18,xs:24},{default:m(()=>[r(j,{shadow:`hover`,class:`h-full`},{default:m(()=>[t(`div`,se,[a.aggLoading?(c(),e(D,{key:0,class:`w-full`})):(c(),e(M,{key:1,data:a.barChartData,options:a.barChartOptions,class:`chart`},null,8,[`data`,`options`]))])]),_:1})]),_:1})]),_:1})):i(``,!0),r(j,{shadow:`hover`},{default:m(()=>[a.type===a.serviceType.API?x((c(),e(I,{key:0,data:a.apiUsages,stripe:``,"table-layout":`fixed`,"empty-text":a.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:m(()=>[r(N,{label:a.$t(`application.field.name`),width:`160px`},{default:m(e=>[t(`span`,null,s(e.row?.api?.title),1)]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.field.statusCode`),width:`120px`},{default:m(e=>[t(`span`,null,s(e.row.status_code),1)]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.field.elapsed`),width:`120px`},{default:m(e=>[t(`span`,null,s(a.formatElapsed(e.row.elapsed)),1)]),_:1},8,[`label`]),r(N,{prop:`deducted_amount`,label:a.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:m(e=>[a.getDeductedAmount(e.row)===a.getOriginalAmount(e.row)?(c(),p(`div`,ce,[t(`span`,null,s(a.getDeductedAmount(e.row)),1)])):(c(),p(`div`,le,[u[7]||=t(`p`,null,null,-1),t(`p`,null,[t(`span`,null,s(a.getDeductedAmount(e.row)),1)]),t(`p`,null,[t(`del`,null,s(a.getOriginalAmount(e.row)),1)])]))]),_:1},8,[`label`]),r(N,{prop:`remaining_amount`,label:a.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:m(e=>[t(`span`,null,s(a.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),r(N,{prop:`metadata`,label:a.$t(`usage.field.metadata`),width:`260px`,"class-name":`text-center`},{default:m(r=>[t(`div`,ue,[r.row.original_amount>r.row.deducted_amount&&r.row.original_amount>0?(c(),e(P,{key:0,type:`success`,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:m(()=>[n(s(((r.row.original_amount-r.row.deducted_amount)*100/r.row.original_amount).toFixed(0)+`% OFF`),1)]),_:2},1024)):i(``,!0),(c(!0),p(S,null,o(a.getSimpleMetadata(r.row.metadata),(t,r)=>(c(),e(P,{key:r,style:{textWrap:`wrap`,height:`fit-content`,lineHeight:`20px`,borderRadius:`10px`}},{default:m(()=>[n(s(r)+`: `+s(t),1)]),_:2},1024))),128))])]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.button.viewDetail`),width:`120px`,"class-name":`text-center`},{default:m(t=>[t.row.id?(c(),e(A,{key:0,type:`primary`,plain:``,size:`small`,class:`!px-2 !py-1 !text-xs !h-auto !min-h-0`,onClick:e=>a.onShowDetail(t.row)},{default:m(()=>[n(s(a.$t(`usage.button.viewDetail`)),1)]),_:1},8,[`onClick`])):i(``,!0)]),_:1},8,[`label`]),r(N,{prop:`trace_id`,label:a.$t(`application.field.traceId`),width:`200px`,"class-name":`text-center`},{default:m(e=>[t(`span`,de,s(e.row.trace_id),1),e.row.trace_id?(c(),p(`span`,fe,[r(F,{content:e.row.trace_id,class:`inline-block`},null,8,[`content`])])):i(``,!0)]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.field.createdAt`),width:`200px`},{default:m(e=>[t(`span`,pe,s(a.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[V,a.loading]]):i(``,!0),a.type===a.serviceType.Proxy?x((c(),e(I,{key:1,data:a.proxyUsages,stripe:``,"table-layout":`fixed`,"empty-text":a.$t(`common.message.noData`),class:`min-h-[calc(100vh-350px)] mb-5`},{default:m(()=>[r(N,{label:a.$t(`application.field.name`),width:`160px`},{default:m(e=>[t(`span`,null,s(e.row?.service?.title),1)]),_:1},8,[`label`]),r(N,{prop:`remaining_amount`,label:a.$t(`usage.field.remainingAmount`),width:`160px`,"class-name":`text-center`},{default:m(e=>[t(`span`,null,s(a.getRemainingAmount(e.row)),1),t(`span`,null,s(a.getOriginalAmount(e.row)),1)]),_:1},8,[`label`]),r(N,{prop:`deducted_amount`,label:a.$t(`usage.field.deductedAmount`),width:`150px`,"class-name":`text-center`},{default:m(e=>[t(`span`,null,s(a.getDeductedAmount(e.row)),1)]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.field.balanceAfter`),width:`160px`,"class-name":`text-center`},{default:m(e=>[t(`span`,null,s(a.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),r(N,{prop:`metadata`,label:a.$t(`usage.field.metadata`),width:`200px`,"class-name":`text-center`},{default:m(t=>[(c(!0),p(S,null,o(t.row.metadata,(t,r)=>(c(),e(P,{key:r,class:`mb-2`},{default:m(()=>[n(s(r)+`: `+s(t),1)]),_:2},1024))),128))]),_:1},8,[`label`]),r(N,{label:a.$t(`usage.field.createdAt`),width:`200px`},{default:m(e=>[t(`span`,me,s(a.$dayjs.format(e.row.created_at)),1)]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[V,a.loading]]):i(``,!0)]),_:1})]),_:1})]),_:1}),r(z,{modelValue:a.detailDialogVisible,"onUpdate:modelValue":u[6]||=e=>a.detailDialogVisible=e,title:a.$t(`usage.dialog.detailTitle`),width:`70%`,top:`5vh`,"destroy-on-close":``},{default:m(()=>[r(R,{modelValue:a.detailActiveTab,"onUpdate:modelValue":u[5]||=e=>a.detailActiveTab=e},{default:m(()=>[r(L,{label:a.$t(`usage.dialog.request`),name:`request`},{default:m(()=>[a.detailLoading?(c(),e(D,{key:0,rows:6,animated:``})):a.detailRow?.metadata?.request?(c(),p(`pre`,he,s(a.formatJson(a.detailRow.metadata.request)),1)):(c(),p(`p`,ge,s(a.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`]),r(L,{label:a.$t(`usage.dialog.response`),name:`response`},{default:m(()=>[a.detailLoading?(c(),e(D,{key:0,rows:6,animated:``})):a.detailRow?.metadata?.response?(c(),p(`pre`,_e,s(a.formatJson(a.detailRow.metadata.response)),1)):(c(),p(`p`,ve,s(a.$t(`usage.dialog.noData`)),1))]),_:1},8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`modelValue`,`title`]),r(v,null,{default:m(()=>[r(_,{span:10,offset:14},{default:m(()=>[t(`div`,ye,[r(B,{"current-page":a.page,"page-size":a.limit,total:a.total,onChange:a.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var xe=B(Z,[[`render`,be],[`__scopeId`,`data-v-38f1845c`]]);export{xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,T as o,Ut as s,X as c,et as l,k as u,lt as d}from"./vendor-chart-Df3WBvr0.js";import{t as f}from"./button-DgZFgZDr.js";import{t as p}from"./Navigator-
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,T as o,Ut as s,X as c,et as l,k as u,lt as d}from"./vendor-chart-Df3WBvr0.js";import{t as f}from"./button-DgZFgZDr.js";import{t as p}from"./Navigator-DSwupf0r.js";import{t as m}from"./checkbox-CKgwxnhw.js";import{t as h}from"./divider-DntlVH34.js";import"./constants-BBPmpf2e.js";import{Ot as g,S as _,cr as v,dr as y,lr as b,mr as x,wn as S,wr as C,xr as w}from"./index-BlUS5P9H.js";import{t as T}from"./Status-B6brUD9h.js";var E=a({name:`ApplicationConfirm`,components:{ElDialog:C,ElDivider:h,ElCheckbox:m,ElButton:f},props:{visible:{type:Boolean,required:!1,default:!1}},emits:[`update:visible`,`apply`],data(){return{checked:!0}},watch:{},methods:{getBaseUrlPlatform:x,onApply(){if(!this.checked){w.error(this.$t(`application.message.notAgreePolicy`));return}this.$emit(`apply`)}}}),D={class:`content py-[10px] px-[40px]`},O={class:`my-4`},k={class:`policy mb-[10px]`},A={class:`policy-title text-[12px] relative -bottom-[3px]`},j=[`href`];function M(i,a,o,u,f,p){let m=l(`el-divider`),h=l(`el-checkbox`),g=l(`el-button`),_=l(`el-dialog`);return c(),e(_,{"model-value":i.visible,width:`500px`,title:i.$t(`application.message.welcome`),center:``,onClose:a[1]||=e=>i.$emit(`update:visible`,!1)},{default:d(()=>[t(`div`,D,[t(`p`,O,s(i.$t(`application.message.notApplied`)),1),r(m,{class:`my-2`}),t(`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`]),t(`span`,A,s(i.$t(`application.message.readPolicy`)),1),t(`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`+s(i.$t(`application.message.policy`)),9,j)]),r(g,{round:``,type:`primary`,onClick:i.onApply},{default:d(()=>[n(s(i.$t(`common.button.start`)),1)]),_:1},8,[`onClick`])])]),_:1},8,[`model-value`,`title`])}var N=a({name:`LayoutMain`,components:{Navigator:p,ApplicationStatus:T,ApplicationConfirm:_(E,[[`render`,M]])},provide(){return{initialized:o(()=>this.initialized)}},data(){return{initialized:!1,applying:!1,mobile:window.innerWidth<768,initializeRunId:0}},computed:{appName(){return this.$route.meta.appName},application(){return this.$store.state[this.appName]?.application},applications(){let e=this.$store.state[this.appName]?.applications??[];console.debug(`individualApplications`,e);let t=this.$store.state.applications??[];return console.debug(`globalApplications`,t),t.concat(e)},loading(){return this.$store.state[this.appName]?.status?.getApplications===y.Request},service(){return this.$store.state[this.appName]?.service},userId(){return this.$store.state.user?.id}},watch:{appName(){this.initialize()},userId(e,t){e&&e!==t&&this.initialize()}},mounted(){this.initialize(),window.addEventListener(`resize`,this.onResize)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize)},methods:{onResize(){this.mobile=window.innerWidth<768},async initialize(){let e=++this.initializeRunId;if(this.initialized=!1,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=g(this.applications,t);console.debug(`final application`,n),n&&(console.debug(`set final application`,n,n?.type),await this.$store.dispatch(`${this.appName}/setApplication`,n)),console.debug(`finished initialization`),this.initialized=!0},onApply(){this.onAutoApply()},async onAutoApply(){try{await S.create({type:b.USAGE,scope:v.GLOBAL,user_id:this.$store.getters.user.id}),this.applying=!1,await this.$store.dispatch(`getApplications`),this.showWelcomeToast()}catch(e){e?.response?.data?.code===`duplication`?await this.$store.dispatch(`getApplications`):w.error(this.$t(`application.message.applyFailed`))}},showWelcomeToast(){let e=this.$store.state.applications?.[0],t=Math.floor(e?.remaining_amount??0);w({message:t>0?this.$t(`application.message.welcomeWithCredits`,{credits:t}):this.$t(`application.message.welcomeNoCredits`),type:`success`,duration:6e3,showClose:!0})}}}),P={class:`wrapper`};function F(t,n,a,o,s,d){let f=l(`router-view`),p=l(`navigator`),m=l(`application-status`),h=l(`application-confirm`);return c(),u(`div`,P,[r(f,{class:`main`}),r(p,{class:`navigator`,direction:t.mobile?`row`:`column`},null,8,[`direction`]),t.application?(c(),e(m,{key:0,class:`status-floating fixed right-2 z-[200]`,application:t.application,applications:t.applications,"show-price":!1,authenticated:!!t.$store.state.token.access,service:t.service,onSelect:n[0]||=e=>t.$store.dispatch(`${t.appName}/setApplication`,e)},null,8,[`application`,`applications`,`authenticated`,`service`])):i(``,!0),r(h,{modelValue:t.applying,"onUpdate:modelValue":n[1]||=e=>t.applying=e,modelModifiers:{visible:!0},onApply:t.onApply},null,8,[`modelValue`,`onApply`])])}var I=_(N,[[`render`,F],[`__scopeId`,`data-v-319483e1`]]);export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{Bt as e,D as t,E as n,M as r,N as i,O as a,P as o,Q as ee,Ut as s,X as c,et as l,k as u,lt as d,x as f,y as p}from"./vendor-chart-Df3WBvr0.js";import{t as m}from"./button-DgZFgZDr.js";import{t as h}from"./upload-DFPa_BD4.js";import{t as g}from"./image-O6VGxJ4Z.js";import{t as _}from"./alert-Bgv5POrX.js";import{n as v,r as y}from"./radio-DNLlMkjf.js";import{t as b}from"./switch-DIZDXF7V.js";import{t as x}from"./vendor-axios-Ck2ffRoh.js";import"./constants-BjCTsJHD.js";import{Ht as S,Or as C,S as w,Tt as te,U as T,mr as E,xr as D}from"./index-BEH1eMIF.js";import{t as O}from"./index.es-Cu-xLibc.js";import{t as k}from"./CopyToClipboard-BVpxVZ_S.js";import{t as A}from"./Hailuo-qRGeVqhW.js";import{t as j}from"./BotPlaceholder-D2Bfbs3T.js";import{t as M}from"./TabSwitcher-BuDPstIu.js";var N=4,P=90,F=o({name:`FishRecorder`,components:{ElButton:m,FontAwesomeIcon:O},emits:[`done`,`cancel`,`update:script`],data(){return{state:`idle`,scriptIndex:0,seconds:0,timerId:0,maxTimerId:0,mediaRecorder:null,stream:null,chunks:[],recordedBlob:null,recordedUrl:``,uploading:!1}},computed:{formattedTime(){let e=Math.floor(this.seconds/60),t=this.seconds%60;return`${e.toString().padStart(2,`0`)}:${t.toString().padStart(2,`0`)}`},currentScript(){let e=`fish.script.passage${this.scriptIndex%N+1}`;return this.$t(e)}},beforeUnmount(){this.cleanup()},mounted(){this.$emit(`update:script`,this.currentScript)},methods:{nextScript(){this.scriptIndex=(this.scriptIndex+1)%N,this.$emit(`update:script`,this.currentScript)},async startRecord(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){D.error(this.$t(`fish.message.recorderUnsupported`));return}try{this.stream=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){let t=e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`;D.error(this.$t(t?`fish.message.micDenied`:`fish.message.micError`));return}this.chunks=[];let e=this.pickMimeType();try{this.mediaRecorder=e?new MediaRecorder(this.stream,{mimeType:e}):new MediaRecorder(this.stream)}catch{this.mediaRecorder=new MediaRecorder(this.stream)}this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.chunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.chunks,{type:this.mediaRecorder?.mimeType||`audio/webm`});this.recordedBlob=e,this.recordedUrl=URL.createObjectURL(e),this.state=`recorded`,this.releaseStream()},this.mediaRecorder.start(),this.state=`recording`,this.seconds=0,this.timerId=window.setInterval(()=>{this.seconds++},1e3),this.maxTimerId=window.setTimeout(()=>{this.state===`recording`&&this.stopRecord()},P*1e3)},stopRecord(){this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),window.clearInterval(this.timerId),window.clearTimeout(this.maxTimerId)},reset(){this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl),this.recordedUrl=``,this.recordedBlob=null,this.state=`idle`,this.seconds=0},onCancel(){this.cleanup(),this.$emit(`cancel`)},cleanup(){this.stopRecord(),this.releaseStream(),this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl)},releaseStream(){this.stream?.getTracks().forEach(e=>e.stop()),this.stream=null},pickMimeType(){for(let e of[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg`])if(typeof MediaRecorder<`u`&&MediaRecorder.isTypeSupported?.(e))return e},extensionForMime(e){return e.includes(`webm`)?`webm`:e.includes(`mp4`)?`m4a`:e.includes(`ogg`)?`ogg`:e.includes(`wav`)?`wav`:`mp3`},async useRecording(){if(this.recordedBlob){if(this.seconds<3){D.warning(this.$t(`fish.message.recordingTooShort`));return}this.uploading=!0;try{let e=this.$store.state.token?.access,t=this.extensionForMime(this.recordedBlob.type||``),n=new File([this.recordedBlob],`recording-${Date.now()}.${t}`,{type:this.recordedBlob.type||`audio/webm`}),r=new FormData;r.append(`file`,n);let{data:i}=await x.post(`${E()}/api/v1/files/`,r,{headers:{Authorization:`Bearer ${e}`}}),a=i?.file_url;if(!a){D.error(this.$t(`fish.message.uploadError`));return}this.$emit(`done`,{url:a,text:this.currentScript})}catch(e){D.error(this.$t(`fish.message.uploadError`)),console.error(`recorder upload failed`,e)}finally{this.uploading=!1}}}}}),I={class:`recorder`},L={key:0,class:`script`},R={class:`script-header`},z={class:`label`},B={class:`script-text`},V={class:`controls`},H={class:`status`},U={class:`hint`},W={key:1,class:`preview`},G=[`src`],K={class:`preview-actions`},q={class:`footer`};function J(o,ee,f,p,m,h){let g=l(`font-awesome-icon`),_=l(`el-button`);return c(),u(`div`,I,[o.state===`recorded`?a(``,!0):(c(),u(`div`,L,[n(`div`,R,[i(g,{icon:`fa-solid fa-book-open`,class:`icon mr-1`}),n(`span`,z,s(o.$t(`fish.description.readScript`)),1),i(_,{link:``,size:`small`,class:`ml-auto`,disabled:o.state===`recording`,onClick:o.nextScript},{default:d(()=>[i(g,{icon:`fa-solid fa-shuffle`,class:`mr-1`}),r(` `+s(o.$t(`fish.button.nextScript`)),1)]),_:1},8,[`disabled`,`onClick`])]),n(`p`,B,s(o.currentScript),1)])),n(`div`,V,[o.state===`idle`?(c(),t(_,{key:0,type:`danger`,circle:``,size:`large`,title:o.$t(`fish.button.startRecord`),onClick:o.startRecord},{default:d(()=>[i(g,{icon:`fa-solid fa-microphone`})]),_:1},8,[`title`,`onClick`])):o.state===`recording`?(c(),t(_,{key:1,type:`warning`,circle:``,size:`large`,title:o.$t(`fish.button.stopRecord`),onClick:o.stopRecord},{default:d(()=>[i(g,{icon:`fa-solid fa-stop`})]),_:1},8,[`title`,`onClick`])):a(``,!0),n(`div`,H,[n(`span`,{class:e([`timer`,o.state===`recording`?`live`:``])},s(o.formattedTime),3),n(`span`,U,s(o.state===`idle`?o.$t(`fish.description.recorderIdle`):o.state===`recording`?o.$t(`fish.description.recorderRecording`):o.$t(`fish.description.recorderRecorded`)),1)])]),o.state===`recorded`&&o.recordedUrl?(c(),u(`div`,W,[n(`audio`,{src:o.recordedUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,G),n(`div`,K,[i(_,{size:`small`,disabled:o.uploading,onClick:o.reset},{default:d(()=>[i(g,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),r(` `+s(o.$t(`fish.button.reRecord`)),1)]),_:1},8,[`disabled`,`onClick`]),i(_,{size:`small`,type:`primary`,loading:o.uploading,onClick:o.useRecording},{default:d(()=>[i(g,{icon:`fa-solid fa-check`,class:`mr-1`}),r(` `+s(o.$t(`fish.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])])])):a(``,!0),n(`div`,q,[i(_,{link:``,size:`small`,disabled:o.uploading||o.state===`recording`,onClick:o.onCancel},{default:d(()=>[r(s(o.$t(`fish.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Y=w(F,[[`render`,J],[`__scopeId`,`data-v-1958e4a1`]]),X=50*1024*1024,Z=()=>({title:``,description:``,texts:``,voicesUrl:``,visibility:`unlist`,trainMode:`fast`,enhanceAudio:!0,generateSample:!1}),Q=o({name:`FishModelConfigPanel`,components:{ElButton:m,ElInput:C,ElRadioButton:v,ElRadioGroup:y,ElSwitch:b,ElUpload:h,FontAwesomeIcon:O,Recorder:Y},mixins:[te],emits:[`create`],data(){return{form:Z(),fileList:[],uploading:!1,creating:!1,recording:!1,textsAuto:!0}},computed:{uploadUrl(){return E()+`/api/v1/files/`},uploadHeaders(){return{Authorization:`Bearer ${this.$store.state.token?.access}`}},canCreate(){return!!this.form.title.trim()&&!!this.form.voicesUrl&&!this.uploading&&!this.creating},supportsRecorder(){return!!(typeof navigator<`u`?navigator.mediaDevices:void 0)?.getUserMedia&&typeof MediaRecorder<`u`}},methods:{onBeforeUpload(e){return e.size>X?(D.warning(this.$t(`fish.message.audioSizeExceed`)),!1):(this.uploading=!0,!0)},onExceed(){D.warning(this.$t(`fish.message.audioOnlyOne`))},onUploadError(){this.uploading=!1,D.error(this.$t(`fish.message.uploadError`))},onUploadSuccess(e,t,n){this.uploading=!1;let r=e?.file_url;if(!r){D.error(this.$t(`fish.message.uploadError`)),this.fileList=[];return}this.form.voicesUrl=r,this.fileList=n},onRecorded(e){this.form.voicesUrl=e.url,this.recording=!1,e.text&&this.textsAuto&&(this.form.texts=e.text)},onStartRecord(){this.recording=!0,this.textsAuto=!this.form.texts.trim()},onScriptChange(e){this.textsAuto&&this.recording&&(this.form.texts=e)},onTextsInput(){this.textsAuto=!1},clearAudio(){this.form.voicesUrl=``,this.fileList=[]},onCreate(){let e=this.form.title.trim();if(!e){D.warning(this.$t(`fish.message.titleRequired`));return}if(!this.form.voicesUrl){D.warning(this.$t(`fish.message.audioRequired`));return}let t={title:e,voices:this.form.voicesUrl,visibility:this.form.visibility,train_mode:this.form.trainMode,enhance_audio_quality:this.form.enhanceAudio,generate_sample:this.form.generateSample};this.form.description.trim()&&(t.description=this.form.description.trim()),this.form.texts.trim()&&(t.texts=[this.form.texts.trim()]),this.creating=!0,this.$emit(`create`,t),setTimeout(()=>{this.creating=!1,this.form=Z(),this.fileList=[]},600)}}}),ne={class:`flex flex-col h-full`},re={class:`flex-1 overflow-y-auto p-5`},ie={class:`field-block mb-4`},ae={class:`title font-bold`},oe={class:`field-block mb-4`},se={class:`flex items-baseline justify-between mb-1`},ce={class:`title font-bold`},le={key:0,class:`muted`},ue={class:`hint`},de={key:0,class:`audio-actions`},fe={key:1,class:`hint warn`},pe={key:3,class:`mt-2`},me=[`src`],he={class:`ready-actions`},ge={class:`field-block mb-4`},_e={class:`title font-bold`},ve={class:`hint`},ye={class:`field-block mb-4`},be={class:`title font-bold`},xe={class:`field-block mb-4`},Se={class:`title font-bold`},Ce={class:`field-block mb-4`},we={class:`title font-bold`},Te={class:`field-block mb-3`},Ee={class:`field-row`},De={class:`title font-bold`},Oe={class:`hint mt-0 mb-0`},ke={class:`field-block mb-2`},Ae={class:`field-row`},je={class:`title font-bold`},Me={class:`hint mt-0 mb-0`},Ne={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pe(e,o,ee,f,p,m){let h=l(`el-input`),g=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`recorder`),b=l(`el-radio-button`),x=l(`el-radio-group`),S=l(`el-switch`);return c(),u(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`h2`,ae,[r(s(e.$t(`fish.name.voiceTitle`))+` `,1),o[9]||=n(`span`,{class:`required`},`*`,-1)]),i(h,{modelValue:e.form.title,"onUpdate:modelValue":o[0]||=t=>e.form.title=t,placeholder:e.$t(`fish.placeholder.voiceTitle`),maxlength:`60`},null,8,[`modelValue`,`placeholder`])]),n(`div`,oe,[n(`div`,se,[n(`h2`,ce,[r(s(e.$t(`fish.name.referenceAudio`))+` `,1),o[10]||=n(`span`,{class:`required`},`*`,-1)]),!e.form.voicesUrl&&!e.recording?(c(),u(`span`,le,s(e.$t(`fish.description.audioRequired`)),1)):a(``,!0)]),n(`p`,ue,s(e.$t(`fish.description.uploadAudio`)),1),!e.form.voicesUrl&&!e.recording?(c(),u(`div`,de,[i(v,{"file-list":e.fileList,"onUpdate:fileList":o[1]||=t=>e.fileList=t,name:`file`,limit:1,class:`upload-wrapper`,action:e.uploadUrl,accept:`.mp3,.wav,.m4a,.ogg,.webm,audio/*`,"show-file-list":!1,"on-exceed":e.onExceed,"on-error":e.onUploadError,"on-success":e.onUploadSuccess,"before-upload":e.onBeforeUpload,headers:e.uploadHeaders},{default:d(()=>[i(_,{type:`primary`,plain:``,round:``,loading:e.uploading},{default:d(()=>[i(g,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+s(e.$t(`fish.button.uploadAudio`)),1)]),_:1},8,[`loading`])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`before-upload`,`headers`]),i(_,{type:`primary`,round:``,disabled:!e.supportsRecorder,onClick:e.onStartRecord},{default:d(()=>[i(g,{icon:`fa-solid fa-microphone`,class:`icon mr-1`}),r(` `+s(e.$t(`fish.button.recordAudio`)),1)]),_:1},8,[`disabled`,`onClick`])])):a(``,!0),!e.supportsRecorder&&!e.form.voicesUrl&&!e.recording?(c(),u(`p`,fe,s(e.$t(`fish.message.recorderUnsupported`)),1)):a(``,!0),e.recording?(c(),t(y,{key:2,class:`mt-2`,onDone:e.onRecorded,onCancel:o[2]||=t=>e.recording=!1,"onUpdate:script":e.onScriptChange},null,8,[`onDone`,`onUpdate:script`])):a(``,!0),e.form.voicesUrl&&!e.recording?(c(),u(`div`,pe,[n(`audio`,{src:e.form.voicesUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,me),n(`div`,he,[i(_,{link:``,size:`small`,onClick:e.clearAudio},{default:d(()=>[i(g,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),r(` `+s(e.$t(`fish.button.replaceAudio`)),1)]),_:1},8,[`onClick`])])])):a(``,!0)]),n(`div`,ge,[n(`h2`,_e,s(e.$t(`fish.name.audioTexts`)),1),n(`p`,ve,s(e.$t(`fish.description.audioTexts`)),1),i(h,{modelValue:e.form.texts,"onUpdate:modelValue":o[3]||=t=>e.form.texts=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.audioTexts`),maxlength:`500`,onInput:e.onTextsInput},null,8,[`modelValue`,`placeholder`,`onInput`])]),n(`div`,ye,[n(`h2`,be,s(e.$t(`fish.name.voiceDescription`)),1),i(h,{modelValue:e.form.description,"onUpdate:modelValue":o[4]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.voiceDescription`),maxlength:`500`},null,8,[`modelValue`,`placeholder`])]),n(`div`,xe,[n(`h2`,Se,s(e.$t(`fish.name.visibility`)),1),i(x,{modelValue:e.form.visibility,"onUpdate:modelValue":o[5]||=t=>e.form.visibility=t,size:`small`},{default:d(()=>[i(b,{label:`private`,value:`private`},{default:d(()=>[r(s(e.$t(`fish.value.private`)),1)]),_:1}),i(b,{label:`unlist`,value:`unlist`},{default:d(()=>[r(s(e.$t(`fish.value.unlist`)),1)]),_:1}),i(b,{label:`public`,value:`public`},{default:d(()=>[r(s(e.$t(`fish.value.public`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Ce,[n(`h2`,we,s(e.$t(`fish.name.trainMode`)),1),i(x,{modelValue:e.form.trainMode,"onUpdate:modelValue":o[6]||=t=>e.form.trainMode=t,size:`small`},{default:d(()=>[i(b,{label:`fast`,value:`fast`},{default:d(()=>[r(s(e.$t(`fish.value.trainModeFast`)),1)]),_:1}),i(b,{label:`precise`,value:`precise`},{default:d(()=>[r(s(e.$t(`fish.value.trainModePrecise`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Te,[n(`div`,Ee,[n(`h2`,De,s(e.$t(`fish.name.enhanceAudio`)),1),i(S,{modelValue:e.form.enhanceAudio,"onUpdate:modelValue":o[7]||=t=>e.form.enhanceAudio=t},null,8,[`modelValue`])]),n(`p`,Oe,s(e.$t(`fish.description.enhanceAudio`)),1)]),n(`div`,ke,[n(`div`,Ae,[n(`h2`,je,s(e.$t(`fish.name.generateSample`)),1),i(S,{modelValue:e.form.generateSample,"onUpdate:modelValue":o[8]||=t=>e.form.generateSample=t},null,8,[`modelValue`])]),n(`p`,Me,s(e.$t(`fish.description.generateSample`)),1)])]),n(`div`,Ne,[i(_,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canCreate||e.creating,loading:e.creating,onClick:e.onCreate},{default:d(()=>[i(g,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+s(e.$t(`fish.button.createModel`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])])])}var Fe=w(Q,[[`render`,Pe],[`__scopeId`,`data-v-d8fc0e55`]]),Ie=o({name:`FishVoiceCard`,components:{ElAlert:_,ElButton:m,ElImage:g,CopyToClipboard:k,FontAwesomeIcon:O},props:{modelValue:{type:Object,required:!0}},computed:{sampleAudioUrl(){let e=this.modelValue?.samples;if(e?.length)return e[0]?.audio},voiceId(){let e=this.modelValue;return(e?.id||e?._id||e?.reference_id||``).toString()},coverSrc(){let e=this.modelValue?.cover_image;return e&&typeof e==`string`?e:void 0},createdAtLabel(){let e=this.modelValue?.created_at;if(e==null||e===``)return null;let t=typeof e==`number`?e:parseFloat(String(e));return!Number.isFinite(t)||t<=0?null:this.$dayjs.format(``+new Date(t*1e3))}},methods:{onUseVoice(){let e=this.voiceId;e&&(this.$store.commit(`fish/setConfig`,{...this.$store.state.fish?.config,reference_id:e}),this.$router.push({name:T}))}}}),Le={class:`card`},Re={class:`left`},ze={class:`main`},Be={class:`header`},Ve={class:`title`},He={key:0,class:`datetime`},Ue={key:0,class:`description`},We={key:1,class:`sample mt-2`},Ge=[`src`],Ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qe={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Je={class:`operations mt-2`};function Ye(e,o,ee,f,m,h){let g=l(`el-image`),_=l(`font-awesome-icon`),v=l(`copy-to-clipboard`),y=l(`el-alert`),b=l(`el-button`);return c(),u(`div`,Le,[n(`div`,Re,[e.coverSrc?(c(),t(g,{key:0,src:e.coverSrc,class:`cover`,fit:`cover`},{error:d(()=>[i(g,{src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`})]),placeholder:d(()=>[...o[0]||=[n(`div`,{class:`cover placeholder`},null,-1)]]),_:1},8,[`src`])):(c(),t(g,{key:1,src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`}))]),n(`div`,ze,[n(`div`,Be,[n(`span`,Ve,s(e.modelValue?.title||e.$t(`fish.name.untitledVoice`)),1),e.createdAtLabel?(c(),u(`span`,He,s(e.createdAtLabel),1)):a(``,!0)]),e.modelValue?.description?(c(),u(`p`,Ue,s(e.modelValue?.description),1)):a(``,!0),e.sampleAudioUrl?(c(),u(`div`,We,[n(`audio`,{src:e.sampleAudioUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,Ge)])):a(``,!0),i(y,{closable:!1,class:`mt-2 success`},{default:d(()=>[e.voiceId?(c(),u(`p`,Ke,[i(_,{icon:`fa-solid fa-microphone`,class:`mr-1`}),r(` `+s(e.$t(`fish.name.referenceId`))+`: `+s(e.voiceId)+` `,1),i(v,{content:e.voiceId},null,8,[`content`])])):a(``,!0),e.modelValue?.visibility?(c(),u(`p`,qe,[i(_,{icon:`fa-solid fa-eye`,class:`mr-1`}),r(` `+s(e.$t(`fish.name.visibility`))+`: `+s(e.modelValue?.visibility),1)])):a(``,!0)]),_:1}),n(`div`,Je,[i(b,{type:`primary`,size:`small`,plain:``,disabled:!e.voiceId,onClick:p(e.onUseVoice,[`stop`])},{default:d(()=>[i(_,{icon:`fa-solid fa-volume-high`,class:`mr-1`}),r(` `+s(e.$t(`fish.button.useVoice`)),1)]),_:1},8,[`disabled`,`onClick`])])])])}var Xe=o({name:`FishModelListPanel`,components:{VoiceCard:w(Ie,[[`render`,Ye],[`__scopeId`,`data-v-629e2d04`]]),BotPlaceholder:j,FontAwesomeIcon:O},props:{loading:{type:Boolean,default:!1}},computed:{voices(){return this.$store.state.fish?.voices}}}),Ze={class:`model-list-panel flex flex-col h-full`},Qe={class:`header`},$e={class:`title`},et={key:0,class:`count`},tt={class:`body flex-1 min-h-0`},$={key:0,class:`h-full`},nt={key:1,class:`w-full h-full flex flex-col items-center justify-center text-center px-6`},rt={class:`empty-title`},it={class:`empty-hint`},at={key:2,class:`w-full h-full overflow-y-auto pr-1`};function ot(e,r,o,d,p,m){let h=l(`bot-placeholder`),g=l(`font-awesome-icon`),_=l(`voice-card`);return c(),u(`div`,Ze,[n(`header`,Qe,[n(`h2`,$e,s(e.$t(`fish.title.myVoices`)),1),e.voices?.length?(c(),u(`span`,et,s(e.voices?.length),1)):a(``,!0)]),n(`div`,tt,[e.voices===void 0?(c(),u(`div`,$,[i(h)])):e.voices.length===0?(c(),u(`div`,nt,[i(g,{icon:`fa-solid fa-microphone-lines`,class:`empty-icon`}),n(`p`,rt,s(e.$t(`fish.title.noVoicesYet`)),1),n(`p`,it,s(e.$t(`fish.description.noVoicesYet`)),1)])):(c(),u(`div`,at,[(c(!0),u(f,null,ee(e.voices,e=>(c(),t(_,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]))])])}var st=o({name:`FishModelIndex`,components:{ModelConfigPanel:Fe,Layout:A,ModelListPanel:w(Xe,[[`render`,ot],[`__scopeId`,`data-v-4aab2294`]]),TabSwitcher:M},inject:[`initialized`],data(){return{loading:!1}},computed:{credential(){return this.$store.state.fish?.credential}},watch:{initialized:{async handler(e){e&&await this.onGetVoices()},immediate:!0}},async mounted(){await this.onGetService()},methods:{async onGetService(){await this.$store.dispatch(`fish/getService`)},async onGetVoices(){await this.$store.dispatch(`fish/getVoices`)},async onCreate(e){let t=this.credential?.token;if(!t){console.error(`no token specified`);return}this.loading=!0,D.info(this.$t(`fish.message.creatingModel`));try{await S.createModel(e,{token:t}),D.success(this.$t(`fish.message.createModelSuccess`)),await this.onGetVoices()}catch(e){let t=e?.response?.data;t?.error?.code===`used_up`?D.error(this.$t(`fish.message.usedUp`)):D.error(t?.error?.message||this.$t(`fish.message.createModelFailed`))}finally{this.loading=!1}}}}),ct={class:`flex flex-col h-full`},lt={class:`flex-1 min-h-0`};function ut(e,r,a,o,ee,s){let u=l(`tab-switcher`),f=l(`model-config-panel`),p=l(`model-list-panel`),m=l(`layout`);return c(),t(m,null,{config:d(()=>[n(`div`,ct,[i(u),n(`div`,lt,[i(f,{onCreate:e.onCreate},null,8,[`onCreate`])])])]),result:d(()=>[i(p,{loading:e.loading},null,8,[`loading`])]),_:1})}var dt=w(st,[[`render`,ut]]);export{dt as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{Bt as e,D as t,E as n,M as r,N as i,O as a,P as o,Q as ee,Ut as s,X as c,et as l,k as u,lt as d,x as f,y as p}from"./vendor-chart-Df3WBvr0.js";import{t as m}from"./button-DgZFgZDr.js";import{t as h}from"./upload-DFPa_BD4.js";import{t as g}from"./image-ZJJR3Ibj.js";import{t as _}from"./alert-Bgv5POrX.js";import{n as v,r as y}from"./radio-DNLlMkjf.js";import{t as b}from"./switch-DJHf-mwW.js";import{t as x}from"./vendor-axios-Ck2ffRoh.js";import"./constants-BBPmpf2e.js";import{Ht as S,Or as C,S as w,Tt as te,U as T,mr as E,xr as D}from"./index-BlUS5P9H.js";import{t as O}from"./index.es-C3NHsxpC.js";import{t as k}from"./CopyToClipboard-CKQPzIHN.js";import{t as A}from"./Hailuo-pRBbDp0w.js";import{t as j}from"./BotPlaceholder-Dogry0Kr.js";import{t as M}from"./TabSwitcher-6yz6wBJe.js";var N=4,P=90,F=o({name:`FishRecorder`,components:{ElButton:m,FontAwesomeIcon:O},emits:[`done`,`cancel`,`update:script`],data(){return{state:`idle`,scriptIndex:0,seconds:0,timerId:0,maxTimerId:0,mediaRecorder:null,stream:null,chunks:[],recordedBlob:null,recordedUrl:``,uploading:!1}},computed:{formattedTime(){let e=Math.floor(this.seconds/60),t=this.seconds%60;return`${e.toString().padStart(2,`0`)}:${t.toString().padStart(2,`0`)}`},currentScript(){let e=`fish.script.passage${this.scriptIndex%N+1}`;return this.$t(e)}},beforeUnmount(){this.cleanup()},mounted(){this.$emit(`update:script`,this.currentScript)},methods:{nextScript(){this.scriptIndex=(this.scriptIndex+1)%N,this.$emit(`update:script`,this.currentScript)},async startRecord(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){D.error(this.$t(`fish.message.recorderUnsupported`));return}try{this.stream=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){let t=e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`;D.error(this.$t(t?`fish.message.micDenied`:`fish.message.micError`));return}this.chunks=[];let e=this.pickMimeType();try{this.mediaRecorder=e?new MediaRecorder(this.stream,{mimeType:e}):new MediaRecorder(this.stream)}catch{this.mediaRecorder=new MediaRecorder(this.stream)}this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.chunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.chunks,{type:this.mediaRecorder?.mimeType||`audio/webm`});this.recordedBlob=e,this.recordedUrl=URL.createObjectURL(e),this.state=`recorded`,this.releaseStream()},this.mediaRecorder.start(),this.state=`recording`,this.seconds=0,this.timerId=window.setInterval(()=>{this.seconds++},1e3),this.maxTimerId=window.setTimeout(()=>{this.state===`recording`&&this.stopRecord()},P*1e3)},stopRecord(){this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),window.clearInterval(this.timerId),window.clearTimeout(this.maxTimerId)},reset(){this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl),this.recordedUrl=``,this.recordedBlob=null,this.state=`idle`,this.seconds=0},onCancel(){this.cleanup(),this.$emit(`cancel`)},cleanup(){this.stopRecord(),this.releaseStream(),this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl)},releaseStream(){this.stream?.getTracks().forEach(e=>e.stop()),this.stream=null},pickMimeType(){for(let e of[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg`])if(typeof MediaRecorder<`u`&&MediaRecorder.isTypeSupported?.(e))return e},extensionForMime(e){return e.includes(`webm`)?`webm`:e.includes(`mp4`)?`m4a`:e.includes(`ogg`)?`ogg`:e.includes(`wav`)?`wav`:`mp3`},async useRecording(){if(this.recordedBlob){if(this.seconds<3){D.warning(this.$t(`fish.message.recordingTooShort`));return}this.uploading=!0;try{let e=this.$store.state.token?.access,t=this.extensionForMime(this.recordedBlob.type||``),n=new File([this.recordedBlob],`recording-${Date.now()}.${t}`,{type:this.recordedBlob.type||`audio/webm`}),r=new FormData;r.append(`file`,n);let{data:i}=await x.post(`${E()}/api/v1/files/`,r,{headers:{Authorization:`Bearer ${e}`}}),a=i?.file_url;if(!a){D.error(this.$t(`fish.message.uploadError`));return}this.$emit(`done`,{url:a,text:this.currentScript})}catch(e){D.error(this.$t(`fish.message.uploadError`)),console.error(`recorder upload failed`,e)}finally{this.uploading=!1}}}}}),I={class:`recorder`},L={key:0,class:`script`},R={class:`script-header`},z={class:`label`},B={class:`script-text`},V={class:`controls`},H={class:`status`},U={class:`hint`},W={key:1,class:`preview`},G=[`src`],K={class:`preview-actions`},q={class:`footer`};function J(o,ee,f,p,m,h){let g=l(`font-awesome-icon`),_=l(`el-button`);return c(),u(`div`,I,[o.state===`recorded`?a(``,!0):(c(),u(`div`,L,[n(`div`,R,[i(g,{icon:`fa-solid fa-book-open`,class:`icon mr-1`}),n(`span`,z,s(o.$t(`fish.description.readScript`)),1),i(_,{link:``,size:`small`,class:`ml-auto`,disabled:o.state===`recording`,onClick:o.nextScript},{default:d(()=>[i(g,{icon:`fa-solid fa-shuffle`,class:`mr-1`}),r(` `+s(o.$t(`fish.button.nextScript`)),1)]),_:1},8,[`disabled`,`onClick`])]),n(`p`,B,s(o.currentScript),1)])),n(`div`,V,[o.state===`idle`?(c(),t(_,{key:0,type:`danger`,circle:``,size:`large`,title:o.$t(`fish.button.startRecord`),onClick:o.startRecord},{default:d(()=>[i(g,{icon:`fa-solid fa-microphone`})]),_:1},8,[`title`,`onClick`])):o.state===`recording`?(c(),t(_,{key:1,type:`warning`,circle:``,size:`large`,title:o.$t(`fish.button.stopRecord`),onClick:o.stopRecord},{default:d(()=>[i(g,{icon:`fa-solid fa-stop`})]),_:1},8,[`title`,`onClick`])):a(``,!0),n(`div`,H,[n(`span`,{class:e([`timer`,o.state===`recording`?`live`:``])},s(o.formattedTime),3),n(`span`,U,s(o.state===`idle`?o.$t(`fish.description.recorderIdle`):o.state===`recording`?o.$t(`fish.description.recorderRecording`):o.$t(`fish.description.recorderRecorded`)),1)])]),o.state===`recorded`&&o.recordedUrl?(c(),u(`div`,W,[n(`audio`,{src:o.recordedUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,G),n(`div`,K,[i(_,{size:`small`,disabled:o.uploading,onClick:o.reset},{default:d(()=>[i(g,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),r(` `+s(o.$t(`fish.button.reRecord`)),1)]),_:1},8,[`disabled`,`onClick`]),i(_,{size:`small`,type:`primary`,loading:o.uploading,onClick:o.useRecording},{default:d(()=>[i(g,{icon:`fa-solid fa-check`,class:`mr-1`}),r(` `+s(o.$t(`fish.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])])])):a(``,!0),n(`div`,q,[i(_,{link:``,size:`small`,disabled:o.uploading||o.state===`recording`,onClick:o.onCancel},{default:d(()=>[r(s(o.$t(`fish.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Y=w(F,[[`render`,J],[`__scopeId`,`data-v-1958e4a1`]]),X=50*1024*1024,Z=()=>({title:``,description:``,texts:``,voicesUrl:``,visibility:`unlist`,trainMode:`fast`,enhanceAudio:!0,generateSample:!1}),Q=o({name:`FishModelConfigPanel`,components:{ElButton:m,ElInput:C,ElRadioButton:v,ElRadioGroup:y,ElSwitch:b,ElUpload:h,FontAwesomeIcon:O,Recorder:Y},mixins:[te],emits:[`create`],data(){return{form:Z(),fileList:[],uploading:!1,creating:!1,recording:!1,textsAuto:!0}},computed:{uploadUrl(){return E()+`/api/v1/files/`},uploadHeaders(){return{Authorization:`Bearer ${this.$store.state.token?.access}`}},canCreate(){return!!this.form.title.trim()&&!!this.form.voicesUrl&&!this.uploading&&!this.creating},supportsRecorder(){return!!(typeof navigator<`u`?navigator.mediaDevices:void 0)?.getUserMedia&&typeof MediaRecorder<`u`}},methods:{onBeforeUpload(e){return e.size>X?(D.warning(this.$t(`fish.message.audioSizeExceed`)),!1):(this.uploading=!0,!0)},onExceed(){D.warning(this.$t(`fish.message.audioOnlyOne`))},onUploadError(){this.uploading=!1,D.error(this.$t(`fish.message.uploadError`))},onUploadSuccess(e,t,n){this.uploading=!1;let r=e?.file_url;if(!r){D.error(this.$t(`fish.message.uploadError`)),this.fileList=[];return}this.form.voicesUrl=r,this.fileList=n},onRecorded(e){this.form.voicesUrl=e.url,this.recording=!1,e.text&&this.textsAuto&&(this.form.texts=e.text)},onStartRecord(){this.recording=!0,this.textsAuto=!this.form.texts.trim()},onScriptChange(e){this.textsAuto&&this.recording&&(this.form.texts=e)},onTextsInput(){this.textsAuto=!1},clearAudio(){this.form.voicesUrl=``,this.fileList=[]},onCreate(){let e=this.form.title.trim();if(!e){D.warning(this.$t(`fish.message.titleRequired`));return}if(!this.form.voicesUrl){D.warning(this.$t(`fish.message.audioRequired`));return}let t={title:e,voices:this.form.voicesUrl,visibility:this.form.visibility,train_mode:this.form.trainMode,enhance_audio_quality:this.form.enhanceAudio,generate_sample:this.form.generateSample};this.form.description.trim()&&(t.description=this.form.description.trim()),this.form.texts.trim()&&(t.texts=[this.form.texts.trim()]),this.creating=!0,this.$emit(`create`,t),setTimeout(()=>{this.creating=!1,this.form=Z(),this.fileList=[]},600)}}}),ne={class:`flex flex-col h-full`},re={class:`flex-1 overflow-y-auto p-5`},ie={class:`field-block mb-4`},ae={class:`title font-bold`},oe={class:`field-block mb-4`},se={class:`flex items-baseline justify-between mb-1`},ce={class:`title font-bold`},le={key:0,class:`muted`},ue={class:`hint`},de={key:0,class:`audio-actions`},fe={key:1,class:`hint warn`},pe={key:3,class:`mt-2`},me=[`src`],he={class:`ready-actions`},ge={class:`field-block mb-4`},_e={class:`title font-bold`},ve={class:`hint`},ye={class:`field-block mb-4`},be={class:`title font-bold`},xe={class:`field-block mb-4`},Se={class:`title font-bold`},Ce={class:`field-block mb-4`},we={class:`title font-bold`},Te={class:`field-block mb-3`},Ee={class:`field-row`},De={class:`title font-bold`},Oe={class:`hint mt-0 mb-0`},ke={class:`field-block mb-2`},Ae={class:`field-row`},je={class:`title font-bold`},Me={class:`hint mt-0 mb-0`},Ne={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pe(e,o,ee,f,p,m){let h=l(`el-input`),g=l(`font-awesome-icon`),_=l(`el-button`),v=l(`el-upload`),y=l(`recorder`),b=l(`el-radio-button`),x=l(`el-radio-group`),S=l(`el-switch`);return c(),u(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`h2`,ae,[r(s(e.$t(`fish.name.voiceTitle`))+` `,1),o[9]||=n(`span`,{class:`required`},`*`,-1)]),i(h,{modelValue:e.form.title,"onUpdate:modelValue":o[0]||=t=>e.form.title=t,placeholder:e.$t(`fish.placeholder.voiceTitle`),maxlength:`60`},null,8,[`modelValue`,`placeholder`])]),n(`div`,oe,[n(`div`,se,[n(`h2`,ce,[r(s(e.$t(`fish.name.referenceAudio`))+` `,1),o[10]||=n(`span`,{class:`required`},`*`,-1)]),!e.form.voicesUrl&&!e.recording?(c(),u(`span`,le,s(e.$t(`fish.description.audioRequired`)),1)):a(``,!0)]),n(`p`,ue,s(e.$t(`fish.description.uploadAudio`)),1),!e.form.voicesUrl&&!e.recording?(c(),u(`div`,de,[i(v,{"file-list":e.fileList,"onUpdate:fileList":o[1]||=t=>e.fileList=t,name:`file`,limit:1,class:`upload-wrapper`,action:e.uploadUrl,accept:`.mp3,.wav,.m4a,.ogg,.webm,audio/*`,"show-file-list":!1,"on-exceed":e.onExceed,"on-error":e.onUploadError,"on-success":e.onUploadSuccess,"before-upload":e.onBeforeUpload,headers:e.uploadHeaders},{default:d(()=>[i(_,{type:`primary`,plain:``,round:``,loading:e.uploading},{default:d(()=>[i(g,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+s(e.$t(`fish.button.uploadAudio`)),1)]),_:1},8,[`loading`])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`before-upload`,`headers`]),i(_,{type:`primary`,round:``,disabled:!e.supportsRecorder,onClick:e.onStartRecord},{default:d(()=>[i(g,{icon:`fa-solid fa-microphone`,class:`icon mr-1`}),r(` `+s(e.$t(`fish.button.recordAudio`)),1)]),_:1},8,[`disabled`,`onClick`])])):a(``,!0),!e.supportsRecorder&&!e.form.voicesUrl&&!e.recording?(c(),u(`p`,fe,s(e.$t(`fish.message.recorderUnsupported`)),1)):a(``,!0),e.recording?(c(),t(y,{key:2,class:`mt-2`,onDone:e.onRecorded,onCancel:o[2]||=t=>e.recording=!1,"onUpdate:script":e.onScriptChange},null,8,[`onDone`,`onUpdate:script`])):a(``,!0),e.form.voicesUrl&&!e.recording?(c(),u(`div`,pe,[n(`audio`,{src:e.form.voicesUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,me),n(`div`,he,[i(_,{link:``,size:`small`,onClick:e.clearAudio},{default:d(()=>[i(g,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),r(` `+s(e.$t(`fish.button.replaceAudio`)),1)]),_:1},8,[`onClick`])])])):a(``,!0)]),n(`div`,ge,[n(`h2`,_e,s(e.$t(`fish.name.audioTexts`)),1),n(`p`,ve,s(e.$t(`fish.description.audioTexts`)),1),i(h,{modelValue:e.form.texts,"onUpdate:modelValue":o[3]||=t=>e.form.texts=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.audioTexts`),maxlength:`500`,onInput:e.onTextsInput},null,8,[`modelValue`,`placeholder`,`onInput`])]),n(`div`,ye,[n(`h2`,be,s(e.$t(`fish.name.voiceDescription`)),1),i(h,{modelValue:e.form.description,"onUpdate:modelValue":o[4]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.voiceDescription`),maxlength:`500`},null,8,[`modelValue`,`placeholder`])]),n(`div`,xe,[n(`h2`,Se,s(e.$t(`fish.name.visibility`)),1),i(x,{modelValue:e.form.visibility,"onUpdate:modelValue":o[5]||=t=>e.form.visibility=t,size:`small`},{default:d(()=>[i(b,{label:`private`,value:`private`},{default:d(()=>[r(s(e.$t(`fish.value.private`)),1)]),_:1}),i(b,{label:`unlist`,value:`unlist`},{default:d(()=>[r(s(e.$t(`fish.value.unlist`)),1)]),_:1}),i(b,{label:`public`,value:`public`},{default:d(()=>[r(s(e.$t(`fish.value.public`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Ce,[n(`h2`,we,s(e.$t(`fish.name.trainMode`)),1),i(x,{modelValue:e.form.trainMode,"onUpdate:modelValue":o[6]||=t=>e.form.trainMode=t,size:`small`},{default:d(()=>[i(b,{label:`fast`,value:`fast`},{default:d(()=>[r(s(e.$t(`fish.value.trainModeFast`)),1)]),_:1}),i(b,{label:`precise`,value:`precise`},{default:d(()=>[r(s(e.$t(`fish.value.trainModePrecise`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Te,[n(`div`,Ee,[n(`h2`,De,s(e.$t(`fish.name.enhanceAudio`)),1),i(S,{modelValue:e.form.enhanceAudio,"onUpdate:modelValue":o[7]||=t=>e.form.enhanceAudio=t},null,8,[`modelValue`])]),n(`p`,Oe,s(e.$t(`fish.description.enhanceAudio`)),1)]),n(`div`,ke,[n(`div`,Ae,[n(`h2`,je,s(e.$t(`fish.name.generateSample`)),1),i(S,{modelValue:e.form.generateSample,"onUpdate:modelValue":o[8]||=t=>e.form.generateSample=t},null,8,[`modelValue`])]),n(`p`,Me,s(e.$t(`fish.description.generateSample`)),1)])]),n(`div`,Ne,[i(_,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canCreate||e.creating,loading:e.creating,onClick:e.onCreate},{default:d(()=>[i(g,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+s(e.$t(`fish.button.createModel`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])])])}var Fe=w(Q,[[`render`,Pe],[`__scopeId`,`data-v-d8fc0e55`]]),Ie=o({name:`FishVoiceCard`,components:{ElAlert:_,ElButton:m,ElImage:g,CopyToClipboard:k,FontAwesomeIcon:O},props:{modelValue:{type:Object,required:!0}},computed:{sampleAudioUrl(){let e=this.modelValue?.samples;if(e?.length)return e[0]?.audio},voiceId(){let e=this.modelValue;return(e?.id||e?._id||e?.reference_id||``).toString()},coverSrc(){let e=this.modelValue?.cover_image;return e&&typeof e==`string`?e:void 0},createdAtLabel(){let e=this.modelValue?.created_at;if(e==null||e===``)return null;let t=typeof e==`number`?e:parseFloat(String(e));return!Number.isFinite(t)||t<=0?null:this.$dayjs.format(``+new Date(t*1e3))}},methods:{onUseVoice(){let e=this.voiceId;e&&(this.$store.commit(`fish/setConfig`,{...this.$store.state.fish?.config,reference_id:e}),this.$router.push({name:T}))}}}),Le={class:`card`},Re={class:`left`},ze={class:`main`},Be={class:`header`},Ve={class:`title`},He={key:0,class:`datetime`},Ue={key:0,class:`description`},We={key:1,class:`sample mt-2`},Ge=[`src`],Ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qe={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Je={class:`operations mt-2`};function Ye(e,o,ee,f,m,h){let g=l(`el-image`),_=l(`font-awesome-icon`),v=l(`copy-to-clipboard`),y=l(`el-alert`),b=l(`el-button`);return c(),u(`div`,Le,[n(`div`,Re,[e.coverSrc?(c(),t(g,{key:0,src:e.coverSrc,class:`cover`,fit:`cover`},{error:d(()=>[i(g,{src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`})]),placeholder:d(()=>[...o[0]||=[n(`div`,{class:`cover placeholder`},null,-1)]]),_:1},8,[`src`])):(c(),t(g,{key:1,src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`}))]),n(`div`,ze,[n(`div`,Be,[n(`span`,Ve,s(e.modelValue?.title||e.$t(`fish.name.untitledVoice`)),1),e.createdAtLabel?(c(),u(`span`,He,s(e.createdAtLabel),1)):a(``,!0)]),e.modelValue?.description?(c(),u(`p`,Ue,s(e.modelValue?.description),1)):a(``,!0),e.sampleAudioUrl?(c(),u(`div`,We,[n(`audio`,{src:e.sampleAudioUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,Ge)])):a(``,!0),i(y,{closable:!1,class:`mt-2 success`},{default:d(()=>[e.voiceId?(c(),u(`p`,Ke,[i(_,{icon:`fa-solid fa-microphone`,class:`mr-1`}),r(` `+s(e.$t(`fish.name.referenceId`))+`: `+s(e.voiceId)+` `,1),i(v,{content:e.voiceId},null,8,[`content`])])):a(``,!0),e.modelValue?.visibility?(c(),u(`p`,qe,[i(_,{icon:`fa-solid fa-eye`,class:`mr-1`}),r(` `+s(e.$t(`fish.name.visibility`))+`: `+s(e.modelValue?.visibility),1)])):a(``,!0)]),_:1}),n(`div`,Je,[i(b,{type:`primary`,size:`small`,plain:``,disabled:!e.voiceId,onClick:p(e.onUseVoice,[`stop`])},{default:d(()=>[i(_,{icon:`fa-solid fa-volume-high`,class:`mr-1`}),r(` `+s(e.$t(`fish.button.useVoice`)),1)]),_:1},8,[`disabled`,`onClick`])])])])}var Xe=o({name:`FishModelListPanel`,components:{VoiceCard:w(Ie,[[`render`,Ye],[`__scopeId`,`data-v-629e2d04`]]),BotPlaceholder:j,FontAwesomeIcon:O},props:{loading:{type:Boolean,default:!1}},computed:{voices(){return this.$store.state.fish?.voices}}}),Ze={class:`model-list-panel flex flex-col h-full`},Qe={class:`header`},$e={class:`title`},et={key:0,class:`count`},tt={class:`body flex-1 min-h-0`},$={key:0,class:`h-full`},nt={key:1,class:`w-full h-full flex flex-col items-center justify-center text-center px-6`},rt={class:`empty-title`},it={class:`empty-hint`},at={key:2,class:`w-full h-full overflow-y-auto pr-1`};function ot(e,r,o,d,p,m){let h=l(`bot-placeholder`),g=l(`font-awesome-icon`),_=l(`voice-card`);return c(),u(`div`,Ze,[n(`header`,Qe,[n(`h2`,$e,s(e.$t(`fish.title.myVoices`)),1),e.voices?.length?(c(),u(`span`,et,s(e.voices?.length),1)):a(``,!0)]),n(`div`,tt,[e.voices===void 0?(c(),u(`div`,$,[i(h)])):e.voices.length===0?(c(),u(`div`,nt,[i(g,{icon:`fa-solid fa-microphone-lines`,class:`empty-icon`}),n(`p`,rt,s(e.$t(`fish.title.noVoicesYet`)),1),n(`p`,it,s(e.$t(`fish.description.noVoicesYet`)),1)])):(c(),u(`div`,at,[(c(!0),u(f,null,ee(e.voices,e=>(c(),t(_,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]))])])}var st=o({name:`FishModelIndex`,components:{ModelConfigPanel:Fe,Layout:A,ModelListPanel:w(Xe,[[`render`,ot],[`__scopeId`,`data-v-4aab2294`]]),TabSwitcher:M},inject:[`initialized`],data(){return{loading:!1}},computed:{credential(){return this.$store.state.fish?.credential}},watch:{initialized:{async handler(e){e&&await this.onGetVoices()},immediate:!0}},async mounted(){await this.onGetService()},methods:{async onGetService(){await this.$store.dispatch(`fish/getService`)},async onGetVoices(){await this.$store.dispatch(`fish/getVoices`)},async onCreate(e){let t=this.credential?.token;if(!t){console.error(`no token specified`);return}this.loading=!0,D.info(this.$t(`fish.message.creatingModel`));try{await S.createModel(e,{token:t}),D.success(this.$t(`fish.message.createModelSuccess`)),await this.onGetVoices()}catch(e){let t=e?.response?.data;t?.error?.code===`used_up`?D.error(this.$t(`fish.message.usedUp`)):D.error(t?.error?.message||this.$t(`fish.message.createModelFailed`))}finally{this.loading=!1}}}}),ct={class:`flex flex-col h-full`},lt={class:`flex-1 min-h-0`};function ut(e,r,a,o,ee,s){let u=l(`tab-switcher`),f=l(`model-config-panel`),p=l(`model-list-panel`),m=l(`layout`);return c(),t(m,null,{config:d(()=>[n(`div`,ct,[i(u),n(`div`,lt,[i(f,{onCreate:e.onCreate},null,8,[`onCreate`])])])]),result:d(()=>[i(p,{loading:e.loading},null,8,[`loading`])]),_:1})}var dt=w(st,[[`render`,ut]]);export{dt as default};
|