fix: align user action buttons, add json/yaml support for plugin config, improve formatTrafficSize, show processed commission

- Aligned user action buttons in dropdown for consistent UI.
- Added JSON and YAML support in plugin config form with Monaco Editor and resizable height.
- Improved formatTrafficSize to handle large numbers and prevent undefined units.
- Order detail now shows commission info when commission_status is 1 or 2.
This commit is contained in:
xboard committed 2025-07-21 23:52:07 +08:00
1 parent dcd1d64bbd
commit a0e09f1c3a
2 files changed
+14 -14

No files matched your search

+1 -1
View File
@@ -1 +1 @@
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--header-height: 4rem;--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreLine truncated
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--header-height: 4rem;--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreLine truncated
+13 -13
View File
@@ -1,21 +1,21 @@
import{r as m,j as e,t as eo,c as so,I as Xt,a as xt,S as Tn,u as Bs,b as to,d as Dn,R as kr,e as Tr,f as ao,F as no,C as ro,L as Dr,T as Fr,g as Pr,h as lo,i as io,k as oo,l as co,m as $,z as h,n as M,o as we,p as Te,q as ae,s as Is,v as Ee,w as mo,x as uo,O as Fn,y as xo,A as ho,B as go,D as po,E as fo,G as jo,Q as vo,H as bo,J as yo,K as _o,P as No,M as wo,N as Co,U as So,V as ko,W as Rr,X as Lr,Y as Va,Z as Ia,_ as Pn,$ as os,a0 as Ma,a1 as Oa,a2 as Er,a3 as Vr,a4 as Ir,a5 as Mr,a6 as Or,a7 as To,a8 as zr,a9 as $r,aa as Ar,ab as qr,ac as ht,ad as Ur,ae as Do,af as Hr,ag as Kr,ah as Fo,ai as Po,aj as Ro,ak as Lo,al as Eo,am as Vo,an as Io,ao as Mo,ap as Oo,aq as zo,ar as Br,as as $o,at as Ao,au as Zs,av as Gr,aw as qo,ax as Uo,ay as Wr,az as Rn,aA as Ho,aB as Ko,aC as sr,aD as Bo,aE as Yr,aF as Go,aG as Jr,aH as Wo,aI as Yo,aJ as Jo,aK as Qo,aL as Xo,aM as Zo,aN as ec,aO as Qr,aP as sc,aQ as tc,aR as ac,aS as xs,aT as nc,aU as Ln,aV as rc,aW as lc,aX as Xr,aY as Zr,aZ as el,a_ as ic,a$ as oc,b0 as cc,b1 as sl,b2 as dc,b3 as En,b4 as tl,b5 as mc,b6 as al,b7 as uc,b8 as nl,b9 as xc,ba as rl,bb as ll,bc as hc,bd as gc,be as il,bf as pc,bg as ol,bh as fc,bi as cl,bj as dl,bk as ml,bl as jc,bm as ul,bn as vc,bo as bc,bp as Es,bq as Re,br as ws,bs as yc,bt as _c,bu as Nc,bv as wc,bw as Cc,bx as Sc,by as tr,bz as ar,bA as kc,bB as Tc,bC as Vn,bD as Dc,bE as Fc,bF as wa,bG as Dt,bH as Zt,bI as Pc,bJ as xl,bK as Rc,bL as Lc,bM as hl,bN as Ec,bO as Vc,bP as nr,bQ as jn,bR as vn,bS as Ic,bT as Mc,bU as gl,bV as Oc,bW as zc,bX as $c,bY as Ac,bZ as Ca,b_ as bn,b$ as Be,c0 as Sa,c1 as qc,c2 as nn,c3 as Uc,c4 as yn,c5 as us,c6 as Kt,c7 as Bt,c8 as _n,c9 as pl,ca as Ge,cb as Ze,cc as fl,cd as jl,ce as Hc,cf as Kc,cg as Bc,ch as Gc,ci as Wc,cj as vl,ck as Yc,cl as Jc,cm as Ke,cn as rr,co as Qc,cp as bl,cq as yl,cr as _l,cs as Nl,ct as wl,cu as Cl,cv as Xc,cw as Zc,cx as ed,cy as za,cz as tt,cA as hs,cB as gs,cC as sd,cD as td,cE as ad,cF as nd,cG as rd,cH as ka,cI as ld,cJ as id,cK as Nn,cL as In,cM as Mn,cN as od,cO as Fs,cP as Ps,cQ as $a,cR as cd,cS as Ta,cT as dd,cU as lr,cV as Sl,cW as ir,cX as Da,cY as md,cZ as kl,c_ as ud,c$ as xd,d0 as hd,d1 as Tl,d2 as gd,d3 as pd,d4 as Dl,d5 as wn,d6 as Fl,d7 as fd,d8 as Cn,d9 as Pl,da as jd,db as vd,dc as bd,dd as Rl,de as yd,df as _d,dg as Ll,dh as Gt,di as On,dj as Nd,dk as or,dl as El,dm as wd,dn as cr,dp as Cd,dq as Sd}from"./vendor.js";import"./index.js";var np=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rp(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function kd(s){if(s.__esModule)return s;var n=s.default;if(typeof n=="function"){var t=function r(){return this instanceof r?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var a=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return s[r]}})}),t}const Td={theme:"system",setTheme:()=>null},Vl=m.createContext(Td);function Dd({children:s,defaultTheme:n="system",storageKey:t="vite-ui-theme",...r}){const[a,i]=m.useState(()=>localStorage.getItem(t)||n);m.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),a==="system"){const u=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(u);return}d.classList.add(a)},[a]);const l={theme:a,setTheme:d=>{localStorage.setItem(t,d),i(d)}};return e.jsx(Vl.Provider,{...r,value:l,children:s})}const Fd=()=>{const s=m.useContext(Vl);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},Pd=function(){const n=typeof document<"u"&&document.createElement("link").relList;return n&&n.supports&&n.supports("modulepreload")?"modulepreload":"preload"}(),Rd=function(s,n){return new URL(s,n).href},dr={},Ne=function(n,t,r){let a=Promise.resolve();if(t&&t.length>0){const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),u=d?.nonce||d?.getAttribute("nonce");a=Promise.allSettled(t.map(x=>{if(x=Rd(x,r),x in dr)return;dr[x]=!0;const o=x.endsWith(".css"),c=o?'[rel="stylesheet"]':"";if(!!r)for(let S=l.length-1;S>=0;S--){const w=l[S];if(w.href===x&&(!o||w.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${x}"]${c}`))return;const F=document.createElement("link");if(F.rel=o?"stylesheet":Pd,o||(F.as="script"),F.crossOrigin="",F.href=x,u&&F.setAttribute("nonce",u),document.head.appendChild(F),o)return new Promise((S,w)=>{F.addEventListener("load",S),F.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${x}`)))})}))}function i(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return a.then(l=>{for(const d of l||[])d.status==="rejected"&&i(d.reason);Line truncated
`)[0]})}),e.jsx(ue,{className:"max-w-[300px] whitespace-pre-wrap",children:e.jsx("span",{children:B.original.exception})})]})})}),qt.display({id:"actions",header:()=>s("dashboard:queue.details.action"),size:80,cell:({row:B})=>e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>Wi(B.original),"aria-label":s("dashboard:queue.details.viewDetail"),children:e.jsx(bn,{className:"h-4 w-4"})})})],[s]),Zn=Be({data:Xn,columns:Hi,getCoreRowModel:Ge(),getPaginationRowModel:Ze(),pageCount:Math.ceil(Ui/d),manualPagination:!0,state:{pagination:{pageIndex:i-1,pageSize:d}},onPaginationChange:B=>{if(typeof B=="function"){const Ls=B({pageIndex:i-1,pageSize:d});er(Ls.pageIndex+1)}else er(B.pageIndex+1)}}),Ki=()=>{t(B=>B+1)},er=B=>{l(B)},oa=B=>{w(B)},ca=B=>{y(B),w(1)},Bi=B=>{se(B),w(1)},Gi=()=>{E(""),K(""),se("all"),w(1)},da=B=>{C(B),p(!0)},Wi=B=>{x(B),c(!0)},Yi=async()=>{try{const B=await ve.getLogClearStats({days:ee,level:fs==="all"?void 0:fs});Et(B.data),Vt(!0)}catch(B){console.error("Failed to get clear stats:",B),$.error(s("dashboard:systemLog.getStatsFailed"))}},Ji=async()=>{lt(!0);try{const{data:B}=await ve.clearSystemLog({days:ee,level:fs==="all"?void 0:fs,limit:re});B&&($.success(s("dashboard:systemLog.clearSuccess",{count:B.cleared_count}),{duration:3e3}),H(!1),Vt(!1),Et(null),ye())}catch(B){console.error("Failed to clear logs:",B),$.error(s("dashboard:systemLog.clearLogsFailed"))}finally{lt(!1)}};if(te||zi)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(Sa,{className:"h-6 w-6 animate-spin"})});const Qi=B=>B?e.jsx(fl,{className:"h-5 w-5 text-green-500"}):e.jsx(jl,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(ke,{children:[e.jsxs(Fe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx(qc,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Hs,{children:s("dashboard:queue.status.description")})]}),e.jsx(G,{variant:"outline",size:"icon",onClick:Ki,disabled:Ye||Yn,children:e.jsx(nn,{className:N("h-4 w-4",(Ye||Yn)&&"animate-spin")})})]}),e.jsx(Pe,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Qi(_e?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(U,{variant:_e?.status?"secondary":"destructive",children:_e?.status?s("dashboard:queue.status.normal"):s("dashboard:queue.status.abnormal")})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.status.waitTime",{seconds:_e?.wait?.default||0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(be,{children:e.jsxs(ge,{children:[e.jsx(pe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.recentJobs")}),e.jsx("p",{className:"text-2xl font-bold",children:_e?.recentJobs||0}),e.jsx(ba,{value:(_e?.recentJobs||0)/(_e?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ue,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:_e?.periods?.recentJobs||0})})})]})}),e.jsx(be,{children:e.jsxs(ge,{children:[e.jsx(pe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.jobsPerMinute")}),e.jsx("p",{className:"text-2xl font-bold",children:_e?.jobsPerMinute||0}),e.jsx(ba,{value:(_e?.jobsPerMinute||0)/(_e?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ue,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:_e?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(ke,{children:[e.jsxs(Fe,{children:[e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx(Uc,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Hs,{children:s("dashboard:queue.details.description")})]}),e.jsx(Pe,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.failedJobs7Days")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"cursor-pointer text-2xl font-bold text-destructive hover:underline",title:s("dashboard:queue.details.viewFailedJobs"),onClick:()=>a(!0),style:{userSelect:"none"},children:_e?.failedJobs||0}),e.jsx(bn,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-destructive",onClick Line truncated
import{r as m,j as e,t as so,c as to,I as Xt,a as xt,S as Dn,u as Bs,b as ao,d as Pn,R as Tr,e as Dr,f as no,F as ro,C as lo,L as Pr,T as Lr,g as Fr,h as io,i as oo,k as co,l as mo,m as $,z as h,n as M,o as we,p as Te,q as ne,s as Is,v as Ee,w as jn,x as uo,O as Ln,y as xo,A as ho,B as go,D as po,E as fo,G as jo,Q as vo,H as bo,J as yo,K as _o,P as No,M as wo,N as Co,U as So,V as ko,W as Rr,X as Er,Y as Va,Z as Ia,_ as Fn,$ as os,a0 as Ma,a1 as Oa,a2 as Vr,a3 as Ir,a4 as Mr,a5 as Or,a6 as zr,a7 as To,a8 as $r,a9 as Ar,aa as qr,ab as Hr,ac as ht,ad as Ur,ae as Do,af as Kr,ag as Br,ah as Po,ai as Lo,aj as Fo,ak as Ro,al as Eo,am as Vo,an as Io,ao as Mo,ap as Oo,aq as zo,ar as Gr,as as $o,at as Ao,au as Zs,av as Yr,aw as qo,ax as Ho,ay as Wr,az as Rn,aA as Uo,aB as Ko,aC as tr,aD as Bo,aE as Jr,aF as Go,aG as Qr,aH as Yo,aI as Wo,aJ as Jo,aK as Qo,aL as Xo,aM as Zo,aN as ec,aO as Xr,aP as sc,aQ as tc,aR as ac,aS as xs,aT as nc,aU as En,aV as rc,aW as lc,aX as Zr,aY as el,aZ as sl,a_ as ic,a$ as oc,b0 as cc,b1 as tl,b2 as dc,b3 as Vn,b4 as al,b5 as mc,b6 as nl,b7 as uc,b8 as rl,b9 as xc,ba as ll,bb as il,bc as hc,bd as gc,be as ol,bf as pc,bg as cl,bh as fc,bi as dl,bj as ml,bk as ul,bl as jc,bm as xl,bn as vc,bo as bc,bp as Es,bq as Fe,br as ws,bs as yc,bt as _c,bu as Nc,bv as wc,bw as Cc,bx as Sc,by as ar,bz as nr,bA as kc,bB as Tc,bC as In,bD as Dc,bE as Pc,bF as wa,bG as Dt,bH as Zt,bI as Lc,bJ as hl,bK as Fc,bL as Rc,bM as gl,bN as Ec,bO as Vc,bP as rr,bQ as vn,bR as bn,bS as Ic,bT as Mc,bU as pl,bV as Oc,bW as zc,bX as $c,bY as Ac,bZ as Ca,b_ as yn,b$ as Be,c0 as Sa,c1 as qc,c2 as nn,c3 as Hc,c4 as _n,c5 as us,c6 as Kt,c7 as Bt,c8 as Nn,c9 as fl,ca as Ge,cb as Ze,cc as jl,cd as vl,ce as Uc,cf as Kc,cg as Bc,ch as Gc,ci as Yc,cj as bl,ck as Wc,cl as Jc,cm as Ke,cn as lr,co as Qc,cp as yl,cq as _l,cr as Nl,cs as wl,ct as Cl,cu as Sl,cv as Xc,cw as Zc,cx as ed,cy as za,cz as tt,cA as hs,cB as gs,cC as sd,cD as td,cE as ad,cF as nd,cG as rd,cH as ka,cI as ld,cJ as id,cK as wn,cL as Mn,cM as On,cN as od,cO as Ps,cP as Ls,cQ as $a,cR as cd,cS as Ta,cT as dd,cU as ir,cV as kl,cW as or,cX as Da,cY as md,cZ as Tl,c_ as ud,c$ as xd,d0 as hd,d1 as Dl,d2 as gd,d3 as pd,d4 as Pl,d5 as Cn,d6 as Ll,d7 as fd,d8 as Sn,d9 as Fl,da as jd,db as vd,dc as bd,dd as Rl,de as yd,df as _d,dg as El,dh as Gt,di as zn,dj as Nd,dk as cr,dl as Vl,dm as wd,dn as dr,dp as Cd,dq as Sd}from"./vendor.js";import"./index.js";var np=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rp(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function kd(s){if(s.__esModule)return s;var n=s.default;if(typeof n=="function"){var t=function r(){return this instanceof r?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var a=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return s[r]}})}),t}const Td={theme:"system",setTheme:()=>null},Il=m.createContext(Td);function Dd({children:s,defaultTheme:n="system",storageKey:t="vite-ui-theme",...r}){const[a,i]=m.useState(()=>localStorage.getItem(t)||n);m.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),a==="system"){const u=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(u);return}d.classList.add(a)},[a]);const l={theme:a,setTheme:d=>{localStorage.setItem(t,d),i(d)}};return e.jsx(Il.Provider,{...r,value:l,children:s})}const Pd=()=>{const s=m.useContext(Il);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},Ld=function(){const n=typeof document<"u"&&document.createElement("link").relList;return n&&n.supports&&n.supports("modulepreload")?"modulepreload":"preload"}(),Fd=function(s,n){return new URL(s,n).href},mr={},Ne=function(n,t,r){let a=Promise.resolve();if(t&&t.length>0){const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),u=d?.nonce||d?.getAttribute("nonce");a=Promise.allSettled(t.map(x=>{if(x=Fd(x,r),x in mr)return;mr[x]=!0;const o=x.endsWith(".css"),c=o?'[rel="stylesheet"]':"";if(!!r)for(let k=l.length-1;k>=0;k--){const C=l[k];if(C.href===x&&(!o||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${x}"]${c}`))return;const P=document.createElement("link");if(P.rel=o?"stylesheet":Ld,o||(P.as="script"),P.crossOrigin="",P.href=x,u&&P.setAttribute("nonce",u),document.head.appendChild(P),o)return new Promise((k,C)=>{P.addEventListener("load",k),P.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${x}`)))})}))}function i(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return a.then(l=>{for(const d of l||[])d.status==="rejected"&&i(d.reason);Line truncated
`)[0]})}),e.jsx(ue,{className:"max-w-[300px] whitespace-pre-wrap",children:e.jsx("span",{children:B.original.exception})})]})})}),qt.display({id:"actions",header:()=>s("dashboard:queue.details.action"),size:80,cell:({row:B})=>e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>Wi(B.original),"aria-label":s("dashboard:queue.details.viewDetail"),children:e.jsx(yn,{className:"h-4 w-4"})})})],[s]),er=Be({data:Zn,columns:Ki,getCoreRowModel:Ge(),getPaginationRowModel:Ze(),pageCount:Math.ceil(Ui/d),manualPagination:!0,state:{pagination:{pageIndex:i-1,pageSize:d}},onPaginationChange:B=>{if(typeof B=="function"){const Rs=B({pageIndex:i-1,pageSize:d});sr(Rs.pageIndex+1)}else sr(B.pageIndex+1)}}),Bi=()=>{t(B=>B+1)},sr=B=>{l(B)},oa=B=>{C(B)},ca=B=>{p(B),C(1)},Gi=B=>{se(B),C(1)},Yi=()=>{E(""),K(""),se("all"),C(1)},da=B=>{N(B),f(!0)},Wi=B=>{x(B),c(!0)},Ji=async()=>{try{const B=await ve.getLogClearStats({days:ee,level:fs==="all"?void 0:fs});Et(B.data),Vt(!0)}catch(B){console.error("Failed to get clear stats:",B),$.error(s("dashboard:systemLog.getStatsFailed"))}},Qi=async()=>{lt(!0);try{const{data:B}=await ve.clearSystemLog({days:ee,level:fs==="all"?void 0:fs,limit:re});B&&($.success(s("dashboard:systemLog.clearSuccess",{count:B.cleared_count}),{duration:3e3}),q(!1),Vt(!1),Et(null),ye())}catch(B){console.error("Failed to clear logs:",B),$.error(s("dashboard:systemLog.clearLogsFailed"))}finally{lt(!1)}};if(ae||$i)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(Sa,{className:"h-6 w-6 animate-spin"})});const Xi=B=>B?e.jsx(jl,{className:"h-5 w-5 text-green-500"}):e.jsx(vl,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(ke,{children:[e.jsxs(Pe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Re,{className:"flex items-center gap-2",children:[e.jsx(qc,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Us,{children:s("dashboard:queue.status.description")})]}),e.jsx(G,{variant:"outline",size:"icon",onClick:Bi,disabled:We||Jn,children:e.jsx(nn,{className:w("h-4 w-4",(We||Jn)&&"animate-spin")})})]}),e.jsx(Le,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Xi(_e?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(U,{variant:_e?.status?"secondary":"destructive",children:_e?.status?s("dashboard:queue.status.normal"):s("dashboard:queue.status.abnormal")})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.status.waitTime",{seconds:_e?.wait?.default||0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(be,{children:e.jsxs(ge,{children:[e.jsx(pe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.recentJobs")}),e.jsx("p",{className:"text-2xl font-bold",children:_e?.recentJobs||0}),e.jsx(ba,{value:(_e?.recentJobs||0)/(_e?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ue,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:_e?.periods?.recentJobs||0})})})]})}),e.jsx(be,{children:e.jsxs(ge,{children:[e.jsx(pe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.jobsPerMinute")}),e.jsx("p",{className:"text-2xl font-bold",children:_e?.jobsPerMinute||0}),e.jsx(ba,{value:(_e?.jobsPerMinute||0)/(_e?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ue,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:_e?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(ke,{children:[e.jsxs(Pe,{children:[e.jsxs(Re,{className:"flex items-center gap-2",children:[e.jsx(Hc,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Us,{children:s("dashboard:queue.details.description")})]}),e.jsx(Le,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.failedJobs7Days")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"cursor-pointer text-2xl font-bold text-destructive hover:underline",title:s("dashboard:queue.details.viewFailedJobs"),onClick:()=>a(!0),style:{userSelect:"none"},children:_e?.failedJobs||0}),e.jsx(yn,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-destructive",onClick Line truncated
File: ${Xi}
Line: ${Zi}`}return JSON.stringify(B,null,2)}catch{return L.context}})()})})]})]}),e.jsx(Me,{children:e.jsx(Qs,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common:close")})})})]})}),e.jsx(de,{open:ne,onOpenChange:H,children:e.jsxs(ce,{className:"max-w-2xl",children:[e.jsx(he,{children:e.jsxs(me,{className:"flex items-center gap-2",children:[e.jsx(us,{className:"h-5 w-5 text-destructive"}),s("dashboard:systemLog.clearLogs")]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{htmlFor:"clearDays",children:s("dashboard:systemLog.clearDays")}),e.jsx(k,{id:"clearDays",type:"number",min:"0",max:"365",value:ee,onChange:B=>{const Ls=B.target.value;if(Ls==="")fe(0);else{const vt=parseInt(Ls);!isNaN(vt)&&vt>=0&&vt<=365&&fe(vt)}},placeholder:"0"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearDaysDesc")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{htmlFor:"clearLevel",children:s("dashboard:systemLog.clearLevel")}),e.jsxs(J,{value:fs,onValueChange:Ie,children:[e.jsx(W,{children:e.jsx(Q,{})}),e.jsxs(Y,{children:[e.jsx(A,{value:"all",children:s("dashboard:systemLog.tabs.all")}),e.jsx(A,{value:"info",children:s("dashboard:systemLog.tabs.info")}),e.jsx(A,{value:"warning",children:s("dashboard:systemLog.tabs.warning")}),e.jsx(A,{value:"error",children:s("dashboard:systemLog.tabs.error")})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{htmlFor:"clearLimit",children:s("dashboard:systemLog.clearLimit")}),e.jsx(k,{id:"clearLimit",type:"number",min:"100",max:"10000",value:re,onChange:B=>q(parseInt(B.target.value)||1e3),placeholder:"1000"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearLimitDesc")})]})]}),e.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-900 dark:bg-amber-950/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vn,{className:"h-5 w-5 text-amber-600"}),e.jsx("span",{className:"font-medium text-amber-800 dark:text-amber-200",children:s("dashboard:systemLog.clearPreview")})]}),e.jsxs(G,{variant:"outline",size:"sm",onClick:Yi,disabled:oe,children:[e.jsx(ws,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.getStats")]})]}),na&&$s&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.cutoffDate")}),e.jsx("p",{className:"font-mono text-sm",children:$s.cutoff_date})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.totalLogs")}),e.jsx("p",{className:"font-mono text-sm font-medium",children:$s.total_logs.toLocaleString()})]})]}),e.jsxs("div",{className:"rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Bt,{className:"h-4 w-4 text-red-600"}),e.jsxs("span",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:[s("dashboard:systemLog.willClear"),":",e.jsx("span",{className:"ml-1 font-bold",children:$s.logs_to_clear.toLocaleString()}),s("dashboard:systemLog.logsUnit")]})]}),e.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-300",children:s("dashboard:systemLog.clearWarning")})]})]})]})]}),e.jsxs(Me,{children:[e.jsx(G,{variant:"outline",onClick:()=>{H(!1),Vt(!1),Et(null)},children:s("common:cancel")}),e.jsx(G,{variant:"destructive",onClick:Ji,disabled:oe||!na||!$s,children:oe?e.jsxs(e.Fragment,{children:[e.jsx(Sa,{className:"mr-2 h-4 w-4 animate-spin"}),s("dashboard:systemLog.clearing")]}):e.jsxs(e.Fragment,{children:[e.jsx(us,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.confirmClear")]})})]})]})})]})}function Um(){const{t:s}=M();return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:s("dashboard:title")})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(cs,{}),e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsx(We,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Mm,{}),e.jsx(Rm,{}),e.jsx(Om,{}),e.jsx(qm,{})]})})})]})}const Hm=Object.freeze(Object.defineProperty({__proto__:null,default:Um},Symbol.toStringTag,{value:"Module"}));function Km({className:s,items:n,...t}){const{pathname:r}=Dn(),a=Bs(),[i,l]=m.useState(r??"/settings"),d=x=>{l(x),a(x)},{t:u}=M("settings");return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(J,{value:i,onValueChange:d,children:[e.jsx(W,{className:"h-12 sm:w-48",children:e.jsx(Q,{placeholder:"The Line truncated
`),onChange:f=>{const F=f.target.value.split(`
`).filter(Boolean);c.onChange(F),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.emailWhitelist.suffixes.description")}),e.jsx(R,{})]})}),e.jsx(v,{control:l.control,name:"captcha_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.enable.label")}),e.jsx(z,{children:s("safe.form.captcha.enable.description")})]}),e.jsx(_,{children:e.jsx(X,{checked:c.value||!1,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),l.watch("captcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"captcha_type",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.type.label")}),e.jsxs(J,{onValueChange:f=>{c.onChange(f),o(l.getValues())},value:c.value||"recaptcha",children:[e.jsx(_,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:s("safe.form.captcha.type.description")})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"recaptcha",children:s("safe.form.captcha.type.options.recaptcha")}),e.jsx(A,{value:"recaptcha-v3",children:s("safe.form.captcha.type.options.recaptcha-v3")}),e.jsx(A,{value:"turnstile",children:s("safe.form.captcha.type.options.turnstile")})]})]}),e.jsx(z,{children:s("safe.form.captcha.type.description")}),e.jsx(R,{})]})}),l.watch("captcha_type")==="recaptcha"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"recaptcha_site_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.recaptcha.siteKey.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.captcha.recaptcha.siteKey.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.recaptcha.siteKey.description")}),e.jsx(R,{})]})}),e.jsx(v,{control:l.control,name:"recaptcha_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.recaptcha.key.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.captcha.recaptcha.key.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.recaptcha.key.description")}),e.jsx(R,{})]})})]}),l.watch("captcha_type")==="recaptcha-v3"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"recaptcha_v3_site_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.siteKey.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.captcha.recaptcha_v3.siteKey.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.recaptcha_v3.siteKey.description")}),e.jsx(R,{})]})}),e.jsx(v,{control:l.control,name:"recaptcha_v3_secret_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.secretKey.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.captcha.recaptcha_v3.secretKey.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.recaptcha_v3.secretKey.description")}),e.jsx(R,{})]})}),e.jsx(v,{control:l.control,name:"recaptcha_v3_score_threshold",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.scoreThreshold.label")}),e.jsx(_,{children:e.jsx(k,{type:"number",step:"0.1",min:"0",max:"1",placeholder:s("safe.form.captcha.recaptcha_v3.scoreThreshold.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.recaptcha_v3.scoreThreshold.description")}),e.jsx(R,{})]})})]}),l.watch("captcha_type")==="turnstile"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"turnstile_site_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.turnstile.siteKey.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.captcha.turnstile.siteKey.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.turnstile.siteKey.description")}),e.jsx(R,{})]})}),e.jsx(v,{control:l.control,name:"turnstile_secret_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.turnstile.secretKey.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("safe.form.captcha.turnstile.secretKey.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.turnstile.secretKey.description")}),e.jsx(R,{})]})})]})]}),e.jsx(v,{control:l.control,name:"register_limit_by_ip_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx(z,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(_, Line truncated
File: ${Zi}
Line: ${eo}`}return JSON.stringify(B,null,2)}catch{return S.context}})()})})]})]}),e.jsx(Me,{children:e.jsx(Qs,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common:close")})})})]})}),e.jsx(de,{open:te,onOpenChange:q,children:e.jsxs(ce,{className:"max-w-2xl",children:[e.jsx(he,{children:e.jsxs(me,{className:"flex items-center gap-2",children:[e.jsx(us,{className:"h-5 w-5 text-destructive"}),s("dashboard:systemLog.clearLogs")]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{htmlFor:"clearDays",children:s("dashboard:systemLog.clearDays")}),e.jsx(D,{id:"clearDays",type:"number",min:"0",max:"365",value:ee,onChange:B=>{const Rs=B.target.value;if(Rs==="")fe(0);else{const vt=parseInt(Rs);!isNaN(vt)&&vt>=0&&vt<=365&&fe(vt)}},placeholder:"0"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearDaysDesc")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{htmlFor:"clearLevel",children:s("dashboard:systemLog.clearLevel")}),e.jsxs(J,{value:fs,onValueChange:Ie,children:[e.jsx(Y,{children:e.jsx(Q,{})}),e.jsxs(W,{children:[e.jsx(A,{value:"all",children:s("dashboard:systemLog.tabs.all")}),e.jsx(A,{value:"info",children:s("dashboard:systemLog.tabs.info")}),e.jsx(A,{value:"warning",children:s("dashboard:systemLog.tabs.warning")}),e.jsx(A,{value:"error",children:s("dashboard:systemLog.tabs.error")})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{htmlFor:"clearLimit",children:s("dashboard:systemLog.clearLimit")}),e.jsx(D,{id:"clearLimit",type:"number",min:"100",max:"10000",value:re,onChange:B=>H(parseInt(B.target.value)||1e3),placeholder:"1000"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearLimitDesc")})]})]}),e.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-900 dark:bg-amber-950/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(In,{className:"h-5 w-5 text-amber-600"}),e.jsx("span",{className:"font-medium text-amber-800 dark:text-amber-200",children:s("dashboard:systemLog.clearPreview")})]}),e.jsxs(G,{variant:"outline",size:"sm",onClick:Ji,disabled:oe,children:[e.jsx(ws,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.getStats")]})]}),na&&$s&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.cutoffDate")}),e.jsx("p",{className:"font-mono text-sm",children:$s.cutoff_date})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.totalLogs")}),e.jsx("p",{className:"font-mono text-sm font-medium",children:$s.total_logs.toLocaleString()})]})]}),e.jsxs("div",{className:"rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Bt,{className:"h-4 w-4 text-red-600"}),e.jsxs("span",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:[s("dashboard:systemLog.willClear"),":",e.jsx("span",{className:"ml-1 font-bold",children:$s.logs_to_clear.toLocaleString()}),s("dashboard:systemLog.logsUnit")]})]}),e.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-300",children:s("dashboard:systemLog.clearWarning")})]})]})]})]}),e.jsxs(Me,{children:[e.jsx(G,{variant:"outline",onClick:()=>{q(!1),Vt(!1),Et(null)},children:s("common:cancel")}),e.jsx(G,{variant:"destructive",onClick:Qi,disabled:oe||!na||!$s,children:oe?e.jsxs(e.Fragment,{children:[e.jsx(Sa,{className:"mr-2 h-4 w-4 animate-spin"}),s("dashboard:systemLog.clearing")]}):e.jsxs(e.Fragment,{children:[e.jsx(us,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.confirmClear")]})})]})]})})]})}function Hm(){const{t:s}=M();return e.jsxs(qe,{children:[e.jsxs(He,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:s("dashboard:title")})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(cs,{}),e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsx(Ye,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Mm,{}),e.jsx(Fm,{}),e.jsx(Om,{}),e.jsx(qm,{})]})})})]})}const Um=Object.freeze(Object.defineProperty({__proto__:null,default:Hm},Symbol.toStringTag,{value:"Module"}));function Km({className:s,items:n,...t}){const{pathname:r}=Pn(),a=Bs(),[i,l]=m.useState(r??"/settings"),d=x=>{l(x),a(x)},{t:u}=M("settings");return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(J,{value:i,onValueChange:d,children:[e.jsx(Y,{className:"h-12 sm:w-48",children:e.jsx(Q,{placeholder:"The Line truncated
`),onChange:j=>{const P=j.target.value.split(`
`).filter(Boolean);c.onChange(P),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.emailWhitelist.suffixes.description")}),e.jsx(R,{})]})}),e.jsx(b,{control:l.control,name:"captcha_enable",render:({field:c})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.captcha.enable.label")}),e.jsx(z,{children:s("safe.form.captcha.enable.description")})]}),e.jsx(_,{children:e.jsx(Z,{checked:c.value||!1,onCheckedChange:j=>{c.onChange(j),o(l.getValues())}})})]})}),l.watch("captcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:l.control,name:"captcha_type",render:({field:c})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.captcha.type.label")}),e.jsxs(J,{onValueChange:j=>{c.onChange(j),o(l.getValues())},value:c.value||"recaptcha",children:[e.jsx(_,{children:e.jsx(Y,{children:e.jsx(Q,{placeholder:s("safe.form.captcha.type.description")})})}),e.jsxs(W,{children:[e.jsx(A,{value:"recaptcha",children:s("safe.form.captcha.type.options.recaptcha")}),e.jsx(A,{value:"recaptcha-v3",children:s("safe.form.captcha.type.options.recaptcha-v3")}),e.jsx(A,{value:"turnstile",children:s("safe.form.captcha.type.options.turnstile")})]})]}),e.jsx(z,{children:s("safe.form.captcha.type.description")}),e.jsx(R,{})]})}),l.watch("captcha_type")==="recaptcha"&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:l.control,name:"recaptcha_site_key",render:({field:c})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.captcha.recaptcha.siteKey.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.captcha.recaptcha.siteKey.placeholder"),...c,value:c.value||"",onChange:j=>{c.onChange(j),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.recaptcha.siteKey.description")}),e.jsx(R,{})]})}),e.jsx(b,{control:l.control,name:"recaptcha_key",render:({field:c})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.captcha.recaptcha.key.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.captcha.recaptcha.key.placeholder"),...c,value:c.value||"",onChange:j=>{c.onChange(j),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.recaptcha.key.description")}),e.jsx(R,{})]})})]}),l.watch("captcha_type")==="recaptcha-v3"&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:l.control,name:"recaptcha_v3_site_key",render:({field:c})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.siteKey.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.captcha.recaptcha_v3.siteKey.placeholder"),...c,value:c.value||"",onChange:j=>{c.onChange(j),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.recaptcha_v3.siteKey.description")}),e.jsx(R,{})]})}),e.jsx(b,{control:l.control,name:"recaptcha_v3_secret_key",render:({field:c})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.secretKey.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.captcha.recaptcha_v3.secretKey.placeholder"),...c,value:c.value||"",onChange:j=>{c.onChange(j),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.recaptcha_v3.secretKey.description")}),e.jsx(R,{})]})}),e.jsx(b,{control:l.control,name:"recaptcha_v3_score_threshold",render:({field:c})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.scoreThreshold.label")}),e.jsx(_,{children:e.jsx(D,{type:"number",step:"0.1",min:"0",max:"1",placeholder:s("safe.form.captcha.recaptcha_v3.scoreThreshold.placeholder"),...c,value:c.value||"",onChange:j=>{c.onChange(j),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.recaptcha_v3.scoreThreshold.description")}),e.jsx(R,{})]})})]}),l.watch("captcha_type")==="turnstile"&&e.jsxs(e.Fragment,{children:[e.jsx(b,{control:l.control,name:"turnstile_site_key",render:({field:c})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.captcha.turnstile.siteKey.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.captcha.turnstile.siteKey.placeholder"),...c,value:c.value||"",onChange:j=>{c.onChange(j),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.turnstile.siteKey.description")}),e.jsx(R,{})]})}),e.jsx(b,{control:l.control,name:"turnstile_secret_key",render:({field:c})=>e.jsxs(v,{children:[e.jsx(y,{className:"text-base",children:s("safe.form.captcha.turnstile.secretKey.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("safe.form.captcha.turnstile.secretKey.placeholder"),...c,value:c.value||"",onChange:j=>{c.onChange(j),o(l.getValues())}})}),e.jsx(z,{children:s("safe.form.captcha.turnstile.secretKey.description")}),e.jsx(R,{})]})})]})]}),e.jsx(b,{control:l.control,name:"register_limit_by_ip_enable",render:({field:c})=>e.jsxs(v,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(y,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx(z,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(_, Line truncated
stop=8
0=30-30
1=100-400
2=400-500,c,500-1000`),...g,value:Array.isArray(g.value)?g.value.join(`
`):"",onChange:p=>{const E=p.target.value.split(`
`).filter(P=>P.trim()!=="");g.onChange(E)}})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"tls.server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.anytls.tls.server_name.label","SNI")}),e.jsx(_,{children:e.jsx(k,{placeholder:r("dynamic_form.anytls.tls.server_name.placeholder","服务器名称"),...g})})]})}),e.jsx(v,{control:d.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.anytls.tls.allow_insecure","允许不安全连接")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(X,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]})})};return e.jsx(be,{children:C[s]?.()})};function Mx(){const{t:s}=M("server"),n=h.object({start:h.string().min(1,s("form.dynamic_rate.start_time_error")),end:h.string().min(1,s("form.dynamic_rate.end_time_error")),rate:h.string().min(1,s("form.dynamic_rate.multiplier_error")).refine(E=>!isNaN(parseFloat(E))&&isFinite(Number(E)),{message:s("form.dynamic_rate.multiplier_error_numeric")}).refine(E=>parseFloat(E)>=0,{message:s("form.dynamic_rate.multiplier_error_gte_zero")})}),t=h.object({id:h.number().optional().nullable(),specific_key:h.string().optional().nullable(),code:h.string().optional(),show:h.boolean().optional().nullable(),name:h.string().min(1,s("form.name.error")),rate:h.string().min(1,s("form.rate.error")).refine(E=>!isNaN(parseFloat(E))&&isFinite(Number(E)),{message:s("form.rate.error_numeric")}).refine(E=>parseFloat(E)>=0,{message:s("form.rate.error_gte_zero")}),rate_time_enable:h.boolean().default(!1),rate_time_ranges:h.array(n).default([]),tags:h.array(h.string()).default([]),excludes:h.array(h.string()).default([]),ips:h.array(h.string()).default([]),group_ids:h.array(h.string()).default([]),host:h.string().min(1,s("form.host.error")),port:h.string().min(1,s("form.port.error")),server_port:h.string().min(1,s("form.server_port.error")),parent_id:h.string().default("0").nullable(),route_ids:h.array(h.string()).default([]),protocol_settings:h.record(h.any()).default({}).nullable()}),r={id:null,specific_key:null,code:"",show:!1,name:"",rate:"1",rate_time_enable:!1,rate_time_ranges:[],tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null},{isOpen:a,setIsOpen:i,editingServer:l,setEditingServer:d,serverType:u,setServerType:x,refetch:o}=gi(),[c,f]=m.useState([]),[F,S]=m.useState([]),[w,T]=m.useState([]),y=we({resolver:Te(t),defaultValues:r,mode:"onChange"});m.useEffect(()=>{L()},[a]),m.useEffect(()=>{l?.type&&l.type!==u&&x(l.type)},[l,u,x]),m.useEffect(()=>{l?l.type===u&&y.reset({...r,...l}):y.reset({...r,protocol_settings:Oe[u].schema.parse({})})},[l,y,u]);const L=async()=>{if(!a)return;const[E,P,K]=await Promise.all([pt.getList(),qa.getList(),dt.getList()]);f(E.data?.map(Z=>({label:Z.name,value:Z.id.toString()}))||[]),S(P.data?.map(Z=>({label:Z.remarks,value:Z.id.toString()}))||[]),T(K.data||[])},C=m.useMemo(()=>w?.filter(E=>(E.parent_id===0||E.parent_id===null)&&E.type===u&&E.id!==y.watch("id")),[u,w,y]),g=()=>e.jsxs(zs,{children:[e.jsx(Ks,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ke,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(Ms,{align:"start",children:e.jsx(cm,{children:Ts.map(({type:E,label:P})=>e.jsx(Se,{onClick:()=>{x(E),i(!0)},className:"cursor-pointer",children:e.jsx(U,{variant:"outline",className:"text-white",style:{background:bs[E]},children:P})},E))})})]}),p=()=>{i(!1),d(null),y.reset(r)},V=async()=>{const E=y.getValues();(await dt.save({...E,type:u})).data&&(p(),$.success(s("form.success")),o())};return e.jsxs(de,{open:a,onOpenChange:p,children:[g(),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(he,{children:[e.jsx(me,{children:s(l?"form.edit_node":"form.new_node")}),e.jsx(Ae,{})]}),e.jsxs(De,{...y,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:y.control,name:"name",render:({field:E})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:s("form.name.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:s("form.name.placeholder"),...E})}),e.jsx(R,{})]})}),e.jsx(v,{control:y.control,name:"rate",render:({field:E})=>e.jsxs(j,{className:"flex-[1]",children:[e.jsx(b,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(_,{children:e.jsx(k,{type:"number",min:"0",step:"0.1",...E})})}),e.jsx(R,{})]})})]}),e.jsx(v,{control:y.control,name:"rate_time_enable",render:({field:E})=>e.jsxs(j,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(b,{children:s("form.dynamic_rate.enable_label")}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("form.dynamic_rate.enable_description")})]}),e.jsx(_,{children:e.jsx(X,{checked:E.value,onCheckedChange:E.onChange Line truncated
`):"",onChange:f=>{const E=f.target.value.split(`
`).filter(L=>L.trim()!=="");g.onChange(E)}})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:d.control,name:"tls.server_name",render:({field:g})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:r("dynamic_form.anytls.tls.server_name.label","SNI")}),e.jsx(_,{children:e.jsx(D,{placeholder:r("dynamic_form.anytls.tls.server_name.placeholder","服务器名称"),...g})})]})}),e.jsx(b,{control:d.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(v,{children:[e.jsx(y,{children:r("dynamic_form.anytls.tls.allow_insecure","允许不安全连接")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(_,{children:e.jsx(Z,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]})})};return e.jsx(be,{children:N[s]?.()})};function Mx(){const{t:s}=M("server"),n=h.object({start:h.string().min(1,s("form.dynamic_rate.start_time_error")),end:h.string().min(1,s("form.dynamic_rate.end_time_error")),rate:h.string().min(1,s("form.dynamic_rate.multiplier_error")).refine(E=>!isNaN(parseFloat(E))&&isFinite(Number(E)),{message:s("form.dynamic_rate.multiplier_error_numeric")}).refine(E=>parseFloat(E)>=0,{message:s("form.dynamic_rate.multiplier_error_gte_zero")})}),t=h.object({id:h.number().optional().nullable(),specific_key:h.string().optional().nullable(),code:h.string().optional(),show:h.boolean().optional().nullable(),name:h.string().min(1,s("form.name.error")),rate:h.string().min(1,s("form.rate.error")).refine(E=>!isNaN(parseFloat(E))&&isFinite(Number(E)),{message:s("form.rate.error_numeric")}).refine(E=>parseFloat(E)>=0,{message:s("form.rate.error_gte_zero")}),rate_time_enable:h.boolean().default(!1),rate_time_ranges:h.array(n).default([]),tags:h.array(h.string()).default([]),excludes:h.array(h.string()).default([]),ips:h.array(h.string()).default([]),group_ids:h.array(h.string()).default([]),host:h.string().min(1,s("form.host.error")),port:h.string().min(1,s("form.port.error")),server_port:h.string().min(1,s("form.server_port.error")),parent_id:h.string().default("0").nullable(),route_ids:h.array(h.string()).default([]),protocol_settings:h.record(h.any()).default({}).nullable()}),r={id:null,specific_key:null,code:"",show:!1,name:"",rate:"1",rate_time_enable:!1,rate_time_ranges:[],tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null},{isOpen:a,setIsOpen:i,editingServer:l,setEditingServer:d,serverType:u,setServerType:x,refetch:o}=pi(),[c,j]=m.useState([]),[P,k]=m.useState([]),[C,T]=m.useState([]),p=we({resolver:Te(t),defaultValues:r,mode:"onChange"});m.useEffect(()=>{S()},[a]),m.useEffect(()=>{l?.type&&l.type!==u&&x(l.type)},[l,u,x]),m.useEffect(()=>{l?l.type===u&&p.reset({...r,...l}):p.reset({...r,protocol_settings:Oe[u].schema.parse({})})},[l,p,u]);const S=async()=>{if(!a)return;const[E,L,K]=await Promise.all([pt.getList(),qa.getList(),dt.getList()]);j(E.data?.map(X=>({label:X.name,value:X.id.toString()}))||[]),k(L.data?.map(X=>({label:X.remarks,value:X.id.toString()}))||[]),T(K.data||[])},N=m.useMemo(()=>C?.filter(E=>(E.parent_id===0||E.parent_id===null)&&E.type===u&&E.id!==p.watch("id")),[u,C,p]),g=()=>e.jsxs(zs,{children:[e.jsx(Ks,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ke,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(Ms,{align:"start",children:e.jsx(cm,{children:Ts.map(({type:E,label:L})=>e.jsx(Se,{onClick:()=>{x(E),i(!0)},className:"cursor-pointer",children:e.jsx(U,{variant:"outline",className:"text-white",style:{background:bs[E]},children:L})},E))})})]}),f=()=>{i(!1),d(null),p.reset(r)},V=async()=>{const E=p.getValues();(await dt.save({...E,type:u})).data&&(f(),$.success(s("form.success")),o())};return e.jsxs(de,{open:a,onOpenChange:f,children:[g(),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(he,{children:[e.jsx(me,{children:s(l?"form.edit_node":"form.new_node")}),e.jsx(Ae,{})]}),e.jsxs(De,{...p,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{control:p.control,name:"name",render:({field:E})=>e.jsxs(v,{className:"flex-[2]",children:[e.jsx(y,{children:s("form.name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:s("form.name.placeholder"),...E})}),e.jsx(R,{})]})}),e.jsx(b,{control:p.control,name:"rate",render:({field:E})=>e.jsxs(v,{className:"flex-[1]",children:[e.jsx(y,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(_,{children:e.jsx(D,{type:"number",min:"0",step:"0.1",...E})})}),e.jsx(R,{})]})})]}),e.jsx(b,{control:p.control,name:"rate_time_enable",render:({field:E})=>e.jsxs(v,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(y,{children:s("form.dynamic_rate.enable_label")}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("form.dynamic_rate.enable_description")})]}),e.jsx(_,{children:e.jsx(Z,{checked:E.value,onCheckedChange:E.onChange Line truncated
`):"",onChange:x=>{const o=x.target.value.split(`
`);u.onChange(o)}})})}),e.jsx(R,{})]})}),e.jsx(v,{control:i.control,name:"action",render:({field:u})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsxs(J,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("form.actionPlaceholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"block",children:a("actions.block")}),e.jsx(A,{value:"dns",children:a("actions.dns")})]})]})})}),e.jsx(R,{})]})}),i.watch("action")==="dns"&&e.jsx(v,{control:i.control,name:"action_value",render:({field:u})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsx(k,{type:"text",placeholder:a("form.dnsPlaceholder"),...u})})})]})}),e.jsxs(Me,{children:[e.jsx(Qs,{asChild:!0,children:e.jsx(D,{variant:"outline",children:a("form.cancel")})}),e.jsx(D,{type:"submit",onClick:()=>{const u=i.getValues(),x={...u,match:Array.isArray(u.match)?u.match.filter(o=>o.trim()!==""):[]};qa.save(x).then(({data:o})=>{o&&(d(!1),s&&s(),$.success(a(r==="edit"?"messages.updateSuccess":"messages.createSuccess")),i.reset())})},children:a("form.submit")})]})]})]})]})}function Jx({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=M("route");return e.jsx("div",{className:"flex items-center justify-between ",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[e.jsx(pi,{refetch:n}),e.jsx(k,{placeholder:r("toolbar.searchPlaceholder"),value:s.getColumn("remarks")?.getFilterValue()??"",onChange:a=>s.getColumn("remarks")?.setFilterValue(a.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),t&&e.jsxs(D,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("toolbar.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]})})}function Qx({columns:s,data:n,refetch:t}){const[r,a]=m.useState({}),[i,l]=m.useState({}),[d,u]=m.useState([]),[x,o]=m.useState([]),c=Be({data:n,columns:s,state:{sorting:x,columnVisibility:i,rowSelection:r,columnFilters:d},enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:o,onColumnFiltersChange:u,onColumnVisibilityChange:l,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),getFacetedRowModel:Fs(),getFacetedUniqueValues:Ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ts,{table:c,toolbar:f=>e.jsx(Jx,{table:f,refetch:t})})}const Xx=s=>{const{t:n}=M("route"),t={block:{icon:ud,variant:"destructive",className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800"},dns:{icon:xd,variant:"secondary",className:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800"}};return[{accessorKey:"id",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.id")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(U,{variant:"outline",children:r.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.remarks")}),cell:({row:r})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:r.original.remarks})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action_value",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.action_value.title")}),cell:({row:r})=>{const a=r.original.action,i=r.original.action_value,l=r.original.match?.length||0;return e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("span",{className:"text-sm font-medium",children:a==="dns"&&i?n("columns.action_value.dns",{value:i}):a==="block"?e.jsx("span",{className:"text-destructive",children:n("columns.action_value.block")}):n("columns.action_value.direct")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("columns.matchRules",{count:l})})]})},enableHiding:!1,enableSorting:!1,size:300},{accessorKey:"action",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.action")}),cell:({row:r})=>{const a=r.getValue("action"),i=t[a]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(U,{variant:t[a]?.variant||"default",className:N("flex items-center gap-1.5 px-3 py-1 capitalize",t[a]?.className),children:[i&&e.jsx(i,{className:"h-3.5 w-3.5"}),n(`actions.${a}`)]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:n("columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(pi,{defaultValues:r.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(D,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(_s,{title:n("messag Line truncated
`)||d("plan.form.submit.error.validation","表单校验失败"))},w=y=>{if(isNaN(y))return;const L=Object.entries(ja).reduce((C,[g,p])=>{const V=y*p.months*p.discount;return{...C,[g]:V.toFixed(2)}},{});u.setValue("prices",L,{shouldDirty:!0})},T=()=>{n(!1),r(null),u.reset(fa)};return e.jsx(de,{open:s,onOpenChange:T,children:e.jsxs(ce,{children:[e.jsxs(he,{children:[e.jsx(me,{children:d(t?"plan.form.edit_title":"plan.form.add_title")}),e.jsx(Ae,{})]}),e.jsx(De,{...u,children:e.jsxs("form",{onSubmit:u.handleSubmit(F,S),children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:u.control,name:"name",render:({field:y})=>e.jsxs(j,{children:[e.jsx(b,{children:d("plan.form.name.label")}),e.jsx(_,{children:e.jsx(k,{placeholder:d("plan.form.name.placeholder"),...y})}),e.jsx(R,{})]})}),e.jsx(v,{control:u.control,name:"tags",render:({field:y})=>e.jsxs(j,{children:[e.jsx(b,{children:d("plan.form.tags.label","标签")}),e.jsx(_,{children:e.jsx(Xa,{value:y.value||[],onChange:y.onChange,placeholder:d("plan.form.tags.placeholder","输入标签后按回车确认"),className:"w-full"})}),e.jsx(R,{})]})}),e.jsx(v,{control:u.control,name:"group_id",render:({field:y})=>e.jsxs(j,{children:[e.jsxs(b,{className:"flex items-center justify-between",children:[d("plan.form.group.label"),e.jsx(Za,{dialogTrigger:e.jsx(D,{variant:"link",children:d("plan.form.group.add")}),refetch:f})]}),e.jsxs(J,{value:y.value?.toString()??"",onValueChange:L=>y.onChange(L?Number(L):null),children:[e.jsx(_,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:d("plan.form.group.placeholder")})})}),e.jsx(Y,{children:o?.map(L=>e.jsx(A,{value:L.id.toString(),children:L.name},L.id))})]}),e.jsx(R,{})]})}),e.jsx(v,{control:u.control,name:"transfer_enable",render:({field:y})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:d("plan.form.transfer.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(k,{type:"number",min:0,placeholder:d("plan.form.transfer.placeholder"),className:"rounded-r-none",...y})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.transfer.unit")})]}),e.jsx(R,{})]})}),e.jsx(v,{control:u.control,name:"speed_limit",render:({field:y})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:d("plan.form.speed.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(k,{type:"number",min:0,placeholder:d("plan.form.speed.placeholder"),className:"rounded-r-none",...y,value:y.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.speed.unit")})]}),e.jsx(R,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center",children:[e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"}),e.jsx("h3",{className:"mx-4 text-sm font-medium text-gray-500 dark:text-gray-400",children:d("plan.form.price.title")}),e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(k,{type:"number",step:"0.01",placeholder:d("plan.form.price.base_price"),className:"h-7 w-32 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500",onChange:y=>{const L=parseFloat(y.target.value);w(L)}})]}),e.jsx(be,{children:e.jsxs(ge,{children:[e.jsx(pe,{asChild:!0,children:e.jsx(D,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const y=Object.keys(ja).reduce((L,C)=>({...L,[C]:""}),{});u.setValue("prices",y,{shouldDirty:!0})},children:d("plan.form.price.clear.button")})}),e.jsx(ue,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:d("plan.form.price.clear.tooltip")})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(ja).filter(([y])=>!["onetime","reset_traffic"].includes(y)).map(([y,L])=>e.jsx("div",{className:"group relative rounded-md bg-card p-2 ring-1 ring-gray-200 transition-all hover:ring-primary dark:ring-gray-800",children:e.jsx(v,{control:u.control,name:`prices.${y}`,render:({field:C})=>e.jsxs(j,{children:[e.jsxs(b,{className:"text-xs font-medium text-muted-foreground",children:[d(`plan.columns.price_period.${y}`),e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",L.months===1?d("plan.form.price.period.monthly"):d("plan.form.price.period.months",{count:L.months}),")"]})]}),e.jsxs("div", Line truncated
`+a("columns.online_status.offline_duration.days",{count:f}):c>0?x+=`
`);u.onChange(o)}})})}),e.jsx(R,{})]})}),e.jsx(b,{control:i.control,name:"action",render:({field:u})=>e.jsxs(v,{children:[e.jsx(y,{children:a("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsxs(J,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(Y,{children:e.jsx(Q,{placeholder:a("form.actionPlaceholder")})}),e.jsxs(W,{children:[e.jsx(A,{value:"block",children:a("actions.block")}),e.jsx(A,{value:"dns",children:a("actions.dns")})]})]})})}),e.jsx(R,{})]})}),i.watch("action")==="dns"&&e.jsx(b,{control:i.control,name:"action_value",render:({field:u})=>e.jsxs(v,{children:[e.jsx(y,{children:a("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(_,{children:e.jsx(D,{type:"text",placeholder:a("form.dnsPlaceholder"),...u})})})]})}),e.jsxs(Me,{children:[e.jsx(Qs,{asChild:!0,children:e.jsx(F,{variant:"outline",children:a("form.cancel")})}),e.jsx(F,{type:"submit",onClick:()=>{const u=i.getValues(),x={...u,match:Array.isArray(u.match)?u.match.filter(o=>o.trim()!==""):[]};qa.save(x).then(({data:o})=>{o&&(d(!1),s&&s(),$.success(a(r==="edit"?"messages.updateSuccess":"messages.createSuccess")),i.reset())})},children:a("form.submit")})]})]})]})]})}function Jx({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=M("route");return e.jsx("div",{className:"flex items-center justify-between ",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[e.jsx(fi,{refetch:n}),e.jsx(D,{placeholder:r("toolbar.searchPlaceholder"),value:s.getColumn("remarks")?.getFilterValue()??"",onChange:a=>s.getColumn("remarks")?.setFilterValue(a.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),t&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("toolbar.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]})})}function Qx({columns:s,data:n,refetch:t}){const[r,a]=m.useState({}),[i,l]=m.useState({}),[d,u]=m.useState([]),[x,o]=m.useState([]),c=Be({data:n,columns:s,state:{sorting:x,columnVisibility:i,rowSelection:r,columnFilters:d},enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:o,onColumnFiltersChange:u,onColumnVisibilityChange:l,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ts,{table:c,toolbar:j=>e.jsx(Jx,{table:j,refetch:t})})}const Xx=s=>{const{t:n}=M("route"),t={block:{icon:ud,variant:"destructive",className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800"},dns:{icon:xd,variant:"secondary",className:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800"}};return[{accessorKey:"id",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.id")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(U,{variant:"outline",children:r.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.remarks")}),cell:({row:r})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:r.original.remarks})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action_value",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.action_value.title")}),cell:({row:r})=>{const a=r.original.action,i=r.original.action_value,l=r.original.match?.length||0;return e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("span",{className:"text-sm font-medium",children:a==="dns"&&i?n("columns.action_value.dns",{value:i}):a==="block"?e.jsx("span",{className:"text-destructive",children:n("columns.action_value.block")}):n("columns.action_value.direct")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("columns.matchRules",{count:l})})]})},enableHiding:!1,enableSorting:!1,size:300},{accessorKey:"action",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.action")}),cell:({row:r})=>{const a=r.getValue("action"),i=t[a]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(U,{variant:t[a]?.variant||"default",className:w("flex items-center gap-1.5 px-3 py-1 capitalize",t[a]?.className),children:[i&&e.jsx(i,{className:"h-3.5 w-3.5"}),n(`actions.${a}`)]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:n("columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(fi,{defaultValues:r.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(tt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(_s,{title:n("messag Line truncated
`)||d("plan.form.submit.error.validation","表单校验失败"))},C=p=>{if(isNaN(p))return;const S=Object.entries(ja).reduce((N,[g,f])=>{const V=p*f.months*f.discount;return{...N,[g]:V.toFixed(2)}},{});u.setValue("prices",S,{shouldDirty:!0})},T=()=>{n(!1),r(null),u.reset(fa)};return e.jsx(de,{open:s,onOpenChange:T,children:e.jsxs(ce,{children:[e.jsxs(he,{children:[e.jsx(me,{children:d(t?"plan.form.edit_title":"plan.form.add_title")}),e.jsx(Ae,{})]}),e.jsx(De,{...u,children:e.jsxs("form",{onSubmit:u.handleSubmit(P,k),children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{control:u.control,name:"name",render:({field:p})=>e.jsxs(v,{children:[e.jsx(y,{children:d("plan.form.name.label")}),e.jsx(_,{children:e.jsx(D,{placeholder:d("plan.form.name.placeholder"),...p})}),e.jsx(R,{})]})}),e.jsx(b,{control:u.control,name:"tags",render:({field:p})=>e.jsxs(v,{children:[e.jsx(y,{children:d("plan.form.tags.label","标签")}),e.jsx(_,{children:e.jsx(Xa,{value:p.value||[],onChange:p.onChange,placeholder:d("plan.form.tags.placeholder","输入标签后按回车确认"),className:"w-full"})}),e.jsx(R,{})]})}),e.jsx(b,{control:u.control,name:"group_id",render:({field:p})=>e.jsxs(v,{children:[e.jsxs(y,{className:"flex items-center justify-between",children:[d("plan.form.group.label"),e.jsx(Za,{dialogTrigger:e.jsx(F,{variant:"link",children:d("plan.form.group.add")}),refetch:j})]}),e.jsxs(J,{value:p.value?.toString()??"",onValueChange:S=>p.onChange(S?Number(S):null),children:[e.jsx(_,{children:e.jsx(Y,{children:e.jsx(Q,{placeholder:d("plan.form.group.placeholder")})})}),e.jsx(W,{children:o?.map(S=>e.jsx(A,{value:S.id.toString(),children:S.name},S.id))})]}),e.jsx(R,{})]})}),e.jsx(b,{control:u.control,name:"transfer_enable",render:({field:p})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:d("plan.form.transfer.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",min:0,placeholder:d("plan.form.transfer.placeholder"),className:"rounded-r-none",...p})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.transfer.unit")})]}),e.jsx(R,{})]})}),e.jsx(b,{control:u.control,name:"speed_limit",render:({field:p})=>e.jsxs(v,{className:"flex-1",children:[e.jsx(y,{children:d("plan.form.speed.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(_,{children:e.jsx(D,{type:"number",min:0,placeholder:d("plan.form.speed.placeholder"),className:"rounded-r-none",...p,value:p.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.speed.unit")})]}),e.jsx(R,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center",children:[e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"}),e.jsx("h3",{className:"mx-4 text-sm font-medium text-gray-500 dark:text-gray-400",children:d("plan.form.price.title")}),e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(D,{type:"number",step:"0.01",placeholder:d("plan.form.price.base_price"),className:"h-7 w-32 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500",onChange:p=>{const S=parseFloat(p.target.value);C(S)}})]}),e.jsx(be,{children:e.jsxs(ge,{children:[e.jsx(pe,{asChild:!0,children:e.jsx(F,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const p=Object.keys(ja).reduce((S,N)=>({...S,[N]:""}),{});u.setValue("prices",p,{shouldDirty:!0})},children:d("plan.form.price.clear.button")})}),e.jsx(ue,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:d("plan.form.price.clear.tooltip")})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(ja).filter(([p])=>!["onetime","reset_traffic"].includes(p)).map(([p,S])=>e.jsx("div",{className:"group relative rounded-md bg-card p-2 ring-1 ring-gray-200 transition-all hover:ring-primary dark:ring-gray-800",children:e.jsx(b,{control:u.control,name:`prices.${p}`,render:({field:N})=>e.jsxs(v,{children:[e.jsxs(y,{className:"text-xs font-medium text-muted-foreground",children:[d(`plan.columns.price_period.${p}`),e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",S.months===1?d("plan.form.price.period.monthly"):d("plan.form.price.period.months",{count:S.months}),")"]})]}),e.jsxs("div", Line truncated
`+a("columns.online_status.offline_duration.days",{count:j}):c>0?x+=`
`+a("columns.online_status.offline_duration.hours",{count:c}):o>0?x+=`
`+a("columns.online_status.offline_duration.minutes",{count:o}):x+=`
`+a("columns.online_status.offline_duration.seconds",{count:u})}return e.jsx(be,{delayDuration:100,children:e.jsxs(ge,{children:[e.jsx(pe,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:N("size-2.5 rounded-full ring-2 ring-offset-2",d?"bg-green-500 ring-green-500/20":"bg-gray-300 ring-gray-300/20","transition-all duration-300")}),e.jsx("span",{className:"font-medium text-foreground/90",children:i.original.email})]})}),e.jsx(ue,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:x})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.online_count")}),cell:({row:i})=>{const l=i.original.device_limit,d=i.original.online_count||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(ge,{children:[e.jsx(pe,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(U,{variant:"outline",className:N("min-w-[4rem] justify-center",l!==null&&d>=l?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[d," / ",l===null?"∞":l]})})}),e.jsx(ue,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:l===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:l})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.status")}),cell:({row:i})=>{const l=i.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(U,{className:N("min-w-20 justify-center transition-colors",l?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(l?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l))},{accessorKey:"plan_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.subscription")}),cell:({row:i})=>e.jsx("div",{className:"min-w-[10em] break-all",children:i.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.group")}),cell:({row:i})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(U,{variant:"outline",className:N("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5 whitespace-nowrap"),children:i.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.used_traffic")}),cell:({row:i})=>{const l=ze(i.original?.total_used),d=ze(i.original?.transfer_enable),u=i.original?.total_used/i.original?.transfer_enable*100||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(ge,{children:[e.jsx(pe,{className:"w-full",children:e.jsxs("div",{className:"w-full space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:N("h-full rounded-full transition-all",u>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(u,100)}%`}})})]})}),e.jsx(ue,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",d]})})]})})}},{accessorKey:"transfer_enable",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.total_traffic")}),cell:({row:i})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:ze(i.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.expire_time")}),cell:({row:i})=>{const l=i.original.expired_at,d=Date.now()/1e3,u=l!=null&&l<d,x=l!=null?new Date(l*1e3):null,o=x!=null?Math.ceil((x.getTime()-Date.now())/(1e3*60*60*24)):null;return e.jsx(be,{delayDuration:100,children:e.jsxs(ge,{children:[e.jsx(pe,{className:"block w-full",children:e.jsx(U,{variant:"outline",className:N("w-full justify-center transition-colors",u?"border-destructive/50 bg-destructive/10 text-destructive":l?"border-success/50 bg-success/10 text-success":"border-primary/40 bg-primary/5 text-primary/90"),children:l==null?a("columns.expire_status.permanent"):ie(l,"YYYY-MM-DD")})}),e.jsx(ue,{side:"bottom",className:"space-y-1 p-3",children:l!=null?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[a("columns.expire_time"),": ",ie(l)]}),e.jsx("p",{className:N("text-sm font-medium",u?"text-destructive":"text-success"),children:u?a("columns.expire_status.expired",{days:Math.abs(o??0)}):a("columns.expire_status.remaining",{days:o??0})}),i.original.next_reset_at&&e.jsxs("p",{className:"text-sm",children:[a("columns.next_reset_at"),":"," ",ie(i.original.nex Line truncated
`),p=new Blob([g],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a"),E=URL.createObjectURL(p);V.setAttribute("href",E),V.setAttribute("download",`traffic-reset-logs-${Re(new Date,"yyyy-MM-dd")}.csv`),V.style.visibility="hidden",document.body.appendChild(V),V.click(),document.body.removeChild(V),$.success(t("traffic_reset_logs.actions.export_success"))}catch(w){console.error("导出失败:",w),$.error(t("traffic_reset_logs.actions.export_failed"))}finally{x(!1)}},S=()=>e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.search_user")}),e.jsx(k,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:w=>s.getColumn("user_email")?.setFilterValue(w.target.value),className:"h-9"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.reset_type")}),e.jsxs(J,{value:s.getColumn("reset_type")?.getFilterValue()??"",onValueChange:w=>s.getColumn("reset_type")?.setFilterValue(w==="all"?"":w),children:[e.jsx(W,{className:"h-9",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.reset_type")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"all",children:t("traffic_reset_logs.filters.all_types")}),o.map(w=>e.jsx(A,{value:w.value,children:w.label},w.value))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.trigger_source")}),e.jsxs(J,{value:s.getColumn("trigger_source")?.getFilterValue()??"",onValueChange:w=>s.getColumn("trigger_source")?.setFilterValue(w==="all"?"":w),children:[e.jsx(W,{className:"h-9",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.trigger_source")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"all",children:t("traffic_reset_logs.filters.all_sources")}),c.map(w=>e.jsx(A,{value:w.value,children:w.label},w.value))]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.start_date")}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(D,{variant:"outline",className:N("h-9 w-full justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(ws,{className:"mr-2 h-4 w-4"}),a?Re(a,"MM-dd"):t("traffic_reset_logs.filters.start_date")]})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",children:e.jsx(Cs,{mode:"single",selected:a,onSelect:i,initialFocus:!0})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.end_date")}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(D,{variant:"outline",className:N("h-9 w-full justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(ws,{className:"mr-2 h-4 w-4"}),l?Re(l,"MM-dd"):t("traffic_reset_logs.filters.end_date")]})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",children:e.jsx(Cs,{mode:"single",selected:l,onSelect:d,initialFocus:!0})})]})]})]}),(a||l)&&e.jsxs(D,{variant:"outline",className:"w-full",onClick:f,children:[e.jsx(cr,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.apply_date")]}),r&&e.jsxs(D,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),i(void 0),d(void 0)},className:"w-full",children:[t("traffic_reset_logs.filters.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between md:hidden",children:[e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(Gn,{children:[e.jsx(Ci,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"h-8",children:[e.jsx(wd,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.reset_type"),r&&e.jsx("div",{className:"ml-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:s.getState().columnFilters.length})]})}),e.jsxs(en,{side:"bottom",className:"h-[85vh]",children:[e.jsxs(sn,{className:"mb-4",children:[e.jsx(tn,{children:t("traffic_reset_logs.filters.filter_title")}),e.jsx(an,{children:t("traffic_reset_logs.filters.filter_description")})]}),e.jsx("div",{className:"max-h-[calc(85vh-120px)] overflow-y-auto",children:e.jsx(S,{})})]})]})}),e.jsxs(D,{variant:"outline",size:"sm",className:"h-8",onClick:F,disabled:u,children:[e.jsx(Zt,{className:"mr-2 h-4 w-4"}),t(u?"traffic_reset_logs.actions.exporting":"traffic_reset_logs.actions.export")]})]}),e.jsxs("div",{className:"hidden items-center justify-between md:flex",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(k,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:w=>s.getColumn("user_email")?.setFilterValue(w.target.valu Line truncated
`+a("columns.online_status.offline_duration.seconds",{count:u})}return e.jsx(be,{delayDuration:100,children:e.jsxs(ge,{children:[e.jsx(pe,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:w("size-2.5 rounded-full ring-2 ring-offset-2",d?"bg-green-500 ring-green-500/20":"bg-gray-300 ring-gray-300/20","transition-all duration-300")}),e.jsx("span",{className:"font-medium text-foreground/90",children:i.original.email})]})}),e.jsx(ue,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:x})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.online_count")}),cell:({row:i})=>{const l=i.original.device_limit,d=i.original.online_count||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(ge,{children:[e.jsx(pe,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(U,{variant:"outline",className:w("min-w-[4rem] justify-center",l!==null&&d>=l?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[d," / ",l===null?"∞":l]})})}),e.jsx(ue,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:l===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:l})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.status")}),cell:({row:i})=>{const l=i.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(U,{className:w("min-w-20 justify-center transition-colors",l?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(l?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l))},{accessorKey:"plan_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.subscription")}),cell:({row:i})=>e.jsx("div",{className:"min-w-[10em] break-all",children:i.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.group")}),cell:({row:i})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(U,{variant:"outline",className:w("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5 whitespace-nowrap"),children:i.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.used_traffic")}),cell:({row:i})=>{const l=ze(i.original?.total_used),d=ze(i.original?.transfer_enable),u=i.original?.total_used/i.original?.transfer_enable*100||0;return e.jsx(be,{delayDuration:100,children:e.jsxs(ge,{children:[e.jsx(pe,{className:"w-full",children:e.jsxs("div",{className:"w-full space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:w("h-full rounded-full transition-all",u>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(u,100)}%`}})})]})}),e.jsx(ue,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",d]})})]})})}},{accessorKey:"transfer_enable",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.total_traffic")}),cell:({row:i})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:ze(i.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.expire_time")}),cell:({row:i})=>{const l=i.original.expired_at,d=Date.now()/1e3,u=l!=null&&l<d,x=l!=null?new Date(l*1e3):null,o=x!=null?Math.ceil((x.getTime()-Date.now())/(1e3*60*60*24)):null;return e.jsx(be,{delayDuration:100,children:e.jsxs(ge,{children:[e.jsx(pe,{className:"block w-full",children:e.jsx(U,{variant:"outline",className:w("w-full justify-center transition-colors",u?"border-destructive/50 bg-destructive/10 text-destructive":l?"border-success/50 bg-success/10 text-success":"border-primary/40 bg-primary/5 text-primary/90"),children:l==null?a("columns.expire_status.permanent"):ie(l,"YYYY-MM-DD")})}),e.jsx(ue,{side:"bottom",className:"space-y-1 p-3",children:l!=null?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[a("columns.expire_time"),": ",ie(l)]}),e.jsx("p",{className:w("text-sm font-medium",u?"text-destructive":"text-success"),children:u?a("columns.expire_status.expired",{days:Math.abs(o??0)}):a("columns.expire_status.remaining",{days:o??0})}),i.original.next_reset_at&&e.jsxs("p",{className:"text-sm",children:[a("columns.next_reset_at"),":"," ",ie(i.original.nex Line truncated
`),f=new Blob([g],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a"),E=URL.createObjectURL(f);V.setAttribute("href",E),V.setAttribute("download",`traffic-reset-logs-${Fe(new Date,"yyyy-MM-dd")}.csv`),V.style.visibility="hidden",document.body.appendChild(V),V.click(),document.body.removeChild(V),$.success(t("traffic_reset_logs.actions.export_success"))}catch(C){console.error("导出失败:",C),$.error(t("traffic_reset_logs.actions.export_failed"))}finally{x(!1)}},k=()=>e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.search_user")}),e.jsx(D,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:C=>s.getColumn("user_email")?.setFilterValue(C.target.value),className:"h-9"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.reset_type")}),e.jsxs(J,{value:s.getColumn("reset_type")?.getFilterValue()??"",onValueChange:C=>s.getColumn("reset_type")?.setFilterValue(C==="all"?"":C),children:[e.jsx(Y,{className:"h-9",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.reset_type")})}),e.jsxs(W,{children:[e.jsx(A,{value:"all",children:t("traffic_reset_logs.filters.all_types")}),o.map(C=>e.jsx(A,{value:C.value,children:C.label},C.value))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.trigger_source")}),e.jsxs(J,{value:s.getColumn("trigger_source")?.getFilterValue()??"",onValueChange:C=>s.getColumn("trigger_source")?.setFilterValue(C==="all"?"":C),children:[e.jsx(Y,{className:"h-9",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.trigger_source")})}),e.jsxs(W,{children:[e.jsx(A,{value:"all",children:t("traffic_reset_logs.filters.all_sources")}),c.map(C=>e.jsx(A,{value:C.value,children:C.label},C.value))]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.start_date")}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",className:w("h-9 w-full justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(ws,{className:"mr-2 h-4 w-4"}),a?Fe(a,"MM-dd"):t("traffic_reset_logs.filters.start_date")]})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",children:e.jsx(Cs,{mode:"single",selected:a,onSelect:i,initialFocus:!0})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.end_date")}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",className:w("h-9 w-full justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(ws,{className:"mr-2 h-4 w-4"}),l?Fe(l,"MM-dd"):t("traffic_reset_logs.filters.end_date")]})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",children:e.jsx(Cs,{mode:"single",selected:l,onSelect:d,initialFocus:!0})})]})]})]}),(a||l)&&e.jsxs(F,{variant:"outline",className:"w-full",onClick:j,children:[e.jsx(dr,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.apply_date")]}),r&&e.jsxs(F,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),i(void 0),d(void 0)},className:"w-full",children:[t("traffic_reset_logs.filters.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between md:hidden",children:[e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(Yn,{children:[e.jsx(Si,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:"h-8",children:[e.jsx(wd,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.reset_type"),r&&e.jsx("div",{className:"ml-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:s.getState().columnFilters.length})]})}),e.jsxs(en,{side:"bottom",className:"h-[85vh]",children:[e.jsxs(sn,{className:"mb-4",children:[e.jsx(tn,{children:t("traffic_reset_logs.filters.filter_title")}),e.jsx(an,{children:t("traffic_reset_logs.filters.filter_description")})]}),e.jsx("div",{className:"max-h-[calc(85vh-120px)] overflow-y-auto",children:e.jsx(k,{})})]})]})}),e.jsxs(F,{variant:"outline",size:"sm",className:"h-8",onClick:P,disabled:u,children:[e.jsx(Zt,{className:"mr-2 h-4 w-4"}),t(u?"traffic_reset_logs.actions.exporting":"traffic_reset_logs.actions.export")]})]}),e.jsxs("div",{className:"hidden items-center justify-between md:flex",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(D,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:C=>s.getColumn("user_email")?.setFilterValue(C.target.valu Line truncated