1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SetupWizardView-CcbwuU7Z.js","assets/vendor-vue-Dzwqm9Y9.js","assets/Select-unWSiPwC.js","assets/vendor-i18n-BuoWFzps.js","assets/Select-DJFS-V-w.css","assets/Toggle.vue_vue_type_script_setup_true_lang-CwidWQzY.js","assets/vendor-misc-B-nM3tYW.js","assets/vendor-misc-DB0Q8XAf.css","assets/HomeView-nf-T4jbR.js","assets/LocaleSwitcher-DwqRgoPh.js","assets/LocaleSwitcher-CjvPxOhx.css","assets/featureFlags-DuhANbyz.js","assets/HomeView-Dagk0jRk.css","assets/LoginView-CwmVNC6B.js","assets/AppHeader.vue_vue_type_style_index_0_scoped_80f3916c_lang-CWJeTQGo.js","assets/AppHeader-yeo8Fp_l.css","assets/useClipboard-00CrFCqB.js","assets/AuthLayout-DBu6UiEG.js","assets/AuthLayout-BMNyCXdz.css","assets/LoginAgreementPrompt-D9F0h1HR.js","assets/oauthAffiliate-CrlUwkd1.js","assets/LoginAgreementPrompt-DhEkaHwn.css","assets/CaptchaChallenge.vue_vue_type_script_setup_true_lang-CagJo7ro.js","assets/CaptchaChallenge-BmkiKxf7.css","assets/apiError-BcAuv_LF.js","assets/LoginView-D0nGZ1jO.css","assets/RegisterView-D3JrrTq-.js","assets/authError-Ch9RozGZ.js","assets/registrationEmailPolicy-BIuq-4e8.js","assets/RegisterView-DFnoI0Xn.css","assets/EmailVerifyView-D5GKHftQ.js","assets/EmailVerifyView-CCbXb7Sd.css","assets/OAuthCallbackView-Co6-4gE8.js","assets/LinuxDoCallbackView-D35l-5Mx.js","assets/PendingOAuthCreateAccountForm-CeNqGNMn.js","assets/PendingOAuthCreateAccountForm-CE5mbEbn.css","assets/LinuxDoCallbackView-DQ7xRnW6.css","assets/WechatCallbackView-BJ9pC8Wj.js","assets/WechatCallbackView-BRJlNRB0.css","assets/WechatPaymentCallbackView-BZLEAF3x.js","assets/DingTalkCallbackView-BriPk8l5.js","assets/DingTalkCallbackView-2-yiQGEP.css","assets/DingTalkEmailCompletionView-BBdJ8HII.js","assets/OidcCallbackView-CL2S9SUY.js","assets/OidcCallbackView-Buxp4n1p.css","assets/ForgotPasswordView-CUr73Y-1.js","assets/ForgotPasswordView-D5q6IfTR.css","assets/ResetPasswordView--vI3A5_6.js","assets/ResetPasswordView-Bthzu-nm.css","assets/KeyUsageView-cYWkOnFL.js","assets/KeyUsageView-Bg34gQbA.css","assets/LegalDocumentView-D5C8_MB7.js","assets/LegalDocumentView-DCxikJph.css","assets/ModelPlazaView-DLpqovWj.js","assets/AppLayout.vue_vue_type_script_setup_true_lang-DU-NXSvm.js","assets/PlatformIcon.vue_vue_type_script_setup_true_lang-Day_FQoY.js","assets/platformColors-DkrFx9Dx.js","assets/GroupBadge.vue_vue_type_script_setup_true_lang-YJMvDS0Z.js","assets/peak-rate-qZGUWdry.js","assets/channel-3bnFPzcg.js","assets/ModelPlazaView-DP17fo33.css","assets/DashboardView-8vTQdJww.js","assets/usage-CJjJuAF_.js","assets/LoadingSpinner-DZOe8TOe.js","assets/LoadingSpinner-DT-rtrW_.css","assets/TokenUsageTrend.vue_vue_type_script_setup_true_lang-CKoYF9_D.js","assets/vendor-chart-BNlN3Otn.js","assets/TokenUsageTrend-hT21aKUj.css","assets/EmptyState.vue_vue_type_script_setup_true_lang-DJjIeSM_.js","assets/user-CdHOjlvP.js","assets/KeysView-8lTyYcsx.js","assets/usePersistedPageSize-x0WpaIWh.js","assets/groups-lkMFXaQ3.js","assets/TablePageLayout-ebRrTZp5.js","assets/TablePageLayout-CTUsgGJ4.css","assets/DataTable-BszWCXiN.js","assets/DataTable-bsUFtred.css","assets/Pagination-BuZWDbKf.js","assets/Pagination-DgYObafU.css","assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-G7SCzKKv.js","assets/SearchInput.vue_vue_type_script_setup_true_lang-DnoXrebP.js","assets/vendor-ui-mF4M59HB.js","assets/GroupOptionItem-BLoucsm-.js","assets/GroupOptionItem-EDVK0Prz.css","assets/maskApiKey-ClKV8GuA.js","assets/BatchImageGuideView-DrOBDD4a.js","assets/BatchImageGuideView-BJDwNkfA.css","assets/UsageView-BPTBYNTT.js","assets/GroupDistributionChart.vue_vue_type_script_setup_true_lang-BZRKu_PO.js","assets/EndpointDistributionChart.vue_vue_type_script_setup_true_lang-BunRdw9d.js","assets/ModelDistributionChart.vue_vue_type_script_setup_true_lang-eQtnwKY2.js","assets/errorBadges-It0ru3B2.js","assets/RedeemView-PsozsaJx.js","assets/RedeemView-ChkGqhY_.css","assets/AffiliateView-Dj5DzVbY.js","assets/AvailableChannelsView-CXglUDb8.js","assets/ProfileView-BkSQ_phr.js","assets/totp-BUqbULHW.js","assets/SubscriptionsView-Bv9CwjXH.js","assets/subscriptionQuota-DBCjRtsa.js","assets/PaymentView-DygUM5_9.js","assets/payment-D3iaUYR9.js","assets/payment-Dx3ZzASf.js","assets/providerConfig-CHSBMM6y.js","assets/wxpay-UHDvuORB.js","assets/paymentFlow-cys_N5rS.js","assets/currency-DpW1WrYL.js","assets/paymentUx-DGTR60TU.js","assets/UserOrdersView-CjeKlUPI.js","assets/OrderTable.vue_vue_type_script_setup_true_lang-bkLwEBPD.js","assets/OrderStatusBadge.vue_vue_type_script_setup_true_lang-BuSXfjAG.js","assets/PaymentQRCodeView-Brn0_79w.js","assets/PaymentResultView-HzNkaMbD.js","assets/StripePaymentView-DedDlzIY.js","assets/AirwallexPaymentView-B8lpCeaG.js","assets/StripePopupView-CBlsF1zu.js","assets/CustomPageView-LnsuP_mQ.js","assets/CustomPageView-CPy1ApRj.css","assets/DashboardView-C_TPG3jr.js","assets/OpsDashboard-J44NNWAQ.js","assets/platforms-BQiEVrJv.js","assets/HelpTooltip.vue_vue_type_script_setup_true_lang-gHutfHq8.js","assets/OpsErrorLogTable.vue_vue_type_script_setup_true_lang-Brz3-qCT.js","assets/OpsDashboard-DwWJHeD7.css","assets/AuditLogView-krcEznYk.js","assets/UsersView-Dn8A2Xki.js","assets/useTableSelection-SzTxF-Vr.js","assets/stableObjectKey-DullU5Fx.js","assets/TotpStepUpDialog.vue_vue_type_script_setup_true_lang-YGWwgM47.js","assets/UserBalanceHistoryModal.vue_vue_type_script_setup_true_lang-B51I64Su.js","assets/UsersView-CZxeAc6a.css","assets/GroupsView-CB7pfhQx.js","assets/PricingEntryCard-Cgh-Hz9D.js","assets/ModelTagInput.vue_vue_type_script_setup_true_lang-CSLP002e.js","assets/PricingEntryCard-Dgw822Gu.css","assets/GroupsView-yOT7cHd7.css","assets/ChannelsView-Dl0z4o2j.js","assets/ChannelsView-CXQknQmA.css","assets/ChannelMonitorView-Bn8f31dR.js","assets/channelMonitorV2-QSv55elo.js","assets/UsageProgressBar.vue_vue_type_script_setup_true_lang-CHMcx5LQ.js","assets/ChannelStatusView-BWJWj5yJ.js","assets/ChannelStatusView-BlQhAFzI.css","assets/SubscriptionsView-KItH7wJg.js","assets/SubscriptionsView-BLbovvvn.css","assets/AccountsView-3k0mtUp-.js","assets/proxyExpiry-iowBZSuW.js","assets/ModelWhitelistSelector.vue_vue_type_script_setup_true_lang-CpTbfwSp.js","assets/ModelWhitelistSelector-BR3Adxor.css","assets/ProxySelector-0Febhil4.js","assets/ProxySelector-CL3006OT.css","assets/GroupSelector.vue_vue_type_script_setup_true_lang-CI3-sDJl.js","assets/AccountsView-C07k6ZGO.css","assets/PluginsView-BSQJ4X34.js","assets/AnnouncementsView-Ch7svYWU.js","assets/ProxiesView-DqOB57kJ.js","assets/RedeemView-BCu5mt2g.js","assets/PromoCodesView-BuD0SBGr.js","assets/SettingsView-A5drFaX7.js","assets/SettingsView-gONBddcz.css","assets/RiskControlVie
1w-D6CeNzn8.js","assets/PromptAuditView-AAMivdtm.js","assets/UsageView-Ba0Qvcb7.js","assets/AdminAffiliateInvitesView-BwNikPfC.js","assets/AdminAffiliateRecordsTable.vue_vue_type_script_setup_true_lang-QHPARKSd.js","assets/AdminAffiliateRebatesView-J5WXcUTg.js","assets/AdminAffiliateTransfersView-DQNKLSWo.js","assets/AdminPaymentDashboardView-BZ5Yo9hP.js","assets/AdminOrdersView-DFv0srCa.js","assets/AdminPaymentPlansView-yCWl26-i.js","assets/NotFoundView-hv91aOPv.js"])))=>i.map(i=>d[i]); 2import{d as Z,c as I,z as L,B as h,A as X,C,L as re,r as w,D as pe,k as z,aa as va,K as ne,P as He,F as kt,V as wa,E as j,G as R,S as St,ab as we,_ as Fe,Q as ba,R as Aa,w as ee,o as Pt,a as ka,I as be,U as Ke,n as Sa,H as Ae,Y as Pa,u as T,O as It,Z as Ia,X as Ea,ac as $a,ad as Ca,ae as Ma,af as Ta,ag as Ra}from"./vendor-vue-Dzwqm9Y9.js";import{c as xa,u as Et}from"./vendor-i18n-BuoWFzps.js";import{a as Pe,d as ke,p as $t}from"./vendor-misc-B-nM3tYW.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function a(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=a(o);fetch(o.href,s)}})();const La=["stroke-width"],Oa=["d"],de=Z({__name:"Icon",props:{name:{},size:{default:"md"},strokeWidth:{default:1.5}},setup(e){const t=e,a={play:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z",refresh:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99",edit:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10",trash:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0",plus:"M12 4.5v15m7.5-7.5h-15",search:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z",more:"M6.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM12.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM18.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0z",chart:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z",clock:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z",link:"M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244",sync:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 00-3.7-3.7 48.678 48.678 0 00-7.324 0 4.006 4.006 0 00-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3l-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 003.7 3.7 48.656 48.656 0 007.324 0 4.006 4.006 0 003.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3l-3 3",chevronDown:"M19.5 8.25l-7.5 7.5-7.5-7.5",chevronRight:"M8.25 4.5l7.5 7.5-7.5 7.5",chevronLeft:"M15.75 19.5L8.25 12l7.5-7.5",check:"M4.5 12.75l6 6 9-13.5",x:"M6 18L18 6M6 6l12 12",eye:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178zM15 12a3 3 0 11-6 0 3 3 0 016 0z",eyeOff:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88",cog:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.
2074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z M15 12a3 3 0 11-6 0 3 3 0 016 0z",grid:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z",chat:"M8.625 12a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H8.25m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H12m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0h-.375M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 01-2.555-.337A5.972 5.972 0 015.41 20.97a5.969 5.969 0 01-.474-.065 4.48 4.48 0 00.978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25z",lightbulb:"M12 18v-5.25m0 0a6.01 6.01 0 001.5-.189m-1.5.189a6.01 6.01 0 01-1.5-.189m3.75 7.478a12.06 12.06 0 01-4.5 0m3.75 2.383a14.406 14.406 0 01-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 10-7.517 0c.85.493 1.509 1.333 1.509 2.316V18",arrowRight:"M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3",arrowLeft:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18",arrowUp:"M5 10l7-7m0 0l7 7m-7-7v18",arrowDown:"M19 14l-7 7m0 0l-7-7m7 7V3",arrowsUpDown:"M3 7.5L7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5",chevronUp:"M5 15l7-7 7 7",externalLink:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14",checkCircle:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z",xCircle:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z",exclamationCircle:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z",exclamationTriangle:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z",trophy:"M16.5 18.75h-9m9 0a3 3 0 013 3h-15a3 3 0 013-3m9 0v-4.5A3.375 3.375 0 0012.75 11.25h-1.5A3.375 3.375 0 008.25 14.25v4.5m8.25-12V6.75a.75.75 0 00-.75-.75h-1.5a.75.75 0 00-.75.75v1.5m0 0V9a.75.75 0 01-.75.75H9.75A.75.75 0 019 9V8.25m0 0V6.75a.75.75 0 00-.75-.75h-1.5a.75.75 0 00-.75.75v1.5m12 0h.008v.008h-.008V8.25zm-12 0h.008v.008H5.25V8.25z",infoCircle:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z",questionCircle:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",user:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z",userCircle:"M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z",userPlus:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z",users:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2
20 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z",document:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z",clipboard:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2",copy:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z",inbox:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4",download:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4",upload:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5",filter:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32
20 0112 3z",globe:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418",sort:"M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9",key:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z",lock:"M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z",shield:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z",menu:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5",calendar:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5",home:"M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25",terminal:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z",gift:"M21 11.25v8.25a1.5 1.5 0 01-1.5 1.5H5.25a1.5 1.5 0 01-1.5-1.5v-8.25M12 4.875A2.625 2.625 0 109.375 7.5H12m0-2.625V7.5m0-2.625A2.625 2.625 0 1114.625 7.5H12m0 0V21m-8.625-9.75h18c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125h-18c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z",creditCard:"M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 002.25-2.25V6.75A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25v10.5A2.25 2.25 0 004.5 19.5z",mail:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75",chartBar:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z",trendingUp:"M13 7h8m0 0v8m0-8l-8 8-4-4-6 6",database:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125",cube:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4",bell:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9",bolt:"M13 10V3L4 14h7v7l9-11h-7z",sparkles:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456z",cloud:"M2.25 15a4.5 4.5 0 004.5 4.5H18a3.75 3.75 0 001.332-7.257 3 3 0 00-3.758-3.848 5.25 5.25 0 00-10.233 2.33A4.502 4.502 0 002.25 15z",server:"M5.25 14.25h13.5m-13.5 0a3 3 0 01-3-3m3 3a3 3 0 100 6h13.5a3 3 0 100-6m-16.5-3a3 3 0 013-3h13.5a3 3 0 013 3m-19.5 0a4.5 4.5 0 01.9-2.7L5.737 5.1a3.375 3.375 0 012.7-1.35h7.126c1.062 0 2.062.5 2.7 1.35l2.587 3.45a4.5 4.5 0 01.9 2.7m0 0a3 3 0 01-3 3m0 3h.008v.008h-.008v-.008zm0-6h.008v.008h-.008v-.008zm-3 6h.008v.008h-.008v-.008zm0-6h.008v.008h-.008v-.008z",sun:"M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z",moon:"M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z",book:"M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25",dollar:"M12 6v12m-3-2.818l.879.659c1.171.879 3.07.879 4.242 0 1.172-.879 1.172-2.303 0-3.182C13.536 12.219 12.768 12 12 12c-.725 0-1.45-.22-2.003-.659-1.106-.879-1.106-2.303 0-3.182s2.9-.879 4.006 0l.415.33M21 12a9 9 0 11-18 0 9 9 0 0118 0z",ban:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636",login:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9",swap:"M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5",beaker:"M9.75 3.104v5.714a2.25 2.25 0 01-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 014.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0112 15a9.065 9.065 0 00-6.23.693L5 14.5m14.8.8l1.402 1.402c1.232 1.232.65 3.318-1.067 3.611A48.309 48.309 0 0112 21c-2.773 0-5.491-.235-8.135-.687-1.718-.293-2.3-2.379-1.067-3.61L5 14.5",cpu:"M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z",chatBubble:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z",calculator:"M9 7h6m0 10v-3m-3 3h.01M9 17h.01M9 14h.01M12 14h.01M15 11h.01M12 11h.01M9 11h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z",fire:"M17.657 18.657A8 8 0 016.343 7.343S7 9 9 10c0-2 .5-5 2.986-7C14 5 16.09 5.777 17.656 7.343A7.975 7.975 0 0120 13a7.975 7.975 0 01-2.343 5.657z",badge:"M9 12.75L11.25 15 15 9.75M21 12c0 1.268-.63 2.39-1.593 3.068a3.745 3.745 0 01-1.043 3.296 3.745 3.745 0 01-3.296 1.043A3.745 3.745 0 0112 21c-1.268 0-2.39-.63
2-3.068-1.593a3.746 3.746 0 01-3.296-1.043 3.745 3.745 0 01-1.043-3.296A3.745 3.745 0 013 12c0-1.268.63-2.39 1.593-3.068a3.745 3.745 0 011.043-3.296 3.746 3.746 0 013.296-1.043A3.746 3.746 0 0112 3c1.268 0 2.39.63 3.068 1.593a3.746 3.746 0 013.296 1.043 3.746 3.746 0 011.043 3.296A3.745 3.745 0 0121 12z",brain:"M9.75 3.104v5.714a2.25 2.25 0 01-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 014.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0112 15a9.065 9.065 0 00-6.23.693L5 14.5m0 0l-2.69 2.689c-1.232 1.232-.65 3.318 1.067 3.611A48.309 48.309 0 0012 21c2.773 0 5.491-.235 8.135-.687 1.718-.293 2.3-2.379 1.067-3.61L19.8 15.3M12 8.25a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm0 0v3m-3-1.5a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm0 0h6m-3 4.5a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"},r=I(()=>a[t.name]),o=I(()=>({xs:"h-3 w-3",sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-8 w-8"})[t.size]);return(s,i)=>(C(),L("svg",{class:X(o.value),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":e.strokeWidth},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:r.value},null,8,Oa)],10,La))}}),Da="modulepreload",qa=function(e){return"/"+e},ct={},_=function(t,a,r){let o=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=Promise.allSettled(a.map(u=>{if(u=qa(u),u in ct)return;ct[u]=!0;const m=u.endsWith(".css"),l=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${l}`))return;const y=document.createElement("link");if(y.rel=m?"stylesheet":Da,m||(y.as="script"),y.crossOrigin="",y.href=u,c&&y.setAttribute("nonce",c),document.head.appendChild(y),m)return new Promise((p,d)=>{y.addEventListener("load",p),y.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return o.then(i=>{for(const c of i||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})},Ct="sub2api_locale",We="en",Ua={en:()=>_(()=>import("./index-C55ksSKf.js"),[]),zh:()=>_(()=>import("./index-Dvhr44A_.js"),[])};function je(e){return e==="en"||e==="zh"}function za(){const e=localStorage.getItem(Ct);return e&&je(e)?e:navigator.language.toLowerCase().startsWith("zh")?"zh":We}const D=xa({legacy:!1,locale:za(),fallbackLocale:We,messages:{},warnHtmlMessage:!1}),ut=new Set;async function Mt(e){if(ut.has(e))return;const t=Ua[e],a=await t();D.global.setLocaleMessage(e,a.default),ut.add(e)}async function Ka(){const e=Y();await Mt(e),document.documentElement.setAttribute("lang",e)}async function Hp(e){var y;if(!je(e))return;await Mt(e),D.global.locale.value=e,localStorage.setItem(Ct,e),document.documentElement.setAttribute("lang",e);const{resolveRouteDocumentTitle:t}=await _(async()=>{const{resolveRouteDocumentTitle:p}=await Promise.resolve().then(()=>Ym);return{resolveRouteDocumentTitle:p}},void 0),{default:a}=await _(async()=>{const{default:p}=await Promise.resolve().then(()=>Tp);return{default:p}},void 0),{useAppStore:r}=await _(async()=>{const{useAppStore:p}=await Promise.resolve().then(()=>Kn);return{useAppStore:p}},void 0),{useAuthStore:o}=await _(async()=>{const{useAuthStore:p}=await Promise.resolve().then(()=>pm);return{useAuthStore:p}},void 0),{useAdminSettingsStore:s}=await _(async()=>{const{useAdminSettingsStore:p}=await Promise.resolve().then(()=>fm);return{useAdminSettingsStore:p}},void 0),i=a.currentRoute.value,c=r(),u=o(),m=s(),l=[...((y=c.cachedPublicSettings)==null?void 0:y.custom_menu_items)??[],...u.isAdmin?m.customMenuItems:[]];document.title=t(i,c.siteName,l)}function Y(){const e=D.global.locale.value;return je(e)?e:We}const Fp=[{code:"en",name:"English",flag:"ðºð¸"},{code:"zh",name:"䏿",flag:"ð¨ð³"}],Na="X-Admin-UI-Request",Va="X-User-UI-Request";function lt(e){return e==="/admin"||e.startsWith("/admin/")||e==="/api/v1/admin"||e.startsWith("/api/v1/admin/")}function Tt(e){const t=e.trim();if(!t)return"";try{const a=typeof window<"u"?window.location.origin:"http://localhost";return new URL(t,a).pathname}catch{return t.split(/[?#]/,1)[0]}}function Ba(e){const t=Tt(e);return t?t==="/api/v1"||t.startsWith("/api/v1/")?t.slice(7)||"/":t.startsWith("/")?t:`/${t}`:""}function Ha(e){const t=Ba(e);return t?t==="/auth/me"||t==="/auth/revoke-all-sessions"||t==="/auth/oauth/bind-token"||t==="/user"||t.startsWith("/user/")||t==="/keys"||t.startsWith("/keys/")||t==="/groups/available"||t==="/groups/rates"||t==="/channels/available"||t==="/usage"||t.startsWith("/usage/")||t==="/announcements"||t.startsWith("/announcements/")||t==="/redeem"||t.startsWith("/redeem/")||t==="/subscriptions"||t.startsWith("/subscriptions/")||t==="/channel-monitors"||t.startsWith("/channel-monitors/")?!0:t.startsWith("/payment/")?!(t.startsWith("/payment/public")||t.startsWith("/payment/webhook")):!1:!1}function Fa(e,t){const a=typeof window<"u"?window.location.pathname:"";return lt(Tt(e))||lt(a)}function Wa(e){return Ha(e)}const ce="/api/v1",ja=Ga();function Ge(e){return e.startsWith("/")?e:`/${e}`}function Ga(e){const a=(String(ce).trim()||ce).replace(/\/+$/,"");return/^[a-z][a-z\d+.-]*:\/\//i.test(a)||a.startsWith("//")?a:Ge(a)}function me(){return ja}function Wp(e){const t=me().replace(/\/+$/,"");let a=Ge(e);return a===ce?a="":a.startsWith(`${ce}/`)&&(a=a.slice(ce.length)),`${t}${a}`}function Rt(e){const t=Ge(e);try{return`${typeof window>
2"u"?new URL(me()).origin:new URL(me(),window.location.origin).origin}${t}`}catch{return t}}const Qe="auth_token",Qa="auth_user",Ie="refresh_token",Je="token_expires_at",Ja="sub2api-auth-token-refresh",dt=3e4,xt=1e3,Ya=1e3,Za=25;let ie=null;function Ye(){const e=localStorage.getItem(Qa);if(!e)return null;try{const t=Number(JSON.parse(e).id);return Number.isFinite(t)&&t>0?t:null}catch{return null}}function Xa(){const e=localStorage.getItem(Ie);if(!e)throw new Error("No refresh token available");return{accessToken:localStorage.getItem(Qe),refreshToken:e,expiresAt:Number(localStorage.getItem(Je)),userID:Ye()}}function en(e){const t=localStorage.getItem(Qe),a=localStorage.getItem(Ie),r=Number(localStorage.getItem(Je));return!t||!a||!Number.isFinite(r)||r<=Date.now()||Ye()!==e.userID?null:{access_token:t,refresh_token:a,expires_in:Math.max(1,Math.ceil((r-Date.now())/1e3)),token_type:"Bearer"}}function Se(e,t){const a=en(e);return a&&(a.refresh_token!==e.refreshToken||t&&e.accessToken!==t&&a.access_token===e.accessToken)?a:null}async function tn(e,t,a=Date.now()+xt){for(;Date.now()<a;){const r=Se(e,t);if(r)return r;await new Promise(o=>window.setTimeout(o,Za))}return Se(e,t)}function an(e){localStorage.setItem(Qe,e.access_token),localStorage.setItem(Je,String(Date.now()+e.expires_in*1e3)),localStorage.setItem(Ie,e.refresh_token)}async function nn(e,t,a=!1){var o;const r=Date.now()+dt+Ya;try{const i=(await Pe.post(`${me()}/auth/refresh`,{refresh_token:e.refreshToken},{headers:{"Content-Type":"application/json"},timeout:dt})).data;if(i.code!==0||!i.data)throw new Error(i.message||"Token refresh failed");if(localStorage.getItem(Ie)!==e.refreshToken||Ye()!==e.userID){const c=Se(e,t);if(c)return c;throw new Error("Session changed during token refresh")}return an(i.data),i.data}catch(s){const i=(o=s.response)==null?void 0:o.status,c=typeof i=="number"&&i>=400&&i<500,u=await tn(e,t,c&&a?r:Date.now()+xt);if(u)return u;throw s}}async function rn(e){const t=Xa(),a=async(r=!1)=>{const o=Se(t,e.failedAccessToken);return o||nn(t,e.failedAccessToken,r)};return typeof navigator<"u"&&navigator.locks?navigator.locks.request(Ja,()=>a(!1)):a(!0)}function Lt(e={}){if(ie)return ie;const t=rn(e);ie=t;const a=()=>{ie===t&&(ie=null)};return t.then(a,a),t}const n=Pe.create({baseURL:me(),withCredentials:!0,timeout:3e4,headers:{"Content-Type":"application/json"}}),on=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"UTC"}};n.interceptors.request.use(e=>{const t=localStorage.getItem("auth_token");if(t&&e.headers&&(e.headers.Authorization=`Bearer ${t}`),e.headers&&(e.headers["Accept-Language"]=Y()),e.method==="get"&&(e.params||(e.params={}),e.params.timezone=on()),e.headers){const a=String(e.url||"");Fa(a)&&(e.headers[Na]="1"),Wa(a)&&(e.headers[Va]="1")}return e},e=>Promise.reject(e));n.interceptors.response.use(e=>{const t=e.data;if(t&&typeof t=="object"&&"code"in t)if(t.code===0)e.data=t.data;else{const a=t;return Promise.reject({status:e.status,code:t.code,message:t.message||"Unknown error",reason:a.reason,metadata:a.metadata})}return e},async e=>{var a,r;if(e.code==="ERR_CANCELED"||Pe.isCancel(e))return Promise.reject(e);const t=e.config;if(e.response){const{status:o,data:s}=e.response,i=String(((a=e.config)==null?void 0:a.url)||""),c=typeof s=="object"&&s!==null?s:{};if(o===404&&c.message==="Ops monitoring is disabled"){try{localStorage.setItem("ops_monitoring_enabled_cached","false")}catch{}try{window.dispatchEvent(new CustomEvent("ops-monitoring-disabled"))}catch{}return window.location.pathname.startsWith("/admin/ops")&&(window.location.href="/admin/settings"),Promise.reject({status:o,code:"OPS_DISABLED",message:c.message||e.message,url:i})}if(o===423&&c.code==="ADMIN_COMPLIANCE_ACK_REQUIRED"){try{window.dispatchEvent(new CustomEvent("admin-compliance-required",{detail:c.metadata||{}}))}catch{}return Promise.reject({status:o,code:c.code,message:c.message||e.message,metadata:c.metadata})}if(o===401&&!t._retry){const u=localStorage.getItem("refresh_token"),m=i.includes("/auth/login")||i.includes("/auth/register")||i.includes("/auth/refresh");if(u&&!m){const f=localStorage.getItem("auth_user");t._retry=!0;try{const g=t.headers,A=(g==null?void 0:g.Authorization)??(g==null?void 0:g.authorization),P=typeof A=="string"&&A.startsWith("Bearer ")?A.slice(7):null,b=await Lt({failedAccessToken:P});return t.headers&&(t.headers.Authorization=`Bearer ${b.access_token}`),n(t)}catch{return localStorage.getItem("refresh_token")!==u||localStorage.getItem("auth_user")!==f?Promise.reject({status:401,code:"AUTH_SESSION_CHANGED",message:"Authentication session changed while refreshing."}):(localStorage.removeItem("auth_token"),localStorage.removeItem("refresh_token"),localStorage.removeItem("auth_user"),localStorage.removeItem("token_expires_at"),sessionStorage.setItem("auth_expired","1"),window.location.pathname.includes("/login")||(window.location.href="/login"),Promise.reject({status:401,code:"TOKEN_REFRESH_FAILED",message:"Session expired. Please log in again."}))}}const l=!!localStorage.getItem("auth_token"),y=(r=e.config)==null?void 0:r.headers,p=(y==null?void 0:y.Authorization)??(y==null?void 0:y.authorization),d=typeof p=="string"?p.trim()!=="":Array.isArray(p)?p.length>0:!!p;localStorage.removeItem("auth_token"),localStorage.removeItem("refresh_token"),localStorage.removeItem("auth_user"),localStorage.removeItem("token_expires_at"),(l||d)&&!m&&sessionStorage.setItem("auth_expired","1"),window.location.pathname.includes("/login")||(window.location.href="/login")}return Promise.reject({status:o,code:c.code,reason:c.reason,error:c.error,message:c.message||c.detail||e.message,metadata:c.metadata})}return Promise.reject({status:0,message:"Network error. Please check your connection."})});async function sn(){const{data:e}=await n.get("/admin/system/version");return e}async function Ot(e=!1){const{data:t}=await n.get("/admin/system/check-updates",{params:e?{force:"true"}:void 0});return t}async function cn(){const{data:e}=await n.get("/admin/system/rollback-versions");return e}const Dt=15*60*1e3;async function un(){const{data:e}=await n.post("/admin/system/update",void 0,{timeout:Dt});return e}async function ln(e){const{data:t}=await n.post("/admin/system/rollback",e?{version:e}:void 0,{timeout:Dt});return t}async function dn(){const{data:e}=await n.post("/admin/system/restart");return e}const mn={getVersion:sn,checkUpdates:Ot,performUpdate:un,getRollbackVersions:cn,rollback:ln,restartService:dn};function jp(e){const a="/api/v1".replace(/\/$/,""),r=new URLSearchParams(e.params).toString(),o=`${a}/auth/oauth/${e.provider}/start`;return r?`${o}?${r}`:o}async function Gp(e,t){const{data:a}=await n.post(`/auth/oauth/${e.provider}/start`,t,{params:e.params});return a}function Ze(e){return"requires_2fa"in e&&e.requires_2fa===!0}function Ee(e){localStorage.setItem("auth_token",e)}function fe(e){localStorage.setItem("refresh_token",e)}function ge(e){const t=Date.now()+e*1e3;localStorage.setItem("token_expires_at",String(t))}function Xe(){return localStorage.getItem("auth_token")}function qt(){return localStorage.getItem("refresh_token")}function pn(){const e=localStorage.getItem("token_expires_at");return e?parseInt(e,10):null}function Ut(){localStorage.removeItem("auth_token"),localStorage.removeItem("refresh_token"),localStorage.removeItem("auth_user"),localStorage.removeItem("token_expires_at")}async function fn(e){const{data:t}=await n.post("/auth/login",e);return Ze(t)||(Ee(t.access_token),t.refresh_token&&fe(t.refresh_token),t.expires_in&&ge(t.expires_in),localStorage.setItem("auth_user",JSON.stringify(t.user))),t}async function gn(e){const{data:t}=await n.post("/auth/login/2fa",e);return Ee(t.access_token),t.refresh_token&&fe(t.refresh_token),t.expires_in&&ge(t.expires_in),localStorage.setItem("auth_user",JSON.stringify(t.user)),t}async function hn(e){const{data:t}=await n.post("/auth/register",e);return Ee(t.access_token),t.refresh_token&&fe(t.refresh_token),t.expires_in&&ge(t.expires_in),localStorage.setItem("auth_user",JSON.stringify(t.user)),t}async function yn(){return n.get("/auth/me")}async function _n(){const e=qt();if(e)try{await n.post("/auth/logout",{refresh_token:e})}catch{}Ut()}function zt(e){const t={};return typeof(e==null?void 0:e.adoptDisplayName)=="boolean"&&(t.adopt_display_name=e.adoptDisplayName),typeof(e==null?void 0:e.adoptAvatar)=="boolean"&&(t.adopt_avatar=e.adoptAvatar),t}function vn(e){return typeof e.access_token=="string"&&e.access_token.trim().length>0}function wn(e){return vn(e)?"login":"bind"}function bn(e){return wn(e)}function An(e){return e.error==="invitation_required"}function kn(e){return!!(e.suggested_display_name||e.suggested_avatar_url)}function Qp(e){e.refresh_token&&fe(e.refresh_token),e.expires_in&&ge(e.expires_in)}async function Jp(){Xe()&&await n.post("/auth/oauth/bind-token")}async function Sn(){return Lt()}async function Pn(){const{data:e}=await n.post("/auth/revoke-all-sessions");return e}function In(){return Xe()!==null}async function Kt(){const{data:e}=await n.get("/settings/public");return e}function Yp(e){const t=(e==null?void 0:e.wechat_oauth_enabled)??!1;return typeof(e==null?void 0:e.wechat_oauth_open_enabled)=="boolean"||typeof(e==null?void 0:e.wechat_oauth_mp_enabled)=="boolean"?(e==null?void 0:e.wechat_oauth_open_enabled)===!0||(e==null?void 0:e.wechat_oauth_mp_enabled)===!0:t}function En(e){return typeof(e==null?void 0:e.wechat_oauth_open_enabled)=="boolean"&&typeof(e==null?void 0:e.wechat_oauth_mp_enabled)=="boolean"}function $n(e,t){const a=(t??(typeof navigator<"u"?navigator.userAgent:"")??"").trim(),r
2=/MicroMessenger/i.test(a),o=(e==null?void 0:e.wechat_oauth_enabled)??!1,s=typeof(e==null?void 0:e.wechat_oauth_open_enabled)=="boolean"?e.wechat_oauth_open_enabled:o,i=typeof(e==null?void 0:e.wechat_oauth_mp_enabled)=="boolean"?e.wechat_oauth_mp_enabled:o,c=typeof(e==null?void 0:e.wechat_oauth_mobile_enabled)=="boolean"?e.wechat_oauth_mobile_enabled:!1;return r?i?{mode:"mp",openEnabled:s,mpEnabled:i,mobileEnabled:c,isWeChatBrowser:r,unavailableReason:null}:s?{mode:null,openEnabled:s,mpEnabled:i,mobileEnabled:c,isWeChatBrowser:r,unavailableReason:"external_browser_required"}:{mode:null,openEnabled:s,mpEnabled:i,mobileEnabled:c,isWeChatBrowser:r,unavailableReason:"not_configured"}:s?{mode:"open",openEnabled:s,mpEnabled:i,mobileEnabled:c,isWeChatBrowser:r,unavailableReason:null}:i?{mode:null,openEnabled:s,mpEnabled:i,mobileEnabled:c,isWeChatBrowser:r,unavailableReason:"wechat_browser_required"}:{mode:null,openEnabled:s,mpEnabled:i,mobileEnabled:c,isWeChatBrowser:r,unavailableReason:"not_configured"}}function Zp(e,t){const a=((typeof navigator<"u"?navigator.userAgent:"")??"").trim(),r=/MicroMessenger/i.test(a);return En(e)?$n(e,a):{mode:null,openEnabled:!1,mpEnabled:!1,mobileEnabled:!1,isWeChatBrowser:r,unavailableReason:"capability_unknown"}}async function Cn(e){const{data:t}=await n.post("/auth/send-verify-code",e);return t}async function Mn(e){const{data:t}=await n.post("/auth/oauth/pending/send-verify-code",e);return t}async function Tn(e){const{data:t}=await n.post("/auth/validate-promo-code",{code:e});return t}async function Rn(e){const{data:t}=await n.post("/auth/validate-invitation-code",{code:e});return t}async function xn(e){const{data:t}=await n.post("/auth/forgot-password",e);return t}async function Ln(e){const{data:t}=await n.post("/auth/reset-password",e);return t}async function On(e,t,a){return Nt(e,t,a)}async function Dn(e,t,a){return Vt(e,t,a)}async function qn(e,t,a){return Bt(e,t,a)}async function $e(e,t,a,r){const o=r==null?void 0:r.trim(),{data:s}=await n.post(`/auth/oauth/${e}/complete-registration`,{invitation_code:t,...o?{aff_code:o}:{},...zt(a)});return s}async function Nt(e,t,a){return $e("linuxdo",e,t,a)}async function Vt(e,t,a){return $e("oidc",e,t,a)}async function Bt(e,t,a){return $e("wechat",e,t,a)}async function Un(e,t,a){return $e("dingtalk",e,t,a)}async function Ht(e){const{data:t}=await n.post("/auth/oauth/pending/exchange",zt(e));return t}async function zn(e){return Ht(e)}const ae={login:fn,login2FA:gn,isTotp2FARequired:Ze,register:hn,getCurrentUser:yn,logout:_n,isAuthenticated:In,setAuthToken:Ee,setRefreshToken:fe,setTokenExpiresAt:ge,getAuthToken:Xe,getRefreshToken:qt,getTokenExpiresAt:pn,clearAuthToken:Ut,getPublicSettings:Kt,sendVerifyCode:Cn,sendPendingOAuthVerifyCode:Mn,validatePromoCode:Tn,validateInvitationCode:Rn,forgotPassword:xn,resetPassword:Ln,refreshToken:Sn,revokeAllSessions:Pn,getPendingOAuthBindLoginKind:bn,isPendingOAuthCreateAccountRequired:An,hasPendingOAuthSuggestedProfile:kn,completePendingOAuthBindLogin:Ht,createPendingLinuxDoOAuthAccount:Nt,createPendingOIDCOAuthAccount:Vt,createPendingWeChatOAuthAccount:Bt,exchangePendingOAuthCompletion:zn,completeLinuxDoOAuthRegistration:On,completeOIDCOAuthRegistration:Dn,completeWeChatOAuthRegistration:qn,createPendingDingTalkOAuthAccount:Un},oe=re("app",()=>{const e=w(!1),t=w(!1),a=w(0),r=w(!1),o=w([]),s=w(!1),i=w(!1),c=w("Sub2API"),u=w(""),m=w(""),l=w(""),y=w(""),p=w(""),d=w(null);let f=null;const g=w(!1),A=w(!1),P=w(""),b=w(""),M=w(!1),E=w("source"),K=w(null);let G=0;const H=I(()=>o.value.length>0),F=I(()=>{var k;return((k=d.value)==null?void 0:k.backend_mode_enabled)??!1}),U=w(0);function W(){e.value=!e.value}function O(k){e.value=k}function q(){t.value=!t.value}function N(k){t.value=k}function v(k){k?U.value++:U.value=Math.max(0,U.value-1),r.value=U.value>0}function S(k,$,V){const B=`toast-${++G}`,_a={id:B,type:k,message:$,duration:V,startTime:V!==void 0?Date.now():void 0};return o.value.push(_a),V!==void 0&&setTimeout(()=>{it(B)},V),B}function x(k,$=3e3){return S("success",k,$)}function Q(k,$=5e3){return S("error",k,$)}function se(k,$=3e3){return S("info",k,$)}function ca(k,$=4e3){return S("warning",k,$)}function it(k){const $=o.value.findIndex(V=>V.id===k);$!==-1&&o.value.splice($,1)}function ua(){o.value=[]}
2async function la(k){v(!0);try{return await k()}finally{v(!1)}}async function da(k,$){v(!0);try{return await k()}catch(V){const B=$||V.message||D.global.t("common.unknownError");return Q(B),null}finally{v(!1)}}function ma(){e.value=!1,r.value=!1,U.value=0,o.value=[]}async function pa(k=!1){if(g.value&&!k)return{current_version:P.value,latest_version:b.value,has_update:M.value,build_type:E.value,release_info:K.value||void 0,cached:!0};if(A.value)return null;A.value=!0;try{const $=await Ot(k);return P.value=$.current_version,b.value=$.latest_version,M.value=$.has_update,E.value=$.build_type||"source",K.value=$.release_info||null,g.value=!0,$}catch($){return console.error("Failed to fetch version:",$),null}finally{A.value=!1}}function fa(){g.value=!1,M.value=!1}function Re(k){typeof window<"u"&&(window.__APP_CONFIG__={...k}),d.value=k,c.value=k.site_name||"Sub2API",u.value=k.site_logo||"",m.value=k.version||"",l.value=k.contact_info||"",y.value=k.api_base_url||"",p.value=k.doc_url||"",s.value=!0}function ga(k=!1){if(f)return f;if(!s.value&&!k&&window.__APP_CONFIG__)return Re(window.__APP_CONFIG__),Promise.resolve(window.__APP_CONFIG__);if(s.value&&!k)return d.value?Promise.resolve({...d.value}):Promise.resolve({registration_enabled:!1,email_verify_enabled:!1,force_email_on_third_party_signup:!1,registration_email_suffix_whitelist:[],promo_code_enabled:!0,password_reset_enabled:!1,invitation_code_enabled:!1,turnstile_enabled:!1,turnstile_site_key:"",aliyun_captcha_enabled:!1,aliyun_captcha_scene_id:"",aliyun_captcha_prefix:"",aliyun_captcha_region:"cn",site_name:c.value,site_logo:u.value,site_subtitle:"",api_base_url:y.value,contact_info:l.value,doc_url:p.value,home_content:"",compact_home_enabled:!1,hide_ccs_import_button:!1,payment_enabled:!1,table_default_page_size:20,table_page_size_options:[10,20,50,100],custom_menu_items:[],custom_endpoints:[],linuxdo_oauth_enabled:!1,wechat_oauth_enabled:!1,wechat_oauth_open_enabled:!1,wechat_oauth_mp_enabled:!1,wechat_oauth_mobile_enabled:!1,oidc_oauth_enabled:!1,oidc_oauth_provider_name:"OIDC",github_oauth_enabled:!1,google_oauth_enabled:!1,backend_mode_enabled:!1,passkey_enabled:!1,version:m.value,balance_low_notify_enabled:!1,account_quota_notify_enabled:!1,balance_low_notify_threshold:0,channel_monitor_enabled:!0,channel_monitor_default_interval_seconds:60,available_channels_enabled:!1,model_plaza_enabled:!1,model_plaza_require_auth:!1,plugin_management_enabled:!1,risk_control_enabled:!1,service_quota_enabled:!1,affiliate_enabled:!1,allow_user_view_error_requests:!1});i.value=!0;let $;try{$=Kt()}catch(B){return console.error("Failed to fetch public settings:",B),i.value=!1,Promise.resolve(null)}const V=$.then(B=>(Re(B),B)).catch(B=>(console.error("Failed to fetch public settings:",B),null)).finally(()=>{f===V&&(f=null,i.value=!1)});return f=V,V}function ha(){s.value=!1,d.value=null}function ya(){return window.__APP_CONFIG__?(Re(window.__APP_CONFIG__),!0):!1}return{sidebarCollapsed:e,mobileOpen:t,sidebarScrollTop:a,loading:r,toasts:o,publicSettingsLoaded:s,siteName:c,siteLogo:u,siteVersion:m,contactInfo:l,apiBaseUrl:y,docUrl:p,cachedPublicSettings:d,versionLoaded:g,versionLoading:A,currentVersion:P,latestVersion:b,hasUpdate:M,buildType:E,releaseInfo:K,hasActiveToasts:H,backendModeEnabled:F,toggleSidebar:W,setSidebarCollapsed:O,toggleMobileSidebar:q,setMobileOpen:N,setLoading:v,showToast:S,showSuccess:x,showError:Q,showInfo:se,showWarning:ca,hideToast:it,clearAllToasts:ua,withLoading:la,withLoadingAndError:da,reset:ma,fetchVersion:pa,clearVersionCache:fa,fetchPublicSettings:ga,clearPublicSettingsCache:ha,initFromInjectedConfig:ya}}),Kn=Object.freeze(Object.defineProperty({__proto__:null,useAppStore:oe},Symbol.toStringTag,{value:"Module"})),Nn={class:"pointer-events-none fixed right-4 top-4 z-[9999] space-y-3","aria-live":"polite","aria-atomic":"true"},Vn={class:"p-4"},Bn={class:"flex items-start gap-3"},Hn={class:"mt-0.5 flex-shrink-0"},Fn={class:"min-w-0 flex-1"},Wn={key:0,class:"text-sm font-semibold text-gray-900 dark:text-white"},jn=["onClick"],Gn={key:0,class:"h-1 bg-gray-100 dark:bg-dark-700"},Qn=Z({__name:"Toast",setup(e){const t=oe(),a=I(()=>t.toasts),r=u=>{switch(u){case"success":return"checkCircle";case"error":return"xCircle";case"warning":return"exclamationTriangle";case"info":default:return"infoCircle"}},o=u=>{const m={success:"text-green-500",error:"text-red-500",warning:"text-yellow-500",info:"text-blue-500"};return m[u]||m.info},s=u=>{const m={success:"border-green-500",error:"border-red-500",warning:"border-yellow-500",info:"border-blue-500"};return m[u]||m.info},i=u=>{const m={success:"bg-green-500",error:"bg-red-500",warning:"bg-yellow-500",info:"bg-blue-500"};return m[u]||m.info},c=u=>{t.hideToast(u)};return(u,m)=>(C(),pe(He,{to:"body"},[h("div",Nn,[z(va,{"enter-active-class":"transition ease-out duration-300","enter-from-class":"opacity-0 translate-x-full","enter-to-class":"opacity-100 translate-x-0","leave-active-class":"transition ease-in duration-200","leave-from-class":"opacity-100 translate-x-0","leave-to-class":"opacity-0 translate-x-full"},{default:ne(()=>[(C(!0),L(kt,null,wa(a.value,l=>(C(),L("div",{key:l.id,class:X(["pointer-events-auto min-w-[320px] max-w-md overflow-hidden rounded-lg shadow-lg","bg-white dark:bg-dark-800","border-l-4",s(l.type)])},[h("div",Vn,[h("div",Bn,[h("div",Hn,[z(de,{name:r(l.type),size:"md",class:X(o(l.type)),"aria-hidden":"true"},null,8,["name","class"])]),h("div",Fn,[l.title?(C(),L("p",Wn,R(l.title),
21)):j("",!0),h("p",{class:X(["text-sm leading-relaxed",l.title?"mt-1 text-gray-600 dark:text-gray-300":"text-gray-900 dark:text-white"])},R(l.message),3)]),h("button",{onClick:y=>c(l.id),class:"-m-1 flex-shrink-0 rounded p-1 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:text-gray-500 dark:hover:bg-dark-700 dark:hover:text-gray-300","aria-label":"Close notification"},[z(de,{name:"x",size:"sm"})],8,jn)])]),l.duration?(C(),L("div",Gn,[h("div",{class:X(["h-full toast-progress",i(l.type)]),style:St({animationDuration:`${l.duration}ms`})},null,6)])):j("",!0)],2))),128))]),_:1})])]))}}),Ce=(e,t)=>{const a=e.__vccOpts||e;for(const[r,o]of t)a[r]=o;return a},Jn=Ce(Qn,[["__scopeId","data-v-5ff03eb7"]]);function Yn(){const e=w(!1);let t=null,a=null;const r=w(!1),o=100,s=()=>{a!==null&&(clearTimeout(a),a=null)},i=()=>{t=Date.now(),e.value=!0,s(),a=setTimeout(()=>{e.value&&(r.value=!0)},o)},c=()=>{s(),e.value=!1,r.value=!1,t=null},u=()=>{s(),t=null},m=()=>{s(),e.value=!1,r.value=!1,t=null},l=()=>t===null?null:Date.now()-t,y=I(()=>r.value),p=we(e);return{isLoading:y,isNavigating:p,startNavigation:i,endNavigation:c,cancelNavigation:u,resetState:m,getNavigationDuration:l,ANTI_FLICKER_DELAY:o}}let xe=null;function Ft(){return xe||(xe=Yn()),xe}const Zn={class:"navigation-progress",role:"progressbar","aria-label":"Loading","aria-valuenow":"0","aria-valuemin":"0","aria-valuemax":"100"},Xn=Z({__name:"NavigationProgress",setup(e){const{isLoading:t}=Ft(),a=I(()=>t.value);return(r,o)=>(C(),pe(Fe,{name:"progress-fade"},{default:ne(()=>[ba(h("div",Zn,[...o[0]||(o[0]=[h("div",{class:"navigation-progress-bar"},null,-1)])],512),[[Aa,a.value]])]),_:1}))}}),er=Ce(Xn,[["__scopeId","data-v-0856a86e"]]),tr={class:"modal-header"},ar={key:0,class:"modal-footer"},nr=Z({__name:"BaseDialog",props:{show:{type:Boolean},title:{},width:{default:"normal"},closeOnEscape:{type:Boolean,default:!0},closeOnClickOutside:{type:Boolean,default:!1},showCloseButton:{type:Boolean,default:!0},zIndex:{default:50}},emits:["close"],setup(e,{emit:t}){let a=0;const r=`modal-title-${++a}`,o=w(null),s=w(null);let i=null;const c=e,u=t,m=I(()=>c.zIndex!==50?{zIndex:c.zIndex}:void 0),l=I(()=>({narrow:"max-w-md",normal:"max-w-lg",wide:"w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl","extra-wide":"w-full sm:max-w-3xl md:max-w-4xl lg:max-w-5xl xl:max-w-6xl",full:"w-full sm:max-w-4xl md:max-w-5xl lg:max-w-6xl xl:max-w-7xl"})[c.width]),y=()=>{c.closeOnClickOutside&&u("close")},p=d=>{c.show&&c.closeOnEscape&&d.key==="Escape"&&u("close")};return ee(()=>c.show,async d=>{if(d){if(i=document.activeElement,document.body.classList.add("modal-open"),await Sa(),s.value&&(s.value.scrollTop=0),o.value){const f=o.value.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');f==null||f.focus()}}else document.body.classList.remove("modal-open"),i&&typeof i.focus=="function"&&i.focus(),i=null},{immediate:!0}),Pt(()=>{document.addEventListener("keydown",p)}),ka(()=>{document.removeEventListener("keydown",p),document.body.classList.remove("modal-open")}),(d,f)=>(C(),pe(He,{to:"body"},[z(Fe,{name:"modal"},{default:ne(()=>[e.show?(C(),L("div",{key:0,class:"modal-overlay",style:St(m.value),"aria-labelledby":r,role:"dialog","aria-modal":"true",onClick:Ke(y,["self"])},[h("div",{ref_key:"dialogRef",ref:o,class:X(["modal-content",l.value]),onClick:f[1]||(f[1]=Ke(()=>{},["stop"]))},[h("div",tr,[h("h3",{id:r,class:"modal-title"},R(e.title),1),e.showCloseButton?(C(),L("button",{key:0,onClick:f[0]||(f[0]=g=>u("close")),class:"-mr-2 rounded-xl p-2 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30 focus-visible:ring-offset-2 dark:text-dark-500 dark:hover:bg-dark-700 dark:hover:text-dark-300 dark:focus-visible:ring-offset-dark-900","aria-label":"Close modal"},[z(de,{name:"x",size:"md"})])):j("",!0)]),h("div",{ref_key:"modalBodyRef",ref:s,class:"modal-body"},[be(d.$slots,"default")],512),d.$slots.footer?(C(),L("div",ar,[be(d.$slots,"footer")])):j("",!0)],2)],4)):j("",!0)]),_:3})]))}}),rr={class:"w-full"},or=["for"],sr={key:0,class:"text-red-500"},ir={class:"relative"},cr={key:0,class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3.5 text-gray-400 dark:text-dark-400"},ur=["id","type","value","disabled","required","placeholder","autocomplete","readonly"],lr={key:1,class:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 dark:text-dark-400"},dr={key:1,class:"input-error-text mt-1.5"},mr={key:2,class:"input-hint mt-1.5"},pr=Z({__name:"Input",props:{modelValue:{},type:{default:"text"},label:{},placeholder:{},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},error:{},hint:{},id:{},autocomplete:{}},emits:["update:modelValue","change","blur","focus","enter"],setup(e,{expose:t,emit:a}){const r=e,o=a,s=w(null),i=I(()=>r.placeholder||""),c=u=>{const m=u.target.value;o("update:modelValue",m)};return t({focus:()=>{var u;return(u=s.value)==null?void 0:u.focus()},select:()=>{var u;return(u=s.value)==null?void 0:u.select()}}),(u,m)=>(C(),L("div",rr,[e.label?(C(),L("label",{key:0,for:e.id,class:"input-label mb-1.5 block"},[Ae(R(e.label)+" ",1),e.required?(C(),L("span",sr,"*")):j("",!0)],8,or)):j("",!0),h("div",ir,[u.$slots.prefix?(C(),L("div",cr,[be(u.$slots,"prefix")])):j("",!0),h("input",{id:e.id,ref_key:"inputRef",ref:s,type:e.type,value:e.modelValue,disabled:e.disabled,required:e.required,placeholder:i.value,autocomplete:e.autocomplete,readonly:e.readonly,class:X(["input w-full transition-all duration-200",u.$slots.prefix?"pl-11":"",u.$slots.suffix?"pr-11":"",e.error?"input-error ring-2 ring-red-500/20":"",e.disabled?"cursor-not-allowed bg-gray-100 opacity-60 dark:bg-dark-900":""]),onInput:c,onChange:m[0]||(m[0]=l=>u.$emit("change",l.target.value)),onBlur:m[1]||(m[1]=l=>u.$emit("blur",l)),onFocus:m[2]||(m[2]=l=>u.$emit("focus",l)),onKeyup:m[3]||(m[3]=Pa(l=>u.$emit("enter",l),["enter"]))}
2,null,42,ur),u.$slots.suffix?(C(),L("div",lr,[be(u.$slots,"suffix")])):j("",!0)]),e.error?(C(),L("p",dr,R(e.error),1)):e.hint?(C(),L("p",mr,R(e.hint),1)):j("",!0)]))}});function Wt(){if(!window.PublicKeyCredential||!navigator.credentials)throw new Error("Passkeys are not supported by this browser")}function ue(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),a=t+"=".repeat((4-t.length%4)%4),r=atob(a);return Uint8Array.from(r,s=>s.charCodeAt(0)).buffer}function J(e){if(e===null)return null;const t=new Uint8Array(e);let a="";for(const r of t)a+=String.fromCharCode(r);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function fr(e){const t={...e};t.challenge=ue(String(t.challenge));const a={...t.user};return a.id=ue(String(a.id)),t.user=a,Array.isArray(t.excludeCredentials)&&(t.excludeCredentials=t.excludeCredentials.map(r=>({...r,id:ue(String(r.id))}))),t}function gr(e){const t={...e};return t.challenge=ue(String(t.challenge)),Array.isArray(t.allowCredentials)&&(t.allowCredentials=t.allowCredentials.map(a=>({...a,id:ue(String(a.id))}))),t}function hr(e){const t=e.response;return{id:e.id,rawId:J(e.rawId),type:e.type,authenticatorAttachment:e.authenticatorAttachment,clientExtensionResults:e.getClientExtensionResults(),response:{attestationObject:J(t.attestationObject),clientDataJSON:J(t.clientDataJSON),transports:typeof t.getTransports=="function"?t.getTransports():[]}}}function yr(e){const t=e.response;return{id:e.id,rawId:J(e.rawId),type:e.type,authenticatorAttachment:e.authenticatorAttachment,clientExtensionResults:e.getClientExtensionResults(),response:{authenticatorData:J(t.authenticatorData),clientDataJSON:J(t.clientDataJSON),signature:J(t.signature),userHandle:J(t.userHandle)}}}async function _r(e){Wt();const{data:t}=e?await n.post("/auth/passkey/login/begin",e):await n.post("/auth/passkey/login/begin"),a=await navigator.credentials.get({publicKey:gr(t.options.publicKey)});if(!(a instanceof PublicKeyCredential))throw new Error("Passkey sign-in was cancelled");const{data:r}=await n.post("/auth/passkey/login/finish",{session_token:t.session_token,credential:yr(a)});return r}async function vr(e,t){Wt();const{data:a}=await n.post("/user/passkeys/register/begin",{password:t}),r=await navigator.credentials.create({publicKey:fr(a.options.publicKey)});if(!(r instanceof PublicKeyCredential))throw new Error("Passkey creation was cancelled");const{data:o}=await n.post("/user/passkeys/register/finish",{session_token:a.session_token,name:e,credential:hr(r)});return o}async function wr(){const{data:e}=await n.get("/user/passkeys");return e}async function br(e,t){await n.patch(`/user/passkeys/${e}`,{name:t})}async function Ar(e,t){await n.delete(`/user/passkeys/${e}`,{data:{password:t}})}const kr={isSupported:()=>!!(window.PublicKeyCredential&&navigator.credentials),login:_r,register:vr,list:wr,rename:br,remove:Ar};async function Sr(e=!1){const{data:t}=await n.get("/announcements",{params:e?{unread_only:1}:{}});return t}async function Pr(e){const{data:t}=await n.post(`/announcements/${e}/read`);return t}const Le={list:Sr,markRead:Pr};async function Ir(){const{data:e}=await n.get("/admin/dashboard/stats");return e}async function Er(){const{data:e}=await n.get("/admin/dashboard/realtime");return e}async function $r(e){const{data:t}=await n.get("/admin/dashboard/trend",{params:e});return t}async function Cr(e){const{data:t}=await n.get("/admin/dashboard/models",{params:e});return t}async function Mr(e){const{data:t}=await n.get("/admin/dashboard/groups",{params:e});return t}async function Xp(e){const{data:t}=await n.get("/admin/dashboard/user-breakdown",{params:e});return t}async function Tr(e){const{data:t}=await n.get("/admin/dashboard/snapshot-v2",{params:e});return t}async function Rr(e){const{data:t}=await n.get("/admin/dashboard/api-keys-trend",{params:e});return t}async function xr(e){const{data:t}=await n.get("/admin/dashboard/users-trend",{params:e});return t}async function Lr(e){const{data:t}=await n.get("/admin/dashboard/users-ranking",{params:e});return t}async function Or(e){const{data:t}=await n.post("/admin/dashboard/users-usage",{user_ids:e});return t}async function Dr(e){const{data:t}=await n.post("/admin/dashboard/api-keys-usage",{api_key_ids:e});return t}const qr={getStats:Ir,getRealtimeMetrics:Er,getUsageTrend:$r,getModelStats:Cr,getGroupStats:Mr,getSnapshotV2:Tr,getApiKeyUsageTrend:Rr,getUserUsageTrend:xr,getUserSpendingRanking:Lr,getBatchUsersUsage:Or,getBatchApiKeysUsage:Dr};async function Ur(e=1,t=20,a,r){const o={page:e,page_size:t,status:a==null?void 0:a.status,role:a==null?void 0:a.role,search:a==null?void 0:a.search,group_name:a==null?void 0:a.group_name,api_key_group_id:a==null?void 0:a.api_key_group_id,include_subscriptions:a==null?void 0:a.include_subscriptions,sort_by:a==null?void 0:a.sort_by,sort_order:a==null?void 0:a.sort_order};if(a!=null&&a.attributes)for(const[i,c]of Object.entries(a.attributes))c&&(o[`attr[${i}]`]=c);const{data:s}=await n.get("/admin/users",{params:o,signal:r==null?void 0:r.signal});return s}async function zr(e,t=!1){const a=t?`/admin/users/${e}?include_deleted=true`:`/admin/users/${e}`,{data:r}=await n.get(a);return r}async function Kr(e){const{data:t}=await n.post("/admin/users",e);return t}async function et(e,t){const{data:a}=await n.put(`/admin/users/${e}`,t);return a}
2async function Nr(e){const{data:t}=await n.delete(`/admin/users/${e}`);return t}async function Vr(e,t,a="set",r){const{data:o}=await n.post(`/admin/users/${e}/balance`,{balance:t,operation:a,notes:r||""});return o}async function Br(e,t){return et(e,{concurrency:t})}async function Hr(e){const{data:t}=await n.post("/admin/users/batch-limits",e);return t}async function Fr(e,t){return et(e,{status:t})}async function Wr(e){const{data:t}=await n.get(`/admin/users/${e}/api-keys`);return t}async function jr(e,t="month"){const{data:a}=await n.get(`/admin/users/${e}/usage`,{params:{period:t}});return a}async function Gr(e,t=1,a=20,r){const o={page:t,page_size:a};r&&(o.type=r);const{data:s}=await n.get(`/admin/users/${e}/balance-history`,{params:o});return s}async function Qr(e,t,a){const{data:r}=await n.post(`/admin/users/${e}/replace-group`,{old_group_id:t,new_group_id:a});return r}async function Jr(e,t){const{data:a}=await n.post(`/admin/users/${e}/auth-identities`,t);return a}async function Yr(e){const{data:t}=await n.get(`/admin/users/${e}/platform-quotas`);return t}async function Zr(e,t){const{data:a}=await n.put(`/admin/users/${e}/platform-quotas`,{quotas:t});return a}async function Xr(e,t,a){const{data:r}=await n.post(`/admin/users/${e}/platform-quotas/reset`,{platform:t,window:a});return r}const eo={list:Ur,getById:zr,create:Kr,update:et,delete:Nr,updateBalance:Vr,updateConcurrency:Br,batchUpdateLimits:Hr,toggleStatus:Fr,getUserApiKeys:Wr,getUserUsageStats:jr,getUserBalanceHistory:Gr,replaceGroup:Qr,bindUserAuthIdentity:Jr,getPlatformQuotas:Yr,updatePlatformQuotas:Zr,resetPlatformQuotaWindow:Xr};async function to(e=1,t=20,a,r){const{data:o}=await n.get("/admin/groups",{params:{page:e,page_size:t,...a},signal:r==null?void 0:r.signal});return o}async function jt(e){const{data:t}=await n.get("/admin/groups/all",{params:e?{platform:e}:void 0});return t}async function ao(){const{data:e}=await n.get("/admin/groups/all",{params:{include_inactive:!0}});return e}async function no(e){return jt(e)}async function ro(){const{data:e}=await n.get("/admin/groups/live-capability");return e}async function oo(e){const{data:t}=await n.get(`/admin/groups/${e}`);return t}async function so(e,t){const{data:a}=await n.get(`/admin/groups/${e}/model-allowlist-candidates`,{params:t?{platform:t}:void 0});return a.models||[]}async function io(e){const{data:t}=await n.post("/admin/groups",e);return t}const Oe=new Map;function co(){var e;try{const t=(e=globalThis.localStorage)==null?void 0:e.getItem("auth_user");if(!t)return null;const a=JSON.parse(t);if(typeof a!="object"||a===null)return null;const r=a.id;return typeof r!="number"||!Number.isSafeInteger(r)||r<=0?null:String(r)}catch{return null}}function uo(e){const t=co();return t?{adminID:t,key:`sub2api:admin:group-duplicate:${t}:${e}`}:null}function lo(e){var t;try{return((t=globalThis.sessionStorage)==null?void 0:t.getItem(e))??null}catch{return null}}function mt(e,t){var a,r;try{t?(a=globalThis.sessionStorage)==null||a.setItem(e,t):(r=globalThis.sessionStorage)==null||r.removeItem(e)}catch{}}async function mo(e){var o,s;const t=uo(e);let a=t?Oe.get(t.key)??lo(t.key):null;if(!a){const i=((s=(o=globalThis.crypto)==null?void 0:o.randomUUID)==null?void 0:s.call(o))??`${Date.now()}-${Math.random().toString(36).slice(2)}`;a=`group-duplicate-${(t==null?void 0:t.adminID)??"unknown-admin"}-${e}-${i}`}t&&(Oe.set(t.key,a),mt(t.key,a));const{data:r}=await n.post(`/admin/groups/${e}/duplicate`,void 0,{headers:{"Idempotency-Key":a}});return t&&(Oe.delete(t.key),mt(t.key,null)),r}async function Gt(e,t){const{data:a}=await n.put(`/admin/groups/${e}`,t);return a}async function po(e){const{data:t}=await n.delete(`/admin/groups/${e}`);return t}async function fo(e,t){return Gt(e,{status:t})}async function go(e){const{data:t}=await n.get(`/admin/groups/${e}/stats`);return t}async function ho(e,t=1,a=20){const{data:r}=await n.get(`/admin/groups/${e}/api-keys`,{params:{page:t,page_size:a}});return r}async function yo(e){const{data:t}=await n.get(`/admin/groups/${e}/composite-routes`);return t}async function _o(e,t){const{data:a}=await n.post(`/admin/groups/${e}/composite-routes`,t);return a}
2async function vo(e,t,a){const{data:r}=await n.put(`/admin/groups/${e}/composite-routes/${t}`,a);return r}async function wo(e,t){const{data:a}=await n.delete(`/admin/groups/${e}/composite-routes/${t}`);return a}async function bo(e,t){const{data:a}=await n.post(`/admin/groups/${e}/composite-routes/preview`,t);return a}async function Ao(e){const{data:t}=await n.get(`/admin/groups/${e}/rate-multipliers`);return t}async function ko(e){const{data:t}=await n.put("/admin/groups/sort-order",{updates:e});return t}async function So(e){const{data:t}=await n.delete(`/admin/groups/${e}/rate-multipliers`);return t}async function Po(e,t){const{data:a}=await n.put(`/admin/groups/${e}/rate-multipliers`,{entries:t});return a}async function Io(e){const{data:t}=await n.get(`/admin/groups/${e}/rate-multipliers`);return t.filter(a=>a.rpm_override!=null).map(a=>({user_id:a.user_id,user_name:a.user_name,user_email:a.user_email,user_notes:a.user_notes,user_status:a.user_status,rpm_override:a.rpm_override}))}async function Eo(e,t){const{data:a}=await n.put(`/admin/groups/${e}/rpm-overrides`,{entries:t});return a}async function $o(e){const{data:t}=await n.delete(`/admin/groups/${e}/rpm-overrides`);return t}async function Co(){const{data:e}=await n.get("/admin/groups/usage-summary");return e}async function Mo(){const{data:e}=await n.get("/admin/groups/capacity-summary");return e}const To={list:to,getAll:jt,getByPlatform:no,getAllIncludingInactive:ao,getLiveCapability:ro,getById:oo,getModelAllowlistCandidates:so,create:io,duplicate:mo,update:Gt,delete:po,toggleStatus:fo,getStats:go,getGroupApiKeys:ho,listCompositeRoutes:yo,createCompositeRoute:_o,updateCompositeRoute:vo,deleteCompositeRoute:wo,previewCompositeRoute:bo,getGroupRateMultipliers:Ao,clearGroupRateMultipliers:So,batchSetGroupRateMultipliers:Po,getGroupRPMOverrides:Io,clearGroupRPMOverrides:$o,batchSetGroupRPMOverrides:Eo,updateSortOrder:ko,getUsageSummary:Co,getCapacitySummary:Mo};async function Ro(e=1,t=20,a,r){const{data:o}=await n.get("/admin/accounts",{params:{page:e,page_size:t,...a},signal:r==null?void 0:r.signal});return o}async function xo(e=1,t=20,a,r){var c;const o={};r!=null&&r.etag&&(o["If-None-Match"]=r.etag);const s=await n.get("/admin/accounts/upstream-billing-rates",{params:{page:e,page_size:t,...a},headers:o,signal:r==null?void 0:r.signal,validateStatus:u=>u>=200&&u<300||u===304}),i=typeof((c=s.headers)==null?void 0:c.etag)=="string"?s.headers.etag:null;return s.status===304?{notModified:!0,etag:i,data:null}:{notModified:!1,etag:i,data:s.data}}async function Lo(e=1,t=20,a,r){var c;const o={};r!=null&&r.etag&&(o["If-None-Match"]=r.etag);const s=await n.get("/admin/accounts",{params:{page:e,page_size:t,...a},headers:o,signal:r==null?void 0:r.signal,validateStatus:u=>u>=200&&u<300||u===304}),i=typeof((c=s.headers)==null?void 0:c.etag)=="string"?s.headers.etag:null;return s.status===304?{notModified:!0,etag:i,data:null}:{notModified:!1,etag:i,data:s.data}}async function Oo(e){const{data:t}=await n.get(`/admin/accounts/${e}`);return t}async function Do(e){const{data:t}=await n.post("/admin/accounts",e);return t}const De=new Map;function Ne(e){return`sub2api:admin:account-duplicate:${e}`}function qo(e){var t;try{return((t=globalThis.sessionStorage)==null?void 0:t.getItem(Ne(e)))??null}catch{return null}}function pt(e,t){var a,r;try{t?(a=globalThis.sessionStorage)==null||a.setItem(Ne(e),t):(r=globalThis.sessionStorage)==null||r.removeItem(Ne(e))}catch{}}async function Uo(e){var r,o;let t=De.get(e)??qo(e);if(!t){const s=((o=(r=globalThis.crypto)==null?void 0:r.randomUUID)==null?void 0:o.call(r))??`${Date.now()}-${Math.random().toString(36).slice(2)}`;t=`account-duplicate-${e}-${s}`}De.set(e,t),pt(e,t);const{data:a}=await n.post(`/admin/accounts/${e}/duplicate`,void 0,{headers:{"Idempotency-Key":t}});return De.delete(e),pt(e,null),a}async function Qt(e,t){const{data:a}=await n.put(`/admin/accounts/${e}`,t);return a}async function zo(e){const{data:t}=await n.post("/admin/accounts/check-mixed-channel",e);return t}async function Ko(e){const{data:t}=await n.delete(`/admin/accounts/${e}`);return t}async function No(e,t){return Qt(e,{status:t})}async function Vo(e){const{data:t}=await n.post(`/admin/accounts/${e}/test`);return t}async function Bo(e){const{data:t}=await n.post(`/admin/accounts/${e}/refresh`);return t}async function Ho(e,t){const{data:a}=await n.post(`/admin/accounts/${e}/apply-oauth-credentials`,t);return a}
2async function Fo(e,t=30){const{data:a}=await n.get(`/admin/accounts/${e}/stats`,{params:{days:t}});return a}async function Wo(e){const{data:t}=await n.post(`/admin/accounts/${e}/clear-error`);return t}async function jo(e,t,a){const r={};t&&(r.source=t),a&&(r.force="true");const{data:o}=await n.get(`/admin/accounts/${e}/usage`,{params:Object.keys(r).length>0?r:void 0});return o}async function Go(e,t){const{data:a}=await n.post("/admin/accounts/usage/batch",{account_ids:e,force:t===!0});return a}async function Qo(e){const{data:t}=await n.post(`/admin/accounts/${e}/clear-rate-limit`);return t}async function Jo(e){const{data:t}=await n.post(`/admin/accounts/${e}/recover-state`);return t}async function Yo(e){const{data:t}=await n.post(`/admin/accounts/${e}/reset-quota`);return t}async function Zo(e){const{data:t}=await n.get(`/admin/accounts/${e}/temp-unschedulable`);return t}async function Xo(e){const{data:t}=await n.delete(`/admin/accounts/${e}/temp-unschedulable`);return t}async function es(e,t){const{data:a}=await n.post(e,t);return a}async function ts(e,t){const{data:a}=await n.post(e,t);return a}async function as(e){const{data:t}=await n.post("/admin/accounts/batch",{accounts:e});return t}async function ns(e){const{data:t}=await n.post("/admin/accounts/batch-update-credentials",e);return t}async function rs(e,t){const a=Array.isArray(e)?{account_ids:e,...t??{}}:e,{data:r}=await n.post("/admin/accounts/bulk-update",a);return r}async function os(e){const{data:t}=await n.get(`/admin/accounts/${e}/today-stats`);return t}async function ss(e){const{data:t}=await n.post("/admin/accounts/today-stats/batch",{account_ids:e});return t}async function is(e,t){const{data:a}=await n.post(`/admin/accounts/${e}/schedulable`,{schedulable:t});return a}async function cs(e){const{data:t}=await n.get(`/admin/accounts/${e}/models`);return t}async function us(e){const{data:t}=await n.post(`/admin/accounts/${e}/models/sync-upstream`);return t}async function ls(e){const{data:t}=await n.post("/admin/accounts/models/sync-upstream-preview",e);return t}async function ds(e){const{data:t}=await n.post("/admin/accounts/sync/crs/preview",e);return t}async function ms(e){const{data:t}=await n.post("/admin/accounts/sync/crs",e,{timeout:18e4});return t}async function ps(e){const t={};if(e!=null&&e.ids&&e.ids.length>0)t.ids=e.ids.join(",");else if(e!=null&&e.filters){const{platform:r,type:o,status:s,group:i,privacy_mode:c,search:u,sort_by:m,sort_order:l}=e.filters;r&&(t.platform=r),o&&(t.type=o),s&&(t.status=s),i&&(t.group=i),c&&(t.privacy_mode=c),u&&(t.search=u),m&&(t.sort_by=m),l&&(t.sort_order=l)}(e==null?void 0:e.includeProxies)===!1&&(t.include_proxies="false");const{data:a}=await n.get("/admin/accounts/data",{params:t});return a}async function fs(e){const{data:t}=await n.post("/admin/accounts/data",{data:e.data,skip_default_group_bind:e.skip_default_group_bind});return t}async function gs(e){const{data:t}=await n.post("/admin/accounts/import/codex-session",e,{timeout:12e4});return t}async function hs(e){const{data:t}=await n.post("/admin/openai/create-from-codex-pat",e);return t}async function ys(){const{data:e}=await n.get("/admin/accounts/antigravity/default-model-mapping");return e}async function _s(e,t,a="/admin/openai/refresh-token",r){const o={refresh_token:e};t&&(o.proxy_id=t),r&&(o.client_id=r);const{data:s}=await n.post(a,o);return s}async function vs(e){const{data:t}=await n.post(`/admin/accounts/${e}/revert-proxy-fallback`);return t}async function ws(e){const{data:t}=await n.post("/admin/accounts/batch-delete",{account_ids:e});return t}async function bs(e){const{data:t}=await n.post("/admin/accounts/batch-clear-error",{account_ids:e});return t}async function As(e){const{data:t}=await n.post("/admin/accounts/batch-refresh",{account_ids:e},{timeout:12e4});return t}async function ks(e){const{data:t}=await n.post(`/admin/accounts/${e}/set-privacy`);return t}async function Ss(e){const{data:t}=await n.post(`/admin/openai/accounts/${e}/quota/refresh`);return t}async function Ps(e){const{data:t}=await n.post(`/admin/openai/accounts/${e}/reset-quota`,void 0,{timeout:9e4});return t}async function Is(e,t){const{data:a}=await n.post(`/admin/accounts/${e}/shadow`,t);return a}
2async function Es(){const{data:e}=await n.get("/admin/accounts/upstream-billing-probe/settings");return e}async function $s(e){const{data:t}=await n.put("/admin/accounts/upstream-billing-probe/settings",e);return t}async function Cs(e,t){await n.put(`/admin/accounts/${e}/upstream-billing-probe`,{enabled:t})}async function Ms(e){const{data:t}=await n.post(`/admin/accounts/${e}/upstream-billing-probe`);return t}async function Ts(e){const{data:t}=await n.post("/admin/accounts/upstream-billing-probe/batch",{account_ids:e});return t.results}async function Rs(){const{data:e}=await n.get("/admin/accounts/ollama-cloud-usage/settings");return e}async function xs(e){const{data:t}=await n.put("/admin/accounts/ollama-cloud-usage/settings",e);return t}async function Ls(e){const{data:t}=await n.get(`/admin/accounts/${e}/ollama-cloud-usage`);return t}async function Os(e,t){const{data:a}=await n.put(`/admin/accounts/${e}/ollama-cloud-usage/session`,{session:t});return a}async function Ds(e){const{data:t}=await n.delete(`/admin/accounts/${e}/ollama-cloud-usage/session`);return t}async function qs(e,t){const{data:a}=await n.put(`/admin/accounts/${e}/ollama-cloud-usage/auto-refresh`,{enabled:t});return a}async function Us(e){const{data:t}=await n.post(`/admin/accounts/${e}/ollama-cloud-usage/refresh`);return t}const zs={list:Ro,listWithEtag:Lo,getUpstreamBillingRatesWithEtag:xo,getById:Oo,create:Do,duplicate:Uo,update:Qt,checkMixedChannelRisk:zo,delete:Ko,toggleStatus:No,testAccount:Vo,refreshCredentials:Bo,applyOAuthCredentials:Ho,getStats:Fo,clearError:Wo,getUsage:jo,getBatchUsage:Go,getTodayStats:os,getBatchTodayStats:ss,clearRateLimit:Qo,recoverState:Jo,resetAccountQuota:Yo,getTempUnschedulableStatus:Zo,resetTempUnschedulable:Xo,setSchedulable:is,getAvailableModels:cs,syncUpstreamModels:us,syncUpstreamModelsPreview:ls,generateAuthUrl:es,exchangeCode:ts,refreshOpenAIToken:_s,batchCreate:as,batchUpdateCredentials:ns,bulkUpdate:rs,previewFromCrs:ds,syncFromCrs:ms,exportData:ps,importData:fs,importCodexSession:gs,createOpenAICodexPAT:hs,getAntigravityDefaultModelMapping:ys,batchDelete:ws,batchClearError:bs,batchRefresh:As,setPrivacy:ks,revertProxyFallback:vs,refreshOpenAIQuota:Ss,resetOpenAIQuota:Ps,createSparkShadow:Is,getUpstreamBillingProbeSettings:Es,updateUpstreamBillingProbeSettings:$s,setUpstreamBillingProbeEnabled:Cs,probeUpstreamBilling:Ms,probeUpstreamBillingBatch:Ts,getOllamaCloudUsageSettings:Rs,updateOllamaCloudUsageSettings:xs,getOllamaCloudUsage:Ls,saveOllamaCloudUsageSession:Os,deleteOllamaCloudUsageSession:Ds,setOllamaCloudUsageAutoRefresh:qs,refreshOllamaCloudUsage:Us};async function Ks(e=1,t=20,a,r){const{data:o}=await n.get("/admin/proxies",{params:{page:e,page_size:t,...a},signal:r==null?void 0:r.signal});return o}async function Ns(){const{data:e}=await n.get("/admin/proxies/all");return e}async function Vs(){const{data:e}=await n.get("/admin/proxies/all",{params:{with_count:"true"}});return e}async function Bs(e){const{data:t}=await n.get(`/admin/proxies/${e}`);return t}async function Hs(e){const{data:t}=await n.post("/admin/proxies",e);return t}async function Jt(e,t){const{data:a}=await n.put(`/admin/proxies/${e}`,t);return a}async function Fs(e){const{data:t}=await n.delete(`/admin/proxies/${e}`);return t}async function Ws(e,t){return Jt(e,{status:t})}async function js(e){const{data:t}=await n.post(`/admin/proxies/${e}/test`);return t}async function Gs(e){const{data:t}=await n.post(`/admin/proxies/${e}/quality-check`);return t}async function Qs(e){const{data:t}=await n.get(`/admin/proxies/${e}/stats`);return t}async function Js(e){const{data:t}=await n.get(`/admin/proxies/${e}/accounts`);return t}async function Ys(e){const{data:t}=await n.post("/admin/proxies/batch",{proxies:e});return t}async function Zs(e){const{data:t}=await n.post("/admin/proxies/batch-delete",{ids:e});return t}async function Xs(e){const t={};if(e!=null&&e.ids&&e.ids.length>0)t.ids=e.ids.join(",");else if(e!=null&&e.filters){const{protocol:r,status:o,search:s,sort_by:i,sort_order:c}=e.filters;r&&(t.protocol=r),o&&(t.status=o),s&&(t.search=s),i&&(t.sort_by=i),c&&(t.sort_order=c)}const{data:a}=await n.get("/admin/proxies/data",{params:t});return a}
2async function ei(e){const{data:t}=await n.post("/admin/proxies/data",e);return t}const ti={list:Ks,getAll:Ns,getAllWithCount:Vs,getById:Bs,create:Hs,update:Jt,delete:Fs,toggleStatus:Ws,testProxy:js,checkProxyQuality:Gs,getStats:Qs,getProxyAccounts:Js,batchCreate:Ys,batchDelete:Zs,exportData:Xs,importData:ei};async function ai(e=1,t=20,a,r){const{data:o}=await n.get("/admin/redeem-codes",{params:{page:e,page_size:t,...a},signal:r==null?void 0:r.signal});return o}async function ni(e){const{data:t}=await n.get(`/admin/redeem-codes/${e}`);return t}async function ri(e,t,a,r,o,s){const i={count:e,type:t,value:a};t==="subscription"&&(i.group_id=r,o&&o>0&&(i.validity_days=o)),s&&s>0&&(i.expires_in_days=s);const{data:c}=await n.post("/admin/redeem-codes/generate",i);return c}async function oi(e){const{data:t}=await n.delete(`/admin/redeem-codes/${e}`);return t}async function si(e){const{data:t}=await n.post("/admin/redeem-codes/batch-delete",{ids:e});return t}async function ii(e,t){const{data:a}=await n.post("/admin/redeem-codes/batch-update",{ids:e,fields:t});return a}async function ci(e){const{data:t}=await n.post(`/admin/redeem-codes/${e}/expire`);return t}async function ui(){const{data:e}=await n.get("/admin/redeem-codes/stats");return e}async function li(e){return(await n.get("/admin/redeem-codes/export",{params:e,responseType:"blob"})).data}const di={list:ai,getById:ni,generate:ri,delete:oi,batchDelete:si,batchUpdate:ii,expire:ci,getStats:ui,exportCodes:li};async function mi(e=1,t=20,a,r){const{data:o}=await n.get("/admin/promo-codes",{params:{page:e,page_size:t,...a},signal:r==null?void 0:r.signal});return o}async function pi(e){const{data:t}=await n.get(`/admin/promo-codes/${e}`);return t}async function fi(e){const{data:t}=await n.post("/admin/promo-codes",e);return t}async function gi(e,t){const{data:a}=await n.put(`/admin/promo-codes/${e}`,t);return a}async function hi(e){const{data:t}=await n.delete(`/admin/promo-codes/${e}`);return t}async function yi(e,t=1,a=20){const{data:r}=await n.get(`/admin/promo-codes/${e}/usages`,{params:{page:t,page_size:a}});return r}const _i={list:mi,getById:pi,create:fi,update:gi,delete:hi,getUsages:yi};async function vi(e=1,t=20,a,r){const{data:o}=await n.get("/admin/announcements",{params:{page:e,page_size:t,...a},signal:r==null?void 0:r.signal});return o}async function wi(e){const{data:t}=await n.get(`/admin/announcements/${e}`);return t}async function bi(e){const{data:t}=await n.post("/admin/announcements",e);return t}async function Ai(e,t){const{data:a}=await n.put(`/admin/announcements/${e}`,t);return a}async function ki(e){const{data:t}=await n.delete(`/admin/announcements/${e}`);return t}async function Si(e,t=1,a=20,r,o){const{data:s}=await n.get(`/admin/announcements/${e}/read-status`,{params:{page:t,page_size:a,...r},signal:o==null?void 0:o.signal});return s}const Pi={list:vi,getById:wi,create:bi,update:Ai,delete:ki,getReadStatus:Si},Yt=["anthropic","openai","gemini","antigravity","grok"],Ii=["openai","anthropic","grok","kimi","zhipu"];function Ei(e){const t={};for(const a of Ii){const r=e==null?void 0:e[a];t[a]=typeof r=="number"&&Number.isFinite(r)?Math.min(100,Math.max(1,Math.trunc(r))):100}return t}function ef(e){return Ei(e)}function $i(e){const t={};for(const a of Yt){const r=e==null?void 0:e[a];t[a]={daily:typeof(r==null?void 0:r.daily)=="number"?r.daily:null,weekly:typeof(r==null?void 0:r.weekly)=="number"?r.weekly:null,monthly:typeof(r==null?void 0:r.monthly)=="number"?r.monthly:null}}return t}function Ci(e){const t=r=>typeof r=="number"&&Number.isFinite(r)&&r>=0?r:null,a={};for(const r of Yt){const o=e==null?void 0:e[r];a[r]={daily:t(o==null?void 0:o.daily),weekly:t(o==null?void 0:o.weekly),monthly:t(o==null?void 0:o.monthly)}}return a}const Zt=["email","linuxdo","oidc","wechat","github","google","dingtalk"],Mi=0,Xt=5,Ti={open:"open",open_platform:"open",official:"open",wx_open:"open",mp:"mp",official_account:"mp",wechat_mp:"mp",mini_program:"mp",mobile:"mobile",mobile_app:"mobile",native_app:"mobile"};function ea(e){return Array.isArray(e)?e.filter(t=>t.group_id>0&&t.validity_days>0).map(t=>({group_id:Math.floor(t.group_id),validity_days:Math.min(36500,Math.max(1,Math.floor(t.validity_days)))})):[]}function tf(e){const t=e;return Zt.reduce((a,r)=>{const o=t[`auth_source_default_${r}_subscriptions`];return a[r]={balance:Number(t[`auth_source_default_${r}_balance`]??Mi),concurrency:Math.max(1,Number(t[`auth_source_default_${r}_concurrency`]??Xt)),subscriptions:ea(Array.isArray(o)?o:[]),grant_on_signup:t[`auth_source_default_${r}_grant_on_signup`]===!0,grant_on_first_bind:t[`auth_source_default_${r}_grant_on_first_bind`]===!0,platform_quotas:$i(t[`auth_source_default_${r}_platform_quotas`])},a},{})}function af(e,t){const a=e;for(const r of Zt){const o=t[r];a[`auth_source_default_${r}_balance`]=Number(o.balance)||0,a[`auth_source_default_${r}_concurrency`]=Math.max(1,Math.floor(Number(o.concurrency)||Xt)),a[`auth_source_default_${r}_subscriptions`]=ea(o.subscriptions),a[`auth_source_default_${r}_grant_on_signup`]=o.grant_on_signup,a[`auth_source_default_${r}_grant_on_first_bind`]=o.grant_on_first_bind,a[`auth_source_default_${r}_platform_quotas`]=Ci(o.platform_quotas)}return e}function tt(e){if(typeof e!="string")return"open";const t=e.trim().toLowerCase();return t?Ti[t]??"open":"open"}function nf(e){switch(tt(e)){case"mp":return"snsapi_userinfo";case"mobile":return"";default:return"snsapi_login"}}function rf(e,t,a,r){if(typeof e=="boolean"||typeof t=="boolean"||typeof a=="boolean")return{openEnabled:e===!0,mpEnabled:t===!0,mobileEnabled:a===!0};switch(tt(r)){case"mp":return{openEnabled:!1,mpEnabled:!0,mobileEnabled:!1};case"mobile":return{openEnabled:!1,mpEnabled:!1,mobileEnabled:!0};default:return{openEnabled:!0,mpEnabled:!1,mobileEnabled:!1}}}function of(e,t,a,r){return t?"mp":a?"mobile":e?"open":tt(r)}async function Ri(){const{data:e}=await n.get("/admin/settings");return e}async function xi(e){const{data:t}=await n.put("/admin/settings",e);return t}async function Li(e){const{data:t}=await n.post("/admin/settings/test-smtp",e);return t}async function Oi(e){const{data:t}=await n.post("/admin/settings/send-test-email",e);return t}async function Di(){const{data:e}=await n.get("/admin/settings/email-templates");return e}async function qi(e,t){const{data:a}=await n.get(`/admin/settings/email-templates/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return a}
2async function Ui(e,t,a){const{data:r}=await n.put(`/admin/settings/email-templates/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,a);return r}async function zi(e,t){const{data:a}=await n.post(`/admin/settings/email-templates/${encodeURIComponent(e)}/${encodeURIComponent(t)}/restore-official`);return a}async function Ki(e){const{data:t}=await n.post("/admin/settings/email-template-preview",e);return t}async function Ni(){const{data:e}=await n.get("/admin/settings/admin-api-key");return e}async function Vi(){const{data:e}=await n.post("/admin/settings/admin-api-key/regenerate");return e}async function Bi(){const{data:e}=await n.delete("/admin/settings/admin-api-key");return e}async function Hi(){const{data:e}=await n.get("/admin/settings/overload-cooldown");return e}async function Fi(e){const{data:t}=await n.put("/admin/settings/overload-cooldown",e);return t}async function Wi(){const{data:e}=await n.get("/admin/settings/rate-limit-429-cooldown");return e}async function ji(e){const{data:t}=await n.put("/admin/settings/rate-limit-429-cooldown",e);return t}async function Gi(){const{data:e}=await n.get("/admin/settings/panel-rate-limit");return e}async function Qi(e){const{data:t}=await n.put("/admin/settings/panel-rate-limit",e);return t}async function Ji(){const{data:e}=await n.get("/admin/settings/stream-timeout");return e}async function Yi(e){const{data:t}=await n.put("/admin/settings/stream-timeout",e);return t}async function Zi(){const{data:e}=await n.get("/admin/settings/rectifier");return e}async function Xi(e){const{data:t}=await n.put("/admin/settings/rectifier",e);return t}async function ec(){const{data:e}=await n.get("/admin/settings/beta-policy");return e}async function tc(e){const{data:t}=await n.put("/admin/settings/beta-policy",e);return t}async function ac(){const{data:e}=await n.get("/admin/settings/web-search-emulation");return e}async function nc(e){const{data:t}=await n.put("/admin/settings/web-search-emulation",e);return t}async function rc(e){const{data:t}=await n.post("/admin/settings/web-search-emulation/test",{query:e});return t}async function oc(e){await n.post("/admin/settings/web-search-emulation/reset-usage",e)}const sc={getSettings:Ri,updateSettings:xi,testSmtpConnection:Li,sendTestEmail:Oi,getEmailTemplates:Di,getEmailTemplate:qi,updateEmailTemplate:Ui,restoreOfficialEmailTemplate:zi,previewEmailTemplate:Ki,getAdminApiKey:Ni,regenerateAdminApiKey:Vi,deleteAdminApiKey:Bi,getOverloadCooldownSettings:Hi,updateOverloadCooldownSettings:Fi,getRateLimit429CooldownSettings:Wi,updateRateLimit429CooldownSettings:ji,getPanelRateLimitSettings:Gi,updatePanelRateLimitSettings:Qi,getStreamTimeoutSettings:Ji,updateStreamTimeoutSettings:Yi,getRectifierSettings:Zi,updateRectifierSettings:Xi,getBetaPolicySettings:ec,updateBetaPolicySettings:tc,getWebSearchEmulationConfig:ac,updateWebSearchEmulationConfig:nc,testWebSearchEmulation:rc,resetWebSearchUsage:oc};async function ic(e=1,t=20,a,r){const{data:o}=await n.get("/admin/subscriptions",{params:{page:e,page_size:t,...a},signal:r==null?void 0:r.signal});return o}async function cc(e){const{data:t}=await n.get(`/admin/subscriptions/${e}`);return t}async function uc(e){const{data:t}=await n.get(`/admin/subscriptions/${e}/progress`);return t}async function lc(e){const{data:t}=await n.post("/admin/subscriptions/assign",e);return t}async function dc(e){const{data:t}=await n.post("/admin/subscriptions/bulk-assign",e);return t}async function mc(e,t){const{data:a}=await n.post(`/admin/subscriptions/${e}/extend`,t);return a}async function pc(e){const{data:t}=await n.post(`/admin/subscriptions/${e}/revoke`);return t}async function fc(e){const{data:t}=await n.post(`/admin/subscriptions/${e}/restore`);return t}async function gc(e,t){const{data:a}=await n.post(`/admin/subscriptions/${e}/reset-quota`,t);return a}async function hc(e,t=1,a=20){const{data:r}=await n.get(`/admin/groups/${e}/subscriptions`,{params:{page:t,page_size:a}});return r}async function yc(e,t=1,a=20){const{data:r}=await n.get(`/admin/users/${e}/subscriptions`,{params:{page:t,page_size:a}});return r}const _c={list:ic,getById:cc,getProgress:uc,assign:lc,bulkAssign:dc,extend:mc,revoke:pc,restore:fc,resetQuota:gc,listByGroup:hc,listByUser:yc};async function vc(e,t){const{data:a}=await n.get("/admin/usage",{params:e,signal:t==null?void 0:t.signal});return a}
2async function wc(e){const{data:t}=await n.get("/admin/usage/stats",{params:e});return t}async function bc(e){const{data:t}=await n.get("/admin/usage/search-users",{params:{q:e}});return t}async function Ac(e,t){const a={};e!==void 0&&(a.user_id=e),t&&(a.q=t);const{data:r}=await n.get("/admin/usage/search-api-keys",{params:a});return r}async function kc(e,t){const{data:a}=await n.get("/admin/usage/cleanup-tasks",{params:e,signal:t==null?void 0:t.signal});return a}async function Sc(e){const{data:t}=await n.post("/admin/usage/cleanup-tasks",e);return t}async function Pc(e){const{data:t}=await n.post(`/admin/usage/cleanup-tasks/${e}/cancel`);return t}const Ic={list:vc,getStats:wc,searchUsers:bc,searchApiKeys:Ac,listCleanupTasks:kc,createCleanupTask:Sc,cancelCleanupTask:Pc};async function Ec(e){const{data:t}=await n.post("/admin/gemini/oauth/auth-url",e);return t}async function $c(e){const{data:t}=await n.post("/admin/gemini/oauth/exchange-code",e);return t}async function Cc(){const{data:e}=await n.get("/admin/gemini/oauth/capabilities");return e}const Mc={generateAuthUrl:Ec,exchangeCode:$c,getCapabilities:Cc};async function Tc(e){const{data:t}=await n.post("/admin/antigravity/oauth/auth-url",e);return t}async function Rc(e){const{data:t}=await n.post("/admin/antigravity/oauth/exchange-code",e);return t}async function xc(e,t){const a={refresh_token:e};t&&(a.proxy_id=t);const{data:r}=await n.post("/admin/antigravity/oauth/refresh-token",a);return r}const Lc={generateAuthUrl:Tc,exchangeCode:Rc,refreshAntigravityToken:xc},ta=12e4;async function Oc(){const{data:e}=await n.get("/admin/grok/oauth/capabilities");return e}const Dc=3,qc=9e4,Uc=9e4;function zc(e){return Math.ceil(Math.max(1,e)/Dc)*qc+Uc}async function Kc(e){const{data:t}=await n.post("/admin/grok/oauth/auth-url",e);return t}async function Nc(e){const{data:t}=await n.post("/admin/grok/oauth/exchange-code",e);return t}async function Vc(e,t){const a={refresh_token:e};t&&(a.proxy_id=t);const{data:r}=await n.post("/admin/grok/oauth/refresh-token",a);return r}async function Bc(e){const{data:t}=await n.get(`/admin/grok/accounts/${e}/quota`);return t}async function Hc(e){const{data:t}=await n.post(`/admin/grok/accounts/${e}/reset-quota`);return t}async function Fc(e){const{data:t}=await n.post("/admin/grok/sso-to-oauth",e,{timeout:zc(e.sso_tokens.length)});return t}async function Wc(e,t){const a={sso_token:e};t&&(a.proxy_id=t);const{data:r}=await n.post("/admin/grok/oauth/sso-token",a,{timeout:ta});return r}async function jc(e,t){const a="----",r=e.indexOf(a),o=(r>=0?e.slice(0,r):e).trim(),s=r>=0?e.slice(r+a.length):"",i={email:o,password:s};t&&(i.proxy_id=t);const{data:c}=await n.post("/admin/grok/oauth/password",i,{timeout:ta});return c}const Gc={generateAuthUrl:Kc,getCapabilities:Oc,exchangeCode:Nc,refreshGrokToken:Vc,queryQuota:Bc,resetQuota:Hc,createFromSSO:Fc,validateSSOToken:Wc,authorizePassword:jc};async function Qc(e){const{data:t}=await n.get(`/admin/cn-providers/accounts/${e}/quota`);return t}async function Jc(e){const{data:t}=await n.get(`/admin/cn-providers/accounts/${e}/balance`);return t}const Yc={queryQuota:Qc,queryBalance:Jc};async function Zc(){const{data:e}=await n.get("/admin/user-attributes");return e}async function Xc(){const{data:e}=await n.get("/admin/user-attributes",{params:{enabled:!0}});return e}async function eu(e){const{data:t}=await n.post("/admin/user-attributes",e);return t}async function tu(e,t){const{data:a}=await n.put(`/admin/user-attributes/${e}`,t);return a}async function au(e){const{data:t}=await n.delete(`/admin/user-attributes/${e}`);return t}async function nu(e){const{data:t}=await n.put("/admin/user-attributes/reorder",{ids:e});return t}async function ru(e){const{data:t}=await n.get(`/admin/users/${e}/attributes`);return t}async function ou(e,t){const{data:a}=await n.put(`/admin/users/${e}/attributes`,{values:t});return a}async function su(e){const{data:t}=await n.post("/admin/user-attributes/batch",{user_ids:e});return t}const iu={listDefinitions:Zc,listEnabledDefinitions:Xc,createDefinition:eu,updateDefinition:tu,deleteDefinition:au,reorderDefinitions:nu,getUserAttributeValues:ru,updateUserAttributeValues:ou,getBatchUserAttributes:su};async function cu(e,t){const a={};e&&(a.platform=e),typeof t=="number"&&t>0&&(a.group_id=t);const{data:r}=await n.get("/admin/ops/concurrency",{params:a});return r}async function uu(){const{data:e}=await n.get("/admin/ops/user-concurrency");return e}async function lu(e,t){const a={};e&&(a.platform=e),typeof t=="number"&&t>0&&(a.group_id=t);const{data:r}=await n.get("/admin/ops/account-availability",{params:a});return r}async function du(e,t,a){const r={window:e};t&&(r.platform=t),typeof a=="number"&&a>0&&(r.group_id=a);const{data:o}=await n.get("/admin/ops/realtime-traffic",{params:r});return o}const mu={REALTIME_DISABLED:4001},pu="sub2api-admin";function fu(e,t={}){let a=null,r=0;const o=Number.isFinite(t.maxReconnectAttempts)?t.maxReconnectAttempts:1/0,s=t.reconnectBaseDelayMs??1e3,i=t.reconnectMaxDelayMs??3e4;let c=null,u=!0,m=!1,l=!1,y=0;const p=t.staleTimeoutMs??12e4,d=t.staleCheckIntervalMs??3e4;let f=null;const g=H=>{var F;(F=t.onStatusChange)==null||F.call(t,H)},A=()=>{c&&(clearTimeout(c),c=null)},P=()=>{f&&(clearInterval(f),f=null)},b=()=>{P(),!(!p||p<=0)&&(f=setInterval(()=>{if(!u||!a||a.readyState!==WebSocket.OPEN||!y)return;Date.now()-y>p&&a.close()},d))},M=()=>{var W;if(!u||l&&r>=o)return;if(typeof navigator<"u"&&"onLine"in navigator&&!navigator.onLine){g("offline");return}const H=s*Math.pow(2,r),F=Math.min(H,i),U=Math.floor(Math.random()*250);A(),c=setTimeout(()=>{r++,G()},F+U),(W=t.onReconnectScheduled)==null||W.call(t,{attempt:r+1,delayMs:F+U})},E=()=>{u&&(a&&(a.readyState===WebSocket.OPEN||a.readyState===WebSocket.CONNECTING)||G())},K=()=>{g("offline")},G=()=>{if(!u||m||a&&(a.readyState===WebSocket.OPEN||a.readyState===WebSocket.CONNECTING)||l&&r>=o)return;m=!0,g(l?"reconnecting":"connecting");const H=t.wsBaseUrl||void 0,F=H?new URL(`${window.location.protocol==="https:"?"wss:":"ws:"}//${H}/api/v1/admin/ops/ws/qps`):new URL(Rt("/api/v1/admin/ops/ws/qps").replace(/^http/,"ws")),U=String(t.token??localStorage.getItem("auth_token")??"").trim(),W=[pu];U&&W.push(`jwt.${U}`),a=new WebSocket(F.toString(),W),a.onopen=()=>{var O;r=0,m=!1,l=!0,A(),y=Date.now(),b(),g("connected"),(O=t.onOpen)==null||O.call(t)},a.onmessage=O=>{try{const q=JSON.parse(O.data);y=Date.now(),e(q)}catch(q){console.warn("[OpsWS] Failed to parse message:",q)}},a.onerror=O=>{var q;console.error("[OpsWS] Connection error:",O),(q=t.onError)==null||q.call(t,O)}
2,a.onclose=O=>{var q,N;if(m=!1,(q=t.onClose)==null||q.call(t,O),P(),a=null,O&&typeof O.code=="number"&&O.code===mu.REALTIME_DISABLED){u=!1,A(),g("closed"),(N=t.onFatalClose)==null||N.call(t,O);return}M()}};return window.addEventListener("online",E),window.addEventListener("offline",K),G(),()=>{u=!1,window.removeEventListener("online",E),window.removeEventListener("offline",K),A(),P(),a&&a.close(),a=null,g("closed")}}async function gu(e,t={}){const{data:a}=await n.get("/admin/ops/dashboard/overview",{params:e,signal:t.signal});return a}async function hu(e,t={}){const{data:a}=await n.get("/admin/ops/dashboard/snapshot-v2",{params:e,signal:t.signal});return a}async function yu(e,t={}){const{data:a}=await n.get("/admin/ops/dashboard/throughput-trend",{params:e,signal:t.signal});return a}async function _u(e,t={}){const{data:a}=await n.get("/admin/ops/dashboard/latency-histogram",{params:e,signal:t.signal});return a}async function vu(e,t={}){const{data:a}=await n.get("/admin/ops/dashboard/error-trend",{params:e,signal:t.signal});return a}async function wu(e,t={}){const{data:a}=await n.get("/admin/ops/dashboard/error-distribution",{params:e,signal:t.signal});return a}async function bu(e,t={}){const{data:a}=await n.get("/admin/ops/dashboard/openai-token-stats",{params:e,signal:t.signal});return a}async function Au(e){const{data:t}=await n.get("/admin/ops/errors",{params:e});return t}async function ku(e){const{data:t}=await n.get(`/admin/ops/errors/${e}`);return t}async function Su(e,t){await n.put(`/admin/ops/errors/${e}/resolve`,{resolved:t})}async function Pu(e){const{data:t}=await n.get("/admin/ops/request-errors",{params:e});return t}async function Iu(e){const{data:t}=await n.get("/admin/ops/upstream-errors",{params:e});return t}async function Eu(e){const{data:t}=await n.get(`/admin/ops/request-errors/${e}`);return t}async function $u(e){const{data:t}=await n.get(`/admin/ops/upstream-errors/${e}`);return t}async function Cu(e,t){await n.put(`/admin/ops/request-errors/${e}/resolve`,{resolved:t})}async function Mu(e,t){await n.put(`/admin/ops/upstream-errors/${e}/resolve`,{resolved:t})}async function Tu(e,t={},a={}){const r={...t};a.include_detail&&(r.include_detail="1");const{data:o}=await n.get(`/admin/ops/request-errors/${e}/upstream-errors`,{params:r});return o}async function Ru(e){const{data:t}=await n.get("/admin/ops/requests",{params:e});return t}async function xu(){const{data:e}=await n.get("/admin/ops/alert-rules");return e}async function Lu(e){const{data:t}=await n.post("/admin/ops/alert-rules",e);return t}async function Ou(e,t){const{data:a}=await n.put(`/admin/ops/alert-rules/${e}`,t);return a}async function Du(e){await n.delete(`/admin/ops/alert-rules/${e}`)}async function qu(e={}){const{data:t}=await n.get("/admin/ops/alert-events",{params:e});return t}async function Uu(e){const{data:t}=await n.get(`/admin/ops/alert-events/${e}`);return t}async function zu(e,t){await n.put(`/admin/ops/alert-events/${e}/status`,{status:t})}async function Ku(e){await n.post("/admin/ops/alert-silences",e)}async function Nu(){const{data:e}=await n.get("/admin/ops/email-notification/config");return e}async function Vu(e){const{data:t}=await n.put("/admin/ops/email-notification/config",e);return t}async function Bu(){const{data:e}=await n.get("/admin/ops/runtime/alert");return e}async function Hu(e){const{data:t}=await n.put("/admin/ops/runtime/alert",e);return t}async function Fu(){const{data:e}=await n.get("/admin/ops/runtime/logging");return e}async function Wu(e){const{data:t}=await n.put("/admin/ops/runtime/logging",e);return t}async function ju(){const{data:e}=await n.post("/admin/ops/runtime/logging/reset");return e}async function Gu(e){const{data:t}=await n.get("/admin/ops/system-logs",{params:e});return t}async function Qu(e){const{data:t}=await n.post("/admin/ops/system-logs/cleanup",e);return t}async function Ju(){const{data:e}=await n.get("/admin/ops/system-logs/health");return e}async function Yu(){const{data:e}=await n.get("/admin/ops/advanced-settings");return e}async function Zu(e){const{data:t}=await n.put("/admin/ops/advanced-settings",e);return t}async function Xu(){const{data:e}=await n.get("/admin/ops/settings/metric-thresholds");return e}async function el(e){await n.put("/admin/ops/settings/metric-thresholds",e)}const tl={getDashboardSnapshotV2:hu,getDashboardOverview:gu,getThroughputTrend:yu,getLatencyHistogram:_u,getErrorTrend:vu,getErrorDistribution:wu,getOpenAITokenStats:bu,getConcurrencyStats:cu,getUserConcurrencyStats:uu,getAccountAvailabilityStats:lu,getRealtimeTrafficSummary:du,subscribeQPS:fu,listErrorLogs:Au,getErrorLogDetail:ku,updateErrorResolved:Su,listRequestErrors:Pu,listUpstreamErrors:Iu,getRequestErrorDetail:Eu,getUpstreamErrorDetail:$u,updateRequestErrorResolved:Cu,updateUpstreamErrorResolved:Mu,listRequestErrorUpstreamErrors:Tu,listRequestDetails:Ru,listAlertRules:xu,createAlertRule:Lu,updateAlertRule:Ou,deleteAlertRule:Du,listAlertEvents:qu,getAlertEvent:Uu,updateAlertEventStatus:zu,createAlertSilence:Ku,getEmailNotificationConfig:Nu,updateEmailNotificationConfig:Vu,getAlertRuntimeSettings:Bu,updateAlertRuntimeSettings:Hu,getRuntimeLogC
2onfig:Fu,updateRuntimeLogConfig:Wu,resetRuntimeLogConfig:ju,getAdvancedSettings:Yu,updateAdvancedSettings:Zu,getMetricThresholds:Xu,updateMetricThresholds:el,listSystemLogs:Gu,cleanupSystemLogs:Qu,getSystemLogSinkHealth:Ju};async function al(){const{data:e}=await n.get("/admin/error-passthrough-rules");return e}async function nl(e){const{data:t}=await n.get(`/admin/error-passthrough-rules/${e}`);return t}async function rl(e){const{data:t}=await n.post("/admin/error-passthrough-rules",e);return t}async function aa(e,t){const{data:a}=await n.put(`/admin/error-passthrough-rules/${e}`,t);return a}async function ol(e){const{data:t}=await n.delete(`/admin/error-passthrough-rules/${e}`);return t}async function sl(e,t){return aa(e,{enabled:t})}const il={list:al,getById:nl,create:rl,update:aa,delete:ol,toggleEnabled:sl};async function cl(){const{data:e}=await n.get("/admin/data-management/agent/health");return e}async function ul(){const{data:e}=await n.get("/admin/data-management/config");return e}async function ll(e){const{data:t}=await n.put("/admin/data-management/config",e);return t}async function dl(e){const{data:t}=await n.post("/admin/data-management/s3/test",e);return t}async function ml(e){const{data:t}=await n.get(`/admin/data-management/sources/${e}/profiles`);return t}async function pl(e,t){const{data:a}=await n.post(`/admin/data-management/sources/${e}/profiles`,t);return a}async function fl(e,t,a){const{data:r}=await n.put(`/admin/data-management/sources/${e}/profiles/${t}`,a);return r}async function gl(e,t){await n.delete(`/admin/data-management/sources/${e}/profiles/${t}`)}async function hl(e,t){const{data:a}=await n.post(`/admin/data-management/sources/${e}/profiles/${t}/activate`);return a}async function yl(){const{data:e}=await n.get("/admin/data-management/s3/profiles");return e}async function _l(e){const{data:t}=await n.post("/admin/data-management/s3/profiles",e);return t}async function vl(e,t){const{data:a}=await n.put(`/admin/data-management/s3/profiles/${e}`,t);return a}async function wl(e){await n.delete(`/admin/data-management/s3/profiles/${e}`)}async function bl(e){const{data:t}=await n.post(`/admin/data-management/s3/profiles/${e}/activate`);return t}async function Al(e){const t=e.idempotency_key?{"X-Idempotency-Key":e.idempotency_key}:void 0,{data:a}=await n.post("/admin/data-management/backups",e,{headers:t});return a}async function kl(e){const{data:t}=await n.get("/admin/data-management/backups",{params:e});return t}async function Sl(e){const{data:t}=await n.get(`/admin/data-management/backups/${e}`);return t}const Pl={getAgentHealth:cl,getConfig:ul,updateConfig:ll,listSourceProfiles:ml,createSourceProfile:pl,updateSourceProfile:fl,deleteSourceProfile:gl,setActiveSourceProfile:hl,testS3:dl,listS3Profiles:yl,createS3Profile:_l,updateS3Profile:vl,deleteS3Profile:wl,setActiveS3Profile:bl,createBackupJob:Al,listBackupJobs:kl,getBackupJob:Sl};async function Il(e,t){const{data:a}=await n.put(`/admin/api-keys/${e}`,{group_id:t===null?0:t});return a}const El={updateApiKeyGroup:Il};async function $l(e){const{data:t}=await n.get(`/admin/accounts/${e}/scheduled-test-plans`);return t??[]}async function Cl(e){const{data:t}=await n.post("/admin/scheduled-test-plans",e);return t}async function Ml(e,t){const{data:a}=await n.put(`/admin/scheduled-test-plans/${e}`,t);return a}async function Tl(e){await n.delete(`/admin/scheduled-test-plans/${e}`)}async function Rl(e,t){const{data:a}=await n.get(`/admin/scheduled-test-plans/${e}/results`,{params:t?{limit:t}:void 0});return a??[]}const xl={listByAccount:$l,create:Cl,update:Ml,delete:Tl,listResults:Rl};async function Ll(){const{data:e}=await n.get("/admin/backups/s3-config");return e}async function Ol(e){const{data:t}=await n.put("/admin/backups/s3-config",e);return t}async function Dl(e){const{data:t}=await n.post("/admin/backups/s3-config/test",e);return t}async function ql(){const{data:e}=await n.get("/admin/backups/image-storage");return e}async function Ul(e){const{data:t}=await n.put("/admin/backups/image-storage",e);return t}async function zl(e){const{data:t}=await n.post("/admin/backups/image-storage/test",e);return t}async function Kl(){const{data:e}=await n.get("/admin/backups/schedule");return e}async function Nl(e){const{data:t}=await n.put("/admin/backups/schedule",e);return t}async function Vl(e){const{data:t}=await n.post("/admin/backups",e||{});return t}async function Bl(){const{data:e}=await n.get("/admin/backups");return e}async function Hl(e){const{data:t}=await n.get(`/admin/backups/${e}`);return t}async function Fl(e){await n.delete(`/admin/backups/${e}`)}async function Wl(e){const{data:t}=await n.get(`/admin/backups/${e}/download-url`);return t}async function jl(e,t){const{data:a}=await n.post(`/admin/backups/${e}/restore`,{password:t});return a}const Gl={getS3Config:Ll,updateS3Config:Ol,testS3Connection:Dl,getImageStorageConfig:ql,updateImageStorageConfig:Ul,testImageStorageConnection:zl,getSchedule:Kl,updateSchedule:Nl,createBackup:Vl,listBackups:Bl,getBackup:Hl,deleteBackup:Fl,getDownloadURL:Wl,restoreBackup:jl};async function Ql(){const{data:e}=await n.get("/admin/tls-fingerprint-profiles");return e}async function Jl(e){const{data:t}=await n.get(`/admin/tls-fingerprint-profiles/${e}`);return t}async function Yl(e){const{data:t}=await n.post("/admin/tls-fingerprint-profiles",e);return t}async function Zl(e,t){const{data:a}=await n.put(`/admin/tls-fingerprint-profiles/${e}`,t);return a}
2async function Xl(e){const{data:t}=await n.delete(`/admin/tls-fingerprint-profiles/${e}`);return t}const ed={list:Ql,getById:Jl,create:Yl,update:Zl,delete:Xl};async function td(e=1,t=20,a,r){const{data:o}=await n.get("/admin/channels",{params:{page:e,page_size:t,...a},signal:r==null?void 0:r.signal});return o}async function ad(e){const{data:t}=await n.get(`/admin/channels/${e}`);return t}async function nd(e){const{data:t}=await n.post("/admin/channels",e);return t}async function rd(e,t){const{data:a}=await n.put(`/admin/channels/${e}`,t);return a}async function od(e){await n.delete(`/admin/channels/${e}`)}async function sd(e){const{data:t}=await n.get("/admin/channels/model-pricing",{params:{model:e}});return t}async function id(e){const{data:t}=await n.get("/admin/channels/pricing/sync-models",{params:{platform:e}});return t}const cd={list:td,getById:ad,create:nd,update:rd,remove:od,getModelDefaultPricing:sd,syncPricingModels:id};async function ud(e={},t){const{data:a}=await n.get("/admin/channel-monitors",{params:e,signal:t==null?void 0:t.signal});return a}async function ld(e){const{data:t}=await n.get(`/admin/channel-monitors/${e}`);return t}async function dd(e){const{data:t}=await n.post("/admin/channel-monitors",e);return t}const qe=new Map;function md(){var e;try{const t=(e=globalThis.localStorage)==null?void 0:e.getItem("auth_user");if(!t)return null;const a=JSON.parse(t);if(typeof a!="object"||a===null)return null;const r=a.id;return typeof r!="number"||!Number.isSafeInteger(r)||r<=0?null:String(r)}catch{return null}}function pd(e){const t=md();return t?{adminID:t,key:`sub2api:admin:channel-monitor-duplicate:${t}:${e}`}:null}function fd(e){var t;try{return((t=globalThis.sessionStorage)==null?void 0:t.getItem(e))??null}catch{return null}}function ft(e,t){var a,r;try{t?(a=globalThis.sessionStorage)==null||a.setItem(e,t):(r=globalThis.sessionStorage)==null||r.removeItem(e)}catch{}}async function gd(e){var o,s;const t=pd(e);let a=t?qe.get(t.key)??fd(t.key):null;if(!a){const i=((s=(o=globalThis.crypto)==null?void 0:o.randomUUID)==null?void 0:s.call(o))??`${Date.now()}-${Math.random().toString(36).slice(2)}`;a=`channel-monitor-duplicate-${(t==null?void 0:t.adminID)??"unknown-admin"}-${e}-${i}`}t&&(qe.set(t.key,a),ft(t.key,a));const{data:r}=await n.post(`/admin/channel-monitors/${e}/duplicate`,void 0,{headers:{"Idempotency-Key":a}});return t&&(qe.delete(t.key),ft(t.key,null)),r}async function hd(e,t){const{data:a}=await n.put(`/admin/channel-monitors/${e}`,t);return a}async function yd(e){await n.delete(`/admin/channel-monitors/${e}`)}async function _d(e){const{data:t}=await n.post(`/admin/channel-monitors/${e}/run`);return t}async function vd(e,t={}){const{data:a}=await n.get(`/admin/channel-monitors/${e}/history`,{params:t});return a}const wd={list:ud,get:ld,create:dd,duplicate:gd,update:hd,del:yd,runNow:_d,listHistory:vd};async function bd(e={}){const{data:t}=await n.get("/admin/channel-monitor-templates",{params:e});return t}async function Ad(e){const{data:t}=await n.get(`/admin/channel-monitor-templates/${e}`);return t}async function kd(e){const{data:t}=await n.post("/admin/channel-monitor-templates",e);return t}async function Sd(e,t){const{data:a}=await n.put(`/admin/channel-monitor-templates/${e}`,t);return a}async function Pd(e){await n.delete(`/admin/channel-monitor-templates/${e}`)}async function Id(e,t){const{data:a}=await n.post(`/admin/channel-monitor-templates/${e}/apply`,{monitor_ids:t});return a}async function Ed(e){const{data:t}=await n.get(`/admin/channel-monitor-templates/${e}/monitors`);return t}const $d={list:bd,get:Ad,create:kd,update:Sd,del:Pd,apply:Id,listAssociatedMonitors:Ed},Cd={getConfig(){return n.get("/admin/payment/config")},updateConfig(e){return n.put("/admin/payment/config",e)},getDashboard(e){return n.get("/admin/payment/dashboard",{params:e?{days:e}:void 0})},getOrders(e){return n.get("/admin/payment/orders",{params:e})},getOrder(e){return n.get(`/admin/payment/orders/${e}`)},cancelOrder(e){return n.post(`/admin/payment/orders/${e}/cancel`)},retryRecharge(e){return n.post(`/admin/payment/orders/${e}
2/retry`)},refundOrder(e,t){return n.post(`/admin/payment/orders/${e}/refund`,t)},queryRefund(e){return n.post(`/admin/payment/orders/${e}/refund/query`)},getChannels(){return n.get("/admin/payment/channels")},createChannel(e){return n.post("/admin/payment/channels",e)},updateChannel(e,t){return n.put(`/admin/payment/channels/${e}`,t)},deleteChannel(e){return n.delete(`/admin/payment/channels/${e}`)},getPlans(){return n.get("/admin/payment/plans")},createPlan(e){return n.post("/admin/payment/plans",e)},updatePlan(e,t){return n.put(`/admin/payment/plans/${e}`,t)},deletePlan(e){return n.delete(`/admin/payment/plans/${e}`)},getProviders(){return n.get("/admin/payment/providers")},createProvider(e){return n.post("/admin/payment/providers",e)},updateProvider(e,t){return n.put(`/admin/payment/providers/${e}`,t)},deleteProvider(e){return n.delete(`/admin/payment/providers/${e}`)}};async function Md(e={}){const{data:t}=await n.get("/admin/affiliates/users",{params:{page:e.page??1,page_size:e.page_size??20,search:e.search??""}});return t}async function Td(e){const{data:t}=await n.get("/admin/affiliates/users/lookup",{params:{q:e}});return t}async function Rd(e,t){const{data:a}=await n.put(`/admin/affiliates/users/${e}`,t);return a}async function xd(e){const{data:t}=await n.delete(`/admin/affiliates/users/${e}`);return t}async function Ld(e){const{data:t}=await n.post("/admin/affiliates/users/batch-rate",e);return t}function at(e={}){return{page:e.page??1,page_size:e.page_size??20,search:e.search??"",start_at:e.start_at||void 0,end_at:e.end_at||void 0,sort_by:e.sort_by||void 0,sort_order:e.sort_order||void 0,timezone:e.timezone||void 0}}async function Od(e={}){const{data:t}=await n.get("/admin/affiliates/invites",{params:at(e)});return t}async function Dd(e={}){const{data:t}=await n.get("/admin/affiliates/rebates",{params:at(e)});return t}async function qd(e={}){const{data:t}=await n.get("/admin/affiliates/transfers",{params:at(e)});return t}async function Ud(e){const{data:t}=await n.get(`/admin/affiliates/users/${e}/overview`);return t}const zd={listUsers:Md,lookupUsers:Td,updateUserSettings:Rd,clearUserSettings:xd,batchSetRate:Ld,listInviteRecords:Od,listRebateRecords:Dd,listTransferRecords:qd,getUserOverview:Ud};async function Kd(){const{data:e}=await n.get("/admin/risk-control/config");return e}async function Nd(e){const{data:t}=await n.put("/admin/risk-control/config",e);return t}async function Vd(){const{data:e}=await n.get("/admin/risk-control/status");return e}async function Bd(e={}){const{data:t}=await n.post("/admin/risk-control/api-keys/test",e);return t}async function Hd(e={}){const{data:t}=await n.get("/admin/risk-control/logs",{params:e});return t}async function Fd(e){const{data:t}=await n.post(`/admin/risk-control/users/${e}/unban`);return t}async function Wd(e){const{data:t}=await n.delete("/admin/risk-control/hashes",{data:{input_hash:e}});return t}async function jd(){const{data:e}=await n.delete("/admin/risk-control/hashes/all");return e}const Gd={getConfig:Kd,updateConfig:Nd,getStatus:Vd,testAPIKeys:Bd,listLogs:Hd,unbanUser:Fd,deleteFlaggedHash:Wd,clearFlaggedHashes:jd},Ve={async getStatus(){const{data:e}=await n.get("/admin/compliance");return e},async accept(e){const{data:t}=await n.post("/admin/compliance/accept",e);return t}};async function Qd(e){const{data:t}=await n.get("/admin/audit-logs",{params:e});return t}async function Jd(e){const{data:t}=await n.get(`/admin/audit-logs/${e}`);return t}async function Yd(e){const{data:t}=await n.post("/admin/audit-logs/clear",{totp_code:e});return t}const Zd={list:Qd,get:Jd,clear:Yd};async function Xd(){const{data:e}=await n.get("/admin/plugins");return e}async function em(e){const t=new FormData;t.append("plugin",e);const{data:a}=await n.post("/admin/plugins/upload",t,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4});return a}async function tm(e,t,a){const{data:r}=await n.post(`/admin/plugins/${e}/enable`,{rollout_percent:t,accept_untested:a});return r}async function am(e){const{data:t}=await n.post(`/admin/plugins/${e}/disable`);return t}async function nm(e){await n.delete(`/admin/plugins/${e}`)}async function rm(e){const{data:t}=await n.get(`/admin/plugins/${e}/config`);return t}async function om(e,t){const{data:a}=await n.put(`/admin/plugins/${e}/config`,t);return a}
2async function sm(e){const{data:t}=await n.post(`/admin/plugins/${e}/test`);return t}async function im(e){const{data:t}=await n.post(`/admin/plugins/${e}/ui-session`);return t}const cm={list:Xd,upload:em,enable:tm,disable:am,remove:nm,getConfig:rm,saveConfig:om,test:sm,createUISession:im},gt={dashboard:qr,users:eo,groups:To,accounts:zs,proxies:ti,redeem:di,promo:_i,announcements:Pi,settings:sc,system:mn,subscriptions:_c,usage:Ic,gemini:Mc,antigravity:Lc,grok:Gc,cnProviders:Yc,userAttributes:iu,ops:tl,errorPassthrough:il,dataManagement:Pl,apiKeys:El,scheduledTests:xl,backup:Gl,tlsFingerprintProfiles:ed,channels:cd,channelMonitor:wd,channelMonitorTemplate:$d,payment:Cd,affiliates:zd,riskControl:Gd,compliance:Ve,audit:Zd,plugins:cm},he="auth_token",ye="auth_user",_e="refresh_token",ve="token_expires_at",le="pending_auth_session",um=60*1e3,lm=120*1e3;function dm(e){return e==="pending_oauth_token"?"pending_oauth_token":"pending_auth_token"}function ht(){const e=localStorage.getItem(le);if(!e)return null;try{const t=JSON.parse(e),a=typeof(t==null?void 0:t.provider)=="string"?t.provider.trim():"";return a?{token:typeof(t==null?void 0:t.token)=="string"?t.token:"",token_field:dm(t==null?void 0:t.token_field),provider:a,redirect:typeof(t==null?void 0:t.redirect)=="string"?t.redirect:void 0,adoption_required:typeof(t==null?void 0:t.adoption_required)=="boolean"?t.adoption_required:void 0,suggested_display_name:typeof(t==null?void 0:t.suggested_display_name)=="string"?t.suggested_display_name:void 0,suggested_avatar_url:typeof(t==null?void 0:t.suggested_avatar_url)=="string"?t.suggested_avatar_url:void 0}:(localStorage.removeItem(le),null)}catch{return localStorage.removeItem(le),null}}function mm(e){localStorage.setItem(le,JSON.stringify(e))}function yt(){localStorage.removeItem(le)}const Me=re("auth",()=>{const e=w(null),t=w(null),a=w(null),r=w(null),o=w("standard"),s=w(null);let i=null,c=null;const u=I(()=>!!t.value&&!!e.value),m=I(()=>{var v;return((v=e.value)==null?void 0:v.role)==="admin"}),l=I(()=>o.value==="simple"),y=I(()=>s.value!==null);function p(){const v=localStorage.getItem(he),S=localStorage.getItem(ye),x=localStorage.getItem(_e),Q=localStorage.getItem(ve);if(s.value=ht(),v&&S)try{t.value=v,e.value=JSON.parse(S),a.value=x,r.value=Q?parseInt(Q,10):null,q().catch(se=>{console.error("Failed to refresh user on init:",se)}),d(),x&&r.value!==null&&g(r.value)}catch(se){console.error("Failed to parse saved user data:",se),N({preservePendingAuthSession:!0})}}function d(){f(),i=setInterval(()=>{t.value&&q().catch(v=>{console.error("Auto-refresh user failed:",v)})},um)}function f(){i&&(clearInterval(i),i=null)}function g(v){c&&(clearTimeout(c),c=null);const S=Date.now(),x=Math.max(0,v-S-lm);if(x<=0){P();return}c=setTimeout(()=>{P()},x)}function A(v){const S=Date.now()+v*1e3;r.value=S,localStorage.setItem(ve,String(S)),g(S)}async function P(){if(a.value)try{const v=await ae.refreshToken();t.value=v.access_token,a.value=v.refresh_token,A(v.expires_in)}catch(v){console.error("Token refresh failed:",v)}}function b(){c&&(clearTimeout(c),c=null)}async function M(v){try{const S=await ae.login(v);return Ze(S)||G(S),S}catch(S){throw N({preservePendingAuthSession:s.value!==null}),S}}async function E(v,S){try{const x=await ae.login2FA({temp_token:v,totp_code:S});return G(x),e.value}catch(x){throw N({preservePendingAuthSession:s.value!==null}),x}}async function K(v){try{const S=await kr.login(v);return G(S),e.value}catch(S){throw N({preservePendingAuthSession:s.value!==null}),S}}function G(v){t.value=v.access_token,v.refresh_token&&(a.value=v.refresh_token,localStorage.setItem(_e,v.refresh_token)),v.user.run_mode&&(o.value=v.user.run_mode);const{run_mode:S,...x}=v.user;e.value=x,localStorage.setItem(he,v.access_token),localStorage.setItem(ye,JSON.stringify(x)),W(),d(),v.refresh_token&&v.expires_in&&A(v.expires_in)}async function H(v){try{const S=await ae.register(v);return G(S),e.value}catch(S){throw N({preservePendingAuthSession:s.value!==null}),S}}async function F(v){f(),b(),t.value=null,e.value=null,t.value=v,localStorage.setItem(he,v);const S=localStorage.getItem(_e),x=localStorage.getItem(ve);S&&(a.value=S),x&&(r.value=parseInt(x,10));try{const Q=await q();return d(),S&&r.value!==null&&g(r.value),W(),Q}catch(Q){throw N({preservePendingAuthSession:s.value!==null}),Q}}function U(v){if(s.value=v,v){mm(v);return}yt()}function W(){U(null)}async function O(){try{await ae.logout()}catch(v){console.warn("Logout API call failed, clearing local session anyway",v)}finally{N()}}async function q(){if(!t.value)throw new Error("Not authenticated");try{const v=await ae.getCurrentUser();v.data.run_mode&&(o.value=v.data.run_mode);const{run_mode:S,...x}=v.data;return e.value=x,localStorage.setItem(ye,JSON.stringify(x)),x}catch(v){throw v.status===401&&N({preservePendingAuthSession:s.value!==null}),v}}function N(v){if(f(),b(),t.value=null,a.value=null,r.value=null,e.value=null,localStorage.removeItem(he),localStorage.removeItem(ye),localStorage.removeItem(_e),localStorage.removeItem(ve),v!=null&&v.preservePendingAuthSession){s.value=ht();return}s.value=null,yt()}
2return{user:e,token:t,runMode:we(o),pendingAuthSession:we(s),isAuthenticated:u,isAdmin:m,isSimpleMode:l,hasPendingAuthSession:y,login:M,loginWithPasskey:K,login2FA:E,register:H,setToken:F,logout:O,checkAuth:p,refreshUser:q,setPendingAuthSession:U,clearPendingAuthSession:W}}),pm=Object.freeze(Object.defineProperty({__proto__:null,useAuthStore:Me},Symbol.toStringTag,{value:"Module"})),nt=re("adminSettings",()=>{const e=w(!1),t=w(!1),a=(b,M)=>{try{const E=localStorage.getItem(b);if(E==="true")return!0;if(E==="false")return!1}catch{}return M},r=(b,M)=>{try{localStorage.setItem(b,M?"true":"false")}catch{}},o=(b,M)=>{try{const E=localStorage.getItem(b);if(typeof E=="string"&&E.length>0)return E}catch{}return M},s=(b,M)=>{try{localStorage.setItem(b,M)}catch{}},i=w(a("ops_monitoring_enabled_cached",!0)),c=w(a("ops_realtime_monitoring_enabled_cached",!0)),u=w(o("ops_query_mode_default_cached","auto")),m=w(a("payment_enabled_cached",!1)),l=w([]);async function y(b=!1){var M;if(!(e.value&&!b)&&!t.value){t.value=!0;try{const[E,K]=await Promise.all([gt.settings.getSettings(),gt.payment.getConfig()]);i.value=E.ops_monitoring_enabled??!0,r("ops_monitoring_enabled_cached",i.value),
2c.value=E.ops_realtime_monitoring_enabled??!0,r("ops_realtime_monitoring_enabled_cached",c.value),u.value=E.ops_query_mode_default||"auto",s("ops_query_mode_default_cached",u.value),l.value=Array.isArray(E.custom_menu_items)?E.custom_menu_items:[],m.value=((M=K.data)==null?void 0:M.enabled)??!1,r("payment_enabled_cached",m.value),e.value=!0}catch(E){e.value=!0,console.error("[adminSettings] Failed to fetch settings:",E)}finally{t.value=!1}}}function p(b){i.value=b,r("ops_monitoring_enabled_cached",b),e.value=!0}function d(b){c.value=b,r("ops_realtime_monitoring_enabled_cached",b),e.value=!0}function f(b){m.value=b,r("payment_enabled_cached",b),e.value=!0}function g(b){u.value=b||"auto",s("ops_query_mode_default_cached",u.value),e.value=!0}let A=null;function P(){if(!A)try{const b=()=>{p(!1)};window.addEventListener("ops-monitoring-disabled",b),A=()=>{window.removeEventListener("ops-monitoring-disabled",b)}}catch{}}return typeof window<"u"&&P(),{loaded:e,loading:t,opsMonitoringEnabled:i,opsRealtimeMonitoringEnabled:c,opsQueryModeDefault:u,paymentEnabled:m,customMenuItems:l,fetch:y,setOpsMonitoringEnabledLocal:p,setOpsRealtimeMonitoringEnabledLocal:d,setPaymentEnabledLocal:f,setOpsQueryModeDefaultLocal:g}}),fm=Object.freeze(Object.defineProperty({__proto__:null,useAdminSettingsStore:nt},Symbol.toStringTag,{value:"Module"}));async function gm(){return(await n.get("/subscriptions")).data}async function hm(){return(await n.get("/subscriptions/active")).data}async function ym(){return(await n.get("/subscriptions/progress")).data}async function _m(){return(await n.get("/subscriptions/summary")).data}async function vm(e){return(await n.get(`/subscriptions/${e}/progress`)).data}const wm={getMySubscriptions:gm,getActiveSubscriptions:hm,getSubscriptionsProgress:ym,getSubscriptionSummary:_m,getSubscriptionProgress:vm},bm=6e4;let Ue=0;const Am=re("subscriptions",()=>{const e=w([]),t=w(!1),a=w(!1),r=w(null);let o=null,s=null;const i=I(()=>e.value.length>0);async function c(p=!1){const d=Date.now();if(!p&&a.value&&r.value&&d-r.value<bm)return e.value;if(o&&!p)return o;const f=++Ue;t.value=!0;const g=wm.getActiveSubscriptions().then(A=>(f===Ue&&(e.value=A,a.value=!0,r.value=Date.now()),A)).catch(A=>{throw console.error("Failed to fetch active subscriptions:",A),A}).finally(()=>{o===g&&(t.value=!1,o=null)});return o=g,o}function u(){s||(s=setInterval(()=>{c(!0).catch(p=>{console.error("Subscription polling failed:",p)})},5*60*1e3))}function m(){s&&(clearInterval(s),s=null)}function l(){Ue++,o=null,e.value=[],a.value=!1,r.value=null,m()}function y(){r.value=null}return{activeSubscriptions:e,loading:t,hasActiveSubscriptions:i,fetchActiveSubscriptions:c,startPolling:u,stopPolling:m,clear:l,invalidateCache:y}}),km=20*60*1e3,na=re("announcements",()=>{const e=w([]),t=w(!1),a=w(0),r=w([]),o=w(null);let s=new Set;const i=I(()=>e.value.filter(f=>!f.read_at).length);async function c(f=!1){const g=Date.now();if(!(!f&&a.value>0&&g-a.value<km)){a.value=g;try{t.value=!0;const A=await Le.list(!1);e.value=A.slice(0,20),u()}catch(A){a.value=0,console.error("Failed to fetch announcements:",A)}finally{t.value=!1}}}function u(){const f=e.value.filter(g=>g.notify_mode==="popup"&&!g.read_at&&!s.has(g.id));if(f.length!==0){for(const g of f)r.value.some(A=>A.id===g.id)||r.value.push(g);o.value||m()}}function m(){if(r.value.length===0){o.value=null;return}o.value=r.value.shift(),s.add(o.value.id)}async function l(){if(!o.value)return;const f=o.value.id;o.value=null,y(f),r.value.length>0&&setTimeout(()=>m(),300)}async function y(f){try{await Le.markRead(f);const g=e.value.find(A=>A.id===f);g&&(g.read_at=new Date().toISOString())}catch(g){console.error("Failed to mark announcement as read:",g)}}async function p(){const f=e.value.filter(g=>!g.read_at);if(f.length!==0)try{t.value=!0,await Promise.all(f.map(g=>Le.markRead(g.id))),e.value.forEach(g=>{g.read_at||(g.read_at=new Date().toISOString())})}catch(g){throw console.error("Failed to mark all as read:",g),g}finally{t.value=!1}}function d(){e.value=[],a.value=0,s=new Set,r.value=[],o.value=null,t.value=!1}return{announcements:e,loading:t,currentPopup:o,unreadCount:i,fetchAnnouncements:c,dismissPopup:l,markAsRead:y,markAllAsRead:p,reset:d}}),_t="æå·²é
读ãçè§£å¹¶åæ Sub2API é¨ç½²ä¸è¿è¥åè§æ¿è¯º",vt="I have read, understood, and agree to the Sub2API Deployment and Operation Compliance Commitment",rt=re("adminCompl
2iance",()=>{const e=w(null),t=w(!1),a=w(!1),r=w(!1),o=w(!1),s=I(()=>{var d;return((d=e.value)==null?void 0:d.required)===!0}),i=I(()=>s.value||o.value),c=I(()=>Y()),u=I(()=>{var d,f;return c.value==="zh"?((d=e.value)==null?void 0:d.ack_phrase_zh)||_t:((f=e.value)==null?void 0:f.ack_phrase_en)||vt});async function m(){t.value=!0;try{const d=await Ve.getStatus();return e.value=d,r.value=!0,o.value=d.required,d}finally{t.value=!1}}async function l(d){a.value=!0;try{const f=await Ve.accept({phrase:d,language:c.value});return e.value=f,o.value=f.required,f}finally{a.value=!1}}function y(d){var f,g,A,P,b,M,E,K;e.value={required:!0,version:(d==null?void 0:d.version)||((f=e.value)==null?void 0:f.version)||"v2026.06.10",document_path_zh:(d==null?void 0:d.document_path_zh)||((g=e.value)==null?void 0:g.document_path_zh)||"docs/legal/admin-compliance.zh.md",document_path_en:(d==null?void 0:d.document_path_en)||((A=e.value)==null?void 0:A.document_path_en)||"docs/legal/admin-compliance.en.md",document_url_zh:(d==null?void 0:d.document_url_zh)||((P=e.value)==null?void 0:P.document_url_zh)||"https://github.com/Wei-Shaw/sub2api/blob/main/docs/legal/admin-compliance.zh.md",document_url_en:(d==null?void 0:d.document_url_en)||((b=e.value)==null?void 0:b.document_url_en)||"https://github.com/Wei-Shaw/sub2api/blob/main/docs/legal/admin-compliance.en.md",ack_phrase_zh:(d==null?void 0:d.ack_phrase_zh)||((M=e.value)==null?void 0:M.ack_phrase_zh)||_t,ack_phrase_en:(d==null?void 0:d.ack_phrase_en)||((E=e.value)==null?void 0:E.ack_phrase_en)||vt,acknowledgement:(K=e.value)==null?void 0:K.acknowledgement},r.value=!0,o.value=!0}function p(){e.value=null,t.value=!1,a.value=!1,r.value=!1,o.value=!1}return{status:e,loading:t,submitting:a,initialized:r,required:s,shouldShow:i,expectedPhrase:u,fetchStatus:m,accept:l,requireAcknowledgement:y,reset:p}}),Sm=`# Sub2API é¨ç½²ä¸è¿è¥åè§æ¿è¯º 3 4çæ¬ï¼v2026.06.10 5 6æ¬æä»¶éç¨äºé¨ç½²ãé ç½®ã管çãè¿è¥æå®é æ§å¶ Sub2API å®ä¾ç个人ãç»ç»åå ¶ææä»£è¡¨ãç»§ç»è®¿é®æä½¿ç¨æ§å¶å°åè½åï¼ç¡®è®¤ä¸»ä½åºå®æ´é 读ãç解并æ¥åæ¬æä»¶ã 7 8## ä¸ãéç¨èå´ 9 10Sub2API æ¯å¼æºè½¯ä»¶ãä»»ä½åºäº Sub2API è¿è¡çèªé¨ç½²ãäºæ¬¡å¼åãæç®¡è¿è¡ã坹夿å¡ãåä¸å使ç¨ãç¨æ·ç®¡çãå 容å¤çãæ°æ®å¤çãæ¯ä»ç»ç®ãå®¢æ·æ¯æå䏿¸¸è´¦å·ææ¥å£ä½¿ç¨è¡ä¸ºï¼åç±ç¸åºå®ä¾çé¨ç½²ãè¿è¥ææ§å¶ä¸»ä½èªè¡è´è´£ã 11 12æ¬æä»¶ä¸æ¿ä»£å¼æºè®¸å¯è¯ã䏿¸¸æå¡æ¡æ¬¾ãç¨æ·åè®®ãéç§æ¿çãæ°æ®å¤çåè®®ãåä¸ååãçç®¡å¤æ¡ãè¡æ¿è®¸å¯ãå®å ¨è¯ä¼°æå ¶ä»ä¾æ³åºå½å ·å¤çæä»¶ãæç»æä¹å¡ã 13 14## äºã主ä½è´£ä»» 15 16确认主ä½åºèªè¡è¯ä¼°å¹¶æç»éµå®å ¶æå¨å°ãæå¡å¨æå¨å°ãç®æ ç¨æ·æå¨å°ãä¸å¡å®é å¼å±å°ä»¥å䏿¸¸æå¡æä¾æ¹æå¨å°å¯è½éç¨çæ³å¾æ³è§ãçç®¡è¦æ±ãè¡ä¸è§èãåå约å®åå¹³å°è§åã 17 18确认主ä½åºç¡®ä¿å ¶å·²å ·å¤é¨ç½²åè¿è¥ç¸å ³å®ä¾æéçææãèµè´¨ã夿¡ã许å¯ãè¯ä¼°ãååã飿§è½åãå 容å®å ¨è½åãæ°æ®ä¿æ¤è½åãæè¯å¤çæºå¶ååºæ¥å¤ç½®è½åãç¸å ³ä¹å¡ä¸å¾å 使ç¨å¼æºè½¯ä»¶è转移ãå 餿éä½ã 19 20## ä¸ãéå ³èå ³ç³»ä¸è´£ä»»é离 21 22ä»»ä½ç¬¬ä¸æ¹å®ä¾ãå䏿å¡ãæ¶è´¹å¥é¤ãç¨æ·ææ½ãå 容å¤çãæ°æ®å¤çãè´¦å·ä½¿ç¨ãæ¥å£è°ç¨ãæ¯ä»ç»ç®ãå®¢æ·æ¯æææ¨å¹¿æ´»å¨ï¼åç±ç¸åºé¨ç½²ãè¿è¥ææ§å¶ä¸»ä½ç¬ç«å®æ½ï¼å¹¶ä¸å æ¬é¡¹ç®å¼æºã代ç è´¡ç®ãè®®é¢è®¨è®ºãææ¡£ç»´æ¤ãçæ¬åå¸ã缺é·ä¿®å¤ã社åºäº¤æµæä¸è¬æ§ææ¯è¯´æèå½¢æå¼æºé¡¹ç®ãèä½æäººãè´¡ç®è æç»´æ¤è å¯¹è¯¥çæ´»å¨çåä¸ãææã认å¯ãæ ä¿ãå ±åç»è¥ã代çãåä¼ãéä½£ãææè¿è¥ãå ±åæ§å¶ãæ¶çåé ãå ±åä¾µææå ¶ä»è¿å¸¦è´£ä»»å ³ç³»ã 23 24确认主ä½ä¸å¾ä»¥é¡¹ç®åç§°ãæ è¯ãææ¡£ãæªå¾ã社åºå 容æå¼æºä»åºä¿¡æ¯æç¤ºææç¤ºå ¶ç¬¬ä¸æ¹å®ä¾ãå䏿å¡ãæ¶è´¹å¥é¤æè¿è¥æ´»å¨è·å¾å¼æºé¡¹ç®ãèä½æäººãè´¡ç®è ãç»´æ¤è æç¤¾åºçåä¸ãææã认å¯ãæ ä¿æè书ã 25 26确认主ä½åºç¬ç«æ¿æ å å ¶é¨ç½²ãé ç½®ãè¿è¥ãæ¨å¹¿ãæ¶è´¹ãç¨æ·è¡ä¸ºç®¡çãå 容å¤çãæ°æ®å¤çãè´¦å·ä½¿ç¨ãæ¥å£è°ç¨åè¿åæ³å¾æ³è§ãçç®¡è¦æ±ãååçº¦å®æä¸æ¸¸è§åæäº§ççç¸å ³åæã 27 28便³ä¸å¾ç±åè®®æé¤æéå¶çå¼ºå¶æ§è´£ä»»ï¼ä¾ç¸å ³æ³å¾è§å®å¤çï¼è¯¥çæ³å®ä¾å¤ä¸ææå¯¹ä»»ä½ç¬¬ä¸æ¹é¨ç½²ãè¿è¥æå䏿´»å¨çåä¸ãææã认å¯ãæ ä¿æè书ã 29 30## åãåè§æ¿è¯º 31 32确认主ä½å¨ç»§ç»ä½¿ç¨æ§å¶å°åè½æ¶ï¼ä½åºä»¥ä¸æ¿è¯ºï¼ 33 341. å·²ç¬ç«å®¡é å¹¶å°æç»éµå® OpenAIãAnthropicãGoogle åå ¶ä»ä¸æ¸¸æå¡æä¾æ¹çæå¡æ¡æ¬¾ã坿¥åä½¿ç¨æ¿çãæ¯æå½å®¶åå°åºãè´¦å·/API Key 使ç¨è§åãåä¸ä½¿ç¨è¦æ±ã转å®éå¶ã飿§è¦æ±åææ¯éå¶ã 352. ä¸å©ç¨æ¬é¡¹ç®è§é¿æåå©ä»äººè§é¿ä¸æ¸¸æå¡çå°åºéå¶ã访é®éå¶ãè´¦å·éå¶ã飿§éå¶ã计费éå¶ã身份éªè¯ã使ç¨éå¶ææå¡æ¡æ¬¾ã 363. ä¸å¨ç¼ºä¹å¿ è¦ææãèµè´¨ã夿¡ã许å¯ãè¯ä¼°æååå®æçæ åµä¸ï¼åå ¬ä¼æä¸ç¹å®å¯¹è±¡æä¾ API ä¸è½¬ã模åè°ç¨è½¬å®ãè´¦å·é¢åº¦ååãå ±äº«è®¢é ãä»è´¹è°ç¨ã代å ä»£ä»æå ¶ä»ç±»ä¼¼æå¡ã 374. å¦å¨ä¸å½å¤§éå¢å æé¢åä¸å½å¤§éå ¬ä¼æä¾çæå¼äººå·¥æºè½æå¡ãæ·±åº¦åææå¡ãç®æ³ç¸å ³æå¡ãAPI ä¸è½¬ãä»è´¹è°ç¨æå ¶ä»å¯è½åç管æå¡ï¼å°èªè¡å®æå¯è½éç¨çäºèç½ä¿¡æ¯æå¡ãçæå¼äººå·¥æºè½æå¡ã深度åæãç®æ³å¤æ¡ãå®å ¨è¯ä¼°ãç½ç»å®å ¨ãæ°æ®å®å ¨ã个人信æ¯ä¿æ¤ãå 容å®å ¨ãæ¯ä»ç»ç®ãç¨å¡å䏿¸¸ææçä¹å¡ã 385. 建ç«ä¸ä¸å¡è§æ¨¡åé£é©ç¸å¹é çç¨æ·ç®¡çãè®¿é®æ§å¶ãå å®¹å®¡æ ¸ãæ»¥ç¨å¤çãæ¥å¿çåãéç§ä¿æ¤ãæ°æ®å é¤ãæè¯å¤çãåºæ¥ä¸çº¿åå®å ¨äºä»¶ååºæºå¶ã 396. ä¸åä»»ä½ç¨æ·ã客æ·ãå使¹ãæ¸ éæ¹ãçç®¡æºææç¬¬ä¸æ¹ä½åºä¸æ¬æä»¶ç¬¬ä¸æ¡ç¸å²çªçéè¿°ãæ¿è¯ºãå®£ä¼ æä¿è¯ã 407. å¯¹å ¶é¨ç½²ãè¿è¥ãæ¨å¹¿ãæ¶è´¹ãç¨æ·è¡ä¸ºç®¡çãå 容å¤çãæ°æ®å¤çãè´¦å·ä½¿ç¨ãæ¥å£è°ç¨åè¿åæ³å¾æ³è§ãçç®¡è¦æ±ãååçº¦å®æä¸æ¸¸è§åæäº§ççåæç¬ç«æ¿æ 责任ã 41
42## äºãé£é©ä¸è´£ä»»æç¤º 43 44å° Sub2API ç¨äºå ¬å¼ API æå¡ãåä¸ä¸è½¬ãé¢åº¦ååãå¢éå ±äº«ãä»è´¹è°ç¨æç±»ä¼¼ç¨éï¼å¯è½æ¶åæå¡æ¡æ¬¾ãååè¿çº¦ãæ°æ®ä¿æ¤ãå 容å®å ¨ãæ¶è´¹è æçãæ¯ä»ç»ç®ãç¨å¡ãåºå£ç®¡å¶ãå¶è£åè§ãç½ç»å®å ¨ãè¡ä¸åå ¥åè¡æ¿ç管çé£é©ãä¸å叿³è¾åºåä¸å¡åºæ¯çè¦æ±å¯è½ä¸åï¼å¹¶å¯è½éæ¶é´ååã 45 46æ§å¶å°ä¸çå¼ºå¶æç¤ºãåè®®é¾æ¥ãéåè¾å ¥ç¡®è®¤åæ¬å°ç¡®è®¤è®°å½ï¼æ¨å¨ä»¥æ¸ æ°ãæ¾èãå¯çççæ¹å¼æç¤ºé¨ç½²ä¸è¿è¥é£é©ï¼ç¡®è®¤æ§å¶å°ä½¿ç¨è å·²é 读å½åçæ¬æä»¶ï¼å¹¶å¨å¼æºé¡¹ç®ãèä½æäººãè´¡ç®è ãç»´æ¤è ä¸ç¬¬ä¸æ¹é¨ç½²ãè¿è¥ææ§å¶ä¸»ä½ä¹é´å½¢ææç¡®ç责任é离记å½ã 47 48## å ãçµå确认 49 50确认主ä½éè¿ç»§ç»ä½¿ç¨æ§å¶å°ãæå¼åè®®é¾æ¥ãé è¯»æ¬æä»¶å¹¶æé¡µé¢è¦æ±éåè¾å ¥ç¡®è®¤çè¯ï¼å³è¡¨ç¤ºå ¶ä»¥çµåæ¹å¼ç¡®è®¤å·²é 读ãçè§£å¹¶åææ¬æä»¶ï¼å¹¶åæç³»ç»è®°å½ç¡®è®¤çæ¬ã确认æ¶é´ãæ§å¶å°è´¦æ·æ è¯ãIP å°åå User-Agent çå¿ è¦ççä¿¡æ¯ã 51`,Pm=`# Sub2API Deployment and Operation Compliance Commitment 52 53Version: v2026.06.10 54 55This document applies to any individual, organization, or authorized representative that deploys, configures, manages, operates, or effectively controls a Sub2API instance. Before continuing to access or use console functions, the acknowledging party must read, understand, and accept this document in full. 56 57## 1. Scope 58 59Sub2API is open-source software. Any self-hosted deployment, modification, hosted operation, external service, commercial use, user management, content processing, data processing, payment settlement, customer support, or upstream account/API usage based on Sub2API is the sole responsibility of the party that deploys, operates, or controls the relevant instance. 60 61This document does not replace the open-source license, upstream terms of service, user agreements, privacy policies, data processing agreements, commercial contracts, regulatory filings, administrative permits, security assessments, or any other documents, procedures, or obligations required by applicable law or contract. 62 63## 2. Responsibility of the Deploying or Operating Party 64 65The acknowledging party must independently assess and continuously comply with the laws, regulations, regulatory requirements, industry rules, contractual obligations, and platform policies that may apply in its location, server location, target-user location, place of actual business operation, and the locations of upstream service providers. 66 67The acknowledging party must ensure that it has all authorizations, qualifications, filings, permits, assessments, contracts, risk-control capabilities, content-safety capabilities, data-protection capabilities, complaint-handling mechanisms, and emergency-response capabilities required for deploying and operating the relevant instance. Such obligations are not transferred, waived, or reduced by the use of open-source software. 68 69## 3. No Affiliation and Allocation of Responsibility 70 71Any third-party instance, commercial service, paid plan, user solicitation, content processing, data processing, account usage, API call, payment settlement, customer support, or promotional activity is independently carried out by the corresponding deploying, operating, or controlling party. The open-source nature of this project, code contributions, issue discussions, documentation maintenance, version releases, bug fixes, community communications, or general technical explanations do not create participation in, authorization of, approval of, warranty for, joint operation, agency, partnership, employment, authorized operation, joint control, revenue sharing, joint tort, or any other joint-and-several liability relationship between the open-source project, copyright holders, contributors, or maintainers and such activities. 72 73The acknowledging party must not use the project name, marks, documentation, screenshots, community content, or open-source repository information to state or imply that its third-party instance, commercial service, paid plan, or operation is participated in, authorized, approved, warranted, or endorsed by the open-source project, copyright holders, contributors, maintainers, or community. 74 75The acknowledging party is independently responsible for consequences arising from its deployment, configuration, operation, promotion, charging, user-behavior management, content processing, data processing, account usage, API calls, or violations of laws, regulations, regulatory requirements, contractual obligations, or upstream rules. 76 77Any mandatory liability that cannot be excluded or limited by agreement shall be handled according to applicable law. Such statutory exception does not constitute participation in, authorization of, approval of, warranty for, or endorsement of any third-party deployment, operation, or commercial activity. 78 79## 4. Compliance Commitments 80 81By continuing to use console functions, the acknowledging party makes the following commitments: 82 831. It has independently reviewed and will continuously comply with the terms of service, acceptable use policies, supported countries and regions, account/API key rules, commercial-use requirements, resale restrictions, risk-control requirements, and technical restrictions of OpenAI, Anthropic, Google, and any other upstream service providers. 842. It will not use this project to bypass, or assist others in bypassing, upstream regional restrictions, access restrictions, account restrictions, risk controls, billing restrictions, identity verification, usage limits, or terms of service. 853. It will not provide API relay, model-call resale, account quota distribution, shared subscriptions, paid calls, top-up/payment agency, or similar services to the public or an indefinite group of users unless all necessary authorizations, qualifications, filings, permits, assessments, or contractual arrangements have been obtained. 864. If it provides generative AI services, deep synthesis services, algorithm-related services, API relay, paid calls, or other potentially regulated services within Mainland China or to the Mainland China public, it will independently complete all potentially applicable obligations regarding internet information services, generative AI services, deep synthesis, algorithm filing, security assessment, cybersecurity, data security, personal information protection, content safety, payment settlement, taxes, and upstream authorization. 875. It will maintain user management, access control, content review, abuse handling, log retention, privacy protection, data deletion, complaint handling, emergency takedown, and security incident response mechanisms appropriate to the scale and risk of its business. 886. It will not make any statement, commitment, marketing representation, or warranty to any user, customer, partner, channel, regulator, or third party that conflicts with Section 3 of this document. 897. It will be independently responsible for consequences arising from its deployment, operation, promotion, charging, user-behavior management, content processing, data processing, account usage, API calls, or violations of laws, regulations, regulatory requirements, contractual obligations, or upstream rules. 90 91## 5. Risk and Responsibility Notice 92 93Using Sub2API for public API services, commercial relay, quota distribution, team sharing, paid calls, or similar purposes may involve risks relating to terms of service, contractual breach, data protection, content safety, consumer protection, payment settlement, taxes, export controls, sanctions compliance, cybersecurity, industry access, and administrative regulation. Requirements vary by jurisdiction and business model and may change over time. 94 95The mandatory notice, document link, exact-phrase acknowledgment, and local acknowledgment record
95in the console are intended to provide clear, conspicuous, and reproducible notice of deployment and operation risks, confirm that the console user has read the current version of this document, and create a clear responsibility-separation record between the open-source project, copyright holders, contributors, maintainers and any third-party deploying, operating, or controlling party. 96 97## 6. Electronic Acknowledgment 98 99By continuing to use the console, opening the document link, reading this document, and typing the required confirmation phrase exactly as displayed, the acknowledging party electronically confirms that it has read, understood, and agreed to this document, and agrees that the system may record necessary evidence including the acknowledged version, acknowledgment time, console account identifier, IP address, and User-Agent. 100`,Im={class:"space-y-5"},Em={class:"rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-100"},$m={class:"flex gap-3"},Cm={class:"space-y-2"},Mm={class:"font-semibold"},Tm={class:"leading-6"},Rm={class:"grid gap-4 md:grid-cols-[minmax(0,1fr)_240px]"},xm={class:"min-h-[320px] max-h-[46vh] overflow-y-auto rounded-lg border border-gray-200 bg-white p-5 dark:border-dark-700 dark:bg-dark-900"},Lm=["innerHTML"],Om={class:"space-y-3 rounded-lg border border-gray-200 bg-gray-50 p-4 text-sm dark:border-dark-700 dark:bg-dark-900/60"},Dm={class:"text-xs font-medium uppercase tracking-wide text-gray-500 dark:text-dark-400"},qm={class:"mt-1 break-all font-mono text-gray-900 dark:text-white"},Um=["href"],zm={class:"leading-6 text-gray-600 dark:text-dark-300"},Km={class:"space-y-3"},Nm={for:"admin-compliance-phrase",class:"block text-sm font-semibold text-gray-900 dark:text-white"},Vm={class:"rounded-lg bg-gray-100 px-3 py-2 font-mono text-sm text-gray-900 dark:bg-dark-800 dark:text-dark-100"},Bm={class:"text-xs leading-5 text-gray-500 dark:text-dark-400"},Hm={class:"flex flex-col gap-3 sm:flex-row sm:justify-end"},Fm=["disabled"],Wm=["disabled"],jm={key:0},Gm={key:1},Qm=Z({__name:"AdminComplianceDialog",setup(e){const{t}=Et(),a=rt(),r=Me(),o=oe(),s=w(""),i=w(!1);ke.setOptions({breaks:!0,gfm:!0});const c=I(()=>r.isAuthenticated&&r.isAdmin&&a.shouldShow),u=I(()=>a.expectedPhrase),m=I(()=>s.value.trim()===u.value),l=I(()=>Y()==="zh"?Sm:Pm),y=I(()=>{var P,b;return Y()==="zh"?((P=a.status)==null?void 0:P.document_url_zh)||"https://github.com/Wei-Shaw/sub2api/blob/main/docs/legal/admin-compliance.zh.md":((b=a.status)==null?void 0:b.document_url_en)||"https://github.com/Wei-Shaw/sub2api/blob/main/docs/legal/admin-compliance.en.md"}),p=I(()=>!i.value||m.value?"":t("adminCompliance.inputMismatch")),d=I(()=>{const P=ke.parse(l.value);return $t.sanitize(P)});ee(u,()=>{s.value="",i.value=!1}),ee(c,P=>{P&&(s.value="",i.value=!1)});function f(){}async function g(){if(i.value=!0,!!m.value)try{(await a.accept(s.value.trim())).required||(o.showSuccess(t("adminCompliance.accepted")),s.value="",i.value=!1)}catch(P){const b=(P==null?void 0:P.message)||t("adminCompliance.acceptFailed");o.showError(b)}}async function A(){await r.logout(),window.location.href="/login"}return(P,b)=>(C(),pe(nr,{show:c.value,title:T(t)("adminCompliance.title"),width:"wide","close-on-escape":!1,"close-on-click-outside":!1,"show-close-button":!1,"z-index":80,onClose:f},{footer:ne(()=>[h("div",Hm,[h("button",{type:"button",class:"btn btn-secondary",disabled:T(a).submitting,onClick:A},R(T(t)("adminCompliance.logout")),9,Fm),h("button",{type:"button",class:"btn btn-primary",disabled:!m.value||T(a).submitting,onClick:g},[T(a).submitting?(C(),L("span",jm,R(T(t)("common.submitting")),1)):(C(),L("span",Gm,R(T(t)("adminCompliance.accept")),1))],8,Wm)])]),default:ne(()=>{var M;return[h("div",Im,[h("div",Em,[h("div",$m,[z(de,{name:"exclamationTriangle",size:"md",class:"mt-0.5 flex-shrink-0"}),h("div",Cm,[h("p",Mm,R(T(t)("adminCompliance.blockingNotice")),1),h("p",Tm,R(T(t)("adminCompliance.riskNotice")),1)])])]),h("div",Rm,[h("section",xm,[h("div",{class:"legal-document-content",innerHTML:d.value},null,8,Lm)]),h("aside",Om,[h("div",null,[h("p",Dm,R(T(t)("adminCompl
100iance.version")),1),h("p",qm,R(((M=T(a).status)==null?void 0:M.version)||"v2026.06.10"),1)]),h("a",{href:y.value,target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-2 text-primary-600 underline underline-offset-4 hover:text-primary-700 dark:text-primary-300 dark:hover:text-primary-200"},[z(de,{name:"externalLink",size:"sm"}),Ae(" "+R(T(t)("adminCompliance.openDocument")),1)],8,Um),h("p",zm,R(T(t)("adminCompliance.documentSource")),1)])]),h("div",Km,[h("label",Nm,R(T(t)("adminCompliance.inputLabel")),1),h("div",Vm,R(u.value),1),z(pr,{id:"admin-compliance-phrase",modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=E=>s.value=E),placeholder:T(t)("adminCompliance.inputPlaceholder"),autocomplete:"off",disabled:T(a).submitting,error:p.value,onEnter:g},null,8,["modelValue","placeholder","disabled","error"])]),h("p",Bm,R(T(t)("adminCompliance.legalNote")),1)])]}),_:1},8,["show","title"]))}}),Jm=Ce(Qm,[["__scopeId","data-v-42404ff1"]]);function ra(e,t,a){const r=typeof t=="string"&&t.trim()?t.trim():"Sub2API";if(typeof a=="string"&&a.trim()){const o=D.global.t(a);if(o&&o!==a)return`${o} - ${r}`}return typeof e=="string"&&e.trim()?`${e.trim()} - ${r}`:r}function ot(e,t,a=[]){const r=typeof e.params.id=="string"?e.params.id:"",o=e.name==="CustomPage"&&r?a.find(i=>i.id===r):void 0,s=o==null?void 0:o.label.trim();return ra(s||e.meta.title,t,s?void 0:e.meta.titleKey)}const Ym=Object.freeze(Object.defineProperty({__proto__:null,resolveDocumentTitle:ra,resolveRouteDocumentTitle:ot},Symbol.toStringTag,{value:"Module"}));function Zm(e){if(!e)return D.global.t("common.time.never");const t=new Date,a=new Date(e),r=t.getTime()-a.getTime();if(r<0||isNaN(r))return D.global.t("common.time.never");const o=Math.floor(r/1e3),s=Math.floor(o/60),i=Math.floor(s/60),c=Math.floor(i/24);return c>0?D.global.t("common.time.daysAgo",{n:c}):i>0?D.global.t("common.time.hoursAgo",{n:i}):s>0?D.global.t("common.time.minutesAgo",{n:s}):D.global.t("common.time.justNow")}function sf(e){if(e==null)return"0";const t=Y(),a=Math.abs(e);return new Intl.NumberFormat(t,{notation:a>=1e4?"compact":"standard",maximumFractionDigits:1}).format(e)}function cf(e,t="USD"){if(e==null)return"$0.00";const a=Y(),r=e>0&&e<.01?6:2;return new Intl.NumberFormat(a,{style:"currency",currency:t,minimumFractionDigits:r,maximumFractionDigits:r}).format(e)}function uf(e,t=2){if(e===0)return"0 Bytes";const a=1024,r=t<0?0:t,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.floor(Math.log(e)/Math.log(a));return parseFloat((e/Math.pow(a,s)).toFixed(r))+" "+o[s]}function st(e,t={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1},a){if(!e)return"";const r=new Date(e);if(isNaN(r.getTime()))return"";const o=a??Y();return new Intl.DateTimeFormat(o,t).format(r)}function Xm(e,t,a){return st(e,t,a)}function lf(e,t){return st(e,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1},t)}function df(e){if(isNaN(e.getTime()))return"";const t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${a}-${r}`}function mf(e){if(!e)return"";const t=new Date(e*1e3);if(isNaN(t.getTime()))return"";const a=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return`${a}-${r}-${o}T${s}:${i}`}function pf(e){if(!e)return null;const t=/^(\d{4,})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/.exec(e);if(!t)return null;const a=Number(t[1]),r=Number(t[2]),o=Number(t[3]),s=Number(t[4]),i=Number(t[5]),c=t[6]?Number(t[6]):0,u=t[7]?Number(t[7].slice(0,3).padEnd(3,"0")):0;if(!Number.isSafeInteger(a)||a<1||r<1||r>12||o<1||o>31||s>23||i>59||c>59)return null;const m=new Date(0);if(m.setFullYear(a,r-1,o),m.setHours(s,i,c,u),m.getFullYear()!==a||m.getMonth()!==r-1||m.getDate()!==o)return null;const l=m.getTime();return Number.isFinite(l)?Math.floor(l/1e3):null}function ff(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Be(e){return(e??"").toString().trim().toLowerCase().replace(/[-_\s]/g,"")}function gf(e){const t=(e??"").toString().trim();if(!t)return"-";switch(Be(t)){case"low":return"Low";case"medium":return"Medium";case"high":return"High";case"xhigh":case"extrahigh":return"XHigh";case"max":return"Max";
100case"none":case"minimal":return"-";default:return t.length>1?t[0].toUpperCase()+t.slice(1):t.toUpperCase()}}function hf(e,t){const a=Be(e),r=Be(t);return!a&&!r?!0:a!==""&&a===r}function yf(e){return st(e,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function _f(e){return e.toLocaleString()}function vf(e,t=4){return e.toFixed(t)}function wf(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function bf(e,t){if(e==null)return"0";const a=Math.abs(e);return(t==null?void 0:t.allowBillions)!==!1&&a>=1e9?`${(e/1e9).toFixed(1)}B`:a>=1e6?`${(e/1e6).toFixed(1)}M`:a>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function ep(e){if(!e)return null;const t=new Date,r=new Date(e).getTime()-t.getTime();if(r<=0||isNaN(r))return null;const o=Math.floor(r/(1e3*60)),s=Math.floor(o/60),i=Math.floor(s/24),c=s%24,u=o%60;return i>0?D.global.t("common.time.countdown.daysHours",{d:i,h:c}):s>0?D.global.t("common.time.countdown.hoursMinutes",{h:s,m:u}):D.global.t("common.time.countdown.minutes",{m:o})}function Af(e){const t=ep(e);return t?D.global.t("common.time.countdown.withSuffix",{time:t}):null}function tp(e){if(!e)return"";const t=Zm(e),a=Xm(e);return!a||t===D.global.t("common.time.never")?t:`${t} · ${a}`}const ap={key:0,class:"fixed inset-0 z-[120] flex items-start justify-center overflow-y-auto bg-gradient-to-br from-black/70 via-black/60 to-black/70 p-4 pt-[8vh] backdrop-blur-md"},np={class:"relative overflow-hidden border-b border-amber-100/80 bg-gradient-to-br from-amber-50/80 via-orange-50/50 to-yellow-50/30 px-8 py-6 dark:border-dark-700/50 dark:from-amber-900/20 dark:via-orange-900/10 dark:to-yellow-900/5"},rp={class:"relative z-10"},op={class:"mb-3 flex items-center gap-2"},sp={class:"inline-flex items-center gap-1.5 rounded-lg bg-gradient-to-r from-amber-500 to-orange-600 px-2.5 py-1 text-xs font-medium text-white shadow-lg shadow-amber-500/30"},ip={class:"mb-2 text-2xl font-bold leading-tight text-gray-900 dark:text-white"},cp={class:"flex items-center gap-1.5 text-sm text-gray-600 dark:text-gray-400"},up={class:"max-h-[50vh] overflow-y-auto bg-white px-8 py-8 dark:bg-dark-800"},lp={class:"relative"},dp={class:"pl-6"},mp=["innerHTML"],pp={class:"border-t border-gray-100 bg-gray-50/50 px-8 py-5 dark:border-dark-700 dark:bg-dark-900/30"},fp={class:"flex items-center justify-end"},gp={class:"flex items-center gap-2"},hp={key:0,class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},yp={key:1,class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},_p=Z({__name:"AnnouncementPopup",props:{announcement:{default:null},preview:{type:Boolean,default:!1}},emits:["close"],setup(e,{emit:t}){const a=e,r=t,{t:o}=Et(),s=na(),i=I(()=>a.preview?a.announcement:s.currentPopup);ke.setOptions({breaks:!0,gfm:!0});const c=I(()=>{var y;const m=(y=i.value)==null?void 0:y.content;if(!m)return"";const l=ke.parse(m);return $t.sanitize(l)});function u(){if(a.preview){r("close");return}s.dismissPopup()}return ee(i,m=>{m?document.body.style.overflow="hidden":a.preview&&(document.body.style.overflow="")},{immediate:!0}),It(()=>{a.preview&&(document.body.style.overflow="")}),(m,l)=>(C(),pe(He,{to:"body"},[z(Fe,{name:"popup-fade"},{default:ne(()=>[i.value?(C(),L("div",ap,[h("div",{class:"w-full max-w-[680px] overflow-hidden rounded-3xl bg-white shadow-2xl ring-1 ring-black/5 dark:bg-dark-800 dark:ring-white/10",onClick:l[0]||(l[0]=Ke(()=>{},["stop"]))},[h("div",np,[l[4]||(l[4]=h("div",{class:"absolute right-0 top-0 h-full w-64 bg-gradient-to-l from-orange-100/30 to-transparent dark:from-orange-900/20"},null,-1)),l[5]||(l[5]=h("div",{class:"absolute -right-8 -top-8 h-32 w-32 rounded-full bg-gradient-to-br from-amber-400/20 to-orange-500/20 blur-3xl"},null,-1)),l[6]||(l[6]=h("div",{class:"absolute -left-4 -bottom-4 h-24 w-24 rounded-full bg-gradient-to-tr from-yellow-400/20 to-amber-500/20 blur-2xl"},null,-1)),h("div",rp,[h("div",op,[l[2]||(l[2]=h("div",{class:"flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-amber-500 to-orange-600 text-white shadow-lg shadow-amber-500/30"},[h("svg",{class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})])],-1)),h("span",sp,[l[1]||(l[1]=h("span",{class:"relative flex h-2 w-2"},[h("span",{class:"absolute inline-flex h-full w-full animate-ping rounded-full bg-white opacity-75"}),h("span",{class:"relative inline-flex h-2 w-2 rounded-full bg-white"})],-1)),Ae(" "+R(T(o)("announcements.unread")),1)])]),h("h2",ip,R(i.value.title),
1001),h("div",cp,[l[3]||(l[3]=h("svg",{class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),h("time",null,R(T(tp)(i.value.created_at)),1)])])]),h("div",up,[h("div",lp,[l[7]||(l[7]=h("div",{class:"absolute left-0 top-0 bottom-0 w-1 rounded-full bg-gradient-to-b from-amber-500 via-orange-500 to-yellow-500"},null,-1)),h("div",dp,[h("div",{class:"markdown-body prose prose-sm max-w-none dark:prose-invert",innerHTML:c.value},null,8,mp)])])]),h("div",pp,[h("div",fp,[h("button",{onClick:u,"data-testid":"announcement-popup-dismiss",class:"rounded-xl bg-gradient-to-r from-amber-500 to-orange-600 px-6 py-2.5 text-sm font-medium text-white shadow-lg shadow-amber-500/30 transition-all hover:shadow-xl hover:scale-105"},[h("span",gp,[e.preview?(C(),L("svg",hp,[...l[8]||(l[8]=[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)])])):(C(),L("svg",yp,[...l[9]||(l[9]=[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"},null,-1)])])),Ae(" "+R(e.preview?T(o)("common.close"):T(o)("announcements.markRead")),1)])])])])])])):j("",!0)]),_:1})]))}}),vp=Ce(_p,[["__scopeId","data-v-bdbde8bb"]]),Te=Pe.create({baseURL:Rt("/").replace(/\/+$/,""),timeout:3e4,headers:{"Content-Type":"application/json"}});async function oa(){return(await Te.get("/setup/status")).data.data}async function kf(e){await Te.post("/setup/test-db",e)}async function Sf(e){await Te.post("/setup/test-redis",e)}async function Pf(e){return(await Te.post("/setup/install",e)).data.data}function wp(e,t={}){const a=e.trim();if(!a)return"";if(t.allowRelative&&a.startsWith("/")&&!a.startsWith("//")||t.allowDataUrl&&a.startsWith("data:image/"))return a;if(!a.match(/^https?:\/\//i))return"";try{const r=new URL(a),o=r.protocol.toLowerCase();return o!=="http:"&&o!=="https:"?"":r.toString()}catch{return""}}function sa(e){const t=wp(e,{allowRelative:!0,allowDataUrl:!0});if(!t)return;let a=document.querySelector('link[rel="icon"]');a||(a=document.createElement("link"),a.rel="icon",document.head.appendChild(a)),a.type=t.endsWith(".svg")?"image/svg+xml":"image/x-icon",a.href=t}const bp=Z({__name:"App",setup(e){const t=Ia(),a=Ea(),r=oe(),o=Me(),s=Am(),i=na(),c=rt(),u=nt();function m(){var d;const p=[...((d=r.cachedPublicSettings)==null?void 0:d.custom_menu_items)??[],...o.isAdmin?u.customMenuItems:[]];document.title=ot(a,r.siteName,p)}ee(()=>r.siteLogo,p=>{p&&sa(p)},{immediate:!0}),ee([()=>a.fullPath,()=>a.meta.title,()=>a.meta.titleKey,()=>r.siteName,()=>{var p;return(p=r.cachedPublicSettings)==null?void 0:p.custom_menu_items},()=>o.isAdmin,()=>u.customMenuItems],m,{deep:!0});function l(){document.visibilityState==="visible"&&o.isAuthenticated&&i.fetchAnnouncements()}function y(p){const d=p.detail||{};c.requireAcknowledgement(d)}return ee(()=>o.isAuthenticated,(p,d)=>{p?(o.isAdmin&&c.fetchStatus().catch(f=>{console.error("Failed to fetch admin compliance status:",f)}),s.fetchActiveSubscriptions().catch(f=>{console.error("Failed to preload subscriptions:",f)}),s.startPolling(),d===!1?setTimeout(()=>i.fetchAnnouncements(!0),3e3):i.fetchAnnouncements(),document.addEventListener("visibilitychange",l)):(s.clear(),i.reset(),c.reset(),document.removeEventListener("visibilitychange",l))},{immediate:!0}),t.afterEach(()=>{o.isAuthenticated&&i.fetchAnnouncements()}),It(()=>{document.removeEventListener("visibilitychange",l),window.removeEventListener("admin-compliance-required",y)}),Pt(async()=>{window.addEventListener("admin-compliance-required",y);try{if((await oa()).needs_setup&&a.path!=="/setup"){t.replace("/setup");return}}catch{}await r.fetchPublicSettings(),m()}),(p,d)=>(C(),L(kt,null,[z(er),z(T($a)),z(Jn),z(vp),z(Jm)],64))}}),Ap={"/admin/dashboard":["/admin/accounts","/admin/users"],"/admin/accounts":["/admin/dashboard","/admin/users"],"/admin/users":["/admin/groups","/admin/dashboard"],"/admin/groups":["/admin/subscriptions","/admin/users"],"/admin/subscriptions":["/admin/groups","/admin/redeem"],"/dashboard":["/keys","/usage"],"/keys":["/dashboard","/usage"],"/usage":["/keys","/redeem"],"/redeem":["/usage","/profile"],"/profile":["/dashboard","/keys"]},kp=(e,t)=>typeof window.requestIdleCallback=="function"?window.requestIdleCallback(e,t):setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>50})},1e3),Sp=e=>{typeof window.cancelIdleCallback=="function"&&typeof e=="number"?window.cancelIdleCallback(e):clearTimeout(e)};function Pp(e){const t=w(null),a=w(new Set),r=y=>{var f;if(!e)return null;const d=e.getRoutes().find(g=>g.path===y);if(d&&((f=d.components)!=null&&f.default)){const g=d.components.default;if(typeof g=="function")return g}return null},o=y=>Ap[y.path]||[],s=async y=>{try{await y()}catch{}},i=()=>{t.value!==null&&(Sp(t.value),t.value=null)},c=y=>{i();const p=o(y);p.length!==0&&(t.value=kp(()=>{t.value=null;const d=y.path;if(a.value.has(d))return;const f=[];for(const g of p){const A=r(g);A&&f.push(A)}f.length>0&&Promise.all(f.map(s)).then(()=>{a.value.add(d)})},{timeout:2e3}))},u=()=>{i(),a.value.clear()},m=y=>y.startsWith("/admin"),l=y=>{const p=o(y),d=[];for(const f of p){const g=r(f);g&&d.push(g)}return d};
100return{prefetchedRoutes:we(a),triggerPrefetch:c,cancelPendingPrefetch:i,resetPrefetchState:u,_getPrefetchConfig:l,_isAdminRoute:m}}function Ip(e,t){return e?t?"/admin/dashboard":"/dashboard":"/login"}const Ep=[{path:"/setup",name:"Setup",component:()=>_(()=>import("./SetupWizardView-CcbwuU7Z.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),meta:{requiresAuth:!1,title:"Setup"}},{path:"/home",name:"Home",component:()=>_(()=>import("./HomeView-nf-T4jbR.js"),__vite__mapDeps([8,9,1,3,10,11,6,7,12])),meta:{requiresAuth:!1,title:"Home"}},{path:"/login",name:"Login",component:()=>_(()=>import("./LoginView-CwmVNC6B.js"),__vite__mapDeps([13,1,14,15,6,7,16,17,18,19,20,3,21,22,23,24,25,10])),meta:{requiresAuth:!1,title:"Login",titleKey:"home.login"}},{path:"/register",name:"Register",component:()=>_(()=>import("./RegisterView-D3JrrTq-.js"),__vite__mapDeps([26,1,14,15,6,7,16,17,18,19,20,3,21,22,23,27,24,28,29,10])),meta:{requiresAuth:!1,title:"Register",titleKey:"auth.createAccount"}},{path:"/email-verify",name:"EmailVerify",component:()=>_(()=>import("./EmailVerifyView-D5GKHftQ.js"),__vite__mapDeps([30,1,14,15,6,7,16,17,18,22,3,23,27,24,28,20,31,10])),meta:{requiresAuth:!1,title:"Verify Email"}},{path:"/auth/callback",name:"OAuthCallback",alias:"/auth/oauth/callback",component:()=>_(()=>import("./OAuthCallbackView-Co6-4gE8.js"),__vite__mapDeps([32,1,16,20,3,6,7])),meta:{requiresAuth:!1,title:"OAuth Callback",titleKey:"auth.oauthCallbackPageTitle"}},{path:"/auth/linuxdo/callback",name:"LinuxDoOAuthCallback",component:()=>_(()=>import("./LinuxDoCallbackView-D35l-5Mx.js"),__vite__mapDeps([33,1,14,15,6,7,16,17,18,34,22,3,23,35,20,36,10])),meta:{requiresAuth:!1,title:"LinuxDo OAuth Callback",titleKey:"auth.linuxdoCallbackPageTitle"}},{path:"/auth/wechat/callback",name:"WeChatOAuthCallback",component:()=>_(()=>import("./WechatCallbackView-BJ9pC8Wj.js"),__vite__mapDeps([37,1,14,15,6,7,16,17,18,34,22,3,23,35,20,38,10])),meta:{requiresAuth:!1,title:"WeChat OAuth Callback",titleKey:"auth.wechatCallbackPageTitle"}},{path:"/auth/wechat/payment/callback",name:"WeChatPaymentOAuthCallback",component:()=>_(()=>import("./WechatPaymentCallbackView-BZLEAF3x.js"),__vite__mapDeps([39,1,3,6,7])),meta:{requiresAuth:!1,title:"WeChat Payment Callback",titleKey:"auth.wechatPaymentCallbackPageTitle"}},{path:"/auth/dingtalk/callback",name:"DingTalkOAuthCallback",component:()=>_(()=>import("./DingTalkCallbackView-BriPk8l5.js"),__vite__mapDeps([40,1,14,15,6,7,16,17,18,34,22,3,23,35,20,41,10])),meta:{requiresAuth:!1,title:"DingTalk OAuth Callback",titleKey:"auth.dingtalkCallbackPageTitle"}},{path:"/auth/dingtalk/email-completion",name:"dingtalk-email-completion",component:()=>_(()=>import("./DingTalkEmailCompletionView-BBdJ8HII.js"),__vite__mapDeps([42,1,14,15,6,7,16,17,18,34,22,3,23,35,20,10])),meta:{requiresAuth:!1,title:"DingTalk Email Completion"}},{path:"/auth/oidc/callback",name:"OIDCOAuthCallback",component:()=>_(()=>import("./OidcCallbackView-CL2S9SUY.js"),__vite__mapDeps([43,1,14,15,6,7,16,17,18,34,22,3,23,35,20,44,10])),meta:{requiresAuth:!1,title:"OIDC OAuth Callback",titleKey:"auth.oidcCallbackPageTitle"}},{path:"/forgot-password",name:"ForgotPassword",component:()=>_(()=>import("./ForgotPasswordView-CUr73Y-1.js"),__vite__mapDeps([45,1,14,15,6,7,16,17,18,22,3,23,46,10])),meta:{requiresAuth:!1,title:"Forgot Password",titleKey:"auth.forgotPasswordTitle"}},{path:"/reset-password",name:"ResetPassword",component:()=>_(()=>import("./ResetPasswordView--vI3A5_6.js"),__vite__mapDeps([47,1,14,15,6,7,16,17,18,3,48,10])),meta:{requiresAuth:!1,title:"Reset Password"}},{path:"/key-usage",name:"KeyUsage",component:()=>_(()=>import("./KeyUsageView-cYWkOnFL.js"),__vite__mapDeps([49,1,9,3,10,6,7,50])),meta:{requiresAuth:!1,title:"Key Usage"}},{path:"/legal/:documentId",name:"LegalDocument",component:()=>_(()=>import("./LegalDocumentView-D5C8_MB7.js"),__vite__mapDeps([51,1,6,7,3,52])),meta:{requiresAuth:!1,title:"Legal Document"}},{path:"/model-plaza",name:"ModelPlaza",component:()=>_(()=>import("./ModelPlazaView-DLpqovWj.js"),__vite__mapDeps([53,1,54,14,15,6,7,3,16,11,9,10,55,56,57,58,59,60])),meta:{requiresAuth:!1,title:"Model Plaza",titleKey:"modelPlaza.title"}},{path:"/",redirect:"/home"},{path:"/dashboard",name:"Dashboard",component:()=>_(()=>import("./DashboardView-8vTQdJww.js"),__vite__mapDeps([61,62,54,14,1,15,6,7,3,16,11,9,10,63,64,65,66,67,2,4,68,69])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Dashboard",titleKey:"dashboard.title",descriptionKey:"dashboard.welcomeMessage"}},{path:"/keys",name:"Keys",component:()=>_(()=>import("./KeysView-8lTyYcsx.js"),__vite__mapDeps([70,1,54,14,15,6,7,3,16,11,9,10,71,62,72,73,74,75,76,77,2,4,78,79,68,80,81,57,58,55,82,83,84])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"API Keys",titleKey:"keys.title",descriptionKey:"keys.description"}},{path:"/batch-image",name:"BatchImageGuide",alias:"/docs/batch-image",component:()=>_(()=>import("./BatchImageGuideView-DrOBDD4a.js"),__vite__mapDeps([85,1,54,14,15,6,7,3,16,11,9,10,73,74,75,76,2,4,80,81,71,86])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Batch Image Guide",titleKey:"batchImageGuide.title",descriptionKey:"batchImageGuide.description"}},{path:"/usage",name:"Usage",component:()=>_(()=>import("./UsageView-BPTBYNTT.js"),__vite__mapDeps([87,14,1,15,62,72,54,6,7,3,16,11,9,10,77,2,4,71,78,65,66,63,64,67,88,89,90,75,76,68,91])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Usage Records",titleKey:"usage.title",descriptionKey:"usage.description"}},{path:"/redeem",name:"Redeem",component:()=>_(()=>import("./RedeemView-PsozsaJx.js"),__vite__mapDeps([92,1,54,14,15,6,7,3,16,11,9,10,93])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Redeem Code",titleKey:"redeem.title",descriptionKey:"redeem.description"}},{path:"/affiliate",name:"Affiliate",component:()=>_(()=>import("./AffiliateView-Dj5DzVbY.js"),__vite__mapDeps([94,54,14,1,15,6,7,3,16,11,9,10,69,24])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Affiliate",titleKey:"affiliate.title",descriptionKey:"affiliate.description"}},{path:"/available-channels",name:"UserAvailableChannels",component:()=>_(()=>import("./AvailableChannelsView-CXglUDb8.js"),__vite__mapDeps([95,1,54,14,15,6,7,3,16,11,9,10,73,74,55,57,58,59,56,72,24])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Available Channels",titleKey:"availableChannels.title",descriptionKey:"availableChannels.description"}},{path:"/profile",name:"Profile",component:()=>_(()=>import("./ProfileView-BkSQ_phr.js"),__vite__mapDeps([96,54,14,1,15,6,7,3,16,11,9,10,69,24,97])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Profile",titleKey:"profile.title",descriptionKey:"profile.description"}},{path:"/subscriptions",name:"Subscriptions",component:()=>_(()=>import("./SubscriptionsView-Bv9CwjXH.js"),__vite__mapDeps([98,1,54,14,15,6,7,3,16,11,9,10,58,56,99])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"My Subscriptions",titleKey:"userSubscriptions.title",descriptionKey:"userSubscriptions.description"}},{path:"/purchase",name:"PurchaseSubscription",component:()=>_(()=>
100import("./PaymentView-DygUM5_9.js"),__vite__mapDeps([100,1,101,102,24,58,54,14,15,6,7,3,16,11,9,10,103,104,105,56,106,107])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Purchase Subscription",titleKey:"nav.buySubscription",descriptionKey:"purchase.description",requiresPayment:!0}},{path:"/orders",name:"OrderList",component:()=>_(()=>import("./UserOrdersView-CjeKlUPI.js"),__vite__mapDeps([108,1,102,24,54,14,15,6,7,3,16,11,9,10,77,2,4,71,78,109,75,76,110,106])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"My Orders",titleKey:"nav.myOrders",requiresPayment:!0}},{path:"/payment/qrcode",name:"PaymentQRCode",component:()=>_(()=>import("./PaymentQRCodeView-Brn0_79w.js"),__vite__mapDeps([111,1,54,14,15,6,7,3,16,11,9,10,101,102,24,103,104])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Payment",titleKey:"payment.qr.scanToPay",requiresPayment:!0}},{path:"/payment/result",name:"PaymentResult",component:()=>_(()=>import("./PaymentResultView-HzNkaMbD.js"),__vite__mapDeps([112,1,110,3,105,101,102,106,107,24,6,7])),meta:{requiresAuth:!1,requiresAdmin:!1,title:"Payment Result",titleKey:"payment.result.success",requiresPayment:!1}},{path:"/payment/stripe",name:"StripePayment",component:()=>_(()=>import("./StripePaymentView-DedDlzIY.js"),__vite__mapDeps([113,1,101,102,24,106,105,54,14,15,6,7,3,16,11,9,10])),meta:{requiresAuth:!1,requiresAdmin:!1,title:"Stripe Payment",titleKey:"payment.stripePay",requiresPayment:!1}},{path:"/payment/airwallex",name:"AirwallexPayment",component:()=>_(()=>import("./AirwallexPaymentView-B8lpCeaG.js"),__vite__mapDeps([114,1,54,14,15,6,7,3,16,11,9,10,105])),meta:{requiresAuth:!1,requiresAdmin:!1,title:"Airwallex Payment",titleKey:"payment.airwallexPay",requiresPayment:!1}},{path:"/payment/stripe-popup",name:"StripePopup",component:()=>_(()=>import("./StripePopupView-CBlsF1zu.js"),__vite__mapDeps([115,1,24,3,6,7])),meta:{requiresAuth:!1,requiresAdmin:!1,title:"Payment",requiresPayment:!1}},{path:"/custom/:id",name:"CustomPage",component:()=>_(()=>import("./CustomPageView-LnsuP_mQ.js"),__vite__mapDeps([116,1,54,14,15,6,7,3,16,11,9,10,117])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Custom Page",titleKey:"customPage.title"}},{path:"/admin",redirect:"/admin/dashboard"},{path:"/admin/dashboard",name:"AdminDashboard",component:()=>_(()=>import("./DashboardView-C_TPG3jr.js"),__vite__mapDeps([118,1,54,14,15,6,7,3,16,11,9,10,63,64,65,66,67,2,4,90])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Admin Dashboard",titleKey:"admin.dashboard.title",descriptionKey:"admin.dashboard.description"}},{path:"/admin/ops",name:"AdminOps",component:()=>_(()=>import("./OpsDashboard-J44NNWAQ.js"),__vite__mapDeps([119,1,54,14,15,6,7,3,16,11,9,10,2,4,120,121,122,75,76,68,77,71,78,91,66,81,24,5,79,123])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Ops Monitoring",titleKey:"admin.ops.title",descriptionKey:"admin.ops.description"}},{path:"/admin/audit-logs",name:"AdminAuditLogs",component:()=>_(()=>import("./AuditLogView-krcEznYk.js"),__vite__mapDeps([124,1,97,54,14,15,6,7,3,16,11,9,10,73,74,75,76,77,2,4,71,78,79])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Audit Logs",titleKey:"admin.audit.title",descriptionKey:"admin.audit.description"}},{path:"/admin/users",name:"AdminUsers",component:()=>_(()=>import("./UsersView-Dn8A2Xki.js"),__vite__mapDeps([125,1,71,126,54,14,15,6,7,3,16,11,9,10,73,74,75,76,77,2,4,78,79,68,57,58,55,127,128,97,5,82,83,129,130])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"User Management",titleKey:"admin.users.title",descriptionKey:"admin.users.description"}},{path:"/admin/groups",name:"AdminGroups",component:()=>_(()=>import("./GroupsView-CB7pfhQx.js"),__vite__mapDeps([131,1,54,14,15,6,7,3,16,11,9,10,120,73,74,75,76,77,2,4,71,78,5,79,68,55,132,133,134,127,24,135])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Group Management",titleKey:"admin.groups.title",descriptionKey:"admin.groups.description"}},{path:"/admin/channels",redirect:"/admin/channels/pricing"},{path:"/admin/channels/pricing",name:"AdminChannels",component:()=>_(()=>import("./ChannelsView-Dl0z4o2j.js"),__vite__mapDeps([136,1,24,133,3,56,54,14,15,6,7,16,11,9,10,73,74,75,76,77,2,4,71,78,79,68,55,5,132,134,137])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Channel Management",titleKey:"admin.channels.title",descriptionKey:"admin.channels.description"}},{path:"/admin/channels/monitor",name:"AdminChannelMonitor",component:()=>_(()=>import("./ChannelMonitorView-Bn8f31dR.js"),__vite__mapDeps([138,24,54,14,1,15,6,7,3,16,11,9,10,73,74,75,76,77,2,4,71,78,79,68,121,5,139,140,81,72,133,57,58,55,84])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Channel Monitor",titleKey:"admin.channelMonitor.title",descriptionKey:"admin.channelMonitor.description"}},{path:"/monitor",name:"ChannelStatus",component:()=>_(()=>import("./ChannelStatusView-BWJWj5yJ.js"),__vite__mapDeps([141,11,24,54,14,1,15,6,7,3,16,9,10,68,139,140,81,63,64,2,4,66,142])),meta:{requiresAuth:!0,requiresAdmin:!1,title:"Channel Status",titleKey:"nav.channelStatus"}},{path:"/admin/subscriptions",name:"AdminSubscriptions",component:()=>_(()=>import("./SubscriptionsView-KItH7wJg.js"),__vite__mapDeps([143,1,71,54,14,15,6,7,3,16,11,9,10,73,74,75,76,77,2,4,78,79,68,57,58,55,82,83,99,120,144])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Subscription Management",titleKey:"admin.subscriptions.title",descriptionKey:"admin.subscriptions.description"}},{path:"/admin/accounts",name:"AdminAccounts",component:()=>_(()=>import("./AccountsView-3k0mtUp-.js"),__vite__mapDeps([145,1,71,81,146,3,55,126,128,97,54,14,15,6,7,16,11,9,10,73,74,75,76,121,77,2,4,78,79,147,148,24,149,150,151,57,58,5,127,140,56,63,64,80,120,66,90,89,152])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Account Management",titleKey:"admin.accounts.title",descriptionKey:"admin.accounts.description"}},{path:"/admin/plugins",name:"AdminPlugins",component:()=>_(()=>import("./PluginsView-BSQJ4X34.js"),__vite__mapDeps([153,54,14,1,15,6,7,3,16,11,9,10,128,97])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Plugin Management",titleKey:"admin.plugins.title",descriptionKey:"admin.plugins.description"}},{path:"/admin/announcements",name:"AdminAnnouncements",component:()=>_(()=>import("./AnnouncementsView-Ch7svYWU.js"),__vite__mapDeps([154,1,71,54,14,15,6,7,3,16,11,9,10,73,74,75,76,77,2,4,78,79,68,151,57,58,55])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Announcements",titleKey:"admin.announcements.title",descriptionKey:"admin.announcements.description"}},{path:"/admin/proxies",name:"AdminProxies",component:()=>_(()=>import("./ProxiesView-DqOB57kJ.js"),__vite__mapDeps([155,1,54,14,15,6,7,3,16,11,9,10,73,74,75,76,77,2,4,71,78,79,68,146,55,126])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Proxy Management",titleKey:"admin.proxies.title",descriptionKey:"admin.proxies.description"}},{path:"/admin/redeem",name:"AdminRedeem",component:()=>_(()=>import("./RedeemView-BCu5mt2g.js"),__vite__mapDeps([156,1,16,126,71,54,14,15,6,7,3,11,9,10,73,74,75,76,77,2,4,78,79,57,58,55,82,83])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Redeem Code Management",titleKey:"admin.redeem.title",descriptionKey:"admin.redeem.description"}},{path:"/admin/promo-codes",name:"AdminPromoCodes",component:()=>_(()=>import("./PromoCodesView-BuD0SBGr.js"),__vite__mapDeps([157,1,16,71,54,14,15,6,7,3,11,9,10,73,74,75,76,77,2,4,78,79])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Promo Code Management",titleKey:"admin.promo.title",descriptionKey:"admin.promo.description"}},{path:"/admin/settings",name:"AdminSettings",component:()=>_(()=>import("./SettingsView-A5drFaX7.js"),__vite__mapDeps([158,1,54,14,15,6,7,3,16,11,9,10,2,4,79,103,121,57,58,55,82,83,5,149,150,128,97,24,105,28,159])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"System Settings",titleKey:"admin.settings.title",descriptionKey:"admin.settings.description"}},{path:"/admin/risk-control",name:"AdminRiskControl",component:()=>_(()=>
100import("./RiskControlView-D6CeNzn8.js"),__vite__mapDeps([160,1,54,14,15,6,7,3,16,11,9,10,2,4,5,77,71,78,147,148,149,150,24])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Risk Control",titleKey:"admin.riskControl.title",descriptionKey:"admin.riskControl.description",requiresRiskControl:!0}},{path:"/admin/prompt-audit",name:"AdminPromptAudit",component:()=>_(()=>import("./PromptAuditView-AAMivdtm.js"),__vite__mapDeps([161,1,54,14,15,6,7,3,16,11,9,10,79,24,77,2,4,71,78])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Prompt Audit",titleKey:"admin.promptAudit.title",descriptionKey:"admin.promptAudit.description",requiresRiskControl:!0}},{path:"/admin/usage",name:"AdminUsage",component:()=>_(()=>import("./UsageView-Ba0Qvcb7.js"),__vite__mapDeps([162,1,6,7,71,88,3,89,66,63,64,90,75,76,68,91,54,14,15,16,11,9,10,77,2,4,78,65,67,79,129,122])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Usage Records",titleKey:"admin.usage.title",descriptionKey:"admin.usage.description"}},{path:"/admin/affiliates",redirect:"/admin/affiliates/invites"},{path:"/admin/affiliates/invites",name:"AdminAffiliateInvites",component:()=>_(()=>import("./AdminAffiliateInvitesView-BwNikPfC.js"),__vite__mapDeps([163,164,1,54,14,15,6,7,3,16,11,9,10,73,74,75,76,77,2,4,71,78,110,24])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Affiliate Invite Records",titleKey:"nav.affiliateInviteRecords",descriptionKey:"admin.affiliates.invitesDescription"}},{path:"/admin/affiliates/rebates",name:"AdminAffiliateRebates",component:()=>_(()=>import("./AdminAffiliateRebatesView-J5WXcUTg.js"),__vite__mapDeps([165,164,1,54,14,15,6,7,3,16,11,9,10,73,74,75,76,77,2,4,71,78,110,24])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Affiliate Rebate Records",titleKey:"nav.affiliateRebateRecords",descriptionKey:"admin.affiliates.rebatesDescription"}},{path:"/admin/affiliates/transfers",name:"AdminAffiliateTransfers",component:()=>_(()=>import("./AdminAffiliateTransfersView-DQNKLSWo.js"),__vite__mapDeps([166,164,1,54,14,15,6,7,3,16,11,9,10,73,74,75,76,77,2,4,71,78,110,24])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Affiliate Transfer Records",titleKey:"nav.affiliateTransferRecords",descriptionKey:"admin.affiliates.transfersDescription"}},{path:"/admin/orders/dashboard",name:"AdminPaymentDashboard",component:()=>_(()=>import("./AdminPaymentDashboardView-BZ5Yo9hP.js"),__vite__mapDeps([167,24,54,14,1,15,6,7,3,16,11,9,10,63,64,66])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Payment Dashboard",titleKey:"nav.paymentDashboard",requiresPayment:!0}},{path:"/admin/orders",name:"AdminOrders",component:()=>_(()=>import("./AdminOrdersView-DFv0srCa.js"),__vite__mapDeps([168,1,24,54,14,15,6,7,3,16,11,9,10,77,2,4,71,78,106,110,109,75,76])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Order Management",titleKey:"nav.orderManagement",requiresPayment:!0}},{path:"/admin/orders/plans",name:"AdminPaymentPlans",component:()=>_(()=>import("./AdminPaymentPlansView-yCWl26-i.js"),__vite__mapDeps([169,24,54,14,1,15,6,7,3,16,11,9,10,75,76,79,57,58,55,106,2,4,56])),meta:{requiresAuth:!0,requiresAdmin:!0,title:"Subscription Plans",titleKey:"nav.paymentPlans",requiresPayment:!0}},{path:"/:pathMatch(.*)*",name:"NotFound",component:()=>_(()=>import("./NotFoundView-hv91aOPv.js"),__vite__mapDeps([170,1,3,6,7])),meta:{title:"404 Not Found"}}],te=Ca({history:Ma("/"),routes:Ep,scrollBehavior(e,t,a){return a||{top:0}}});let wt=!1;const ia=Ft();let ze=null;const $p=["/login","/key-usage","/setup","/payment/result","/payment/airwallex","/legal"],Cp=["/auth/callback","/auth/linuxdo/callback","/auth/dingtalk/callback","/auth/dingtalk/email-completion","/auth/oidc/callback","/auth/wechat/callback","/auth/wechat/payment/callback"],Mp=["/register","/email-verify"];function bt(e,t){return!!($p.some(a=>e===a||e.startsWith(a))||Cp.some(a=>e===a)||t&&Mp.some(a=>e===a))}te.beforeEach(async(e,t,a)=>{var m,l,y;ia.startNavigation();const r=Me();wt||(r.checkAuth(),wt=!0);const o=oe(),s=nt(),i=[...((m=o.cachedPublicSettings)==null?void 0:m.custom_menu_items)??[],...r.isAdmin?s.customMenuItems:[]];document.title=ot(e,o.siteName,i);const c=e.meta.requiresAuth!==!1,u=e.meta.requiresAdmin===!0;if(e.path==="/setup")try{if(!(await oa()).needs_setup){a(Ip(r.isAuthenticated,r.isAdmin));return}}catch{}if(!c){if(r.isAuthenticated&&(e.path==="/login"||e.path==="/register")){if(o.backendModeEnabled&&!r.isAdmin){a();return}a(r.isAdmin?"/admin/dashboard":"/dashboard");return}if(e.path==="/model-plaza"){if(!o.publicSettingsLoaded)try{await o.fetchPublicSettings()}catch(d){console.warn("Failed to load public settings in route guard",d)}const p=o.cachedPublicSettings;if(o.publicSettingsLoaded&&(p==null?void 0:p.model_plaza_enabled)===!1){a(r.isAuthenticated?r.isAdmin?"/admin/dashboard":"/dashboard":"/home");return}if((p==null?void 0:p.model_plaza_require_auth)===!0&&!r.isAuthenticated){a({path:"/login",query:{redirect:e.fullPath}});return}if(o.backendModeEnabled&&r.isAuthenticated&&!r.isAdmin){a("/login");return}}if(o.backendModeEnabled&&!r.isAuthenticated&&!bt(e.path,r.hasPendingAuthSession)){a("/login");return}a();return}if(!r.isAuthenticated){a({path:"/login",query:{redirect:e.fullPath}});return}if(u&&!r.isAdmin){a("/dashboard");return}if(u&&r.isAdmin){const p=rt();if(!p.initialized)try{await p.fetchStatus()}catch(d){const f=d;f.status===423&&f.code==="ADMIN_COMPLIANCE_ACK_REQUIRED"&&p.requireAcknowledgement(f.metadata)}}if((e.meta.requiresPayment||e.meta.requiresRiskControl)&&!o.publicSettingsLoaded)try{await o.fetchPublicSettings()}catch(p){console.warn("Failed to load public settings in route guard",p)}
100if(e.meta.requiresPayment&&o.publicSettingsLoaded&&((l=o.cachedPublicSettings)==null?void 0:l.payment_enabled)===!1){a(r.isAdmin?"/admin/dashboard":"/dashboard");return}if(e.meta.requiresRiskControl&&o.publicSettingsLoaded&&((y=o.cachedPublicSettings)==null?void 0:y.risk_control_enabled)===!1){a(r.isAdmin?"/admin/settings":"/dashboard");return}if(r.isSimpleMode&&["/admin/subscriptions","/admin/redeem","/subscriptions","/redeem"].some(d=>e.path.startsWith(d))){a(r.isAdmin?"/admin/dashboard":"/dashboard");return}if(o.backendModeEnabled){if(r.isAuthenticated&&r.isAdmin){a();return}if(!bt(e.path,r.hasPendingAuthSession)){a("/login");return}}a()});te.afterEach(e=>{ia.endNavigation(),ze||(ze=Pp(te)),ze.triggerPrefetch(e)});te.onError(e=>{var a,r,o;if(console.error("Router error:",e),((a=e.message)==null?void 0:a.includes("Failed to fetch dynamically imported module"))||((r=e.message)==null?void 0:r.includes("Loading chunk"))||((o=e.message)==null?void 0:o.includes("Loading CSS chunk"))||e.name==="ChunkLoadError"){const s="chunk_reload_attempted",i=sessionStorage.getItem(s),c=Date.now();!i||c-parseInt(i)>1e4?(sessionStorage.setItem(s,c.toString()),console.warn("Chunk load error detected, reloading page to fetch latest version..."),window.location.reload()):console.error("Chunk load error persists after reload. Please clear browser cache.")}});const Tp=Object.freeze(Object.defineProperty({__proto__:null,default:te},Symbol.toStringTag,{value:"Module"})),Rp=/\b(Mobi|Android|iPhone|iPod|Windows Phone|webOS|BlackBerry|IEMobile)\b/i,xp=/\b(iPad|Tablet)\b/i,Lp=/\b(iPhone|iPad|iPod)\b/i;function At(e,t){var a;try{return((a=e==null?void 0:e(t))==null?void 0:a.matches)===!0}catch{return!1}}function Op(e={}){var l;const t=e.navigator;if(!t)return!1;if(((l=t.userAgentData)==null?void 0:l.mobile)===!0)return!0;const a=t.userAgent||"",r=t.maxTouchPoints??0,o=t.platform==="MacIntel"&&r>1,s=Rp.test(a),i=xp.test(a)||o,c=At(e.matchMedia,"(pointer: coarse)"),u=At(e.matchMedia,"(hover: none)"),m=r>0;return s||i||c&&u&&m}function If(){return typeof navigator>"u"?!1:Op({navigator,matchMedia:typeof window<"u"?window.matchMedia.bind(window):void 0})}function Dp(e={}){const t=e.navigator;if(!t)return!1;const a=t.userAgent||"",r=t.maxTouchPoints??0,o=t.platform==="MacIntel"&&r>1;return Lp.test(a)||o}function qp(){return typeof navigator>"u"?!1:Dp({navigator})}function Up(){if(!qp())return;const e=document.querySelector('meta[name="viewport"]');if(!e)return;const t=e.getAttribute("content")||"";/maximum-scale/i.test(t)||e.setAttribute("content",`${t}, maximum-scale=1.0`)}function zp(){const e=localStorage.getItem("theme"),t=e==="dark"||!e&&window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",t)}async function Kp(){zp(),Up();const e=Ta(bp),t=Ra();e.use(t);const a=oe();a.initFromInjectedConfig(),a.siteName&&a.siteName!=="Sub2API"&&(document.title=`${a.siteName} - AI API Gateway`),sa(a.siteLogo),await Ka(),e.use(te),e.use(D),await te.isReady(),e.mount("#app")}Kp();export{Ln as $,If as A,Fp as B,Hp as C,Ce as D,Xp as E,ff as F,pf as G,mf as H,wp as I,Kt as J,Yp as K,Tn as L,Rn as M,jp as N,Gp as O,Mn as P,Cn as Q,vn as R,wn as S,On as T,gn as U,Xe as V,En as W,qn as X,Dn as Y,xn as Z,de as _,oe as a,df as a0,Sm as a1,Pm as a2,Y as a3,Cd as a4,gf as a5,ae as a6,vp as a7,Ze as a8,uf as a9,Ci as aA,ef as aB,af as aC,sf as aD,ep as aE,Af as aF,yf as aG,Ss as aH,Ps as aI,Na as aJ,pr as aK,tl as aa,ys as ab,zs as ac,wf as ad,_f as ae,vf as af,Ic as ag,Au as ah,cd as ai,$n as aj,hf as ak,kr as al,un as am,cn as an,ln as ao,dn as ap,tp as aq,Zm as ar,Ei as as,$i as at,tf as au,Ii as av,ea as aw,rf as ax,of as ay,nf as az,nt as b,Am as c,na as d,rt as e,n as f,nr as g,Xm as h,D as i,gt as j,bf as k,zd as l,Sf as m,Pf as n,Rt as o,Jp as p,Wp as q,Zp as r,Qp as s,kf as t,Me as u,zn as v,cf as w,wm as x,lf as y,_ as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.