From 5de466fc3e864d1e5836858eb9ec7a342369f0c9 Mon Sep 17 00:00:00 2001 From: xboard Date: Fri, 10 Jan 2025 23:41:35 +0800 Subject: [PATCH] fix: correct know file issues --- public/assets/admin/assets/index.css | 2 +- public/assets/admin/assets/index.js | 8 ++++---- public/assets/admin/assets/vendor.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/assets/admin/assets/index.css b/public/assets/admin/assets/index.css index c86b438..590f9e1 100644 --- a/public/assets/admin/assets/index.css +++ b/public/assets/admin/assets/index.css @@ -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-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9%}.collapsibleDropdown{overflow:hidden}.collapsibleDropdown[data-state=open]{animation:slideDown .2s ease-out}.collapsibleDropdown[data-state=closed]{animation:slideUp .2s ease-out}@keyframes slideDown{0%{height:0}to{height:var(--radix-collapsible-content-height)}}@keyframes slideUp{0%{height:var(--radix-collapsible-content-height)}to{height:0}}*{border-color:hsl(var(--border))}body{min-height:100svh;width:100%;background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-left-1{left:-.25rem}.-right-1{right:-.25rem}.-right-5{right:-1.25rem}.-top-1\/2{top:-50%}.bottom-0{bottom:0}.bottom-5{bottom:1.25rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-4{left:1rem}.left-5{left:1.25rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-5{right:1.25rem}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[-1\]{z-index:-1}.z-\[1\]{z-index:1}.col-span-2{grid-column:span 2 / span 2}.-m-0\.5{margin:-.125rem}.m-1{margin:.25rem}.m-auto{margin:auto}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.-ml-3{margin-left:-.75rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-8{margin-left:2rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.\!table{display:table!important}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-\[16\/9\]{aspect-ratio:16/9}.aspect-square{aspect-ratio:1 / 1}.size-10{width:2.5rem;height:2.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.h-0{height:0px}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[180px\]{height:180px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[90vh\]{height:90vh}.h-\[calc\(100\%-var\(--header-height\)\)\]{height:calc(100% - var(--header-height))}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[var\(--header-height\)\]{height:var(--header-height)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-0{max-height:0px}.max-h-12{max-height:3rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[95\%\]{max-height:95%}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-6{min-height:1.5rem}.min-h-\[120px\]{min-height:120px}.min-h-\[150px\]{min-height:150px}.min-h-\[200px\]{min-height:200px}.min-h-\[60px\]{min-height:60px}.w-0{width:0px}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[250px\]{width:250px}.w-\[300px\]{width:300px}.w-\[400px\]{width:400px}.w-\[50px\]{width:50px}.w-\[70px\]{width:70px}.w-\[80px\]{width:80px}.w-auto{width:auto}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.min-w-0{min-width:0px}.min-w-20{min-width:5rem}.min-w-\[10em\]{min-width:10em}.min-w-\[300px\]{min-width:300px}.min-w-\[40px\]{min-width:40px}.min-w-\[4rem\]{min-width:4rem}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-32{max-width:8rem}.max-w-4xl{max-width:56rem}.max-w-52{max-width:13rem}.max-w-80{max-width:20rem}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[500px\]{max-width:500px}.max-w-\[60\%\]{max-width:60%}.max-w-\[600px\]{max-width:600px}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-none{max-width:none}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.flex-\[1\.2\]{flex:1.2}.flex-\[1\]{flex:1}.flex-\[2\]{flex:2}.flex-\[4\]{flex:4}.flex-\[5\]{flex:5}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-180{--tw-rotate: -180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-125{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-help{cursor:help}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[100px_1fr\]{grid-template-columns:100px 1fr}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-1{-moz-column-gap:.25rem;column-gap:.25rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-2{row-gap:.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.625rem * var(--tw-space-x-reverse));margin-left:calc(.625rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-wrap{text-wrap:wrap}.text-nowrap{text-wrap:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-lg{border-top-left-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-r-lg{border-top-right-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-bl-none{border-bottom-left-radius:0}.rounded-br-none{border-bottom-right-radius:0}.rounded-tl-lg{border-top-left-radius:var(--radius)}.rounded-tl-none{border-top-left-radius:0}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-lg{border-top-right-radius:var(--radius)}.rounded-tr-none{border-top-right-radius:0}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-x-0{border-left-width:0px;border-right-width:0px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-0{border-left-width:0px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-r-0{border-right-width:0px}.border-r-2{border-right-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.border-blue-500\/50{border-color:#3b82f680}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-foreground\/10{border-color:hsl(var(--foreground) / .1)}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/25{border-color:hsl(var(--muted-foreground) / .25)}.border-orange-500\/50{border-color:#f9731680}.border-primary{border-color:hsl(var(--primary))}.border-primary\/40{border-color:hsl(var(--primary) / .4)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-l-slate-500{--tw-border-opacity: 1;border-left-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-r-muted{border-right-color:hsl(var(--muted))}.border-t-transparent{border-top-color:transparent}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/80{background-color:#000c}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-cyan-50{--tw-bg-opacity: 1;background-color:rgb(236 254 255 / var(--tw-bg-opacity, 1))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-destructive\/15{background-color:hsl(var(--destructive) / .15)}.bg-destructive\/80{background-color:hsl(var(--destructive) / .8)}.bg-emerald-500\/80{background-color:#10b981cc}.bg-fuchsia-50{--tw-bg-opacity: 1;background-color:rgb(253 244 255 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-indigo-50{--tw-bg-opacity: 1;background-color:rgb(238 242 255 / var(--tw-bg-opacity, 1))}.bg-inherit{background-color:inherit}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-pink-50{--tw-bg-opacity: 1;background-color:rgb(253 242 248 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground{background-color:hsl(var(--primary-foreground))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-50{--tw-bg-opacity: 1;background-color:rgb(250 245 255 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-rose-50{--tw-bg-opacity: 1;background-color:rgb(255 241 242 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/30{background-color:hsl(var(--secondary) / .3)}.bg-secondary\/50{background-color:hsl(var(--secondary) / .5)}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-violet-50{--tw-bg-opacity: 1;background-color:rgb(245 243 255 / var(--tw-bg-opacity, 1))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/80{background-color:#eab308cc}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-background\/95{--tw-gradient-from: hsl(var(--background) / .95) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background\/80{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background) / .8) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-background\/60{--tw-gradient-to: hsl(var(--background) / .6) var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-primary{fill:hsl(var(--primary))}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-0\.5{padding-bottom:.125rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-3{padding-left:.75rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-7{padding-right:1.75rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-16{padding-top:4rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.625rem\]{font-size:.625rem}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[7rem\]{font-size:7rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-10{line-height:2.5rem}.leading-none{line-height:1}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-700{--tw-text-opacity: 1;color:rgb(14 116 144 / var(--tw-text-opacity, 1))}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/70{color:hsl(var(--foreground) / .7)}.text-foreground\/90{color:hsl(var(--foreground) / .9)}.text-fuchsia-700{--tw-text-opacity: 1;color:rgb(162 28 175 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-indigo-700{--tw-text-opacity: 1;color:rgb(67 56 202 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/30{color:hsl(var(--muted-foreground) / .3)}.text-muted-foreground\/40{color:hsl(var(--muted-foreground) / .4)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/70{color:hsl(var(--muted-foreground) / .7)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-700{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.text-pink-700{--tw-text-opacity: 1;color:rgb(190 24 93 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/90{color:hsl(var(--primary) / .9)}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-rose-700{--tw-text-opacity: 1;color:rgb(190 18 60 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-violet-700{--tw-text-opacity: 1;color:rgb(109 40 217 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-destructive\/50{--tw-shadow-color: hsl(var(--destructive) / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/50{--tw-shadow-color: rgb(16 185 129 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-yellow-500\/50{--tw-shadow-color: rgb(234 179 8 / .5);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-gray-200{--tw-ring-opacity: 1;--tw-ring-color: rgb(229 231 235 / var(--tw-ring-opacity, 1))}.ring-gray-300\/20{--tw-ring-color: rgb(209 213 219 / .2)}.ring-green-500\/20{--tw-ring-color: rgb(34 197 94 / .2)}.ring-primary\/20{--tw-ring-color: hsl(var(--primary) / .2)}.ring-offset-2{--tw-ring-offset-width: 2px}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.ring-offset-white{--tw-ring-offset-color: #fff}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-\[1px\]{--tw-backdrop-blur: blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[max-height\,padding\]{transition-property:max-height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[opacity\]{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-100{transition-delay:.1s}.delay-150{transition-delay:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-700{animation-duration:.7s}.delay-100{animation-delay:.1s}.delay-150{animation-delay:.15s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}html{overflow-y:scroll}.sticky{position:sticky!important;z-index:2;background-color:hsl(var(--card))}.sticky.before\:right-0:before,.sticky.before\:left-0:before{content:"";position:absolute;top:0;bottom:0;width:2px;background:linear-gradient(to right,rgba(0,0,0,.08),transparent);opacity:1;transition:opacity .3s ease}.sticky.before\:right-0:before{right:-1px;background:linear-gradient(to right,rgba(0,0,0,.08),transparent)}.sticky.before\:right-0:after{content:"";position:absolute;top:0;right:-8px;bottom:0;width:8px;pointer-events:none;background:linear-gradient(to right,rgba(0,0,0,.05),transparent)}.sticky.before\:left-0:before{left:-1px;background:linear-gradient(to left,rgba(0,0,0,.08),transparent)}.sticky.before\:left-0:after{content:"";position:absolute;top:0;left:-8px;bottom:0;width:8px;pointer-events:none;background:linear-gradient(to left,rgba(0,0,0,.05),transparent)}.sticky:hover:before{opacity:.8}.dark .sticky.before\:right-0:before,.dark .sticky.before\:left-0:before{background:linear-gradient(to right,rgba(255,255,255,.05),transparent)}.dark .sticky.before\:right-0:after,.dark .sticky.before\:left-0:after{background:linear-gradient(to right,rgba(255,255,255,.03),transparent)}.\*\:\!inline-block>*{display:inline-block!important}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:bottom-0:before{content:var(--tw-content);bottom:0}.before\:left-0:before{content:var(--tw-content);left:0}.before\:right-0:before{content:var(--tw-content);right:0}.before\:top-0:before{content:var(--tw-content);top:0}.before\:w-\[1px\]:before{content:var(--tw-content);width:1px}.before\:bg-border:before{content:var(--tw-content);background-color:hsl(var(--border))}.after\:pointer-events-none:after{content:var(--tw-content);pointer-events:none}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:bottom-0:after{content:var(--tw-content);bottom:0}.after\:left-0:after{content:var(--tw-content);left:0}.after\:hidden:after{content:var(--tw-content);display:none}.after\:h-32:after{content:var(--tw-content);height:8rem}.after\:w-full:after{content:var(--tw-content);width:100%}.after\:bg-\[linear-gradient\(180deg\,_transparent_10\%\,_hsl\(var\(--background\)\)_70\%\)\]:after{content:var(--tw-content);background-image:linear-gradient(180deg,transparent 10%,hsl(var(--background)) 70%)}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.focus-within\:ring-1:focus-within{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-within\:ring-ring:focus-within{--tw-ring-color: hsl(var(--ring))}.hover\:-translate-y-1:hover{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-background:hover{background-color:hsl(var(--background))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-card\/80:hover{background-color:hsl(var(--card) / .8)}.hover\:bg-destructive\/10:hover{background-color:hsl(var(--destructive) / .1)}.hover\:bg-destructive\/25:hover{background-color:hsl(var(--destructive) / .25)}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-100:hover{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.hover\:bg-inherit:hover{background-color:inherit}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/40:hover{background-color:hsl(var(--muted) / .4)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-muted\/60:hover{background-color:hsl(var(--muted) / .6)}.hover\:bg-muted\/70:hover{background-color:hsl(var(--muted) / .7)}.hover\:bg-primary:hover{background-color:hsl(var(--primary))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary-foreground\/10:hover{background-color:hsl(var(--secondary-foreground) / .1)}.hover\:bg-secondary\/50:hover{background-color:hsl(var(--secondary) / .5)}.hover\:bg-secondary\/70:hover{background-color:hsl(var(--secondary) / .7)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-yellow-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.hover\:bg-opacity-80:hover{--tw-bg-opacity: .8}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-foreground\/70:hover{color:hsl(var(--foreground) / .7)}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-black\/30:hover{--tw-shadow-color: rgb(0 0 0 / .3);--tw-shadow: var(--tw-shadow-colored)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:z-10:focus{z-index:10}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-primary:focus{background-color:hsl(var(--primary))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-destructive:focus{color:hsl(var(--destructive))}.focus\:text-primary-foreground:focus{color:hsl(var(--primary-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-primary:focus-visible{--tw-ring-color: hsl(var(--primary))}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:via-background\/90{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background) / .9) var(--tw-gradient-via-position), var(--tw-gradient-to)}.group:hover .group-hover\:to-background\/70{--tw-gradient-to: hsl(var(--background) / .7) var(--tw-gradient-to-position)}.group\/id:hover .group-hover\/id\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group[data-collapsed=true] .group-\[\[data-collapsed\=true\]\]\:justify-center{justify-content:center}.group[data-collapsed=true] .group-\[\[data-collapsed\=true\]\]\:px-2{padding-left:.5rem;padding-right:.5rem}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\:focus-visible\]\:outline-none:has(:focus-visible){outline:2px solid transparent;outline-offset:2px}.has-\[\:focus-visible\]\:ring-1:has(:focus-visible){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.has-\[\:focus-visible\]\:ring-neutral-950:has(:focus-visible){--tw-ring-opacity: 1;--tw-ring-color: rgb(10 10 10 / var(--tw-ring-opacity, 1))}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:bg-accent\/50[aria-selected=true]{background-color:hsl(var(--accent) / .5)}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[state\=dragging\]\:cursor-grabbing[data-state=dragging]{cursor:grabbing}.data-\[active\]\:bg-accent\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\[disabled\]\:bg-muted-foreground[data-disabled],.data-\[fixed\]\:bg-muted-foreground[data-fixed]{background-color:hsl(var(--muted-foreground))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[collapsed\=true\]\:py-2[data-collapsed=true]{padding-top:.5rem;padding-bottom:.5rem}.data-\[disabled\]\:text-muted[data-disabled],.data-\[fixed\]\:text-muted[data-fixed]{color:hsl(var(--muted))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed],.data-\[state\=open\]\:duration-300[data-state=open]{transition-duration:.3s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=closed\]\:duration-300[data-state=closed],.data-\[state\=open\]\:duration-300[data-state=open]{animation-duration:.3s}.data-\[disabled\]\:hover\:bg-muted-foreground:hover[data-disabled],.data-\[fixed\]\:hover\:bg-muted-foreground:hover[data-fixed]{background-color:hsl(var(--muted-foreground))}.group[data-state=open] .group-data-\[state\=\"open\"\]\:-rotate-180{--tw-rotate: -180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:border-blue-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-green-500\/10:is(.dark *){background-color:#22c55e1a}.dark\:bg-red-500\/10:is(.dark *){background-color:#ef44441a}.dark\:bg-yellow-500\/10:is(.dark *){background-color:#eab3081a}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:ring-gray-700:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(55 65 81 / var(--tw-ring-opacity, 1))}.dark\:ring-gray-800:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(31 41 55 / var(--tw-ring-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-blue-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-red-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-red-400:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:has-\[\:focus-visible\]\:ring-neutral-300:has(:focus-visible):is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(212 212 212 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:absolute{position:absolute}.sm\:inset-auto{inset:auto}.sm\:bottom-\[calc\(100\%\+10px\)\]{bottom:calc(100% + 10px)}.sm\:left-0{left:0}.sm\:right-0{right:0}.sm\:my-0{margin-top:0;margin-bottom:0}.sm\:my-4{margin-top:1rem;margin-bottom:1rem}.sm\:mt-0{margin-top:0}.sm\:hidden{display:none}.sm\:h-\[80vh\]{height:80vh}.sm\:h-full{height:100%}.sm\:max-h-\[500px\]{max-height:500px}.sm\:max-h-\[600px\]{max-height:600px}.sm\:max-h-\[700px\]{max-height:700px}.sm\:max-h-\[800px\]{max-height:800px}.sm\:w-48{width:12rem}.sm\:w-\[480px\]{width:480px}.sm\:w-\[540px\]{width:540px}.sm\:w-\[90vw\]{width:90vw}.sm\:w-full{width:100%}.sm\:max-w-72{max-width:18rem}.sm\:max-w-\[1025px\]{max-width:1025px}.sm\:max-w-\[425px\]{max-width:425px}.sm\:max-w-\[700px\]{max-width:700px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:max-w-xl{max-width:36rem}.sm\:translate-y-5{--tw-translate-y: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:bottom-0{bottom:0}.md\:right-auto{right:auto}.md\:col-span-1{grid-column:span 1 / span 1}.md\:ml-14{margin-left:3.5rem}.md\:ml-64{margin-left:16rem}.md\:block{display:block}.md\:flex{display:flex}.md\:inline-flex{display:inline-flex}.md\:hidden{display:none}.md\:h-svh{height:100svh}.md\:max-h-screen{max-height:100vh}.md\:w-14{width:3.5rem}.md\:w-32{width:8rem}.md\:w-64{width:16rem}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[31rem\]{max-width:31rem}.md\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:overflow-y-hidden{overflow-y:hidden}.md\:border-none{border-style:none}.md\:px-4{padding-left:1rem;padding-right:1rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\:pt-0{padding-top:0}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.after\:md\:block:after{content:var(--tw-content);display:block}}@media (min-width: 1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-1\/5{width:20%}.lg\:w-\[250px\]{width:250px}.lg\:max-w-none{max-width:none}.lg\:max-w-xl{max-width:36rem}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:flex-col{flex-direction:column}.lg\:gap-8{gap:2rem}.lg\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(0px * var(--tw-space-x-reverse));margin-left:calc(0px * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-12>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(3rem * var(--tw-space-x-reverse));margin-left:calc(3rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-3{padding-left:.75rem;padding-right:.75rem}}@media (min-width: 1280px){.xl\:mr-2{margin-right:.5rem}.xl\:flex{display:flex}.xl\:inline-flex{display:inline-flex}.xl\:h-10{height:2.5rem}.xl\:w-60{width:15rem}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:justify-start{justify-content:flex-start}.xl\:px-3{padding-left:.75rem;padding-right:.75rem}.xl\:py-2{padding-top:.5rem;padding-bottom:.5rem}}.\[\&\:\:-webkit-calendar-picker-indicator\]\:hidden::-webkit-calendar-picker-indicator{display:none}.\[\&\:has\(\>\.day-range-end\)\]\:rounded-r-md:has(>.day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\>\.day-range-start\)\]\:rounded-l-md:has(>.day-range-start){border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:rounded-md:has([aria-selected]){border-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]){background-color:hsl(var(--accent))}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:has([aria-selected]):first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:has([aria-selected]):last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\.day-outside\)\]\:bg-accent\/50:has([aria-selected].day-outside){background-color:hsl(var(--accent) / .5)}.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} +*,: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-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9%}.collapsibleDropdown{overflow:hidden}.collapsibleDropdown[data-state=open]{animation:slideDown .2s ease-out}.collapsibleDropdown[data-state=closed]{animation:slideUp .2s ease-out}@keyframes slideDown{0%{height:0}to{height:var(--radix-collapsible-content-height)}}@keyframes slideUp{0%{height:var(--radix-collapsible-content-height)}to{height:0}}*{border-color:hsl(var(--border))}body{min-height:100svh;width:100%;background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-left-1{left:-.25rem}.-right-1{right:-.25rem}.-right-5{right:-1.25rem}.-top-1\/2{top:-50%}.bottom-0{bottom:0}.bottom-5{bottom:1.25rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-4{left:1rem}.left-5{left:1.25rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-5{right:1.25rem}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[-1\]{z-index:-1}.z-\[1\]{z-index:1}.col-span-2{grid-column:span 2 / span 2}.-m-0\.5{margin:-.125rem}.m-1{margin:.25rem}.m-auto{margin:auto}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.-ml-3{margin-left:-.75rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-8{margin-left:2rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.\!table{display:table!important}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-\[16\/9\]{aspect-ratio:16/9}.aspect-square{aspect-ratio:1 / 1}.size-10{width:2.5rem;height:2.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.h-0{height:0px}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[180px\]{height:180px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[90vh\]{height:90vh}.h-\[calc\(100\%-var\(--header-height\)\)\]{height:calc(100% - var(--header-height))}.h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.h-\[var\(--header-height\)\]{height:var(--header-height)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-0{max-height:0px}.max-h-12{max-height:3rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[95\%\]{max-height:95%}.max-h-screen{max-height:100vh}.min-h-10{min-height:2.5rem}.min-h-6{min-height:1.5rem}.min-h-\[120px\]{min-height:120px}.min-h-\[200px\]{min-height:200px}.min-h-\[60px\]{min-height:60px}.w-0{width:0px}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[250px\]{width:250px}.w-\[300px\]{width:300px}.w-\[400px\]{width:400px}.w-\[50px\]{width:50px}.w-\[70px\]{width:70px}.w-\[80px\]{width:80px}.w-auto{width:auto}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.min-w-0{min-width:0px}.min-w-20{min-width:5rem}.min-w-\[10em\]{min-width:10em}.min-w-\[300px\]{min-width:300px}.min-w-\[40px\]{min-width:40px}.min-w-\[4rem\]{min-width:4rem}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-32{max-width:8rem}.max-w-4xl{max-width:56rem}.max-w-52{max-width:13rem}.max-w-80{max-width:20rem}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[500px\]{max-width:500px}.max-w-\[60\%\]{max-width:60%}.max-w-\[600px\]{max-width:600px}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-none{max-width:none}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.flex-\[1\.2\]{flex:1.2}.flex-\[1\]{flex:1}.flex-\[2\]{flex:2}.flex-\[4\]{flex:4}.flex-\[5\]{flex:5}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-180{--tw-rotate: -180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-125{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-help{cursor:help}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[100px_1fr\]{grid-template-columns:100px 1fr}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-1{-moz-column-gap:.25rem;column-gap:.25rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-2{row-gap:.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.625rem * var(--tw-space-x-reverse));margin-left:calc(.625rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-wrap{text-wrap:wrap}.text-nowrap{text-wrap:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-lg{border-top-left-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-r-lg{border-top-right-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-bl-none{border-bottom-left-radius:0}.rounded-br-none{border-bottom-right-radius:0}.rounded-tl-lg{border-top-left-radius:var(--radius)}.rounded-tl-none{border-top-left-radius:0}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-lg{border-top-right-radius:var(--radius)}.rounded-tr-none{border-top-right-radius:0}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-x-0{border-left-width:0px;border-right-width:0px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-0{border-left-width:0px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-r-0{border-right-width:0px}.border-r-2{border-right-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.border-blue-500\/50{border-color:#3b82f680}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-foreground\/10{border-color:hsl(var(--foreground) / .1)}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/25{border-color:hsl(var(--muted-foreground) / .25)}.border-orange-500\/50{border-color:#f9731680}.border-primary{border-color:hsl(var(--primary))}.border-primary\/40{border-color:hsl(var(--primary) / .4)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-l-slate-500{--tw-border-opacity: 1;border-left-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.border-l-transparent{border-left-color:transparent}.border-r-muted{border-right-color:hsl(var(--muted))}.border-t-transparent{border-top-color:transparent}.bg-accent{background-color:hsl(var(--accent))}.bg-background{background-color:hsl(var(--background))}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/80{background-color:#000c}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-destructive\/15{background-color:hsl(var(--destructive) / .15)}.bg-destructive\/80{background-color:hsl(var(--destructive) / .8)}.bg-emerald-500\/80{background-color:#10b981cc}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-inherit{background-color:inherit}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground{background-color:hsl(var(--primary-foreground))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/50{background-color:hsl(var(--secondary) / .5)}.bg-slate-100\/80{background-color:#f1f5f9cc}.bg-transparent{background-color:transparent}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/80{background-color:#eab308cc}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-background\/95{--tw-gradient-from: hsl(var(--background) / .95) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background\/80{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background) / .8) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-background\/60{--tw-gradient-to: hsl(var(--background) / .6) var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-primary{fill:hsl(var(--primary))}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-0\.5{padding-bottom:.125rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-3{padding-left:.75rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-7{padding-right:1.75rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-16{padding-top:4rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.625rem\]{font-size:.625rem}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[7rem\]{font-size:7rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-10{line-height:2.5rem}.leading-none{line-height:1}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/70{color:hsl(var(--foreground) / .7)}.text-foreground\/90{color:hsl(var(--foreground) / .9)}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/30{color:hsl(var(--muted-foreground) / .3)}.text-muted-foreground\/40{color:hsl(var(--muted-foreground) / .4)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/70{color:hsl(var(--muted-foreground) / .7)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/90{color:hsl(var(--primary) / .9)}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-destructive\/50{--tw-shadow-color: hsl(var(--destructive) / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/50{--tw-shadow-color: rgb(16 185 129 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-yellow-500\/50{--tw-shadow-color: rgb(234 179 8 / .5);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-gray-200{--tw-ring-opacity: 1;--tw-ring-color: rgb(229 231 235 / var(--tw-ring-opacity, 1))}.ring-gray-300\/20{--tw-ring-color: rgb(209 213 219 / .2)}.ring-green-500\/20{--tw-ring-color: rgb(34 197 94 / .2)}.ring-primary\/20{--tw-ring-color: hsl(var(--primary) / .2)}.ring-offset-2{--tw-ring-offset-width: 2px}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.ring-offset-white{--tw-ring-offset-color: #fff}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-\[1px\]{--tw-backdrop-blur: blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[max-height\,padding\]{transition-property:max-height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[opacity\]{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-100{transition-delay:.1s}.delay-150{transition-delay:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-700{animation-duration:.7s}.delay-100{animation-delay:.1s}.delay-150{animation-delay:.15s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}html{overflow-y:scroll}.sticky{position:sticky!important;z-index:2;background-color:hsl(var(--card))}.sticky.before\:right-0:before,.sticky.before\:left-0:before{content:"";position:absolute;top:0;bottom:0;width:2px;background:linear-gradient(to right,rgba(0,0,0,.08),transparent);opacity:1;transition:opacity .3s ease}.sticky.before\:right-0:before{right:-1px;background:linear-gradient(to right,rgba(0,0,0,.08),transparent)}.sticky.before\:right-0:after{content:"";position:absolute;top:0;right:-8px;bottom:0;width:8px;pointer-events:none;background:linear-gradient(to right,rgba(0,0,0,.05),transparent)}.sticky.before\:left-0:before{left:-1px;background:linear-gradient(to left,rgba(0,0,0,.08),transparent)}.sticky.before\:left-0:after{content:"";position:absolute;top:0;left:-8px;bottom:0;width:8px;pointer-events:none;background:linear-gradient(to left,rgba(0,0,0,.05),transparent)}.sticky:hover:before{opacity:.8}.dark .sticky.before\:right-0:before,.dark .sticky.before\:left-0:before{background:linear-gradient(to right,rgba(255,255,255,.05),transparent)}.dark .sticky.before\:right-0:after,.dark .sticky.before\:left-0:after{background:linear-gradient(to right,rgba(255,255,255,.03),transparent)}.\*\:\!inline-block>*{display:inline-block!important}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.before\:absolute:before{content:var(--tw-content);position:absolute}.before\:bottom-0:before{content:var(--tw-content);bottom:0}.before\:left-0:before{content:var(--tw-content);left:0}.before\:right-0:before{content:var(--tw-content);right:0}.before\:top-0:before{content:var(--tw-content);top:0}.before\:w-\[1px\]:before{content:var(--tw-content);width:1px}.before\:bg-border:before{content:var(--tw-content);background-color:hsl(var(--border))}.after\:pointer-events-none:after{content:var(--tw-content);pointer-events:none}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:bottom-0:after{content:var(--tw-content);bottom:0}.after\:left-0:after{content:var(--tw-content);left:0}.after\:hidden:after{content:var(--tw-content);display:none}.after\:h-32:after{content:var(--tw-content);height:8rem}.after\:w-full:after{content:var(--tw-content);width:100%}.after\:bg-\[linear-gradient\(180deg\,_transparent_10\%\,_hsl\(var\(--background\)\)_70\%\)\]:after{content:var(--tw-content);background-image:linear-gradient(180deg,transparent 10%,hsl(var(--background)) 70%)}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.focus-within\:ring-1:focus-within{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-within\:ring-ring:focus-within{--tw-ring-color: hsl(var(--ring))}.hover\:-translate-y-1:hover{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-background:hover{background-color:hsl(var(--background))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-card\/80:hover{background-color:hsl(var(--card) / .8)}.hover\:bg-destructive\/10:hover{background-color:hsl(var(--destructive) / .1)}.hover\:bg-destructive\/25:hover{background-color:hsl(var(--destructive) / .25)}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-100:hover{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.hover\:bg-inherit:hover{background-color:inherit}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/40:hover{background-color:hsl(var(--muted) / .4)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-muted\/60:hover{background-color:hsl(var(--muted) / .6)}.hover\:bg-muted\/70:hover{background-color:hsl(var(--muted) / .7)}.hover\:bg-primary:hover{background-color:hsl(var(--primary))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary-foreground\/10:hover{background-color:hsl(var(--secondary-foreground) / .1)}.hover\:bg-secondary\/70:hover{background-color:hsl(var(--secondary) / .7)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-200\/80:hover{background-color:#e2e8f0cc}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-yellow-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.hover\:bg-opacity-80:hover{--tw-bg-opacity: .8}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-foreground\/70:hover{color:hsl(var(--foreground) / .7)}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-black\/30:hover{--tw-shadow-color: rgb(0 0 0 / .3);--tw-shadow: var(--tw-shadow-colored)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:z-10:focus{z-index:10}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-primary:focus{background-color:hsl(var(--primary))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-destructive:focus{color:hsl(var(--destructive))}.focus\:text-primary-foreground:focus{color:hsl(var(--primary-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-primary:focus-visible{--tw-ring-color: hsl(var(--primary))}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:via-background\/90{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background) / .9) var(--tw-gradient-via-position), var(--tw-gradient-to)}.group:hover .group-hover\:to-background\/70{--tw-gradient-to: hsl(var(--background) / .7) var(--tw-gradient-to-position)}.group\/id:hover .group-hover\/id\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group[data-collapsed=true] .group-\[\[data-collapsed\=true\]\]\:justify-center{justify-content:center}.group[data-collapsed=true] .group-\[\[data-collapsed\=true\]\]\:px-2{padding-left:.5rem;padding-right:.5rem}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\:focus-visible\]\:outline-none:has(:focus-visible){outline:2px solid transparent;outline-offset:2px}.has-\[\:focus-visible\]\:ring-1:has(:focus-visible){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.has-\[\:focus-visible\]\:ring-neutral-950:has(:focus-visible){--tw-ring-opacity: 1;--tw-ring-color: rgb(10 10 10 / var(--tw-ring-opacity, 1))}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:bg-accent\/50[aria-selected=true]{background-color:hsl(var(--accent) / .5)}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[state\=dragging\]\:cursor-grabbing[data-state=dragging]{cursor:grabbing}.data-\[active\]\:bg-accent\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\[disabled\]\:bg-muted-foreground[data-disabled],.data-\[fixed\]\:bg-muted-foreground[data-fixed]{background-color:hsl(var(--muted-foreground))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[collapsed\=true\]\:py-2[data-collapsed=true]{padding-top:.5rem;padding-bottom:.5rem}.data-\[disabled\]\:text-muted[data-disabled],.data-\[fixed\]\:text-muted[data-fixed]{color:hsl(var(--muted))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed],.data-\[state\=open\]\:duration-300[data-state=open]{transition-duration:.3s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=closed\]\:duration-300[data-state=closed],.data-\[state\=open\]\:duration-300[data-state=open]{animation-duration:.3s}.data-\[disabled\]\:hover\:bg-muted-foreground:hover[data-disabled],.data-\[fixed\]\:hover\:bg-muted-foreground:hover[data-fixed]{background-color:hsl(var(--muted-foreground))}.group[data-state=open] .group-data-\[state\=\"open\"\]\:-rotate-180{--tw-rotate: -180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:border-blue-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-green-500\/10:is(.dark *){background-color:#22c55e1a}.dark\:bg-red-500\/10:is(.dark *){background-color:#ef44441a}.dark\:bg-yellow-500\/10:is(.dark *){background-color:#eab3081a}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:ring-gray-700:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(55 65 81 / var(--tw-ring-opacity, 1))}.dark\:ring-gray-800:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(31 41 55 / var(--tw-ring-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:placeholder\:text-gray-500:is(.dark *)::placeholder{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-blue-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-red-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-red-400:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:has-\[\:focus-visible\]\:ring-neutral-300:has(:focus-visible):is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(212 212 212 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:absolute{position:absolute}.sm\:inset-auto{inset:auto}.sm\:bottom-\[calc\(100\%\+10px\)\]{bottom:calc(100% + 10px)}.sm\:left-0{left:0}.sm\:right-0{right:0}.sm\:my-0{margin-top:0;margin-bottom:0}.sm\:my-4{margin-top:1rem;margin-bottom:1rem}.sm\:mt-0{margin-top:0}.sm\:hidden{display:none}.sm\:h-\[80vh\]{height:80vh}.sm\:h-full{height:100%}.sm\:max-h-\[500px\]{max-height:500px}.sm\:max-h-\[600px\]{max-height:600px}.sm\:max-h-\[700px\]{max-height:700px}.sm\:max-h-\[800px\]{max-height:800px}.sm\:w-48{width:12rem}.sm\:w-\[480px\]{width:480px}.sm\:w-\[540px\]{width:540px}.sm\:w-\[90vw\]{width:90vw}.sm\:w-full{width:100%}.sm\:max-w-72{max-width:18rem}.sm\:max-w-\[1025px\]{max-width:1025px}.sm\:max-w-\[425px\]{max-width:425px}.sm\:max-w-\[700px\]{max-width:700px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:max-w-xl{max-width:36rem}.sm\:translate-y-5{--tw-translate-y: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:bottom-0{bottom:0}.md\:right-auto{right:auto}.md\:col-span-1{grid-column:span 1 / span 1}.md\:ml-14{margin-left:3.5rem}.md\:ml-64{margin-left:16rem}.md\:block{display:block}.md\:flex{display:flex}.md\:inline-flex{display:inline-flex}.md\:hidden{display:none}.md\:h-svh{height:100svh}.md\:max-h-screen{max-height:100vh}.md\:w-14{width:3.5rem}.md\:w-32{width:8rem}.md\:w-64{width:16rem}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[31rem\]{max-width:31rem}.md\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:overflow-y-hidden{overflow-y:hidden}.md\:border-none{border-style:none}.md\:px-4{padding-left:1rem;padding-right:1rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\:pt-0{padding-top:0}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.after\:md\:block:after{content:var(--tw-content);display:block}}@media (min-width: 1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-1\/5{width:20%}.lg\:w-\[250px\]{width:250px}.lg\:max-w-none{max-width:none}.lg\:max-w-xl{max-width:36rem}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:flex-col{flex-direction:column}.lg\:gap-8{gap:2rem}.lg\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(0px * var(--tw-space-x-reverse));margin-left:calc(0px * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-12>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(3rem * var(--tw-space-x-reverse));margin-left:calc(3rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-3{padding-left:.75rem;padding-right:.75rem}}@media (min-width: 1280px){.xl\:mr-2{margin-right:.5rem}.xl\:flex{display:flex}.xl\:inline-flex{display:inline-flex}.xl\:h-10{height:2.5rem}.xl\:w-60{width:15rem}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:justify-start{justify-content:flex-start}.xl\:px-3{padding-left:.75rem;padding-right:.75rem}.xl\:py-2{padding-top:.5rem;padding-bottom:.5rem}}.\[\&\:\:-webkit-calendar-picker-indicator\]\:hidden::-webkit-calendar-picker-indicator{display:none}.\[\&\:has\(\>\.day-range-end\)\]\:rounded-r-md:has(>.day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\>\.day-range-start\)\]\:rounded-l-md:has(>.day-range-start){border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:rounded-md:has([aria-selected]){border-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]){background-color:hsl(var(--accent))}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:has([aria-selected]):first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:has([aria-selected]):last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\.day-outside\)\]\:bg-accent\/50:has([aria-selected].day-outside){background-color:hsl(var(--accent) / .5)}.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} diff --git a/public/assets/admin/assets/index.js b/public/assets/admin/assets/index.js index c5c8e87..9be2aa8 100644 --- a/public/assets/admin/assets/index.js +++ b/public/assets/admin/assets/index.js @@ -1,7 +1,7 @@ -import{r as o,j as e,t as cl,c as dl,I as fa,a as ys,S as Wt,u as as,b as _t,d as ul,O as Jt,e as xl,f as L,g as ml,h as hl,i as jl,Q as gl,k as fl,R as pl,l as vl,P as bl,m as yl,B as Nl,n as La,F as wl,C as _l,o as Cl,p as Sl,q as kl,s as Tl,v as Dl,z as u,w as $a,x as ae,y as ie,A as Aa,D as Ct,E as St,G as Qt,H as Me,T as kt,J as Tt,K as Ha,L as Ka,M as Pl,N as Il,U as Vl,V as Rl,W as qa,X as Zt,Y as Ua,Z as El,_ as Ba,$ as Ga,a0 as Ya,a1 as Wa,a2 as Ns,a3 as Ja,a4 as Fl,a5 as Qa,a6 as Za,a7 as Ml,a8 as zl,a9 as Ol,aa as Ll,ab as Xa,ac as $l,ad as Al,ae as ws,af as en,ag as Hl,ah as Kl,ai as sn,aj as ql,ak as Ul,al as pa,am as Bl,an as tn,ao as Gl,ap as an,aq as Yl,ar as Wl,as as Jl,at as Ql,au as Zl,av as Xl,aw as nn,ax as ei,ay as si,az as ti,aA as we,aB as ai,aC as ni,aD as ri,aE as li,aF as rn,aG as ln,aH as on,aI as ii,aJ as cn,aK as dn,aL as un,aM as oi,aN as ci,aO as di,aP as xn,aQ as ui,aR as Xt,aS as mn,aT as xi,aU as hn,aV as mi,aW as jn,aX as hi,aY as gn,aZ as fn,a_ as ji,a$ as gi,b0 as pn,b1 as fi,b2 as pi,b3 as vn,b4 as vi,b5 as bn,b6 as bi,b7 as yi,b8 as He,b9 as Q,ba as Pe,bb as rt,bc as Ni,bd as wi,be as _i,bf as Ci,bg as Si,bh as ki,bi as va,bj as ba,bk as Ti,bl as Di,bm as Pi,bn as Ii,bo as Vi,bp as Ri,bq as yn,br as Ei,bs as Nn,bt as Fi,bu as Mi,bv as wn,bw as zi,bx as de,by as Oi,bz as ya,bA as Ht,bB as Kt,bC as Li,bD as $i,bE as _n,bF as Ai,bG as ea,bH as Hi,bI as Ki,bJ as qi,bK as Cn,bL as Sn,bM as kn,bN as Ui,bO as Bi,bP as Gi,bQ as Yi,bR as Tn,bS as Wi,bT as We,bU as Ji,bV as Qi,bW as vt,bX as Ne,bY as Na,bZ as Zi,b_ as Dn,b$ as Pn,c0 as In,c1 as Vn,c2 as Rn,c3 as En,c4 as Xi,c5 as eo,c6 as so,c7 as Dt,c8 as _s,c9 as ns,ca as Le,cb as $e,cc as Ke,cd as qe,ce as Ue,cf as wa,cg as to,ch as ao,ci as no,cj as qt,ck as rs,cl as ls,cm as Fn,cn as Mn,co as lt,cp as ro,cq as lo,cr as _a,cs as zn,ct as Ca,cu as bt,cv as io,cw as oo,cx as On,cy as co,cz as uo,cA as Ln,cB as Ut,cC as $n,cD as xo,cE as An,cF as mo,cG as ho,cH as jo,cI as go,cJ as fo,cK as po}from"./vendor.js";import"./index.js";var oh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ch(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function vo(s){if(s.__esModule)return s;var t=s.default;if(typeof t=="function"){var a=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};a.prototype=t.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(s).forEach(function(n){var l=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(a,n,l.get?l:{enumerable:!0,get:function(){return s[n]}})}),a}const bo={theme:"system",setTheme:()=>null},Hn=o.createContext(bo);function yo({children:s,defaultTheme:t="system",storageKey:a="vite-ui-theme",...n}){const[l,c]=o.useState(()=>localStorage.getItem(a)||t);o.useEffect(()=>{const x=window.document.documentElement;if(x.classList.remove("light","dark"),l==="system"){const r=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";x.classList.add(r);return}x.classList.add(l)},[l]);const d={theme:l,setTheme:x=>{localStorage.setItem(a,x),c(x)}};return e.jsx(Hn.Provider,{...n,value:d,children:s})}const No=()=>{const s=o.useContext(Hn);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},wo=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),_o=function(s,t){return new URL(s,t).href},Sa={},X=function(t,a,n){let l=Promise.resolve();if(a&&a.length>0){const d=document.getElementsByTagName("link"),x=document.querySelector("meta[property=csp-nonce]"),r=x?.nonce||x?.getAttribute("nonce");l=Promise.allSettled(a.map(i=>{if(i=_o(i,n),i in Sa)return;Sa[i]=!0;const h=i.endsWith(".css"),D=h?'[rel="stylesheet"]':"";if(!!n)for(let w=d.length-1;w>=0;w--){const _=d[w];if(_.href===i&&(!h||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${D}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":wo,h||(m.as="script"),m.crossOrigin="",m.href=i,r&&m.setAttribute("nonce",r),document.head.appendChild(m),h)return new Promise((w,_)=>{m.addEventListener("load",w),m.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${i}`)))})}))}function c(d){const x=new Event("vite:preloadError",{cancelable:!0});if(x.payload=d,window.dispatchEvent(x),!x.defaultPrevented)throw d}return l.then(d=>{for(const x of d||[])x.status==="rejected"&&c(x.reason);return t().catch(c)})};function b(...s){return cl(dl(s))}const Os=ys("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),T=o.forwardRef(({className:s,variant:t,size:a,asChild:n=!1,children:l,disabled:c,loading:d=!1,leftSection:x,rightSection:r,...i},h)=>{const D=n?Wt:"button";return e.jsxs(D,{className:b(Os({variant:t,size:a,className:s})),disabled:d||c,ref:h,...i,children:[(x&&d||!x&&!r&&d)&&e.jsx(fa,{className:"mr-2 h-4 w-4 animate-spin"}),!d&&x&&e.jsx("div",{className:"mr-2",children:x}),l,!d&&r&&e.jsx("div",{className:"ml-2",children:r}),r&&d&&e.jsx(fa,{className:"ml-2 h-4 w-4 animate-spin"})]})});T.displayName="Button";function Ps({className:s,minimal:t=!1}){const a=as();return e.jsx("div",{className:b("h-svh w-full",s),children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[!t&&e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"500"}),e.jsxs("span",{className:"font-medium",children:["Oops! Something went wrong ",":')"]}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["We apologize for the inconvenience. ",e.jsx("br",{})," Please try again later."]}),!t&&e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(T,{variant:"outline",onClick:()=>a(-1),children:"Go Back"}),e.jsx(T,{onClick:()=>a("/"),children:"Back to Home"})]})]})})}function ka(){const s=as();return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"404"}),e.jsx("span",{className:"font-medium",children:"Oops! Page Not Found!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["It seems like the page you're looking for ",e.jsx("br",{}),"does not exist or might have been removed."]}),e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(T,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(T,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function Co(){return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"503"}),e.jsx("span",{className:"font-medium",children:"Website is under maintenance!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["The site is not available at the moment. ",e.jsx("br",{}),"We'll be back online shortly."]}),e.jsx("div",{className:"mt-6 flex gap-4",children:e.jsx(T,{variant:"outline",children:"Learn more"})})]})})}function So(s){return typeof s>"u"}function ko(s){return s===null}function To(s){return ko(s)||So(s)}class Do{storage;prefixKey;constructor(t){this.storage=t.storage,this.prefixKey=t.prefixKey}getKey(t){return`${this.prefixKey}${t}`.toUpperCase()}set(t,a,n=null){const l=JSON.stringify({value:a,time:Date.now(),expire:n!==null?new Date().getTime()+n*1e3:null});this.storage.setItem(this.getKey(t),l)}get(t,a=null){const n=this.storage.getItem(this.getKey(t));if(!n)return{value:a,time:0};try{const l=JSON.parse(n),{value:c,time:d,expire:x}=l;return To(x)||x>new Date().getTime()?{value:c,time:d}:(this.remove(t),{value:a,time:0})}catch{return this.remove(t),{value:a,time:0}}}remove(t){this.storage.removeItem(this.getKey(t))}clear(){this.storage.clear()}}function Kn({prefixKey:s="",storage:t=sessionStorage}){return new Do({prefixKey:s,storage:t})}const qn="Xboard_",Po=function(s={}){return Kn({prefixKey:s.prefixKey||"",storage:localStorage})},Io=function(s={}){return Kn({prefixKey:s.prefixKey||"",storage:sessionStorage})},Pt=Po({prefixKey:qn});Io({prefixKey:qn});const Un="access_token";function Qs(){return Pt.get(Un)}function Bn(){Pt.remove(Un)}const Ta=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function Vo({children:s}){const t=as(),a=_t(),n=Qs();return o.useEffect(()=>{if(!n.value&&!Ta.includes(a.pathname)){const l=encodeURIComponent(a.pathname+a.search);t(`/sign-in?redirect=${l}`)}},[n.value,a.pathname,a.search,t]),Ta.includes(a.pathname)||n.value?e.jsx(e.Fragment,{children:s}):null}const Ro=()=>e.jsx(Vo,{children:e.jsx(Jt,{})}),Eo=ul([{path:"/sign-in",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>sc);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(Ro,{}),children:[{path:"/",lazy:async()=>({Component:(await X(()=>Promise.resolve().then(()=>jc),void 0,import.meta.url)).default}),errorElement:e.jsx(Ps,{}),children:[{index:!0,lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Md);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(Ps,{}),children:[{path:"system",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Ld);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>qd);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Wd);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>eu);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>ru);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>du);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>ju);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>bu);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Cu);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Pu);return{default:s}},void 0,import.meta.url)).default})}]},{path:"payment",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Hu);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Uu);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Zu);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>lx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(Ps,{}),children:[{path:"manage",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Ix);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Mx);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Hx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(Ps,{}),children:[{path:"plan",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Qx);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>dm);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>vm);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(Ps,{}),children:[{path:"manage",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Hm);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>rh);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:Ps},{path:"/404",Component:ka},{path:"/503",Component:Co},{path:"*",Component:ka}]),Fo="locale";function Mo(){return Pt.get(Fo)}function Gn(){Bn();const s=window.location.pathname,t=s&&!["/404","/sign-in"].includes(s),a=window.location.pathname.split("/"),n=a[1]?`/${a[1]}`:"",l=window.location.hash.split("/")[0]||"",c=`${n}${l}#/sign-in`;window.location.href=c+(t?`?redirect=${s}`:"")}const zo=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function Oo(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const R=xl.create({baseURL:Oo(),timeout:12e3,headers:{"Content-Type":"application/json"}});R.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const t=Qs();if(!zo.includes(s.url?.split("?")[0]||"")){if(!t.value)return Gn(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=t.value}return s.headers["Content-Language"]=Mo().value||"zh-CN",s},s=>Promise.reject(s));R.interceptors.response.use(s=>s?.data||{code:-1,message:"未知错误"},s=>{const t=s.response?.status,a=s.response?.data?.message;return(t===401||t===403)&&Gn(),L.error(a||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[t]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});function Lo(){return R.get("/user/info")}const zt={token:Qs()?.value||"",userInfo:null,isLoggedIn:!!Qs()?.value,loading:!1,error:null},Ws=ml("user/fetchUserInfo",async()=>(await Lo()).data,{condition:(s,{getState:t})=>{const{user:a}=t();return!!a.token&&!a.loading}}),Yn=hl({name:"user",initialState:zt,reducers:{setToken(s,t){s.token=t.payload,s.isLoggedIn=!!t.payload},resetUserState:()=>zt},extraReducers:s=>{s.addCase(Ws.pending,t=>{t.loading=!0,t.error=null}).addCase(Ws.fulfilled,(t,a)=>{t.loading=!1,t.userInfo=a.payload,t.error=null}).addCase(Ws.rejected,(t,a)=>{if(t.loading=!1,t.error=a.error.message||"Failed to fetch user info",!t.token)return zt})}}),{setToken:$o,resetUserState:Ao}=Yn.actions,Ho=s=>s.user.userInfo,Ko=Yn.reducer,Wn=jl({reducer:{user:Ko}});Qs()?.value&&Wn.dispatch(Ws());const qo=new gl;fl.createRoot(document.getElementById("root")).render(e.jsx(pl.StrictMode,{children:e.jsx(vl,{client:qo,children:e.jsx(bl,{store:Wn,children:e.jsxs(yo,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(yl,{router:Eo}),e.jsx(Nl,{richColors:!0,position:"top-right"})]})})})}));const Ie=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:b("rounded-xl border bg-card text-card-foreground shadow",s),...t}));Ie.displayName="Card";const ze=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:b("flex flex-col space-y-1.5 p-6",s),...t}));ze.displayName="CardHeader";const Je=o.forwardRef(({className:s,...t},a)=>e.jsx("h3",{ref:a,className:b("font-semibold leading-none tracking-tight",s),...t}));Je.displayName="CardTitle";const Zs=o.forwardRef(({className:s,...t},a)=>e.jsx("p",{ref:a,className:b("text-sm text-muted-foreground",s),...t}));Zs.displayName="CardDescription";const Oe=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:b("p-6 pt-0",s),...t}));Oe.displayName="CardContent";const Uo=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:b("flex items-center p-6 pt-0",s),...t}));Uo.displayName="CardFooter";const Bo=ys("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),yt=o.forwardRef(({className:s,...t},a)=>e.jsx(La,{ref:a,className:b(Bo(),s),...t}));yt.displayName=La.displayName;const oe=wl,Jn=o.createContext({}),g=({...s})=>e.jsx(Jn.Provider,{value:{name:s.name},children:e.jsx(_l,{...s})}),It=()=>{const s=o.useContext(Jn),t=o.useContext(Qn),{getFieldState:a,formState:n}=Cl(),l=a(s.name,n);if(!s)throw new Error("useFormField should be used within ");const{id:c}=t;return{id:c,name:s.name,formItemId:`${c}-form-item`,formDescriptionId:`${c}-form-item-description`,formMessageId:`${c}-form-item-message`,...l}},Qn=o.createContext({}),j=o.forwardRef(({className:s,...t},a)=>{const n=o.useId();return e.jsx(Qn.Provider,{value:{id:n},children:e.jsx("div",{ref:a,className:b("space-y-2",s),...t})})});j.displayName="FormItem";const f=o.forwardRef(({className:s,...t},a)=>{const{error:n,formItemId:l}=It();return e.jsx(yt,{ref:a,className:b(n&&"text-destructive",s),htmlFor:l,...t})});f.displayName="FormLabel";const v=o.forwardRef(({...s},t)=>{const{error:a,formItemId:n,formDescriptionId:l,formMessageId:c}=It();return e.jsx(Wt,{ref:t,id:n,"aria-describedby":a?`${l} ${c}`:`${l}`,"aria-invalid":!!a,...s})});v.displayName="FormControl";const E=o.forwardRef(({className:s,...t},a)=>{const{formDescriptionId:n}=It();return e.jsx("p",{ref:a,id:n,className:b("text-[0.8rem] text-muted-foreground",s),...t})});E.displayName="FormDescription";const k=o.forwardRef(({className:s,children:t,...a},n)=>{const{error:l,formMessageId:c}=It(),d=l?String(l?.message):t;return d?e.jsx("p",{ref:n,id:c,className:b("text-[0.8rem] font-medium text-destructive",s),...a,children:d}):null});k.displayName="FormMessage";const S=o.forwardRef(({className:s,type:t,...a},n)=>e.jsx("input",{type:t,className:b("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:n,...a}));S.displayName="Input";const Zn=o.forwardRef(({className:s,...t},a)=>{const[n,l]=o.useState(!1);return e.jsxs("div",{className:"relative rounded-md",children:[e.jsx("input",{type:n?"text":"password",className:b("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...t}),e.jsx(T,{type:"button",size:"icon",variant:"ghost",className:"absolute right-1 top-1/2 h-6 w-6 -translate-y-1/2 rounded-md text-muted-foreground",onClick:()=>l(c=>!c),children:n?e.jsx(Sl,{size:18}):e.jsx(kl,{size:18})})]})});Zn.displayName="PasswordInput";const Go=s=>R({url:"/passport/auth/login",method:"post",data:s}),Bt=s=>s;function re(s=void 0,t="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),Dl(s).format(t))}function Yo(s=void 0,t="YYYY-MM-DD"){return re(s,t)}function Rs(s){const t=typeof s=="string"?parseFloat(s):s;return isNaN(t)?"0.00":t.toFixed(2)}function qs(s){const t=typeof s=="string"?parseFloat(s):s;return isNaN(t)?"0.00":(t/100).toFixed(2)}function Nt(s){navigator.clipboard?navigator.clipboard.writeText(s).then(()=>{L.success(Bt("复制成功"))}).catch(t=>{console.error("复制到剪贴板时出错:",t),Da(s)}):Da(s)}function Da(s){const t=document.createElement("button"),a=new Tl(t,{text:()=>s});a.on("success",()=>{L.success(Bt("复制成功")),a.destroy()}),a.on("error",()=>{L.error(Bt("复制失败")),a.destroy()}),t.click()}function Fs(s){const t=s/1024,a=t/1024,n=a/1024,l=n/1024;return l>=1?Rs(l)+" TB":n>=1?Rs(n)+" GB":a>=1?Rs(a)+" MB":Rs(t)+" KB"}const Wo="access_token";function Jo(s){Pt.set(Wo,s)}const Qo=u.object({email:u.string().min(1,{message:"请输入邮箱地址"}).email({message:"邮箱地址格式不正确"}),password:u.string().min(1,{message:"请输入密码"}).min(7,{message:"密码长度至少为7个字符"})});function Zo({className:s,onForgotPassword:t,...a}){const n=as(),l=$a(),c=ae({resolver:ie(Qo),defaultValues:{email:"",password:""}});async function d(x){Go(x).then(({data:r})=>{Jo(r.auth_data),l($o(r.auth_data)),l(Ws()).unwrap(),n("/")})}return e.jsx("div",{className:b("grid gap-6",s),...a,children:e.jsx(oe,{...c,children:e.jsx("form",{onSubmit:c.handleSubmit(d),children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(g,{control:c.control,name:"email",render:({field:x})=>e.jsxs(j,{className:"space-y-1",children:[e.jsx(f,{children:"邮箱地址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"name@example.com",...x})}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"password",render:({field:x})=>e.jsxs(j,{className:"space-y-1",children:[e.jsx(f,{children:"密码"}),e.jsx(v,{children:e.jsx(Zn,{placeholder:"请输入密码",...x})}),e.jsx(k,{})]})}),e.jsx(T,{className:"mt-2",loading:c.formState.isSubmitting,children:"登录"}),e.jsx(T,{variant:"link",type:"button",className:"mt-1 text-sm text-muted-foreground hover:text-primary",onClick:t,children:"忘记密码?"})]})})})})}const ue=Aa,Re=Ha,Xo=Ka,it=Qt,Xn=o.forwardRef(({className:s,...t},a)=>e.jsx(Ct,{ref:a,className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t}));Xn.displayName=Ct.displayName;const ce=o.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(Xo,{children:[e.jsx(Xn,{}),e.jsxs(St,{ref:n,className:b("max-h-[95%] overflow-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...a,children:[t,e.jsxs(Qt,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Me,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ce.displayName=St.displayName;const je=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col space-y-1.5 text-center sm:text-left",s),...t});je.displayName="DialogHeader";const Ee=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});Ee.displayName="DialogFooter";const xe=o.forwardRef(({className:s,...t},a)=>e.jsx(kt,{ref:a,className:b("text-lg font-semibold leading-none tracking-tight",s),...t}));xe.displayName=kt.displayName;const Se=o.forwardRef(({className:s,...t},a)=>e.jsx(Tt,{ref:a,className:b("text-sm text-muted-foreground",s),...t}));Se.displayName=Tt.displayName;const zs=ys("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),W=o.forwardRef(({className:s,variant:t,size:a,asChild:n=!1,...l},c)=>{const d=n?Wt:"button";return e.jsx(d,{className:b(zs({variant:t,size:a,className:s})),ref:c,...l})});W.displayName="Button";function ec(){const[s,t]=o.useState(!1),a="php artisan reset:password 管理员邮箱";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"container grid h-svh flex-col items-center justify-center bg-primary-foreground lg:max-w-none lg:px-0",children:e.jsxs("div",{className:"mx-auto flex w-full flex-col justify-center space-y-2 sm:w-[480px] lg:p-8",children:[e.jsx("div",{className:"mb-4 flex items-center justify-center",children:e.jsx("h1",{className:"text-3xl font-medium",children:window?.settings?.title})}),e.jsxs(Ie,{className:"p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-left",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"登录"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"请输入您的邮箱和密码登录系统"})]}),e.jsx(Zo,{onForgotPassword:()=>t(!0)})]})]})}),e.jsx(ue,{open:s,onOpenChange:t,children:e.jsx(ce,{children:e.jsxs(je,{children:[e.jsx(xe,{children:"忘记密码"}),e.jsx(Se,{children:"在站点目录下执行以下命令找回密码"}),e.jsx("div",{className:"mt-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"rounded-md bg-secondary p-4 pr-12",children:a}),e.jsx(W,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>Nt(a),children:e.jsx(Pl,{className:"h-4 w-4"})})]})})]})})})]})}const sc=Object.freeze(Object.defineProperty({__proto__:null,default:ec},Symbol.toStringTag,{value:"Module"})),be=o.forwardRef(({className:s,fadedBelow:t=!1,fixedHeight:a=!1,...n},l)=>e.jsx("div",{ref:l,className:b("relative flex h-full w-full flex-col",t&&"after:pointer-events-none after:absolute after:bottom-0 after:left-0 after:hidden after:h-32 after:w-full after:bg-[linear-gradient(180deg,_transparent_10%,_hsl(var(--background))_70%)] after:md:block",a&&"md:h-svh",s),...n}));be.displayName="Layout";const ye=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:b("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...t}));ye.displayName="LayoutHeader";const _e=o.forwardRef(({className:s,fixedHeight:t,...a},n)=>e.jsx("div",{ref:n,className:b("flex-1 overflow-hidden px-4 py-6 md:px-8",t&&"h-[calc(100%-var(--header-height))]",s),...a}));_e.displayName="LayoutBody";const er=Il,sr=Vl,tr=Rl,vs=Ml,bs=zl,tc=Ol,ac=o.forwardRef(({className:s,inset:t,children:a,...n},l)=>e.jsxs(qa,{ref:l,className:b("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",s),...n,children:[a,e.jsx(Zt,{className:"ml-auto h-4 w-4"})]}));ac.displayName=qa.displayName;const nc=o.forwardRef(({className:s,...t},a)=>e.jsx(Ua,{ref:a,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...t}));nc.displayName=Ua.displayName;const hs=o.forwardRef(({className:s,sideOffset:t=4,...a},n)=>e.jsx(El,{children:e.jsx(Ba,{ref:n,sideOffset:t,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a})}));hs.displayName=Ba.displayName;const he=o.forwardRef(({className:s,inset:t,...a},n)=>e.jsx(Ga,{ref:n,className:b("relative flex cursor-default cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",s),...a}));he.displayName=Ga.displayName;const rc=o.forwardRef(({className:s,children:t,checked:a,...n},l)=>e.jsxs(Ya,{ref:l,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:a,...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Wa,{children:e.jsx(Ns,{className:"h-4 w-4"})})}),t]}));rc.displayName=Ya.displayName;const lc=o.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(Ja,{ref:n,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Wa,{children:e.jsx(Fl,{className:"h-4 w-4 fill-current"})})}),t]}));lc.displayName=Ja.displayName;const sa=o.forwardRef(({className:s,inset:t,...a},n)=>e.jsx(Qa,{ref:n,className:b("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",s),...a}));sa.displayName=Qa.displayName;const Xs=o.forwardRef(({className:s,...t},a)=>e.jsx(Za,{ref:a,className:b("-mx-1 my-1 h-px bg-muted",s),...t}));Xs.displayName=Za.displayName;const Gt=({className:s,...t})=>e.jsx("span",{className:b("ml-auto text-xs tracking-widest opacity-60",s),...t});Gt.displayName="DropdownMenuShortcut";const le=Ll,se=$l,te=Al,ee=o.forwardRef(({className:s,sideOffset:t=4,...a},n)=>e.jsx(Xa,{ref:n,sideOffset:t,className:b("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a}));ee.displayName=Xa.displayName;function Vt(){const{pathname:s}=_t();return{checkActiveNav:a=>{if(a==="/"&&s==="/")return!0;const n=a.replace(/^\//,""),l=s.replace(/^\//,"");return n?l.startsWith(n):!1}}}function ar({key:s,defaultValue:t}){const[a,n]=o.useState(()=>{const l=localStorage.getItem(s);return l!==null?JSON.parse(l):t});return o.useEffect(()=>{localStorage.setItem(s,JSON.stringify(a))},[a,s]),[a,n]}function ic(){const[s,t]=ar({key:"expanded-sidebar-items",defaultValue:["仪表盘","系统管理","节点管理","订阅管理","用户管理"]});return{expandedItems:s,toggleItem:n=>{t(l=>l.includes(n)?l.filter(c=>c!==n):[...l,n])},isExpanded:n=>s.includes(n)}}function oc({links:s,isCollapsed:t,className:a,closeNav:n}){const l=({sub:c,...d})=>{const x=`${d.title}-${d.href}`;return t&&c?o.createElement(uc,{...d,sub:c,key:x,closeNav:n}):t?o.createElement(dc,{...d,key:x,closeNav:n}):c?o.createElement(cc,{...d,sub:c,key:x,closeNav:n}):o.createElement(nr,{...d,key:x,closeNav:n})};return e.jsx("div",{"data-collapsed":t,className:b("group border-b bg-background py-2 transition-[max-height,padding] duration-500 data-[collapsed=true]:py-2 md:border-none",a),children:e.jsx(le,{delayDuration:0,children:e.jsx("nav",{className:"grid gap-1 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2",children:s.map(l)})})})}function nr({title:s,icon:t,label:a,href:n,closeNav:l,subLink:c=!1}){const{checkActiveNav:d}=Vt();return e.jsxs(ws,{to:n,onClick:l,className:b(Os({variant:d(n)?"secondary":"ghost",size:"sm"}),"h-12 justify-start text-wrap rounded-none px-6",c&&"h-10 w-full border-l border-l-slate-500 px-2"),"aria-current":d(n)?"page":void 0,children:[e.jsx("div",{className:"mr-2",children:t}),s,a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:a})]})}function cc({title:s,icon:t,label:a,sub:n,closeNav:l}){const{checkActiveNav:c}=Vt(),{isExpanded:d,toggleItem:x}=ic(),r=!!n?.find(h=>c(h.href)),i=d(s)||r;return e.jsxs(er,{open:i,onOpenChange:()=>x(s),children:[e.jsxs(sr,{className:b(Os({variant:"ghost",size:"sm"}),"group h-12 w-full justify-start rounded-none px-6"),children:[e.jsx("div",{className:"mr-2",children:t}),s,a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:a}),e.jsx("span",{className:b('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(en,{stroke:1})})]}),e.jsx(tr,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:n.map(h=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(nr,{...h,subLink:!0,closeNav:l})},h.title))})})]})}function dc({title:s,icon:t,label:a,href:n}){const{checkActiveNav:l}=Vt();return e.jsxs(se,{delayDuration:0,children:[e.jsx(te,{asChild:!0,children:e.jsxs(ws,{to:n,className:b(Os({variant:l(n)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[t,e.jsx("span",{className:"sr-only",children:s})]})}),e.jsxs(ee,{side:"right",className:"flex items-center gap-4",children:[s,a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:a})]})]})}function uc({title:s,icon:t,label:a,sub:n}){const{checkActiveNav:l}=Vt(),c=!!n?.find(d=>l(d.href));return e.jsxs(vs,{children:[e.jsxs(se,{delayDuration:0,children:[e.jsx(te,{asChild:!0,children:e.jsx(bs,{asChild:!0,children:e.jsx(T,{variant:c?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:t})})}),e.jsxs(ee,{side:"right",className:"flex items-center gap-4",children:[s," ",a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:a}),e.jsx(en,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(hs,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(sa,{children:[s," ",a?`(${a})`:""]}),e.jsx(Xs,{}),n.map(({title:d,icon:x,label:r,href:i})=>e.jsx(he,{asChild:!0,children:e.jsxs(ws,{to:i,className:`${l(i)?"bg-secondary":""}`,children:[x," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:d}),r&&e.jsx("span",{className:"ml-auto text-xs",children:r})]})},`${d}-${i}`))]})]})}const rr=[{title:"仪表盘",label:"",href:"/",icon:e.jsx(Hl,{size:18})},{title:"系统管理",label:"",href:"",icon:e.jsx(Kl,{size:18}),sub:[{title:"系统配置",label:"",href:"/config/system",icon:e.jsx(sn,{size:18})},{title:"主题配置",label:"",href:"/config/theme",icon:e.jsx(ql,{size:18})},{title:"公告管理",label:"",href:"/config/notice",icon:e.jsx(Ul,{size:18})},{title:"支付配置",label:"",href:"/config/payment",icon:e.jsx(pa,{size:18})},{title:"知识库管理",label:"",href:"/config/knowledge",icon:e.jsx(Bl,{size:18})}]},{title:"节点管理",label:"",href:"",icon:e.jsx(tn,{size:18}),sub:[{title:"节点管理",label:"",href:"/server/manage",icon:e.jsx(Gl,{size:18})},{title:"权限组管理",label:"",href:"/server/group",icon:e.jsx(an,{size:18})},{title:"路由管理",label:"",href:"/server/route",icon:e.jsx(Yl,{size:18})}]},{title:"订阅管理",label:"",href:"",icon:e.jsx(Wl,{size:18}),sub:[{title:"套餐管理",label:"",href:"/finance/plan",icon:e.jsx(Jl,{size:18})},{title:"订单管理",label:"",href:"/finance/order",icon:e.jsx(pa,{size:18})},{title:"优惠券管理",label:"",href:"/finance/coupon",icon:e.jsx(Ql,{size:18})}]},{title:"用户管理",label:"",href:"",icon:e.jsx(Zl,{size:18}),sub:[{title:"用户管理",label:"",href:"/user/manage",icon:e.jsx(Xl,{size:18})},{title:"工单管理",label:"",href:"/user/ticket",icon:e.jsx(nn,{size:18})}]}];function xc({className:s,isCollapsed:t,setIsCollapsed:a}){const[n,l]=o.useState(!1);return o.useEffect(()=>{n?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[n]),e.jsxs("aside",{className:b(`fixed left-0 right-0 top-0 z-50 w-full border-r-2 border-r-muted transition-[width] md:bottom-0 md:right-auto md:h-svh ${t?"md:w-14":"md:w-64"}`,s),children:[e.jsx("div",{onClick:()=>l(!1),className:`absolute inset-0 transition-[opacity] delay-100 duration-700 ${n?"h-svh opacity-50":"h-0 opacity-0"} w-full bg-black md:hidden`}),e.jsxs(be,{children:[e.jsxs(ye,{className:"sticky top-0 justify-between px-4 py-3 shadow md:px-4",children:[e.jsxs("div",{className:`flex items-center ${t?"":"gap-2"}`,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:`transition-all ${t?"h-6 w-6":"h-8 w-8"}`,children:[e.jsx("rect",{width:"256",height:"256",fill:"none"}),e.jsx("line",{x1:"208",y1:"128",x2:"128",y2:"208",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("line",{x1:"192",y1:"40",x2:"40",y2:"192",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("span",{className:"sr-only",children:"Website Name"})]}),e.jsx("div",{className:`flex flex-col justify-end truncate ${t?"invisible w-0":"visible w-auto"}`,children:e.jsx("span",{className:"font-medium",children:window?.settings?.title})})]}),e.jsx(T,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Toggle Navigation","aria-controls":"sidebar-menu","aria-expanded":n,onClick:()=>l(c=>!c),children:n?e.jsx(ei,{}):e.jsx(si,{})})]}),e.jsx(oc,{id:"sidebar-menu",className:`h-full flex-1 overflow-auto ${n?"max-h-screen":"max-h-0 py-0 md:max-h-screen md:py-2"}`,closeNav:()=>l(!1),isCollapsed:t,links:rr}),e.jsx(T,{onClick:()=>a(c=>!c),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex",children:e.jsx(ti,{stroke:1.5,className:`h-5 w-5 ${t?"rotate-180":""}`})})]})]})}function mc(){const[s,t]=ar({key:"collapsed-sidebar",defaultValue:!1});return o.useEffect(()=>{const a=()=>{t(window.innerWidth<768?!1:s)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[s,t]),[s,t]}function hc(){const[s,t]=mc();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(xc,{isCollapsed:s,setIsCollapsed:t}),e.jsx("main",{id:"content",className:`overflow-x-hidden pt-16 transition-[margin] md:overflow-y-hidden md:pt-0 ${s?"md:ml-14":"md:ml-64"} h-full`,children:e.jsx(Jt,{})})]})}const jc=Object.freeze(Object.defineProperty({__proto__:null,default:hc},Symbol.toStringTag,{value:"Module"})),js=o.forwardRef(({className:s,...t},a)=>e.jsx(we,{ref:a,className:b("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...t}));js.displayName=we.displayName;const gc=({children:s,...t})=>e.jsx(ue,{...t,children:e.jsx(ce,{className:"overflow-hidden p-0",children:e.jsx(js,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:s})})}),Cs=o.forwardRef(({className:s,...t},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(ai,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(we.Input,{ref:a,className:b("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",s),...t})]}));Cs.displayName=we.Input.displayName;const gs=o.forwardRef(({className:s,...t},a)=>e.jsx(we.List,{ref:a,className:b("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...t}));gs.displayName=we.List.displayName;const Ss=o.forwardRef((s,t)=>e.jsx(we.Empty,{ref:t,className:"py-6 text-center text-sm",...s}));Ss.displayName=we.Empty.displayName;const Ve=o.forwardRef(({className:s,...t},a)=>e.jsx(we.Group,{ref:a,className:b("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",s),...t}));Ve.displayName=we.Group.displayName;const Ls=o.forwardRef(({className:s,...t},a)=>e.jsx(we.Separator,{ref:a,className:b("-mx-1 h-px bg-border",s),...t}));Ls.displayName=we.Separator.displayName;const ve=o.forwardRef(({className:s,...t},a)=>e.jsx(we.Item,{ref:a,className:b("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...t}));ve.displayName=we.Item.displayName;function fc(){const s=[];for(const t of rr)if(t.href&&s.push(t),t.sub)for(const a of t.sub)s.push({...a,parent:t.title});return s}function ke(){const[s,t]=o.useState(!1),a=as(),n=fc();o.useEffect(()=>{const c=d=>{d.key==="k"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),t(x=>!x))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]);const l=o.useCallback(c=>{t(!1),a(c)},[a]);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-10 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>t(!0),children:[e.jsx(ni,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex",children:"搜索..."}),e.jsx("span",{className:"sr-only",children:"搜索"}),e.jsxs("kbd",{className:"pointer-events-none absolute right-1.5 top-2 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsxs(gc,{open:s,onOpenChange:t,children:[e.jsx(Cs,{placeholder:"搜索所有菜单和功能..."}),e.jsxs(gs,{children:[e.jsx(Ss,{children:"未找到相关结果"}),e.jsx(Ve,{heading:"菜单导航",children:n.map(c=>e.jsxs(ve,{value:`${c.parent?c.parent+" ":""}${c.title}`,onSelect:()=>l(c.href),children:[e.jsx("div",{className:"mr-2",children:c.icon}),e.jsx("span",{children:c.title}),c.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c.parent})]},c.href))})]})]})]})}function Te(){const{theme:s,setTheme:t}=No();return o.useEffect(()=>{const a=s==="dark"?"#020817":"#fff",n=document.querySelector("meta[name='theme-color']");n&&n.setAttribute("content",a)},[s]),e.jsx(T,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>t(s==="light"?"dark":"light"),children:s==="light"?e.jsx(ri,{size:20}):e.jsx(li,{size:20})})}const lr=o.forwardRef(({className:s,...t},a)=>e.jsx(rn,{ref:a,className:b("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...t}));lr.displayName=rn.displayName;const ir=o.forwardRef(({className:s,...t},a)=>e.jsx(ln,{ref:a,className:b("aspect-square h-full w-full",s),...t}));ir.displayName=ln.displayName;const or=o.forwardRef(({className:s,...t},a)=>e.jsx(on,{ref:a,className:b("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...t}));or.displayName=on.displayName;function De(){const s=as(),t=$a(),a=ii(Ho),n=()=>{Bn(),t(Ao()),s("/sign-in")},l=a?.email?.split("@")[0]||"User",c=l.substring(0,2).toUpperCase();return e.jsxs(vs,{children:[e.jsx(bs,{asChild:!0,children:e.jsx(T,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(lr,{className:"h-8 w-8",children:[e.jsx(ir,{src:a?.avatar_url,alt:l}),e.jsx(or,{children:c})]})})}),e.jsxs(hs,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(sa,{className:"font-normal",children:e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("p",{className:"text-sm font-medium leading-none",children:l}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:a?.email||"user@example.com"})]})}),e.jsx(Xs,{}),e.jsx(he,{asChild:!0,children:e.jsxs(ws,{to:"/config/system",children:["设置",e.jsx(Gt,{children:"⌘S"})]})}),e.jsx(Xs,{}),e.jsxs(he,{onClick:n,children:["退出登录",e.jsx(Gt,{children:"⇧⌘Q"})]})]})]})}const M=window?.settings?.secure_path,pc=s=>R.get(M+"/stat/getOrder",{params:s}),vc=()=>R.get(M+"/stat/getStats"),Pa=s=>R.get(M+"/stat/getTrafficRank",{params:s}),bc=()=>R.get(M+"/theme/getThemes"),yc=s=>R.post(M+"/theme/getThemeConfig",{name:s}),Nc=(s,t)=>R.post(M+"/theme/saveThemeConfig",{name:s,config:t}),wc=s=>{const t=new FormData;return t.append("file",s),R.post(M+"/theme/upload",t,{headers:{"Content-Type":"multipart/form-data"}})},_c=s=>R.post(M+"/theme/delete",{name:s}),Cc=s=>R.post(M+"/config/save",s),cr=()=>R.get(M+"/server/manage/getNodes"),Sc=s=>R.post(M+"/server/manage/save",s),kc=s=>R.post(M+"/server/manage/drop",s),Tc=s=>R.post(M+"/server/manage/copy",s),Dc=s=>R.post(M+"/server/manage/update",s),Pc=s=>R.post(M+"/server/manage/sort",s),Rt=()=>R.get(M+"/server/group/fetch"),Ic=s=>R.post(M+"/server/group/save",s),Vc=s=>R.post(M+"/server/group/drop",s),dr=()=>R.get(M+"/server/route/fetch"),Rc=s=>R.post(M+"/server/route/save",s),Ec=s=>R.post(M+"/server/route/drop",s),Fc=()=>R.get(M+"/payment/fetch"),Mc=()=>R.get(M+"/payment/getPaymentMethods"),zc=s=>R.post(M+"/payment/getPaymentForm",s),Oc=s=>R.post(M+"/payment/save",s),Lc=s=>R.post(M+"/payment/drop",s),$c=s=>R.post(M+"/payment/show",s),Ac=s=>R.post(M+"/payment/sort",s),Hc=()=>R.get(M+"/notice/fetch"),Kc=s=>R.post(M+"/notice/save",s),qc=s=>R.post(M+"/notice/drop",s),Uc=s=>R.post(M+"/notice/show",s),Bc=()=>R.get(M+"/knowledge/fetch"),Gc=s=>R.get(M+"/knowledge/fetch?id="+s),Yc=s=>R.post(M+"/knowledge/save",s),Wc=s=>R.post(M+"/knowledge/drop",s),Jc=s=>R.post(M+"/knowledge/show",s),Qc=s=>R.post(M+"/knowledge/sort",s),ks=()=>R.get(M+"/plan/fetch"),Zc=s=>R.post(M+"/plan/save",s),Ot=s=>R.post(M+"/plan/update",s),Xc=s=>R.post(M+"/plan/drop",s),ed=s=>R.post(M+"/plan/sort",{ids:s}),ur=async s=>R.post(M+"/order/fetch",s),sd=s=>R.post(M+"/order/detail",s),td=s=>R.post(M+"/order/paid",s),ad=s=>R.post(M+"/order/cancel",s),Ia=s=>R.post(M+"/order/update",s),nd=s=>R.post(M+"/order/assign",s),rd=s=>R.post(M+"/coupon/fetch",s),ld=s=>R.post(M+"/coupon/generate",s),id=s=>R.post(M+"/coupon/drop",s),od=s=>R.post(M+"/coupon/update",s),cd=s=>R.post(M+"/user/fetch",s),dd=s=>R.post(M+"/user/update",s),ud=s=>R.post(M+"/user/resetSecret",s),xd=s=>R.post(M+"/user/generate",s),md=s=>R.post(M+"/stat/getStatUser",s),xr=s=>R.post(M+"/ticket/fetch",s),hd=s=>R.get(M+"/ticket/fetch?id= "+s),jd=s=>R.post(M+"/ticket/reply",s),mr=s=>R.post(M+"/ticket/close",{id:s}),is=(s="")=>R.get(M+"/config/fetch?key="+s),os=s=>R.post(M+"/config/save",s),gd=()=>R.get(M+"/config/getEmailTemplate"),fd=()=>R.post(M+"/config/testSendMail"),pd=()=>R.post(M+"/config/setTelegramWebhook"),hr=oi,ta=o.forwardRef(({className:s,...t},a)=>e.jsx(cn,{ref:a,className:b("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...t}));ta.displayName=cn.displayName;const et=o.forwardRef(({className:s,...t},a)=>e.jsx(dn,{ref:a,className:b("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",s),...t}));et.displayName=dn.displayName;const vd=o.forwardRef(({className:s,...t},a)=>e.jsx(un,{ref:a,className:b("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...t}));vd.displayName=un.displayName;const B=ci,us=fi,G=di,q=o.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(xn,{ref:n,className:b("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...a,children:[t,e.jsx(ui,{asChild:!0,children:e.jsx(Xt,{className:"h-4 w-4 opacity-50"})})]}));q.displayName=xn.displayName;const jr=o.forwardRef(({className:s,...t},a)=>e.jsx(mn,{ref:a,className:b("flex cursor-default items-center justify-center py-1",s),...t,children:e.jsx(xi,{className:"h-4 w-4"})}));jr.displayName=mn.displayName;const gr=o.forwardRef(({className:s,...t},a)=>e.jsx(hn,{ref:a,className:b("flex cursor-default items-center justify-center py-1",s),...t,children:e.jsx(Xt,{className:"h-4 w-4"})}));gr.displayName=hn.displayName;const U=o.forwardRef(({className:s,children:t,position:a="popper",...n},l)=>e.jsx(mi,{children:e.jsxs(jn,{ref:l,className:b("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:a,...n,children:[e.jsx(jr,{}),e.jsx(hi,{className:b("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),e.jsx(gr,{})]})}));U.displayName=jn.displayName;const bd=o.forwardRef(({className:s,...t},a)=>e.jsx(gn,{ref:a,className:b("px-2 py-1.5 text-sm font-semibold",s),...t}));bd.displayName=gn.displayName;const z=o.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(fn,{ref:n,className:b("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(ji,{children:e.jsx(Ns,{className:"h-4 w-4"})})}),e.jsx(gi,{children:t})]}));z.displayName=fn.displayName;const yd=o.forwardRef(({className:s,...t},a)=>e.jsx(pn,{ref:a,className:b("-mx-1 my-1 h-px bg-muted",s),...t}));yd.displayName=pn.displayName;function Ts({className:s,classNames:t,showOutsideDays:a=!0,...n}){return e.jsx(pi,{showOutsideDays:a,className:b("p-3",s),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:b(zs({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:b("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",n.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:b(zs({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({className:l,...c})=>e.jsx(vn,{className:b("h-4 w-4",l),...c}),IconRight:({className:l,...c})=>e.jsx(Zt,{className:b("h-4 w-4",l),...c})},...n})}Ts.displayName="Calendar";const Qe=bi,Ze=yi,Be=o.forwardRef(({className:s,align:t="center",sideOffset:a=4,...n},l)=>e.jsx(vi,{children:e.jsx(bn,{ref:l,align:t,sideOffset:a,className:b("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...n})}));Be.displayName=bn.displayName;const xs={income:{main:"hsl(var(--primary))",gradient:{start:"hsl(var(--primary))",end:"transparent"}},commission:{main:"hsl(var(--secondary))",gradient:{start:"hsl(var(--secondary))",end:"transparent"}}},Ys=s=>(s/100).toFixed(2),Nd=({active:s,payload:t,label:a})=>s&&t&&t.length?e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-sm",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:a}),t.map((n,l)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:n.color}}),e.jsxs("span",{className:"text-muted-foreground",children:[n.name,":"]}),e.jsx("span",{className:"font-medium",children:n.name.includes("金额")?`¥${Ys(n.value)}`:`${n.value}笔`})]},l))]}):null,wd=[{value:"7d",label:"最近7天"},{value:"30d",label:"最近30天"},{value:"90d",label:"最近90天"},{value:"180d",label:"最近180天"},{value:"365d",label:"最近一年"},{value:"custom",label:"自定义范围"}],_d=(s,t)=>{const a=new Date;if(s==="custom"&&t)return{startDate:t.from,endDate:t.to};let n;switch(s){case"7d":n=He(a,7);break;case"30d":n=He(a,30);break;case"90d":n=He(a,90);break;case"180d":n=He(a,180);break;case"365d":n=He(a,365);break;default:n=He(a,30)}return{startDate:n,endDate:a}};function Cd(){const[s,t]=o.useState("amount"),[a,n]=o.useState("30d"),[l,c]=o.useState({from:He(new Date,7),to:new Date}),{startDate:d,endDate:x}=_d(a,l),{data:r}=Q({queryKey:["orderStat",{start_date:Pe(d,"yyyy-MM-dd"),end_date:Pe(x,"yyyy-MM-dd")}],queryFn:async()=>{const{data:i}=await pc({start_date:Pe(d,"yyyy-MM-dd"),end_date:Pe(x,"yyyy-MM-dd")});return i},refetchInterval:3e4});return e.jsxs(Ie,{children:[e.jsxs(ze,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Je,{children:"收入趋势"}),e.jsx(Zs,{children:`${r?.summary.start_date||""} 至 ${r?.summary.end_date||""}`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsxs(B,{value:a,onValueChange:i=>n(i),children:[e.jsx(q,{className:"w-[120px]",children:e.jsx(G,{placeholder:"选择时间范围"})}),e.jsx(U,{children:wd.map(i=>e.jsx(z,{value:i.value,children:i.label},i.value))})]}),a==="custom"&&e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(W,{variant:"outline",className:b("min-w-0 justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(rt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:l?.from?l.to?e.jsxs(e.Fragment,{children:[Pe(l.from,"yyyy-MM-dd")," -"," ",Pe(l.to,"yyyy-MM-dd")]}):Pe(l.from,"yyyy-MM-dd"):e.jsx("span",{children:"选择日期范围"})})]})}),e.jsx(Be,{className:"w-auto p-0",align:"end",children:e.jsx(Ts,{mode:"range",defaultMonth:l?.from,selected:{from:l?.from,to:l?.to},onSelect:i=>{i?.from&&i?.to&&c({from:i.from,to:i.to})},numberOfMonths:2})})]})]}),e.jsx(hr,{value:s,onValueChange:i=>t(i),children:e.jsxs(ta,{children:[e.jsx(et,{value:"amount",children:"金额"}),e.jsx(et,{value:"count",children:"笔数"})]})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总收入"}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Ys(r?.summary?.paid_total||0)]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["共 ",r?.summary?.paid_count||0," 笔"]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["平均订单金额 ¥",Ys(r?.summary?.avg_paid_amount||0)]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总佣金"}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Ys(r?.summary?.commission_total||0)]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["共 ",r?.summary?.commission_count||0," 笔"]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["佣金比率 ",r?.summary?.commission_rate.toFixed(2)||0,"%"]})]})]})]}),e.jsx(Oe,{children:e.jsx("div",{className:"h-[400px] w-full",children:e.jsx(Ni,{width:"100%",height:"100%",children:e.jsxs(wi,{data:r?.list||[],margin:{top:20,right:20,left:0,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"incomeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:xs.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:xs.income.gradient.end,stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"commissionGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:xs.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:xs.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(_i,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:i=>Pe(new Date(i),"MM-dd",{locale:Ti})}),e.jsx(Ci,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:i=>s==="amount"?`¥${Ys(i)}`:`${i}笔`}),e.jsx(Si,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(ki,{content:e.jsx(Nd,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(va,{type:"monotone",dataKey:"paid_total",name:"收款金额",stroke:xs.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(va,{type:"monotone",dataKey:"commission_total",name:"佣金金额",stroke:xs.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(ba,{dataKey:"paid_count",name:"收款笔数",fill:xs.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(ba,{dataKey:"commission_count",name:"佣金笔数",fill:xs.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})})]})}var me=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.CANCELLED=2]="CANCELLED",s[s.COMPLETED=3]="COMPLETED",s[s.DISCOUNTED=4]="DISCOUNTED",s))(me||{});const Vs={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},Us={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var ts=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=5]="RESET_FLOW",s))(ts||{});const fr={1:"新购",2:"续费",3:"升级",5:"流量重置"};var fe=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(fe||{});const ct={0:"待确认",1:"发放中",2:"有效",3:"无效"},dt={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var ne=(s=>(s.MONTH_PRICE="month_price",s.QUARTER_PRICE="quarter_price",s.HALF_YEAR_PRICE="half_year_price",s.YEAR_PRICE="year_price",s.TWO_YEAR_PRICE="two_year_price",s.THREE_YEAR_PRICE="three_year_price",s.ONETIME_PRICE="onetime_price",s.RESET_PRICE="reset_price",s))(ne||{});const st={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var pe=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s))(pe||{});const ps=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"}],ss={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a"};var Et=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(Et||{});const aa={1:"按金额优惠",2:"按比例优惠"},Sd={0:"正常",1:"锁定"};var Es=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(Es||{});const kd={0:"开启",1:"已关闭"};var es=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(es||{});const Js={0:"低",1:"中",2:"高"};function Td(){const s=as(),{data:t}=Q({queryKey:["pendingTickets"],queryFn:()=>xr({filter:[{id:"status",value:0}]}),staleTime:1e3*30,refetchInterval:1e3*30}),{data:a}=Q({queryKey:["pendingCommissions"],queryFn:()=>ur({filter:[{id:"commission_status",value:fe.PENDING},{id:"status",value:me.COMPLETED}]}),staleTime:1e3*30,refetchInterval:1e3*30}),n=t?.data||[],l=a?.data||[],c=()=>{const d=new URLSearchParams;d.set("commission_status",fe.PENDING.toString()),d.set("status",me.COMPLETED.toString()),s(`/finance/order?${d.toString()}`)};return e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(Ie,{className:`cursor-pointer transition-colors hover:bg-muted/50 ${n.length>0?"border-orange-500/50":""}`,onClick:()=>s("/user/ticket"),children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Je,{className:"text-sm font-medium",children:"待处理工单"}),e.jsx(Di,{className:`h-4 w-4 ${n.length>0?"text-orange-500":"text-muted-foreground"}`})]}),e.jsxs(Oe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n.length>0?"有待处理的工单需要关注":"暂无待处理工单"})]})]}),e.jsxs(Ie,{className:`cursor-pointer transition-colors hover:bg-muted/50 ${l.length>0?"border-blue-500/50":""}`,onClick:c,children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Je,{className:"text-sm font-medium",children:"待处理佣金"}),e.jsx(Pi,{className:`h-4 w-4 ${l.length>0?"text-blue-500":"text-muted-foreground"}`})]}),e.jsxs(Oe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l.length>0?"有待处理的佣金需要确认":"暂无待处理佣金"})]})]})]})}function Fe({className:s,...t}){return e.jsx("div",{className:b("animate-pulse rounded-md bg-primary/10",s),...t})}function Dd(){return e.jsxs(Ie,{children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Fe,{className:"h-4 w-[100px]"}),e.jsx(Fe,{className:"h-4 w-4"})]}),e.jsxs(Oe,{children:[e.jsx(Fe,{className:"h-8 w-[120px]"}),e.jsx("div",{className:"flex items-center pt-1",children:e.jsx(Fe,{className:"h-4 w-[100px]"})})]})]})}function Pd(){return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((s,t)=>e.jsx(Dd,{},t))})}function ut({title:s,value:t,icon:a,trend:n,className:l}){return e.jsxs(Ie,{className:b("transition-colors hover:border-primary/50",l),children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Je,{className:"text-sm font-medium",children:s}),a]}),e.jsxs(Oe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:t}),e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(Ei,{className:b("h-4 w-4",n.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:b("ml-1 text-xs",n.isPositive?"text-emerald-500":"text-red-500"),children:[n.isPositive?"+":"-",Math.abs(n.value),"%"]}),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:n.label})]})]})]})}function Id({className:s}){const{data:t,isLoading:a}=Q({queryKey:["dashboardStats"],queryFn:async()=>(await vc()).data,refetchInterval:3e5});return a||!t?e.jsx(Pd,{}):e.jsxs("div",{className:b("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx(ut,{title:"今日收入",value:`¥${t.todayIncome/100}`,icon:e.jsx(Ii,{className:"h-4 w-4 text-emerald-500"}),trend:{value:t.dayIncomeGrowth,label:"vs 昨日",isPositive:t.dayIncomeGrowth>0}}),e.jsx(ut,{title:"本月收入",value:`¥${t.currentMonthIncome/100}`,icon:e.jsx(Vi,{className:"h-4 w-4 text-blue-500"}),trend:{value:t.monthIncomeGrowth,label:"vs 上月",isPositive:t.monthIncomeGrowth>0}}),e.jsx(ut,{title:"上月佣金支出",value:`¥${t.lastMonthCommissionPayout/100}`,icon:e.jsx(Ri,{className:"h-4 w-4 text-destructive"}),trend:{value:t.commissionGrowth,label:"vs 上上月",isPositive:t.commissionGrowth>0}}),e.jsx(ut,{title:"本月新增用户",value:t.currentMonthNewUsers,icon:e.jsx(yn,{className:"h-4 w-4 text-blue-500"}),trend:{value:t.userGrowth,label:"vs 上月",isPositive:t.userGrowth>0}})]})}const tt=o.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(Nn,{ref:n,className:b("relative overflow-hidden",s),...a,children:[e.jsx(Fi,{className:"h-full w-full rounded-[inherit]",children:t}),e.jsx(wt,{}),e.jsx(Mi,{})]}));tt.displayName=Nn.displayName;const wt=o.forwardRef(({className:s,orientation:t="vertical",...a},n)=>e.jsx(wn,{ref:n,orientation:t,className:b("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",s),...a,children:e.jsx(zi,{className:"relative flex-1 rounded-full bg-border"})}));wt.displayName=wn.displayName;const Yt={today:{label:"今天",getValue:()=>{const s=Li();return{start:s,end:$i(s,1)}}},last7days:{label:"最近7天",getValue:()=>{const s=new Date;return{start:He(s,7),end:s}}},last30days:{label:"最近30天",getValue:()=>{const s=new Date;return{start:He(s,30),end:s}}},custom:{label:"自定义范围",getValue:()=>null}};function Va({selectedRange:s,customDateRange:t,onRangeChange:a,onCustomRangeChange:n}){return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.jsxs(B,{value:s,onValueChange:a,children:[e.jsx(q,{className:"w-[120px]",children:e.jsx(G,{placeholder:"选择时间范围"})}),e.jsx(U,{position:"popper",className:"z-50",children:Object.entries(Yt).map(([l,{label:c}])=>e.jsx(z,{value:l,children:c},l))})]}),s==="custom"&&e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(W,{variant:"outline",className:b("min-w-0 justify-start text-left font-normal",!t&&"text-muted-foreground"),children:[e.jsx(rt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:t?.from?t.to?e.jsxs(e.Fragment,{children:[Pe(t.from,"yyyy-MM-dd")," -"," ",Pe(t.to,"yyyy-MM-dd")]}):Pe(t.from,"yyyy-MM-dd"):e.jsx("span",{children:"选择日期范围"})})]})}),e.jsx(Be,{className:"w-auto p-0",align:"end",children:e.jsx(Ts,{mode:"range",defaultMonth:t?.from,selected:{from:t?.from,to:t?.to},onSelect:l=>{l?.from&&l?.to&&n({from:l.from,to:l.to})},numberOfMonths:2})})]})]})}const Is=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Vd({className:s}){const[t,a]=o.useState("today"),[n,l]=o.useState({from:He(new Date,7),to:new Date}),[c,d]=o.useState("today"),[x,r]=o.useState({from:He(new Date,7),to:new Date}),i=o.useMemo(()=>t==="custom"?{start:n.from,end:n.to}:Yt[t].getValue(),[t,n]),h=o.useMemo(()=>c==="custom"?{start:x.from,end:x.to}:Yt[c].getValue(),[c,x]),{data:D}=Q({queryKey:["nodeTrafficRank",i.start,i.end],queryFn:()=>Pa({type:"node",start_time:de.round(i.start.getTime()/1e3),end_time:de.round(i.end.getTime()/1e3)}),refetchInterval:3e4}),{data:C}=Q({queryKey:["userTrafficRank",h.start,h.end],queryFn:()=>Pa({type:"user",start_time:de.round(h.start.getTime()/1e3),end_time:de.round(h.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:b("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(Ie,{children:[e.jsx(ze,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(Je,{className:"flex items-center text-base font-medium",children:[e.jsx(Oi,{className:"mr-2 h-4 w-4"}),"节点流量排行"]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(Va,{selectedRange:t,customDateRange:n,onRangeChange:a,onCustomRangeChange:l}),e.jsx(ya,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Oe,{className:"flex-1",children:D?.data?e.jsxs(tt,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:D.data.map(m=>e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:m.name}),e.jsxs("span",{className:b("ml-2 flex items-center text-xs font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?e.jsx(Ht,{className:"mr-1 h-3 w-3"}):e.jsx(Kt,{className:"mr-1 h-3 w-3"}),Math.abs(m.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${m.value/D.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Is(m.value)})]})]})})}),e.jsx(ee,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"当前流量:"}),e.jsx("span",{className:"font-medium",children:Is(m.value)}),e.jsx("span",{className:"text-muted-foreground",children:"上期流量:"}),e.jsx("span",{className:"font-medium",children:Is(m.previousValue)}),e.jsx("span",{className:"text-muted-foreground",children:"变化率:"}),e.jsxs("span",{className:b("font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?"+":"",m.change,"%"]}),e.jsx("span",{className:"text-muted-foreground",children:"记录时间:"}),e.jsx("span",{className:"font-medium",children:Pe(new Date(m.timestamp),"yyyy-MM-dd HH:mm")})]})})]})},m.id))}),e.jsx(wt,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:"Loading..."})})})]}),e.jsxs(Ie,{children:[e.jsx(ze,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(Je,{className:"flex items-center text-base font-medium",children:[e.jsx(yn,{className:"mr-2 h-4 w-4"}),"用户流量排行"]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(Va,{selectedRange:c,customDateRange:x,onRangeChange:d,onCustomRangeChange:r}),e.jsx(ya,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Oe,{className:"flex-1",children:C?.data?e.jsxs(tt,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:C.data.map(m=>e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:m.name}),e.jsxs("span",{className:b("ml-2 flex items-center text-xs font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?e.jsx(Ht,{className:"mr-1 h-3 w-3"}):e.jsx(Kt,{className:"mr-1 h-3 w-3"}),Math.abs(m.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${m.value/C.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Is(m.value)})]})]})})}),e.jsx(ee,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"当前流量:"}),e.jsx("span",{className:"font-medium",children:Is(m.value)}),e.jsx("span",{className:"text-muted-foreground",children:"上期流量:"}),e.jsx("span",{className:"font-medium",children:Is(m.previousValue)}),e.jsx("span",{className:"text-muted-foreground",children:"变化率:"}),e.jsxs("span",{className:b("font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?"+":"",m.change,"%"]}),e.jsx("span",{className:"text-muted-foreground",children:"记录时间:"}),e.jsx("span",{className:"font-medium",children:Pe(new Date(m.timestamp),"yyyy-MM-dd HH:mm")})]})})]})},m.id))}),e.jsx(wt,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:"Loading..."})})})]})]})}const Rd=ys("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/10",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function O({className:s,variant:t,...a}){return e.jsx("div",{className:b(Rd({variant:t}),s),...a})}const Bs=window?.settings?.secure_path,Ra={getSystemStatus:()=>R.get(`${Bs}/system/getSystemStatus`),getQueueStats:()=>R.get(`${Bs}/system/getQueueStats`),getQueueWorkload:()=>R.get(`${Bs}/system/getQueueWorkload`),getQueueMasters:()=>R.get(`${Bs}/system/getQueueMasters`),getSystemLog:s=>R.get(`${Bs}/system/getSystemLog`,{params:s})},pt=o.forwardRef(({className:s,value:t,...a},n)=>e.jsx(_n,{ref:n,className:b("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...a,children:e.jsx(Ai,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));pt.displayName=_n.displayName;function Ed(){const[s,t]=o.useState(null),[a,n]=o.useState(null),[l,c]=o.useState(!0),[d,x]=o.useState(!1),r=async()=>{try{x(!0);const[D,C]=await Promise.all([Ra.getSystemStatus(),Ra.getQueueStats()]);t(D.data),n(C.data)}catch(D){console.error("Error fetching system data:",D)}finally{c(!1),x(!1)}};o.useEffect(()=>{r();const D=setInterval(r,3e4);return()=>clearInterval(D)},[]);const i=()=>{r()};if(l)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(ea,{className:"h-6 w-6 animate-spin"})});const h=D=>D?e.jsx(Cn,{className:"h-5 w-5 text-green-500"}):e.jsx(Sn,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ie,{children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Je,{className:"flex items-center gap-2",children:[e.jsx(Hi,{className:"h-5 w-5"}),"队列状态"]}),e.jsx(Zs,{children:"当前队列运行状态"})]}),e.jsx(W,{variant:"outline",size:"icon",onClick:i,disabled:d,children:e.jsx(Ki,{className:b("h-4 w-4",d&&"animate-spin")})})]}),e.jsx(Oe,{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:[h(a?.status||!1),e.jsx("span",{className:"font-medium",children:"运行状态"})]}),e.jsx(O,{variant:a?.status?"secondary":"destructive",children:a?.status?"正常":"异常"})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前等待时间:",a?.wait?.default||0," 秒"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{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:"近期任务数"}),e.jsx("p",{className:"text-2xl font-bold",children:a?.recentJobs||0}),e.jsx(pt,{value:(a?.recentJobs||0)/(a?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ee,{children:e.jsxs("p",{children:["统计时间范围: ",a?.periods?.recentJobs||0," 小时"]})})]})}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{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:"每分钟处理量"}),e.jsx("p",{className:"text-2xl font-bold",children:a?.jobsPerMinute||0}),e.jsx(pt,{value:(a?.jobsPerMinute||0)/(a?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ee,{children:e.jsxs("p",{children:["最高吞吐量:"," ",a?.queueWithMaxThroughput?.throughput||0]})})]})})]})]})})]}),e.jsxs(Ie,{children:[e.jsxs(ze,{children:[e.jsxs(Je,{className:"flex items-center gap-2",children:[e.jsx(qi,{className:"h-5 w-5"}),"作业详情"]}),e.jsx(Zs,{children:"队列处理详细信息"})]}),e.jsx(Oe,{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:"7日报错数量"}),e.jsx("p",{className:"text-2xl font-bold text-destructive",children:a?.failedJobs||0}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["保留 ",a?.periods?.failedJobs||0," 小时"]})]}),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:"最长运行队列"}),e.jsxs("p",{className:"text-2xl font-bold",children:[a?.queueWithMaxRuntime?.runtime||0,"s"]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a?.queueWithMaxRuntime?.name||"N/A"})]})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"活跃进程"}),e.jsxs("span",{className:"font-medium",children:[a?.processes||0," /"," ",(a?.processes||0)+(a?.pausedMasters||0)]})]}),e.jsx(pt,{value:(a?.processes||0)/((a?.processes||0)+(a?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]})}function Fd(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:"仪表盘"})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ke,{}),e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsx(_e,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"border-b pb-6",children:e.jsx(Td,{})}),e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Id,{}),e.jsx(Cd,{}),e.jsx(Vd,{}),e.jsx(Ed,{})]})]})})]})}const Md=Object.freeze(Object.defineProperty({__proto__:null,default:Fd},Symbol.toStringTag,{value:"Module"})),ge=o.forwardRef(({className:s,orientation:t="horizontal",decorative:a=!0,...n},l)=>e.jsx(kn,{ref:l,decorative:a,orientation:t,className:b("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...n}));ge.displayName=kn.displayName;function zd({className:s,items:t,...a}){const{pathname:n}=_t(),l=as(),[c,d]=o.useState(n??"/settings"),x=r=>{d(r),l(r)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(B,{value:c,onValueChange:x,children:[e.jsx(q,{className:"h-12 sm:w-48",children:e.jsx(G,{placeholder:"Theme"})}),e.jsx(U,{children:t.map(r=>e.jsx(z,{value:r.href,children:e.jsxs("div",{className:"flex gap-x-4 px-2 py-1",children:[e.jsx("span",{className:"scale-125",children:r.icon}),e.jsx("span",{className:"text-md",children:r.title})]})},r.href))})]})}),e.jsx("div",{className:"hidden w-full overflow-x-auto bg-background px-1 py-2 md:block",children:e.jsx("nav",{className:b("flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",s),...a,children:t.map(r=>e.jsxs(ws,{to:r.href,className:b(Os({variant:"ghost"}),n===r.href?"bg-muted hover:bg-muted":"hover:bg-transparent hover:underline","justify-start"),children:[e.jsx("span",{className:"mr-2",children:r.icon}),r.title]},r.href))})})]})}const pr=[{title:"站点设置",key:"site",icon:e.jsx(Ui,{size:18}),href:"/config/system",description:"配置站点基本信息,包括站点名称、描述、货币单位等核心设置。"},{title:"安全设置",key:"safe",icon:e.jsx(an,{size:18}),href:"/config/system/safe",description:"配置系统安全相关选项,包括登录验证、密码策略、API访问等安全设置。"},{title:"订阅设置",key:"subscribe",icon:e.jsx(nn,{size:18}),href:"/config/system/subscribe",description:"管理用户订阅相关配置,包括订阅链接格式、更新频率、流量统计等设置。"},{title:"邀请&佣金",key:"invite",icon:e.jsx(Bi,{size:18}),href:"/config/system/invite",description:"管理用户邀请和佣金系统,配置邀请奖励、分销规则等。"},{title:"节点配置",key:"server",icon:e.jsx(tn,{size:18}),href:"/config/system/server",description:"配置节点通信和同步设置,包括通信密钥、轮询间隔、负载均衡等高级选项。"},{title:"邮件设置",key:"email",icon:e.jsx(Gi,{size:18}),href:"/config/system/email",description:"配置系统邮件服务,用于发送验证码、密码重置、通知等邮件,支持多种SMTP服务商。"},{title:"Telegram设置",key:"telegram",icon:e.jsx(Yi,{size:18}),href:"/config/system/telegram",description:"配置Telegram机器人功能,实现用户通知、账户绑定、指令交互等自动化服务。"},{title:"APP设置",key:"app",icon:e.jsx(sn,{size:18}),href:"/config/system/app",description:"管理移动应用程序相关配置,包括API接口、版本控制、推送通知等功能设置。"}];function Od(){return e.jsxs(be,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:"系统设置"}),e.jsx("div",{className:"text-muted-foreground",children:"管理系统核心配置,包括站点、安全、订阅、邀请佣金、节点、邮件和通知等设置"})]}),e.jsx(ge,{className:"my-6"}),e.jsxs("div",{className:"flex flex-1 flex-col space-y-8 overflow-auto lg:flex-row lg:space-x-12 lg:space-y-0",children:[e.jsx("aside",{className:"sticky top-0 lg:w-1/5",children:e.jsx(zd,{items:pr})}),e.jsx("div",{className:"w-full p-1 pr-4 lg:max-w-xl",children:e.jsx("div",{className:"pb-16",children:e.jsx(Jt,{})})})]})]})]})}const Ld=Object.freeze(Object.defineProperty({__proto__:null,default:Od},Symbol.toStringTag,{value:"Module"}));function $d({title:s,description:t,children:a}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t})]}),e.jsx(ge,{}),a]})}const H=o.forwardRef(({className:s,...t},a)=>e.jsx(Tn,{className:b("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...t,ref:a,children:e.jsx(Wi,{className:b("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));H.displayName=Tn.displayName;const cs=o.forwardRef(({className:s,...t},a)=>e.jsx("textarea",{className:b("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...t}));cs.displayName="Textarea";const Ad=u.object({logo:u.string().nullable().default(""),force_https:u.number().nullable().default(0),stop_register:u.number().nullable().default(0),app_name:u.string().nullable().default(""),app_description:u.string().nullable().default(""),app_url:u.string().nullable().default(""),subscribe_url:u.string().nullable().default(""),try_out_plan_id:u.number().nullable().default(0),try_out_hour:u.coerce.number().nullable().default(0),tos_url:u.string().nullable().default(""),currency:u.string().nullable().default(""),currency_symbol:u.string().nullable().default("")});function Hd(){const[s,t]=o.useState(!1),a=o.useRef(null),{data:n}=Q({queryKey:["settings","site"],queryFn:()=>is("site")}),{data:l}=Q({queryKey:["plans"],queryFn:()=>ks()}),c=ae({resolver:ie(Ad),defaultValues:{},mode:"onBlur"}),{mutateAsync:d}=We({mutationFn:os,onSuccess:i=>{i.data&&L.success("已自动保存")}});o.useEffect(()=>{if(n?.data?.site){const i=n?.data?.site;Object.entries(i).forEach(([h,D])=>{c.setValue(h,D)}),a.current=i}},[n]);const x=o.useCallback(de.debounce(async i=>{if(!de.isEqual(i,a.current)){t(!0);try{const h=Object.entries(i).reduce((D,[C,m])=>(D[C]=m===null?"":m,D),{});await d(h),a.current=i}finally{t(!1)}}},1e3),[d]),r=o.useCallback(i=>{x(i)},[x]);return o.useEffect(()=>{const i=c.watch(h=>{r(h)});return()=>i.unsubscribe()},[c.watch,r]),e.jsx(oe,{...c,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:c.control,name:"app_name",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"站点名称"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入站点名称",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"用于显示需要站点名称的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"app_description",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"站点描述"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入站点描述",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"用于显示需要站点描述的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"app_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"站点网址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入站点URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"当前网站最新网址,将会在邮件等需要用于网址处体现。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"force_https",render:({field:i})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"强制HTTPS"}),e.jsx(E,{children:"当站点没有使用HTTPS,CDN或反代开启强制HTTPS时需要开启。"})]}),e.jsx(v,{children:e.jsx(H,{checked:!!i.value,onCheckedChange:h=>{i.onChange(Number(h)),r(c.getValues())}})})]})}),e.jsx(g,{control:c.control,name:"logo",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"LOGO"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入LOGO URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"用于显示需要LOGO的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"subscribe_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"订阅URL"}),e.jsx(v,{children:e.jsx(cs,{placeholder:"用于订阅所使用,多个订阅地址用','隔开.留空则为站点URL。",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"用于订阅所使用,留空则为站点URL。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"tos_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"用户条款(TOS)URL"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入用户条款URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"用于跳转到用户条款(TOS)"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"stop_register",render:({field:i})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"停止新用户注册"}),e.jsx(E,{children:"开启后任何人都将无法进行注册。"})]}),e.jsx(v,{children:e.jsx(H,{checked:!!i.value,onCheckedChange:h=>{i.onChange(Number(h)),r(c.getValues())}})})]})}),e.jsx(g,{control:c.control,name:"try_out_plan_id",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"注册试用"}),e.jsx(v,{children:e.jsxs(B,{value:i.value?.toString(),onValueChange:h=>{i.onChange(Number(h)),r(c.getValues())},children:[e.jsx(q,{children:e.jsx(G,{placeholder:"关闭"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"关闭"}),l?.data?.map(h=>e.jsx(z,{value:h.id.toString(),children:h.name},h.id.toString()))]})]})}),e.jsx(E,{children:"选择需要试用的订阅,如果没有选项请先前往订阅管理添加。"}),e.jsx(k,{})]})}),!!c.watch("try_out_plan_id")&&e.jsx(g,{control:c.control,name:"try_out_hour",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"",children:"注册试用时长"}),e.jsx(v,{children:e.jsx(S,{placeholder:"0",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"注册试用时长,单位为小时。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"currency",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"货币单位"}),e.jsx(v,{children:e.jsx(S,{placeholder:"CNY",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"仅用于展示使用,更改后系统中所有的货币单位都将发生变更。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"currency_symbol",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"货币符号"}),e.jsx(v,{children:e.jsx(S,{placeholder:"¥",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"仅用于展示使用,更改后系统中所有的货币单位都将发生变更。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Kd(){const s=pr.find(t=>t.key==="site");return e.jsx($d,{title:s.title,description:s.description,children:e.jsx(Hd,{})})}const qd=Object.freeze(Object.defineProperty({__proto__:null,default:Kd},Symbol.toStringTag,{value:"Module"})),Ud=u.object({email_verify:u.boolean().nullable(),safe_mode_enable:u.boolean().nullable(),secure_path:u.string().nullable(),email_whitelist_enable:u.boolean().nullable(),email_whitelist_suffix:u.array(u.string().nullable()).nullable(),email_gmail_limit_enable:u.boolean().nullable(),recaptcha_enable:u.boolean().nullable(),recaptcha_key:u.string().nullable(),recaptcha_site_key:u.string().nullable(),register_limit_by_ip_enable:u.boolean().nullable(),register_limit_count:u.coerce.string().transform(s=>s===""?null:s).nullable(),register_limit_expire:u.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_enable:u.boolean().nullable(),password_limit_count:u.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_expire:u.coerce.string().transform(s=>s===""?null:s).nullable()}),Bd={email_verify:!1,safe_mode_enable:!1,secure_path:"",email_whitelist_enable:!1,email_whitelist_suffix:[],email_gmail_limit_enable:!1,recaptcha_enable:!1,recaptcha_key:"",recaptcha_site_key:"",register_limit_by_ip_enable:!1,register_limit_count:"",register_limit_expire:"",password_limit_enable:!1,password_limit_count:"",password_limit_expire:""};function Gd(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(Ud),defaultValues:Bd,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","safe"],queryFn:()=>is("safe")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:r=>{r.data&&L.success("已自动保存")}});o.useEffect(()=>{if(l?.data.safe){const r=l.data.safe;Object.entries(r).forEach(([i,h])=>{typeof h=="number"?n.setValue(i,String(h)):n.setValue(i,h)}),a.current=r}},[l]);const d=o.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await c(r),a.current=r}finally{t(!1)}}},1e3),[c]),x=o.useCallback(r=>{d(r)},[d]);return o.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"email_verify",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"邮箱验证"}),e.jsx(E,{children:"开启后将会强制要求用户进行邮箱验证。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"email_gmail_limit_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"禁止使用Gmail多别名"}),e.jsx(E,{children:"开启后Gmail多别名将无法注册。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"safe_mode_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"安全模式"}),e.jsx(E,{children:"开启后除了站点URL以外的绑定本站点的域名访问都将会被403。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"secure_path",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"后台路径"}),e.jsx(v,{children:e.jsx(S,{placeholder:"admin",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(E,{children:"后台管理路径,修改后将会改变原有的admin路径"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"email_whitelist_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"邮箱后缀白名单"}),e.jsx(E,{children:"开启后在名单中的邮箱后缀才允许进行注册。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("email_whitelist_enable")&&e.jsx(g,{control:n.control,name:"email_whitelist_suffix",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"白名单后缀"}),e.jsx(v,{children:e.jsx(cs,{placeholder:"请输入后缀域名,逗号分割 如:qq.com,gmail.com",value:r.value?.length?r.value.join(","):"",onChange:i=>{const h=i.target.value?i.target.value.split(","):[];r.onChange(h),x(n.getValues())}})}),e.jsx(E,{children:"请使用逗号进行分割,如:qq.com,gmail.com。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"recaptcha_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"防机器人"}),e.jsx(E,{children:"开启后将会使用Google reCAPTCHA防止机器人。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"recaptcha_key",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"密钥"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入密钥",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"recaptcha_site_key",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"站点密钥"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入站点密钥",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:n.control,name:"register_limit_by_ip_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"IP注册限制"}),e.jsx(E,{children:"开启后同一IP将会被限制注册次数。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"register_limit_count",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"限制次数"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入限制次数",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"register_limit_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"限制时长(分钟)"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入限制时长",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:n.control,name:"password_limit_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"密码错误限制"}),e.jsx(E,{children:"开启后密码错误将会被限制登录。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"password_limit_count",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"限制次数"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入限制次数",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"password_limit_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"限制时长(分钟)"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入限制时长",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Yd(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"安全设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置系统安全相关选项,包括登录验证、密码策略、API访问等安全设置。"})]}),e.jsx(ge,{}),e.jsx(Gd,{})]})}const Wd=Object.freeze(Object.defineProperty({__proto__:null,default:Yd},Symbol.toStringTag,{value:"Module"})),Jd=u.object({plan_change_enable:u.boolean().nullable().default(!1),reset_traffic_method:u.coerce.number().nullable().default(0),surplus_enable:u.boolean().nullable().default(!1),new_order_event_id:u.coerce.number().nullable().default(0),renew_order_event_id:u.coerce.number().nullable().default(0),change_order_event_id:u.coerce.number().nullable().default(0),show_info_to_server_enable:u.boolean().nullable().default(!1),show_protocol_to_server_enable:u.boolean().nullable().default(!1),default_remind_expire:u.boolean().nullable().default(!1),default_remind_traffic:u.boolean().nullable().default(!1),remind_mail_enable:u.boolean().nullable().default(!1),subscribe_path:u.string().nullable().default("s")}),Qd={plan_change_enable:!1,reset_traffic_method:0,surplus_enable:!1,new_order_event_id:0,renew_order_event_id:0,change_order_event_id:0,show_info_to_server_enable:!1,show_protocol_to_server_enable:!1,default_remind_expire:!1,default_remind_traffic:!1,remind_mail_enable:!1,subscribe_path:"s"};function Zd(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(Jd),defaultValues:Qd,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","subscribe"],queryFn:()=>is("subscribe")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:r=>{r.data&&L.success("已自动保存")}});o.useEffect(()=>{if(l?.data?.subscribe){const r=l?.data?.subscribe;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=o.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await c(r),a.current=r}finally{t(!1)}}},1e3),[c]),x=o.useCallback(r=>{d(r)},[d]);return o.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"plan_change_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"允许用户更改订阅"}),e.jsx(E,{children:"开启后用户将会可以对订阅计划进行变更。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"reset_traffic_method",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"月流量重置方式"}),e.jsx("div",{className:"relative w-max",children:e.jsx(v,{children:e.jsxs(B,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"每月1号"}),e.jsx(z,{value:"1",children:"按月重置"}),e.jsx(z,{value:"2",children:"不重置"}),e.jsx(z,{value:"3",children:"每年1月1号"}),e.jsx(z,{value:"4",children:"按年重置"})]})]})})}),e.jsx(E,{children:"全局流量重置方式,默认每月1号。可以在订阅管理为订阅单独设置。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"surplus_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"开启折抵方案"}),e.jsx(E,{children:"开启后用户更换订阅将会由系统对原有订阅进行折抵,方案参考文档。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"new_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"当订阅新购时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(v,{children:e.jsxs(B,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"不执行任何动作"}),e.jsx(z,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(E,{children:"新购订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"renew_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"当订阅续费时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(v,{children:e.jsxs(B,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"不执行任何动作"}),e.jsx(z,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(E,{children:"续费订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"change_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"当订阅变更时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(v,{children:e.jsxs(B,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"不执行任何动作"}),e.jsx(z,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(E,{children:"变更订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"subscribe_path",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"订阅路径"}),e.jsx(v,{children:e.jsx(S,{placeholder:"subscribe",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["订阅路径,修改后将会改变原有的subscribe路径",e.jsx("br",{}),"当前订阅路径格式:",r.value?`${r.value}/xxxxxxxxxx`:"s/xxxxxxxxxx"]}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"show_info_to_server_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"在订阅中展示订阅信息"}),e.jsx(E,{children:"开启后将会在用户订阅节点时输出订阅信息。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"show_protocol_to_server_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"在订阅中线路名称中显示协议名称"}),e.jsx(E,{children:"开启后订阅线路会附带协议名称(例如: [Hy2]香港)"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"remind_mail_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"邮件提醒"}),e.jsx(E,{children:"开启后用户订阅即将到期时和流量告急时时将发送邮件通知。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Xd(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"订阅设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"管理用户订阅相关配置,包括订阅链接格式、更新频率、流量统计等设置。"})]}),e.jsx(ge,{}),e.jsx(Zd,{})]})}const eu=Object.freeze(Object.defineProperty({__proto__:null,default:Xd},Symbol.toStringTag,{value:"Module"})),su=u.object({invite_force:u.boolean().default(!1),invite_commission:u.coerce.string().default("0"),invite_gen_limit:u.coerce.string().default("0"),invite_never_expire:u.boolean().default(!1),commission_first_time_enable:u.boolean().default(!1),commission_auto_check_enable:u.boolean().default(!1),commission_withdraw_limit:u.coerce.string().default("0"),commission_withdraw_method:u.array(u.string()).default(["支付宝","USDT","Paypal"]),withdraw_close_enable:u.boolean().default(!1),commission_distribution_enable:u.boolean().default(!1),commission_distribution_l1:u.coerce.number().default(0),commission_distribution_l2:u.coerce.number().default(0),commission_distribution_l3:u.coerce.number().default(0)}),tu={invite_force:!1,invite_commission:"0",invite_gen_limit:"0",invite_never_expire:!1,commission_first_time_enable:!1,commission_auto_check_enable:!1,commission_withdraw_limit:"0",commission_withdraw_method:["支付宝","USDT","Paypal"],withdraw_close_enable:!1,commission_distribution_enable:!1,commission_distribution_l1:0,commission_distribution_l2:0,commission_distribution_l3:0};function au(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(su),defaultValues:tu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","invite"],queryFn:()=>is("invite")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:r=>{r.data&&L.success("已自动保存")}});o.useEffect(()=>{if(l?.data?.invite){const r=l?.data?.invite;Object.entries(r).forEach(([i,h])=>{typeof h=="number"?n.setValue(i,String(h)):n.setValue(i,h)}),a.current=r}},[l]);const d=o.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await c(r),a.current=r}finally{t(!1)}}},1e3),[c]),x=o.useCallback(r=>{d(r)},[d]);return o.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"invite_force",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"开启强制邀请"}),e.jsx(E,{children:"开启后只有被邀请的用户才可以进行注册。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"invite_commission",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:" 邀请佣金百分比"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(E,{children:"默认全局的佣金分配比例,你可以在用户管理单独配置单个比例。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"invite_gen_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"用户可创建邀请码上限"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(E,{children:"用户可创建邀请码上限"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"invite_never_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"邀请码永不失效"}),e.jsx(E,{children:"开启后邀请码被使用后将不会失效,否则使用过后即失效。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_first_time_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"佣金仅首次发放"}),e.jsx(E,{children:"开启后被邀请人首次支付时才会产生佣金,可以在用户管理对用户进行单独配置。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_auto_check_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"佣金自动确认"}),e.jsx(E,{children:"开启后佣金将会在订单完成3日后自动进行确认。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_withdraw_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"提现单申请门槛(元)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(E,{children:"小于门槛金额的提现单将不会被提交。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_withdraw_method",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"提现方式"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",...r,value:Array.isArray(r.value)?r.value.join(","):"",onChange:i=>{const h=i.target.value.split(",").filter(Boolean);r.onChange(h),x(n.getValues())}})}),e.jsx(E,{children:"可以支持的提现方式,多个用逗号分隔。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"withdraw_close_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"关闭提现"}),e.jsx(E,{children:"关闭后将禁止用户申请提现,且邀请佣金将会直接进入用户余额。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"三级分销"}),e.jsx(E,{children:"开启后将佣金将按照设置的3成比例进行分成,三成比例合计请不要大于100%。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"commission_distribution_l1",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"一级邀请人比例"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_l2",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"二级邀请人比例"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_l3",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"三级邀请人比例"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function nu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"邀请&佣金设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"邀请注册、佣金相关设置。"})]}),e.jsx(ge,{}),e.jsx(au,{})]})}const ru=Object.freeze(Object.defineProperty({__proto__:null,default:nu},Symbol.toStringTag,{value:"Module"})),lu=u.object({frontend_theme:u.string().nullable(),frontend_theme_sidebar:u.string().nullable(),frontend_theme_header:u.string().nullable(),frontend_theme_color:u.string().nullable(),frontend_background_url:u.string().url().nullable()}),iu={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function ou(){const{data:s}=Q({queryKey:["settings","frontend"],queryFn:()=>is("frontend")}),t=ae({resolver:ie(lu),defaultValues:iu,mode:"onChange"});o.useEffect(()=>{if(s?.data?.frontend){const n=s?.data?.frontend;Object.entries(n).forEach(([l,c])=>{t.setValue(l,c)})}},[s]);function a(n){os(n).then(({data:l})=>{l&&L.success("更新成功")})}return e.jsx(oe,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(a),className:"space-y-8",children:[e.jsx(g,{control:t.control,name:"frontend_theme_sidebar",render:({field:n})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"边栏风格"}),e.jsx(E,{children:"边栏风格"})]}),e.jsx(v,{children:e.jsx(H,{checked:n.value,onCheckedChange:n.onChange})})]})}),e.jsx(g,{control:t.control,name:"frontend_theme_header",render:({field:n})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"头部风格"}),e.jsx(E,{children:"边栏风格"})]}),e.jsx(v,{children:e.jsx(H,{checked:n.value,onCheckedChange:n.onChange})})]})}),e.jsx(g,{control:t.control,name:"frontend_theme_color",render:({field:n})=>e.jsxs(j,{children:[e.jsx(f,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(v,{children:e.jsxs("select",{className:b(Os({variant:"outline"}),"w-[200px] appearance-none font-normal"),...n,children:[e.jsx("option",{value:"default",children:"默认"}),e.jsx("option",{value:"black",children:"黑色"}),e.jsx("option",{value:"blackblue",children:"暗蓝色"}),e.jsx("option",{value:"green",children:"奶绿色"})]})}),e.jsx(Xt,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx(E,{children:"主题色"}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"frontend_background_url",render:({field:n})=>e.jsxs(j,{children:[e.jsx(f,{children:"背景"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入图片地址",...n})}),e.jsx(E,{children:"将会在后台登录页面进行展示。"}),e.jsx(k,{})]})}),e.jsx(T,{type:"submit",children:"保存设置"})]})})}function cu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"个性化设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"自定义系统界面外观,包括主题风格、布局、颜色方案、背景图等个性化选项。"})]}),e.jsx(ge,{}),e.jsx(ou,{})]})}const du=Object.freeze(Object.defineProperty({__proto__:null,default:cu},Symbol.toStringTag,{value:"Module"})),uu=u.object({server_pull_interval:u.coerce.number().nullable(),server_push_interval:u.coerce.number().nullable(),server_token:u.string().nullable(),device_limit_mode:u.coerce.number().nullable()}),xu={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function mu(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(uu),defaultValues:xu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","server"],queryFn:()=>is("server")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:r=>{r.data&&L.success("已自动保存")}});o.useEffect(()=>{if(l?.data.server){const r=l.data.server;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=o.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await c(r),a.current=r}finally{t(!1)}}},1e3),[c]),x=o.useCallback(r=>{d(r)},[d]);return o.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"server_token",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"通讯密钥"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(E,{children:"Xboard与节点通讯的密钥,以便数据不会被他人获取。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"server_pull_interval",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"节点拉取动作轮询间隔"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):null;r.onChange(h)}})}),e.jsx(E,{children:"节点从面板获取数据的间隔频率。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"server_push_interval",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"节点推送动作轮询间隔"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):null;r.onChange(h)}})}),e.jsx(E,{children:"节点推送数据到面板的间隔频率。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"device_limit_mode",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"设备限制模式"}),e.jsxs(B,{onValueChange:r.onChange,value:r.value?.toString()||"0",children:[e.jsx(v,{children:e.jsx(q,{children:e.jsx(G,{placeholder:"请选择设备限制模式"})})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"严格模式"}),e.jsx(z,{value:"1",children:"宽松模式"})]})]}),e.jsx(E,{children:"宽松模式下,同一IP地址使用多个节点只统计为一个设备。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function hu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"节点配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置节点通信和同步设置,包括通信密钥、轮询间隔、负载均衡等高级选项。"})]}),e.jsx(ge,{}),e.jsx(mu,{})]})}const ju=Object.freeze(Object.defineProperty({__proto__:null,default:hu},Symbol.toStringTag,{value:"Module"}));function gu({open:s,onOpenChange:t,result:a}){const n=!a.error;return e.jsx(ue,{open:s,onOpenChange:t,children:e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n?e.jsx(Cn,{className:"h-5 w-5 text-green-500"}):e.jsx(Sn,{className:"h-5 w-5 text-destructive"}),e.jsx(xe,{children:n?"邮件发送成功":"邮件发送失败"})]}),e.jsx(Se,{children:n?"测试邮件已成功发送,请检查收件箱":"发送测试邮件时遇到错误"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"发送详情"}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2 text-sm",children:[e.jsx("div",{className:"text-muted-foreground",children:"收件地址"}),e.jsx("div",{children:a.email}),e.jsx("div",{className:"text-muted-foreground",children:"邮件主题"}),e.jsx("div",{children:a.subject}),e.jsx("div",{className:"text-muted-foreground",children:"模板名称"}),e.jsx("div",{children:a.template_name})]})]}),a.error&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium text-destructive",children:"错误信息"}),e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive break-all",children:a.error})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"配置信息"}),e.jsx(tt,{className:"h-[200px] rounded-md border p-4",children:e.jsx("div",{className:"grid gap-2 text-sm",children:e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2",children:[e.jsx("div",{className:"text-muted-foreground",children:"驱动"}),e.jsx("div",{children:a.config.driver}),e.jsx("div",{className:"text-muted-foreground",children:"服务器"}),e.jsx("div",{children:a.config.host}),e.jsx("div",{className:"text-muted-foreground",children:"端口"}),e.jsx("div",{children:a.config.port}),e.jsx("div",{className:"text-muted-foreground",children:"加密方式"}),e.jsx("div",{children:a.config.encryption||"无"}),e.jsx("div",{className:"text-muted-foreground",children:"发件人"}),e.jsx("div",{children:a.config.from.address?`${a.config.from.address}${a.config.from.name?` (${a.config.from.name})`:""}`:"未设置"}),e.jsx("div",{className:"text-muted-foreground",children:"用户名"}),e.jsx("div",{children:a.config.username||"未设置"})]})})})]})]})]})})}const fu=u.object({email_template:u.string().nullable().default("classic"),email_host:u.string().nullable().default(""),email_port:u.string().regex(/^\d+$/).nullable().default("465"),email_username:u.string().nullable().default(""),email_password:u.string().nullable().default(""),email_encryption:u.string().nullable().default(""),email_from_address:u.string().email().nullable().default("")});function pu(){const[s,t]=o.useState(null),[a,n]=o.useState(!1),l=o.useRef(null),[c,d]=o.useState(!1),x=ae({resolver:ie(fu),defaultValues:{},mode:"onBlur"}),{data:r}=Q({queryKey:["settings","email"],queryFn:()=>is("email")}),{data:i}=Q({queryKey:["emailTemplate"],queryFn:()=>gd()}),{mutateAsync:h}=We({mutationFn:os,onSuccess:_=>{_.data&&L.success("已自动保存")}}),{mutate:D,isPending:C}=We({mutationFn:fd,onMutate:()=>{t(null),n(!1)},onSuccess:_=>{t(_.data),n(!0),_.data.error||L.success("发送成功")}});o.useEffect(()=>{if(r?.data.email){const _=r.data.email;Object.entries(_).forEach(([y,N])=>{x.setValue(y,N)}),l.current=_}},[r]);const m=o.useCallback(de.debounce(async _=>{if(!de.isEqual(_,l.current)){d(!0);try{await h(_),l.current=_}finally{d(!1)}}},1e3),[h]),w=o.useCallback(_=>{m(_)},[m]);return o.useEffect(()=>{const _=x.watch(y=>{w(y)});return()=>_.unsubscribe()},[x.watch,w]),e.jsxs(e.Fragment,{children:[e.jsx(oe,{...x,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:x.control,name:"email_host",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"SMTP服务器地址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(E,{children:"由邮件服务商提供的服务地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_port",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"SMTP服务端口"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(E,{children:"常见的端口有25, 465, 587"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_encryption",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"SMTP加密方式"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(E,{children:"465端口加密方式一般为SSL,587端口加密方式一般为TLS"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_username",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"SMTP账号"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(E,{children:"由邮件服务商提供的账号"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_password",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"SMTP密码"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||"",type:"password"})}),e.jsx(E,{children:"由邮件服务商提供的密码"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_from_address",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"发件地址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(E,{children:"由邮件服务商提供的发件地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_template",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"邮件模板"}),e.jsxs(B,{onValueChange:y=>{_.onChange(y),w(x.getValues())},value:_.value||void 0,children:[e.jsx(v,{children:e.jsx(q,{className:"w-[200px]",children:e.jsx(G,{placeholder:"选择邮件模板"})})}),e.jsx(U,{children:i?.data?.map(y=>e.jsx(z,{value:y,children:y},y))})]}),e.jsx(E,{children:"你可以在文档查看如何自定义邮件模板"}),e.jsx(k,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(T,{onClick:()=>D(),loading:C,disabled:C,children:C?"发送中...":"发送测试邮件"})})]})}),c&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."}),s&&e.jsx(gu,{open:a,onOpenChange:n,result:s})]})}function vu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"邮件设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置系统邮件服务,用于发送验证码、密码重置、通知等邮件,支持多种SMTP服务商。"})]}),e.jsx(ge,{}),e.jsx(pu,{})]})}const bu=Object.freeze(Object.defineProperty({__proto__:null,default:vu},Symbol.toStringTag,{value:"Module"})),yu=u.object({telegram_bot_enable:u.boolean().nullable(),telegram_bot_token:u.string().nullable(),telegram_discuss_link:u.string().nullable()}),Nu={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function wu(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(yu),defaultValues:Nu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","telegram"],queryFn:()=>is("telegram")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:h=>{h.data&&L.success("已自动保存")}}),{mutate:d,isPending:x}=We({mutationFn:pd,onSuccess:h=>{h.data&&L.success("Webhook设置成功")}});o.useEffect(()=>{if(l?.data.telegram){const h=l.data.telegram;Object.entries(h).forEach(([D,C])=>{n.setValue(D,C)}),a.current=h}},[l]);const r=o.useCallback(de.debounce(async h=>{if(!de.isEqual(h,a.current)){t(!0);try{await c(h),a.current=h}finally{t(!1)}}},1e3),[c]),i=o.useCallback(h=>{r(h)},[r]);return o.useEffect(()=>{const h=n.watch(D=>{i(D)});return()=>h.unsubscribe()},[n.watch,i]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"telegram_bot_token",render:({field:h})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"机器人Token"}),e.jsx(v,{children:e.jsx(S,{placeholder:"0000000000:xxxxxxxxx_xxxxxxxxxxxxxxx",...h,value:h.value||""})}),e.jsx(E,{children:"请输入由Botfather提供的token。"}),e.jsx(k,{})]})}),n.watch("telegram_bot_token")&&e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"设置Webhook"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(T,{loading:x,disabled:x,onClick:()=>d(),children:x?"Webhook设置中...":"一键设置"}),s&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"保存中..."})]}),e.jsx(E,{children:"对机器人进行Webhook设置,不设置将无法收到Telegram通知。"}),e.jsx(k,{})]}),e.jsx(g,{control:n.control,name:"telegram_bot_enable",render:({field:h})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"开启机器人通知"}),e.jsx(E,{children:"开启后bot将会对绑定了telegram的管理员和用户进行基础通知。"}),e.jsx(v,{children:e.jsx(H,{checked:h.value||!1,onCheckedChange:D=>{h.onChange(D),i(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"telegram_discuss_link",render:({field:h})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"群组地址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"https://t.me/xxxxxx",...h,value:h.value||""})}),e.jsx(E,{children:"填写后将会在用户端展示,或者被用于需要的地方。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function _u(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Telegram设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置Telegram机器人功能,实现用户通知、账户绑定、指令交互等自动化服务。"})]}),e.jsx(ge,{}),e.jsx(wu,{})]})}const Cu=Object.freeze(Object.defineProperty({__proto__:null,default:_u},Symbol.toStringTag,{value:"Module"})),Su=u.object({windows_version:u.string().nullable(),windows_download_url:u.string().nullable(),macos_version:u.string().nullable(),macos_download_url:u.string().nullable(),android_version:u.string().nullable(),android_download_url:u.string().nullable()}),ku={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function Tu(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(Su),defaultValues:ku,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","app"],queryFn:()=>is("app")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:r=>{r.data&&L.success("已自动保存")}});o.useEffect(()=>{if(l?.data.app){const r=l.data.app;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=o.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await c(r),a.current=r}finally{t(!1)}}},1e3),[c]),x=o.useCallback(r=>{d(r)},[d]);return o.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Windows"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"Windows端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"windows_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"windows_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.exe",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"macOS"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"macOS端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"macos_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"macos_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.dmg",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Android"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"Android端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"android_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"android_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.apk",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Du(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"APP设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"管理移动应用程序相关配置,包括API接口、版本控制、推送通知等功能设置。"})]}),e.jsx(ge,{}),e.jsx(Tu,{})]})}const Pu=Object.freeze(Object.defineProperty({__proto__:null,default:Du},Symbol.toStringTag,{value:"Module"})),na=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:b("w-full caption-bottom text-sm",s),...t})}));na.displayName="Table";const ra=o.forwardRef(({className:s,...t},a)=>e.jsx("thead",{ref:a,className:b("[&_tr]:border-b",s),...t}));ra.displayName="TableHeader";const la=o.forwardRef(({className:s,...t},a)=>e.jsx("tbody",{ref:a,className:b("[&_tr:last-child]:border-0",s),...t}));la.displayName="TableBody";const Iu=o.forwardRef(({className:s,...t},a)=>e.jsx("tfoot",{ref:a,className:b("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...t}));Iu.displayName="TableFooter";const ms=o.forwardRef(({className:s,...t},a)=>e.jsx("tr",{ref:a,className:b("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...t}));ms.displayName="TableRow";const ia=o.forwardRef(({className:s,...t},a)=>e.jsx("th",{ref:a,className:b("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t}));ia.displayName="TableHead";const Ms=o.forwardRef(({className:s,...t},a)=>e.jsx("td",{ref:a,className:b("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t}));Ms.displayName="TableCell";const Vu=o.forwardRef(({className:s,...t},a)=>e.jsx("caption",{ref:a,className:b("mt-4 text-sm text-muted-foreground",s),...t}));Vu.displayName="TableCaption";function Ru({table:s}){const[t,a]=o.useState("");o.useEffect(()=>{a((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const n=l=>{const c=parseInt(l);!isNaN(c)&&c>=1&&c<=s.getPageCount()?s.setPageIndex(c-1):a((s.getState().pagination.pageIndex+1).toString())};return e.jsxs("div",{className:"flex flex-col-reverse gap-4 px-2 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex-1 text-sm text-muted-foreground",children:["已选择 ",s.getFilteredSelectedRowModel().rows.length," 项, 共"," ",s.getFilteredRowModel().rows.length," 项"]}),e.jsxs("div",{className:"flex flex-col-reverse items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"每页显示"}),e.jsxs(B,{value:`${s.getState().pagination.pageSize}`,onValueChange:l=>{s.setPageSize(Number(l))},children:[e.jsx(q,{className:"h-8 w-[70px]",children:e.jsx(G,{placeholder:s.getState().pagination.pageSize})}),e.jsx(U,{side:"top",children:[10,20,30,40,50,100,500].map(l=>e.jsx(z,{value:`${l}`,children:l},l))})]})]}),e.jsxs("div",{className:"flex items-center justify-center space-x-2 text-sm font-medium",children:[e.jsx("span",{children:"第"}),e.jsx(S,{type:"text",value:t,onChange:l=>a(l.target.value),onBlur:l=>n(l.target.value),onKeyDown:l=>{l.key==="Enter"&&n(l.currentTarget.value)},className:"h-8 w-[50px] text-center"}),e.jsxs("span",{children:["页,共 ",s.getPageCount()," 页"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(T,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(0),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:"跳转到第一页"}),e.jsx(Ji,{className:"h-4 w-4"})]}),e.jsxs(T,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.previousPage(),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:"上一页"}),e.jsx(vn,{className:"h-4 w-4"})]}),e.jsxs(T,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.nextPage(),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4"})]}),e.jsxs(T,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(s.getPageCount()-1),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:"跳转到最后一页"}),e.jsx(Qi,{className:"h-4 w-4"})]})]})]})]})}function Ge({table:s,toolbar:t,draggable:a=!1,onDragStart:n,onDragEnd:l,onDragOver:c,onDragLeave:d,onDrop:x,showPagination:r=!0,isLoading:i=!1}){const h=o.useRef(null),D=s.getAllColumns().filter(_=>_.getIsPinned()==="left"),C=s.getAllColumns().filter(_=>_.getIsPinned()==="right"),m=_=>D.slice(0,_).reduce((y,N)=>y+(N.getSize()??0),0),w=_=>C.slice(_+1).reduce((y,N)=>y+(N.getSize()??0),0);return e.jsxs("div",{className:"space-y-4",children:[typeof t=="function"?t(s):t,e.jsx("div",{ref:h,className:"relative overflow-auto rounded-md border bg-card",children:e.jsx("div",{className:"overflow-auto",children:e.jsxs(na,{children:[e.jsx(ra,{children:s.getHeaderGroups().map(_=>e.jsx(ms,{className:"hover:bg-transparent",children:_.headers.map((y,N)=>{const P=y.column.getIsPinned()==="left",p=y.column.getIsPinned()==="right",V=P?m(D.indexOf(y.column)):void 0,A=p?w(C.indexOf(y.column)):void 0;return e.jsx(ia,{colSpan:y.colSpan,style:{width:y.getSize(),...P&&{left:V},...p&&{right:A}},className:b("h-11 bg-card px-4 text-muted-foreground",(P||p)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",P&&"before:right-0",p&&"before:left-0"]),children:y.isPlaceholder?null:vt(y.column.columnDef.header,y.getContext())},y.id)})},_.id))}),e.jsx(la,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((_,y)=>e.jsx(ms,{"data-state":_.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:a,onDragStart:N=>n?.(N,y),onDragEnd:l,onDragOver:c,onDragLeave:d,onDrop:N=>x?.(N,y),children:_.getVisibleCells().map((N,P)=>{const p=N.column.getIsPinned()==="left",V=N.column.getIsPinned()==="right",A=p?m(D.indexOf(N.column)):void 0,$=V?w(C.indexOf(N.column)):void 0;return e.jsx(Ms,{style:{width:N.column.getSize(),...p&&{left:A},...V&&{right:$}},className:b("bg-card",(p||V)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",p&&"before:right-0",V&&"before:left-0"]),children:vt(N.column.columnDef.cell,N.getContext())},N.id)})},_.id)):e.jsx(ms,{children:e.jsx(Ms,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:"暂无数据"})})})]})})}),r&&e.jsx(Ru,{table:s})]})}const vr=(s,t)=>{let a=null;switch(s.field_type){case"input":a=e.jsx(S,{placeholder:s.placeholder,...t});break;case"textarea":a=e.jsx(cs,{placeholder:s.placeholder,...t});break;case"select":a=e.jsx("select",{className:b(zs({variant:"outline"}),"w-full appearance-none font-normal"),...t,children:s.select_options&&Object.keys(s.select_options).map(n=>e.jsx("option",{value:n,children:s.select_options?.[n]},n))});break;default:a=null;break}return a},Eu=u.object({id:u.number().nullable(),name:u.string().min(2,"名称至少需要2个字符").max(30,"名称不能超过30个字符"),icon:u.string().optional().nullable(),notify_domain:u.string().refine(s=>!s||/^https?:\/\/\S+/.test(s),"请输入有效的URL").optional().nullable(),handling_fee_fixed:u.coerce.number().min(0).optional().nullable(),handling_fee_percent:u.coerce.number().min(0).max(100).optional().nullable(),payment:u.string().min(1,"请选择支付接口"),config:u.record(u.string(),u.string())}),Ea={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function br({refetch:s,dialogTrigger:t,type:a="add",defaultFormValues:n=Ea}){const[l,c]=o.useState(!1),[d,x]=o.useState(!1),[r,i]=o.useState([]),[h,D]=o.useState([]),C=ae({resolver:ie(Eu),defaultValues:n,mode:"onChange"}),m=C.watch("payment");o.useEffect(()=>{l&&(async()=>{const{data:y}=await Mc();i(y)})()},[l]),o.useEffect(()=>{if(!m||!l)return;(async()=>{const y={payment:m,...a==="edit"&&{id:Number(C.getValues("id"))}};zc(y).then(({data:N})=>{D(N);const P=N.reduce((p,V)=>(V.field_name&&(p[V.field_name]=V.value??""),p),{});C.setValue("config",P)})})()},[m,l,C,a]);const w=async _=>{x(!0),(await Oc(_)).data&&(L.success("保存成功"),C.reset(Ea),s(),c(!1)),x(!1)};return e.jsxs(ue,{open:l,onOpenChange:c,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"})," ",e.jsx("div",{children:"添加支付方式"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(je,{children:e.jsx(xe,{children:a==="add"?"添加支付方式":"编辑支付方式"})}),e.jsx(oe,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(w),className:"space-y-4",children:[e.jsx(g,{control:C.control,name:"name",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"显示名称"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入支付名称",..._})}),e.jsx(E,{children:"用于前端显示"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"icon",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"图标URL"}),e.jsx(v,{children:e.jsx(S,{placeholder:"https://example.com/icon.svg",..._})}),e.jsx(E,{children:"用于前端显示的图标地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"notify_domain",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"通知域名"}),e.jsx(v,{children:e.jsx(S,{placeholder:"https://example.com",..._})}),e.jsx(E,{children:"网关通知将发送到该域名"}),e.jsx(k,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(g,{control:C.control,name:"handling_fee_percent",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"百分比手续费(%)"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"0-100",..._})}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"handling_fee_fixed",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"固定手续费"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"0",..._})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:C.control,name:"payment",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"支付接口"}),e.jsxs(B,{value:_.value,onValueChange:_.onChange,children:[e.jsx(v,{children:e.jsx(q,{children:e.jsx(G,{placeholder:"请选择支付接口"})})}),e.jsx(U,{children:r.map(y=>e.jsx(z,{value:y,children:y},y))})]}),e.jsx(k,{})]})}),h.map(_=>e.jsx(g,{control:C.control,name:`config.${_.field_name}`,render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:_.label}),e.jsx(v,{children:vr(_,y)}),e.jsx(k,{})]})},_.field_name)),e.jsxs(Ee,{className:"gap-2",children:[e.jsx(it,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",disabled:d,className:b(d&&"cursor-not-allowed opacity-50"),children:d?"保存中...":"提交"})]})]})})]})]})}function I({column:s,title:t,tooltip:a,className:n}){return s.getCanSort()?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(T,{variant:"ghost",size:"default",className:b("-ml-3 flex h-8 items-center gap-2 text-nowrap font-medium hover:bg-muted/60",n),onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:[e.jsx("span",{children:t}),a&&e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(Na,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(ee,{children:a})]})}),s.getIsSorted()==="asc"?e.jsx(Ht,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(Kt,{className:"h-4 w-4 text-foreground/70"}):e.jsx(Zi,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-foreground/70"})]})})}):e.jsxs("div",{className:b("flex items-center space-x-1 text-nowrap py-2 font-medium text-muted-foreground",n),children:[e.jsx("span",{children:t}),a&&e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx(Na,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(ee,{children:a})]})})]})}const Fu=Xi,Mu=eo,zu=so,yr=o.forwardRef(({className:s,...t},a)=>e.jsx(Dn,{className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t,ref:a}));yr.displayName=Dn.displayName;const Nr=o.forwardRef(({className:s,...t},a)=>e.jsxs(zu,{children:[e.jsx(yr,{}),e.jsx(Pn,{ref:a,className:b("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...t})]}));Nr.displayName=Pn.displayName;const wr=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col space-y-2 text-center sm:text-left",s),...t});wr.displayName="AlertDialogHeader";const _r=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});_r.displayName="AlertDialogFooter";const Cr=o.forwardRef(({className:s,...t},a)=>e.jsx(In,{ref:a,className:b("text-lg font-semibold",s),...t}));Cr.displayName=In.displayName;const Sr=o.forwardRef(({className:s,...t},a)=>e.jsx(Vn,{ref:a,className:b("text-sm text-muted-foreground",s),...t}));Sr.displayName=Vn.displayName;const kr=o.forwardRef(({className:s,...t},a)=>e.jsx(Rn,{ref:a,className:b(zs(),s),...t}));kr.displayName=Rn.displayName;const Tr=o.forwardRef(({className:s,...t},a)=>e.jsx(En,{ref:a,className:b(zs({variant:"outline"}),"mt-2 sm:mt-0",s),...t}));Tr.displayName=En.displayName;function Ye({onConfirm:s,children:t,title:a="确认操作",description:n="确定要执行此操作吗?",cancelText:l="取消",confirmText:c="确认",variant:d="default",className:x}){return e.jsxs(Fu,{children:[e.jsx(Mu,{asChild:!0,children:t}),e.jsxs(Nr,{className:b("sm:max-w-[425px]",x),children:[e.jsxs(wr,{children:[e.jsx(Cr,{children:a}),e.jsx(Sr,{children:n})]}),e.jsxs(_r,{children:[e.jsx(Tr,{asChild:!0,children:e.jsx(T,{variant:"outline",children:l})}),e.jsx(kr,{asChild:!0,children:e.jsx(T,{variant:d,onClick:s,children:c})})]})]})]})}const Dr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M11.29 15.29a2 2 0 0 0-.12.15a.8.8 0 0 0-.09.18a.6.6 0 0 0-.06.18a1.4 1.4 0 0 0 0 .2a.84.84 0 0 0 .08.38a.9.9 0 0 0 .54.54a.94.94 0 0 0 .76 0a.9.9 0 0 0 .54-.54A1 1 0 0 0 13 16a1 1 0 0 0-.29-.71a1 1 0 0 0-1.42 0M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8 8 0 0 1-8 8m0-13a3 3 0 0 0-2.6 1.5a1 1 0 1 0 1.73 1A1 1 0 0 1 12 9a1 1 0 0 1 0 2a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-.18A3 3 0 0 0 12 7"})}),Ou=({refetch:s,isSortMode:t=!1})=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:t?"cursor-move":"opacity-0",children:e.jsx(Dt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(I,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(O,{variant:"outline",children:a.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:a})=>e.jsx(I,{column:a,title:"启用"}),cell:({row:a})=>e.jsx(H,{defaultChecked:a.getValue("enable"),onCheckedChange:async()=>{const{data:n}=await $c({id:a.original.id});n||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:a})=>e.jsx(I,{column:a,title:"显示名称"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:a.getValue("name")})}),enableSorting:!1,size:200},{accessorKey:"payment",header:({column:a})=>e.jsx(I,{column:a,title:"支付接口"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:a.getValue("payment")})}),enableSorting:!1,size:200},{accessorKey:"notify_url",header:({column:a})=>e.jsxs("div",{className:"flex items-center",children:[e.jsx(I,{column:a,title:"通知地址"}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{className:"ml-1",children:e.jsx(Dr,{className:"h-4 w-4"})}),e.jsx(ee,{children:"支付网关将会把数据通知到本地址,请通过防火墙放行本地址。"})]})})]}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[300px] truncate font-medium",children:a.getValue("notify_url")})}),enableSorting:!1,size:3e3},{id:"actions",header:({column:a})=>e.jsx(I,{className:"justify-end",column:a,title:"操作"}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(br,{refetch:s,dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:a.original}),e.jsx(Ye,{title:"删除确认",description:"确定要删除该支付方式吗?此操作无法撤销。",onConfirm:async()=>{const{data:n}=await Lc({id:a.original.id});n&&s()},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function Lu({table:s,refetch:t,saveOrder:a,isSortMode:n}){const l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽支付方式进行排序,完成后点击保存"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(br,{refetch:t}),e.jsx(S,{placeholder:"搜索支付方式...",value:s.getColumn("name")?.getFilterValue()??"",onChange:c=>s.getColumn("name")?.setFilterValue(c.target.value),className:"h-8 w-[250px]"}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:n?"default":"outline",onClick:a,size:"sm",children:n?"保存排序":"编辑排序"})})]})}function $u(){const[s,t]=o.useState([]),[a,n]=o.useState([]),[l,c]=o.useState(!1),[d,x]=o.useState([]),[r,i]=o.useState({"drag-handle":!1}),[h,D]=o.useState({pageSize:20,pageIndex:0}),{refetch:C}=Q({queryKey:["paymentList"],queryFn:async()=>{const{data:N}=await Fc();return x(N?.map(P=>({...P,enable:!!P.enable}))||[]),N}});o.useEffect(()=>{i({"drag-handle":l}),D({pageSize:l?99999:10,pageIndex:0})},[l]);const m=(N,P)=>{l&&(N.dataTransfer.setData("text/plain",P.toString()),N.currentTarget.classList.add("opacity-50"))},w=(N,P)=>{if(!l)return;N.preventDefault(),N.currentTarget.classList.remove("bg-muted");const p=parseInt(N.dataTransfer.getData("text/plain"));if(p===P)return;const V=[...d],[A]=V.splice(p,1);V.splice(P,0,A),x(V)},_=async()=>{l?Ac({ids:d.map(N=>N.id)}).then(()=>{C(),c(!1),L.success("排序保存成功")}):c(!0)},y=Le({data:d,columns:Ou({refetch:C,isSortMode:l}),state:{sorting:a,columnFilters:s,columnVisibility:r,pagination:h},onSortingChange:n,onColumnFiltersChange:t,onColumnVisibilityChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),initialState:{columnPinning:{right:["actions"]}},pageCount:l?1:void 0});return e.jsx(Ge,{table:y,toolbar:N=>e.jsx(Lu,{table:N,refetch:C,saveOrder:_,isSortMode:l}),draggable:l,onDragStart:m,onDragEnd:N=>N.currentTarget.classList.remove("opacity-50"),onDragOver:N=>{N.preventDefault(),N.currentTarget.classList.add("bg-muted")},onDragLeave:N=>N.currentTarget.classList.remove("bg-muted"),onDrop:w,showPagination:!l})}function Au(){return e.jsxs(be,{children:[e.jsxs(ye,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{children:[e.jsx("header",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"支付配置"})}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置支付方式,包括支付宝、微信等。"})]})}),e.jsx("section",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx($u,{})})]})]})}const Hu=Object.freeze(Object.defineProperty({__proto__:null,default:Au},Symbol.toStringTag,{value:"Module"}));function Ku({themeKey:s,themeInfo:t}){const[a,n]=o.useState(!1),[l,c]=o.useState(!1),[d,x]=o.useState(!1),r=ae({defaultValues:t.configs.reduce((D,C)=>(D[C.field_name]="",D),{})}),i=async()=>{c(!0),yc(s).then(({data:D})=>{Object.entries(D).forEach(([C,m])=>{r.setValue(C,m)})}).finally(()=>{c(!1)})},h=async D=>{x(!0),Nc(s,D).then(()=>{L.success("保存成功"),n(!1)}).finally(()=>{x(!1)})};return e.jsxs(ue,{open:a,onOpenChange:D=>{n(D),D?i():r.reset()},children:[e.jsx(Re,{asChild:!0,children:e.jsx(T,{variant:"outline",children:"主题设置"})}),e.jsxs(ce,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsxs(xe,{children:["配置",t.name,"主题"]}),e.jsx(Se,{children:"修改主题的样式、布局和其他显示选项。"})]}),l?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(ea,{className:"h-6 w-6 animate-spin"})}):e.jsx(oe,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(h),className:"space-y-4",children:[t.configs.map(D=>e.jsx(g,{control:r.control,name:D.field_name,render:({field:C})=>e.jsxs(j,{children:[e.jsx(f,{children:D.label}),e.jsx(v,{children:vr(D,C)}),e.jsx(k,{})]})},D.field_name)),e.jsxs(Ee,{className:"mt-6 gap-2",children:[e.jsx(T,{type:"button",variant:"secondary",onClick:()=>n(!1),children:"取消"}),e.jsx(T,{type:"submit",loading:d,children:"保存"})]})]})})]})]})}function qu(){const[s,t]=o.useState(null),[a,n]=o.useState(!1),[l,c]=o.useState(!1),[d,x]=o.useState(!1),[r,i]=o.useState(null),h=o.useRef(null),[D,C]=o.useState(0),{data:m,isLoading:w,refetch:_}=Q({queryKey:["themeList"],queryFn:async()=>{const{data:F}=await bc();return F}}),y=async F=>{t(F),Cc({frontend_theme:F}).then(()=>{L.success("主题切换成功"),_()}).finally(()=>{t(null)})},N=async F=>{if(!F.name.endsWith(".zip")){L.error("只支持上传 ZIP 格式的主题文件");return}n(!0),wc(F).then(()=>{L.success("主题上传成功"),c(!1),_()}).finally(()=>{n(!1),h.current&&(h.current.value="")})},P=F=>{F.preventDefault(),F.stopPropagation(),F.type==="dragenter"||F.type==="dragover"?x(!0):F.type==="dragleave"&&x(!1)},p=F=>{F.preventDefault(),F.stopPropagation(),x(!1),F.dataTransfer.files&&F.dataTransfer.files[0]&&N(F.dataTransfer.files[0])},V=()=>{r&&C(F=>F===0?r.images.length-1:F-1)},A=()=>{r&&C(F=>F===r.images.length-1?0:F+1)},$=(F,Y)=>{C(0),i({name:F,images:Y})};return e.jsxs(be,{children:[e.jsxs(ye,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"主题配置"})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-muted-foreground",children:"主题配置,包括主题色、字体大小等。如果你采用前后分离的方式部署V2board,那么主题配置将不会生效。"}),e.jsxs(T,{onClick:()=>c(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(wa,{className:"mr-2 h-4 w-4"}),"上传主题"]})]})]}),e.jsx("section",{className:"grid gap-6 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3",children:w?e.jsxs(e.Fragment,{children:[e.jsx(Fa,{}),e.jsx(Fa,{})]}):m?.themes&&Object.entries(m.themes).map(([F,Y])=>e.jsx(Ie,{className:"group relative overflow-hidden transition-all hover:shadow-md",style:{backgroundImage:Y.background_url?`url(${Y.background_url})`:"none",backgroundSize:"cover",backgroundPosition:"center"},children:e.jsxs("div",{className:b("relative z-10 h-full transition-colors",Y.background_url?"group-hover:from-background/98 bg-gradient-to-t from-background/95 via-background/80 to-background/60 backdrop-blur-[1px] group-hover:via-background/90 group-hover:to-background/70":"bg-background"),children:[!!Y.can_delete&&e.jsx("div",{className:"absolute right-2 top-2",children:e.jsx(Ye,{title:"删除主题",description:"确定要删除该主题吗?删除后无法恢复。",confirmText:"删除",variant:"destructive",onConfirm:async()=>{if(F===m?.active){L.error("不能删除当前使用的主题");return}t(F),_c(F).then(()=>{L.success("主题删除成功"),_()}).finally(()=>{t(null)})},children:e.jsx(T,{disabled:s===F,loading:s===F,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(ns,{className:"h-4 w-4"})})})}),e.jsxs(ze,{children:[e.jsx(Je,{children:Y.name}),e.jsx(Zs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{children:Y.description}),Y.version&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:["版本: ",Y.version]})]})})]}),e.jsxs(Oe,{className:"flex items-center justify-end space-x-3",children:[Y.images&&Array.isArray(Y.images)&&Y.images.length>0&&e.jsx(T,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>$(Y.name,Y.images),children:e.jsx(to,{className:"h-4 w-4"})}),e.jsx(Ku,{themeKey:F,themeInfo:Y}),e.jsx(T,{onClick:()=>y(F),disabled:s===F||F===m.active,loading:s===F,variant:F===m.active?"secondary":"default",children:F===m.active?"当前主题":"激活主题"})]})]})},F))}),e.jsx(ue,{open:l,onOpenChange:c,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(je,{children:[e.jsx(xe,{children:"上传主题"}),e.jsx(Se,{children:"请上传一个有效的主题压缩包(.zip 格式)。主题包应包含完整的主题文件结构。"})]}),e.jsxs("div",{className:b("relative mt-4 flex h-64 flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted-foreground/25 px-5 py-10 text-center transition-colors",d&&"border-primary/50 bg-muted/50"),onDragEnter:P,onDragLeave:P,onDragOver:P,onDrop:p,children:[e.jsx("input",{type:"file",ref:h,className:"hidden",accept:".zip",onChange:F=>{const Y=F.target.files?.[0];Y&&N(Y)}}),a?e.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[e.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-b-2 border-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"正在上传..."})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"rounded-full border-2 border-muted-foreground/25 p-3",children:e.jsx(wa,{className:"h-6 w-6 text-muted-foreground/50"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:["将主题文件拖放到此处,或者",e.jsx("button",{type:"button",onClick:()=>h.current?.click(),className:"mx-1 text-primary hover:underline",children:"点击选择"})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"支持 .zip 格式的主题包"})]})]})})]})]})}),e.jsx(ue,{open:!!r,onOpenChange:F=>{F||(i(null),C(0))},children:e.jsxs(ce,{className:"max-w-4xl",children:[e.jsxs(je,{children:[e.jsxs(xe,{children:[r?.name," 主题预览"]}),e.jsx(Se,{className:"text-center",children:r&&`${D+1} / ${r.images.length}`})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"aspect-[16/9] overflow-hidden rounded-lg border bg-muted",children:r?.images[D]&&e.jsx("img",{src:r.images[D],alt:`${r.name} 预览图 ${D+1}`,className:"h-full w-full object-contain"})}),r&&r.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(T,{variant:"outline",size:"icon",className:"absolute left-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:V,children:e.jsx(ao,{className:"h-4 w-4"})}),e.jsx(T,{variant:"outline",size:"icon",className:"absolute right-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:A,children:e.jsx(no,{className:"h-4 w-4"})})]})]}),r&&r.images.length>1&&e.jsx("div",{className:"mt-4 flex gap-2 overflow-x-auto pb-2",children:r.images.map((F,Y)=>e.jsx("button",{onClick:()=>C(Y),className:b("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",D===Y?"border-primary":"border-transparent"),children:e.jsx("img",{src:F,alt:`缩略图 ${Y+1}`,className:"h-full w-full object-cover"})},Y))})]})})]})]})}function Fa(){return e.jsxs(Ie,{children:[e.jsxs(ze,{children:[e.jsx(Fe,{className:"h-6 w-[200px]"}),e.jsx(Fe,{className:"h-4 w-[300px]"})]}),e.jsxs(Oe,{className:"flex items-center justify-end space-x-3",children:[e.jsx(Fe,{className:"h-10 w-[100px]"}),e.jsx(Fe,{className:"h-10 w-[100px]"})]})]})}const Uu=Object.freeze(Object.defineProperty({__proto__:null,default:qu},Symbol.toStringTag,{value:"Module"})),oa=o.forwardRef(({className:s,value:t,onChange:a,...n},l)=>{const[c,d]=o.useState("");o.useEffect(()=>{if(c.includes(",")){const r=new Set([...t,...c.split(",").map(i=>i.trim())]);a(Array.from(r)),d("")}},[c,a,t]);const x=()=>{if(c){const r=new Set([...t,c]);a(Array.from(r)),d("")}};return e.jsxs("div",{className:b(" has-[:focus-visible]:outline-none has-[:focus-visible]:ring-1 has-[:focus-visible]:ring-neutral-950 dark:has-[:focus-visible]:ring-neutral-300 flex w-full flex-wrap gap-2 rounded-md border border-input shadow-sm px-3 py-2 text-sm ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",s),children:[t.map(r=>e.jsxs(O,{variant:"secondary",children:[r,e.jsx(W,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{a(t.filter(i=>i!==r))},children:e.jsx(qt,{className:"w-3"})})]},r)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:c,onChange:r=>d(r.target.value),onKeyDown:r=>{r.key==="Enter"||r.key===","?(r.preventDefault(),x()):r.key==="Backspace"&&c.length===0&&t.length>0&&(r.preventDefault(),a(t.slice(0,-1)))},...n,ref:l})]})});oa.displayName="InputTags";const Bu=u.object({id:u.number().nullable(),title:u.string().min(1).max(250),content:u.string().min(1),show:u.boolean(),tags:u.array(u.string()),img_url:u.string().nullable()}),Gu={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function Pr({refetch:s,dialogTrigger:t,type:a="add",defaultFormValues:n=Gu}){const[l,c]=o.useState(!1),d=ae({resolver:ie(Bu),defaultValues:n,mode:"onChange",shouldFocusError:!0});return e.jsx(oe,{...d,children:e.jsxs(ue,{onOpenChange:c,open:l,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"})," ",e.jsx("div",{children:"添加公告"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:a==="add"?"添加公告":"编辑公告"}),e.jsx(Se,{})]}),e.jsx(g,{control:d.control,name:"title",render:({field:x})=>e.jsxs(j,{children:[e.jsx(f,{children:"标题"}),e.jsx("div",{className:"relative ",children:e.jsx(v,{children:e.jsx(S,{placeholder:"请输入公告标题",...x})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"content",render:({field:x})=>e.jsxs(j,{children:[e.jsx(f,{children:"公告内容"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsx(cs,{className:"min-h-[150px]",placeholder:"请输入公告内容,支持HTML",...x})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"img_url",render:({field:x})=>e.jsxs(j,{children:[e.jsx(f,{children:"公告背景"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsx(S,{type:"text",placeholder:"请输入公告背景图片URL",...x,value:x.value||""})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"show",render:({field:x})=>e.jsxs(j,{children:[e.jsx(f,{children:"显示"}),e.jsx("div",{className:"relative py-2",children:e.jsx(v,{children:e.jsx(H,{checked:x.value,onCheckedChange:x.onChange})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"tags",render:({field:x})=>e.jsxs(j,{children:[e.jsx(f,{children:"节点标签"}),e.jsx(v,{children:e.jsx(oa,{value:x.value,onChange:x.onChange,placeholder:"输入后回车添加标签",className:"w-full"})}),e.jsx(k,{})]})}),e.jsxs(Ee,{children:[e.jsx(it,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",onClick:x=>{x.preventDefault(),d.handleSubmit(async r=>{try{(await Kc(r)).data&&(await s(),c(!1))}catch(i){console.error("Failed to save notice:",i)}})()},children:"提交"})]})]})]})})}function Yu({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between space-x-2 ",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(Pr,{refetch:t}),e.jsx(S,{placeholder:"搜索公告标题...",value:s.getColumn("title")?.getFilterValue()??"",onChange:n=>s.getColumn("title")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),e.jsx("div",{className:"flex items-center space-x-2"})]})}const Wu=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"ID"}),cell:({row:t})=>e.jsx(O,{variant:"outline",className:"font-mono",children:t.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"显示状态"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(H,{defaultChecked:t.getValue("show"),onCheckedChange:async()=>{const{data:a}=await Uc({id:t.original.id});a||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:t})=>e.jsx(I,{column:t,title:"标题"}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[500px] items-center",children:e.jsx("span",{className:"truncate font-medium",children:t.getValue("title")})}),enableSorting:!1,size:6e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(Pr,{refetch:s,dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:t.original}),e.jsx(Ye,{title:"删除确认",description:"确定要删除该条公告吗?此操作无法撤销。",onConfirm:async()=>{qc({id:t.original.id}).then(()=>{L.success("删除成功"),s()})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function Ju(){const[s,t]=o.useState({}),[a,n]=o.useState({}),[l,c]=o.useState([]),[d,x]=o.useState([]),{data:r,isLoading:i,refetch:h}=Q({queryKey:["notices"],queryFn:async()=>{const{data:C}=await Hc();return C}}),D=Le({data:r??[],columns:Wu(h),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:D,toolbar:C=>e.jsx(Yu,{table:C,refetch:h})})}function Qu(){return e.jsxs(be,{children:[e.jsxs(ye,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"公告管理"})}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置公告,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Ju,{})})]})]})}const Zu=Object.freeze(Object.defineProperty({__proto__:null,default:Qu},Symbol.toStringTag,{value:"Module"})),Xu=u.object({id:u.number().nullable(),language:u.string().max(250),category:u.string().max(250),title:u.string().min(1).max(250),body:u.string().min(1),show:u.boolean()}),ex={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function Ir({refreshData:s,dialogTrigger:t,type:a="add",defaultFormValues:n=ex}){const[l,c]=o.useState(!1),d=ae({resolver:ie(Xu),defaultValues:n,mode:"onChange",shouldFocusError:!0}),x=new Fn({html:!0});return o.useEffect(()=>{l&&n.id&&Gc(n.id).then(({data:r})=>{d.reset(r)})},[n.id,d,l]),e.jsxs(ue,{onOpenChange:c,open:l,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"})," ",e.jsx("div",{children:"添加知识"})]})}),e.jsxs(ce,{className:"sm:max-w-[1025px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:a==="add"?"添加知识":"编辑知识"}),e.jsx(Se,{})]}),e.jsxs(oe,{...d,children:[e.jsx(g,{control:d.control,name:"title",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"标题"}),e.jsx("div",{className:"relative ",children:e.jsx(v,{children:e.jsx(S,{placeholder:"请输入知识标题",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"category",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"分类"}),e.jsx("div",{className:"relative ",children:e.jsx(v,{children:e.jsx(S,{placeholder:"请输入分类,分类将会自动归类",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"language",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"语言"}),e.jsx(v,{children:e.jsxs(B,{value:r.value,onValueChange:r.onChange,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择语言"})}),e.jsx(U,{children:[{field:"English",value:"en-US"},{field:"日本語",value:"ja-JP"},{field:"한국어",value:"ko-KR"},{field:"Tiếng Việt",value:"vi-VN"},{field:"简体中文",value:"zh-CN"},{field:"繁體中文",value:"zh-TW"}].map(i=>e.jsx(z,{value:i.value,className:"cursor-pointer",children:i.field},i.value))})]})})]})}),e.jsx(g,{control:d.control,name:"body",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"内容"}),e.jsx(v,{children:e.jsx(Mn,{style:{height:"500px"},value:r.value,renderHTML:i=>x.render(i),onChange:({text:i})=>{r.onChange(i)}})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"show",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"显示"}),e.jsx("div",{className:"relative py-2",children:e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:r.onChange})})}),e.jsx(k,{})]})}),e.jsxs(Ee,{children:[e.jsx(it,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",onClick:()=>{d.handleSubmit(r=>{Yc(r).then(({data:i})=>{i&&(d.reset(),L.success("操作成功"),c(!1),s())})})()},children:"提交"})]})]})]})]})}function sx({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(c=>l.has(c.value)).map(c=>e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(js,{children:[e.jsx(Cs,{placeholder:t}),e.jsxs(gs,{children:[e.jsx(Ss,{children:"No results found."}),e.jsx(Ve,{children:a.map(c=>{const d=l.has(c.value);return e.jsxs(ve,{onSelect:()=>{d?l.delete(c.value):l.add(c.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},children:[e.jsx("div",{className:b("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ns,{className:b("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:c.label}),n?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(c.value)})]},c.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ls,{}),e.jsx(Ve,{children:e.jsx(ve,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function tx({table:s,refetch:t,saveOrder:a,isSortMode:n}){const l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽知识条目进行排序,完成后点击保存"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ir,{refreshData:t}),e.jsx(S,{placeholder:"搜索知识...",value:s.getColumn("title")?.getFilterValue()??"",onChange:c=>s.getColumn("title")?.setFilterValue(c.target.value),className:"h-8 w-[250px]"}),s.getColumn("category")&&e.jsx(sx,{column:s.getColumn("category"),title:"分类",options:Array.from(new Set(s.getCoreRowModel().rows.map(c=>c.getValue("category")))).map(c=>({label:c,value:c}))}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:n?"default":"outline",onClick:a,size:"sm",children:n?"保存排序":"编辑排序"})})]})}const ax=({refetch:s,isSortMode:t=!1})=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:t?"cursor-move":"opacity-0",children:e.jsx(Dt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(I,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(O,{variant:"outline",className:"justify-center",children:a.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:a})=>e.jsx(I,{column:a,title:"状态"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(H,{defaultChecked:a.getValue("show"),onCheckedChange:async()=>{Jc({id:a.original.id}).then(({data:n})=>{n||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:a})=>e.jsx(I,{column:a,title:"标题"}),cell:({row:a})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"line-clamp-2 font-medium",children:a.getValue("title")})}),enableSorting:!0,size:600},{accessorKey:"category",header:({column:a})=>e.jsx(I,{column:a,title:"分类"}),cell:({row:a})=>e.jsx(O,{variant:"secondary",className:"max-w-[180px] truncate",children:a.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:a})=>e.jsx(I,{className:"justify-end",column:a,title:"操作"}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx(Ir,{refreshData:s,dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:a.original}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该知识库记录,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Wc({id:a.original.id}).then(({data:n})=>{n&&(L.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function nx(){const[s,t]=o.useState([]),[a,n]=o.useState([]),[l,c]=o.useState(!1),[d,x]=o.useState([]),[r,i]=o.useState({"drag-handle":!1}),[h,D]=o.useState({pageSize:20,pageIndex:0}),{refetch:C,isLoading:m,data:w}=Q({queryKey:["knowledge"],queryFn:async()=>{const{data:p}=await Bc();return x(p||[]),p}});o.useEffect(()=>{i({"drag-handle":l}),D({pageSize:l?99999:10,pageIndex:0})},[l]);const _=(p,V)=>{l&&(p.dataTransfer.setData("text/plain",V.toString()),p.currentTarget.classList.add("opacity-50"))},y=(p,V)=>{if(!l)return;p.preventDefault(),p.currentTarget.classList.remove("bg-muted");const A=parseInt(p.dataTransfer.getData("text/plain"));if(A===V)return;const $=[...d],[F]=$.splice(A,1);$.splice(V,0,F),x($)},N=async()=>{Qc({ids:d.map(p=>p.id)}).then(()=>{C(),c(!1),L.success("排序保存成功")})},P=Le({data:d,columns:ax({refetch:C,isSortMode:l}),state:{sorting:a,columnFilters:s,columnVisibility:r,pagination:h},onSortingChange:n,onColumnFiltersChange:t,onColumnVisibilityChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:P,toolbar:p=>e.jsx(tx,{table:p,refetch:C,saveOrder:N,isSortMode:l}),draggable:l,onDragStart:_,onDragEnd:p=>p.currentTarget.classList.remove("opacity-50"),onDragOver:p=>{p.preventDefault(),p.currentTarget.classList.add("bg-muted")},onDragLeave:p=>p.currentTarget.classList.remove("bg-muted"),onDrop:y,showPagination:!l})}function rx(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight mb-2",children:"知识库管理"}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置知识库,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(nx,{})})]})]})}const lx=Object.freeze(Object.defineProperty({__proto__:null,default:rx},Symbol.toStringTag,{value:"Module"}));function ix(s,t){const[a,n]=o.useState(s);return o.useEffect(()=>{const l=setTimeout(()=>n(s),t);return()=>{clearTimeout(l)}},[s,t]),a}function Lt(s,t){if(s.length===0)return{};if(!t)return{"":s};const a={};return s.forEach(n=>{const l=n[t]||"";a[l]||(a[l]=[]),a[l].push(n)}),a}function ox(s,t){const a=JSON.parse(JSON.stringify(s));for(const[n,l]of Object.entries(a))a[n]=l.filter(c=>!t.find(d=>d.value===c.value));return a}function cx(s,t){for(const[,a]of Object.entries(s))if(a.some(n=>t.find(l=>l.value===n.value)))return!0;return!1}const Vr=o.forwardRef(({className:s,...t},a)=>ro(l=>l.filtered.count===0)?e.jsx("div",{ref:a,className:b("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...t}):null);Vr.displayName="CommandEmpty";const at=o.forwardRef(({value:s,onChange:t,placeholder:a,defaultOptions:n=[],options:l,delay:c,onSearch:d,loadingIndicator:x,emptyIndicator:r,maxSelected:i=Number.MAX_SAFE_INTEGER,onMaxSelected:h,hidePlaceholderWhenSelected:D,disabled:C,groupBy:m,className:w,badgeClassName:_,selectFirstItem:y=!0,creatable:N=!1,triggerSearchOnFocus:P=!1,commandProps:p,inputProps:V,hideClearAllButton:A=!1},$)=>{const F=o.useRef(null),[Y,Ds]=o.useState(!1),$s=o.useRef(!1),[ha,ja]=o.useState(!1),[J,As]=o.useState(s||[]),[fs,ga]=o.useState(Lt(n,m)),[ds,Mt]=o.useState(""),Hs=ix(ds,c||500);o.useImperativeHandle($,()=>({selectedValue:[...J],input:F.current,focus:()=>F.current?.focus()}),[J]);const ot=o.useCallback(K=>{const Z=J.filter(Ce=>Ce.value!==K.value);As(Z),t?.(Z)},[t,J]),al=o.useCallback(K=>{const Z=F.current;Z&&((K.key==="Delete"||K.key==="Backspace")&&Z.value===""&&J.length>0&&(J[J.length-1].fixed||ot(J[J.length-1])),K.key==="Escape"&&Z.blur())},[ot,J]);o.useEffect(()=>{s&&As(s)},[s]),o.useEffect(()=>{if(!l||d)return;const K=Lt(l||[],m);JSON.stringify(K)!==JSON.stringify(fs)&&ga(K)},[n,l,m,d,fs]),o.useEffect(()=>{const K=async()=>{ja(!0);const Ce=await d?.(Hs);ga(Lt(Ce||[],m)),ja(!1)};(async()=>{!d||!Y||(P&&await K(),Hs&&await K())})()},[Hs,m,Y,P]);const nl=()=>{if(!N||cx(fs,[{value:ds,label:ds}])||J.find(Z=>Z.value===ds))return;const K=e.jsx(ve,{value:ds,className:"cursor-pointer",onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation()},onSelect:Z=>{if(J.length>=i){h?.(J.length);return}Mt("");const Ce=[...J,{value:Z,label:Z}];As(Ce),t?.(Ce)},children:`Create "${ds}"`});if(!d&&ds.length>0||d&&Hs.length>0&&!ha)return K},rl=o.useCallback(()=>{if(r)return d&&!N&&Object.keys(fs).length===0?e.jsx(ve,{value:"-",disabled:!0,children:r}):e.jsx(Vr,{children:r})},[N,r,d,fs]),ll=o.useMemo(()=>ox(fs,J),[fs,J]),il=o.useCallback(()=>{if(p?.filter)return p.filter;if(N)return(K,Z)=>K.toLowerCase().includes(Z.toLowerCase())?1:-1},[N,p?.filter]),ol=o.useCallback(()=>{const K=J.filter(Z=>Z.fixed);As(K),t?.(K)},[t,J]);return e.jsxs(js,{...p,onKeyDown:K=>{al(K),p?.onKeyDown?.(K)},className:b("h-auto overflow-visible bg-transparent",p?.className),shouldFilter:p?.shouldFilter!==void 0?p.shouldFilter:!d,filter:il(),children:[e.jsx("div",{className:b("rounded-md border border-input text-sm ring-offset-background focus-within:ring-1 focus-within:ring-ring ",{"px-3 py-2":J.length!==0,"cursor-text":!C&&J.length!==0},w),onClick:()=>{C||F.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[J.map(K=>e.jsxs(O,{className:b("data-[disabled]:bg-muted-foreground data-[disabled]:text-muted data-[disabled]:hover:bg-muted-foreground","data-[fixed]:bg-muted-foreground data-[fixed]:text-muted data-[fixed]:hover:bg-muted-foreground",_),"data-fixed":K.fixed,"data-disabled":C||void 0,children:[K.label,e.jsx("button",{className:b("ml-1 rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",(C||K.fixed)&&"hidden"),onKeyDown:Z=>{Z.key==="Enter"&&ot(K)},onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation()},onClick:()=>ot(K),children:e.jsx(qt,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},K.value)),e.jsx(we.Input,{...V,ref:F,value:ds,disabled:C,onValueChange:K=>{Mt(K),V?.onValueChange?.(K)},onBlur:K=>{$s.current===!1&&Ds(!1),V?.onBlur?.(K)},onFocus:K=>{Ds(!0),P&&d?.(Hs),V?.onFocus?.(K)},placeholder:D&&J.length!==0?"":a,className:b("flex-1 bg-transparent outline-none placeholder:text-muted-foreground",{"w-full":D,"px-3 py-2":J.length===0,"ml-1":J.length!==0},V?.className)}),e.jsx("button",{type:"button",onClick:ol,className:b((A||C||J.length<1||J.filter(K=>K.fixed).length===J.length)&&"hidden"),children:e.jsx(qt,{})})]})}),e.jsx("div",{className:"relative",children:Y&&e.jsx(gs,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{$s.current=!1},onMouseEnter:()=>{$s.current=!0},onMouseUp:()=>{F.current?.focus()},children:ha?e.jsx(e.Fragment,{children:x}):e.jsxs(e.Fragment,{children:[rl(),nl(),!y&&e.jsx(ve,{value:"-",className:"hidden"}),Object.entries(ll).map(([K,Z])=>e.jsx(Ve,{heading:K,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:Z.map(Ce=>e.jsx(ve,{value:Ce.value,disabled:Ce.disable,onMouseDown:Ks=>{Ks.preventDefault(),Ks.stopPropagation()},onSelect:()=>{if(J.length>=i){h?.(J.length);return}Mt("");const Ks=[...J,Ce];As(Ks),t?.(Ks)},className:b("cursor-pointer",Ce.disable&&"cursor-default text-muted-foreground"),children:Ce.label},Ce.value))})},K))]})})})]})});at.displayName="MultipleSelector";const dx=u.object({id:u.number().optional(),name:u.string().min(2,"组名至少需要2个字符").max(50,"组名不能超过50个字符").regex(/^[a-zA-Z0-9\u4e00-\u9fa5_-]+$/,"组名只能包含字母、数字、中文、下划线和连字符")});function Ft({refetch:s,dialogTrigger:t,defaultValues:a={name:""},type:n="add"}){const l=ae({resolver:ie(dx),defaultValues:a,mode:"onChange"}),[c,d]=o.useState(!1),[x,r]=o.useState(!1),i=async h=>{r(!0),Ic(h).then(()=>{L.success(n==="edit"?"更新成功":"创建成功"),s&&s(),l.reset(),d(!1)}).finally(()=>{r(!1)})};return e.jsxs(ue,{open:c,onOpenChange:d,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("span",{children:"添加权限组"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:n==="edit"?"编辑权限组":"创建权限组"}),e.jsx(Se,{children:n==="edit"?"修改权限组信息,更新后会立即生效。":"创建新的权限组,可以为不同的用户分配不同的权限。"})]}),e.jsx(oe,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(i),className:"space-y-4",children:[e.jsx(g,{control:l.control,name:"name",render:({field:h})=>e.jsxs(j,{children:[e.jsx(f,{children:"组名称"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入权限组名称",...h,className:"w-full"})}),e.jsx(E,{children:"权限组名称用于标识不同的用户组,建议使用有意义的名称。"}),e.jsx(k,{})]})}),e.jsxs(Ee,{className:"gap-2",children:[e.jsx(it,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsxs(T,{type:"submit",disabled:x||!l.formState.isValid,children:[x&&e.jsx(ea,{className:"mr-2 h-4 w-4 animate-spin"}),n==="edit"?"更新":"创建"]})]})]})})]})]})}const Rr=o.createContext(void 0);function ux({children:s,refetch:t}){const[a,n]=o.useState(!1),[l,c]=o.useState(null),[d,x]=o.useState(pe.Shadowsocks);return e.jsx(Rr.Provider,{value:{isOpen:a,setIsOpen:n,editingServer:l,setEditingServer:c,serverType:d,setServerType:x,refetch:t},children:s})}function Er(){const s=o.useContext(Rr);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function $t({dialogTrigger:s,value:t,setValue:a,templateType:n}){o.useEffect(()=>{console.log(t)},[t]);const[l,c]=o.useState(!1),[d,x]=o.useState(()=>{if(!t||Object.keys(t).length===0)return"";try{return JSON.stringify(t,null,2)}catch{return""}}),[r,i]=o.useState(null),h=y=>{if(!y)return null;try{const N=JSON.parse(y);return typeof N!="object"||N===null?"配置必须是一个JSON对象":null}catch{return"无效的JSON格式"}},D={tcp:{label:"TCP",content:{acceptProxyProtocol:!1,header:{type:"none"}}},"tcp-http":{label:"TCP + HTTP",content:{acceptProxyProtocol:!1,header:{type:"http",request:{version:"1.1",method:"GET",path:["/"],headers:{Host:["www.example.com"]}},response:{version:"1.1",status:"200",reason:"OK"}}}},grpc:{label:"gRPC",content:{serviceName:"GunService"}},ws:{label:"WebSocket",content:{path:"/",headers:{Host:"v2ray.com"}}}},C=()=>{switch(n){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];default:return[]}},m=()=>{const y=h(d||"");if(y){L.error(y);return}try{if(!d){a(null),c(!1);return}a(JSON.parse(d)),c(!1)}catch{L.error("保存时发生错误")}},w=y=>{x(y),i(h(y))},_=y=>{const N=D[y];if(N){const P=JSON.stringify(N.content,null,2);x(P),i(null)}};return o.useEffect(()=>{l&&console.log(t)},[l,t]),o.useEffect(()=>{l&&t&&Object.keys(t).length>0&&x(JSON.stringify(t,null,2))},[l,t]),e.jsxs(ue,{open:l,onOpenChange:y=>{!y&&l&&m(),c(y)},children:[e.jsx(Re,{asChild:!0,children:s??e.jsx(W,{variant:"link",children:"编辑协议"})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(je,{children:e.jsx(xe,{children:"编辑协议配置"})}),e.jsxs("div",{className:"space-y-4",children:[C().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:C().map(y=>e.jsxs(W,{variant:"outline",size:"sm",onClick:()=>_(y),children:["使用",D[y].label,"模板"]},y))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(cs,{className:`min-h-[200px] font-mono text-sm ${r?"border-red-500 focus-visible:ring-red-500":""}`,value:d,placeholder:`请输入JSON配置${C().length>0?"或选择上方模板":""}`,onChange:y=>w(y.target.value)}),r&&e.jsx("p",{className:"text-sm text-red-500",children:r})]})]}),e.jsxs(Ee,{className:"gap-2",children:[e.jsx(W,{variant:"outline",onClick:()=>c(!1),children:"取消"}),e.jsx(W,{onClick:m,disabled:!!r,children:"确定"})]})]})]})}function dh(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const xx={},mx=Object.freeze(Object.defineProperty({__proto__:null,default:xx},Symbol.toStringTag,{value:"Module"})),uh=vo(mx),Ma=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),hx=()=>{try{const s=lo.box.keyPair(),t=Ma(_a.encodeBase64(s.secretKey)),a=Ma(_a.encodeBase64(s.publicKey));return{privateKey:t,publicKey:a}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},jx=()=>{try{return hx()}catch(s){throw console.error("Error generating key pair:",s),s}},gx=s=>{const t=new Uint8Array(Math.ceil(s/2));return window.crypto.getRandomValues(t),Array.from(t).map(a=>a.toString(16).padStart(2,"0")).join("").substring(0,s)},fx=()=>{const s=Math.floor(Math.random()*8)*2+2;return gx(s)},px=u.object({cipher:u.string().default("aes-128-gcm"),obfs:u.string().default("0"),obfs_settings:u.object({path:u.string().default(""),host:u.string().default("")}).default({})}),vx=u.object({tls:u.coerce.number().default(0),tls_settings:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({})}),bx=u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({})}),yx=u.object({version:u.coerce.number().default(2),alpn:u.string().default("h2"),obfs:u.object({open:u.coerce.boolean().default(!1),type:u.string().default("salamander"),password:u.string().default("")}).default({}),tls:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),bandwidth:u.object({up:u.string().default(""),down:u.string().default("")}).default({})}),Nx=u.object({tls:u.coerce.number().default(0),tls_settings:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),reality_settings:u.object({server_port:u.coerce.number().default(443),server_name:u.string().default(""),allow_insecure:u.boolean().default(!1),public_key:u.string().default(""),private_key:u.string().default(""),short_id:u.string().default("")}).default({}),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({}),flow:u.string().default("")}),Xe={shadowsocks:{schema:px,ciphers:["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"]},vmess:{schema:vx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:bx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:yx,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:Nx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"},{value:"kcp",label:"mKCP"},{value:"httpupgrade",label:"HttpUpgrade"},{value:"xhttp",label:"XHTTP"}],flowOptions:["none","xtls-rprx-direct","xtls-rprx-splice","xtls-rprx-vision"]}},wx=({serverType:s,value:t,onChange:a})=>{const n=s?Xe[s]:null,l=n?.schema||u.record(u.any()),c=s?l.parse({}):{},d=ae({resolver:ie(l),defaultValues:c,mode:"onChange"});return o.useEffect(()=>{if(!t||Object.keys(t).length===0){if(s){const m=l.parse({});d.reset(m)}}else d.reset(t)},[s,t,a,d,l]),o.useEffect(()=>{const m=d.watch(w=>{a(w)});return()=>m.unsubscribe()},[d,a]),!s||!n?null:{shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"cipher",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"加密算法"}),e.jsx(v,{children:e.jsxs(B,{onValueChange:m.onChange,value:m.value,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择加密算法"})}),e.jsx(U,{children:e.jsx(us,{children:Xe.shadowsocks.ciphers.map(w=>e.jsx(z,{value:w,children:w},w))})})]})})]})}),e.jsx(g,{control:d.control,name:"obfs",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"混淆"}),e.jsx(v,{children:e.jsxs(B,{onValueChange:m.onChange,value:m.value,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择混淆方式"})}),e.jsx(U,{children:e.jsxs(us,{children:[e.jsx(z,{value:"0",children:"无"}),e.jsx(z,{value:"http",children:"HTTP"})]})})]})})]})}),d.watch("obfs")==="http"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"obfs_settings.path",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(v,{children:e.jsx(S,{type:"text",placeholder:"路径",...m})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"obfs_settings.host",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(v,{children:e.jsx(S,{type:"text",placeholder:"Host",...m})}),e.jsx(k,{})]})})]})]}),vmess:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"tls",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"TLS"}),e.jsx(v,{children:e.jsxs(B,{value:m.value?.toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择安全性"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"不支持"}),e.jsx(z,{value:"1",children:"支持"})]})]})})]})}),d.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"服务器名称指示(SNI)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"不使用请留空",...m})})]})}),e.jsx(g,{control:d.control,name:"tls_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(f,{children:["传输协议",e.jsx($t,{value:d.watch("network_settings"),setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")})]}),e.jsx(v,{children:e.jsxs(B,{onValueChange:m.onChange,value:m.value,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择传输协议"})}),e.jsx(U,{children:e.jsx(us,{children:Xe.vmess.networkOptions.map(w=>e.jsx(z,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"服务器名称指示(SNI)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"当节点地址于证书不一致时用于证书验证",...m,value:m.value||""})})]})}),e.jsx(g,{control:d.control,name:"allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(f,{children:["传输协议",e.jsx($t,{value:d.watch("network_settings")||{},setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")||"tcp"})]}),e.jsx(v,{children:e.jsxs(B,{onValueChange:m.onChange,value:m.value||"tcp",children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择传输协议"})}),e.jsx(U,{children:e.jsx(us,{children:Xe.trojan.networkOptions.map(w=>e.jsx(z,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"version",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"协议版本"}),e.jsx(v,{children:e.jsxs(B,{value:(m.value||2).toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"协议版本"})}),e.jsx(U,{children:e.jsx(us,{children:Xe.hysteria.versions.map(w=>e.jsxs(z,{value:w,className:"cursor-pointer",children:["V",w]},w))})})]})})]})}),d.watch("version")==1&&e.jsx(g,{control:d.control,name:"alpn",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"ALPN"}),e.jsx(v,{children:e.jsxs(B,{value:m.value||"h2",onValueChange:m.onChange,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"ALPN"})}),e.jsx(U,{children:e.jsx(us,{children:Xe.hysteria.alpnOptions.map(w=>e.jsx(z,{value:w,children:w},w))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"obfs.open",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"混淆"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})}),!!d.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[d.watch("version")=="2"&&e.jsx(g,{control:d.control,name:"obfs.type",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"混淆实现"}),e.jsx(v,{children:e.jsxs(B,{value:m.value||"salamander",onValueChange:m.onChange,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择混淆实现"})}),e.jsx(U,{children:e.jsx(us,{children:e.jsx(z,{value:"salamander",children:"Salamander"})})})]})})]})}),e.jsx(g,{control:d.control,name:"obfs.password",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"混淆密码"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入混淆密码",...m,value:m.value||""})})]})})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"服务器名称指示(SNI)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"当节点地址于证书不一致时用于证书验证",...m,value:m.value||""})})]})}),e.jsx(g,{control:d.control,name:"tls.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"bandwidth.up",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"上行宽带"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入上行宽带"+(d.watch("version")==2?",留空则使用BBR":""),className:"rounded-br-none rounded-tr-none",...m,value:m.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:"Mbps"})})]})]})}),e.jsx(g,{control:d.control,name:"bandwidth.down",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"下行宽带"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入下行宽带"+(d.watch("version")==2?",留空则使用BBR":""),className:"rounded-br-none rounded-tr-none",...m,value:m.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:"Mbps"})})]})]})})]}),vless:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"tls",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"安全性"}),e.jsx(v,{children:e.jsxs(B,{value:m.value?.toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择安全性"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"无"}),e.jsx(z,{value:"1",children:"TLS"}),e.jsx(z,{value:"2",children:"Reality"})]})]})})]})}),d.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"服务器名称指示(SNI)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"不使用请留空",...m})})]})}),e.jsx(g,{control:d.control,name:"tls_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),d.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"reality_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"伪装站点(dest)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"例如:example.com",...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.server_port",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"端口(port)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"例如:443",...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(g,{control:d.control,name:"reality_settings.private_key",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"私钥(Private key)"}),e.jsx(v,{children:e.jsx(S,{...m})})]})}),e.jsxs(W,{variant:"outline",className:"",onClick:()=>{try{const m=jx();d.setValue("reality_settings.private_key",m.privateKey),d.setValue("reality_settings.public_key",m.publicKey),L.success("密钥对生成成功")}catch{L.error("生成密钥对失败")}},children:[e.jsx(Ne,{icon:"ion:key-outline",className:"mr-2 h-4 w-4"}),"生成密钥对"]})]}),e.jsx(g,{control:d.control,name:"reality_settings.public_key",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"公钥(Public key)"}),e.jsx(v,{children:e.jsx(S,{...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.short_id",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"Short ID"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{children:e.jsx(S,{...m,placeholder:"可留空,长度为2的倍数,最长16位"})}),e.jsxs(W,{variant:"outline",onClick:()=>{const w=fx();d.setValue("reality_settings.short_id",w),L.success("Short ID 生成成功")},children:[e.jsx(Ne,{icon:"ion:refresh-outline",className:"mr-2 h-4 w-4"}),"生成"]})]}),e.jsx(E,{className:"text-xs text-muted-foreground",children:"客户端可用的 shortId 列表,可用于区分不同的客户端,使用0-f的十六进制字符"})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(f,{children:["传输协议",e.jsx($t,{value:d.watch("network_settings"),setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")})]}),e.jsx(v,{children:e.jsxs(B,{onValueChange:m.onChange,value:m.value,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择传输协议"})}),e.jsx(U,{children:e.jsx(us,{children:Xe.vless.networkOptions.map(w=>e.jsx(z,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})}),e.jsx(g,{control:d.control,name:"flow",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"流控"}),e.jsx(v,{children:e.jsxs(B,{onValueChange:w=>m.onChange(w==="none"?null:w),value:m.value||"none",children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择流控"})}),e.jsx(U,{children:Xe.vless.flowOptions.map(w=>e.jsx(z,{value:w,children:w},w))})]})})]})})]})}[s]?.()},_x=u.object({id:u.number().optional().nullable(),code:u.string().optional(),name:u.string().min(1,"Please enter a valid name."),rate:u.string().min(1,"Please enter a valid rate."),tags:u.array(u.string()).default([]),excludes:u.array(u.string()).default([]),ips:u.array(u.string()).default([]),group_ids:u.array(u.string()).default([]),host:u.string().min(1,"Please enter a valid host."),port:u.string().min(1,"Please enter a valid port."),server_port:u.string().min(1,"Please enter a valid server port."),parent_id:u.string().default("0").nullable(),route_ids:u.array(u.string()).default([]),protocol_settings:u.record(u.any()).default({}).nullable()}),xt={id:null,code:"",name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null};function Cx(){const{isOpen:s,setIsOpen:t,editingServer:a,setEditingServer:n,serverType:l,setServerType:c,refetch:d}=Er(),[x,r]=o.useState([]),[i,h]=o.useState([]),[D,C]=o.useState([]),m=ae({resolver:ie(_x),defaultValues:xt,mode:"onChange"});o.useEffect(()=>{w()},[s]),o.useEffect(()=>{a?.type&&a.type!==l&&c(a.type)},[a,l,c]),o.useEffect(()=>{a?a.type===l&&m.reset({...xt,...a}):m.reset({...xt,protocol_settings:Xe[l].schema.parse({})})},[a,m,l]);const w=async()=>{if(!s)return;const[p,V,A]=await Promise.all([Rt(),dr(),cr()]);r(p.data?.map($=>({label:$.name,value:$.id.toString()}))||[]),h(V.data?.map($=>({label:$.remarks,value:$.id.toString()}))||[]),C(A.data||[])},_=o.useMemo(()=>D?.filter(p=>(p.parent_id===0||p.parent_id===null)&&p.type===l&&p.id!==m.watch("id")),[l,D,m]),y=()=>e.jsxs(vs,{children:[e.jsx(bs,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("div",{children:"添加节点"})]})}),e.jsx(hs,{align:"start",children:e.jsx(tc,{children:ps.map(({type:p,label:V})=>e.jsx(he,{onClick:()=>{c(p),t(!0)},className:"cursor-pointer",children:e.jsx(O,{variant:"outline",className:"text-white",style:{background:ss[p]},children:V})},p))})})]}),N=()=>{t(!1),n(null),m.reset(xt)},P=async()=>{const p=m.getValues();(await Sc({...p,type:l})).data&&(N(),L.success("提交成功"),d())};return e.jsxs(ue,{open:s,onOpenChange:N,children:[y(),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:a?"编辑节点":"新建节点"}),e.jsx(Se,{})]}),e.jsxs(oe,{...m,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:m.control,name:"name",render:({field:p})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"节点名称"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入节点名称",...p})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"rate",render:({field:p})=>e.jsxs(j,{className:"flex-[1]",children:[e.jsx(f,{children:"倍率"}),e.jsx("div",{className:"relative flex",children:e.jsx(v,{children:e.jsx(S,{type:"number",min:"0",step:"0.1",...p})})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:m.control,name:"code",render:({field:p})=>e.jsxs(j,{children:[e.jsxs(f,{children:["自定义节点ID",e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(选填)"})]}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入自定义节点ID",...p,value:p.value||""})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"tags",render:({field:p})=>e.jsxs(j,{children:[e.jsx(f,{children:"节点标签"}),e.jsx(v,{children:e.jsx(oa,{value:p.value,onChange:p.onChange,placeholder:"输入后回车添加标签",className:"w-full"})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"group_ids",render:({field:p})=>e.jsxs(j,{children:[e.jsxs(f,{className:"flex items-center justify-between",children:["权限组",e.jsx(Ft,{dialogTrigger:e.jsx(T,{variant:"link",children:"添加权限组"}),refetch:w})]}),e.jsx(v,{children:e.jsx(at,{options:x,onChange:V=>p.onChange(V.map(A=>A.value)),value:x?.filter(V=>p.value.includes(V.value)),placeholder:"请选择权限组",emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:"no results found."})})}),e.jsx(k,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:m.control,name:"host",render:({field:p})=>e.jsxs(j,{children:[e.jsx(f,{children:"节点地址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入节点域名或者IP",...p})}),e.jsx(k,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(g,{control:m.control,name:"port",render:({field:p})=>e.jsxs(j,{className:"flex-1",children:[e.jsxs(f,{className:"flex items-center gap-1.5",children:["连接端口",e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(Ne,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(ee,{side:"top",className:"max-w-80 p-3",children:e.jsx("p",{children:"用户实际连接使用的端口,这是客户端配置中需要填写的端口号。如果使用了中转或隧道,这个端口可能与服务器实际监听的端口不同。"})})]})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(v,{children:e.jsx(S,{placeholder:"用户连接端口",...p})}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const V=p.value;V&&m.setValue("server_port",V)},children:e.jsx(Ne,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"同步到服务端口"})})]})})]}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"server_port",render:({field:p})=>e.jsxs(j,{className:"flex-1",children:[e.jsxs(f,{className:"flex items-center gap-1.5",children:["服务端口",e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(Ne,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(ee,{side:"top",className:"max-w-80 p-3",children:e.jsx("p",{children:"服务器实际监听的端口,这是在服务器上开放的真实端口。如果使用了中转或隧道,这个端口可能与用户连接端口不同。"})})]})})]}),e.jsx(v,{children:e.jsx(S,{placeholder:"服务端开放端口",...p})}),e.jsx(k,{})]})})]})]}),s&&e.jsx(wx,{serverType:l,value:m.watch("protocol_settings"),onChange:p=>m.setValue("protocol_settings",p,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(g,{control:m.control,name:"parent_id",render:({field:p})=>e.jsxs(j,{children:[e.jsx(f,{children:"父节点"}),e.jsxs(B,{onValueChange:p.onChange,value:p.value?.toString()||"0",children:[e.jsx(v,{children:e.jsx(q,{children:e.jsx(G,{placeholder:"选择父节点"})})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"无"}),_?.map(V=>e.jsx(z,{value:V.id.toString(),className:"cursor-pointer",children:V.name},V.id))]})]}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"route_ids",render:({field:p})=>e.jsxs(j,{children:[e.jsx(f,{children:"路由组"}),e.jsx(v,{children:e.jsx(at,{options:i,onChange:V=>p.onChange(V.map(A=>A.value)),value:i?.filter(V=>p.value.includes(V.value)),placeholder:"选择路由组",emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:"no results found."})})}),e.jsx(k,{})]})})]}),e.jsxs(Ee,{className:"mt-6",children:[e.jsx(T,{type:"button",variant:"outline",onClick:N,children:"取消"}),e.jsx(T,{type:"submit",onClick:P,children:"提交"})]})]})]})]})}function za({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(c=>l.has(c.value)).map(c=>e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(js,{children:[e.jsx(Cs,{placeholder:t}),e.jsxs(gs,{children:[e.jsx(Ss,{children:"No results found."}),e.jsx(Ve,{children:a.map(c=>{const d=l.has(c.value);return e.jsxs(ve,{onSelect:()=>{d?l.delete(c.value):l.add(c.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},className:"cursor-pointer",children:[e.jsx("div",{className:b("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ns,{className:b("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${c.color}`}),e.jsx("span",{children:c.label}),n?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(c.value)})]},c.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ls,{}),e.jsx(Ve,{children:e.jsx(ve,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const Sx=[{value:pe.Shadowsocks,label:ps.find(s=>s.type===pe.Shadowsocks)?.label,color:ss[pe.Shadowsocks]},{value:pe.Vmess,label:ps.find(s=>s.type===pe.Vmess)?.label,color:ss[pe.Vmess]},{value:pe.Trojan,label:ps.find(s=>s.type===pe.Trojan)?.label,color:ss[pe.Trojan]},{value:pe.Hysteria,label:ps.find(s=>s.type===pe.Hysteria)?.label,color:ss[pe.Hysteria]},{value:pe.Vless,label:ps.find(s=>s.type===pe.Vless)?.label,color:ss[pe.Vless]}];function kx({table:s,saveOrder:t,isSortMode:a,groups:n}){const l=s.getState().columnFilters.length>0,c=n.map(d=>({label:d,value:d}));return e.jsxs("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:[!a&&e.jsxs(e.Fragment,{children:[e.jsx(Cx,{}),e.jsx(S,{placeholder:"搜索节点...",value:s.getColumn("name")?.getFilterValue()??"",onChange:d=>s.getColumn("name")?.setFilterValue(d.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex gap-x-2",children:[s.getColumn("type")&&e.jsx(za,{column:s.getColumn("type"),title:"类型",options:Sx}),s.getColumn("groups")&&e.jsx(za,{column:s.getColumn("groups"),title:"权限组",options:c})]}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),a&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽节点进行排序,完成后点击保存"})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:a?"default":"outline",onClick:t,size:"sm",children:a?"保存排序":"编辑排序"})})]})}const nt=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.71 12.71a6 6 0 1 0-7.42 0a10 10 0 0 0-6.22 8.18a1 1 0 0 0 2 .22a8 8 0 0 1 15.9 0a1 1 0 0 0 1 .89h.11a1 1 0 0 0 .88-1.1a10 10 0 0 0-6.25-8.19M12 12a4 4 0 1 1 4-4a4 4 0 0 1-4 4"})}),mt={0:"bg-destructive/80 shadow-sm shadow-destructive/50",1:"bg-yellow-500/80 shadow-sm shadow-yellow-500/50",2:"bg-emerald-500/80 shadow-sm shadow-emerald-500/50"},ht={0:"未运行",1:"无人使用或异常",2:"运行正常"},Tx=s=>[{id:"drag-handle",header:({column:t})=>e.jsx(I,{column:t,title:"排序"}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Dt,{className:"size-4 cursor-move text-muted-foreground transition-colors hover:text-primary","aria-hidden":"true"})}),size:50},{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"节点ID"}),cell:({row:t})=>{const a=t.getValue("id"),n=t.original.code;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(O,{variant:"outline",className:b("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:ss[t.original.type]},children:[e.jsx(zn,{className:"size-3"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"flex items-center gap-0.5",children:n??a}),t.original.parent?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground/30",children:"→"}),e.jsx("span",{children:t.original.parent?.code||t.original.parent?.id})]}):""]})]}),e.jsx(T,{variant:"ghost",size:"icon",className:"size-5 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:text-muted-foreground group-hover/id:opacity-100",onClick:l=>{l.stopPropagation(),Nt(n||a.toString())},children:e.jsx(Ca,{className:"size-3"})})]})}),e.jsxs(ee,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[ps.find(l=>l.type===t.original.type)?.label,t.original.parent_id?" (子节点)":""]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n?"点击括号内容或复制按钮可复制节点代码":"点击复制按钮可复制节点ID"})]})]})})},size:200,enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"显隐"}),cell:({row:t})=>{const[a,n]=o.useState(!!t.getValue("show"));return e.jsx(H,{checked:a,onCheckedChange:async l=>{n(l),Dc({id:t.original.id,type:t.original.type,show:l?1:0}).catch(()=>{n(!l),s()})},style:{backgroundColor:a?ss[t.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(I,{column:t,title:"节点",tooltip:e.jsxs("div",{className:"grid grid-cols-1 gap-3 p-2",children:[e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:b("h-2.5 w-2.5 rounded-full",mt[0])}),e.jsx("span",{className:"text-sm font-medium",children:ht[0]})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:b("h-2.5 w-2.5 rounded-full",mt[1])}),e.jsx("span",{className:"text-sm font-medium",children:ht[1]})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:b("h-2.5 w-2.5 rounded-full",mt[2])}),e.jsx("span",{className:"text-sm font-medium",children:ht[2]})]})]})})}),cell:({row:t})=>e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:b("size-2.5 flex-shrink-0 rounded-full transition-all duration-200",mt[t.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:t.getValue("name")})]})}),e.jsx(ee,{children:e.jsx("p",{className:"font-medium",children:ht[t.original.available_status]})})]})}),enableSorting:!1,size:200},{accessorKey:"host",header:({column:t})=>e.jsx(I,{column:t,title:"地址"}),cell:({row:t})=>{const a=`${t.original.host}:${t.original.port}`,n=t.original.port!==t.original.server_port;return e.jsxs("div",{className:"group relative flex min-w-0 items-start",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-1 gap-y-0.5 pr-7",children:[e.jsx("div",{className:"flex items-center ",children:e.jsxs("span",{className:"font-mono text-sm font-medium text-foreground/90",children:[t.original.host,":",t.original.port]})}),n&&e.jsxs("span",{className:"whitespace-nowrap text-[0.7rem] tracking-tight text-muted-foreground/40",children:["(内部端口 ",t.original.server_port,")"]})]}),e.jsx("div",{className:"absolute right-0 top-0",children:e.jsx(le,{delayDuration:0,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:bg-muted/50 hover:text-muted-foreground group-hover:opacity-100",onClick:l=>{l.stopPropagation(),Nt(a)},children:e.jsx(Ca,{className:"size-3"})})}),e.jsx(ee,{side:"top",sideOffset:10,children:"复制连接地址"})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:t})=>e.jsx(I,{column:t,title:"在线人数",tooltip:"在线人数根据服务端上报频率而定"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(nt,{className:"size-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("online")})]}),size:80,enableSorting:!0,enableHiding:!0},{accessorKey:"rate",header:({column:t})=>e.jsx(I,{column:t,title:"倍率",tooltip:"流量扣费倍率"}),cell:({row:t})=>e.jsxs(O,{variant:"secondary",className:"font-medium",children:[t.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"groups",header:({column:t})=>e.jsx(I,{column:t,title:"权限组",tooltip:"可订阅到该节点的权限组"}),cell:({row:t})=>{const a=t.getValue("groups")||[];return e.jsx("div",{className:"flex min-w-[300px] max-w-[600px] flex-wrap items-center gap-1.5",children:a.length>0?a.map((n,l)=>e.jsx(O,{variant:"secondary",className:b("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"),children:n.name},l)):e.jsx("span",{className:"text-sm text-muted-foreground",children:"--"})})},enableSorting:!1,size:600,filterFn:(t,a,n)=>{const l=t.getValue(a);return l?n.some(c=>l.includes(c)):!1}},{accessorKey:"type",header:({column:t})=>e.jsx(I,{column:t,title:"类型"}),cell:({row:t})=>{const a=t.getValue("type");return e.jsx(O,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:ss[a]},children:a})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{setIsOpen:a,setEditingServer:n,setServerType:l}=Er();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(vs,{modal:!1,children:[e.jsx(bs,{asChild:!0,children:e.jsx(T,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":"打开操作菜单",children:e.jsx(bt,{className:"size-4"})})}),e.jsxs(hs,{align:"end",className:"w-40",children:[e.jsx(he,{className:"cursor-pointer",onClick:()=>{l(t.original.type),n(t.original),a(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(io,{className:"mr-2 size-4"}),"编辑"]})}),e.jsxs(he,{className:"cursor-pointer",onClick:async()=>{Tc({id:t.original.id}).then(({data:c})=>{c&&(L.success("复制成功"),s())})},children:[e.jsx(oo,{className:"mr-2 size-4"}),"复制"]}),e.jsx(Xs,{}),e.jsx(he,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:c=>c.preventDefault(),children:e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该节点,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{kc({id:t.original.id}).then(({data:c})=>{c&&(L.success("删除成功"),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(ns,{className:"mr-2 size-4"}),"删除"]})})})]})]})})},size:50}];function Dx(){const[s,t]=o.useState({}),[a,n]=o.useState({"drag-handle":!1}),[l,c]=o.useState([]),[d,x]=o.useState({pageSize:50,pageIndex:0}),[r,i]=o.useState([]),[h,D]=o.useState(!1),[C,m]=o.useState({}),[w,_]=o.useState([]),{refetch:y}=Q({queryKey:["nodeList"],queryFn:async()=>{const{data:$}=await cr();return _($),$}}),N=o.useMemo(()=>{const $=new Set;return w.forEach(F=>{F.groups&&F.groups.forEach(Y=>$.add(Y.name))}),Array.from($).sort()},[w]);o.useEffect(()=>{n({"drag-handle":h,show:!h,host:!h,online:!h,rate:!h,groups:!h,type:!1,actions:!h}),m({name:h?2e3:200}),x({pageSize:h?99999:50,pageIndex:0})},[h]);const P=($,F)=>{h&&($.dataTransfer.setData("text/plain",F.toString()),$.currentTarget.classList.add("opacity-50"))},p=($,F)=>{if(!h)return;$.preventDefault(),$.currentTarget.classList.remove("bg-muted");const Y=parseInt($.dataTransfer.getData("text/plain"));if(Y===F)return;const Ds=[...w],[$s]=Ds.splice(Y,1);Ds.splice(F,0,$s),_(Ds)},V=async()=>{if(!h){D(!0);return}const $=w?.map((F,Y)=>({id:F.id,order:Y+1}));Pc($).then(()=>{L.success("排序保存成功"),D(!1),y()}).finally(()=>{D(!1)})},A=Le({data:w||[],columns:Tx(y),state:{sorting:r,columnVisibility:a,rowSelection:s,columnFilters:l,columnSizing:C,pagination:d},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:i,onColumnFiltersChange:c,onColumnVisibilityChange:n,onColumnSizingChange:m,onPaginationChange:x,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ux,{refetch:y,children:e.jsx("div",{className:"space-y-4",children:e.jsx(Ge,{table:A,toolbar:$=>e.jsx(kx,{table:$,refetch:y,saveOrder:V,isSortMode:h,groups:N}),draggable:h,onDragStart:P,onDragEnd:$=>$.currentTarget.classList.remove("opacity-50"),onDragOver:$=>{$.preventDefault(),$.currentTarget.classList.add("bg-muted")},onDragLeave:$=>$.currentTarget.classList.remove("bg-muted"),onDrop:p,showPagination:!h})})})}function Px(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"节点管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"管理所有节点,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Dx,{})})]})]})}const Ix=Object.freeze(Object.defineProperty({__proto__:null,default:Px},Symbol.toStringTag,{value:"Module"}));function Vx({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsx("div",{className:"flex items-center justify-between space-x-4",children:e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(Ft,{refetch:t}),e.jsx(S,{placeholder:"搜索权限组...",value:s.getColumn("name")?.getFilterValue()??"",onChange:n=>s.getColumn("name")?.setFilterValue(n.target.value),className:b("h-8 w-[150px] lg:w-[250px]",a&&"border-primary/50 ring-primary/20")}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})})}const Rx=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"组ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(O,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:t})=>e.jsx(I,{column:t,title:"组名称"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium",children:t.getValue("name")})})},{accessorKey:"users_count",header:({column:t})=>e.jsx(I,{column:t,title:"用户数量"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"server_count",header:({column:t})=>e.jsx(I,{column:t,title:"节点数量"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(zn,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("server_count")})]}),enableSorting:!0,size:8e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Ft,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]})}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该权限组,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Vc({id:t.original.id}).then(({data:a})=>{a&&(L.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}];function Ex(){const[s,t]=o.useState({}),[a,n]=o.useState({}),[l,c]=o.useState([]),[d,x]=o.useState([]),{data:r,refetch:i,isLoading:h}=Q({queryKey:["serverGroupList"],queryFn:async()=>{const{data:C}=await Rt();return C}}),D=Le({data:r||[],columns:Rx(i),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:D,toolbar:C=>e.jsx(Vx,{table:C,refetch:i}),isLoading:h})}function Fx(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"权限组管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"管理所有权限组,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Ex,{})})]})]})}const Mx=Object.freeze(Object.defineProperty({__proto__:null,default:Fx},Symbol.toStringTag,{value:"Module"})),zx=u.object({remarks:u.string().min(1,"Please enter a valid remarks."),match:u.array(u.string()),action:u.enum(["block","dns"]),action_value:u.string().optional()});function Fr({refetch:s,dialogTrigger:t,defaultValues:a={remarks:"",match:[],action:"block",action_value:""},type:n="add"}){const l=ae({resolver:ie(zx),defaultValues:a,mode:"onChange"}),[c,d]=o.useState(!1);return e.jsxs(ue,{open:c,onOpenChange:d,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"})," ",e.jsx("div",{children:"添加路由"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:n==="edit"?"编辑路由":"创建路由"}),e.jsx(Se,{})]}),e.jsxs(oe,{...l,children:[e.jsx(g,{control:l.control,name:"remarks",render:({field:x})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"备注"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsx(S,{type:"text",placeholder:"请输入备注",...x})})}),e.jsx(k,{})]})}),e.jsx(g,{control:l.control,name:"match",render:({field:x})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"备注"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsx(cs,{className:"min-h-[120px]",placeholder:`example.com +import{r as o,j as e,t as dl,c as ul,I as va,a as ys,S as Wt,u as as,b as _t,d as xl,O as Jt,e as ml,f as L,g as hl,h as jl,i as gl,Q as fl,k as pl,R as vl,l as bl,P as yl,m as Nl,B as wl,n as Ha,F as _l,C as Cl,o as Sl,p as kl,q as Tl,s as Dl,v as Pl,z as u,w as Ka,x as ae,y as ie,A as qa,D as Ct,E as St,G as Qt,H as Me,T as kt,J as Tt,K as Ua,L as Ba,M as Il,N as Vl,U as Rl,V as El,W as Ga,X as Zt,Y as Ya,Z as Fl,_ as Wa,$ as Ja,a0 as Qa,a1 as Za,a2 as Ns,a3 as Xa,a4 as Ml,a5 as en,a6 as sn,a7 as zl,a8 as Ol,a9 as Ll,aa as $l,ab as tn,ac as Al,ad as Hl,ae as ws,af as an,ag as Kl,ah as ql,ai as nn,aj as Ul,ak as Bl,al as ba,am as Gl,an as rn,ao as Yl,ap as ln,aq as Wl,ar as Jl,as as Ql,at as Zl,au as Xl,av as ei,aw as on,ax as si,ay as ti,az as ai,aA as we,aB as ni,aC as ri,aD as li,aE as ii,aF as cn,aG as dn,aH as un,aI as oi,aJ as xn,aK as mn,aL as hn,aM as ci,aN as di,aO as ui,aP as jn,aQ as xi,aR as Xt,aS as gn,aT as mi,aU as fn,aV as hi,aW as pn,aX as ji,aY as vn,aZ as bn,a_ as gi,a$ as fi,b0 as yn,b1 as pi,b2 as vi,b3 as Nn,b4 as bi,b5 as wn,b6 as yi,b7 as Ni,b8 as He,b9 as Q,ba as Pe,bb as rt,bc as wi,bd as _i,be as Ci,bf as Si,bg as ki,bh as Ti,bi as ya,bj as Na,bk as Di,bl as Pi,bm as Ii,bn as Vi,bo as Ri,bp as Ei,bq as _n,br as Fi,bs as Cn,bt as Mi,bu as zi,bv as Sn,bw as Oi,bx as de,by as Li,bz as wa,bA as Ht,bB as Kt,bC as $i,bD as Ai,bE as kn,bF as Hi,bG as ea,bH as Ki,bI as qi,bJ as Ui,bK as Tn,bL as Dn,bM as Pn,bN as Bi,bO as Gi,bP as Yi,bQ as Wi,bR as In,bS as Ji,bT as We,bU as Qi,bV as Zi,bW as vt,bX as Ne,bY as _a,bZ as Xi,b_ as Vn,b$ as Rn,c0 as En,c1 as Fn,c2 as Mn,c3 as zn,c4 as eo,c5 as so,c6 as to,c7 as Dt,c8 as _s,c9 as ns,ca as Le,cb as $e,cc as Ke,cd as qe,ce as Ue,cf as Ca,cg as ao,ch as no,ci as ro,cj as qt,ck as sa,cl as ta,cm as rs,cn as ls,co as lt,cp as lo,cq as io,cr as Sa,cs as On,ct as ka,cu as bt,cv as oo,cw as co,cx as Ln,cy as uo,cz as xo,cA as $n,cB as Ut,cC as An,cD as mo,cE as Hn,cF as ho,cG as jo,cH as go,cI as fo,cJ as po,cK as vo}from"./vendor.js";import"./index.js";var ch=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dh(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function bo(s){if(s.__esModule)return s;var t=s.default;if(typeof t=="function"){var a=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};a.prototype=t.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(s).forEach(function(n){var l=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(a,n,l.get?l:{enumerable:!0,get:function(){return s[n]}})}),a}const yo={theme:"system",setTheme:()=>null},Kn=o.createContext(yo);function No({children:s,defaultTheme:t="system",storageKey:a="vite-ui-theme",...n}){const[l,c]=o.useState(()=>localStorage.getItem(a)||t);o.useEffect(()=>{const x=window.document.documentElement;if(x.classList.remove("light","dark"),l==="system"){const r=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";x.classList.add(r);return}x.classList.add(l)},[l]);const d={theme:l,setTheme:x=>{localStorage.setItem(a,x),c(x)}};return e.jsx(Kn.Provider,{...n,value:d,children:s})}const wo=()=>{const s=o.useContext(Kn);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},_o=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),Co=function(s,t){return new URL(s,t).href},Ta={},X=function(t,a,n){let l=Promise.resolve();if(a&&a.length>0){const d=document.getElementsByTagName("link"),x=document.querySelector("meta[property=csp-nonce]"),r=x?.nonce||x?.getAttribute("nonce");l=Promise.allSettled(a.map(i=>{if(i=Co(i,n),i in Ta)return;Ta[i]=!0;const h=i.endsWith(".css"),D=h?'[rel="stylesheet"]':"";if(!!n)for(let w=d.length-1;w>=0;w--){const _=d[w];if(_.href===i&&(!h||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${D}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":_o,h||(m.as="script"),m.crossOrigin="",m.href=i,r&&m.setAttribute("nonce",r),document.head.appendChild(m),h)return new Promise((w,_)=>{m.addEventListener("load",w),m.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${i}`)))})}))}function c(d){const x=new Event("vite:preloadError",{cancelable:!0});if(x.payload=d,window.dispatchEvent(x),!x.defaultPrevented)throw d}return l.then(d=>{for(const x of d||[])x.status==="rejected"&&c(x.reason);return t().catch(c)})};function b(...s){return dl(ul(s))}const Os=ys("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),T=o.forwardRef(({className:s,variant:t,size:a,asChild:n=!1,children:l,disabled:c,loading:d=!1,leftSection:x,rightSection:r,...i},h)=>{const D=n?Wt:"button";return e.jsxs(D,{className:b(Os({variant:t,size:a,className:s})),disabled:d||c,ref:h,...i,children:[(x&&d||!x&&!r&&d)&&e.jsx(va,{className:"mr-2 h-4 w-4 animate-spin"}),!d&&x&&e.jsx("div",{className:"mr-2",children:x}),l,!d&&r&&e.jsx("div",{className:"ml-2",children:r}),r&&d&&e.jsx(va,{className:"ml-2 h-4 w-4 animate-spin"})]})});T.displayName="Button";function Ps({className:s,minimal:t=!1}){const a=as();return e.jsx("div",{className:b("h-svh w-full",s),children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[!t&&e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"500"}),e.jsxs("span",{className:"font-medium",children:["Oops! Something went wrong ",":')"]}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["We apologize for the inconvenience. ",e.jsx("br",{})," Please try again later."]}),!t&&e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(T,{variant:"outline",onClick:()=>a(-1),children:"Go Back"}),e.jsx(T,{onClick:()=>a("/"),children:"Back to Home"})]})]})})}function Da(){const s=as();return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"404"}),e.jsx("span",{className:"font-medium",children:"Oops! Page Not Found!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["It seems like the page you're looking for ",e.jsx("br",{}),"does not exist or might have been removed."]}),e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(T,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(T,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function So(){return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"503"}),e.jsx("span",{className:"font-medium",children:"Website is under maintenance!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["The site is not available at the moment. ",e.jsx("br",{}),"We'll be back online shortly."]}),e.jsx("div",{className:"mt-6 flex gap-4",children:e.jsx(T,{variant:"outline",children:"Learn more"})})]})})}function ko(s){return typeof s>"u"}function To(s){return s===null}function Do(s){return To(s)||ko(s)}class Po{storage;prefixKey;constructor(t){this.storage=t.storage,this.prefixKey=t.prefixKey}getKey(t){return`${this.prefixKey}${t}`.toUpperCase()}set(t,a,n=null){const l=JSON.stringify({value:a,time:Date.now(),expire:n!==null?new Date().getTime()+n*1e3:null});this.storage.setItem(this.getKey(t),l)}get(t,a=null){const n=this.storage.getItem(this.getKey(t));if(!n)return{value:a,time:0};try{const l=JSON.parse(n),{value:c,time:d,expire:x}=l;return Do(x)||x>new Date().getTime()?{value:c,time:d}:(this.remove(t),{value:a,time:0})}catch{return this.remove(t),{value:a,time:0}}}remove(t){this.storage.removeItem(this.getKey(t))}clear(){this.storage.clear()}}function qn({prefixKey:s="",storage:t=sessionStorage}){return new Po({prefixKey:s,storage:t})}const Un="Xboard_",Io=function(s={}){return qn({prefixKey:s.prefixKey||"",storage:localStorage})},Vo=function(s={}){return qn({prefixKey:s.prefixKey||"",storage:sessionStorage})},Pt=Io({prefixKey:Un});Vo({prefixKey:Un});const Bn="access_token";function Qs(){return Pt.get(Bn)}function Gn(){Pt.remove(Bn)}const Pa=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function Ro({children:s}){const t=as(),a=_t(),n=Qs();return o.useEffect(()=>{if(!n.value&&!Pa.includes(a.pathname)){const l=encodeURIComponent(a.pathname+a.search);t(`/sign-in?redirect=${l}`)}},[n.value,a.pathname,a.search,t]),Pa.includes(a.pathname)||n.value?e.jsx(e.Fragment,{children:s}):null}const Eo=()=>e.jsx(Ro,{children:e.jsx(Jt,{})}),Fo=xl([{path:"/sign-in",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>tc);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(Eo,{}),children:[{path:"/",lazy:async()=>({Component:(await X(()=>Promise.resolve().then(()=>gc),void 0,import.meta.url)).default}),errorElement:e.jsx(Ps,{}),children:[{index:!0,lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>zd);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(Ps,{}),children:[{path:"system",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>$d);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Ud);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Jd);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>su);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>lu);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>uu);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>gu);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>yu);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Su);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Iu);return{default:s}},void 0,import.meta.url)).default})}]},{path:"payment",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Ku);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Bu);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Xu);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>ix);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(Ps,{}),children:[{path:"manage",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Vx);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>zx);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Kx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(Ps,{}),children:[{path:"plan",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Zx);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>um);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>bm);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(Ps,{}),children:[{path:"manage",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>Km);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await X(async()=>{const{default:s}=await Promise.resolve().then(()=>lh);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:Ps},{path:"/404",Component:Da},{path:"/503",Component:So},{path:"*",Component:Da}]),Mo="locale";function zo(){return Pt.get(Mo)}function Yn(){Gn();const s=window.location.pathname,t=s&&!["/404","/sign-in"].includes(s),a=window.location.pathname.split("/"),n=a[1]?`/${a[1]}`:"",l=window.location.hash.split("/")[0]||"",c=`${n}${l}#/sign-in`;window.location.href=c+(t?`?redirect=${s}`:"")}const Oo=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function Lo(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const R=ml.create({baseURL:Lo(),timeout:12e3,headers:{"Content-Type":"application/json"}});R.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const t=Qs();if(!Oo.includes(s.url?.split("?")[0]||"")){if(!t.value)return Yn(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=t.value}return s.headers["Content-Language"]=zo().value||"zh-CN",s},s=>Promise.reject(s));R.interceptors.response.use(s=>s?.data||{code:-1,message:"未知错误"},s=>{const t=s.response?.status,a=s.response?.data?.message;return(t===401||t===403)&&Yn(),L.error(a||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[t]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});function $o(){return R.get("/user/info")}const zt={token:Qs()?.value||"",userInfo:null,isLoggedIn:!!Qs()?.value,loading:!1,error:null},Ws=hl("user/fetchUserInfo",async()=>(await $o()).data,{condition:(s,{getState:t})=>{const{user:a}=t();return!!a.token&&!a.loading}}),Wn=jl({name:"user",initialState:zt,reducers:{setToken(s,t){s.token=t.payload,s.isLoggedIn=!!t.payload},resetUserState:()=>zt},extraReducers:s=>{s.addCase(Ws.pending,t=>{t.loading=!0,t.error=null}).addCase(Ws.fulfilled,(t,a)=>{t.loading=!1,t.userInfo=a.payload,t.error=null}).addCase(Ws.rejected,(t,a)=>{if(t.loading=!1,t.error=a.error.message||"Failed to fetch user info",!t.token)return zt})}}),{setToken:Ao,resetUserState:Ho}=Wn.actions,Ko=s=>s.user.userInfo,qo=Wn.reducer,Jn=gl({reducer:{user:qo}});Qs()?.value&&Jn.dispatch(Ws());const Uo=new fl;pl.createRoot(document.getElementById("root")).render(e.jsx(vl.StrictMode,{children:e.jsx(bl,{client:Uo,children:e.jsx(yl,{store:Jn,children:e.jsxs(No,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(Nl,{router:Fo}),e.jsx(wl,{richColors:!0,position:"top-right"})]})})})}));const Ie=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:b("rounded-xl border bg-card text-card-foreground shadow",s),...t}));Ie.displayName="Card";const ze=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:b("flex flex-col space-y-1.5 p-6",s),...t}));ze.displayName="CardHeader";const Je=o.forwardRef(({className:s,...t},a)=>e.jsx("h3",{ref:a,className:b("font-semibold leading-none tracking-tight",s),...t}));Je.displayName="CardTitle";const Zs=o.forwardRef(({className:s,...t},a)=>e.jsx("p",{ref:a,className:b("text-sm text-muted-foreground",s),...t}));Zs.displayName="CardDescription";const Oe=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:b("p-6 pt-0",s),...t}));Oe.displayName="CardContent";const Bo=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:b("flex items-center p-6 pt-0",s),...t}));Bo.displayName="CardFooter";const Go=ys("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),yt=o.forwardRef(({className:s,...t},a)=>e.jsx(Ha,{ref:a,className:b(Go(),s),...t}));yt.displayName=Ha.displayName;const oe=_l,Qn=o.createContext({}),g=({...s})=>e.jsx(Qn.Provider,{value:{name:s.name},children:e.jsx(Cl,{...s})}),It=()=>{const s=o.useContext(Qn),t=o.useContext(Zn),{getFieldState:a,formState:n}=Sl(),l=a(s.name,n);if(!s)throw new Error("useFormField should be used within ");const{id:c}=t;return{id:c,name:s.name,formItemId:`${c}-form-item`,formDescriptionId:`${c}-form-item-description`,formMessageId:`${c}-form-item-message`,...l}},Zn=o.createContext({}),j=o.forwardRef(({className:s,...t},a)=>{const n=o.useId();return e.jsx(Zn.Provider,{value:{id:n},children:e.jsx("div",{ref:a,className:b("space-y-2",s),...t})})});j.displayName="FormItem";const f=o.forwardRef(({className:s,...t},a)=>{const{error:n,formItemId:l}=It();return e.jsx(yt,{ref:a,className:b(n&&"text-destructive",s),htmlFor:l,...t})});f.displayName="FormLabel";const v=o.forwardRef(({...s},t)=>{const{error:a,formItemId:n,formDescriptionId:l,formMessageId:c}=It();return e.jsx(Wt,{ref:t,id:n,"aria-describedby":a?`${l} ${c}`:`${l}`,"aria-invalid":!!a,...s})});v.displayName="FormControl";const E=o.forwardRef(({className:s,...t},a)=>{const{formDescriptionId:n}=It();return e.jsx("p",{ref:a,id:n,className:b("text-[0.8rem] text-muted-foreground",s),...t})});E.displayName="FormDescription";const k=o.forwardRef(({className:s,children:t,...a},n)=>{const{error:l,formMessageId:c}=It(),d=l?String(l?.message):t;return d?e.jsx("p",{ref:n,id:c,className:b("text-[0.8rem] font-medium text-destructive",s),...a,children:d}):null});k.displayName="FormMessage";const S=o.forwardRef(({className:s,type:t,...a},n)=>e.jsx("input",{type:t,className:b("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:n,...a}));S.displayName="Input";const Xn=o.forwardRef(({className:s,...t},a)=>{const[n,l]=o.useState(!1);return e.jsxs("div",{className:"relative rounded-md",children:[e.jsx("input",{type:n?"text":"password",className:b("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...t}),e.jsx(T,{type:"button",size:"icon",variant:"ghost",className:"absolute right-1 top-1/2 h-6 w-6 -translate-y-1/2 rounded-md text-muted-foreground",onClick:()=>l(c=>!c),children:n?e.jsx(kl,{size:18}):e.jsx(Tl,{size:18})})]})});Xn.displayName="PasswordInput";const Yo=s=>R({url:"/passport/auth/login",method:"post",data:s}),Bt=s=>s;function re(s=void 0,t="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),Pl(s).format(t))}function Wo(s=void 0,t="YYYY-MM-DD"){return re(s,t)}function Rs(s){const t=typeof s=="string"?parseFloat(s):s;return isNaN(t)?"0.00":t.toFixed(2)}function qs(s){const t=typeof s=="string"?parseFloat(s):s;return isNaN(t)?"0.00":(t/100).toFixed(2)}function Nt(s){navigator.clipboard?navigator.clipboard.writeText(s).then(()=>{L.success(Bt("复制成功"))}).catch(t=>{console.error("复制到剪贴板时出错:",t),Ia(s)}):Ia(s)}function Ia(s){const t=document.createElement("button"),a=new Dl(t,{text:()=>s});a.on("success",()=>{L.success(Bt("复制成功")),a.destroy()}),a.on("error",()=>{L.error(Bt("复制失败")),a.destroy()}),t.click()}function Fs(s){const t=s/1024,a=t/1024,n=a/1024,l=n/1024;return l>=1?Rs(l)+" TB":n>=1?Rs(n)+" GB":a>=1?Rs(a)+" MB":Rs(t)+" KB"}const Jo="access_token";function Qo(s){Pt.set(Jo,s)}const Zo=u.object({email:u.string().min(1,{message:"请输入邮箱地址"}).email({message:"邮箱地址格式不正确"}),password:u.string().min(1,{message:"请输入密码"}).min(7,{message:"密码长度至少为7个字符"})});function Xo({className:s,onForgotPassword:t,...a}){const n=as(),l=Ka(),c=ae({resolver:ie(Zo),defaultValues:{email:"",password:""}});async function d(x){Yo(x).then(({data:r})=>{Qo(r.auth_data),l(Ao(r.auth_data)),l(Ws()).unwrap(),n("/")})}return e.jsx("div",{className:b("grid gap-6",s),...a,children:e.jsx(oe,{...c,children:e.jsx("form",{onSubmit:c.handleSubmit(d),children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(g,{control:c.control,name:"email",render:({field:x})=>e.jsxs(j,{className:"space-y-1",children:[e.jsx(f,{children:"邮箱地址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"name@example.com",...x})}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"password",render:({field:x})=>e.jsxs(j,{className:"space-y-1",children:[e.jsx(f,{children:"密码"}),e.jsx(v,{children:e.jsx(Xn,{placeholder:"请输入密码",...x})}),e.jsx(k,{})]})}),e.jsx(T,{className:"mt-2",loading:c.formState.isSubmitting,children:"登录"}),e.jsx(T,{variant:"link",type:"button",className:"mt-1 text-sm text-muted-foreground hover:text-primary",onClick:t,children:"忘记密码?"})]})})})})}const ue=qa,Re=Ua,ec=Ba,it=Qt,er=o.forwardRef(({className:s,...t},a)=>e.jsx(Ct,{ref:a,className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t}));er.displayName=Ct.displayName;const ce=o.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(ec,{children:[e.jsx(er,{}),e.jsxs(St,{ref:n,className:b("max-h-[95%] overflow-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...a,children:[t,e.jsxs(Qt,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Me,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ce.displayName=St.displayName;const je=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col space-y-1.5 text-center sm:text-left",s),...t});je.displayName="DialogHeader";const Ee=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});Ee.displayName="DialogFooter";const xe=o.forwardRef(({className:s,...t},a)=>e.jsx(kt,{ref:a,className:b("text-lg font-semibold leading-none tracking-tight",s),...t}));xe.displayName=kt.displayName;const Se=o.forwardRef(({className:s,...t},a)=>e.jsx(Tt,{ref:a,className:b("text-sm text-muted-foreground",s),...t}));Se.displayName=Tt.displayName;const zs=ys("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),W=o.forwardRef(({className:s,variant:t,size:a,asChild:n=!1,...l},c)=>{const d=n?Wt:"button";return e.jsx(d,{className:b(zs({variant:t,size:a,className:s})),ref:c,...l})});W.displayName="Button";function sc(){const[s,t]=o.useState(!1),a="php artisan reset:password 管理员邮箱";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"container grid h-svh flex-col items-center justify-center bg-primary-foreground lg:max-w-none lg:px-0",children:e.jsxs("div",{className:"mx-auto flex w-full flex-col justify-center space-y-2 sm:w-[480px] lg:p-8",children:[e.jsx("div",{className:"mb-4 flex items-center justify-center",children:e.jsx("h1",{className:"text-3xl font-medium",children:window?.settings?.title})}),e.jsxs(Ie,{className:"p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-left",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"登录"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"请输入您的邮箱和密码登录系统"})]}),e.jsx(Xo,{onForgotPassword:()=>t(!0)})]})]})}),e.jsx(ue,{open:s,onOpenChange:t,children:e.jsx(ce,{children:e.jsxs(je,{children:[e.jsx(xe,{children:"忘记密码"}),e.jsx(Se,{children:"在站点目录下执行以下命令找回密码"}),e.jsx("div",{className:"mt-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"rounded-md bg-secondary p-4 pr-12",children:a}),e.jsx(W,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>Nt(a),children:e.jsx(Il,{className:"h-4 w-4"})})]})})]})})})]})}const tc=Object.freeze(Object.defineProperty({__proto__:null,default:sc},Symbol.toStringTag,{value:"Module"})),be=o.forwardRef(({className:s,fadedBelow:t=!1,fixedHeight:a=!1,...n},l)=>e.jsx("div",{ref:l,className:b("relative flex h-full w-full flex-col",t&&"after:pointer-events-none after:absolute after:bottom-0 after:left-0 after:hidden after:h-32 after:w-full after:bg-[linear-gradient(180deg,_transparent_10%,_hsl(var(--background))_70%)] after:md:block",a&&"md:h-svh",s),...n}));be.displayName="Layout";const ye=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{ref:a,className:b("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...t}));ye.displayName="LayoutHeader";const _e=o.forwardRef(({className:s,fixedHeight:t,...a},n)=>e.jsx("div",{ref:n,className:b("flex-1 overflow-hidden px-4 py-6 md:px-8",t&&"h-[calc(100%-var(--header-height))]",s),...a}));_e.displayName="LayoutBody";const sr=Vl,tr=Rl,ar=El,vs=zl,bs=Ol,ac=Ll,nc=o.forwardRef(({className:s,inset:t,children:a,...n},l)=>e.jsxs(Ga,{ref:l,className:b("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",s),...n,children:[a,e.jsx(Zt,{className:"ml-auto h-4 w-4"})]}));nc.displayName=Ga.displayName;const rc=o.forwardRef(({className:s,...t},a)=>e.jsx(Ya,{ref:a,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...t}));rc.displayName=Ya.displayName;const ms=o.forwardRef(({className:s,sideOffset:t=4,...a},n)=>e.jsx(Fl,{children:e.jsx(Wa,{ref:n,sideOffset:t,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a})}));ms.displayName=Wa.displayName;const he=o.forwardRef(({className:s,inset:t,...a},n)=>e.jsx(Ja,{ref:n,className:b("relative flex cursor-default cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",s),...a}));he.displayName=Ja.displayName;const lc=o.forwardRef(({className:s,children:t,checked:a,...n},l)=>e.jsxs(Qa,{ref:l,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:a,...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Za,{children:e.jsx(Ns,{className:"h-4 w-4"})})}),t]}));lc.displayName=Qa.displayName;const ic=o.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(Xa,{ref:n,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Za,{children:e.jsx(Ml,{className:"h-4 w-4 fill-current"})})}),t]}));ic.displayName=Xa.displayName;const aa=o.forwardRef(({className:s,inset:t,...a},n)=>e.jsx(en,{ref:n,className:b("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",s),...a}));aa.displayName=en.displayName;const Xs=o.forwardRef(({className:s,...t},a)=>e.jsx(sn,{ref:a,className:b("-mx-1 my-1 h-px bg-muted",s),...t}));Xs.displayName=sn.displayName;const Gt=({className:s,...t})=>e.jsx("span",{className:b("ml-auto text-xs tracking-widest opacity-60",s),...t});Gt.displayName="DropdownMenuShortcut";const le=$l,se=Al,te=Hl,ee=o.forwardRef(({className:s,sideOffset:t=4,...a},n)=>e.jsx(tn,{ref:n,sideOffset:t,className:b("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a}));ee.displayName=tn.displayName;function Vt(){const{pathname:s}=_t();return{checkActiveNav:a=>{if(a==="/"&&s==="/")return!0;const n=a.replace(/^\//,""),l=s.replace(/^\//,"");return n?l.startsWith(n):!1}}}function nr({key:s,defaultValue:t}){const[a,n]=o.useState(()=>{const l=localStorage.getItem(s);return l!==null?JSON.parse(l):t});return o.useEffect(()=>{localStorage.setItem(s,JSON.stringify(a))},[a,s]),[a,n]}function oc(){const[s,t]=nr({key:"expanded-sidebar-items",defaultValue:["仪表盘","系统管理","节点管理","订阅管理","用户管理"]});return{expandedItems:s,toggleItem:n=>{t(l=>l.includes(n)?l.filter(c=>c!==n):[...l,n])},isExpanded:n=>s.includes(n)}}function cc({links:s,isCollapsed:t,className:a,closeNav:n}){const l=({sub:c,...d})=>{const x=`${d.title}-${d.href}`;return t&&c?o.createElement(xc,{...d,sub:c,key:x,closeNav:n}):t?o.createElement(uc,{...d,key:x,closeNav:n}):c?o.createElement(dc,{...d,sub:c,key:x,closeNav:n}):o.createElement(rr,{...d,key:x,closeNav:n})};return e.jsx("div",{"data-collapsed":t,className:b("group border-b bg-background py-2 transition-[max-height,padding] duration-500 data-[collapsed=true]:py-2 md:border-none",a),children:e.jsx(le,{delayDuration:0,children:e.jsx("nav",{className:"grid gap-1 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2",children:s.map(l)})})})}function rr({title:s,icon:t,label:a,href:n,closeNav:l,subLink:c=!1}){const{checkActiveNav:d}=Vt();return e.jsxs(ws,{to:n,onClick:l,className:b(Os({variant:d(n)?"secondary":"ghost",size:"sm"}),"h-12 justify-start text-wrap rounded-none px-6",c&&"h-10 w-full border-l border-l-slate-500 px-2"),"aria-current":d(n)?"page":void 0,children:[e.jsx("div",{className:"mr-2",children:t}),s,a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:a})]})}function dc({title:s,icon:t,label:a,sub:n,closeNav:l}){const{checkActiveNav:c}=Vt(),{isExpanded:d,toggleItem:x}=oc(),r=!!n?.find(h=>c(h.href)),i=d(s)||r;return e.jsxs(sr,{open:i,onOpenChange:()=>x(s),children:[e.jsxs(tr,{className:b(Os({variant:"ghost",size:"sm"}),"group h-12 w-full justify-start rounded-none px-6"),children:[e.jsx("div",{className:"mr-2",children:t}),s,a&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:a}),e.jsx("span",{className:b('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(an,{stroke:1})})]}),e.jsx(ar,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:n.map(h=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(rr,{...h,subLink:!0,closeNav:l})},h.title))})})]})}function uc({title:s,icon:t,label:a,href:n}){const{checkActiveNav:l}=Vt();return e.jsxs(se,{delayDuration:0,children:[e.jsx(te,{asChild:!0,children:e.jsxs(ws,{to:n,className:b(Os({variant:l(n)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[t,e.jsx("span",{className:"sr-only",children:s})]})}),e.jsxs(ee,{side:"right",className:"flex items-center gap-4",children:[s,a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:a})]})]})}function xc({title:s,icon:t,label:a,sub:n}){const{checkActiveNav:l}=Vt(),c=!!n?.find(d=>l(d.href));return e.jsxs(vs,{children:[e.jsxs(se,{delayDuration:0,children:[e.jsx(te,{asChild:!0,children:e.jsx(bs,{asChild:!0,children:e.jsx(T,{variant:c?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:t})})}),e.jsxs(ee,{side:"right",className:"flex items-center gap-4",children:[s," ",a&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:a}),e.jsx(an,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(ms,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(aa,{children:[s," ",a?`(${a})`:""]}),e.jsx(Xs,{}),n.map(({title:d,icon:x,label:r,href:i})=>e.jsx(he,{asChild:!0,children:e.jsxs(ws,{to:i,className:`${l(i)?"bg-secondary":""}`,children:[x," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:d}),r&&e.jsx("span",{className:"ml-auto text-xs",children:r})]})},`${d}-${i}`))]})]})}const lr=[{title:"仪表盘",label:"",href:"/",icon:e.jsx(Kl,{size:18})},{title:"系统管理",label:"",href:"",icon:e.jsx(ql,{size:18}),sub:[{title:"系统配置",label:"",href:"/config/system",icon:e.jsx(nn,{size:18})},{title:"主题配置",label:"",href:"/config/theme",icon:e.jsx(Ul,{size:18})},{title:"公告管理",label:"",href:"/config/notice",icon:e.jsx(Bl,{size:18})},{title:"支付配置",label:"",href:"/config/payment",icon:e.jsx(ba,{size:18})},{title:"知识库管理",label:"",href:"/config/knowledge",icon:e.jsx(Gl,{size:18})}]},{title:"节点管理",label:"",href:"",icon:e.jsx(rn,{size:18}),sub:[{title:"节点管理",label:"",href:"/server/manage",icon:e.jsx(Yl,{size:18})},{title:"权限组管理",label:"",href:"/server/group",icon:e.jsx(ln,{size:18})},{title:"路由管理",label:"",href:"/server/route",icon:e.jsx(Wl,{size:18})}]},{title:"订阅管理",label:"",href:"",icon:e.jsx(Jl,{size:18}),sub:[{title:"套餐管理",label:"",href:"/finance/plan",icon:e.jsx(Ql,{size:18})},{title:"订单管理",label:"",href:"/finance/order",icon:e.jsx(ba,{size:18})},{title:"优惠券管理",label:"",href:"/finance/coupon",icon:e.jsx(Zl,{size:18})}]},{title:"用户管理",label:"",href:"",icon:e.jsx(Xl,{size:18}),sub:[{title:"用户管理",label:"",href:"/user/manage",icon:e.jsx(ei,{size:18})},{title:"工单管理",label:"",href:"/user/ticket",icon:e.jsx(on,{size:18})}]}];function mc({className:s,isCollapsed:t,setIsCollapsed:a}){const[n,l]=o.useState(!1);return o.useEffect(()=>{n?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[n]),e.jsxs("aside",{className:b(`fixed left-0 right-0 top-0 z-50 w-full border-r-2 border-r-muted transition-[width] md:bottom-0 md:right-auto md:h-svh ${t?"md:w-14":"md:w-64"}`,s),children:[e.jsx("div",{onClick:()=>l(!1),className:`absolute inset-0 transition-[opacity] delay-100 duration-700 ${n?"h-svh opacity-50":"h-0 opacity-0"} w-full bg-black md:hidden`}),e.jsxs(be,{children:[e.jsxs(ye,{className:"sticky top-0 justify-between px-4 py-3 shadow md:px-4",children:[e.jsxs("div",{className:`flex items-center ${t?"":"gap-2"}`,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:`transition-all ${t?"h-6 w-6":"h-8 w-8"}`,children:[e.jsx("rect",{width:"256",height:"256",fill:"none"}),e.jsx("line",{x1:"208",y1:"128",x2:"128",y2:"208",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("line",{x1:"192",y1:"40",x2:"40",y2:"192",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("span",{className:"sr-only",children:"Website Name"})]}),e.jsx("div",{className:`flex flex-col justify-end truncate ${t?"invisible w-0":"visible w-auto"}`,children:e.jsx("span",{className:"font-medium",children:window?.settings?.title})})]}),e.jsx(T,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Toggle Navigation","aria-controls":"sidebar-menu","aria-expanded":n,onClick:()=>l(c=>!c),children:n?e.jsx(si,{}):e.jsx(ti,{})})]}),e.jsx(cc,{id:"sidebar-menu",className:`h-full flex-1 overflow-auto ${n?"max-h-screen":"max-h-0 py-0 md:max-h-screen md:py-2"}`,closeNav:()=>l(!1),isCollapsed:t,links:lr}),e.jsx(T,{onClick:()=>a(c=>!c),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex",children:e.jsx(ai,{stroke:1.5,className:`h-5 w-5 ${t?"rotate-180":""}`})})]})]})}function hc(){const[s,t]=nr({key:"collapsed-sidebar",defaultValue:!1});return o.useEffect(()=>{const a=()=>{t(window.innerWidth<768?!1:s)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[s,t]),[s,t]}function jc(){const[s,t]=hc();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(mc,{isCollapsed:s,setIsCollapsed:t}),e.jsx("main",{id:"content",className:`overflow-x-hidden pt-16 transition-[margin] md:overflow-y-hidden md:pt-0 ${s?"md:ml-14":"md:ml-64"} h-full`,children:e.jsx(Jt,{})})]})}const gc=Object.freeze(Object.defineProperty({__proto__:null,default:jc},Symbol.toStringTag,{value:"Module"})),hs=o.forwardRef(({className:s,...t},a)=>e.jsx(we,{ref:a,className:b("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...t}));hs.displayName=we.displayName;const fc=({children:s,...t})=>e.jsx(ue,{...t,children:e.jsx(ce,{className:"overflow-hidden p-0",children:e.jsx(hs,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:s})})}),Cs=o.forwardRef(({className:s,...t},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(ni,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(we.Input,{ref:a,className:b("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",s),...t})]}));Cs.displayName=we.Input.displayName;const js=o.forwardRef(({className:s,...t},a)=>e.jsx(we.List,{ref:a,className:b("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...t}));js.displayName=we.List.displayName;const Ss=o.forwardRef((s,t)=>e.jsx(we.Empty,{ref:t,className:"py-6 text-center text-sm",...s}));Ss.displayName=we.Empty.displayName;const Ve=o.forwardRef(({className:s,...t},a)=>e.jsx(we.Group,{ref:a,className:b("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",s),...t}));Ve.displayName=we.Group.displayName;const Ls=o.forwardRef(({className:s,...t},a)=>e.jsx(we.Separator,{ref:a,className:b("-mx-1 h-px bg-border",s),...t}));Ls.displayName=we.Separator.displayName;const ve=o.forwardRef(({className:s,...t},a)=>e.jsx(we.Item,{ref:a,className:b("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...t}));ve.displayName=we.Item.displayName;function pc(){const s=[];for(const t of lr)if(t.href&&s.push(t),t.sub)for(const a of t.sub)s.push({...a,parent:t.title});return s}function ke(){const[s,t]=o.useState(!1),a=as(),n=pc();o.useEffect(()=>{const c=d=>{d.key==="k"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),t(x=>!x))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]);const l=o.useCallback(c=>{t(!1),a(c)},[a]);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-10 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>t(!0),children:[e.jsx(ri,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex",children:"搜索..."}),e.jsx("span",{className:"sr-only",children:"搜索"}),e.jsxs("kbd",{className:"pointer-events-none absolute right-1.5 top-2 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsxs(fc,{open:s,onOpenChange:t,children:[e.jsx(Cs,{placeholder:"搜索所有菜单和功能..."}),e.jsxs(js,{children:[e.jsx(Ss,{children:"未找到相关结果"}),e.jsx(Ve,{heading:"菜单导航",children:n.map(c=>e.jsxs(ve,{value:`${c.parent?c.parent+" ":""}${c.title}`,onSelect:()=>l(c.href),children:[e.jsx("div",{className:"mr-2",children:c.icon}),e.jsx("span",{children:c.title}),c.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c.parent})]},c.href))})]})]})]})}function Te(){const{theme:s,setTheme:t}=wo();return o.useEffect(()=>{const a=s==="dark"?"#020817":"#fff",n=document.querySelector("meta[name='theme-color']");n&&n.setAttribute("content",a)},[s]),e.jsx(T,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>t(s==="light"?"dark":"light"),children:s==="light"?e.jsx(li,{size:20}):e.jsx(ii,{size:20})})}const ir=o.forwardRef(({className:s,...t},a)=>e.jsx(cn,{ref:a,className:b("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...t}));ir.displayName=cn.displayName;const or=o.forwardRef(({className:s,...t},a)=>e.jsx(dn,{ref:a,className:b("aspect-square h-full w-full",s),...t}));or.displayName=dn.displayName;const cr=o.forwardRef(({className:s,...t},a)=>e.jsx(un,{ref:a,className:b("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...t}));cr.displayName=un.displayName;function De(){const s=as(),t=Ka(),a=oi(Ko),n=()=>{Gn(),t(Ho()),s("/sign-in")},l=a?.email?.split("@")[0]||"User",c=l.substring(0,2).toUpperCase();return e.jsxs(vs,{children:[e.jsx(bs,{asChild:!0,children:e.jsx(T,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(ir,{className:"h-8 w-8",children:[e.jsx(or,{src:a?.avatar_url,alt:l}),e.jsx(cr,{children:c})]})})}),e.jsxs(ms,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(aa,{className:"font-normal",children:e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("p",{className:"text-sm font-medium leading-none",children:l}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:a?.email||"user@example.com"})]})}),e.jsx(Xs,{}),e.jsx(he,{asChild:!0,children:e.jsxs(ws,{to:"/config/system",children:["设置",e.jsx(Gt,{children:"⌘S"})]})}),e.jsx(Xs,{}),e.jsxs(he,{onClick:n,children:["退出登录",e.jsx(Gt,{children:"⇧⌘Q"})]})]})]})}const M=window?.settings?.secure_path,vc=s=>R.get(M+"/stat/getOrder",{params:s}),bc=()=>R.get(M+"/stat/getStats"),Va=s=>R.get(M+"/stat/getTrafficRank",{params:s}),yc=()=>R.get(M+"/theme/getThemes"),Nc=s=>R.post(M+"/theme/getThemeConfig",{name:s}),wc=(s,t)=>R.post(M+"/theme/saveThemeConfig",{name:s,config:t}),_c=s=>{const t=new FormData;return t.append("file",s),R.post(M+"/theme/upload",t,{headers:{"Content-Type":"multipart/form-data"}})},Cc=s=>R.post(M+"/theme/delete",{name:s}),Sc=s=>R.post(M+"/config/save",s),dr=()=>R.get(M+"/server/manage/getNodes"),kc=s=>R.post(M+"/server/manage/save",s),Tc=s=>R.post(M+"/server/manage/drop",s),Dc=s=>R.post(M+"/server/manage/copy",s),Pc=s=>R.post(M+"/server/manage/update",s),Ic=s=>R.post(M+"/server/manage/sort",s),Rt=()=>R.get(M+"/server/group/fetch"),Vc=s=>R.post(M+"/server/group/save",s),Rc=s=>R.post(M+"/server/group/drop",s),ur=()=>R.get(M+"/server/route/fetch"),Ec=s=>R.post(M+"/server/route/save",s),Fc=s=>R.post(M+"/server/route/drop",s),Mc=()=>R.get(M+"/payment/fetch"),zc=()=>R.get(M+"/payment/getPaymentMethods"),Oc=s=>R.post(M+"/payment/getPaymentForm",s),Lc=s=>R.post(M+"/payment/save",s),$c=s=>R.post(M+"/payment/drop",s),Ac=s=>R.post(M+"/payment/show",s),Hc=s=>R.post(M+"/payment/sort",s),Kc=()=>R.get(M+"/notice/fetch"),qc=s=>R.post(M+"/notice/save",s),Uc=s=>R.post(M+"/notice/drop",s),Bc=s=>R.post(M+"/notice/show",s),Gc=()=>R.get(M+"/knowledge/fetch"),Yc=s=>R.get(M+"/knowledge/fetch?id="+s),Wc=s=>R.post(M+"/knowledge/save",s),Jc=s=>R.post(M+"/knowledge/drop",s),Qc=s=>R.post(M+"/knowledge/show",s),Zc=s=>R.post(M+"/knowledge/sort",s),ks=()=>R.get(M+"/plan/fetch"),Xc=s=>R.post(M+"/plan/save",s),Ot=s=>R.post(M+"/plan/update",s),ed=s=>R.post(M+"/plan/drop",s),sd=s=>R.post(M+"/plan/sort",{ids:s}),xr=async s=>R.post(M+"/order/fetch",s),td=s=>R.post(M+"/order/detail",s),ad=s=>R.post(M+"/order/paid",s),nd=s=>R.post(M+"/order/cancel",s),Ra=s=>R.post(M+"/order/update",s),rd=s=>R.post(M+"/order/assign",s),ld=s=>R.post(M+"/coupon/fetch",s),id=s=>R.post(M+"/coupon/generate",s),od=s=>R.post(M+"/coupon/drop",s),cd=s=>R.post(M+"/coupon/update",s),dd=s=>R.post(M+"/user/fetch",s),ud=s=>R.post(M+"/user/update",s),xd=s=>R.post(M+"/user/resetSecret",s),md=s=>R.post(M+"/user/generate",s),hd=s=>R.post(M+"/stat/getStatUser",s),mr=s=>R.post(M+"/ticket/fetch",s),jd=s=>R.get(M+"/ticket/fetch?id= "+s),gd=s=>R.post(M+"/ticket/reply",s),hr=s=>R.post(M+"/ticket/close",{id:s}),is=(s="")=>R.get(M+"/config/fetch?key="+s),os=s=>R.post(M+"/config/save",s),fd=()=>R.get(M+"/config/getEmailTemplate"),pd=()=>R.post(M+"/config/testSendMail"),vd=()=>R.post(M+"/config/setTelegramWebhook"),jr=ci,na=o.forwardRef(({className:s,...t},a)=>e.jsx(xn,{ref:a,className:b("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...t}));na.displayName=xn.displayName;const et=o.forwardRef(({className:s,...t},a)=>e.jsx(mn,{ref:a,className:b("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",s),...t}));et.displayName=mn.displayName;const bd=o.forwardRef(({className:s,...t},a)=>e.jsx(hn,{ref:a,className:b("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...t}));bd.displayName=hn.displayName;const B=di,ds=pi,G=ui,q=o.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(jn,{ref:n,className:b("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...a,children:[t,e.jsx(xi,{asChild:!0,children:e.jsx(Xt,{className:"h-4 w-4 opacity-50"})})]}));q.displayName=jn.displayName;const gr=o.forwardRef(({className:s,...t},a)=>e.jsx(gn,{ref:a,className:b("flex cursor-default items-center justify-center py-1",s),...t,children:e.jsx(mi,{className:"h-4 w-4"})}));gr.displayName=gn.displayName;const fr=o.forwardRef(({className:s,...t},a)=>e.jsx(fn,{ref:a,className:b("flex cursor-default items-center justify-center py-1",s),...t,children:e.jsx(Xt,{className:"h-4 w-4"})}));fr.displayName=fn.displayName;const U=o.forwardRef(({className:s,children:t,position:a="popper",...n},l)=>e.jsx(hi,{children:e.jsxs(pn,{ref:l,className:b("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:a,...n,children:[e.jsx(gr,{}),e.jsx(ji,{className:b("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),e.jsx(fr,{})]})}));U.displayName=pn.displayName;const yd=o.forwardRef(({className:s,...t},a)=>e.jsx(vn,{ref:a,className:b("px-2 py-1.5 text-sm font-semibold",s),...t}));yd.displayName=vn.displayName;const z=o.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(bn,{ref:n,className:b("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...a,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(gi,{children:e.jsx(Ns,{className:"h-4 w-4"})})}),e.jsx(fi,{children:t})]}));z.displayName=bn.displayName;const Nd=o.forwardRef(({className:s,...t},a)=>e.jsx(yn,{ref:a,className:b("-mx-1 my-1 h-px bg-muted",s),...t}));Nd.displayName=yn.displayName;function Ts({className:s,classNames:t,showOutsideDays:a=!0,...n}){return e.jsx(vi,{showOutsideDays:a,className:b("p-3",s),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:b(zs({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:b("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",n.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:b(zs({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({className:l,...c})=>e.jsx(Nn,{className:b("h-4 w-4",l),...c}),IconRight:({className:l,...c})=>e.jsx(Zt,{className:b("h-4 w-4",l),...c})},...n})}Ts.displayName="Calendar";const Qe=yi,Ze=Ni,Be=o.forwardRef(({className:s,align:t="center",sideOffset:a=4,...n},l)=>e.jsx(bi,{children:e.jsx(wn,{ref:l,align:t,sideOffset:a,className:b("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...n})}));Be.displayName=wn.displayName;const us={income:{main:"hsl(var(--primary))",gradient:{start:"hsl(var(--primary))",end:"transparent"}},commission:{main:"hsl(var(--secondary))",gradient:{start:"hsl(var(--secondary))",end:"transparent"}}},Ys=s=>(s/100).toFixed(2),wd=({active:s,payload:t,label:a})=>s&&t&&t.length?e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-sm",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:a}),t.map((n,l)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:n.color}}),e.jsxs("span",{className:"text-muted-foreground",children:[n.name,":"]}),e.jsx("span",{className:"font-medium",children:n.name.includes("金额")?`¥${Ys(n.value)}`:`${n.value}笔`})]},l))]}):null,_d=[{value:"7d",label:"最近7天"},{value:"30d",label:"最近30天"},{value:"90d",label:"最近90天"},{value:"180d",label:"最近180天"},{value:"365d",label:"最近一年"},{value:"custom",label:"自定义范围"}],Cd=(s,t)=>{const a=new Date;if(s==="custom"&&t)return{startDate:t.from,endDate:t.to};let n;switch(s){case"7d":n=He(a,7);break;case"30d":n=He(a,30);break;case"90d":n=He(a,90);break;case"180d":n=He(a,180);break;case"365d":n=He(a,365);break;default:n=He(a,30)}return{startDate:n,endDate:a}};function Sd(){const[s,t]=o.useState("amount"),[a,n]=o.useState("30d"),[l,c]=o.useState({from:He(new Date,7),to:new Date}),{startDate:d,endDate:x}=Cd(a,l),{data:r}=Q({queryKey:["orderStat",{start_date:Pe(d,"yyyy-MM-dd"),end_date:Pe(x,"yyyy-MM-dd")}],queryFn:async()=>{const{data:i}=await vc({start_date:Pe(d,"yyyy-MM-dd"),end_date:Pe(x,"yyyy-MM-dd")});return i},refetchInterval:3e4});return e.jsxs(Ie,{children:[e.jsxs(ze,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Je,{children:"收入趋势"}),e.jsx(Zs,{children:`${r?.summary.start_date||""} 至 ${r?.summary.end_date||""}`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsxs(B,{value:a,onValueChange:i=>n(i),children:[e.jsx(q,{className:"w-[120px]",children:e.jsx(G,{placeholder:"选择时间范围"})}),e.jsx(U,{children:_d.map(i=>e.jsx(z,{value:i.value,children:i.label},i.value))})]}),a==="custom"&&e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(W,{variant:"outline",className:b("min-w-0 justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(rt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:l?.from?l.to?e.jsxs(e.Fragment,{children:[Pe(l.from,"yyyy-MM-dd")," -"," ",Pe(l.to,"yyyy-MM-dd")]}):Pe(l.from,"yyyy-MM-dd"):e.jsx("span",{children:"选择日期范围"})})]})}),e.jsx(Be,{className:"w-auto p-0",align:"end",children:e.jsx(Ts,{mode:"range",defaultMonth:l?.from,selected:{from:l?.from,to:l?.to},onSelect:i=>{i?.from&&i?.to&&c({from:i.from,to:i.to})},numberOfMonths:2})})]})]}),e.jsx(jr,{value:s,onValueChange:i=>t(i),children:e.jsxs(na,{children:[e.jsx(et,{value:"amount",children:"金额"}),e.jsx(et,{value:"count",children:"笔数"})]})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总收入"}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Ys(r?.summary?.paid_total||0)]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["共 ",r?.summary?.paid_count||0," 笔"]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["平均订单金额 ¥",Ys(r?.summary?.avg_paid_amount||0)]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总佣金"}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Ys(r?.summary?.commission_total||0)]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["共 ",r?.summary?.commission_count||0," 笔"]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["佣金比率 ",r?.summary?.commission_rate.toFixed(2)||0,"%"]})]})]})]}),e.jsx(Oe,{children:e.jsx("div",{className:"h-[400px] w-full",children:e.jsx(wi,{width:"100%",height:"100%",children:e.jsxs(_i,{data:r?.list||[],margin:{top:20,right:20,left:0,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"incomeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:us.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:us.income.gradient.end,stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"commissionGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:us.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:us.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(Ci,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:i=>Pe(new Date(i),"MM-dd",{locale:Di})}),e.jsx(Si,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:i=>s==="amount"?`¥${Ys(i)}`:`${i}笔`}),e.jsx(ki,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(Ti,{content:e.jsx(wd,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(ya,{type:"monotone",dataKey:"paid_total",name:"收款金额",stroke:us.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(ya,{type:"monotone",dataKey:"commission_total",name:"佣金金额",stroke:us.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(Na,{dataKey:"paid_count",name:"收款笔数",fill:us.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(Na,{dataKey:"commission_count",name:"佣金笔数",fill:us.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})})]})}var me=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.CANCELLED=2]="CANCELLED",s[s.COMPLETED=3]="COMPLETED",s[s.DISCOUNTED=4]="DISCOUNTED",s))(me||{});const Vs={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},Us={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var ts=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=5]="RESET_FLOW",s))(ts||{});const pr={1:"新购",2:"续费",3:"升级",5:"流量重置"};var fe=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(fe||{});const ct={0:"待确认",1:"发放中",2:"有效",3:"无效"},dt={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var ne=(s=>(s.MONTH_PRICE="month_price",s.QUARTER_PRICE="quarter_price",s.HALF_YEAR_PRICE="half_year_price",s.YEAR_PRICE="year_price",s.TWO_YEAR_PRICE="two_year_price",s.THREE_YEAR_PRICE="three_year_price",s.ONETIME_PRICE="onetime_price",s.RESET_PRICE="reset_price",s))(ne||{});const st={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var pe=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s))(pe||{});const ps=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"}],ss={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a"};var Et=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(Et||{});const ra={1:"按金额优惠",2:"按比例优惠"},kd={0:"正常",1:"锁定"};var Es=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(Es||{});const Td={0:"开启",1:"已关闭"};var es=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(es||{});const Js={0:"低",1:"中",2:"高"};function Dd(){const s=as(),{data:t}=Q({queryKey:["pendingTickets"],queryFn:()=>mr({filter:[{id:"status",value:0}]}),staleTime:1e3*30,refetchInterval:1e3*30}),{data:a}=Q({queryKey:["pendingCommissions"],queryFn:()=>xr({filter:[{id:"commission_status",value:fe.PENDING},{id:"status",value:me.COMPLETED}]}),staleTime:1e3*30,refetchInterval:1e3*30}),n=t?.data||[],l=a?.data||[],c=()=>{const d=new URLSearchParams;d.set("commission_status",fe.PENDING.toString()),d.set("status",me.COMPLETED.toString()),s(`/finance/order?${d.toString()}`)};return e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(Ie,{className:`cursor-pointer transition-colors hover:bg-muted/50 ${n.length>0?"border-orange-500/50":""}`,onClick:()=>s("/user/ticket"),children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Je,{className:"text-sm font-medium",children:"待处理工单"}),e.jsx(Pi,{className:`h-4 w-4 ${n.length>0?"text-orange-500":"text-muted-foreground"}`})]}),e.jsxs(Oe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n.length>0?"有待处理的工单需要关注":"暂无待处理工单"})]})]}),e.jsxs(Ie,{className:`cursor-pointer transition-colors hover:bg-muted/50 ${l.length>0?"border-blue-500/50":""}`,onClick:c,children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Je,{className:"text-sm font-medium",children:"待处理佣金"}),e.jsx(Ii,{className:`h-4 w-4 ${l.length>0?"text-blue-500":"text-muted-foreground"}`})]}),e.jsxs(Oe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l.length>0?"有待处理的佣金需要确认":"暂无待处理佣金"})]})]})]})}function Fe({className:s,...t}){return e.jsx("div",{className:b("animate-pulse rounded-md bg-primary/10",s),...t})}function Pd(){return e.jsxs(Ie,{children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Fe,{className:"h-4 w-[100px]"}),e.jsx(Fe,{className:"h-4 w-4"})]}),e.jsxs(Oe,{children:[e.jsx(Fe,{className:"h-8 w-[120px]"}),e.jsx("div",{className:"flex items-center pt-1",children:e.jsx(Fe,{className:"h-4 w-[100px]"})})]})]})}function Id(){return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((s,t)=>e.jsx(Pd,{},t))})}function ut({title:s,value:t,icon:a,trend:n,className:l}){return e.jsxs(Ie,{className:b("transition-colors hover:border-primary/50",l),children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Je,{className:"text-sm font-medium",children:s}),a]}),e.jsxs(Oe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:t}),e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(Fi,{className:b("h-4 w-4",n.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:b("ml-1 text-xs",n.isPositive?"text-emerald-500":"text-red-500"),children:[n.isPositive?"+":"-",Math.abs(n.value),"%"]}),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:n.label})]})]})]})}function Vd({className:s}){const{data:t,isLoading:a}=Q({queryKey:["dashboardStats"],queryFn:async()=>(await bc()).data,refetchInterval:3e5});return a||!t?e.jsx(Id,{}):e.jsxs("div",{className:b("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx(ut,{title:"今日收入",value:`¥${t.todayIncome/100}`,icon:e.jsx(Vi,{className:"h-4 w-4 text-emerald-500"}),trend:{value:t.dayIncomeGrowth,label:"vs 昨日",isPositive:t.dayIncomeGrowth>0}}),e.jsx(ut,{title:"本月收入",value:`¥${t.currentMonthIncome/100}`,icon:e.jsx(Ri,{className:"h-4 w-4 text-blue-500"}),trend:{value:t.monthIncomeGrowth,label:"vs 上月",isPositive:t.monthIncomeGrowth>0}}),e.jsx(ut,{title:"上月佣金支出",value:`¥${t.lastMonthCommissionPayout/100}`,icon:e.jsx(Ei,{className:"h-4 w-4 text-destructive"}),trend:{value:t.commissionGrowth,label:"vs 上上月",isPositive:t.commissionGrowth>0}}),e.jsx(ut,{title:"本月新增用户",value:t.currentMonthNewUsers,icon:e.jsx(_n,{className:"h-4 w-4 text-blue-500"}),trend:{value:t.userGrowth,label:"vs 上月",isPositive:t.userGrowth>0}})]})}const tt=o.forwardRef(({className:s,children:t,...a},n)=>e.jsxs(Cn,{ref:n,className:b("relative overflow-hidden",s),...a,children:[e.jsx(Mi,{className:"h-full w-full rounded-[inherit]",children:t}),e.jsx(wt,{}),e.jsx(zi,{})]}));tt.displayName=Cn.displayName;const wt=o.forwardRef(({className:s,orientation:t="vertical",...a},n)=>e.jsx(Sn,{ref:n,orientation:t,className:b("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",s),...a,children:e.jsx(Oi,{className:"relative flex-1 rounded-full bg-border"})}));wt.displayName=Sn.displayName;const Yt={today:{label:"今天",getValue:()=>{const s=$i();return{start:s,end:Ai(s,1)}}},last7days:{label:"最近7天",getValue:()=>{const s=new Date;return{start:He(s,7),end:s}}},last30days:{label:"最近30天",getValue:()=>{const s=new Date;return{start:He(s,30),end:s}}},custom:{label:"自定义范围",getValue:()=>null}};function Ea({selectedRange:s,customDateRange:t,onRangeChange:a,onCustomRangeChange:n}){return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.jsxs(B,{value:s,onValueChange:a,children:[e.jsx(q,{className:"w-[120px]",children:e.jsx(G,{placeholder:"选择时间范围"})}),e.jsx(U,{position:"popper",className:"z-50",children:Object.entries(Yt).map(([l,{label:c}])=>e.jsx(z,{value:l,children:c},l))})]}),s==="custom"&&e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(W,{variant:"outline",className:b("min-w-0 justify-start text-left font-normal",!t&&"text-muted-foreground"),children:[e.jsx(rt,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:t?.from?t.to?e.jsxs(e.Fragment,{children:[Pe(t.from,"yyyy-MM-dd")," -"," ",Pe(t.to,"yyyy-MM-dd")]}):Pe(t.from,"yyyy-MM-dd"):e.jsx("span",{children:"选择日期范围"})})]})}),e.jsx(Be,{className:"w-auto p-0",align:"end",children:e.jsx(Ts,{mode:"range",defaultMonth:t?.from,selected:{from:t?.from,to:t?.to},onSelect:l=>{l?.from&&l?.to&&n({from:l.from,to:l.to})},numberOfMonths:2})})]})]})}const Is=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Rd({className:s}){const[t,a]=o.useState("today"),[n,l]=o.useState({from:He(new Date,7),to:new Date}),[c,d]=o.useState("today"),[x,r]=o.useState({from:He(new Date,7),to:new Date}),i=o.useMemo(()=>t==="custom"?{start:n.from,end:n.to}:Yt[t].getValue(),[t,n]),h=o.useMemo(()=>c==="custom"?{start:x.from,end:x.to}:Yt[c].getValue(),[c,x]),{data:D}=Q({queryKey:["nodeTrafficRank",i.start,i.end],queryFn:()=>Va({type:"node",start_time:de.round(i.start.getTime()/1e3),end_time:de.round(i.end.getTime()/1e3)}),refetchInterval:3e4}),{data:C}=Q({queryKey:["userTrafficRank",h.start,h.end],queryFn:()=>Va({type:"user",start_time:de.round(h.start.getTime()/1e3),end_time:de.round(h.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:b("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(Ie,{children:[e.jsx(ze,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(Je,{className:"flex items-center text-base font-medium",children:[e.jsx(Li,{className:"mr-2 h-4 w-4"}),"节点流量排行"]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(Ea,{selectedRange:t,customDateRange:n,onRangeChange:a,onCustomRangeChange:l}),e.jsx(wa,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Oe,{className:"flex-1",children:D?.data?e.jsxs(tt,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:D.data.map(m=>e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:m.name}),e.jsxs("span",{className:b("ml-2 flex items-center text-xs font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?e.jsx(Ht,{className:"mr-1 h-3 w-3"}):e.jsx(Kt,{className:"mr-1 h-3 w-3"}),Math.abs(m.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${m.value/D.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Is(m.value)})]})]})})}),e.jsx(ee,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"当前流量:"}),e.jsx("span",{className:"font-medium",children:Is(m.value)}),e.jsx("span",{className:"text-muted-foreground",children:"上期流量:"}),e.jsx("span",{className:"font-medium",children:Is(m.previousValue)}),e.jsx("span",{className:"text-muted-foreground",children:"变化率:"}),e.jsxs("span",{className:b("font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?"+":"",m.change,"%"]}),e.jsx("span",{className:"text-muted-foreground",children:"记录时间:"}),e.jsx("span",{className:"font-medium",children:Pe(new Date(m.timestamp),"yyyy-MM-dd HH:mm")})]})})]})},m.id))}),e.jsx(wt,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:"Loading..."})})})]}),e.jsxs(Ie,{children:[e.jsx(ze,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(Je,{className:"flex items-center text-base font-medium",children:[e.jsx(_n,{className:"mr-2 h-4 w-4"}),"用户流量排行"]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(Ea,{selectedRange:c,customDateRange:x,onRangeChange:d,onCustomRangeChange:r}),e.jsx(wa,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Oe,{className:"flex-1",children:C?.data?e.jsxs(tt,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:C.data.map(m=>e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:m.name}),e.jsxs("span",{className:b("ml-2 flex items-center text-xs font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?e.jsx(Ht,{className:"mr-1 h-3 w-3"}):e.jsx(Kt,{className:"mr-1 h-3 w-3"}),Math.abs(m.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${m.value/C.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Is(m.value)})]})]})})}),e.jsx(ee,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"当前流量:"}),e.jsx("span",{className:"font-medium",children:Is(m.value)}),e.jsx("span",{className:"text-muted-foreground",children:"上期流量:"}),e.jsx("span",{className:"font-medium",children:Is(m.previousValue)}),e.jsx("span",{className:"text-muted-foreground",children:"变化率:"}),e.jsxs("span",{className:b("font-medium",m.change>=0?"text-green-600":"text-red-600"),children:[m.change>=0?"+":"",m.change,"%"]}),e.jsx("span",{className:"text-muted-foreground",children:"记录时间:"}),e.jsx("span",{className:"font-medium",children:Pe(new Date(m.timestamp),"yyyy-MM-dd HH:mm")})]})})]})},m.id))}),e.jsx(wt,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:"Loading..."})})})]})]})}const Ed=ys("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/10",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function O({className:s,variant:t,...a}){return e.jsx("div",{className:b(Ed({variant:t}),s),...a})}const Bs=window?.settings?.secure_path,Fa={getSystemStatus:()=>R.get(`${Bs}/system/getSystemStatus`),getQueueStats:()=>R.get(`${Bs}/system/getQueueStats`),getQueueWorkload:()=>R.get(`${Bs}/system/getQueueWorkload`),getQueueMasters:()=>R.get(`${Bs}/system/getQueueMasters`),getSystemLog:s=>R.get(`${Bs}/system/getSystemLog`,{params:s})},pt=o.forwardRef(({className:s,value:t,...a},n)=>e.jsx(kn,{ref:n,className:b("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...a,children:e.jsx(Hi,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));pt.displayName=kn.displayName;function Fd(){const[s,t]=o.useState(null),[a,n]=o.useState(null),[l,c]=o.useState(!0),[d,x]=o.useState(!1),r=async()=>{try{x(!0);const[D,C]=await Promise.all([Fa.getSystemStatus(),Fa.getQueueStats()]);t(D.data),n(C.data)}catch(D){console.error("Error fetching system data:",D)}finally{c(!1),x(!1)}};o.useEffect(()=>{r();const D=setInterval(r,3e4);return()=>clearInterval(D)},[]);const i=()=>{r()};if(l)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(ea,{className:"h-6 w-6 animate-spin"})});const h=D=>D?e.jsx(Tn,{className:"h-5 w-5 text-green-500"}):e.jsx(Dn,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Ie,{children:[e.jsxs(ze,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Je,{className:"flex items-center gap-2",children:[e.jsx(Ki,{className:"h-5 w-5"}),"队列状态"]}),e.jsx(Zs,{children:"当前队列运行状态"})]}),e.jsx(W,{variant:"outline",size:"icon",onClick:i,disabled:d,children:e.jsx(qi,{className:b("h-4 w-4",d&&"animate-spin")})})]}),e.jsx(Oe,{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:[h(a?.status||!1),e.jsx("span",{className:"font-medium",children:"运行状态"})]}),e.jsx(O,{variant:a?.status?"secondary":"destructive",children:a?.status?"正常":"异常"})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前等待时间:",a?.wait?.default||0," 秒"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{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:"近期任务数"}),e.jsx("p",{className:"text-2xl font-bold",children:a?.recentJobs||0}),e.jsx(pt,{value:(a?.recentJobs||0)/(a?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ee,{children:e.jsxs("p",{children:["统计时间范围: ",a?.periods?.recentJobs||0," 小时"]})})]})}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{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:"每分钟处理量"}),e.jsx("p",{className:"text-2xl font-bold",children:a?.jobsPerMinute||0}),e.jsx(pt,{value:(a?.jobsPerMinute||0)/(a?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ee,{children:e.jsxs("p",{children:["最高吞吐量:"," ",a?.queueWithMaxThroughput?.throughput||0]})})]})})]})]})})]}),e.jsxs(Ie,{children:[e.jsxs(ze,{children:[e.jsxs(Je,{className:"flex items-center gap-2",children:[e.jsx(Ui,{className:"h-5 w-5"}),"作业详情"]}),e.jsx(Zs,{children:"队列处理详细信息"})]}),e.jsx(Oe,{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:"7日报错数量"}),e.jsx("p",{className:"text-2xl font-bold text-destructive",children:a?.failedJobs||0}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["保留 ",a?.periods?.failedJobs||0," 小时"]})]}),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:"最长运行队列"}),e.jsxs("p",{className:"text-2xl font-bold",children:[a?.queueWithMaxRuntime?.runtime||0,"s"]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a?.queueWithMaxRuntime?.name||"N/A"})]})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"活跃进程"}),e.jsxs("span",{className:"font-medium",children:[a?.processes||0," /"," ",(a?.processes||0)+(a?.pausedMasters||0)]})]}),e.jsx(pt,{value:(a?.processes||0)/((a?.processes||0)+(a?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]})}function Md(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:"仪表盘"})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ke,{}),e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsx(_e,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"border-b pb-6",children:e.jsx(Dd,{})}),e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Vd,{}),e.jsx(Sd,{}),e.jsx(Rd,{}),e.jsx(Fd,{})]})]})})]})}const zd=Object.freeze(Object.defineProperty({__proto__:null,default:Md},Symbol.toStringTag,{value:"Module"})),ge=o.forwardRef(({className:s,orientation:t="horizontal",decorative:a=!0,...n},l)=>e.jsx(Pn,{ref:l,decorative:a,orientation:t,className:b("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...n}));ge.displayName=Pn.displayName;function Od({className:s,items:t,...a}){const{pathname:n}=_t(),l=as(),[c,d]=o.useState(n??"/settings"),x=r=>{d(r),l(r)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(B,{value:c,onValueChange:x,children:[e.jsx(q,{className:"h-12 sm:w-48",children:e.jsx(G,{placeholder:"Theme"})}),e.jsx(U,{children:t.map(r=>e.jsx(z,{value:r.href,children:e.jsxs("div",{className:"flex gap-x-4 px-2 py-1",children:[e.jsx("span",{className:"scale-125",children:r.icon}),e.jsx("span",{className:"text-md",children:r.title})]})},r.href))})]})}),e.jsx("div",{className:"hidden w-full overflow-x-auto bg-background px-1 py-2 md:block",children:e.jsx("nav",{className:b("flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",s),...a,children:t.map(r=>e.jsxs(ws,{to:r.href,className:b(Os({variant:"ghost"}),n===r.href?"bg-muted hover:bg-muted":"hover:bg-transparent hover:underline","justify-start"),children:[e.jsx("span",{className:"mr-2",children:r.icon}),r.title]},r.href))})})]})}const vr=[{title:"站点设置",key:"site",icon:e.jsx(Bi,{size:18}),href:"/config/system",description:"配置站点基本信息,包括站点名称、描述、货币单位等核心设置。"},{title:"安全设置",key:"safe",icon:e.jsx(ln,{size:18}),href:"/config/system/safe",description:"配置系统安全相关选项,包括登录验证、密码策略、API访问等安全设置。"},{title:"订阅设置",key:"subscribe",icon:e.jsx(on,{size:18}),href:"/config/system/subscribe",description:"管理用户订阅相关配置,包括订阅链接格式、更新频率、流量统计等设置。"},{title:"邀请&佣金",key:"invite",icon:e.jsx(Gi,{size:18}),href:"/config/system/invite",description:"管理用户邀请和佣金系统,配置邀请奖励、分销规则等。"},{title:"节点配置",key:"server",icon:e.jsx(rn,{size:18}),href:"/config/system/server",description:"配置节点通信和同步设置,包括通信密钥、轮询间隔、负载均衡等高级选项。"},{title:"邮件设置",key:"email",icon:e.jsx(Yi,{size:18}),href:"/config/system/email",description:"配置系统邮件服务,用于发送验证码、密码重置、通知等邮件,支持多种SMTP服务商。"},{title:"Telegram设置",key:"telegram",icon:e.jsx(Wi,{size:18}),href:"/config/system/telegram",description:"配置Telegram机器人功能,实现用户通知、账户绑定、指令交互等自动化服务。"},{title:"APP设置",key:"app",icon:e.jsx(nn,{size:18}),href:"/config/system/app",description:"管理移动应用程序相关配置,包括API接口、版本控制、推送通知等功能设置。"}];function Ld(){return e.jsxs(be,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:"系统设置"}),e.jsx("div",{className:"text-muted-foreground",children:"管理系统核心配置,包括站点、安全、订阅、邀请佣金、节点、邮件和通知等设置"})]}),e.jsx(ge,{className:"my-6"}),e.jsxs("div",{className:"flex flex-1 flex-col space-y-8 overflow-auto lg:flex-row lg:space-x-12 lg:space-y-0",children:[e.jsx("aside",{className:"sticky top-0 lg:w-1/5",children:e.jsx(Od,{items:vr})}),e.jsx("div",{className:"w-full p-1 pr-4 lg:max-w-xl",children:e.jsx("div",{className:"pb-16",children:e.jsx(Jt,{})})})]})]})]})}const $d=Object.freeze(Object.defineProperty({__proto__:null,default:Ld},Symbol.toStringTag,{value:"Module"}));function Ad({title:s,description:t,children:a}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t})]}),e.jsx(ge,{}),a]})}const H=o.forwardRef(({className:s,...t},a)=>e.jsx(In,{className:b("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...t,ref:a,children:e.jsx(Ji,{className:b("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));H.displayName=In.displayName;const gs=o.forwardRef(({className:s,...t},a)=>e.jsx("textarea",{className:b("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:a,...t}));gs.displayName="Textarea";const Hd=u.object({logo:u.string().nullable().default(""),force_https:u.number().nullable().default(0),stop_register:u.number().nullable().default(0),app_name:u.string().nullable().default(""),app_description:u.string().nullable().default(""),app_url:u.string().nullable().default(""),subscribe_url:u.string().nullable().default(""),try_out_plan_id:u.number().nullable().default(0),try_out_hour:u.coerce.number().nullable().default(0),tos_url:u.string().nullable().default(""),currency:u.string().nullable().default(""),currency_symbol:u.string().nullable().default("")});function Kd(){const[s,t]=o.useState(!1),a=o.useRef(null),{data:n}=Q({queryKey:["settings","site"],queryFn:()=>is("site")}),{data:l}=Q({queryKey:["plans"],queryFn:()=>ks()}),c=ae({resolver:ie(Hd),defaultValues:{},mode:"onBlur"}),{mutateAsync:d}=We({mutationFn:os,onSuccess:i=>{i.data&&L.success("已自动保存")}});o.useEffect(()=>{if(n?.data?.site){const i=n?.data?.site;Object.entries(i).forEach(([h,D])=>{c.setValue(h,D)}),a.current=i}},[n]);const x=o.useCallback(de.debounce(async i=>{if(!de.isEqual(i,a.current)){t(!0);try{const h=Object.entries(i).reduce((D,[C,m])=>(D[C]=m===null?"":m,D),{});await d(h),a.current=i}finally{t(!1)}}},1e3),[d]),r=o.useCallback(i=>{x(i)},[x]);return o.useEffect(()=>{const i=c.watch(h=>{r(h)});return()=>i.unsubscribe()},[c.watch,r]),e.jsx(oe,{...c,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:c.control,name:"app_name",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"站点名称"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入站点名称",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"用于显示需要站点名称的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"app_description",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"站点描述"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入站点描述",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"用于显示需要站点描述的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"app_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"站点网址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入站点URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"当前网站最新网址,将会在邮件等需要用于网址处体现。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"force_https",render:({field:i})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"强制HTTPS"}),e.jsx(E,{children:"当站点没有使用HTTPS,CDN或反代开启强制HTTPS时需要开启。"})]}),e.jsx(v,{children:e.jsx(H,{checked:!!i.value,onCheckedChange:h=>{i.onChange(Number(h)),r(c.getValues())}})})]})}),e.jsx(g,{control:c.control,name:"logo",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"LOGO"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入LOGO URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"用于显示需要LOGO的地方。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"subscribe_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"订阅URL"}),e.jsx(v,{children:e.jsx(gs,{placeholder:"用于订阅所使用,多个订阅地址用','隔开.留空则为站点URL。",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"用于订阅所使用,留空则为站点URL。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"tos_url",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"用户条款(TOS)URL"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入用户条款URL,末尾不要/",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"用于跳转到用户条款(TOS)"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"stop_register",render:({field:i})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"停止新用户注册"}),e.jsx(E,{children:"开启后任何人都将无法进行注册。"})]}),e.jsx(v,{children:e.jsx(H,{checked:!!i.value,onCheckedChange:h=>{i.onChange(Number(h)),r(c.getValues())}})})]})}),e.jsx(g,{control:c.control,name:"try_out_plan_id",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"注册试用"}),e.jsx(v,{children:e.jsxs(B,{value:i.value?.toString(),onValueChange:h=>{i.onChange(Number(h)),r(c.getValues())},children:[e.jsx(q,{children:e.jsx(G,{placeholder:"关闭"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"关闭"}),l?.data?.map(h=>e.jsx(z,{value:h.id.toString(),children:h.name},h.id.toString()))]})]})}),e.jsx(E,{children:"选择需要试用的订阅,如果没有选项请先前往订阅管理添加。"}),e.jsx(k,{})]})}),!!c.watch("try_out_plan_id")&&e.jsx(g,{control:c.control,name:"try_out_hour",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"",children:"注册试用时长"}),e.jsx(v,{children:e.jsx(S,{placeholder:"0",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"注册试用时长,单位为小时。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"currency",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"货币单位"}),e.jsx(v,{children:e.jsx(S,{placeholder:"CNY",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"仅用于展示使用,更改后系统中所有的货币单位都将发生变更。"}),e.jsx(k,{})]})}),e.jsx(g,{control:c.control,name:"currency_symbol",render:({field:i})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"货币符号"}),e.jsx(v,{children:e.jsx(S,{placeholder:"¥",...i,value:i.value||"",onChange:h=>{i.onChange(h),r(c.getValues())}})}),e.jsx(E,{children:"仅用于展示使用,更改后系统中所有的货币单位都将发生变更。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function qd(){const s=vr.find(t=>t.key==="site");return e.jsx(Ad,{title:s.title,description:s.description,children:e.jsx(Kd,{})})}const Ud=Object.freeze(Object.defineProperty({__proto__:null,default:qd},Symbol.toStringTag,{value:"Module"})),Bd=u.object({email_verify:u.boolean().nullable(),safe_mode_enable:u.boolean().nullable(),secure_path:u.string().nullable(),email_whitelist_enable:u.boolean().nullable(),email_whitelist_suffix:u.array(u.string().nullable()).nullable(),email_gmail_limit_enable:u.boolean().nullable(),recaptcha_enable:u.boolean().nullable(),recaptcha_key:u.string().nullable(),recaptcha_site_key:u.string().nullable(),register_limit_by_ip_enable:u.boolean().nullable(),register_limit_count:u.coerce.string().transform(s=>s===""?null:s).nullable(),register_limit_expire:u.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_enable:u.boolean().nullable(),password_limit_count:u.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_expire:u.coerce.string().transform(s=>s===""?null:s).nullable()}),Gd={email_verify:!1,safe_mode_enable:!1,secure_path:"",email_whitelist_enable:!1,email_whitelist_suffix:[],email_gmail_limit_enable:!1,recaptcha_enable:!1,recaptcha_key:"",recaptcha_site_key:"",register_limit_by_ip_enable:!1,register_limit_count:"",register_limit_expire:"",password_limit_enable:!1,password_limit_count:"",password_limit_expire:""};function Yd(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(Bd),defaultValues:Gd,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","safe"],queryFn:()=>is("safe")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:r=>{r.data&&L.success("已自动保存")}});o.useEffect(()=>{if(l?.data.safe){const r=l.data.safe;Object.entries(r).forEach(([i,h])=>{typeof h=="number"?n.setValue(i,String(h)):n.setValue(i,h)}),a.current=r}},[l]);const d=o.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await c(r),a.current=r}finally{t(!1)}}},1e3),[c]),x=o.useCallback(r=>{d(r)},[d]);return o.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"email_verify",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"邮箱验证"}),e.jsx(E,{children:"开启后将会强制要求用户进行邮箱验证。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"email_gmail_limit_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"禁止使用Gmail多别名"}),e.jsx(E,{children:"开启后Gmail多别名将无法注册。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"safe_mode_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"安全模式"}),e.jsx(E,{children:"开启后除了站点URL以外的绑定本站点的域名访问都将会被403。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"secure_path",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"后台路径"}),e.jsx(v,{children:e.jsx(S,{placeholder:"admin",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(E,{children:"后台管理路径,修改后将会改变原有的admin路径"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"email_whitelist_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"邮箱后缀白名单"}),e.jsx(E,{children:"开启后在名单中的邮箱后缀才允许进行注册。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("email_whitelist_enable")&&e.jsx(g,{control:n.control,name:"email_whitelist_suffix",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"白名单后缀"}),e.jsx(v,{children:e.jsx(gs,{placeholder:"请输入后缀域名,逗号分割 如:qq.com,gmail.com",value:r.value?.length?r.value.join(","):"",onChange:i=>{const h=i.target.value?i.target.value.split(","):[];r.onChange(h),x(n.getValues())}})}),e.jsx(E,{children:"请使用逗号进行分割,如:qq.com,gmail.com。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"recaptcha_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"防机器人"}),e.jsx(E,{children:"开启后将会使用Google reCAPTCHA防止机器人。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("recaptcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"recaptcha_key",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"密钥"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入密钥",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"recaptcha_site_key",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"站点密钥"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入站点密钥",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:n.control,name:"register_limit_by_ip_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"IP注册限制"}),e.jsx(E,{children:"开启后同一IP将会被限制注册次数。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"register_limit_count",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"限制次数"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入限制次数",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"register_limit_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"限制时长(分钟)"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入限制时长",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:n.control,name:"password_limit_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"密码错误限制"}),e.jsx(E,{children:"开启后密码错误将会被限制登录。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"password_limit_count",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"限制次数"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入限制次数",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"password_limit_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"限制时长(分钟)"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入限制时长",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsx(k,{})]})})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Wd(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"安全设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置系统安全相关选项,包括登录验证、密码策略、API访问等安全设置。"})]}),e.jsx(ge,{}),e.jsx(Yd,{})]})}const Jd=Object.freeze(Object.defineProperty({__proto__:null,default:Wd},Symbol.toStringTag,{value:"Module"})),Qd=u.object({plan_change_enable:u.boolean().nullable().default(!1),reset_traffic_method:u.coerce.number().nullable().default(0),surplus_enable:u.boolean().nullable().default(!1),new_order_event_id:u.coerce.number().nullable().default(0),renew_order_event_id:u.coerce.number().nullable().default(0),change_order_event_id:u.coerce.number().nullable().default(0),show_info_to_server_enable:u.boolean().nullable().default(!1),show_protocol_to_server_enable:u.boolean().nullable().default(!1),default_remind_expire:u.boolean().nullable().default(!1),default_remind_traffic:u.boolean().nullable().default(!1),remind_mail_enable:u.boolean().nullable().default(!1),subscribe_path:u.string().nullable().default("s")}),Zd={plan_change_enable:!1,reset_traffic_method:0,surplus_enable:!1,new_order_event_id:0,renew_order_event_id:0,change_order_event_id:0,show_info_to_server_enable:!1,show_protocol_to_server_enable:!1,default_remind_expire:!1,default_remind_traffic:!1,remind_mail_enable:!1,subscribe_path:"s"};function Xd(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(Qd),defaultValues:Zd,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","subscribe"],queryFn:()=>is("subscribe")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:r=>{r.data&&L.success("已自动保存")}});o.useEffect(()=>{if(l?.data?.subscribe){const r=l?.data?.subscribe;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=o.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await c(r),a.current=r}finally{t(!1)}}},1e3),[c]),x=o.useCallback(r=>{d(r)},[d]);return o.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"plan_change_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"允许用户更改订阅"}),e.jsx(E,{children:"开启后用户将会可以对订阅计划进行变更。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"reset_traffic_method",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"月流量重置方式"}),e.jsx("div",{className:"relative w-max",children:e.jsx(v,{children:e.jsxs(B,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"每月1号"}),e.jsx(z,{value:"1",children:"按月重置"}),e.jsx(z,{value:"2",children:"不重置"}),e.jsx(z,{value:"3",children:"每年1月1号"}),e.jsx(z,{value:"4",children:"按年重置"})]})]})})}),e.jsx(E,{children:"全局流量重置方式,默认每月1号。可以在订阅管理为订阅单独设置。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"surplus_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"开启折抵方案"}),e.jsx(E,{children:"开启后用户更换订阅将会由系统对原有订阅进行折抵,方案参考文档。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"new_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"当订阅新购时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(v,{children:e.jsxs(B,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"不执行任何动作"}),e.jsx(z,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(E,{children:"新购订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"renew_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"当订阅续费时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(v,{children:e.jsxs(B,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"不执行任何动作"}),e.jsx(z,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(E,{children:"续费订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"change_order_event_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"当订阅变更时触发事件"}),e.jsx("div",{className:"relative w-max",children:e.jsx(v,{children:e.jsxs(B,{onValueChange:r.onChange,value:r.value?.toString(),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"不执行任何动作"}),e.jsx(z,{value:"1",children:"重置用户流量"})]})]})})}),e.jsx(E,{children:"变更订阅完成时将触发该任务。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"subscribe_path",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"订阅路径"}),e.jsx(v,{children:e.jsx(S,{placeholder:"subscribe",...r,value:r.value||"",onChange:i=>{r.onChange(i),x(n.getValues())}})}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["订阅路径,修改后将会改变原有的subscribe路径",e.jsx("br",{}),"当前订阅路径格式:",r.value?`${r.value}/xxxxxxxxxx`:"s/xxxxxxxxxx"]}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"show_info_to_server_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"在订阅中展示订阅信息"}),e.jsx(E,{children:"开启后将会在用户订阅节点时输出订阅信息。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"show_protocol_to_server_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"在订阅中线路名称中显示协议名称"}),e.jsx(E,{children:"开启后订阅线路会附带协议名称(例如: [Hy2]香港)"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"remind_mail_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"邮件提醒"}),e.jsx(E,{children:"开启后用户订阅即将到期时和流量告急时时将发送邮件通知。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value||!1,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function eu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"订阅设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"管理用户订阅相关配置,包括订阅链接格式、更新频率、流量统计等设置。"})]}),e.jsx(ge,{}),e.jsx(Xd,{})]})}const su=Object.freeze(Object.defineProperty({__proto__:null,default:eu},Symbol.toStringTag,{value:"Module"})),tu=u.object({invite_force:u.boolean().default(!1),invite_commission:u.coerce.string().default("0"),invite_gen_limit:u.coerce.string().default("0"),invite_never_expire:u.boolean().default(!1),commission_first_time_enable:u.boolean().default(!1),commission_auto_check_enable:u.boolean().default(!1),commission_withdraw_limit:u.coerce.string().default("0"),commission_withdraw_method:u.array(u.string()).default(["支付宝","USDT","Paypal"]),withdraw_close_enable:u.boolean().default(!1),commission_distribution_enable:u.boolean().default(!1),commission_distribution_l1:u.coerce.number().default(0),commission_distribution_l2:u.coerce.number().default(0),commission_distribution_l3:u.coerce.number().default(0)}),au={invite_force:!1,invite_commission:"0",invite_gen_limit:"0",invite_never_expire:!1,commission_first_time_enable:!1,commission_auto_check_enable:!1,commission_withdraw_limit:"0",commission_withdraw_method:["支付宝","USDT","Paypal"],withdraw_close_enable:!1,commission_distribution_enable:!1,commission_distribution_l1:0,commission_distribution_l2:0,commission_distribution_l3:0};function nu(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(tu),defaultValues:au,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","invite"],queryFn:()=>is("invite")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:r=>{r.data&&L.success("已自动保存")}});o.useEffect(()=>{if(l?.data?.invite){const r=l?.data?.invite;Object.entries(r).forEach(([i,h])=>{typeof h=="number"?n.setValue(i,String(h)):n.setValue(i,h)}),a.current=r}},[l]);const d=o.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await c(r),a.current=r}finally{t(!1)}}},1e3),[c]),x=o.useCallback(r=>{d(r)},[d]);return o.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"invite_force",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"开启强制邀请"}),e.jsx(E,{children:"开启后只有被邀请的用户才可以进行注册。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"invite_commission",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:" 邀请佣金百分比"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(E,{children:"默认全局的佣金分配比例,你可以在用户管理单独配置单个比例。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"invite_gen_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"用户可创建邀请码上限"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(E,{children:"用户可创建邀请码上限"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"invite_never_expire",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"邀请码永不失效"}),e.jsx(E,{children:"开启后邀请码被使用后将不会失效,否则使用过后即失效。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_first_time_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"佣金仅首次发放"}),e.jsx(E,{children:"开启后被邀请人首次支付时才会产生佣金,可以在用户管理对用户进行单独配置。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_auto_check_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"佣金自动确认"}),e.jsx(E,{children:"开启后佣金将会在订单完成3日后自动进行确认。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_withdraw_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"提现单申请门槛(元)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(E,{children:"小于门槛金额的提现单将不会被提交。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_withdraw_method",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"提现方式"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",...r,value:Array.isArray(r.value)?r.value.join(","):"",onChange:i=>{const h=i.target.value.split(",").filter(Boolean);r.onChange(h),x(n.getValues())}})}),e.jsx(E,{children:"可以支持的提现方式,多个用逗号分隔。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"withdraw_close_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"关闭提现"}),e.jsx(E,{children:"关闭后将禁止用户申请提现,且邀请佣金将会直接进入用户余额。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"三级分销"}),e.jsx(E,{children:"开启后将佣金将按照设置的3成比例进行分成,三成比例合计请不要大于100%。"})]}),e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:i=>{r.onChange(i),x(n.getValues())}})})]})}),n.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:n.control,name:"commission_distribution_l1",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"一级邀请人比例"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_l2",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"二级邀请人比例"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"commission_distribution_l3",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"三级邀请人比例"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入比例如:50",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):0;r.onChange(h),x(n.getValues())}})}),e.jsx(k,{})]})})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function ru(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"邀请&佣金设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"邀请注册、佣金相关设置。"})]}),e.jsx(ge,{}),e.jsx(nu,{})]})}const lu=Object.freeze(Object.defineProperty({__proto__:null,default:ru},Symbol.toStringTag,{value:"Module"})),iu=u.object({frontend_theme:u.string().nullable(),frontend_theme_sidebar:u.string().nullable(),frontend_theme_header:u.string().nullable(),frontend_theme_color:u.string().nullable(),frontend_background_url:u.string().url().nullable()}),ou={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function cu(){const{data:s}=Q({queryKey:["settings","frontend"],queryFn:()=>is("frontend")}),t=ae({resolver:ie(iu),defaultValues:ou,mode:"onChange"});o.useEffect(()=>{if(s?.data?.frontend){const n=s?.data?.frontend;Object.entries(n).forEach(([l,c])=>{t.setValue(l,c)})}},[s]);function a(n){os(n).then(({data:l})=>{l&&L.success("更新成功")})}return e.jsx(oe,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(a),className:"space-y-8",children:[e.jsx(g,{control:t.control,name:"frontend_theme_sidebar",render:({field:n})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"边栏风格"}),e.jsx(E,{children:"边栏风格"})]}),e.jsx(v,{children:e.jsx(H,{checked:n.value,onCheckedChange:n.onChange})})]})}),e.jsx(g,{control:t.control,name:"frontend_theme_header",render:({field:n})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{className:"text-base",children:"头部风格"}),e.jsx(E,{children:"边栏风格"})]}),e.jsx(v,{children:e.jsx(H,{checked:n.value,onCheckedChange:n.onChange})})]})}),e.jsx(g,{control:t.control,name:"frontend_theme_color",render:({field:n})=>e.jsxs(j,{children:[e.jsx(f,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(v,{children:e.jsxs("select",{className:b(Os({variant:"outline"}),"w-[200px] appearance-none font-normal"),...n,children:[e.jsx("option",{value:"default",children:"默认"}),e.jsx("option",{value:"black",children:"黑色"}),e.jsx("option",{value:"blackblue",children:"暗蓝色"}),e.jsx("option",{value:"green",children:"奶绿色"})]})}),e.jsx(Xt,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx(E,{children:"主题色"}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"frontend_background_url",render:({field:n})=>e.jsxs(j,{children:[e.jsx(f,{children:"背景"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入图片地址",...n})}),e.jsx(E,{children:"将会在后台登录页面进行展示。"}),e.jsx(k,{})]})}),e.jsx(T,{type:"submit",children:"保存设置"})]})})}function du(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"个性化设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"自定义系统界面外观,包括主题风格、布局、颜色方案、背景图等个性化选项。"})]}),e.jsx(ge,{}),e.jsx(cu,{})]})}const uu=Object.freeze(Object.defineProperty({__proto__:null,default:du},Symbol.toStringTag,{value:"Module"})),xu=u.object({server_pull_interval:u.coerce.number().nullable(),server_push_interval:u.coerce.number().nullable(),server_token:u.string().nullable(),device_limit_mode:u.coerce.number().nullable()}),mu={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function hu(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(xu),defaultValues:mu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","server"],queryFn:()=>is("server")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:r=>{r.data&&L.success("已自动保存")}});o.useEffect(()=>{if(l?.data.server){const r=l.data.server;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=o.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await c(r),a.current=r}finally{t(!1)}}},1e3),[c]),x=o.useCallback(r=>{d(r)},[d]);return o.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"server_token",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"通讯密钥"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",...r,value:r.value||""})}),e.jsx(E,{children:"Xboard与节点通讯的密钥,以便数据不会被他人获取。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"server_pull_interval",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"节点拉取动作轮询间隔"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):null;r.onChange(h)}})}),e.jsx(E,{children:"节点从面板获取数据的间隔频率。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"server_push_interval",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"节点推送动作轮询间隔"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入",...r,value:r.value||"",onChange:i=>{const h=i.target.value?Number(i.target.value):null;r.onChange(h)}})}),e.jsx(E,{children:"节点推送数据到面板的间隔频率。"}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"device_limit_mode",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"设备限制模式"}),e.jsxs(B,{onValueChange:r.onChange,value:r.value?.toString()||"0",children:[e.jsx(v,{children:e.jsx(q,{children:e.jsx(G,{placeholder:"请选择设备限制模式"})})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"严格模式"}),e.jsx(z,{value:"1",children:"宽松模式"})]})]}),e.jsx(E,{children:"宽松模式下,同一IP地址使用多个节点只统计为一个设备。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function ju(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"节点配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置节点通信和同步设置,包括通信密钥、轮询间隔、负载均衡等高级选项。"})]}),e.jsx(ge,{}),e.jsx(hu,{})]})}const gu=Object.freeze(Object.defineProperty({__proto__:null,default:ju},Symbol.toStringTag,{value:"Module"}));function fu({open:s,onOpenChange:t,result:a}){const n=!a.error;return e.jsx(ue,{open:s,onOpenChange:t,children:e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n?e.jsx(Tn,{className:"h-5 w-5 text-green-500"}):e.jsx(Dn,{className:"h-5 w-5 text-destructive"}),e.jsx(xe,{children:n?"邮件发送成功":"邮件发送失败"})]}),e.jsx(Se,{children:n?"测试邮件已成功发送,请检查收件箱":"发送测试邮件时遇到错误"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"发送详情"}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2 text-sm",children:[e.jsx("div",{className:"text-muted-foreground",children:"收件地址"}),e.jsx("div",{children:a.email}),e.jsx("div",{className:"text-muted-foreground",children:"邮件主题"}),e.jsx("div",{children:a.subject}),e.jsx("div",{className:"text-muted-foreground",children:"模板名称"}),e.jsx("div",{children:a.template_name})]})]}),a.error&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium text-destructive",children:"错误信息"}),e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive break-all",children:a.error})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"配置信息"}),e.jsx(tt,{className:"h-[200px] rounded-md border p-4",children:e.jsx("div",{className:"grid gap-2 text-sm",children:e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2",children:[e.jsx("div",{className:"text-muted-foreground",children:"驱动"}),e.jsx("div",{children:a.config.driver}),e.jsx("div",{className:"text-muted-foreground",children:"服务器"}),e.jsx("div",{children:a.config.host}),e.jsx("div",{className:"text-muted-foreground",children:"端口"}),e.jsx("div",{children:a.config.port}),e.jsx("div",{className:"text-muted-foreground",children:"加密方式"}),e.jsx("div",{children:a.config.encryption||"无"}),e.jsx("div",{className:"text-muted-foreground",children:"发件人"}),e.jsx("div",{children:a.config.from.address?`${a.config.from.address}${a.config.from.name?` (${a.config.from.name})`:""}`:"未设置"}),e.jsx("div",{className:"text-muted-foreground",children:"用户名"}),e.jsx("div",{children:a.config.username||"未设置"})]})})})]})]})]})})}const pu=u.object({email_template:u.string().nullable().default("classic"),email_host:u.string().nullable().default(""),email_port:u.string().regex(/^\d+$/).nullable().default("465"),email_username:u.string().nullable().default(""),email_password:u.string().nullable().default(""),email_encryption:u.string().nullable().default(""),email_from_address:u.string().email().nullable().default("")});function vu(){const[s,t]=o.useState(null),[a,n]=o.useState(!1),l=o.useRef(null),[c,d]=o.useState(!1),x=ae({resolver:ie(pu),defaultValues:{},mode:"onBlur"}),{data:r}=Q({queryKey:["settings","email"],queryFn:()=>is("email")}),{data:i}=Q({queryKey:["emailTemplate"],queryFn:()=>fd()}),{mutateAsync:h}=We({mutationFn:os,onSuccess:_=>{_.data&&L.success("已自动保存")}}),{mutate:D,isPending:C}=We({mutationFn:pd,onMutate:()=>{t(null),n(!1)},onSuccess:_=>{t(_.data),n(!0),_.data.error||L.success("发送成功")}});o.useEffect(()=>{if(r?.data.email){const _=r.data.email;Object.entries(_).forEach(([y,N])=>{x.setValue(y,N)}),l.current=_}},[r]);const m=o.useCallback(de.debounce(async _=>{if(!de.isEqual(_,l.current)){d(!0);try{await h(_),l.current=_}finally{d(!1)}}},1e3),[h]),w=o.useCallback(_=>{m(_)},[m]);return o.useEffect(()=>{const _=x.watch(y=>{w(y)});return()=>_.unsubscribe()},[x.watch,w]),e.jsxs(e.Fragment,{children:[e.jsx(oe,{...x,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:x.control,name:"email_host",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"SMTP服务器地址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(E,{children:"由邮件服务商提供的服务地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_port",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"SMTP服务端口"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(E,{children:"常见的端口有25, 465, 587"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_encryption",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"SMTP加密方式"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(E,{children:"465端口加密方式一般为SSL,587端口加密方式一般为TLS"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_username",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"SMTP账号"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(E,{children:"由邮件服务商提供的账号"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_password",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"SMTP密码"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||"",type:"password"})}),e.jsx(E,{children:"由邮件服务商提供的密码"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_from_address",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"发件地址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入",..._,value:_.value||""})}),e.jsx(E,{children:"由邮件服务商提供的发件地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"email_template",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"邮件模板"}),e.jsxs(B,{onValueChange:y=>{_.onChange(y),w(x.getValues())},value:_.value||void 0,children:[e.jsx(v,{children:e.jsx(q,{className:"w-[200px]",children:e.jsx(G,{placeholder:"选择邮件模板"})})}),e.jsx(U,{children:i?.data?.map(y=>e.jsx(z,{value:y,children:y},y))})]}),e.jsx(E,{children:"你可以在文档查看如何自定义邮件模板"}),e.jsx(k,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(T,{onClick:()=>D(),loading:C,disabled:C,children:C?"发送中...":"发送测试邮件"})})]})}),c&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."}),s&&e.jsx(fu,{open:a,onOpenChange:n,result:s})]})}function bu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"邮件设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置系统邮件服务,用于发送验证码、密码重置、通知等邮件,支持多种SMTP服务商。"})]}),e.jsx(ge,{}),e.jsx(vu,{})]})}const yu=Object.freeze(Object.defineProperty({__proto__:null,default:bu},Symbol.toStringTag,{value:"Module"})),Nu=u.object({telegram_bot_enable:u.boolean().nullable(),telegram_bot_token:u.string().nullable(),telegram_discuss_link:u.string().nullable()}),wu={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function _u(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(Nu),defaultValues:wu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","telegram"],queryFn:()=>is("telegram")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:h=>{h.data&&L.success("已自动保存")}}),{mutate:d,isPending:x}=We({mutationFn:vd,onSuccess:h=>{h.data&&L.success("Webhook设置成功")}});o.useEffect(()=>{if(l?.data.telegram){const h=l.data.telegram;Object.entries(h).forEach(([D,C])=>{n.setValue(D,C)}),a.current=h}},[l]);const r=o.useCallback(de.debounce(async h=>{if(!de.isEqual(h,a.current)){t(!0);try{await c(h),a.current=h}finally{t(!1)}}},1e3),[c]),i=o.useCallback(h=>{r(h)},[r]);return o.useEffect(()=>{const h=n.watch(D=>{i(D)});return()=>h.unsubscribe()},[n.watch,i]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:n.control,name:"telegram_bot_token",render:({field:h})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"机器人Token"}),e.jsx(v,{children:e.jsx(S,{placeholder:"0000000000:xxxxxxxxx_xxxxxxxxxxxxxxx",...h,value:h.value||""})}),e.jsx(E,{children:"请输入由Botfather提供的token。"}),e.jsx(k,{})]})}),n.watch("telegram_bot_token")&&e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"设置Webhook"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(T,{loading:x,disabled:x,onClick:()=>d(),children:x?"Webhook设置中...":"一键设置"}),s&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"保存中..."})]}),e.jsx(E,{children:"对机器人进行Webhook设置,不设置将无法收到Telegram通知。"}),e.jsx(k,{})]}),e.jsx(g,{control:n.control,name:"telegram_bot_enable",render:({field:h})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"开启机器人通知"}),e.jsx(E,{children:"开启后bot将会对绑定了telegram的管理员和用户进行基础通知。"}),e.jsx(v,{children:e.jsx(H,{checked:h.value||!1,onCheckedChange:D=>{h.onChange(D),i(n.getValues())}})}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"telegram_discuss_link",render:({field:h})=>e.jsxs(j,{children:[e.jsx(f,{className:"text-base",children:"群组地址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"https://t.me/xxxxxx",...h,value:h.value||""})}),e.jsx(E,{children:"填写后将会在用户端展示,或者被用于需要的地方。"}),e.jsx(k,{})]})}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Cu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Telegram设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置Telegram机器人功能,实现用户通知、账户绑定、指令交互等自动化服务。"})]}),e.jsx(ge,{}),e.jsx(_u,{})]})}const Su=Object.freeze(Object.defineProperty({__proto__:null,default:Cu},Symbol.toStringTag,{value:"Module"})),ku=u.object({windows_version:u.string().nullable(),windows_download_url:u.string().nullable(),macos_version:u.string().nullable(),macos_download_url:u.string().nullable(),android_version:u.string().nullable(),android_download_url:u.string().nullable()}),Tu={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function Du(){const[s,t]=o.useState(!1),a=o.useRef(null),n=ae({resolver:ie(ku),defaultValues:Tu,mode:"onBlur"}),{data:l}=Q({queryKey:["settings","app"],queryFn:()=>is("app")}),{mutateAsync:c}=We({mutationFn:os,onSuccess:r=>{r.data&&L.success("已自动保存")}});o.useEffect(()=>{if(l?.data.app){const r=l.data.app;Object.entries(r).forEach(([i,h])=>{n.setValue(i,h)}),a.current=r}},[l]);const d=o.useCallback(de.debounce(async r=>{if(!de.isEqual(r,a.current)){t(!0);try{await c(r),a.current=r}finally{t(!1)}}},1e3),[c]),x=o.useCallback(r=>{d(r)},[d]);return o.useEffect(()=>{const r=n.watch(i=>{x(i)});return()=>r.unsubscribe()},[n.watch,x]),e.jsx(oe,{...n,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Windows"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"Windows端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"windows_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"windows_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.exe",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"macOS"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"macOS端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"macos_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"macos_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.dmg",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Android"}),e.jsx("div",{className:"text-[0.8rem] text-muted-foreground",children:"Android端版本号及下载地址"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1",children:e.jsx(g,{control:n.control,name:"android_version",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"1.0.0",...r,value:r.value||""})}),e.jsx(k,{})]})})}),e.jsx("div",{children:e.jsx(g,{control:n.control,name:"android_download_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(v,{children:e.jsx(S,{placeholder:"https://xxx.com/xxx.apk",...r,value:r.value||""})}),e.jsx(k,{})]})})})]})]}),s&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"保存中..."})]})})}function Pu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"APP设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"管理移动应用程序相关配置,包括API接口、版本控制、推送通知等功能设置。"})]}),e.jsx(ge,{}),e.jsx(Du,{})]})}const Iu=Object.freeze(Object.defineProperty({__proto__:null,default:Pu},Symbol.toStringTag,{value:"Module"})),la=o.forwardRef(({className:s,...t},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:b("w-full caption-bottom text-sm",s),...t})}));la.displayName="Table";const ia=o.forwardRef(({className:s,...t},a)=>e.jsx("thead",{ref:a,className:b("[&_tr]:border-b",s),...t}));ia.displayName="TableHeader";const oa=o.forwardRef(({className:s,...t},a)=>e.jsx("tbody",{ref:a,className:b("[&_tr:last-child]:border-0",s),...t}));oa.displayName="TableBody";const Vu=o.forwardRef(({className:s,...t},a)=>e.jsx("tfoot",{ref:a,className:b("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...t}));Vu.displayName="TableFooter";const xs=o.forwardRef(({className:s,...t},a)=>e.jsx("tr",{ref:a,className:b("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...t}));xs.displayName="TableRow";const ca=o.forwardRef(({className:s,...t},a)=>e.jsx("th",{ref:a,className:b("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t}));ca.displayName="TableHead";const Ms=o.forwardRef(({className:s,...t},a)=>e.jsx("td",{ref:a,className:b("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...t}));Ms.displayName="TableCell";const Ru=o.forwardRef(({className:s,...t},a)=>e.jsx("caption",{ref:a,className:b("mt-4 text-sm text-muted-foreground",s),...t}));Ru.displayName="TableCaption";function Eu({table:s}){const[t,a]=o.useState("");o.useEffect(()=>{a((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const n=l=>{const c=parseInt(l);!isNaN(c)&&c>=1&&c<=s.getPageCount()?s.setPageIndex(c-1):a((s.getState().pagination.pageIndex+1).toString())};return e.jsxs("div",{className:"flex flex-col-reverse gap-4 px-2 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex-1 text-sm text-muted-foreground",children:["已选择 ",s.getFilteredSelectedRowModel().rows.length," 项, 共"," ",s.getFilteredRowModel().rows.length," 项"]}),e.jsxs("div",{className:"flex flex-col-reverse items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"每页显示"}),e.jsxs(B,{value:`${s.getState().pagination.pageSize}`,onValueChange:l=>{s.setPageSize(Number(l))},children:[e.jsx(q,{className:"h-8 w-[70px]",children:e.jsx(G,{placeholder:s.getState().pagination.pageSize})}),e.jsx(U,{side:"top",children:[10,20,30,40,50,100,500].map(l=>e.jsx(z,{value:`${l}`,children:l},l))})]})]}),e.jsxs("div",{className:"flex items-center justify-center space-x-2 text-sm font-medium",children:[e.jsx("span",{children:"第"}),e.jsx(S,{type:"text",value:t,onChange:l=>a(l.target.value),onBlur:l=>n(l.target.value),onKeyDown:l=>{l.key==="Enter"&&n(l.currentTarget.value)},className:"h-8 w-[50px] text-center"}),e.jsxs("span",{children:["页,共 ",s.getPageCount()," 页"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(T,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(0),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:"跳转到第一页"}),e.jsx(Qi,{className:"h-4 w-4"})]}),e.jsxs(T,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.previousPage(),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:"上一页"}),e.jsx(Nn,{className:"h-4 w-4"})]}),e.jsxs(T,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.nextPage(),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4"})]}),e.jsxs(T,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(s.getPageCount()-1),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:"跳转到最后一页"}),e.jsx(Zi,{className:"h-4 w-4"})]})]})]})]})}function Ge({table:s,toolbar:t,draggable:a=!1,onDragStart:n,onDragEnd:l,onDragOver:c,onDragLeave:d,onDrop:x,showPagination:r=!0,isLoading:i=!1}){const h=o.useRef(null),D=s.getAllColumns().filter(_=>_.getIsPinned()==="left"),C=s.getAllColumns().filter(_=>_.getIsPinned()==="right"),m=_=>D.slice(0,_).reduce((y,N)=>y+(N.getSize()??0),0),w=_=>C.slice(_+1).reduce((y,N)=>y+(N.getSize()??0),0);return e.jsxs("div",{className:"space-y-4",children:[typeof t=="function"?t(s):t,e.jsx("div",{ref:h,className:"relative overflow-auto rounded-md border bg-card",children:e.jsx("div",{className:"overflow-auto",children:e.jsxs(la,{children:[e.jsx(ia,{children:s.getHeaderGroups().map(_=>e.jsx(xs,{className:"hover:bg-transparent",children:_.headers.map((y,N)=>{const P=y.column.getIsPinned()==="left",p=y.column.getIsPinned()==="right",V=P?m(D.indexOf(y.column)):void 0,A=p?w(C.indexOf(y.column)):void 0;return e.jsx(ca,{colSpan:y.colSpan,style:{width:y.getSize(),...P&&{left:V},...p&&{right:A}},className:b("h-11 bg-card px-4 text-muted-foreground",(P||p)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",P&&"before:right-0",p&&"before:left-0"]),children:y.isPlaceholder?null:vt(y.column.columnDef.header,y.getContext())},y.id)})},_.id))}),e.jsx(oa,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((_,y)=>e.jsx(xs,{"data-state":_.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:a,onDragStart:N=>n?.(N,y),onDragEnd:l,onDragOver:c,onDragLeave:d,onDrop:N=>x?.(N,y),children:_.getVisibleCells().map((N,P)=>{const p=N.column.getIsPinned()==="left",V=N.column.getIsPinned()==="right",A=p?m(D.indexOf(N.column)):void 0,$=V?w(C.indexOf(N.column)):void 0;return e.jsx(Ms,{style:{width:N.column.getSize(),...p&&{left:A},...V&&{right:$}},className:b("bg-card",(p||V)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",p&&"before:right-0",V&&"before:left-0"]),children:vt(N.column.columnDef.cell,N.getContext())},N.id)})},_.id)):e.jsx(xs,{children:e.jsx(Ms,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:"暂无数据"})})})]})})}),r&&e.jsx(Eu,{table:s})]})}const br=(s,t)=>{let a=null;switch(s.field_type){case"input":a=e.jsx(S,{placeholder:s.placeholder,...t});break;case"textarea":a=e.jsx(gs,{placeholder:s.placeholder,...t});break;case"select":a=e.jsx("select",{className:b(zs({variant:"outline"}),"w-full appearance-none font-normal"),...t,children:s.select_options&&Object.keys(s.select_options).map(n=>e.jsx("option",{value:n,children:s.select_options?.[n]},n))});break;default:a=null;break}return a},Fu=u.object({id:u.number().nullable(),name:u.string().min(2,"名称至少需要2个字符").max(30,"名称不能超过30个字符"),icon:u.string().optional().nullable(),notify_domain:u.string().refine(s=>!s||/^https?:\/\/\S+/.test(s),"请输入有效的URL").optional().nullable(),handling_fee_fixed:u.coerce.number().min(0).optional().nullable(),handling_fee_percent:u.coerce.number().min(0).max(100).optional().nullable(),payment:u.string().min(1,"请选择支付接口"),config:u.record(u.string(),u.string())}),Ma={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function yr({refetch:s,dialogTrigger:t,type:a="add",defaultFormValues:n=Ma}){const[l,c]=o.useState(!1),[d,x]=o.useState(!1),[r,i]=o.useState([]),[h,D]=o.useState([]),C=ae({resolver:ie(Fu),defaultValues:n,mode:"onChange"}),m=C.watch("payment");o.useEffect(()=>{l&&(async()=>{const{data:y}=await zc();i(y)})()},[l]),o.useEffect(()=>{if(!m||!l)return;(async()=>{const y={payment:m,...a==="edit"&&{id:Number(C.getValues("id"))}};Oc(y).then(({data:N})=>{D(N);const P=N.reduce((p,V)=>(V.field_name&&(p[V.field_name]=V.value??""),p),{});C.setValue("config",P)})})()},[m,l,C,a]);const w=async _=>{x(!0),(await Lc(_)).data&&(L.success("保存成功"),C.reset(Ma),s(),c(!1)),x(!1)};return e.jsxs(ue,{open:l,onOpenChange:c,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"})," ",e.jsx("div",{children:"添加支付方式"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(je,{children:e.jsx(xe,{children:a==="add"?"添加支付方式":"编辑支付方式"})}),e.jsx(oe,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(w),className:"space-y-4",children:[e.jsx(g,{control:C.control,name:"name",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"显示名称"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入支付名称",..._})}),e.jsx(E,{children:"用于前端显示"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"icon",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"图标URL"}),e.jsx(v,{children:e.jsx(S,{placeholder:"https://example.com/icon.svg",..._})}),e.jsx(E,{children:"用于前端显示的图标地址"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"notify_domain",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"通知域名"}),e.jsx(v,{children:e.jsx(S,{placeholder:"https://example.com",..._})}),e.jsx(E,{children:"网关通知将发送到该域名"}),e.jsx(k,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(g,{control:C.control,name:"handling_fee_percent",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"百分比手续费(%)"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"0-100",..._})}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"handling_fee_fixed",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"固定手续费"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"0",..._})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:C.control,name:"payment",render:({field:_})=>e.jsxs(j,{children:[e.jsx(f,{children:"支付接口"}),e.jsxs(B,{value:_.value,onValueChange:_.onChange,children:[e.jsx(v,{children:e.jsx(q,{children:e.jsx(G,{placeholder:"请选择支付接口"})})}),e.jsx(U,{children:r.map(y=>e.jsx(z,{value:y,children:y},y))})]}),e.jsx(k,{})]})}),h.map(_=>e.jsx(g,{control:C.control,name:`config.${_.field_name}`,render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:_.label}),e.jsx(v,{children:br(_,y)}),e.jsx(k,{})]})},_.field_name)),e.jsxs(Ee,{className:"gap-2",children:[e.jsx(it,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",disabled:d,className:b(d&&"cursor-not-allowed opacity-50"),children:d?"保存中...":"提交"})]})]})})]})]})}function I({column:s,title:t,tooltip:a,className:n}){return s.getCanSort()?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(T,{variant:"ghost",size:"default",className:b("-ml-3 flex h-8 items-center gap-2 text-nowrap font-medium hover:bg-muted/60",n),onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:[e.jsx("span",{children:t}),a&&e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(_a,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(ee,{children:a})]})}),s.getIsSorted()==="asc"?e.jsx(Ht,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(Kt,{className:"h-4 w-4 text-foreground/70"}):e.jsx(Xi,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-foreground/70"})]})})}):e.jsxs("div",{className:b("flex items-center space-x-1 text-nowrap py-2 font-medium text-muted-foreground",n),children:[e.jsx("span",{children:t}),a&&e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx(_a,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(ee,{children:a})]})})]})}const Mu=eo,zu=so,Ou=to,Nr=o.forwardRef(({className:s,...t},a)=>e.jsx(Vn,{className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t,ref:a}));Nr.displayName=Vn.displayName;const wr=o.forwardRef(({className:s,...t},a)=>e.jsxs(Ou,{children:[e.jsx(Nr,{}),e.jsx(Rn,{ref:a,className:b("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...t})]}));wr.displayName=Rn.displayName;const _r=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col space-y-2 text-center sm:text-left",s),...t});_r.displayName="AlertDialogHeader";const Cr=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});Cr.displayName="AlertDialogFooter";const Sr=o.forwardRef(({className:s,...t},a)=>e.jsx(En,{ref:a,className:b("text-lg font-semibold",s),...t}));Sr.displayName=En.displayName;const kr=o.forwardRef(({className:s,...t},a)=>e.jsx(Fn,{ref:a,className:b("text-sm text-muted-foreground",s),...t}));kr.displayName=Fn.displayName;const Tr=o.forwardRef(({className:s,...t},a)=>e.jsx(Mn,{ref:a,className:b(zs(),s),...t}));Tr.displayName=Mn.displayName;const Dr=o.forwardRef(({className:s,...t},a)=>e.jsx(zn,{ref:a,className:b(zs({variant:"outline"}),"mt-2 sm:mt-0",s),...t}));Dr.displayName=zn.displayName;function Ye({onConfirm:s,children:t,title:a="确认操作",description:n="确定要执行此操作吗?",cancelText:l="取消",confirmText:c="确认",variant:d="default",className:x}){return e.jsxs(Mu,{children:[e.jsx(zu,{asChild:!0,children:t}),e.jsxs(wr,{className:b("sm:max-w-[425px]",x),children:[e.jsxs(_r,{children:[e.jsx(Sr,{children:a}),e.jsx(kr,{children:n})]}),e.jsxs(Cr,{children:[e.jsx(Dr,{asChild:!0,children:e.jsx(T,{variant:"outline",children:l})}),e.jsx(Tr,{asChild:!0,children:e.jsx(T,{variant:d,onClick:s,children:c})})]})]})]})}const Pr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M11.29 15.29a2 2 0 0 0-.12.15a.8.8 0 0 0-.09.18a.6.6 0 0 0-.06.18a1.4 1.4 0 0 0 0 .2a.84.84 0 0 0 .08.38a.9.9 0 0 0 .54.54a.94.94 0 0 0 .76 0a.9.9 0 0 0 .54-.54A1 1 0 0 0 13 16a1 1 0 0 0-.29-.71a1 1 0 0 0-1.42 0M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8 8 0 0 1-8 8m0-13a3 3 0 0 0-2.6 1.5a1 1 0 1 0 1.73 1A1 1 0 0 1 12 9a1 1 0 0 1 0 2a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-.18A3 3 0 0 0 12 7"})}),Lu=({refetch:s,isSortMode:t=!1})=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:t?"cursor-move":"opacity-0",children:e.jsx(Dt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(I,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(O,{variant:"outline",children:a.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:a})=>e.jsx(I,{column:a,title:"启用"}),cell:({row:a})=>e.jsx(H,{defaultChecked:a.getValue("enable"),onCheckedChange:async()=>{const{data:n}=await Ac({id:a.original.id});n||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:a})=>e.jsx(I,{column:a,title:"显示名称"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:a.getValue("name")})}),enableSorting:!1,size:200},{accessorKey:"payment",header:({column:a})=>e.jsx(I,{column:a,title:"支付接口"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:a.getValue("payment")})}),enableSorting:!1,size:200},{accessorKey:"notify_url",header:({column:a})=>e.jsxs("div",{className:"flex items-center",children:[e.jsx(I,{column:a,title:"通知地址"}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{className:"ml-1",children:e.jsx(Pr,{className:"h-4 w-4"})}),e.jsx(ee,{children:"支付网关将会把数据通知到本地址,请通过防火墙放行本地址。"})]})})]}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[300px] truncate font-medium",children:a.getValue("notify_url")})}),enableSorting:!1,size:3e3},{id:"actions",header:({column:a})=>e.jsx(I,{className:"justify-end",column:a,title:"操作"}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(yr,{refetch:s,dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:a.original}),e.jsx(Ye,{title:"删除确认",description:"确定要删除该支付方式吗?此操作无法撤销。",onConfirm:async()=>{const{data:n}=await $c({id:a.original.id});n&&s()},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function $u({table:s,refetch:t,saveOrder:a,isSortMode:n}){const l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽支付方式进行排序,完成后点击保存"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(yr,{refetch:t}),e.jsx(S,{placeholder:"搜索支付方式...",value:s.getColumn("name")?.getFilterValue()??"",onChange:c=>s.getColumn("name")?.setFilterValue(c.target.value),className:"h-8 w-[250px]"}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:n?"default":"outline",onClick:a,size:"sm",children:n?"保存排序":"编辑排序"})})]})}function Au(){const[s,t]=o.useState([]),[a,n]=o.useState([]),[l,c]=o.useState(!1),[d,x]=o.useState([]),[r,i]=o.useState({"drag-handle":!1}),[h,D]=o.useState({pageSize:20,pageIndex:0}),{refetch:C}=Q({queryKey:["paymentList"],queryFn:async()=>{const{data:N}=await Mc();return x(N?.map(P=>({...P,enable:!!P.enable}))||[]),N}});o.useEffect(()=>{i({"drag-handle":l}),D({pageSize:l?99999:10,pageIndex:0})},[l]);const m=(N,P)=>{l&&(N.dataTransfer.setData("text/plain",P.toString()),N.currentTarget.classList.add("opacity-50"))},w=(N,P)=>{if(!l)return;N.preventDefault(),N.currentTarget.classList.remove("bg-muted");const p=parseInt(N.dataTransfer.getData("text/plain"));if(p===P)return;const V=[...d],[A]=V.splice(p,1);V.splice(P,0,A),x(V)},_=async()=>{l?Hc({ids:d.map(N=>N.id)}).then(()=>{C(),c(!1),L.success("排序保存成功")}):c(!0)},y=Le({data:d,columns:Lu({refetch:C,isSortMode:l}),state:{sorting:a,columnFilters:s,columnVisibility:r,pagination:h},onSortingChange:n,onColumnFiltersChange:t,onColumnVisibilityChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),initialState:{columnPinning:{right:["actions"]}},pageCount:l?1:void 0});return e.jsx(Ge,{table:y,toolbar:N=>e.jsx($u,{table:N,refetch:C,saveOrder:_,isSortMode:l}),draggable:l,onDragStart:m,onDragEnd:N=>N.currentTarget.classList.remove("opacity-50"),onDragOver:N=>{N.preventDefault(),N.currentTarget.classList.add("bg-muted")},onDragLeave:N=>N.currentTarget.classList.remove("bg-muted"),onDrop:w,showPagination:!l})}function Hu(){return e.jsxs(be,{children:[e.jsxs(ye,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{children:[e.jsx("header",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"支付配置"})}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置支付方式,包括支付宝、微信等。"})]})}),e.jsx("section",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Au,{})})]})]})}const Ku=Object.freeze(Object.defineProperty({__proto__:null,default:Hu},Symbol.toStringTag,{value:"Module"}));function qu({themeKey:s,themeInfo:t}){const[a,n]=o.useState(!1),[l,c]=o.useState(!1),[d,x]=o.useState(!1),r=ae({defaultValues:t.configs.reduce((D,C)=>(D[C.field_name]="",D),{})}),i=async()=>{c(!0),Nc(s).then(({data:D})=>{Object.entries(D).forEach(([C,m])=>{r.setValue(C,m)})}).finally(()=>{c(!1)})},h=async D=>{x(!0),wc(s,D).then(()=>{L.success("保存成功"),n(!1)}).finally(()=>{x(!1)})};return e.jsxs(ue,{open:a,onOpenChange:D=>{n(D),D?i():r.reset()},children:[e.jsx(Re,{asChild:!0,children:e.jsx(T,{variant:"outline",children:"主题设置"})}),e.jsxs(ce,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsxs(xe,{children:["配置",t.name,"主题"]}),e.jsx(Se,{children:"修改主题的样式、布局和其他显示选项。"})]}),l?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(ea,{className:"h-6 w-6 animate-spin"})}):e.jsx(oe,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(h),className:"space-y-4",children:[t.configs.map(D=>e.jsx(g,{control:r.control,name:D.field_name,render:({field:C})=>e.jsxs(j,{children:[e.jsx(f,{children:D.label}),e.jsx(v,{children:br(D,C)}),e.jsx(k,{})]})},D.field_name)),e.jsxs(Ee,{className:"mt-6 gap-2",children:[e.jsx(T,{type:"button",variant:"secondary",onClick:()=>n(!1),children:"取消"}),e.jsx(T,{type:"submit",loading:d,children:"保存"})]})]})})]})]})}function Uu(){const[s,t]=o.useState(null),[a,n]=o.useState(!1),[l,c]=o.useState(!1),[d,x]=o.useState(!1),[r,i]=o.useState(null),h=o.useRef(null),[D,C]=o.useState(0),{data:m,isLoading:w,refetch:_}=Q({queryKey:["themeList"],queryFn:async()=>{const{data:F}=await yc();return F}}),y=async F=>{t(F),Sc({frontend_theme:F}).then(()=>{L.success("主题切换成功"),_()}).finally(()=>{t(null)})},N=async F=>{if(!F.name.endsWith(".zip")){L.error("只支持上传 ZIP 格式的主题文件");return}n(!0),_c(F).then(()=>{L.success("主题上传成功"),c(!1),_()}).finally(()=>{n(!1),h.current&&(h.current.value="")})},P=F=>{F.preventDefault(),F.stopPropagation(),F.type==="dragenter"||F.type==="dragover"?x(!0):F.type==="dragleave"&&x(!1)},p=F=>{F.preventDefault(),F.stopPropagation(),x(!1),F.dataTransfer.files&&F.dataTransfer.files[0]&&N(F.dataTransfer.files[0])},V=()=>{r&&C(F=>F===0?r.images.length-1:F-1)},A=()=>{r&&C(F=>F===r.images.length-1?0:F+1)},$=(F,Y)=>{C(0),i({name:F,images:Y})};return e.jsxs(be,{children:[e.jsxs(ye,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"主题配置"})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-muted-foreground",children:"主题配置,包括主题色、字体大小等。如果你采用前后分离的方式部署V2board,那么主题配置将不会生效。"}),e.jsxs(T,{onClick:()=>c(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(Ca,{className:"mr-2 h-4 w-4"}),"上传主题"]})]})]}),e.jsx("section",{className:"grid gap-6 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3",children:w?e.jsxs(e.Fragment,{children:[e.jsx(za,{}),e.jsx(za,{})]}):m?.themes&&Object.entries(m.themes).map(([F,Y])=>e.jsx(Ie,{className:"group relative overflow-hidden transition-all hover:shadow-md",style:{backgroundImage:Y.background_url?`url(${Y.background_url})`:"none",backgroundSize:"cover",backgroundPosition:"center"},children:e.jsxs("div",{className:b("relative z-10 h-full transition-colors",Y.background_url?"group-hover:from-background/98 bg-gradient-to-t from-background/95 via-background/80 to-background/60 backdrop-blur-[1px] group-hover:via-background/90 group-hover:to-background/70":"bg-background"),children:[!!Y.can_delete&&e.jsx("div",{className:"absolute right-2 top-2",children:e.jsx(Ye,{title:"删除主题",description:"确定要删除该主题吗?删除后无法恢复。",confirmText:"删除",variant:"destructive",onConfirm:async()=>{if(F===m?.active){L.error("不能删除当前使用的主题");return}t(F),Cc(F).then(()=>{L.success("主题删除成功"),_()}).finally(()=>{t(null)})},children:e.jsx(T,{disabled:s===F,loading:s===F,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(ns,{className:"h-4 w-4"})})})}),e.jsxs(ze,{children:[e.jsx(Je,{children:Y.name}),e.jsx(Zs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{children:Y.description}),Y.version&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:["版本: ",Y.version]})]})})]}),e.jsxs(Oe,{className:"flex items-center justify-end space-x-3",children:[Y.images&&Array.isArray(Y.images)&&Y.images.length>0&&e.jsx(T,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>$(Y.name,Y.images),children:e.jsx(ao,{className:"h-4 w-4"})}),e.jsx(qu,{themeKey:F,themeInfo:Y}),e.jsx(T,{onClick:()=>y(F),disabled:s===F||F===m.active,loading:s===F,variant:F===m.active?"secondary":"default",children:F===m.active?"当前主题":"激活主题"})]})]})},F))}),e.jsx(ue,{open:l,onOpenChange:c,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(je,{children:[e.jsx(xe,{children:"上传主题"}),e.jsx(Se,{children:"请上传一个有效的主题压缩包(.zip 格式)。主题包应包含完整的主题文件结构。"})]}),e.jsxs("div",{className:b("relative mt-4 flex h-64 flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted-foreground/25 px-5 py-10 text-center transition-colors",d&&"border-primary/50 bg-muted/50"),onDragEnter:P,onDragLeave:P,onDragOver:P,onDrop:p,children:[e.jsx("input",{type:"file",ref:h,className:"hidden",accept:".zip",onChange:F=>{const Y=F.target.files?.[0];Y&&N(Y)}}),a?e.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[e.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-b-2 border-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"正在上传..."})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"rounded-full border-2 border-muted-foreground/25 p-3",children:e.jsx(Ca,{className:"h-6 w-6 text-muted-foreground/50"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:["将主题文件拖放到此处,或者",e.jsx("button",{type:"button",onClick:()=>h.current?.click(),className:"mx-1 text-primary hover:underline",children:"点击选择"})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"支持 .zip 格式的主题包"})]})]})})]})]})}),e.jsx(ue,{open:!!r,onOpenChange:F=>{F||(i(null),C(0))},children:e.jsxs(ce,{className:"max-w-4xl",children:[e.jsxs(je,{children:[e.jsxs(xe,{children:[r?.name," 主题预览"]}),e.jsx(Se,{className:"text-center",children:r&&`${D+1} / ${r.images.length}`})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"aspect-[16/9] overflow-hidden rounded-lg border bg-muted",children:r?.images[D]&&e.jsx("img",{src:r.images[D],alt:`${r.name} 预览图 ${D+1}`,className:"h-full w-full object-contain"})}),r&&r.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(T,{variant:"outline",size:"icon",className:"absolute left-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:V,children:e.jsx(no,{className:"h-4 w-4"})}),e.jsx(T,{variant:"outline",size:"icon",className:"absolute right-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:A,children:e.jsx(ro,{className:"h-4 w-4"})})]})]}),r&&r.images.length>1&&e.jsx("div",{className:"mt-4 flex gap-2 overflow-x-auto pb-2",children:r.images.map((F,Y)=>e.jsx("button",{onClick:()=>C(Y),className:b("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",D===Y?"border-primary":"border-transparent"),children:e.jsx("img",{src:F,alt:`缩略图 ${Y+1}`,className:"h-full w-full object-cover"})},Y))})]})})]})]})}function za(){return e.jsxs(Ie,{children:[e.jsxs(ze,{children:[e.jsx(Fe,{className:"h-6 w-[200px]"}),e.jsx(Fe,{className:"h-4 w-[300px]"})]}),e.jsxs(Oe,{className:"flex items-center justify-end space-x-3",children:[e.jsx(Fe,{className:"h-10 w-[100px]"}),e.jsx(Fe,{className:"h-10 w-[100px]"})]})]})}const Bu=Object.freeze(Object.defineProperty({__proto__:null,default:Uu},Symbol.toStringTag,{value:"Module"})),da=o.forwardRef(({className:s,value:t,onChange:a,...n},l)=>{const[c,d]=o.useState("");o.useEffect(()=>{if(c.includes(",")){const r=new Set([...t,...c.split(",").map(i=>i.trim())]);a(Array.from(r)),d("")}},[c,a,t]);const x=()=>{if(c){const r=new Set([...t,c]);a(Array.from(r)),d("")}};return e.jsxs("div",{className:b(" has-[:focus-visible]:outline-none has-[:focus-visible]:ring-1 has-[:focus-visible]:ring-neutral-950 dark:has-[:focus-visible]:ring-neutral-300 flex w-full flex-wrap gap-2 rounded-md border border-input shadow-sm px-3 py-2 text-sm ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",s),children:[t.map(r=>e.jsxs(O,{variant:"secondary",children:[r,e.jsx(W,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{a(t.filter(i=>i!==r))},children:e.jsx(qt,{className:"w-3"})})]},r)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:c,onChange:r=>d(r.target.value),onKeyDown:r=>{r.key==="Enter"||r.key===","?(r.preventDefault(),x()):r.key==="Backspace"&&c.length===0&&t.length>0&&(r.preventDefault(),a(t.slice(0,-1)))},...n,ref:l})]})});da.displayName="InputTags";const Gu=u.object({id:u.number().nullable(),title:u.string().min(1).max(250),content:u.string().min(1),show:u.boolean(),tags:u.array(u.string()),img_url:u.string().nullable()}),Yu={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function Ir({refetch:s,dialogTrigger:t,type:a="add",defaultFormValues:n=Yu}){const[l,c]=o.useState(!1),d=ae({resolver:ie(Gu),defaultValues:n,mode:"onChange",shouldFocusError:!0}),x=new sa({html:!0});return e.jsx(oe,{...d,children:e.jsxs(ue,{onOpenChange:c,open:l,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"})," ",e.jsx("div",{children:"添加公告"})]})}),e.jsxs(ce,{className:"sm:max-w-[1025px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:a==="add"?"添加公告":"编辑公告"}),e.jsx(Se,{})]}),e.jsx(g,{control:d.control,name:"title",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"标题"}),e.jsx("div",{className:"relative ",children:e.jsx(v,{children:e.jsx(S,{placeholder:"请输入公告标题",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"content",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"公告内容"}),e.jsx(v,{children:e.jsx(ta,{style:{height:"500px"},value:r.value,renderHTML:i=>x.render(i),onChange:({text:i})=>{r.onChange(i)}})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"img_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"公告背景"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsx(S,{type:"text",placeholder:"请输入公告背景图片URL",...r,value:r.value||""})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"show",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"显示"}),e.jsx("div",{className:"relative py-2",children:e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:r.onChange})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"tags",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"节点标签"}),e.jsx(v,{children:e.jsx(da,{value:r.value,onChange:r.onChange,placeholder:"输入后回车添加标签",className:"w-full"})}),e.jsx(k,{})]})}),e.jsxs(Ee,{children:[e.jsx(it,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",onClick:r=>{r.preventDefault(),d.handleSubmit(async i=>{try{(await qc(i)).data&&(await s(),c(!1))}catch(h){console.error("Failed to save notice:",h)}})()},children:"提交"})]})]})]})})}function Wu({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between space-x-2 ",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(Ir,{refetch:t}),e.jsx(S,{placeholder:"搜索公告标题...",value:s.getColumn("title")?.getFilterValue()??"",onChange:n=>s.getColumn("title")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),e.jsx("div",{className:"flex items-center space-x-2"})]})}const Ju=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"ID"}),cell:({row:t})=>e.jsx(O,{variant:"outline",className:"font-mono",children:t.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"显示状态"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(H,{defaultChecked:t.getValue("show"),onCheckedChange:async()=>{const{data:a}=await Bc({id:t.original.id});a||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:t})=>e.jsx(I,{column:t,title:"标题"}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[500px] items-center",children:e.jsx("span",{className:"truncate font-medium",children:t.getValue("title")})}),enableSorting:!1,size:6e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(Ir,{refetch:s,dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:t.original}),e.jsx(Ye,{title:"删除确认",description:"确定要删除该条公告吗?此操作无法撤销。",onConfirm:async()=>{Uc({id:t.original.id}).then(()=>{L.success("删除成功"),s()})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function Qu(){const[s,t]=o.useState({}),[a,n]=o.useState({}),[l,c]=o.useState([]),[d,x]=o.useState([]),{data:r,isLoading:i,refetch:h}=Q({queryKey:["notices"],queryFn:async()=>{const{data:C}=await Kc();return C}}),D=Le({data:r??[],columns:Ju(h),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:D,toolbar:C=>e.jsx(Wu,{table:C,refetch:h})})}function Zu(){return e.jsxs(be,{children:[e.jsxs(ye,{className:"flex items-center justify-between",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"公告管理"})}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置公告,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Qu,{})})]})]})}const Xu=Object.freeze(Object.defineProperty({__proto__:null,default:Zu},Symbol.toStringTag,{value:"Module"})),ex=u.object({id:u.number().nullable(),language:u.string().max(250),category:u.string().max(250),title:u.string().min(1).max(250),body:u.string().min(1),show:u.boolean()}),sx={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function Vr({refreshData:s,dialogTrigger:t,type:a="add",defaultFormValues:n=sx}){const[l,c]=o.useState(!1),d=ae({resolver:ie(ex),defaultValues:n,mode:"onChange",shouldFocusError:!0}),x=new sa({html:!0});return o.useEffect(()=>{l&&n.id&&Yc(n.id).then(({data:r})=>{d.reset(r)})},[n.id,d,l]),e.jsxs(ue,{onOpenChange:c,open:l,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"})," ",e.jsx("div",{children:"添加知识"})]})}),e.jsxs(ce,{className:"sm:max-w-[1025px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:a==="add"?"添加知识":"编辑知识"}),e.jsx(Se,{})]}),e.jsxs(oe,{...d,children:[e.jsx(g,{control:d.control,name:"title",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"标题"}),e.jsx("div",{className:"relative ",children:e.jsx(v,{children:e.jsx(S,{placeholder:"请输入知识标题",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"category",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"分类"}),e.jsx("div",{className:"relative ",children:e.jsx(v,{children:e.jsx(S,{placeholder:"请输入分类,分类将会自动归类",...r})})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"language",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"语言"}),e.jsx(v,{children:e.jsxs(B,{value:r.value,onValueChange:r.onChange,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择语言"})}),e.jsx(U,{children:[{field:"English",value:"en-US"},{field:"日本語",value:"ja-JP"},{field:"한국어",value:"ko-KR"},{field:"Tiếng Việt",value:"vi-VN"},{field:"简体中文",value:"zh-CN"},{field:"繁體中文",value:"zh-TW"}].map(i=>e.jsx(z,{value:i.value,className:"cursor-pointer",children:i.field},i.value))})]})})]})}),e.jsx(g,{control:d.control,name:"body",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"内容"}),e.jsx(v,{children:e.jsx(ta,{style:{height:"500px"},value:r.value,renderHTML:i=>x.render(i),onChange:({text:i})=>{r.onChange(i)}})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"show",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"显示"}),e.jsx("div",{className:"relative py-2",children:e.jsx(v,{children:e.jsx(H,{checked:r.value,onCheckedChange:r.onChange})})}),e.jsx(k,{})]})}),e.jsxs(Ee,{children:[e.jsx(it,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",onClick:()=>{d.handleSubmit(r=>{Wc(r).then(({data:i})=>{i&&(d.reset(),L.success("操作成功"),c(!1),s())})})()},children:"提交"})]})]})]})]})}function tx({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(c=>l.has(c.value)).map(c=>e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(hs,{children:[e.jsx(Cs,{placeholder:t}),e.jsxs(js,{children:[e.jsx(Ss,{children:"No results found."}),e.jsx(Ve,{children:a.map(c=>{const d=l.has(c.value);return e.jsxs(ve,{onSelect:()=>{d?l.delete(c.value):l.add(c.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},children:[e.jsx("div",{className:b("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ns,{className:b("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:c.label}),n?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(c.value)})]},c.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ls,{}),e.jsx(Ve,{children:e.jsx(ve,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function ax({table:s,refetch:t,saveOrder:a,isSortMode:n}){const l=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽知识条目进行排序,完成后点击保存"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vr,{refreshData:t}),e.jsx(S,{placeholder:"搜索知识...",value:s.getColumn("title")?.getFilterValue()??"",onChange:c=>s.getColumn("title")?.setFilterValue(c.target.value),className:"h-8 w-[250px]"}),s.getColumn("category")&&e.jsx(tx,{column:s.getColumn("category"),title:"分类",options:Array.from(new Set(s.getCoreRowModel().rows.map(c=>c.getValue("category")))).map(c=>({label:c,value:c}))}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:n?"default":"outline",onClick:a,size:"sm",children:n?"保存排序":"编辑排序"})})]})}const nx=({refetch:s,isSortMode:t=!1})=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:t?"cursor-move":"opacity-0",children:e.jsx(Dt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:a})=>e.jsx(I,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(O,{variant:"outline",className:"justify-center",children:a.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:a})=>e.jsx(I,{column:a,title:"状态"}),cell:({row:a})=>e.jsx("div",{className:"flex items-center",children:e.jsx(H,{defaultChecked:a.getValue("show"),onCheckedChange:async()=>{Qc({id:a.original.id}).then(({data:n})=>{n||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:a})=>e.jsx(I,{column:a,title:"标题"}),cell:({row:a})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"line-clamp-2 font-medium",children:a.getValue("title")})}),enableSorting:!0,size:600},{accessorKey:"category",header:({column:a})=>e.jsx(I,{column:a,title:"分类"}),cell:({row:a})=>e.jsx(O,{variant:"secondary",className:"max-w-[180px] truncate",children:a.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:a})=>e.jsx(I,{className:"justify-end",column:a,title:"操作"}),cell:({row:a})=>e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx(Vr,{refreshData:s,dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),type:"edit",defaultFormValues:a.original}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该知识库记录,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Jc({id:a.original.id}).then(({data:n})=>{n&&(L.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]}),size:100}];function rx(){const[s,t]=o.useState([]),[a,n]=o.useState([]),[l,c]=o.useState(!1),[d,x]=o.useState([]),[r,i]=o.useState({"drag-handle":!1}),[h,D]=o.useState({pageSize:20,pageIndex:0}),{refetch:C,isLoading:m,data:w}=Q({queryKey:["knowledge"],queryFn:async()=>{const{data:p}=await Gc();return x(p||[]),p}});o.useEffect(()=>{i({"drag-handle":l}),D({pageSize:l?99999:10,pageIndex:0})},[l]);const _=(p,V)=>{l&&(p.dataTransfer.setData("text/plain",V.toString()),p.currentTarget.classList.add("opacity-50"))},y=(p,V)=>{if(!l)return;p.preventDefault(),p.currentTarget.classList.remove("bg-muted");const A=parseInt(p.dataTransfer.getData("text/plain"));if(A===V)return;const $=[...d],[F]=$.splice(A,1);$.splice(V,0,F),x($)},N=async()=>{Zc({ids:d.map(p=>p.id)}).then(()=>{C(),c(!1),L.success("排序保存成功")})},P=Le({data:d,columns:nx({refetch:C,isSortMode:l}),state:{sorting:a,columnFilters:s,columnVisibility:r,pagination:h},onSortingChange:n,onColumnFiltersChange:t,onColumnVisibilityChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:P,toolbar:p=>e.jsx(ax,{table:p,refetch:C,saveOrder:N,isSortMode:l}),draggable:l,onDragStart:_,onDragEnd:p=>p.currentTarget.classList.remove("opacity-50"),onDragOver:p=>{p.preventDefault(),p.currentTarget.classList.add("bg-muted")},onDragLeave:p=>p.currentTarget.classList.remove("bg-muted"),onDrop:y,showPagination:!l})}function lx(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight mb-2",children:"知识库管理"}),e.jsx("p",{className:"text-muted-foreground",children:"在这里可以配置知识库,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(rx,{})})]})]})}const ix=Object.freeze(Object.defineProperty({__proto__:null,default:lx},Symbol.toStringTag,{value:"Module"}));function ox(s,t){const[a,n]=o.useState(s);return o.useEffect(()=>{const l=setTimeout(()=>n(s),t);return()=>{clearTimeout(l)}},[s,t]),a}function Lt(s,t){if(s.length===0)return{};if(!t)return{"":s};const a={};return s.forEach(n=>{const l=n[t]||"";a[l]||(a[l]=[]),a[l].push(n)}),a}function cx(s,t){const a=JSON.parse(JSON.stringify(s));for(const[n,l]of Object.entries(a))a[n]=l.filter(c=>!t.find(d=>d.value===c.value));return a}function dx(s,t){for(const[,a]of Object.entries(s))if(a.some(n=>t.find(l=>l.value===n.value)))return!0;return!1}const Rr=o.forwardRef(({className:s,...t},a)=>lo(l=>l.filtered.count===0)?e.jsx("div",{ref:a,className:b("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...t}):null);Rr.displayName="CommandEmpty";const at=o.forwardRef(({value:s,onChange:t,placeholder:a,defaultOptions:n=[],options:l,delay:c,onSearch:d,loadingIndicator:x,emptyIndicator:r,maxSelected:i=Number.MAX_SAFE_INTEGER,onMaxSelected:h,hidePlaceholderWhenSelected:D,disabled:C,groupBy:m,className:w,badgeClassName:_,selectFirstItem:y=!0,creatable:N=!1,triggerSearchOnFocus:P=!1,commandProps:p,inputProps:V,hideClearAllButton:A=!1},$)=>{const F=o.useRef(null),[Y,Ds]=o.useState(!1),$s=o.useRef(!1),[ga,fa]=o.useState(!1),[J,As]=o.useState(s||[]),[fs,pa]=o.useState(Lt(n,m)),[cs,Mt]=o.useState(""),Hs=ox(cs,c||500);o.useImperativeHandle($,()=>({selectedValue:[...J],input:F.current,focus:()=>F.current?.focus()}),[J]);const ot=o.useCallback(K=>{const Z=J.filter(Ce=>Ce.value!==K.value);As(Z),t?.(Z)},[t,J]),nl=o.useCallback(K=>{const Z=F.current;Z&&((K.key==="Delete"||K.key==="Backspace")&&Z.value===""&&J.length>0&&(J[J.length-1].fixed||ot(J[J.length-1])),K.key==="Escape"&&Z.blur())},[ot,J]);o.useEffect(()=>{s&&As(s)},[s]),o.useEffect(()=>{if(!l||d)return;const K=Lt(l||[],m);JSON.stringify(K)!==JSON.stringify(fs)&&pa(K)},[n,l,m,d,fs]),o.useEffect(()=>{const K=async()=>{fa(!0);const Ce=await d?.(Hs);pa(Lt(Ce||[],m)),fa(!1)};(async()=>{!d||!Y||(P&&await K(),Hs&&await K())})()},[Hs,m,Y,P]);const rl=()=>{if(!N||dx(fs,[{value:cs,label:cs}])||J.find(Z=>Z.value===cs))return;const K=e.jsx(ve,{value:cs,className:"cursor-pointer",onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation()},onSelect:Z=>{if(J.length>=i){h?.(J.length);return}Mt("");const Ce=[...J,{value:Z,label:Z}];As(Ce),t?.(Ce)},children:`Create "${cs}"`});if(!d&&cs.length>0||d&&Hs.length>0&&!ga)return K},ll=o.useCallback(()=>{if(r)return d&&!N&&Object.keys(fs).length===0?e.jsx(ve,{value:"-",disabled:!0,children:r}):e.jsx(Rr,{children:r})},[N,r,d,fs]),il=o.useMemo(()=>cx(fs,J),[fs,J]),ol=o.useCallback(()=>{if(p?.filter)return p.filter;if(N)return(K,Z)=>K.toLowerCase().includes(Z.toLowerCase())?1:-1},[N,p?.filter]),cl=o.useCallback(()=>{const K=J.filter(Z=>Z.fixed);As(K),t?.(K)},[t,J]);return e.jsxs(hs,{...p,onKeyDown:K=>{nl(K),p?.onKeyDown?.(K)},className:b("h-auto overflow-visible bg-transparent",p?.className),shouldFilter:p?.shouldFilter!==void 0?p.shouldFilter:!d,filter:ol(),children:[e.jsx("div",{className:b("rounded-md border border-input text-sm ring-offset-background focus-within:ring-1 focus-within:ring-ring ",{"px-3 py-2":J.length!==0,"cursor-text":!C&&J.length!==0},w),onClick:()=>{C||F.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[J.map(K=>e.jsxs(O,{className:b("data-[disabled]:bg-muted-foreground data-[disabled]:text-muted data-[disabled]:hover:bg-muted-foreground","data-[fixed]:bg-muted-foreground data-[fixed]:text-muted data-[fixed]:hover:bg-muted-foreground",_),"data-fixed":K.fixed,"data-disabled":C||void 0,children:[K.label,e.jsx("button",{className:b("ml-1 rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",(C||K.fixed)&&"hidden"),onKeyDown:Z=>{Z.key==="Enter"&&ot(K)},onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation()},onClick:()=>ot(K),children:e.jsx(qt,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},K.value)),e.jsx(we.Input,{...V,ref:F,value:cs,disabled:C,onValueChange:K=>{Mt(K),V?.onValueChange?.(K)},onBlur:K=>{$s.current===!1&&Ds(!1),V?.onBlur?.(K)},onFocus:K=>{Ds(!0),P&&d?.(Hs),V?.onFocus?.(K)},placeholder:D&&J.length!==0?"":a,className:b("flex-1 bg-transparent outline-none placeholder:text-muted-foreground",{"w-full":D,"px-3 py-2":J.length===0,"ml-1":J.length!==0},V?.className)}),e.jsx("button",{type:"button",onClick:cl,className:b((A||C||J.length<1||J.filter(K=>K.fixed).length===J.length)&&"hidden"),children:e.jsx(qt,{})})]})}),e.jsx("div",{className:"relative",children:Y&&e.jsx(js,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{$s.current=!1},onMouseEnter:()=>{$s.current=!0},onMouseUp:()=>{F.current?.focus()},children:ga?e.jsx(e.Fragment,{children:x}):e.jsxs(e.Fragment,{children:[ll(),rl(),!y&&e.jsx(ve,{value:"-",className:"hidden"}),Object.entries(il).map(([K,Z])=>e.jsx(Ve,{heading:K,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:Z.map(Ce=>e.jsx(ve,{value:Ce.value,disabled:Ce.disable,onMouseDown:Ks=>{Ks.preventDefault(),Ks.stopPropagation()},onSelect:()=>{if(J.length>=i){h?.(J.length);return}Mt("");const Ks=[...J,Ce];As(Ks),t?.(Ks)},className:b("cursor-pointer",Ce.disable&&"cursor-default text-muted-foreground"),children:Ce.label},Ce.value))})},K))]})})})]})});at.displayName="MultipleSelector";const ux=u.object({id:u.number().optional(),name:u.string().min(2,"组名至少需要2个字符").max(50,"组名不能超过50个字符").regex(/^[a-zA-Z0-9\u4e00-\u9fa5_-]+$/,"组名只能包含字母、数字、中文、下划线和连字符")});function Ft({refetch:s,dialogTrigger:t,defaultValues:a={name:""},type:n="add"}){const l=ae({resolver:ie(ux),defaultValues:a,mode:"onChange"}),[c,d]=o.useState(!1),[x,r]=o.useState(!1),i=async h=>{r(!0),Vc(h).then(()=>{L.success(n==="edit"?"更新成功":"创建成功"),s&&s(),l.reset(),d(!1)}).finally(()=>{r(!1)})};return e.jsxs(ue,{open:c,onOpenChange:d,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("span",{children:"添加权限组"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:n==="edit"?"编辑权限组":"创建权限组"}),e.jsx(Se,{children:n==="edit"?"修改权限组信息,更新后会立即生效。":"创建新的权限组,可以为不同的用户分配不同的权限。"})]}),e.jsx(oe,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(i),className:"space-y-4",children:[e.jsx(g,{control:l.control,name:"name",render:({field:h})=>e.jsxs(j,{children:[e.jsx(f,{children:"组名称"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入权限组名称",...h,className:"w-full"})}),e.jsx(E,{children:"权限组名称用于标识不同的用户组,建议使用有意义的名称。"}),e.jsx(k,{})]})}),e.jsxs(Ee,{className:"gap-2",children:[e.jsx(it,{asChild:!0,children:e.jsx(T,{type:"button",variant:"outline",children:"取消"})}),e.jsxs(T,{type:"submit",disabled:x||!l.formState.isValid,children:[x&&e.jsx(ea,{className:"mr-2 h-4 w-4 animate-spin"}),n==="edit"?"更新":"创建"]})]})]})})]})]})}const Er=o.createContext(void 0);function xx({children:s,refetch:t}){const[a,n]=o.useState(!1),[l,c]=o.useState(null),[d,x]=o.useState(pe.Shadowsocks);return e.jsx(Er.Provider,{value:{isOpen:a,setIsOpen:n,editingServer:l,setEditingServer:c,serverType:d,setServerType:x,refetch:t},children:s})}function Fr(){const s=o.useContext(Er);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function $t({dialogTrigger:s,value:t,setValue:a,templateType:n}){o.useEffect(()=>{console.log(t)},[t]);const[l,c]=o.useState(!1),[d,x]=o.useState(()=>{if(!t||Object.keys(t).length===0)return"";try{return JSON.stringify(t,null,2)}catch{return""}}),[r,i]=o.useState(null),h=y=>{if(!y)return null;try{const N=JSON.parse(y);return typeof N!="object"||N===null?"配置必须是一个JSON对象":null}catch{return"无效的JSON格式"}},D={tcp:{label:"TCP",content:{acceptProxyProtocol:!1,header:{type:"none"}}},"tcp-http":{label:"TCP + HTTP",content:{acceptProxyProtocol:!1,header:{type:"http",request:{version:"1.1",method:"GET",path:["/"],headers:{Host:["www.example.com"]}},response:{version:"1.1",status:"200",reason:"OK"}}}},grpc:{label:"gRPC",content:{serviceName:"GunService"}},ws:{label:"WebSocket",content:{path:"/",headers:{Host:"v2ray.com"}}}},C=()=>{switch(n){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];default:return[]}},m=()=>{const y=h(d||"");if(y){L.error(y);return}try{if(!d){a(null),c(!1);return}a(JSON.parse(d)),c(!1)}catch{L.error("保存时发生错误")}},w=y=>{x(y),i(h(y))},_=y=>{const N=D[y];if(N){const P=JSON.stringify(N.content,null,2);x(P),i(null)}};return o.useEffect(()=>{l&&console.log(t)},[l,t]),o.useEffect(()=>{l&&t&&Object.keys(t).length>0&&x(JSON.stringify(t,null,2))},[l,t]),e.jsxs(ue,{open:l,onOpenChange:y=>{!y&&l&&m(),c(y)},children:[e.jsx(Re,{asChild:!0,children:s??e.jsx(W,{variant:"link",children:"编辑协议"})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(je,{children:e.jsx(xe,{children:"编辑协议配置"})}),e.jsxs("div",{className:"space-y-4",children:[C().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:C().map(y=>e.jsxs(W,{variant:"outline",size:"sm",onClick:()=>_(y),children:["使用",D[y].label,"模板"]},y))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(gs,{className:`min-h-[200px] font-mono text-sm ${r?"border-red-500 focus-visible:ring-red-500":""}`,value:d,placeholder:`请输入JSON配置${C().length>0?"或选择上方模板":""}`,onChange:y=>w(y.target.value)}),r&&e.jsx("p",{className:"text-sm text-red-500",children:r})]})]}),e.jsxs(Ee,{className:"gap-2",children:[e.jsx(W,{variant:"outline",onClick:()=>c(!1),children:"取消"}),e.jsx(W,{onClick:m,disabled:!!r,children:"确定"})]})]})]})}function uh(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const mx={},hx=Object.freeze(Object.defineProperty({__proto__:null,default:mx},Symbol.toStringTag,{value:"Module"})),xh=bo(hx),Oa=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),jx=()=>{try{const s=io.box.keyPair(),t=Oa(Sa.encodeBase64(s.secretKey)),a=Oa(Sa.encodeBase64(s.publicKey));return{privateKey:t,publicKey:a}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},gx=()=>{try{return jx()}catch(s){throw console.error("Error generating key pair:",s),s}},fx=s=>{const t=new Uint8Array(Math.ceil(s/2));return window.crypto.getRandomValues(t),Array.from(t).map(a=>a.toString(16).padStart(2,"0")).join("").substring(0,s)},px=()=>{const s=Math.floor(Math.random()*8)*2+2;return fx(s)},vx=u.object({cipher:u.string().default("aes-128-gcm"),obfs:u.string().default("0"),obfs_settings:u.object({path:u.string().default(""),host:u.string().default("")}).default({})}),bx=u.object({tls:u.coerce.number().default(0),tls_settings:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({})}),yx=u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({})}),Nx=u.object({version:u.coerce.number().default(2),alpn:u.string().default("h2"),obfs:u.object({open:u.coerce.boolean().default(!1),type:u.string().default("salamander"),password:u.string().default("")}).default({}),tls:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),bandwidth:u.object({up:u.string().default(""),down:u.string().default("")}).default({})}),wx=u.object({tls:u.coerce.number().default(0),tls_settings:u.object({server_name:u.string().default(""),allow_insecure:u.boolean().default(!1)}).default({}),reality_settings:u.object({server_port:u.coerce.number().default(443),server_name:u.string().default(""),allow_insecure:u.boolean().default(!1),public_key:u.string().default(""),private_key:u.string().default(""),short_id:u.string().default("")}).default({}),network:u.string().default("tcp"),network_settings:u.record(u.any()).default({}),flow:u.string().default("")}),Xe={shadowsocks:{schema:vx,ciphers:["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"]},vmess:{schema:bx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:yx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:Nx,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:wx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"},{value:"kcp",label:"mKCP"},{value:"httpupgrade",label:"HttpUpgrade"},{value:"xhttp",label:"XHTTP"}],flowOptions:["none","xtls-rprx-direct","xtls-rprx-splice","xtls-rprx-vision"]}},_x=({serverType:s,value:t,onChange:a})=>{const n=s?Xe[s]:null,l=n?.schema||u.record(u.any()),c=s?l.parse({}):{},d=ae({resolver:ie(l),defaultValues:c,mode:"onChange"});return o.useEffect(()=>{if(!t||Object.keys(t).length===0){if(s){const m=l.parse({});d.reset(m)}}else d.reset(t)},[s,t,a,d,l]),o.useEffect(()=>{const m=d.watch(w=>{a(w)});return()=>m.unsubscribe()},[d,a]),!s||!n?null:{shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"cipher",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"加密算法"}),e.jsx(v,{children:e.jsxs(B,{onValueChange:m.onChange,value:m.value,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择加密算法"})}),e.jsx(U,{children:e.jsx(ds,{children:Xe.shadowsocks.ciphers.map(w=>e.jsx(z,{value:w,children:w},w))})})]})})]})}),e.jsx(g,{control:d.control,name:"obfs",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"混淆"}),e.jsx(v,{children:e.jsxs(B,{onValueChange:m.onChange,value:m.value,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择混淆方式"})}),e.jsx(U,{children:e.jsxs(ds,{children:[e.jsx(z,{value:"0",children:"无"}),e.jsx(z,{value:"http",children:"HTTP"})]})})]})})]})}),d.watch("obfs")==="http"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"obfs_settings.path",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(v,{children:e.jsx(S,{type:"text",placeholder:"路径",...m})}),e.jsx(k,{})]})}),e.jsx(g,{control:d.control,name:"obfs_settings.host",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(v,{children:e.jsx(S,{type:"text",placeholder:"Host",...m})}),e.jsx(k,{})]})})]})]}),vmess:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"tls",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"TLS"}),e.jsx(v,{children:e.jsxs(B,{value:m.value?.toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择安全性"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"不支持"}),e.jsx(z,{value:"1",children:"支持"})]})]})})]})}),d.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"服务器名称指示(SNI)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"不使用请留空",...m})})]})}),e.jsx(g,{control:d.control,name:"tls_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(f,{children:["传输协议",e.jsx($t,{value:d.watch("network_settings"),setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")})]}),e.jsx(v,{children:e.jsxs(B,{onValueChange:m.onChange,value:m.value,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择传输协议"})}),e.jsx(U,{children:e.jsx(ds,{children:Xe.vmess.networkOptions.map(w=>e.jsx(z,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"服务器名称指示(SNI)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"当节点地址于证书不一致时用于证书验证",...m,value:m.value||""})})]})}),e.jsx(g,{control:d.control,name:"allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(f,{children:["传输协议",e.jsx($t,{value:d.watch("network_settings")||{},setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")||"tcp"})]}),e.jsx(v,{children:e.jsxs(B,{onValueChange:m.onChange,value:m.value||"tcp",children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择传输协议"})}),e.jsx(U,{children:e.jsx(ds,{children:Xe.trojan.networkOptions.map(w=>e.jsx(z,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"version",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"协议版本"}),e.jsx(v,{children:e.jsxs(B,{value:(m.value||2).toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"协议版本"})}),e.jsx(U,{children:e.jsx(ds,{children:Xe.hysteria.versions.map(w=>e.jsxs(z,{value:w,className:"cursor-pointer",children:["V",w]},w))})})]})})]})}),d.watch("version")==1&&e.jsx(g,{control:d.control,name:"alpn",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"ALPN"}),e.jsx(v,{children:e.jsxs(B,{value:m.value||"h2",onValueChange:m.onChange,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"ALPN"})}),e.jsx(U,{children:e.jsx(ds,{children:Xe.hysteria.alpnOptions.map(w=>e.jsx(z,{value:w,children:w},w))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"obfs.open",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"混淆"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})}),!!d.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[d.watch("version")=="2"&&e.jsx(g,{control:d.control,name:"obfs.type",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"混淆实现"}),e.jsx(v,{children:e.jsxs(B,{value:m.value||"salamander",onValueChange:m.onChange,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择混淆实现"})}),e.jsx(U,{children:e.jsx(ds,{children:e.jsx(z,{value:"salamander",children:"Salamander"})})})]})})]})}),e.jsx(g,{control:d.control,name:"obfs.password",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"混淆密码"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入混淆密码",...m,value:m.value||""})})]})})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"服务器名称指示(SNI)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"当节点地址于证书不一致时用于证书验证",...m,value:m.value||""})})]})}),e.jsx(g,{control:d.control,name:"tls.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value||!1,onCheckedChange:m.onChange})})})]})})]}),e.jsx(g,{control:d.control,name:"bandwidth.up",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"上行宽带"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入上行宽带"+(d.watch("version")==2?",留空则使用BBR":""),className:"rounded-br-none rounded-tr-none",...m,value:m.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:"Mbps"})})]})]})}),e.jsx(g,{control:d.control,name:"bandwidth.down",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"下行宽带"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入下行宽带"+(d.watch("version")==2?",留空则使用BBR":""),className:"rounded-br-none rounded-tr-none",...m,value:m.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:"Mbps"})})]})]})})]}),vless:()=>e.jsxs(e.Fragment,{children:[e.jsx(g,{control:d.control,name:"tls",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"安全性"}),e.jsx(v,{children:e.jsxs(B,{value:m.value?.toString(),onValueChange:w=>m.onChange(Number(w)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择安全性"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"无"}),e.jsx(z,{value:"1",children:"TLS"}),e.jsx(z,{value:"2",children:"Reality"})]})]})})]})}),d.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"tls_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"服务器名称指示(SNI)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"不使用请留空",...m})})]})}),e.jsx(g,{control:d.control,name:"tls_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),d.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:d.control,name:"reality_settings.server_name",render:({field:m})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"伪装站点(dest)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"例如:example.com",...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.server_port",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"端口(port)"}),e.jsx(v,{children:e.jsx(S,{placeholder:"例如:443",...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.allow_insecure",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"允许不安全?"}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(v,{children:e.jsx(H,{checked:m.value,onCheckedChange:m.onChange})})})]})})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(g,{control:d.control,name:"reality_settings.private_key",render:({field:m})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"私钥(Private key)"}),e.jsx(v,{children:e.jsx(S,{...m})})]})}),e.jsxs(W,{variant:"outline",className:"",onClick:()=>{try{const m=gx();d.setValue("reality_settings.private_key",m.privateKey),d.setValue("reality_settings.public_key",m.publicKey),L.success("密钥对生成成功")}catch{L.error("生成密钥对失败")}},children:[e.jsx(Ne,{icon:"ion:key-outline",className:"mr-2 h-4 w-4"}),"生成密钥对"]})]}),e.jsx(g,{control:d.control,name:"reality_settings.public_key",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"公钥(Public key)"}),e.jsx(v,{children:e.jsx(S,{...m})})]})}),e.jsx(g,{control:d.control,name:"reality_settings.short_id",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"Short ID"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{children:e.jsx(S,{...m,placeholder:"可留空,长度为2的倍数,最长16位"})}),e.jsxs(W,{variant:"outline",onClick:()=>{const w=px();d.setValue("reality_settings.short_id",w),L.success("Short ID 生成成功")},children:[e.jsx(Ne,{icon:"ion:refresh-outline",className:"mr-2 h-4 w-4"}),"生成"]})]}),e.jsx(E,{className:"text-xs text-muted-foreground",children:"客户端可用的 shortId 列表,可用于区分不同的客户端,使用0-f的十六进制字符"})]})})]}),e.jsx(g,{control:d.control,name:"network",render:({field:m})=>e.jsxs(j,{children:[e.jsxs(f,{children:["传输协议",e.jsx($t,{value:d.watch("network_settings"),setValue:w=>d.setValue("network_settings",w),templateType:d.watch("network")})]}),e.jsx(v,{children:e.jsxs(B,{onValueChange:m.onChange,value:m.value,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择传输协议"})}),e.jsx(U,{children:e.jsx(ds,{children:Xe.vless.networkOptions.map(w=>e.jsx(z,{value:w.value,className:"cursor-pointer",children:w.label},w.value))})})]})})]})}),e.jsx(g,{control:d.control,name:"flow",render:({field:m})=>e.jsxs(j,{children:[e.jsx(f,{children:"流控"}),e.jsx(v,{children:e.jsxs(B,{onValueChange:w=>m.onChange(w==="none"?null:w),value:m.value||"none",children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择流控"})}),e.jsx(U,{children:Xe.vless.flowOptions.map(w=>e.jsx(z,{value:w,children:w},w))})]})})]})})]})}[s]?.()},Cx=u.object({id:u.number().optional().nullable(),code:u.string().optional(),name:u.string().min(1,"Please enter a valid name."),rate:u.string().min(1,"Please enter a valid rate."),tags:u.array(u.string()).default([]),excludes:u.array(u.string()).default([]),ips:u.array(u.string()).default([]),group_ids:u.array(u.string()).default([]),host:u.string().min(1,"Please enter a valid host."),port:u.string().min(1,"Please enter a valid port."),server_port:u.string().min(1,"Please enter a valid server port."),parent_id:u.string().default("0").nullable(),route_ids:u.array(u.string()).default([]),protocol_settings:u.record(u.any()).default({}).nullable()}),xt={id:null,code:"",name:"",rate:"1",tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null};function Sx(){const{isOpen:s,setIsOpen:t,editingServer:a,setEditingServer:n,serverType:l,setServerType:c,refetch:d}=Fr(),[x,r]=o.useState([]),[i,h]=o.useState([]),[D,C]=o.useState([]),m=ae({resolver:ie(Cx),defaultValues:xt,mode:"onChange"});o.useEffect(()=>{w()},[s]),o.useEffect(()=>{a?.type&&a.type!==l&&c(a.type)},[a,l,c]),o.useEffect(()=>{a?a.type===l&&m.reset({...xt,...a}):m.reset({...xt,protocol_settings:Xe[l].schema.parse({})})},[a,m,l]);const w=async()=>{if(!s)return;const[p,V,A]=await Promise.all([Rt(),ur(),dr()]);r(p.data?.map($=>({label:$.name,value:$.id.toString()}))||[]),h(V.data?.map($=>({label:$.remarks,value:$.id.toString()}))||[]),C(A.data||[])},_=o.useMemo(()=>D?.filter(p=>(p.parent_id===0||p.parent_id===null)&&p.type===l&&p.id!==m.watch("id")),[l,D,m]),y=()=>e.jsxs(vs,{children:[e.jsx(bs,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("div",{children:"添加节点"})]})}),e.jsx(ms,{align:"start",children:e.jsx(ac,{children:ps.map(({type:p,label:V})=>e.jsx(he,{onClick:()=>{c(p),t(!0)},className:"cursor-pointer",children:e.jsx(O,{variant:"outline",className:"text-white",style:{background:ss[p]},children:V})},p))})})]}),N=()=>{t(!1),n(null),m.reset(xt)},P=async()=>{const p=m.getValues();(await kc({...p,type:l})).data&&(N(),L.success("提交成功"),d())};return e.jsxs(ue,{open:s,onOpenChange:N,children:[y(),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:a?"编辑节点":"新建节点"}),e.jsx(Se,{})]}),e.jsxs(oe,{...m,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{control:m.control,name:"name",render:({field:p})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"节点名称"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入节点名称",...p})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"rate",render:({field:p})=>e.jsxs(j,{className:"flex-[1]",children:[e.jsx(f,{children:"倍率"}),e.jsx("div",{className:"relative flex",children:e.jsx(v,{children:e.jsx(S,{type:"number",min:"0",step:"0.1",...p})})}),e.jsx(k,{})]})})]}),e.jsx(g,{control:m.control,name:"code",render:({field:p})=>e.jsxs(j,{children:[e.jsxs(f,{children:["自定义节点ID",e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(选填)"})]}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入自定义节点ID",...p,value:p.value||""})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"tags",render:({field:p})=>e.jsxs(j,{children:[e.jsx(f,{children:"节点标签"}),e.jsx(v,{children:e.jsx(da,{value:p.value,onChange:p.onChange,placeholder:"输入后回车添加标签",className:"w-full"})}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"group_ids",render:({field:p})=>e.jsxs(j,{children:[e.jsxs(f,{className:"flex items-center justify-between",children:["权限组",e.jsx(Ft,{dialogTrigger:e.jsx(T,{variant:"link",children:"添加权限组"}),refetch:w})]}),e.jsx(v,{children:e.jsx(at,{options:x,onChange:V=>p.onChange(V.map(A=>A.value)),value:x?.filter(V=>p.value.includes(V.value)),placeholder:"请选择权限组",emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:"no results found."})})}),e.jsx(k,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:m.control,name:"host",render:({field:p})=>e.jsxs(j,{children:[e.jsx(f,{children:"节点地址"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入节点域名或者IP",...p})}),e.jsx(k,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(g,{control:m.control,name:"port",render:({field:p})=>e.jsxs(j,{className:"flex-1",children:[e.jsxs(f,{className:"flex items-center gap-1.5",children:["连接端口",e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(Ne,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(ee,{side:"top",className:"max-w-80 p-3",children:e.jsx("p",{children:"用户实际连接使用的端口,这是客户端配置中需要填写的端口号。如果使用了中转或隧道,这个端口可能与服务器实际监听的端口不同。"})})]})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(v,{children:e.jsx(S,{placeholder:"用户连接端口",...p})}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const V=p.value;V&&m.setValue("server_port",V)},children:e.jsx(Ne,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(ee,{side:"right",children:e.jsx("p",{children:"同步到服务端口"})})]})})]}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"server_port",render:({field:p})=>e.jsxs(j,{className:"flex-1",children:[e.jsxs(f,{className:"flex items-center gap-1.5",children:["服务端口",e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(Ne,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(ee,{side:"top",className:"max-w-80 p-3",children:e.jsx("p",{children:"服务器实际监听的端口,这是在服务器上开放的真实端口。如果使用了中转或隧道,这个端口可能与用户连接端口不同。"})})]})})]}),e.jsx(v,{children:e.jsx(S,{placeholder:"服务端开放端口",...p})}),e.jsx(k,{})]})})]})]}),s&&e.jsx(_x,{serverType:l,value:m.watch("protocol_settings"),onChange:p=>m.setValue("protocol_settings",p,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(g,{control:m.control,name:"parent_id",render:({field:p})=>e.jsxs(j,{children:[e.jsx(f,{children:"父节点"}),e.jsxs(B,{onValueChange:p.onChange,value:p.value?.toString()||"0",children:[e.jsx(v,{children:e.jsx(q,{children:e.jsx(G,{placeholder:"选择父节点"})})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"无"}),_?.map(V=>e.jsx(z,{value:V.id.toString(),className:"cursor-pointer",children:V.name},V.id))]})]}),e.jsx(k,{})]})}),e.jsx(g,{control:m.control,name:"route_ids",render:({field:p})=>e.jsxs(j,{children:[e.jsx(f,{children:"路由组"}),e.jsx(v,{children:e.jsx(at,{options:i,onChange:V=>p.onChange(V.map(A=>A.value)),value:i?.filter(V=>p.value.includes(V.value)),placeholder:"选择路由组",emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:"no results found."})})}),e.jsx(k,{})]})})]}),e.jsxs(Ee,{className:"mt-6",children:[e.jsx(T,{type:"button",variant:"outline",onClick:N,children:"取消"}),e.jsx(T,{type:"submit",onClick:P,children:"提交"})]})]})]})]})}function La({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(c=>l.has(c.value)).map(c=>e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(hs,{children:[e.jsx(Cs,{placeholder:t}),e.jsxs(js,{children:[e.jsx(Ss,{children:"No results found."}),e.jsx(Ve,{children:a.map(c=>{const d=l.has(c.value);return e.jsxs(ve,{onSelect:()=>{d?l.delete(c.value):l.add(c.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},className:"cursor-pointer",children:[e.jsx("div",{className:b("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ns,{className:b("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${c.color}`}),e.jsx("span",{children:c.label}),n?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(c.value)})]},c.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ls,{}),e.jsx(Ve,{children:e.jsx(ve,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const kx=[{value:pe.Shadowsocks,label:ps.find(s=>s.type===pe.Shadowsocks)?.label,color:ss[pe.Shadowsocks]},{value:pe.Vmess,label:ps.find(s=>s.type===pe.Vmess)?.label,color:ss[pe.Vmess]},{value:pe.Trojan,label:ps.find(s=>s.type===pe.Trojan)?.label,color:ss[pe.Trojan]},{value:pe.Hysteria,label:ps.find(s=>s.type===pe.Hysteria)?.label,color:ss[pe.Hysteria]},{value:pe.Vless,label:ps.find(s=>s.type===pe.Vless)?.label,color:ss[pe.Vless]}];function Tx({table:s,saveOrder:t,isSortMode:a,groups:n}){const l=s.getState().columnFilters.length>0,c=n.map(d=>({label:d,value:d}));return e.jsxs("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:[!a&&e.jsxs(e.Fragment,{children:[e.jsx(Sx,{}),e.jsx(S,{placeholder:"搜索节点...",value:s.getColumn("name")?.getFilterValue()??"",onChange:d=>s.getColumn("name")?.setFilterValue(d.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex gap-x-2",children:[s.getColumn("type")&&e.jsx(La,{column:s.getColumn("type"),title:"类型",options:kx}),s.getColumn("groups")&&e.jsx(La,{column:s.getColumn("groups"),title:"权限组",options:c})]}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]}),a&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"拖拽节点进行排序,完成后点击保存"})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:a?"default":"outline",onClick:t,size:"sm",children:a?"保存排序":"编辑排序"})})]})}const nt=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.71 12.71a6 6 0 1 0-7.42 0a10 10 0 0 0-6.22 8.18a1 1 0 0 0 2 .22a8 8 0 0 1 15.9 0a1 1 0 0 0 1 .89h.11a1 1 0 0 0 .88-1.1a10 10 0 0 0-6.25-8.19M12 12a4 4 0 1 1 4-4a4 4 0 0 1-4 4"})}),mt={0:"bg-destructive/80 shadow-sm shadow-destructive/50",1:"bg-yellow-500/80 shadow-sm shadow-yellow-500/50",2:"bg-emerald-500/80 shadow-sm shadow-emerald-500/50"},ht={0:"未运行",1:"无人使用或异常",2:"运行正常"},Dx=s=>[{id:"drag-handle",header:({column:t})=>e.jsx(I,{column:t,title:"排序"}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(Dt,{className:"size-4 cursor-move text-muted-foreground transition-colors hover:text-primary","aria-hidden":"true"})}),size:50},{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"节点ID"}),cell:({row:t})=>{const a=t.getValue("id"),n=t.original.code;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(O,{variant:"outline",className:b("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:ss[t.original.type]},children:[e.jsx(On,{className:"size-3"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"flex items-center gap-0.5",children:n??a}),t.original.parent?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground/30",children:"→"}),e.jsx("span",{children:t.original.parent?.code||t.original.parent?.id})]}):""]})]}),e.jsx(T,{variant:"ghost",size:"icon",className:"size-5 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:text-muted-foreground group-hover/id:opacity-100",onClick:l=>{l.stopPropagation(),Nt(n||a.toString())},children:e.jsx(ka,{className:"size-3"})})]})}),e.jsxs(ee,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[ps.find(l=>l.type===t.original.type)?.label,t.original.parent_id?" (子节点)":""]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n?"点击括号内容或复制按钮可复制节点代码":"点击复制按钮可复制节点ID"})]})]})})},size:200,enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"显隐"}),cell:({row:t})=>{const[a,n]=o.useState(!!t.getValue("show"));return e.jsx(H,{checked:a,onCheckedChange:async l=>{n(l),Pc({id:t.original.id,type:t.original.type,show:l?1:0}).catch(()=>{n(!l),s()})},style:{backgroundColor:a?ss[t.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(I,{column:t,title:"节点",tooltip:e.jsxs("div",{className:"grid grid-cols-1 gap-3 p-2",children:[e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:b("h-2.5 w-2.5 rounded-full",mt[0])}),e.jsx("span",{className:"text-sm font-medium",children:ht[0]})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:b("h-2.5 w-2.5 rounded-full",mt[1])}),e.jsx("span",{className:"text-sm font-medium",children:ht[1]})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:b("h-2.5 w-2.5 rounded-full",mt[2])}),e.jsx("span",{className:"text-sm font-medium",children:ht[2]})]})]})})}),cell:({row:t})=>e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:b("size-2.5 flex-shrink-0 rounded-full transition-all duration-200",mt[t.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:t.getValue("name")})]})}),e.jsx(ee,{children:e.jsx("p",{className:"font-medium",children:ht[t.original.available_status]})})]})}),enableSorting:!1,size:200},{accessorKey:"host",header:({column:t})=>e.jsx(I,{column:t,title:"地址"}),cell:({row:t})=>{const a=`${t.original.host}:${t.original.port}`,n=t.original.port!==t.original.server_port;return e.jsxs("div",{className:"group relative flex min-w-0 items-start",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-1 gap-y-0.5 pr-7",children:[e.jsx("div",{className:"flex items-center ",children:e.jsxs("span",{className:"font-mono text-sm font-medium text-foreground/90",children:[t.original.host,":",t.original.port]})}),n&&e.jsxs("span",{className:"whitespace-nowrap text-[0.7rem] tracking-tight text-muted-foreground/40",children:["(内部端口 ",t.original.server_port,")"]})]}),e.jsx("div",{className:"absolute right-0 top-0",children:e.jsx(le,{delayDuration:0,children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:bg-muted/50 hover:text-muted-foreground group-hover:opacity-100",onClick:l=>{l.stopPropagation(),Nt(a)},children:e.jsx(ka,{className:"size-3"})})}),e.jsx(ee,{side:"top",sideOffset:10,children:"复制连接地址"})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:t})=>e.jsx(I,{column:t,title:"在线人数",tooltip:"在线人数根据服务端上报频率而定"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(nt,{className:"size-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("online")})]}),size:80,enableSorting:!0,enableHiding:!0},{accessorKey:"rate",header:({column:t})=>e.jsx(I,{column:t,title:"倍率",tooltip:"流量扣费倍率"}),cell:({row:t})=>e.jsxs(O,{variant:"secondary",className:"font-medium",children:[t.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"groups",header:({column:t})=>e.jsx(I,{column:t,title:"权限组",tooltip:"可订阅到该节点的权限组"}),cell:({row:t})=>{const a=t.getValue("groups")||[];return e.jsx("div",{className:"flex min-w-[300px] max-w-[600px] flex-wrap items-center gap-1.5",children:a.length>0?a.map((n,l)=>e.jsx(O,{variant:"secondary",className:b("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"),children:n.name},l)):e.jsx("span",{className:"text-sm text-muted-foreground",children:"--"})})},enableSorting:!1,size:600,filterFn:(t,a,n)=>{const l=t.getValue(a);return l?n.some(c=>l.includes(c)):!1}},{accessorKey:"type",header:({column:t})=>e.jsx(I,{column:t,title:"类型"}),cell:({row:t})=>{const a=t.getValue("type");return e.jsx(O,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:ss[a]},children:a})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{setIsOpen:a,setEditingServer:n,setServerType:l}=Fr();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(vs,{modal:!1,children:[e.jsx(bs,{asChild:!0,children:e.jsx(T,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":"打开操作菜单",children:e.jsx(bt,{className:"size-4"})})}),e.jsxs(ms,{align:"end",className:"w-40",children:[e.jsx(he,{className:"cursor-pointer",onClick:()=>{l(t.original.type),n(t.original),a(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(oo,{className:"mr-2 size-4"}),"编辑"]})}),e.jsxs(he,{className:"cursor-pointer",onClick:async()=>{Dc({id:t.original.id}).then(({data:c})=>{c&&(L.success("复制成功"),s())})},children:[e.jsx(co,{className:"mr-2 size-4"}),"复制"]}),e.jsx(Xs,{}),e.jsx(he,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:c=>c.preventDefault(),children:e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该节点,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Tc({id:t.original.id}).then(({data:c})=>{c&&(L.success("删除成功"),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(ns,{className:"mr-2 size-4"}),"删除"]})})})]})]})})},size:50}];function Px(){const[s,t]=o.useState({}),[a,n]=o.useState({"drag-handle":!1}),[l,c]=o.useState([]),[d,x]=o.useState({pageSize:50,pageIndex:0}),[r,i]=o.useState([]),[h,D]=o.useState(!1),[C,m]=o.useState({}),[w,_]=o.useState([]),{refetch:y}=Q({queryKey:["nodeList"],queryFn:async()=>{const{data:$}=await dr();return _($),$}}),N=o.useMemo(()=>{const $=new Set;return w.forEach(F=>{F.groups&&F.groups.forEach(Y=>$.add(Y.name))}),Array.from($).sort()},[w]);o.useEffect(()=>{n({"drag-handle":h,show:!h,host:!h,online:!h,rate:!h,groups:!h,type:!1,actions:!h}),m({name:h?2e3:200}),x({pageSize:h?99999:50,pageIndex:0})},[h]);const P=($,F)=>{h&&($.dataTransfer.setData("text/plain",F.toString()),$.currentTarget.classList.add("opacity-50"))},p=($,F)=>{if(!h)return;$.preventDefault(),$.currentTarget.classList.remove("bg-muted");const Y=parseInt($.dataTransfer.getData("text/plain"));if(Y===F)return;const Ds=[...w],[$s]=Ds.splice(Y,1);Ds.splice(F,0,$s),_(Ds)},V=async()=>{if(!h){D(!0);return}const $=w?.map((F,Y)=>({id:F.id,order:Y+1}));Ic($).then(()=>{L.success("排序保存成功"),D(!1),y()}).finally(()=>{D(!1)})},A=Le({data:w||[],columns:Dx(y),state:{sorting:r,columnVisibility:a,rowSelection:s,columnFilters:l,columnSizing:C,pagination:d},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:i,onColumnFiltersChange:c,onColumnVisibilityChange:n,onColumnSizingChange:m,onPaginationChange:x,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(xx,{refetch:y,children:e.jsx("div",{className:"space-y-4",children:e.jsx(Ge,{table:A,toolbar:$=>e.jsx(Tx,{table:$,refetch:y,saveOrder:V,isSortMode:h,groups:N}),draggable:h,onDragStart:P,onDragEnd:$=>$.currentTarget.classList.remove("opacity-50"),onDragOver:$=>{$.preventDefault(),$.currentTarget.classList.add("bg-muted")},onDragLeave:$=>$.currentTarget.classList.remove("bg-muted"),onDrop:p,showPagination:!h})})})}function Ix(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"节点管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"管理所有节点,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Px,{})})]})]})}const Vx=Object.freeze(Object.defineProperty({__proto__:null,default:Ix},Symbol.toStringTag,{value:"Module"}));function Rx({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsx("div",{className:"flex items-center justify-between space-x-4",children:e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(Ft,{refetch:t}),e.jsx(S,{placeholder:"搜索权限组...",value:s.getColumn("name")?.getFilterValue()??"",onChange:n=>s.getColumn("name")?.setFilterValue(n.target.value),className:b("h-8 w-[150px] lg:w-[250px]",a&&"border-primary/50 ring-primary/20")}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})})}const Ex=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"组ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(O,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:t})=>e.jsx(I,{column:t,title:"组名称"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium",children:t.getValue("name")})})},{accessorKey:"users_count",header:({column:t})=>e.jsx(I,{column:t,title:"用户数量"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"server_count",header:({column:t})=>e.jsx(I,{column:t,title:"节点数量"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(On,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("server_count")})]}),enableSorting:!0,size:8e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Ft,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]})}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该权限组,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Rc({id:t.original.id}).then(({data:a})=>{a&&(L.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}];function Fx(){const[s,t]=o.useState({}),[a,n]=o.useState({}),[l,c]=o.useState([]),[d,x]=o.useState([]),{data:r,refetch:i,isLoading:h}=Q({queryKey:["serverGroupList"],queryFn:async()=>{const{data:C}=await Rt();return C}}),D=Le({data:r||[],columns:Ex(i),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l},enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:D,toolbar:C=>e.jsx(Rx,{table:C,refetch:i}),isLoading:h})}function Mx(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"权限组管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"管理所有权限组,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Fx,{})})]})]})}const zx=Object.freeze(Object.defineProperty({__proto__:null,default:Mx},Symbol.toStringTag,{value:"Module"})),Ox=u.object({remarks:u.string().min(1,"Please enter a valid remarks."),match:u.array(u.string()),action:u.enum(["block","dns"]),action_value:u.string().optional()});function Mr({refetch:s,dialogTrigger:t,defaultValues:a={remarks:"",match:[],action:"block",action_value:""},type:n="add"}){const l=ae({resolver:ie(Ox),defaultValues:a,mode:"onChange"}),[c,d]=o.useState(!1);return e.jsxs(ue,{open:c,onOpenChange:d,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ne,{icon:"ion:add"})," ",e.jsx("div",{children:"添加路由"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:n==="edit"?"编辑路由":"创建路由"}),e.jsx(Se,{})]}),e.jsxs(oe,{...l,children:[e.jsx(g,{control:l.control,name:"remarks",render:({field:x})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"备注"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsx(S,{type:"text",placeholder:"请输入备注",...x})})}),e.jsx(k,{})]})}),e.jsx(g,{control:l.control,name:"match",render:({field:x})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(f,{children:"备注"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsx(gs,{className:"min-h-[120px]",placeholder:`example.com *.example.com`,value:x.value.join(` `),onChange:r=>{x.onChange(r.target.value.split(` -`))}})})}),e.jsx(k,{})]})}),e.jsx(g,{control:l.control,name:"action",render:({field:x})=>e.jsxs(j,{children:[e.jsx(f,{children:"动作"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsxs(B,{onValueChange:x.onChange,defaultValue:x.value,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择动作"})}),e.jsxs(U,{children:[e.jsx(z,{value:"block",children:"禁止访问"}),e.jsx(z,{value:"dns",children:"指定DNS服务器进行解析"})]})]})})}),e.jsx(k,{})]})}),l.watch("action")==="dns"&&e.jsx(g,{control:l.control,name:"action_value",render:({field:x})=>e.jsxs(j,{children:[e.jsx(f,{children:"DNS服务器"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsx(S,{type:"text",placeholder:"请输入DNS服务器",...x})})})]})}),e.jsxs(Ee,{children:[e.jsx(it,{asChild:!0,children:e.jsx(T,{variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",onClick:()=>{Rc(l.getValues()).then(({data:x})=>{x&&(d(!1),s&&s(),l.reset())})},children:"提交"})]})]})]})]})}function Ox({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;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(Fr,{refetch:t}),e.jsx(S,{placeholder:"搜索路由...",value:s.getColumn("remarks")?.getFilterValue()??"",onChange:n=>s.getColumn("remarks")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["Reset",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})})}function Lx({columns:s,data:t,refetch:a}){const[n,l]=o.useState({}),[c,d]=o.useState({}),[x,r]=o.useState([]),[i,h]=o.useState([]),D=Le({data:t,columns:s,state:{sorting:i,columnVisibility:c,rowSelection:n,columnFilters:x},enableRowSelection:!0,onRowSelectionChange:l,onSortingChange:h,onColumnFiltersChange:r,onColumnVisibilityChange:d,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:D,toolbar:C=>e.jsx(Ox,{table:C,refetch:a})})}const $x=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"组ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(O,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:t})=>e.jsx(I,{column:t,title:"备注"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsxs("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:["匹配 ",t.original.match?.length," 条规则"]})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action",header:({column:t})=>e.jsx(I,{column:t,title:"动作"}),cell:({row:t})=>{const a={dns:"指定DNS服务器进行解析",block:"禁止访问"};return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(O,{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:a[t.getValue("action")]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Fr,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]})}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该权限组,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Ec({id:t.original.id}).then(({data:a})=>{a&&(L.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}];function Ax(){const[s,t]=o.useState([]);function a(){dr().then(({data:n})=>{t(n)})}return o.useEffect(()=>{a()},[]),e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"路由管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"管理所有路由组,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Lx,{data:s,columns:$x(a),refetch:a})})]})]})}const Hx=Object.freeze(Object.defineProperty({__proto__:null,default:Ax},Symbol.toStringTag,{value:"Module"})),Mr=o.createContext(void 0);function Kx({children:s,refreshData:t}){const[a,n]=o.useState(!1),[l,c]=o.useState(null);return e.jsx(Mr.Provider,{value:{isOpen:a,setIsOpen:n,editingPlan:l,setEditingPlan:c,refreshData:t},children:s})}function ca(){const s=o.useContext(Mr);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function qx({table:s,saveOrder:t,isSortMode:a}){const{setIsOpen:n}=ca();return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsxs(T,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>n(!0),children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("div",{children:"添加套餐"})]}),e.jsx(S,{placeholder:"搜索套餐...",value:s.getColumn("name")?.getFilterValue()??"",onChange:l=>s.getColumn("name")?.setFilterValue(l.target.value),className:"h-8 w-[150px] lg:w-[250px]"})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:a?"default":"outline",onClick:t,size:"sm",children:a?"保存排序":"编辑排序"})})]})}const Ux=s=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx(Dt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(O,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"显示"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("show"),onCheckedChange:a=>{Ot({id:t.original.id,show:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:t})=>e.jsx(I,{column:t,title:"销售"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("sell"),onCheckedChange:a=>{Ot({id:t.original.id,sell:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:t})=>e.jsx(I,{column:t,title:"续费",tooltip:"在订阅停止销售时,已购用户是否可以续费"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("renew"),onCheckedChange:a=>{Ot({id:t.original.id,renew:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:t})=>e.jsx(I,{column:t,title:"名称"}),cell:({row:t})=>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:t.getValue("name")})}),enableSorting:!1,enableHiding:!1,size:900},{accessorKey:"users_count",header:({column:t})=>e.jsx(I,{column:t,title:"统计"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-2",children:[e.jsx(nt,{}),e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:t.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"group",header:({column:t})=>e.jsx(I,{column:t,title:"权限组"}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[600px] text-nowrap flex-wrap items-center gap-1.5",children:e.jsx(O,{variant:"secondary",className:b("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"),children:t.getValue("group")?.name})}),enableSorting:!1,enableHiding:!1},{accessorKey:"prices",header:({column:t})=>e.jsx(I,{column:t,title:"价格"}),cell:({row:t})=>{const a=t.getValue("prices"),n=[{period:"月付",key:"monthly",unit:"元/月"},{period:"季付",key:"quarterly",unit:"元/季"},{period:"年付",key:"yearly",unit:"元/年"}];return e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:n.map(({period:l,key:c,unit:d})=>a[c]>0&&e.jsxs(O,{variant:"secondary",className:b("px-2 py-0.5","bg-secondary/30 hover:bg-secondary/50","border border-border/50","transition-all duration-200","cursor-default select-none"),children:[l," ¥",a[c],d]},c))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{setIsOpen:a,setEditingPlan:n}=ca();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{n(t.original),a(!0)},children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该订阅,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Xc({id:t.original.id}).then(({data:l})=>{l&&(L.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}}],Bx=u.object({id:u.number().nullable(),group_id:u.union([u.number(),u.string()]).nullable().optional(),name:u.string().min(1).max(250),content:u.string().nullable().optional(),transfer_enable:u.union([u.number().min(0),u.string().min(1)]),prices:u.object({monthly:u.union([u.number(),u.string()]).nullable().optional(),quarterly:u.union([u.number(),u.string()]).nullable().optional(),half_yearly:u.union([u.number(),u.string()]).nullable().optional(),yearly:u.union([u.number(),u.string()]).nullable().optional(),two_yearly:u.union([u.number(),u.string()]).nullable().optional(),three_yearly:u.union([u.number(),u.string()]).nullable().optional(),onetime:u.union([u.number(),u.string()]).nullable().optional(),reset_traffic:u.union([u.number(),u.string()]).nullable().optional()}).default({}),speed_limit:u.union([u.number(),u.string()]).nullable().optional(),capacity_limit:u.union([u.number(),u.string()]).nullable().optional(),device_limit:u.union([u.number(),u.string()]).nullable().optional(),force_update:u.boolean().optional(),reset_traffic_method:u.number().nullable(),users_count:u.number().optional()}),zr=o.forwardRef(({className:s,...t},a)=>e.jsx(On,{ref:a,className:b("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",s),...t,children:e.jsx(co,{className:b("flex items-center justify-center text-current"),children:e.jsx(Ns,{className:"h-4 w-4"})})}));zr.displayName=On.displayName;const jt={id:null,group_id:null,name:"",content:"",transfer_enable:"",prices:{monthly:"",quarterly:"",half_yearly:"",yearly:"",two_yearly:"",three_yearly:"",onetime:"",reset_traffic:""},speed_limit:"",capacity_limit:"",device_limit:"",force_update:!1,reset_traffic_method:null},gt={monthly:{label:"月付",months:1,discount:1},quarterly:{label:"季付",months:3,discount:.95},half_yearly:{label:"半年付",months:6,discount:.9},yearly:{label:"年付",months:12,discount:.85},two_yearly:{label:"两年付",months:24,discount:.8},three_yearly:{label:"三年付",months:36,discount:.75},onetime:{label:"流量包",months:1,discount:1},reset_traffic:{label:"重置包",months:1,discount:1}},Gx=[{value:0,label:"跟随系统设置"},{value:1,label:"每月1号"},{value:2,label:"按月重置"},{value:3,label:"不重置"},{value:4,label:"每年1月1日"},{value:5,label:"按年重置"}];function Yx(){const{isOpen:s,setIsOpen:t,editingPlan:a,setEditingPlan:n,refreshData:l}=ca(),[c,d]=o.useState(!1),x=ae({resolver:ie(Bx),defaultValues:{...jt,...a||{}},mode:"onChange"});o.useEffect(()=>{a?x.reset({...jt,...a}):x.reset(jt)},[a,x]);const r=new Fn({html:!0}),[i,h]=o.useState();async function D(){Rt().then(({data:w})=>{h(w)})}o.useEffect(()=>{s&&D()},[s]);const C=w=>{if(isNaN(w))return;const _=Object.entries(gt).reduce((y,[N,P])=>{const p=w*P.months*P.discount;return{...y,[N]:p.toFixed(2)}},{});x.setValue("prices",_,{shouldDirty:!0})},m=()=>{t(!1),n(null),x.reset(jt)};return e.jsx(ue,{open:s,onOpenChange:m,children:e.jsxs(ce,{children:[e.jsxs(je,{children:[e.jsx(xe,{children:a?"编辑套餐":"添加套餐"}),e.jsx(Se,{})]}),e.jsxs(oe,{...x,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:x.control,name:"name",render:({field:w})=>e.jsxs(j,{children:[e.jsx(f,{children:"套餐名称"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入套餐名称",...w})}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"group_id",render:({field:w})=>e.jsxs(j,{children:[e.jsxs(f,{className:"flex items-center justify-between",children:["权限组",e.jsx(Ft,{dialogTrigger:e.jsx(T,{variant:"link",children:"添加权限组"}),refetch:D})]}),e.jsxs(B,{value:w.value||"",onValueChange:w.onChange,children:[e.jsx(v,{children:e.jsx(q,{children:e.jsx(G,{placeholder:"选择权限组"})})}),e.jsx(U,{children:i?.map(_=>e.jsx(z,{value:_.id,children:_.name},_.id))})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"transfer_enable",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"流量"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",min:0,placeholder:"请输入流量大小",className:"rounded-r-none",...w})}),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:"GB"})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"speed_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"限速"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",min:0,placeholder:"请输入限速",className:"rounded-r-none",...w})}),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:"Mbps"})]}),e.jsx(k,{})]})}),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:"售价设置"}),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(S,{type:"number",placeholder:"基础月付价格",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:w=>{const _=parseFloat(w.target.value);C(_)}})]}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const w=Object.keys(gt).reduce((_,y)=>({..._,[y]:""}),{});x.setValue("prices",w,{shouldDirty:!0})},children:"清空价格"})}),e.jsx(ee,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:"清空所有周期的价格设置"})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(gt).filter(([w])=>!["onetime","reset_traffic"].includes(w)).map(([w,_])=>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(g,{control:x.control,name:`prices.${w}`,render:({field:y})=>e.jsxs(j,{children:[e.jsxs(f,{className:"text-xs font-medium text-muted-foreground",children:[_.label,e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",_.months===1?"每月":`每${_.months}个月`,"结算)"]})]}),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(v,{children:e.jsx(S,{type:"number",placeholder:"0.00",min:0,...y,value:y.value??"",onChange:N=>y.onChange(N.target.value),className:"h-7 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"})})]})]})})},w))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(gt).filter(([w])=>["onetime","reset_traffic"].includes(w)).map(([w,_])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(g,{control:x.control,name:`prices.${w}`,render:({field:y})=>e.jsx(j,{children:e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsx(f,{className:"text-xs font-medium",children:_.label}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:w==="onetime"?"一次性流量包,购买后立即生效":"用户可随时购买流量重置包,立即重置流量"})]}),e.jsxs("div",{className:"relative w-full md:w-32",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(v,{children:e.jsx(S,{type:"number",placeholder:"0.00",min:0,...y,className:"h-7 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"})})]})]})})})},w))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(g,{control:x.control,name:"device_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"设备限制"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",min:0,placeholder:"留空则不限制",className:"rounded-r-none",...w,value:w.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:"台"})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"capacity_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"容量限制"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",min:0,placeholder:"留空则不限制",className:"rounded-r-none",...w,value:w.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:"人"})]}),e.jsx(k,{})]})})]}),e.jsx(g,{control:x.control,name:"reset_traffic_method",render:({field:w})=>e.jsxs(j,{children:[e.jsx(f,{children:"流量重置方式"}),e.jsxs(B,{value:w.value?.toString()??"0",onValueChange:_=>w.onChange(Number(_)),children:[e.jsx(v,{children:e.jsx(q,{children:e.jsx(G,{placeholder:"选择流量重置方式"})})}),e.jsx(U,{children:Gx.map(_=>e.jsx(z,{value:_.value.toString(),children:_.label},_.value))})]}),e.jsx(E,{className:"text-xs",children:"设置订阅流量的重置方式,不同的重置方式会影响用户的流量计算方式"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"content",render:({field:w})=>{const[_,y]=o.useState(!1);return e.jsxs(j,{className:"space-y-2",children:[e.jsxs(f,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:["套餐描述",e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>y(!_),children:_?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{d:"M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"}),e.jsx("path",{fillRule:"evenodd",d:"M.664 10.59a1.651 1.651 0 010-1.186A10.004 10.004 0 0110 3c4.257 0 7.893 2.66 9.336 6.41.147.381.146.804 0 1.186A10.004 10.004 0 0110 17c-4.257 0-7.893-2.66-9.336-6.41zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{fillRule:"evenodd",d:"M3.28 2.22a.75.75 0 00-1.06 1.06l14.5 14.5a.75.75 0 101.06-1.06l-1.745-1.745a10.029 10.029 0 003.3-4.38 1.651 1.651 0 000-1.185A10.004 10.004 0 009.999 3a9.956 9.956 0 00-4.744 1.194L3.28 2.22zM7.752 6.69l1.092 1.092a2.5 2.5 0 013.374 3.373l1.091 1.092a4 4 0 00-5.557-5.557z",clipRule:"evenodd"}),e.jsx("path",{d:"M10.748 13.93l2.523 2.523a9.987 9.987 0 01-3.27.547c-4.258 0-7.894-2.66-9.337-6.41a1.651 1.651 0 010-1.186A10.007 10.007 0 012.839 6.02L6.07 9.252a4 4 0 004.678 4.678z"})]})})}),e.jsx(ee,{side:"top",children:e.jsx("p",{className:"text-xs",children:_?"隐藏预览":"显示预览"})})]})})]}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"outline",size:"sm",onClick:()=>{w.onChange(`## 套餐特点 +`))}})})}),e.jsx(k,{})]})}),e.jsx(g,{control:l.control,name:"action",render:({field:x})=>e.jsxs(j,{children:[e.jsx(f,{children:"动作"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsxs(B,{onValueChange:x.onChange,defaultValue:x.value,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择动作"})}),e.jsxs(U,{children:[e.jsx(z,{value:"block",children:"禁止访问"}),e.jsx(z,{value:"dns",children:"指定DNS服务器进行解析"})]})]})})}),e.jsx(k,{})]})}),l.watch("action")==="dns"&&e.jsx(g,{control:l.control,name:"action_value",render:({field:x})=>e.jsxs(j,{children:[e.jsx(f,{children:"DNS服务器"}),e.jsx("div",{className:"relative",children:e.jsx(v,{children:e.jsx(S,{type:"text",placeholder:"请输入DNS服务器",...x})})})]})}),e.jsxs(Ee,{children:[e.jsx(it,{asChild:!0,children:e.jsx(T,{variant:"outline",children:"取消"})}),e.jsx(T,{type:"submit",onClick:()=>{Ec(l.getValues()).then(({data:x})=>{x&&(d(!1),s&&s(),l.reset())})},children:"提交"})]})]})]})]})}function Lx({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;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(Mr,{refetch:t}),e.jsx(S,{placeholder:"搜索路由...",value:s.getColumn("remarks")?.getFilterValue()??"",onChange:n=>s.getColumn("remarks")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["Reset",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})})}function $x({columns:s,data:t,refetch:a}){const[n,l]=o.useState({}),[c,d]=o.useState({}),[x,r]=o.useState([]),[i,h]=o.useState([]),D=Le({data:t,columns:s,state:{sorting:i,columnVisibility:c,rowSelection:n,columnFilters:x},enableRowSelection:!0,onRowSelectionChange:l,onSortingChange:h,onColumnFiltersChange:r,onColumnVisibilityChange:d,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:D,toolbar:C=>e.jsx(Lx,{table:C,refetch:a})})}const Ax=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"组ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(O,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:t})=>e.jsx(I,{column:t,title:"备注"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsxs("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:["匹配 ",t.original.match?.length," 条规则"]})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action",header:({column:t})=>e.jsx(I,{column:t,title:"动作"}),cell:({row:t})=>{const a={dns:"指定DNS服务器进行解析",block:"禁止访问"};return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(O,{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:a[t.getValue("action")]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:"操作"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Mr,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]})}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该权限组,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{Fc({id:t.original.id}).then(({data:a})=>{a&&(L.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}];function Hx(){const[s,t]=o.useState([]);function a(){ur().then(({data:n})=>{t(n)})}return o.useEffect(()=>{a()},[]),e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"路由管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"管理所有路由组,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx($x,{data:s,columns:Ax(a),refetch:a})})]})]})}const Kx=Object.freeze(Object.defineProperty({__proto__:null,default:Hx},Symbol.toStringTag,{value:"Module"})),zr=o.createContext(void 0);function qx({children:s,refreshData:t}){const[a,n]=o.useState(!1),[l,c]=o.useState(null);return e.jsx(zr.Provider,{value:{isOpen:a,setIsOpen:n,editingPlan:l,setEditingPlan:c,refreshData:t},children:s})}function ua(){const s=o.useContext(zr);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function Ux({table:s,saveOrder:t,isSortMode:a}){const{setIsOpen:n}=ua();return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsxs(T,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>n(!0),children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("div",{children:"添加套餐"})]}),e.jsx(S,{placeholder:"搜索套餐...",value:s.getColumn("name")?.getFilterValue()??"",onChange:l=>s.getColumn("name")?.setFilterValue(l.target.value),className:"h-8 w-[150px] lg:w-[250px]"})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(T,{variant:a?"default":"outline",onClick:t,size:"sm",children:a?"保存排序":"编辑排序"})})]})}const $a={monthly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},quarterly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},half_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},two_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},three_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},onetime:{color:"text-slate-700",bgColor:"bg-slate-100/80"},reset_traffic:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Bx=s=>[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx(Dt,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"ID"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(O,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"显示"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("show"),onCheckedChange:a=>{Ot({id:t.original.id,show:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:t})=>e.jsx(I,{column:t,title:"销售"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("sell"),onCheckedChange:a=>{Ot({id:t.original.id,sell:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:t})=>e.jsx(I,{column:t,title:"续费",tooltip:"在订阅停止销售时,已购用户是否可以续费"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.getValue("renew"),onCheckedChange:a=>{Ot({id:t.original.id,renew:a}).then(({data:n})=>{!n&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:t})=>e.jsx(I,{column:t,title:"名称"}),cell:({row:t})=>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:t.getValue("name")})}),enableSorting:!1,enableHiding:!1,size:900},{accessorKey:"users_count",header:({column:t})=>e.jsx(I,{column:t,title:"统计"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-2",children:[e.jsx(nt,{}),e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:t.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"group",header:({column:t})=>e.jsx(I,{column:t,title:"权限组"}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[600px] flex-wrap items-center gap-1.5 text-nowrap",children:e.jsx(O,{variant:"secondary",className:b("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"),children:t.getValue("group")?.name})}),enableSorting:!1,enableHiding:!1},{accessorKey:"prices",header:({column:t})=>e.jsx(I,{column:t,title:"价格"}),cell:({row:t})=>{const a=t.getValue("prices"),n=[{period:"月付",key:"monthly",unit:"元/月"},{period:"季付",key:"quarterly",unit:"元/季"},{period:"半年付",key:"half_yearly",unit:"元/半年"},{period:"年付",key:"yearly",unit:"元/年"},{period:"两年付",key:"two_yearly",unit:"元/两年"},{period:"三年付",key:"three_yearly",unit:"元/三年"},{period:"流量包",key:"onetime",unit:"元"},{period:"重置包",key:"reset_traffic",unit:"元/次"}];return e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:n.map(({period:l,key:c,unit:d})=>a[c]!=null&&e.jsxs(O,{variant:"secondary",className:b("px-2 py-0.5 font-medium transition-colors text-nowrap",$a[c].color,$a[c].bgColor,"border border-border/50","hover:bg-slate-200/80"),children:[l," ¥",a[c],d]},c))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{setIsOpen:a,setEditingPlan:n}=ua();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{n(t.original),a(!0)},children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该订阅,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{ed({id:t.original.id}).then(({data:l})=>{l&&(L.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}}],Gx=u.object({id:u.number().nullable(),group_id:u.union([u.number(),u.string()]).nullable().optional(),name:u.string().min(1).max(250),content:u.string().nullable().optional(),transfer_enable:u.union([u.number().min(0),u.string().min(1)]),prices:u.object({monthly:u.union([u.number(),u.string()]).nullable().optional(),quarterly:u.union([u.number(),u.string()]).nullable().optional(),half_yearly:u.union([u.number(),u.string()]).nullable().optional(),yearly:u.union([u.number(),u.string()]).nullable().optional(),two_yearly:u.union([u.number(),u.string()]).nullable().optional(),three_yearly:u.union([u.number(),u.string()]).nullable().optional(),onetime:u.union([u.number(),u.string()]).nullable().optional(),reset_traffic:u.union([u.number(),u.string()]).nullable().optional()}).default({}),speed_limit:u.union([u.number(),u.string()]).nullable().optional(),capacity_limit:u.union([u.number(),u.string()]).nullable().optional(),device_limit:u.union([u.number(),u.string()]).nullable().optional(),force_update:u.boolean().optional(),reset_traffic_method:u.number().nullable(),users_count:u.number().optional()}),Or=o.forwardRef(({className:s,...t},a)=>e.jsx(Ln,{ref:a,className:b("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",s),...t,children:e.jsx(uo,{className:b("flex items-center justify-center text-current"),children:e.jsx(Ns,{className:"h-4 w-4"})})}));Or.displayName=Ln.displayName;const jt={id:null,group_id:null,name:"",content:"",transfer_enable:"",prices:{monthly:"",quarterly:"",half_yearly:"",yearly:"",two_yearly:"",three_yearly:"",onetime:"",reset_traffic:""},speed_limit:"",capacity_limit:"",device_limit:"",force_update:!1,reset_traffic_method:null},gt={monthly:{label:"月付",months:1,discount:1},quarterly:{label:"季付",months:3,discount:.95},half_yearly:{label:"半年付",months:6,discount:.9},yearly:{label:"年付",months:12,discount:.85},two_yearly:{label:"两年付",months:24,discount:.8},three_yearly:{label:"三年付",months:36,discount:.75},onetime:{label:"流量包",months:1,discount:1},reset_traffic:{label:"重置包",months:1,discount:1}},Yx=[{value:0,label:"跟随系统设置"},{value:1,label:"每月1号"},{value:2,label:"按月重置"},{value:3,label:"不重置"},{value:4,label:"每年1月1日"},{value:5,label:"按年重置"}];function Wx(){const{isOpen:s,setIsOpen:t,editingPlan:a,setEditingPlan:n,refreshData:l}=ua(),[c,d]=o.useState(!1),x=ae({resolver:ie(Gx),defaultValues:{...jt,...a||{}},mode:"onChange"});o.useEffect(()=>{a?x.reset({...jt,...a}):x.reset(jt)},[a,x]);const r=new sa({html:!0}),[i,h]=o.useState();async function D(){Rt().then(({data:w})=>{h(w)})}o.useEffect(()=>{s&&D()},[s]);const C=w=>{if(isNaN(w))return;const _=Object.entries(gt).reduce((y,[N,P])=>{const p=w*P.months*P.discount;return{...y,[N]:p.toFixed(2)}},{});x.setValue("prices",_,{shouldDirty:!0})},m=()=>{t(!1),n(null),x.reset(jt)};return e.jsx(ue,{open:s,onOpenChange:m,children:e.jsxs(ce,{children:[e.jsxs(je,{children:[e.jsx(xe,{children:a?"编辑套餐":"添加套餐"}),e.jsx(Se,{})]}),e.jsxs(oe,{...x,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(g,{control:x.control,name:"name",render:({field:w})=>e.jsxs(j,{children:[e.jsx(f,{children:"套餐名称"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入套餐名称",...w})}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"group_id",render:({field:w})=>e.jsxs(j,{children:[e.jsxs(f,{className:"flex items-center justify-between",children:["权限组",e.jsx(Ft,{dialogTrigger:e.jsx(T,{variant:"link",children:"添加权限组"}),refetch:D})]}),e.jsxs(B,{value:w.value||"",onValueChange:w.onChange,children:[e.jsx(v,{children:e.jsx(q,{children:e.jsx(G,{placeholder:"选择权限组"})})}),e.jsx(U,{children:i?.map(_=>e.jsx(z,{value:_.id,children:_.name},_.id))})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"transfer_enable",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"流量"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",min:0,placeholder:"请输入流量大小",className:"rounded-r-none",...w})}),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:"GB"})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"speed_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"限速"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",min:0,placeholder:"请输入限速",className:"rounded-r-none",...w})}),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:"Mbps"})]}),e.jsx(k,{})]})}),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:"售价设置"}),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(S,{type:"number",placeholder:"基础月付价格",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:w=>{const _=parseFloat(w.target.value);C(_)}})]}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const w=Object.keys(gt).reduce((_,y)=>({..._,[y]:""}),{});x.setValue("prices",w,{shouldDirty:!0})},children:"清空价格"})}),e.jsx(ee,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:"清空所有周期的价格设置"})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(gt).filter(([w])=>!["onetime","reset_traffic"].includes(w)).map(([w,_])=>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(g,{control:x.control,name:`prices.${w}`,render:({field:y})=>e.jsxs(j,{children:[e.jsxs(f,{className:"text-xs font-medium text-muted-foreground",children:[_.label,e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",_.months===1?"每月":`每${_.months}个月`,"结算)"]})]}),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(v,{children:e.jsx(S,{type:"number",placeholder:"0.00",min:0,...y,value:y.value??"",onChange:N=>y.onChange(N.target.value),className:"h-7 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"})})]})]})})},w))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(gt).filter(([w])=>["onetime","reset_traffic"].includes(w)).map(([w,_])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(g,{control:x.control,name:`prices.${w}`,render:({field:y})=>e.jsx(j,{children:e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsx(f,{className:"text-xs font-medium",children:_.label}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:w==="onetime"?"一次性流量包,购买后立即生效":"用户可随时购买流量重置包,立即重置流量"})]}),e.jsxs("div",{className:"relative w-full md:w-32",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(v,{children:e.jsx(S,{type:"number",placeholder:"0.00",min:0,...y,className:"h-7 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"})})]})]})})})},w))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(g,{control:x.control,name:"device_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"设备限制"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",min:0,placeholder:"留空则不限制",className:"rounded-r-none",...w,value:w.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:"台"})]}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"capacity_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(f,{children:"容量限制"}),e.jsxs("div",{className:"relative flex",children:[e.jsx(v,{children:e.jsx(S,{type:"number",min:0,placeholder:"留空则不限制",className:"rounded-r-none",...w,value:w.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:"人"})]}),e.jsx(k,{})]})})]}),e.jsx(g,{control:x.control,name:"reset_traffic_method",render:({field:w})=>e.jsxs(j,{children:[e.jsx(f,{children:"流量重置方式"}),e.jsxs(B,{value:w.value?.toString()??"0",onValueChange:_=>w.onChange(Number(_)),children:[e.jsx(v,{children:e.jsx(q,{children:e.jsx(G,{placeholder:"选择流量重置方式"})})}),e.jsx(U,{children:Yx.map(_=>e.jsx(z,{value:_.value.toString(),children:_.label},_.value))})]}),e.jsx(E,{className:"text-xs",children:"设置订阅流量的重置方式,不同的重置方式会影响用户的流量计算方式"}),e.jsx(k,{})]})}),e.jsx(g,{control:x.control,name:"content",render:({field:w})=>{const[_,y]=o.useState(!1);return e.jsxs(j,{className:"space-y-2",children:[e.jsxs(f,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:["套餐描述",e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>y(!_),children:_?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{d:"M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"}),e.jsx("path",{fillRule:"evenodd",d:"M.664 10.59a1.651 1.651 0 010-1.186A10.004 10.004 0 0110 3c4.257 0 7.893 2.66 9.336 6.41.147.381.146.804 0 1.186A10.004 10.004 0 0110 17c-4.257 0-7.893-2.66-9.336-6.41zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{fillRule:"evenodd",d:"M3.28 2.22a.75.75 0 00-1.06 1.06l14.5 14.5a.75.75 0 101.06-1.06l-1.745-1.745a10.029 10.029 0 003.3-4.38 1.651 1.651 0 000-1.185A10.004 10.004 0 009.999 3a9.956 9.956 0 00-4.744 1.194L3.28 2.22zM7.752 6.69l1.092 1.092a2.5 2.5 0 013.374 3.373l1.091 1.092a4 4 0 00-5.557-5.557z",clipRule:"evenodd"}),e.jsx("path",{d:"M10.748 13.93l2.523 2.523a9.987 9.987 0 01-3.27.547c-4.258 0-7.894-2.66-9.337-6.41a1.651 1.651 0 010-1.186A10.007 10.007 0 012.839 6.02L6.07 9.252a4 4 0 004.678 4.678z"})]})})}),e.jsx(ee,{side:"top",children:e.jsx("p",{className:"text-xs",children:_?"隐藏预览":"显示预览"})})]})})]}),e.jsx(le,{children:e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsx(T,{variant:"outline",size:"sm",onClick:()=>{w.onChange(`## 套餐特点 • 高速稳定的全球网络接入 • 支持多设备同时在线 • 无限制的流量重置 @@ -14,8 +14,8 @@ import{r as o,j as e,t as cl,c as dl,I as fa,a as ys,S as Wt,u as as,b as _t,d a ## 注意事项 - 禁止滥用 - 遵守当地法律法规 -- 支持随时更换套餐`)},children:"使用模板"})}),e.jsx(ee,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:"点击使用预设的套餐描述模板"})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${_?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"}`,children:[e.jsx("div",{className:"space-y-2",children:e.jsx(v,{children:e.jsx(Mn,{style:{height:"400px"},value:w.value||"",renderHTML:N=>r.render(N),onChange:({text:N})=>w.onChange(N),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:"在这里编写套餐描述...",className:"rounded-md border"})})}),_&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"预览"}),e.jsx("div",{className:"prose prose-sm dark:prose-invert h-[400px] max-w-none overflow-y-auto rounded-md border p-4",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:r.render(w.value||"")}})})]})]}),e.jsx(E,{className:"text-xs",children:"支持 Markdown 格式,可以使用标题、列表、粗体、斜体等样式来美化描述内容"}),e.jsx(k,{})]})}})]}),e.jsx(Ee,{className:"mt-6",children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("div",{className:"flex-shrink-0",children:a&&e.jsx(g,{control:x.control,name:"force_update",render:({field:w})=>e.jsxs(j,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(v,{children:e.jsx(zr,{checked:w.value,onCheckedChange:w.onChange})}),e.jsx("div",{className:"",children:e.jsx(f,{className:"text-sm",children:"强制更新到用户"})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(T,{type:"button",variant:"outline",onClick:m,children:"取消"}),e.jsx(T,{type:"submit",disabled:c,onClick:()=>{x.handleSubmit(async w=>{d(!0),(await Zc(w)).data&&(L.success(a?"套餐更新成功":"套餐添加成功"),m(),l()),d(!1)})()},children:c?"提交中...":"提交"})]})]})})]})]})})}function Wx(){const[s,t]=o.useState({}),[a,n]=o.useState({"drag-handle":!1}),[l,c]=o.useState([]),[d,x]=o.useState([]),[r,i]=o.useState(!1),[h,D]=o.useState({pageSize:20,pageIndex:0}),[C,m]=o.useState([]),{refetch:w}=Q({queryKey:["planList"],queryFn:async()=>{const{data:p}=await ks();return m(p),p}});o.useEffect(()=>{n({"drag-handle":r}),D({pageSize:r?99999:10,pageIndex:0})},[r]);const _=(p,V)=>{r&&(p.dataTransfer.setData("text/plain",V.toString()),p.currentTarget.classList.add("opacity-50"))},y=(p,V)=>{if(!r)return;p.preventDefault(),p.currentTarget.classList.remove("bg-muted");const A=parseInt(p.dataTransfer.getData("text/plain"));if(A===V)return;const $=[...C],[F]=$.splice(A,1);$.splice(V,0,F),m($)},N=async()=>{if(!r){i(!0);return}const p=C?.map(V=>V.id);ed(p).then(()=>{L.success("排序保存成功"),i(!1),w()}).finally(()=>{i(!1)})},P=Le({data:C||[],columns:Ux(w),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:h},enableRowSelection:!0,onPaginationChange:D,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}},pageCount:r?1:void 0});return e.jsx(Kx,{refreshData:w,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ge,{table:P,toolbar:p=>e.jsx(qx,{table:p,refetch:w,saveOrder:N,isSortMode:r}),draggable:r,onDragStart:_,onDragEnd:p=>p.currentTarget.classList.remove("opacity-50"),onDragOver:p=>{p.preventDefault(),p.currentTarget.classList.add("bg-muted")},onDragLeave:p=>p.currentTarget.classList.remove("bg-muted"),onDrop:y,showPagination:!r}),e.jsx(Yx,{})]})})}function Jx(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"订阅管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以配置订阅计划,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Wx,{})})]})]})}const Qx=Object.freeze(Object.defineProperty({__proto__:null,default:Jx},Symbol.toStringTag,{value:"Module"})),Or=[{value:me.PENDING,label:Vs[me.PENDING],icon:uo,color:Us[me.PENDING]},{value:me.PROCESSING,label:Vs[me.PROCESSING],icon:Ln,color:Us[me.PROCESSING]},{value:me.COMPLETED,label:Vs[me.COMPLETED],icon:Ut,color:Us[me.COMPLETED]},{value:me.CANCELLED,label:Vs[me.CANCELLED],icon:$n,color:Us[me.CANCELLED]},{value:me.DISCOUNTED,label:Vs[me.DISCOUNTED],icon:Ut,color:Us[me.DISCOUNTED]}],Lr=[{value:fe.PENDING,label:ct[fe.PENDING],icon:xo,color:dt[fe.PENDING]},{value:fe.PROCESSING,label:ct[fe.PROCESSING],icon:Ln,color:dt[fe.PROCESSING]},{value:fe.VALID,label:ct[fe.VALID],icon:Ut,color:dt[fe.VALID]},{value:fe.INVALID,label:ct[fe.INVALID],icon:$n,color:dt[fe.INVALID]}];function ft({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=s?.getFilterValue(),c=Array.isArray(l)?new Set(l):l!==void 0?new Set([l]):new Set;return e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,c?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:c.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:c.size>2?e.jsxs(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[c.size," selected"]}):a.filter(d=>c.has(d.value)).map(d=>e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:d.label},d.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(js,{children:[e.jsx(Cs,{placeholder:t}),e.jsxs(gs,{children:[e.jsx(Ss,{children:"No results found."}),e.jsx(Ve,{children:a.map(d=>{const x=c.has(d.value);return e.jsxs(ve,{onSelect:()=>{const r=new Set(c);x?r.delete(d.value):r.add(d.value);const i=Array.from(r);s?.setFilterValue(i.length?i:void 0)},children:[e.jsx("div",{className:b("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ns,{className:b("h-4 w-4")})}),d.icon&&e.jsx(d.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${d.color}`}),e.jsx("span",{children:d.label}),n?.get(d.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(d.value)})]},d.value)})}),c.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ls,{}),e.jsx(Ve,{children:e.jsx(ve,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Zx=u.object({email:u.string().min(1),plan_id:u.number(),period:u.string(),total_amount:u.number()}),Xx={email:"",plan_id:0,total_amount:0,period:""};function $r({refetch:s,trigger:t,defaultValues:a}){const[n,l]=o.useState(!1),c=ae({resolver:ie(Zx),defaultValues:{...Xx,...a},mode:"onChange"}),[d,x]=o.useState([]);return o.useEffect(()=>{n&&ks().then(({data:r})=>{x(r)})},[n]),e.jsxs(ue,{open:n,onOpenChange:l,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:" h-8 space-x-2",children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("div",{children:"添加订单"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:"订单分配"}),e.jsx(Se,{})]}),e.jsxs(oe,{...c,children:[e.jsx(g,{control:c.control,name:"email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"用户邮箱"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入用户邮箱",...r})})]})}),e.jsx(g,{control:c.control,name:"plan_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"订阅计划"}),e.jsx(v,{children:e.jsxs(B,{value:r.value?r.value?.toString():void 0,onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择订阅计划"})}),e.jsx(U,{children:d.map(i=>e.jsx(z,{value:i.id.toString(),children:i.name},i.id))})]})})]})}),e.jsx(g,{control:c.control,name:"period",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"订阅时长"}),e.jsx(v,{children:e.jsxs(B,{value:r.value,onValueChange:r.onChange,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择购买时长"})}),e.jsx(U,{children:Object.keys(st).map(i=>e.jsx(z,{value:i,children:st[i]},i))})]})})]})}),e.jsx(g,{control:c.control,name:"total_amount",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"支付金额"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入需要支付的金额",value:r.value/100,onChange:i=>r.onChange(parseFloat(i.currentTarget.value)*100)})}),e.jsx(k,{})]})}),e.jsxs(Ee,{children:[e.jsx(T,{variant:"outline",onClick:()=>l(!1),children:"取消"}),e.jsx(T,{type:"submit",onClick:()=>{c.handleSubmit(r=>{nd(r).then(({data:i})=>{i&&(s&&s(),c.reset(),l(!1),L.success("添加成功"))})})()},children:"确定"})]})]})]})]})}const em=Object.values(ts).filter(s=>typeof s=="number").map(s=>({label:fr[s],value:s,color:s===ts.NEW?"green-500":s===ts.RENEWAL?"blue-500":s===ts.UPGRADE?"purple-500":"orange-500"})),sm=Object.values(ne).map(s=>({label:st[s],value:s,color:s===ne.MONTH_PRICE?"slate-500":s===ne.QUARTER_PRICE?"cyan-500":s===ne.HALF_YEAR_PRICE?"indigo-500":s===ne.YEAR_PRICE?"violet-500":s===ne.TWO_YEAR_PRICE?"fuchsia-500":s===ne.THREE_YEAR_PRICE?"pink-500":s===ne.ONETIME_PRICE?"rose-500":"orange-500"}));function tm({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx($r,{refetch:t}),e.jsx(S,{placeholder:"搜索订单...",value:s.getColumn("trade_no")?.getFilterValue()??"",onChange:n=>s.getColumn("trade_no")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex flex-wrap gap-x-2",children:[s.getColumn("type")&&e.jsx(ft,{column:s.getColumn("type"),title:"订单类型",options:em}),s.getColumn("period")&&e.jsx(ft,{column:s.getColumn("period"),title:"订单周期",options:sm}),s.getColumn("status")&&e.jsx(ft,{column:s.getColumn("status"),title:"订单状态",options:Or}),s.getColumn("commission_status")&&e.jsx(ft,{column:s.getColumn("commission_status"),title:"佣金状态",options:Lr})]}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})}function Ae({label:s,value:t,className:a,valueClassName:n}){return e.jsxs("div",{className:b("flex items-center py-1.5",a),children:[e.jsx("div",{className:"w-28 shrink-0 text-sm text-muted-foreground",children:s}),e.jsx("div",{className:b("text-sm",n),children:t||"-"})]})}function am({status:s}){const t={PENDING:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",PAID:"bg-green-100 text-green-800 hover:bg-green-100",FAILED:"bg-red-100 text-red-800 hover:bg-red-100",REFUNDED:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(O,{variant:"secondary",className:b("font-medium",t[s]),children:Vs[s]})}function nm({id:s,trigger:t}){const[a,n]=o.useState(!1),[l,c]=o.useState();return o.useEffect(()=>{(async()=>{if(a){const{data:x}=await sd({id:s});c(x)}})()},[a,s]),e.jsxs(ue,{onOpenChange:n,open:a,children:[e.jsx(Re,{asChild:!0,children:t}),e.jsxs(ce,{className:"max-w-xl",children:[e.jsxs(je,{className:"space-y-2",children:[e.jsx(xe,{className:"text-lg font-medium",children:"订单信息"}),e.jsx("div",{className:"flex items-center justify-between text-sm",children:e.jsxs("div",{className:"flex items-center space-x-6",children:[e.jsxs("div",{className:"text-muted-foreground",children:["订单号:",l?.trade_no]}),l?.status&&e.jsx(am,{status:l.status})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"基本信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ae,{label:"用户邮箱",value:l?.user?.email?e.jsxs(ws,{to:`/user/manage?email=${l.user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[l.user.email,e.jsx(An,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(Ae,{label:"订单周期",value:l&&st[l.period]}),e.jsx(Ae,{label:"订阅计划",value:l?.plan?.name,valueClassName:"font-medium"}),e.jsx(Ae,{label:"回调单号",value:l?.callback_no,valueClassName:"font-mono text-xs"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"金额信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ae,{label:"支付金额",value:qs(l?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(ge,{className:"my-2"}),e.jsx(Ae,{label:"余额支付",value:qs(l?.balance_amount||0)}),e.jsx(Ae,{label:"优惠金额",value:qs(l?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(Ae,{label:"退回金额",value:qs(l?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(Ae,{label:"折抵金额",value:qs(l?.surplus_amount||0)})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"时间信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ae,{label:"创建时间",value:re(l?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(Ae,{label:"更新时间",value:re(l?.updated_at),valueClassName:"font-mono text-xs"})]})]})]})]})]})}const rm={[ts.NEW]:{color:"text-green-700",bgColor:"bg-green-50"},[ts.RENEWAL]:{color:"text-blue-700",bgColor:"bg-blue-50"},[ts.UPGRADE]:{color:"text-purple-700",bgColor:"bg-purple-50"},[ts.RESET_FLOW]:{color:"text-orange-700",bgColor:"bg-orange-50"}},lm={[ne.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-50"},[ne.QUARTER_PRICE]:{color:"text-cyan-700",bgColor:"bg-cyan-50"},[ne.HALF_YEAR_PRICE]:{color:"text-indigo-700",bgColor:"bg-indigo-50"},[ne.YEAR_PRICE]:{color:"text-violet-700",bgColor:"bg-violet-50"},[ne.TWO_YEAR_PRICE]:{color:"text-fuchsia-700",bgColor:"bg-fuchsia-50"},[ne.THREE_YEAR_PRICE]:{color:"text-pink-700",bgColor:"bg-pink-50"},[ne.ONETIME_PRICE]:{color:"text-rose-700",bgColor:"bg-rose-50"},[ne.RESET_PRICE]:{color:"text-orange-700",bgColor:"bg-orange-50"}},im=s=>[{accessorKey:"trade_no",header:({column:t})=>e.jsx(I,{column:t,title:"订单号"}),cell:({row:t})=>{const a=t.original.trade_no,n=a.length>6?`${a.slice(0,3)}...${a.slice(-3)}`:a;return e.jsx("div",{className:"flex items-center",children:e.jsx(nm,{trigger:e.jsxs(W,{variant:"ghost",size:"sm",className:"flex h-8 items-center gap-1.5 px-2 font-medium text-primary transition-colors hover:bg-primary/10 hover:text-primary/80",children:[e.jsx("span",{className:"font-mono",children:n}),e.jsx(An,{className:"h-3.5 w-3.5 opacity-70"})]}),id:t.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:t})=>e.jsx(I,{column:t,title:"类型"}),cell:({row:t})=>{const a=t.getValue("type"),n=rm[a]||{color:"text-gray-700",bgColor:"bg-gray-50"};return e.jsx(O,{variant:"secondary",className:b("font-medium transition-colors text-nowrap",n.color,n.bgColor,"hover:bg-opacity-80"),children:fr[a]})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:t})=>e.jsx(I,{column:t,title:"订阅计划"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium text-foreground/90 sm:max-w-72 md:max-w-[31rem]",children:t.original.plan?.name||"-"})}),enableSorting:!1,enableHiding:!1},{accessorKey:"period",header:({column:t})=>e.jsx(I,{column:t,title:"周期"}),cell:({row:t})=>{const a=t.getValue("period"),n=lm[a]||{color:"text-gray-700",bgColor:"bg-gray-50"};return e.jsx(O,{variant:"secondary",className:b("font-medium transition-colors text-nowrap",n.color,n.bgColor,"hover:bg-opacity-80"),children:st[a]})},enableSorting:!1,enableHiding:!1},{accessorKey:"total_amount",header:({column:t})=>e.jsx(I,{column:t,title:"支付金额"}),cell:({row:t})=>{const a=t.getValue("total_amount"),n=typeof a=="number"?(a/100).toFixed(2):"N/A";return e.jsxs("div",{className:"flex items-center font-mono text-foreground/90",children:["¥",n]})},enableSorting:!0,enableHiding:!1},{accessorKey:"status",header:({column:t})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(I,{column:t,title:"订单状态"}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx(Dr,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(ee,{side:"top",className:"max-w-[200px] text-sm",children:"标记为[已支付]后将会由系统进行开通后并完成"})]})})]}),cell:({row:t})=>{const a=Or.find(n=>n.value===t.getValue("status"));return a?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[a.icon&&e.jsx(a.icon,{className:`h-4 w-4 text-${a.color}`}),e.jsx("span",{className:"text-sm font-medium",children:a.label})]}),a.value===me.PENDING&&e.jsxs(vs,{modal:!0,children:[e.jsx(bs,{asChild:!0,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(bt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"打开菜单"})]})}),e.jsxs(hs,{align:"end",className:"w-[140px]",children:[e.jsx(he,{className:"cursor-pointer",onClick:async()=>{await td({trade_no:t.original.trade_no}),s()},children:"标记为已支付"}),e.jsx(he,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await ad({trade_no:t.original.trade_no}),s()},children:"取消订单"})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:t})=>e.jsx(I,{column:t,title:"佣金金额"}),cell:({row:t})=>{const a=t.getValue("commission_balance"),n=a?(a/100).toFixed(2):"-";return e.jsx("div",{className:"flex items-center font-mono text-foreground/90",children:a?`¥${n}`:"-"})},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_status",header:({column:t})=>e.jsx(I,{column:t,title:"佣金状态"}),cell:({row:t})=>{const a=t.original.commission_status,n=Lr.find(l=>l.value===t.getValue("commission_status"));return a==0||!n?e.jsx("span",{className:"text-muted-foreground",children:"-"}):e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n.icon&&e.jsx(n.icon,{className:`h-4 w-4 text-${n.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n.label})]}),n.value===fe.PENDING&&e.jsxs(vs,{modal:!0,children:[e.jsx(bs,{asChild:!0,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(bt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"打开菜单"})]})}),e.jsxs(hs,{align:"end",className:"w-[120px]",children:[e.jsx(he,{className:"cursor-pointer",onClick:async()=>{await Ia({trade_no:t.original.trade_no,commission_status:fe.PROCESSING}),s()},children:"标记为有效"}),e.jsx(he,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ia({trade_no:t.original.trade_no,commission_status:fe.INVALID}),s()},children:"标记为无效"})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:t})=>e.jsx(I,{column:t,title:"创建时间"}),cell:({row:t})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:re(t.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}];function om(){const s=_t(),t=new URLSearchParams(s.search),a=Array.from(t.entries()).map(([V,A])=>({id:V,value:isNaN(parseInt(A))?A:parseInt(A)})),[n]=o.useState(!0),l=n&&s.state?.filters?s.state.filters:[],c=[...a,...l];o.useEffect(()=>{s.state?.filters&&window.history.replaceState({...s.state,filters:void 0},"")},[]);const[d,x]=o.useState({}),[r,i]=o.useState({}),[h,D]=o.useState(c),[C,m]=o.useState([]),[w,_]=o.useState({pageIndex:0,pageSize:20}),{refetch:y,data:N,isLoading:P}=Q({queryKey:["orderList",w,h,C],queryFn:()=>ur({pageSize:w.pageSize,current:w.pageIndex+1,filter:h,sort:C})}),p=Le({data:N?.data??[],columns:im(y),state:{sorting:C,columnVisibility:r,rowSelection:d,columnFilters:h,pagination:w},rowCount:N?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:x,onSortingChange:m,onColumnFiltersChange:D,onColumnVisibilityChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),onPaginationChange:_,getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls()});return e.jsx(Ge,{table:p,toolbar:e.jsx(tm,{table:p,refetch:y}),showPagination:!0})}function cm(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:" 订单管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"在这里可以查看用户订单,包括分配、查看、删除等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(om,{})})]})]})}const dm=Object.freeze(Object.defineProperty({__proto__:null,default:cm},Symbol.toStringTag,{value:"Module"}));function um({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(c=>l.has(c.value)).map(c=>e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(js,{children:[e.jsx(Cs,{placeholder:t}),e.jsxs(gs,{children:[e.jsx(Ss,{children:"No results found."}),e.jsx(Ve,{children:a.map(c=>{const d=l.has(c.value);return e.jsxs(ve,{onSelect:()=>{d?l.delete(c.value):l.add(c.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},children:[e.jsx("div",{className:b("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ns,{className:b("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${c.color}`}),e.jsx("span",{children:c.label}),n?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(c.value)})]},c.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ls,{}),e.jsx(Ve,{children:e.jsx(ve,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const xm=u.object({id:u.coerce.number().nullable().optional(),name:u.string().min(1,"请输入优惠券名称"),code:u.string().nullable(),type:u.union([u.string(),u.nativeEnum(Et)]),value:u.coerce.number(),started_at:u.coerce.number(),ended_at:u.coerce.number(),limit_use:u.union([u.string(),u.number()]).nullable(),limit_use_with_user:u.union([u.string(),u.number()]).nullable(),generate_count:u.coerce.number().nullable().optional(),limit_plan_ids:u.array(u.number()).default([]).nullable(),limit_period:u.array(u.nativeEnum(ne)).default([]).nullable()}).refine(s=>s.ended_at>s.started_at,{message:"结束时间必须晚于开始时间",path:["ended_at"]}),Oa={name:"",code:"",type:Et.AMOUNT,value:0,started_at:Math.floor(Date.now()/1e3),ended_at:Math.floor(Date.now()/1e3)+7*24*60*60,limit_use:"",limit_use_with_user:"",limit_plan_ids:[],limit_period:[],generate_count:""};function Ar({defaultValues:s,refetch:t,type:a="create",dialogTrigger:n=e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("div",{children:"添加优惠券"})]}),open:l,onOpenChange:c}){const[d,x]=o.useState(!1),r=l??d,i=c??x,[h,D]=o.useState([]),C=ae({resolver:ie(xm),defaultValues:s||Oa});o.useEffect(()=>{s&&C.reset(s)},[s,C]),o.useEffect(()=>{ks().then(({data:y})=>D(y))},[]);const m=y=>{if(!y)return;const N=(P,p)=>{const V=new Date(p*1e3);return P.setHours(V.getHours(),V.getMinutes(),V.getSeconds()),Math.floor(P.getTime()/1e3)};y.from&&C.setValue("started_at",N(y.from,C.watch("started_at"))),y.to&&C.setValue("ended_at",N(y.to,C.watch("ended_at")))},w=async y=>{try{await ld(y),i(!1),a==="create"&&C.reset(Oa),t()}catch(N){console.error("保存优惠券失败:",N)}},_=(y,N)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:N}),e.jsx(S,{type:"datetime-local",step:"1",value:re(C.watch(y),"YYYY-MM-DDTHH:mm:ss"),onChange:P=>{const p=new Date(P.target.value);C.setValue(y,Math.floor(p.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(ue,{open:r,onOpenChange:i,children:[n&&e.jsx(Re,{asChild:!0,children:n}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(je,{children:e.jsx(xe,{children:a==="create"?"添加优惠券":"编辑优惠券"})}),e.jsx(oe,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(w),className:"space-y-4",children:[e.jsx(g,{control:C.control,name:"name",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"优惠券名称"}),e.jsx(S,{placeholder:"请输入优惠券名称",...y}),e.jsx(k,{})]})}),e.jsxs(j,{children:[e.jsx(f,{children:"优惠券类型和值"}),e.jsxs("div",{className:"flex",children:[e.jsx(g,{control:C.control,name:"type",render:({field:y})=>e.jsxs(B,{value:y.value.toString(),onValueChange:y.onChange,children:[e.jsx(q,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(G,{placeholder:"优惠券类型"})}),e.jsx(U,{children:Object.entries(aa).map(([N,P])=>e.jsx(z,{value:N,children:P},N))})]})}),e.jsx(g,{control:C.control,name:"value",render:({field:y})=>e.jsx(S,{type:"number",placeholder:"请输入值",...y,onChange:N=>y.onChange(N.target.value===""?"":N.target.value),className:"flex-[2] rounded-none border-x-0 text-left"})}),e.jsx("div",{className:"flex min-w-[40px] items-center justify-center rounded-md rounded-l-none border border-l-0 border-input bg-muted/50 px-3 font-medium text-muted-foreground",children:e.jsx("span",{children:C.watch("type")===Et.AMOUNT?"¥":"%"})})]})]}),e.jsxs(j,{children:[e.jsx(f,{children:"优惠券有效期"}),e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",className:b("w-full justify-start text-left font-normal",!C.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(rt,{className:"mr-2 h-4 w-4"}),re(C.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ","至"," ",re(C.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})}),e.jsxs(Be,{className:"w-auto p-0",align:"start",children:[e.jsx("div",{className:"border-b border-border",children:e.jsx(Ts,{mode:"range",selected:{from:new Date(C.watch("started_at")*1e3),to:new Date(C.watch("ended_at")*1e3)},onSelect:m,numberOfMonths:2})}),e.jsx("div",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[_("started_at","开始时间"),e.jsx("div",{className:"mt-6 text-sm text-muted-foreground",children:"至"}),_("ended_at","结束时间")]})})]})]}),e.jsx(k,{})]}),e.jsx(g,{control:C.control,name:"limit_use",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"最大使用次数"}),e.jsx(S,{type:"number",min:0,placeholder:"限制最大使用次数,留空则不限制",...y,value:y.value===void 0?"":y.value,onChange:N=>y.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(E,{className:"text-xs",children:"设置优惠券的总使用次数限制,留空表示不限制使用次数"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_use_with_user",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"每个用户可使用次数"}),e.jsx(S,{type:"number",min:0,placeholder:"限制每个用户可使用次数,留空则不限制",...y,value:y.value===void 0?"":y.value,onChange:N=>y.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(E,{className:"text-xs",children:"限制每个用户可使用该优惠券的次数,留空表示不限制单用户使用次数"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_period",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"指定周期"}),e.jsx(at,{options:Object.entries(ne).filter(([N])=>isNaN(Number(N))).map(([N,P])=>({label:P,value:N})),onChange:N=>{if(N.length===0){y.onChange([]);return}const P=N.map(p=>ne[p.value]);y.onChange(P)},value:(y.value||[]).map(N=>({label:Object.entries(ne).find(([P,p])=>p===N)?.[1]||"",value:Object.entries(ne).find(([P,p])=>p===N)?.[0]||""})),placeholder:"限制指定周期可以使用优惠,留空则不限制",emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"没有找到匹配的周期"})}),e.jsx(E,{className:"text-xs",children:"选择可以使用优惠券的订阅周期,留空表示不限制使用周期"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_plan_ids",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"指定订阅"}),e.jsx(at,{options:h?.map(N=>({label:N.name,value:N.id.toString()}))||[],onChange:N=>y.onChange(N.map(P=>Number(P.value))),value:(h||[]).filter(N=>(y.value||[]).includes(N.id)).map(N=>({label:N.name,value:N.id.toString()})),placeholder:"限制指定订阅可以使用优惠,留空则不限制",emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"没有找到匹配的订阅"})}),e.jsx(k,{})]})}),a==="create"&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:C.control,name:"code",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"自定义优惠码"}),e.jsx(S,{placeholder:"自定义优惠码,留空则自动生成",...y,className:"h-9"}),e.jsx(E,{className:"text-xs",children:"可以自定义优惠码,留空则系统自动生成"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"generate_count",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"批量生成数量"}),e.jsx(S,{type:"number",min:0,placeholder:"批量生成优惠码数量,留空则生成单个",...y,value:y.value===void 0?"":y.value,onChange:N=>y.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(E,{className:"text-xs",children:"批量生成多个优惠码,留空则只生成单个优惠码"}),e.jsx(k,{})]})})]}),e.jsx(Ee,{children:e.jsx(T,{type:"submit",disabled:C.formState.isSubmitting,children:C.formState.isSubmitting?"保存中...":"保存"})})]})})]})]})}function mm({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ar,{refetch:t}),e.jsx(S,{placeholder:"搜索优惠券...",value:s.getColumn("name")?.getFilterValue()??"",onChange:n=>s.getColumn("name")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(um,{column:s.getColumn("type"),title:"类型",options:Object.entries(aa).map(([n,l])=>({value:n,label:l}))}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})}const Hr=o.createContext(void 0);function hm({children:s,refetch:t}){const[a,n]=o.useState(!1),[l,c]=o.useState(null),d=r=>{c(r),n(!0)},x=()=>{n(!1),c(null)};return e.jsxs(Hr.Provider,{value:{isOpen:a,currentCoupon:l,openEdit:d,closeEdit:x},children:[s,l&&e.jsx(Ar,{defaultValues:l,refetch:t,type:"edit",open:a,onOpenChange:n})]})}function jm(){const s=o.useContext(Hr);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const gm=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"ID"}),cell:({row:t})=>e.jsx(O,{children:t.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"启用"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.original.show,onCheckedChange:a=>{od({id:t.original.id,show:a}).then(({data:n})=>!n&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx(I,{column:t,title:"卷名称"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{children:t.original.name})}),enableSorting:!1,size:800},{accessorKey:"type",header:({column:t})=>e.jsx(I,{column:t,title:"类型"}),cell:({row:t})=>e.jsx(O,{variant:"outline",children:aa[t.original.type]}),enableSorting:!0},{accessorKey:"code",header:({column:t})=>e.jsx(I,{column:t,title:"卷码"}),cell:({row:t})=>e.jsx(O,{variant:"secondary",children:t.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:t})=>e.jsx(I,{column:t,title:"剩余次数"}),cell:({row:t})=>e.jsx(O,{variant:"outline",children:t.original.limit_use===null?"无限次":t.original.limit_use}),enableSorting:!0},{accessorKey:"limit_use_with_user",header:({column:t})=>e.jsx(I,{column:t,title:"可用次数/用户"}),cell:({row:t})=>e.jsx(O,{variant:"outline",children:t.original.limit_use_with_user===null?"无限制":t.original.limit_use_with_user}),enableSorting:!0},{accessorKey:"#",header:({column:t})=>e.jsx(I,{column:t,title:"有效期"}),cell:({row:t})=>{const[a,n]=o.useState(!1),l=Date.now(),c=t.original.started_at*1e3,d=t.original.ended_at*1e3,x=l>d,r=le.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{openEdit:a}=jm();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>a(t.original),children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该优惠券,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{id({id:t.original.id}).then(({data:n})=>{n&&(L.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}}];function fm(){const[s,t]=o.useState({}),[a,n]=o.useState({}),[l,c]=o.useState([]),[d,x]=o.useState([]),[r,i]=o.useState({pageIndex:0,pageSize:20}),{refetch:h,data:D}=Q({queryKey:["couponList",r,l,d],queryFn:()=>rd({pageSize:r.pageSize,current:r.pageIndex+1,filter:l,sort:d})}),C=Le({data:D?.data??[],columns:gm(h),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:r},pageCount:Math.ceil((D?.total??0)/r.pageSize),rowCount:D?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:n,onPaginationChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(hm,{refetch:h,children:e.jsx("div",{className:"space-y-4",children:e.jsx(Ge,{table:C,toolbar:e.jsx(mm,{table:C,refetch:h})})})})}function pm(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"优惠券管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"在这里可以查看优惠券,包括增加、查看、删除等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(fm,{})})]})]})}const vm=Object.freeze(Object.defineProperty({__proto__:null,default:pm},Symbol.toStringTag,{value:"Module"})),bm=u.object({email_prefix:u.string().optional(),email_suffix:u.string().min(1),password:u.string().optional(),expired_at:u.number().optional().nullable(),plan_id:u.number().nullable(),generate_count:u.number().optional().nullable()}).refine(s=>s.generate_count===null?s.email_prefix!==void 0&&s.email_prefix!=="":!0,{message:"Email prefix is required when generate_count is null",path:["email_prefix"]}),ym={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0};function Nm({refetch:s}){const[t,a]=o.useState(!1),n=ae({resolver:ie(bm),defaultValues:ym,mode:"onChange"}),[l,c]=o.useState([]);return o.useEffect(()=>{t&&ks().then(({data:d})=>{d&&c(d)})},[t]),e.jsxs(ue,{open:t,onOpenChange:a,children:[e.jsx(Re,{asChild:!0,children:e.jsxs(W,{size:"sm",variant:"outline",className:"space-x-2 gap-0",children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("div",{children:"创建用户"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:"创建用户"}),e.jsx(Se,{})]}),e.jsxs(oe,{...n,children:[e.jsxs(j,{children:[e.jsx(f,{children:"邮箱"}),e.jsxs("div",{className:"flex",children:[!n.watch("generate_count")&&e.jsx(g,{control:n.control,name:"email_prefix",render:({field:d})=>e.jsx(S,{className:"flex-[5] rounded-r-none",placeholder:"帐号(批量生成请留空)",...d})}),e.jsx("div",{className:`z-[-1] border border-r-0 border-input px-3 py-1 shadow-sm ${n.watch("generate_count")?"rounded-l-md":"border-l-0"}`,children:"@"}),e.jsx(g,{control:n.control,name:"email_suffix",render:({field:d})=>e.jsx(S,{className:"flex-[4] rounded-l-none",placeholder:"域",...d})})]})]}),e.jsx(g,{control:n.control,name:"password",render:({field:d})=>e.jsxs(j,{children:[e.jsx(f,{children:"密码"}),e.jsx(S,{placeholder:"留空则密码与邮件相同",...d}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"expired_at",render:({field:d})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(f,{children:"到期时间"}),e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(v,{children:e.jsxs(W,{variant:"outline",className:b("w-full pl-3 text-left font-normal",!d.value&&"text-muted-foreground"),children:[d.value?re(d.value):e.jsx("span",{children:"请选择用户到期日期,留空为长期有效"}),e.jsx(rt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(Be,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(ho,{asChild:!0,children:e.jsx(W,{variant:"outline",className:"w-full",onClick:()=>{d.onChange(null)},children:"长期有效"})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Ts,{mode:"single",selected:d.value?new Date(d.value*1e3):void 0,onSelect:x=>{x&&d.onChange(x?.getTime()/1e3)}})})]})]})]})}),e.jsx(g,{control:n.control,name:"plan_id",render:({field:d})=>e.jsxs(j,{children:[e.jsx(f,{children:"订阅计划"}),e.jsx(v,{children:e.jsxs(B,{value:d.value?d.value.toString():"null",onValueChange:x=>d.onChange(x==="null"?null:parseInt(x)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"无"})}),e.jsxs(U,{children:[e.jsx(z,{value:"null",children:"无"}),l.map(x=>e.jsx(z,{value:x.id.toString(),children:x.name},x.id))]})]})})]})}),!n.watch("email_prefix")&&e.jsx(g,{control:n.control,name:"generate_count",render:({field:d})=>e.jsxs(j,{children:[e.jsx(f,{children:"生成数量"}),e.jsx(S,{type:"number",placeholder:"如果为批量生产请输入生成数量",value:d.value||"",onChange:x=>d.onChange(x.target.value?parseInt(x.target.value):null)})]})})]}),e.jsxs(Ee,{children:[e.jsx(W,{variant:"outline",onClick:()=>a(!1),children:"取消"}),e.jsx(W,{onClick:()=>n.handleSubmit(d=>{xd(d).then(({data:x})=>{x&&(L.success("生成成功"),n.reset(),s(),a(!1))})})(),children:"生成"})]})]})]})}const Kr=Aa,qr=Ha,wm=Ka,Ur=o.forwardRef(({className:s,...t},a)=>e.jsx(Ct,{className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t,ref:a}));Ur.displayName=Ct.displayName;const _m=ys("fixed overflow-y-scroll z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-md",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-md"}},defaultVariants:{side:"right"}}),da=o.forwardRef(({side:s="right",className:t,children:a,...n},l)=>e.jsxs(wm,{children:[e.jsx(Ur,{}),e.jsxs(St,{ref:l,className:b(_m({side:s}),t),...n,children:[e.jsxs(Qt,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(Me,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),a]})]}));da.displayName=St.displayName;const ua=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col space-y-2 text-center sm:text-left",s),...t});ua.displayName="SheetHeader";const Br=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});Br.displayName="SheetFooter";const xa=o.forwardRef(({className:s,...t},a)=>e.jsx(kt,{ref:a,className:b("text-lg font-semibold text-foreground",s),...t}));xa.displayName=kt.displayName;const ma=o.forwardRef(({className:s,...t},a)=>e.jsx(Tt,{ref:a,className:b("text-sm text-muted-foreground",s),...t}));ma.displayName=Tt.displayName;const Gs=[{label:"邮箱",value:"email",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"用户ID",value:"id",type:"number",operators:[{label:"等于",value:"eq"}]},{label:"订阅",value:"plan_id",type:"select",operators:[{label:"等于",value:"eq"}],useOptions:!0},{label:"流量",value:"transfer_enable",type:"number",unit:"GB",operators:[{label:"大于",value:"gt"},{label:"小于",value:"lt"},{label:"等于",value:"eq"}]},{label:"已用流量",value:"total_used",type:"number",unit:"GB",operators:[{label:"大于",value:"gt"},{label:"小于",value:"lt"},{label:"等于",value:"eq"}]},{label:"在线设备",value:"online_count",type:"number",operators:[{label:"等于",value:"eq"},{label:"大于",value:"gt"},{label:"小于",value:"lt"}]},{label:"到期时间",value:"expired_at",type:"date",operators:[{label:"早于",value:"lt"},{label:"晚于",value:"gt"},{label:"等于",value:"eq"}]},{label:"UUID",value:"uuid",type:"text",operators:[{label:"等于",value:"eq"}]},{label:"Token",value:"token",type:"text",operators:[{label:"等于",value:"eq"}]},{label:"账号状态",value:"banned",type:"select",operators:[{label:"等于",value:"eq"}],options:[{label:"正常",value:"0"},{label:"禁用",value:"1"}]},{label:"备注",value:"remark",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"邀请人邮箱",value:"inviter_email",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"邀请人ID",value:"invite_user_id",type:"number",operators:[{label:"等于",value:"eq"}]},{label:"管理员",value:"is_admin",type:"boolean",operators:[{label:"等于",value:"eq"}]},{label:"员工",value:"is_staff",type:"boolean",operators:[{label:"等于",value:"eq"}]}];function Cm({table:s,refetch:t,permissionGroups:a=[],subscriptionPlans:n=[]}){const l=s.getState().columnFilters.length>0,[c,d]=o.useState([]),[x,r]=o.useState(!1),i=y=>y*1024*1024*1024,h=y=>y/(1024*1024*1024),D=()=>{d([...c,{field:"",operator:"",value:""}])},C=y=>{d(c.filter((N,P)=>P!==y))},m=(y,N,P)=>{const p=[...c];if(p[y]={...p[y],[N]:P},N==="field"){const V=Gs.find(A=>A.value===P);V&&(p[y].operator=V.operators[0].value,p[y].value=V.type==="boolean"?!1:"")}d(p)},w=(y,N)=>{const P=Gs.find(p=>p.value===y.field);if(!P)return null;switch(P.type){case"text":return e.jsx(S,{placeholder:"输入值",value:y.value,onChange:p=>m(N,"value",p.target.value)});case"number":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(S,{type:"number",placeholder:`输入数值${P.unit?`(${P.unit})`:""}`,value:P.unit==="GB"?h(y.value||0):y.value,onChange:p=>{const V=Number(p.target.value);m(N,"value",P.unit==="GB"?i(V):V)}}),P.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:P.unit})]});case"date":return e.jsx(Ts,{mode:"single",selected:y.value,onSelect:p=>m(N,"value",p),className:"rounded-md border"});case"select":return e.jsxs(B,{value:y.value,onValueChange:p=>m(N,"value",p),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择选项"})}),e.jsx(U,{children:P.useOptions?n.map(p=>e.jsx(z,{value:p.value.toString(),children:p.label},p.value)):P.options?.map(p=>e.jsx(z,{value:p.value.toString(),children:p.label},p.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(H,{checked:y.value,onCheckedChange:p=>m(N,"value",p)}),e.jsx(yt,{children:y.value?"是":"否"})]});default:return null}},_=()=>{const y=c.filter(N=>N.field&&N.operator&&N.value!=="").map(N=>{const P=Gs.find(V=>V.value===N.field);let p=N.value;return N.operator==="contains"?{id:N.field,value:p}:(P?.type==="date"&&p instanceof Date&&(p=Math.floor(p.getTime()/1e3)),P?.type==="boolean"&&(p=p?1:0),{id:N.field,value:`${N.operator}:${p}`})});s.setColumnFilters(y),r(!1)};return e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2",children:e.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[e.jsx(Nm,{refetch:t}),e.jsx(S,{placeholder:"搜索用户邮箱...",value:s.getColumn("email")?.getFilterValue()??"",onChange:y=>s.getColumn("email")?.setFilterValue(y.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(Kr,{open:x,onOpenChange:r,children:[e.jsx(qr,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(jo,{className:"mr-2 h-4 w-4"}),"高级筛选",c.length>0&&e.jsx(O,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:c.length})]})}),e.jsxs(da,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(ua,{children:[e.jsx(xa,{children:"高级筛选"}),e.jsx(ma,{children:"添加一个或多个筛选条件来精确查找用户"})]}),e.jsxs("div",{className:"mt-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-medium",children:"筛选条件"}),e.jsx(T,{variant:"outline",size:"sm",onClick:D,children:"添加条件"})]}),e.jsx(tt,{className:"h-[calc(100vh-280px)] pr-4",children:e.jsx("div",{className:"space-y-4",children:c.map((y,N)=>e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(yt,{children:["条件 ",N+1]}),e.jsx(T,{variant:"ghost",size:"sm",onClick:()=>C(N),children:e.jsx(Me,{className:"h-4 w-4"})})]}),e.jsxs(B,{value:y.field,onValueChange:P=>m(N,"field",P),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择字段"})}),e.jsx(U,{children:Gs.map(P=>e.jsx(z,{value:P.value,children:P.label},P.value))})]}),y.field&&e.jsxs(B,{value:y.operator,onValueChange:P=>m(N,"operator",P),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择操作符"})}),e.jsx(U,{children:Gs.find(P=>P.value===y.field)?.operators.map(P=>e.jsx(z,{value:P.value,children:P.label},P.value))})]}),y.field&&y.operator&&w(y,N)]},N))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(T,{variant:"outline",onClick:()=>{d([]),r(!1)},children:"重置"}),e.jsx(T,{onClick:_,children:"应用筛选"})]})]})]})]}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),d([])},className:"h-8 px-2 lg:px-3",children:["重置筛选",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})})}const Sm=u.object({id:u.number(),email:u.string().email(),invite_user_email:u.string().email().nullable().optional(),password:u.string().optional().nullable(),balance:u.coerce.number(),commission_balance:u.coerce.number(),u:u.number(),d:u.number(),transfer_enable:u.number(),expired_at:u.number().nullable(),plan_id:u.number().nullable(),banned:u.number(),commission_type:u.number(),commission_rate:u.number().nullable(),discount:u.number().nullable(),speed_limit:u.number().nullable(),device_limit:u.number().nullable(),is_admin:u.number(),is_staff:u.number(),remarks:u.string().nullable()}),Gr=o.createContext(void 0);function km({children:s,defaultValues:t,open:a,onOpenChange:n}){const[l,c]=o.useState(!1),[d,x]=o.useState(!1),[r,i]=o.useState([]),h=ae({resolver:ie(Sm),defaultValues:t,mode:"onChange"});o.useEffect(()=>{a!==void 0&&c(a)},[a]);const D=C=>{c(C),n?.(C)};return e.jsx(Gr.Provider,{value:{form:h,formOpen:l,setFormOpen:D,datePickerOpen:d,setDatePickerOpen:x,planList:r,setPlanList:i},children:s})}function Tm(){const s=o.useContext(Gr);if(!s)throw new Error("useUserForm must be used within a UserFormProvider");return s}function Dm({refetch:s}){const{form:t,formOpen:a,setFormOpen:n,datePickerOpen:l,setDatePickerOpen:c,planList:d,setPlanList:x}=Tm();return o.useEffect(()=>{a&&ks().then(({data:r})=>{x(r)})},[a,x]),e.jsxs(oe,{...t,children:[e.jsx(g,{control:t.control,name:"email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"邮箱"}),e.jsx(v,{children:e.jsx(S,{...r,placeholder:"请输入邮箱"})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"invite_user_email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"邀请人邮箱"}),e.jsx(v,{children:e.jsx(S,{value:r.value||"",onChange:i=>r.onChange(i.target.value?i.target.value:null),placeholder:"请输入邮箱"})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"password",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"密码"}),e.jsx(v,{children:e.jsx(S,{value:r.value||"",onChange:r.onChange,placeholder:"如需修改密码请输入"})}),e.jsx(k,{...r})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(g,{control:t.control,name:"balance",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"余额"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:r.onChange,placeholder:"请输入余额",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"commission_balance",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"佣金余额"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:r.onChange,placeholder:"请输入佣金余额",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"u",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"已用上行"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"已用上行",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"d",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"已用下行"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"已用下行",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{...r})]})})]}),e.jsx(g,{control:t.control,name:"transfer_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"流量"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"请输入流量",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"expired_at",render:({field:r})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(f,{children:"到期时间"}),e.jsxs(Qe,{open:l,onOpenChange:c,children:[e.jsx(Ze,{asChild:!0,children:e.jsx(v,{children:e.jsxs(T,{type:"button",variant:"outline",className:b("w-full pl-3 text-left font-normal",!r.value&&"text-muted-foreground"),onClick:()=>c(!0),children:[r.value?re(r.value):e.jsx("span",{children:"请选择用户到期日期,留空为长期有效"}),e.jsx(rt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Be,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:i=>{i.preventDefault()},onEscapeKeyDown:i=>{i.preventDefault()},children:e.jsxs("div",{className:"flex flex-col space-y-3 p-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{r.onChange(null),c(!1)},children:"长期有效"}),e.jsx(T,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const i=new Date;i.setMonth(i.getMonth()+1),i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3)),c(!1)},children:"一个月"}),e.jsx(T,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const i=new Date;i.setMonth(i.getMonth()+3),i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3)),c(!1)},children:"三个月"})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Ts,{mode:"single",selected:r.value?new Date(r.value*1e3):void 0,onSelect:i=>{if(i){const h=new Date(r.value?r.value*1e3:Date.now());i.setHours(h.getHours(),h.getMinutes(),h.getSeconds()),r.onChange(Math.floor(i.getTime()/1e3))}},disabled:i=>i{const i=new Date;i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3))},className:"h-6 px-2 text-xs",children:"设为当天结束"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{type:"datetime-local",step:"1",value:re(r.value,"YYYY-MM-DDTHH:mm:ss"),onChange:i=>{const h=new Date(i.target.value);isNaN(h.getTime())||r.onChange(Math.floor(h.getTime()/1e3))},className:"flex-1"}),e.jsx(T,{type:"button",variant:"outline",onClick:()=>c(!1),children:"确定"})]})]})]})})]}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"plan_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"订阅计划"}),e.jsx(v,{children:e.jsxs(B,{value:r.value?r.value.toString():"null",onValueChange:i=>r.onChange(i==="null"?null:parseInt(i)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"无"})}),e.jsxs(U,{children:[e.jsx(z,{value:"null",children:"无"}),d.map(i=>e.jsx(z,{value:i.id.toString(),children:i.name},i.id))]})]})})]})}),e.jsx(g,{control:t.control,name:"banned",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"账户状态"}),e.jsx(v,{children:e.jsxs(B,{value:r.value.toString(),onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(q,{children:e.jsx(G,{})}),e.jsxs(U,{children:[e.jsx(z,{value:"1",children:"封禁"}),e.jsx(z,{value:"0",children:"正常"})]})]})})]})}),e.jsx(g,{control:t.control,name:"commission_type",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"佣金类型"}),e.jsx(v,{children:e.jsxs(B,{value:r.value.toString(),onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"无"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"跟随系统设置"}),e.jsx(z,{value:"1",children:"循环返利"}),e.jsx(z,{value:"2",children:"首次返利"})]})]})})]})}),e.jsx(g,{control:t.control,name:"commission_rate",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"推荐返利比例"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"请输入推荐返利比例(为空则跟随站点设置返利比例)",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})})]})}),e.jsx(g,{control:t.control,name:"discount",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"专享折扣比例"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"请输入专享折扣比例(为空则不享受专享折扣)",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"speed_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"限速"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"留空则不限速",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"Mbps"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"device_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"设备限制"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"留空则不限制",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"台"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"is_admin",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"是否管理员"}),e.jsx("div",{className:"py-2",children:e.jsx(v,{children:e.jsx(H,{checked:r.value===1,onCheckedChange:i=>r.onChange(i?1:0)})})})]})}),e.jsx(g,{control:t.control,name:"is_staff",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"是否员工"}),e.jsx("div",{className:"py-2",children:e.jsx(v,{children:e.jsx(H,{checked:r.value===1,onCheckedChange:i=>r.onChange(i?1:0)})})})]})}),e.jsx(g,{control:t.control,name:"remarks",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"备注"}),e.jsx(v,{children:e.jsx(cs,{className:"h-24",value:r.value||"",onChange:i=>r.onChange(i.currentTarget.value??null),placeholder:"请在这里记录"})}),e.jsx(k,{})]})}),e.jsxs(Br,{children:[e.jsx(T,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(T,{type:"submit",onClick:()=>{t.handleSubmit(r=>{dd(r).then(({data:i})=>{i&&(L.success("修改成功"),n(!1),s())})})()},children:"提交"})]})]})}function Yr({refetch:s,defaultValues:t,dialogTrigger:a=e.jsxs(T,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),"编辑用户信息"]})}){const[n,l]=o.useState(!1);return e.jsx(km,{defaultValues:t,open:n,onOpenChange:l,children:e.jsxs(Kr,{open:n,onOpenChange:l,children:[e.jsx(qr,{asChild:!0,children:a}),e.jsxs(da,{className:"max-w-[90%] space-y-4",children:[e.jsxs(ua,{children:[e.jsx(xa,{children:"用户管理"}),e.jsx(ma,{})]}),e.jsx(Dm,{refetch:s})]})]})})}const Wr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m17.71 11.29l-5-5a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21l-5 5a1 1 0 0 0 1.42 1.42L11 9.41V17a1 1 0 0 0 2 0V9.41l3.29 3.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42"})}),Jr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.71 11.29a1 1 0 0 0-1.42 0L13 14.59V7a1 1 0 0 0-2 0v7.59l-3.29-3.3a1 1 0 0 0-1.42 1.42l5 5a1 1 0 0 0 .33.21a.94.94 0 0 0 .76 0a1 1 0 0 0 .33-.21l5-5a1 1 0 0 0 0-1.42"})}),Pm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17 11H9.41l3.3-3.29a1 1 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33a1 1 0 0 0 0 .76a1 1 0 0 0 .21.33l5 5a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42L9.41 13H17a1 1 0 0 0 0-2"})}),Im=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.92 11.62a1 1 0 0 0-.21-.33l-5-5a1 1 0 0 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l5-5a1 1 0 0 0 .21-.33a1 1 0 0 0 0-.76"})}),At=[{accessorKey:"record_at",header:"时间",cell:({row:s})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("time",{className:"text-sm text-muted-foreground",children:Yo(s.original.record_at)})})},{accessorKey:"u",header:"上行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Wr,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:Fs(s.original.u)})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Jr,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:Fs(s.original.d)})]})},{accessorKey:"server_rate",header:"倍率",cell:({row:s})=>{const t=s.original.server_rate;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(O,{variant:"outline",className:"font-mono",children:[t,"x"]})})}},{id:"total",header:"总计",cell:({row:s})=>{const t=(s.original.u+s.original.d)*s.original.server_rate;return e.jsx("div",{className:"flex items-center justify-end font-mono text-sm",children:Fs(t)})}}];function Qr({user_id:s,dialogTrigger:t}){const[a,n]=o.useState(!1),[l,c]=o.useState({pageIndex:0,pageSize:20}),{data:d,isLoading:x}=Q({queryKey:["userStats",s,l,a],queryFn:()=>a?md({user_id:s,pageSize:l.pageSize,page:l.pageIndex+1}):null}),r=Le({data:d?.data??[],columns:At,pageCount:Math.ceil((d?.total??0)/l.pageSize),state:{pagination:l},manualPagination:!0,getCoreRowModel:$e(),onPaginationChange:c});return e.jsxs(ue,{open:a,onOpenChange:n,children:[e.jsx(Re,{asChild:!0,children:t}),e.jsxs(ce,{className:"sm:max-w-[700px]",children:[e.jsx(je,{children:e.jsx(xe,{children:"流量使用记录"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(na,{children:[e.jsx(ra,{children:r.getHeaderGroups().map(i=>e.jsx(ms,{children:i.headers.map(h=>e.jsx(ia,{className:b("h-10 px-2 text-xs",h.id==="total"&&"text-right"),children:h.isPlaceholder?null:vt(h.column.columnDef.header,h.getContext())},h.id))},i.id))}),e.jsx(la,{children:x?Array.from({length:l.pageSize}).map((i,h)=>e.jsx(ms,{children:Array.from({length:At.length}).map((D,C)=>e.jsx(Ms,{className:"p-2",children:e.jsx(Fe,{className:"h-6 w-full"})},C))},h)):r.getRowModel().rows?.length?r.getRowModel().rows.map(i=>e.jsx(ms,{"data-state":i.getIsSelected()&&"selected",className:"h-10",children:i.getVisibleCells().map(h=>e.jsx(Ms,{className:"px-2",children:vt(h.column.columnDef.cell,h.getContext())},h.id))},i.id)):e.jsx(ms,{children:e.jsx(Ms,{colSpan:At.length,className:"h-24 text-center",children:"暂无记录"})})})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"每页显示"}),e.jsxs(B,{value:`${r.getState().pagination.pageSize}`,onValueChange:i=>{r.setPageSize(Number(i))},children:[e.jsx(q,{className:"h-8 w-[70px]",children:e.jsx(G,{placeholder:r.getState().pagination.pageSize})}),e.jsx(U,{side:"top",children:[10,20,30,40,50].map(i=>e.jsx(z,{value:`${i}`,children:i},i))})]}),e.jsx("p",{className:"text-sm font-medium",children:"条记录"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm",children:["第 ",r.getState().pagination.pageIndex+1," /"," ",r.getPageCount()," 页"]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r.previousPage(),disabled:!r.getCanPreviousPage()||x,children:e.jsx(Pm,{className:"h-4 w-4"})}),e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r.nextPage(),disabled:!r.getCanNextPage()||x,children:e.jsx(Im,{className:"h-4 w-4"})})]})]})]})]})]})]})}const Vm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M5 18h4.24a1 1 0 0 0 .71-.29l6.92-6.93L19.71 8a1 1 0 0 0 0-1.42l-4.24-4.29a1 1 0 0 0-1.42 0l-2.82 2.83l-6.94 6.93a1 1 0 0 0-.29.71V17a1 1 0 0 0 1 1m9.76-13.59l2.83 2.83l-1.42 1.42l-2.83-2.83ZM6 13.17l5.93-5.93l2.83 2.83L8.83 16H6ZM21 20H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2"})}),Rm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11h-6V5a1 1 0 0 0-2 0v6H5a1 1 0 0 0 0 2h6v6a1 1 0 0 0 2 0v-6h6a1 1 0 0 0 0-2"})}),Em=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 8.94a1.3 1.3 0 0 0-.06-.27v-.09a1 1 0 0 0-.19-.28l-6-6a1 1 0 0 0-.28-.19a.3.3 0 0 0-.09 0a.9.9 0 0 0-.33-.11H10a3 3 0 0 0-3 3v1H6a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-1h1a3 3 0 0 0 3-3zm-6-3.53L17.59 8H16a1 1 0 0 1-1-1ZM15 19a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h1v7a3 3 0 0 0 3 3h5Zm4-4a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3v3a3 3 0 0 0 3 3h3Z"})}),Fm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 11a1 1 0 0 0-1 1a8.05 8.05 0 1 1-2.22-5.5h-2.4a1 1 0 0 0 0 2h4.53a1 1 0 0 0 1-1V3a1 1 0 0 0-2 0v1.77A10 10 0 1 0 22 12a1 1 0 0 0-1-1"})}),Mm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9.5 10.5H12a1 1 0 0 0 0-2h-1V8a1 1 0 0 0-2 0v.55a2.5 2.5 0 0 0 .5 4.95h1a.5.5 0 0 1 0 1H8a1 1 0 0 0 0 2h1v.5a1 1 0 0 0 2 0v-.55a2.5 2.5 0 0 0-.5-4.95h-1a.5.5 0 0 1 0-1M21 12h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Z"})}),zm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12.3 12.22A4.92 4.92 0 0 0 14 8.5a5 5 0 0 0-10 0a4.92 4.92 0 0 0 1.7 3.72A8 8 0 0 0 1 19.5a1 1 0 0 0 2 0a6 6 0 0 1 12 0a1 1 0 0 0 2 0a8 8 0 0 0-4.7-7.28M9 11.5a3 3 0 1 1 3-3a3 3 0 0 1-3 3m9.74.32A5 5 0 0 0 15 3.5a1 1 0 0 0 0 2a3 3 0 0 1 3 3a3 3 0 0 1-1.5 2.59a1 1 0 0 0-.5.84a1 1 0 0 0 .45.86l.39.26l.13.07a7 7 0 0 1 4 6.38a1 1 0 0 0 2 0a9 9 0 0 0-4.23-7.68"})}),Om=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 0 0-6.88 2.77V3a1 1 0 0 0-2 0v4.5a1 1 0 0 0 1 1h4.5a1 1 0 0 0 0-2h-2.4A8 8 0 1 1 4 12a1 1 0 0 0-2 0A10 10 0 1 0 12 2m0 6a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h2a1 1 0 0 0 0-2h-1V9a1 1 0 0 0-1-1"})}),Lm=(s,t)=>[{accessorKey:"is_admin",header:({column:a})=>e.jsx(I,{column:a,title:"管理员"}),enableSorting:!1,enableHiding:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n)),size:0},{accessorKey:"is_staff",header:({column:a})=>e.jsx(I,{column:a,title:"员工"}),enableSorting:!1,enableHiding:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n)),size:0},{accessorKey:"id",header:({column:a})=>e.jsx(I,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(O,{variant:"outline",children:a.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:a})=>e.jsx(I,{column:a,title:"邮箱"}),cell:({row:a})=>{const n=a.original.t||0,l=Date.now()/1e3-n<120,c=Math.floor(Date.now()/1e3-n);let d=l?"当前在线":n===0?"从未在线":`最后在线时间: ${re(n)}`;if(!l&&n!==0){const x=Math.floor(c/60),r=Math.floor(x/60),i=Math.floor(r/24);i>0?d+=` +- 支持随时更换套餐`)},children:"使用模板"})}),e.jsx(ee,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:"点击使用预设的套餐描述模板"})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${_?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"}`,children:[e.jsx("div",{className:"space-y-2",children:e.jsx(v,{children:e.jsx(ta,{style:{height:"400px"},value:w.value||"",renderHTML:N=>r.render(N),onChange:({text:N})=>w.onChange(N),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:"在这里编写套餐描述...",className:"rounded-md border"})})}),_&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"预览"}),e.jsx("div",{className:"prose prose-sm dark:prose-invert h-[400px] max-w-none overflow-y-auto rounded-md border p-4",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:r.render(w.value||"")}})})]})]}),e.jsx(E,{className:"text-xs",children:"支持 Markdown 格式,可以使用标题、列表、粗体、斜体等样式来美化描述内容"}),e.jsx(k,{})]})}})]}),e.jsx(Ee,{className:"mt-6",children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("div",{className:"flex-shrink-0",children:a&&e.jsx(g,{control:x.control,name:"force_update",render:({field:w})=>e.jsxs(j,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(v,{children:e.jsx(Or,{checked:w.value,onCheckedChange:w.onChange})}),e.jsx("div",{className:"",children:e.jsx(f,{className:"text-sm",children:"强制更新到用户"})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(T,{type:"button",variant:"outline",onClick:m,children:"取消"}),e.jsx(T,{type:"submit",disabled:c,onClick:()=>{x.handleSubmit(async w=>{d(!0),(await Xc(w)).data&&(L.success(a?"套餐更新成功":"套餐添加成功"),m(),l()),d(!1)})()},children:c?"提交中...":"提交"})]})]})})]})]})})}function Jx(){const[s,t]=o.useState({}),[a,n]=o.useState({"drag-handle":!1}),[l,c]=o.useState([]),[d,x]=o.useState([]),[r,i]=o.useState(!1),[h,D]=o.useState({pageSize:20,pageIndex:0}),[C,m]=o.useState([]),{refetch:w}=Q({queryKey:["planList"],queryFn:async()=>{const{data:p}=await ks();return m(p),p}});o.useEffect(()=>{n({"drag-handle":r}),D({pageSize:r?99999:10,pageIndex:0})},[r]);const _=(p,V)=>{r&&(p.dataTransfer.setData("text/plain",V.toString()),p.currentTarget.classList.add("opacity-50"))},y=(p,V)=>{if(!r)return;p.preventDefault(),p.currentTarget.classList.remove("bg-muted");const A=parseInt(p.dataTransfer.getData("text/plain"));if(A===V)return;const $=[...C],[F]=$.splice(A,1);$.splice(V,0,F),m($)},N=async()=>{if(!r){i(!0);return}const p=C?.map(V=>V.id);sd(p).then(()=>{L.success("排序保存成功"),i(!1),w()}).finally(()=>{i(!1)})},P=Le({data:C||[],columns:Bx(w),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:h},enableRowSelection:!0,onPaginationChange:D,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}},pageCount:r?1:void 0});return e.jsx(qx,{refreshData:w,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ge,{table:P,toolbar:p=>e.jsx(Ux,{table:p,refetch:w,saveOrder:N,isSortMode:r}),draggable:r,onDragStart:_,onDragEnd:p=>p.currentTarget.classList.remove("opacity-50"),onDragOver:p=>{p.preventDefault(),p.currentTarget.classList.add("bg-muted")},onDragLeave:p=>p.currentTarget.classList.remove("bg-muted"),onDrop:y,showPagination:!r}),e.jsx(Wx,{})]})})}function Qx(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"订阅管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以配置订阅计划,包括添加、删除、编辑等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Jx,{})})]})]})}const Zx=Object.freeze(Object.defineProperty({__proto__:null,default:Qx},Symbol.toStringTag,{value:"Module"})),Lr=[{value:me.PENDING,label:Vs[me.PENDING],icon:xo,color:Us[me.PENDING]},{value:me.PROCESSING,label:Vs[me.PROCESSING],icon:$n,color:Us[me.PROCESSING]},{value:me.COMPLETED,label:Vs[me.COMPLETED],icon:Ut,color:Us[me.COMPLETED]},{value:me.CANCELLED,label:Vs[me.CANCELLED],icon:An,color:Us[me.CANCELLED]},{value:me.DISCOUNTED,label:Vs[me.DISCOUNTED],icon:Ut,color:Us[me.DISCOUNTED]}],$r=[{value:fe.PENDING,label:ct[fe.PENDING],icon:mo,color:dt[fe.PENDING]},{value:fe.PROCESSING,label:ct[fe.PROCESSING],icon:$n,color:dt[fe.PROCESSING]},{value:fe.VALID,label:ct[fe.VALID],icon:Ut,color:dt[fe.VALID]},{value:fe.INVALID,label:ct[fe.INVALID],icon:An,color:dt[fe.INVALID]}];function ft({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=s?.getFilterValue(),c=Array.isArray(l)?new Set(l):l!==void 0?new Set([l]):new Set;return e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,c?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:c.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:c.size>2?e.jsxs(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[c.size," selected"]}):a.filter(d=>c.has(d.value)).map(d=>e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:d.label},d.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(hs,{children:[e.jsx(Cs,{placeholder:t}),e.jsxs(js,{children:[e.jsx(Ss,{children:"No results found."}),e.jsx(Ve,{children:a.map(d=>{const x=c.has(d.value);return e.jsxs(ve,{onSelect:()=>{const r=new Set(c);x?r.delete(d.value):r.add(d.value);const i=Array.from(r);s?.setFilterValue(i.length?i:void 0)},children:[e.jsx("div",{className:b("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ns,{className:b("h-4 w-4")})}),d.icon&&e.jsx(d.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${d.color}`}),e.jsx("span",{children:d.label}),n?.get(d.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(d.value)})]},d.value)})}),c.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ls,{}),e.jsx(Ve,{children:e.jsx(ve,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Xx=u.object({email:u.string().min(1),plan_id:u.number(),period:u.string(),total_amount:u.number()}),em={email:"",plan_id:0,total_amount:0,period:""};function Ar({refetch:s,trigger:t,defaultValues:a}){const[n,l]=o.useState(!1),c=ae({resolver:ie(Xx),defaultValues:{...em,...a},mode:"onChange"}),[d,x]=o.useState([]);return o.useEffect(()=>{n&&ks().then(({data:r})=>{x(r)})},[n]),e.jsxs(ue,{open:n,onOpenChange:l,children:[e.jsx(Re,{asChild:!0,children:t||e.jsxs(T,{variant:"outline",size:"sm",className:" h-8 space-x-2",children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("div",{children:"添加订单"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:"订单分配"}),e.jsx(Se,{})]}),e.jsxs(oe,{...c,children:[e.jsx(g,{control:c.control,name:"email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"用户邮箱"}),e.jsx(v,{children:e.jsx(S,{placeholder:"请输入用户邮箱",...r})})]})}),e.jsx(g,{control:c.control,name:"plan_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"订阅计划"}),e.jsx(v,{children:e.jsxs(B,{value:r.value?r.value?.toString():void 0,onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择订阅计划"})}),e.jsx(U,{children:d.map(i=>e.jsx(z,{value:i.id.toString(),children:i.name},i.id))})]})})]})}),e.jsx(g,{control:c.control,name:"period",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"订阅时长"}),e.jsx(v,{children:e.jsxs(B,{value:r.value,onValueChange:r.onChange,children:[e.jsx(q,{children:e.jsx(G,{placeholder:"请选择购买时长"})}),e.jsx(U,{children:Object.keys(st).map(i=>e.jsx(z,{value:i,children:st[i]},i))})]})})]})}),e.jsx(g,{control:c.control,name:"total_amount",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"支付金额"}),e.jsx(v,{children:e.jsx(S,{type:"number",placeholder:"请输入需要支付的金额",value:r.value/100,onChange:i=>r.onChange(parseFloat(i.currentTarget.value)*100)})}),e.jsx(k,{})]})}),e.jsxs(Ee,{children:[e.jsx(T,{variant:"outline",onClick:()=>l(!1),children:"取消"}),e.jsx(T,{type:"submit",onClick:()=>{c.handleSubmit(r=>{rd(r).then(({data:i})=>{i&&(s&&s(),c.reset(),l(!1),L.success("添加成功"))})})()},children:"确定"})]})]})]})]})}const sm=Object.values(ts).filter(s=>typeof s=="number").map(s=>({label:pr[s],value:s,color:s===ts.NEW?"green-500":s===ts.RENEWAL?"blue-500":s===ts.UPGRADE?"purple-500":"orange-500"})),tm=Object.values(ne).map(s=>({label:st[s],value:s,color:s===ne.MONTH_PRICE?"slate-500":s===ne.QUARTER_PRICE?"cyan-500":s===ne.HALF_YEAR_PRICE?"indigo-500":s===ne.YEAR_PRICE?"violet-500":s===ne.TWO_YEAR_PRICE?"fuchsia-500":s===ne.THREE_YEAR_PRICE?"pink-500":s===ne.ONETIME_PRICE?"rose-500":"orange-500"}));function am({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ar,{refetch:t}),e.jsx(S,{placeholder:"搜索订单...",value:s.getColumn("trade_no")?.getFilterValue()??"",onChange:n=>s.getColumn("trade_no")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex flex-wrap gap-x-2",children:[s.getColumn("type")&&e.jsx(ft,{column:s.getColumn("type"),title:"订单类型",options:sm}),s.getColumn("period")&&e.jsx(ft,{column:s.getColumn("period"),title:"订单周期",options:tm}),s.getColumn("status")&&e.jsx(ft,{column:s.getColumn("status"),title:"订单状态",options:Lr}),s.getColumn("commission_status")&&e.jsx(ft,{column:s.getColumn("commission_status"),title:"佣金状态",options:$r})]}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})}function Ae({label:s,value:t,className:a,valueClassName:n}){return e.jsxs("div",{className:b("flex items-center py-1.5",a),children:[e.jsx("div",{className:"w-28 shrink-0 text-sm text-muted-foreground",children:s}),e.jsx("div",{className:b("text-sm",n),children:t||"-"})]})}function nm({status:s}){const t={PENDING:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",PAID:"bg-green-100 text-green-800 hover:bg-green-100",FAILED:"bg-red-100 text-red-800 hover:bg-red-100",REFUNDED:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(O,{variant:"secondary",className:b("font-medium",t[s]),children:Vs[s]})}function rm({id:s,trigger:t}){const[a,n]=o.useState(!1),[l,c]=o.useState();return o.useEffect(()=>{(async()=>{if(a){const{data:x}=await td({id:s});c(x)}})()},[a,s]),e.jsxs(ue,{onOpenChange:n,open:a,children:[e.jsx(Re,{asChild:!0,children:t}),e.jsxs(ce,{className:"max-w-xl",children:[e.jsxs(je,{className:"space-y-2",children:[e.jsx(xe,{className:"text-lg font-medium",children:"订单信息"}),e.jsx("div",{className:"flex items-center justify-between text-sm",children:e.jsxs("div",{className:"flex items-center space-x-6",children:[e.jsxs("div",{className:"text-muted-foreground",children:["订单号:",l?.trade_no]}),l?.status&&e.jsx(nm,{status:l.status})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"基本信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ae,{label:"用户邮箱",value:l?.user?.email?e.jsxs(ws,{to:`/user/manage?email=${l.user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[l.user.email,e.jsx(Hn,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(Ae,{label:"订单周期",value:l&&st[l.period]}),e.jsx(Ae,{label:"订阅计划",value:l?.plan?.name,valueClassName:"font-medium"}),e.jsx(Ae,{label:"回调单号",value:l?.callback_no,valueClassName:"font-mono text-xs"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"金额信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ae,{label:"支付金额",value:qs(l?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(ge,{className:"my-2"}),e.jsx(Ae,{label:"余额支付",value:qs(l?.balance_amount||0)}),e.jsx(Ae,{label:"优惠金额",value:qs(l?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(Ae,{label:"退回金额",value:qs(l?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(Ae,{label:"折抵金额",value:qs(l?.surplus_amount||0)})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:"时间信息"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ae,{label:"创建时间",value:re(l?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(Ae,{label:"更新时间",value:re(l?.updated_at),valueClassName:"font-mono text-xs"})]})]})]})]})]})}const lm={[ts.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ts.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ts.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ts.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},im={[ne.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[ne.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},om=s=>[{accessorKey:"trade_no",header:({column:t})=>e.jsx(I,{column:t,title:"订单号"}),cell:({row:t})=>{const a=t.original.trade_no,n=a.length>6?`${a.slice(0,3)}...${a.slice(-3)}`:a;return e.jsx("div",{className:"flex items-center",children:e.jsx(rm,{trigger:e.jsxs(W,{variant:"ghost",size:"sm",className:"flex h-8 items-center gap-1.5 px-2 font-medium text-primary transition-colors hover:bg-primary/10 hover:text-primary/80",children:[e.jsx("span",{className:"font-mono",children:n}),e.jsx(Hn,{className:"h-3.5 w-3.5 opacity-70"})]}),id:t.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:t})=>e.jsx(I,{column:t,title:"类型"}),cell:({row:t})=>{const a=t.getValue("type"),n=lm[a]||{color:"text-slate-700",bgColor:"bg-slate-100/80"};return e.jsx(O,{variant:"secondary",className:b("font-medium transition-colors text-nowrap",n.color,n.bgColor,"border border-border/50","hover:bg-slate-200/80"),children:pr[a]})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:t})=>e.jsx(I,{column:t,title:"订阅计划"}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium text-foreground/90 sm:max-w-72 md:max-w-[31rem]",children:t.original.plan?.name||"-"})}),enableSorting:!1,enableHiding:!1},{accessorKey:"period",header:({column:t})=>e.jsx(I,{column:t,title:"周期"}),cell:({row:t})=>{const a=t.getValue("period"),n=im[a]||{color:"text-gray-700",bgColor:"bg-gray-50"};return e.jsx(O,{variant:"secondary",className:b("font-medium transition-colors text-nowrap",n.color,n.bgColor,"hover:bg-opacity-80"),children:st[a]})},enableSorting:!1,enableHiding:!1},{accessorKey:"total_amount",header:({column:t})=>e.jsx(I,{column:t,title:"支付金额"}),cell:({row:t})=>{const a=t.getValue("total_amount"),n=typeof a=="number"?(a/100).toFixed(2):"N/A";return e.jsxs("div",{className:"flex items-center font-mono text-foreground/90",children:["¥",n]})},enableSorting:!0,enableHiding:!1},{accessorKey:"status",header:({column:t})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(I,{column:t,title:"订单状态"}),e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx(Pr,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(ee,{side:"top",className:"max-w-[200px] text-sm",children:"标记为[已支付]后将会由系统进行开通后并完成"})]})})]}),cell:({row:t})=>{const a=Lr.find(n=>n.value===t.getValue("status"));return a?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[a.icon&&e.jsx(a.icon,{className:`h-4 w-4 text-${a.color}`}),e.jsx("span",{className:"text-sm font-medium",children:a.label})]}),a.value===me.PENDING&&e.jsxs(vs,{modal:!0,children:[e.jsx(bs,{asChild:!0,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(bt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"打开菜单"})]})}),e.jsxs(ms,{align:"end",className:"w-[140px]",children:[e.jsx(he,{className:"cursor-pointer",onClick:async()=>{await ad({trade_no:t.original.trade_no}),s()},children:"标记为已支付"}),e.jsx(he,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await nd({trade_no:t.original.trade_no}),s()},children:"取消订单"})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:t})=>e.jsx(I,{column:t,title:"佣金金额"}),cell:({row:t})=>{const a=t.getValue("commission_balance"),n=a?(a/100).toFixed(2):"-";return e.jsx("div",{className:"flex items-center font-mono text-foreground/90",children:a?`¥${n}`:"-"})},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_status",header:({column:t})=>e.jsx(I,{column:t,title:"佣金状态"}),cell:({row:t})=>{const a=t.original.commission_status,n=$r.find(l=>l.value===t.getValue("commission_status"));return a==0||!n?e.jsx("span",{className:"text-muted-foreground",children:"-"}):e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n.icon&&e.jsx(n.icon,{className:`h-4 w-4 text-${n.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n.label})]}),n.value===fe.PENDING&&e.jsxs(vs,{modal:!0,children:[e.jsx(bs,{asChild:!0,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(bt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"打开菜单"})]})}),e.jsxs(ms,{align:"end",className:"w-[120px]",children:[e.jsx(he,{className:"cursor-pointer",onClick:async()=>{await Ra({trade_no:t.original.trade_no,commission_status:fe.PROCESSING}),s()},children:"标记为有效"}),e.jsx(he,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await Ra({trade_no:t.original.trade_no,commission_status:fe.INVALID}),s()},children:"标记为无效"})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:t})=>e.jsx(I,{column:t,title:"创建时间"}),cell:({row:t})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:re(t.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}];function cm(){const s=_t(),t=new URLSearchParams(s.search),a=Array.from(t.entries()).map(([V,A])=>({id:V,value:isNaN(parseInt(A))?A:parseInt(A)})),[n]=o.useState(!0),l=n&&s.state?.filters?s.state.filters:[],c=[...a,...l];o.useEffect(()=>{s.state?.filters&&window.history.replaceState({...s.state,filters:void 0},"")},[]);const[d,x]=o.useState({}),[r,i]=o.useState({}),[h,D]=o.useState(c),[C,m]=o.useState([]),[w,_]=o.useState({pageIndex:0,pageSize:20}),{refetch:y,data:N,isLoading:P}=Q({queryKey:["orderList",w,h,C],queryFn:()=>xr({pageSize:w.pageSize,current:w.pageIndex+1,filter:h,sort:C})}),p=Le({data:N?.data??[],columns:om(y),state:{sorting:C,columnVisibility:r,rowSelection:d,columnFilters:h,pagination:w},rowCount:N?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:x,onSortingChange:m,onColumnFiltersChange:D,onColumnVisibilityChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),onPaginationChange:_,getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls()});return e.jsx(Ge,{table:p,toolbar:e.jsx(am,{table:p,refetch:y}),showPagination:!0})}function dm(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:" 订单管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"在这里可以查看用户订单,包括分配、查看、删除等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(cm,{})})]})]})}const um=Object.freeze(Object.defineProperty({__proto__:null,default:dm},Symbol.toStringTag,{value:"Module"}));function xm({column:s,title:t,options:a}){const n=s?.getFacetedUniqueValues(),l=new Set(s?.getFilterValue());return e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),t,l?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:l.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:l.size>2?e.jsxs(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[l.size," selected"]}):a.filter(c=>l.has(c.value)).map(c=>e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:c.label},c.value))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(hs,{children:[e.jsx(Cs,{placeholder:t}),e.jsxs(js,{children:[e.jsx(Ss,{children:"No results found."}),e.jsx(Ve,{children:a.map(c=>{const d=l.has(c.value);return e.jsxs(ve,{onSelect:()=>{d?l.delete(c.value):l.add(c.value);const x=Array.from(l);s?.setFilterValue(x.length?x:void 0)},children:[e.jsx("div",{className:b("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ns,{className:b("h-4 w-4")})}),c.icon&&e.jsx(c.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${c.color}`}),e.jsx("span",{children:c.label}),n?.get(c.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:n.get(c.value)})]},c.value)})}),l.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ls,{}),e.jsx(Ve,{children:e.jsx(ve,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const mm=u.object({id:u.coerce.number().nullable().optional(),name:u.string().min(1,"请输入优惠券名称"),code:u.string().nullable(),type:u.union([u.string(),u.nativeEnum(Et)]),value:u.coerce.number(),started_at:u.coerce.number(),ended_at:u.coerce.number(),limit_use:u.union([u.string(),u.number()]).nullable(),limit_use_with_user:u.union([u.string(),u.number()]).nullable(),generate_count:u.coerce.number().nullable().optional(),limit_plan_ids:u.array(u.number()).default([]).nullable(),limit_period:u.array(u.nativeEnum(ne)).default([]).nullable()}).refine(s=>s.ended_at>s.started_at,{message:"结束时间必须晚于开始时间",path:["ended_at"]}),Aa={name:"",code:"",type:Et.AMOUNT,value:0,started_at:Math.floor(Date.now()/1e3),ended_at:Math.floor(Date.now()/1e3)+7*24*60*60,limit_use:"",limit_use_with_user:"",limit_plan_ids:[],limit_period:[],generate_count:""};function Hr({defaultValues:s,refetch:t,type:a="create",dialogTrigger:n=e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("div",{children:"添加优惠券"})]}),open:l,onOpenChange:c}){const[d,x]=o.useState(!1),r=l??d,i=c??x,[h,D]=o.useState([]),C=ae({resolver:ie(mm),defaultValues:s||Aa});o.useEffect(()=>{s&&C.reset(s)},[s,C]),o.useEffect(()=>{ks().then(({data:y})=>D(y))},[]);const m=y=>{if(!y)return;const N=(P,p)=>{const V=new Date(p*1e3);return P.setHours(V.getHours(),V.getMinutes(),V.getSeconds()),Math.floor(P.getTime()/1e3)};y.from&&C.setValue("started_at",N(y.from,C.watch("started_at"))),y.to&&C.setValue("ended_at",N(y.to,C.watch("ended_at")))},w=async y=>{try{await id(y),i(!1),a==="create"&&C.reset(Aa),t()}catch(N){console.error("保存优惠券失败:",N)}},_=(y,N)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:N}),e.jsx(S,{type:"datetime-local",step:"1",value:re(C.watch(y),"YYYY-MM-DDTHH:mm:ss"),onChange:P=>{const p=new Date(P.target.value);C.setValue(y,Math.floor(p.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(ue,{open:r,onOpenChange:i,children:[n&&e.jsx(Re,{asChild:!0,children:n}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(je,{children:e.jsx(xe,{children:a==="create"?"添加优惠券":"编辑优惠券"})}),e.jsx(oe,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(w),className:"space-y-4",children:[e.jsx(g,{control:C.control,name:"name",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"优惠券名称"}),e.jsx(S,{placeholder:"请输入优惠券名称",...y}),e.jsx(k,{})]})}),e.jsxs(j,{children:[e.jsx(f,{children:"优惠券类型和值"}),e.jsxs("div",{className:"flex",children:[e.jsx(g,{control:C.control,name:"type",render:({field:y})=>e.jsxs(B,{value:y.value.toString(),onValueChange:y.onChange,children:[e.jsx(q,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(G,{placeholder:"优惠券类型"})}),e.jsx(U,{children:Object.entries(ra).map(([N,P])=>e.jsx(z,{value:N,children:P},N))})]})}),e.jsx(g,{control:C.control,name:"value",render:({field:y})=>e.jsx(S,{type:"number",placeholder:"请输入值",...y,onChange:N=>y.onChange(N.target.value===""?"":N.target.value),className:"flex-[2] rounded-none border-x-0 text-left"})}),e.jsx("div",{className:"flex min-w-[40px] items-center justify-center rounded-md rounded-l-none border border-l-0 border-input bg-muted/50 px-3 font-medium text-muted-foreground",children:e.jsx("span",{children:C.watch("type")===Et.AMOUNT?"¥":"%"})})]})]}),e.jsxs(j,{children:[e.jsx(f,{children:"优惠券有效期"}),e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(T,{variant:"outline",className:b("w-full justify-start text-left font-normal",!C.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(rt,{className:"mr-2 h-4 w-4"}),re(C.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ","至"," ",re(C.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})}),e.jsxs(Be,{className:"w-auto p-0",align:"start",children:[e.jsx("div",{className:"border-b border-border",children:e.jsx(Ts,{mode:"range",selected:{from:new Date(C.watch("started_at")*1e3),to:new Date(C.watch("ended_at")*1e3)},onSelect:m,numberOfMonths:2})}),e.jsx("div",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[_("started_at","开始时间"),e.jsx("div",{className:"mt-6 text-sm text-muted-foreground",children:"至"}),_("ended_at","结束时间")]})})]})]}),e.jsx(k,{})]}),e.jsx(g,{control:C.control,name:"limit_use",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"最大使用次数"}),e.jsx(S,{type:"number",min:0,placeholder:"限制最大使用次数,留空则不限制",...y,value:y.value===void 0?"":y.value,onChange:N=>y.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(E,{className:"text-xs",children:"设置优惠券的总使用次数限制,留空表示不限制使用次数"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_use_with_user",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"每个用户可使用次数"}),e.jsx(S,{type:"number",min:0,placeholder:"限制每个用户可使用次数,留空则不限制",...y,value:y.value===void 0?"":y.value,onChange:N=>y.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(E,{className:"text-xs",children:"限制每个用户可使用该优惠券的次数,留空表示不限制单用户使用次数"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_period",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"指定周期"}),e.jsx(at,{options:Object.entries(ne).filter(([N])=>isNaN(Number(N))).map(([N,P])=>({label:P,value:N})),onChange:N=>{if(N.length===0){y.onChange([]);return}const P=N.map(p=>ne[p.value]);y.onChange(P)},value:(y.value||[]).map(N=>({label:Object.entries(ne).find(([P,p])=>p===N)?.[1]||"",value:Object.entries(ne).find(([P,p])=>p===N)?.[0]||""})),placeholder:"限制指定周期可以使用优惠,留空则不限制",emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"没有找到匹配的周期"})}),e.jsx(E,{className:"text-xs",children:"选择可以使用优惠券的订阅周期,留空表示不限制使用周期"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"limit_plan_ids",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"指定订阅"}),e.jsx(at,{options:h?.map(N=>({label:N.name,value:N.id.toString()}))||[],onChange:N=>y.onChange(N.map(P=>Number(P.value))),value:(h||[]).filter(N=>(y.value||[]).includes(N.id)).map(N=>({label:N.name,value:N.id.toString()})),placeholder:"限制指定订阅可以使用优惠,留空则不限制",emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"没有找到匹配的订阅"})}),e.jsx(k,{})]})}),a==="create"&&e.jsxs(e.Fragment,{children:[e.jsx(g,{control:C.control,name:"code",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"自定义优惠码"}),e.jsx(S,{placeholder:"自定义优惠码,留空则自动生成",...y,className:"h-9"}),e.jsx(E,{className:"text-xs",children:"可以自定义优惠码,留空则系统自动生成"}),e.jsx(k,{})]})}),e.jsx(g,{control:C.control,name:"generate_count",render:({field:y})=>e.jsxs(j,{children:[e.jsx(f,{children:"批量生成数量"}),e.jsx(S,{type:"number",min:0,placeholder:"批量生成优惠码数量,留空则生成单个",...y,value:y.value===void 0?"":y.value,onChange:N=>y.onChange(N.target.value===""?"":N.target.value),className:"h-9"}),e.jsx(E,{className:"text-xs",children:"批量生成多个优惠码,留空则只生成单个优惠码"}),e.jsx(k,{})]})})]}),e.jsx(Ee,{children:e.jsx(T,{type:"submit",disabled:C.formState.isSubmitting,children:C.formState.isSubmitting?"保存中...":"保存"})})]})})]})]})}function hm({table:s,refetch:t}){const a=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Hr,{refetch:t}),e.jsx(S,{placeholder:"搜索优惠券...",value:s.getColumn("name")?.getFilterValue()??"",onChange:n=>s.getColumn("name")?.setFilterValue(n.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(xm,{column:s.getColumn("type"),title:"类型",options:Object.entries(ra).map(([n,l])=>({value:n,label:l}))}),a&&e.jsxs(T,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["重置",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})}const Kr=o.createContext(void 0);function jm({children:s,refetch:t}){const[a,n]=o.useState(!1),[l,c]=o.useState(null),d=r=>{c(r),n(!0)},x=()=>{n(!1),c(null)};return e.jsxs(Kr.Provider,{value:{isOpen:a,currentCoupon:l,openEdit:d,closeEdit:x},children:[s,l&&e.jsx(Hr,{defaultValues:l,refetch:t,type:"edit",open:a,onOpenChange:n})]})}function gm(){const s=o.useContext(Kr);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const fm=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"ID"}),cell:({row:t})=>e.jsx(O,{children:t.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(I,{column:t,title:"启用"}),cell:({row:t})=>e.jsx(H,{defaultChecked:t.original.show,onCheckedChange:a=>{cd({id:t.original.id,show:a}).then(({data:n})=>!n&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx(I,{column:t,title:"卷名称"}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{children:t.original.name})}),enableSorting:!1,size:800},{accessorKey:"type",header:({column:t})=>e.jsx(I,{column:t,title:"类型"}),cell:({row:t})=>e.jsx(O,{variant:"outline",children:ra[t.original.type]}),enableSorting:!0},{accessorKey:"code",header:({column:t})=>e.jsx(I,{column:t,title:"卷码"}),cell:({row:t})=>e.jsx(O,{variant:"secondary",children:t.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:t})=>e.jsx(I,{column:t,title:"剩余次数"}),cell:({row:t})=>e.jsx(O,{variant:"outline",children:t.original.limit_use===null?"无限次":t.original.limit_use}),enableSorting:!0},{accessorKey:"limit_use_with_user",header:({column:t})=>e.jsx(I,{column:t,title:"可用次数/用户"}),cell:({row:t})=>e.jsx(O,{variant:"outline",children:t.original.limit_use_with_user===null?"无限制":t.original.limit_use_with_user}),enableSorting:!0},{accessorKey:"#",header:({column:t})=>e.jsx(I,{column:t,title:"有效期"}),cell:({row:t})=>{const[a,n]=o.useState(!1),l=Date.now(),c=t.original.started_at*1e3,d=t.original.ended_at*1e3,x=l>d,r=le.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const{openEdit:a}=gm();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>a(t.original),children:[e.jsx(_s,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:"编辑"})]}),e.jsx(Ye,{title:"确认删除",description:"此操作将永久删除该优惠券,删除后无法恢复。确定要继续吗?",confirmText:"删除",variant:"destructive",onConfirm:async()=>{od({id:t.original.id}).then(({data:n})=>{n&&(L.success("删除成功"),s())})},children:e.jsxs(T,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ns,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:"删除"})]})})]})}}];function pm(){const[s,t]=o.useState({}),[a,n]=o.useState({}),[l,c]=o.useState([]),[d,x]=o.useState([]),[r,i]=o.useState({pageIndex:0,pageSize:20}),{refetch:h,data:D}=Q({queryKey:["couponList",r,l,d],queryFn:()=>ld({pageSize:r.pageSize,current:r.pageIndex+1,filter:l,sort:d})}),C=Le({data:D?.data??[],columns:fm(h),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:r},pageCount:Math.ceil((D?.total??0)/r.pageSize),rowCount:D?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:n,onPaginationChange:i,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(jm,{refetch:h,children:e.jsx("div",{className:"space-y-4",children:e.jsx(Ge,{table:C,toolbar:e.jsx(hm,{table:C,refetch:h})})})})}function vm(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"优惠券管理"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"在这里可以查看优惠券,包括增加、查看、删除等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(pm,{})})]})]})}const bm=Object.freeze(Object.defineProperty({__proto__:null,default:vm},Symbol.toStringTag,{value:"Module"})),ym=u.object({email_prefix:u.string().optional(),email_suffix:u.string().min(1),password:u.string().optional(),expired_at:u.number().optional().nullable(),plan_id:u.number().nullable(),generate_count:u.number().optional().nullable()}).refine(s=>s.generate_count===null?s.email_prefix!==void 0&&s.email_prefix!=="":!0,{message:"Email prefix is required when generate_count is null",path:["email_prefix"]}),Nm={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0};function wm({refetch:s}){const[t,a]=o.useState(!1),n=ae({resolver:ie(ym),defaultValues:Nm,mode:"onChange"}),[l,c]=o.useState([]);return o.useEffect(()=>{t&&ks().then(({data:d})=>{d&&c(d)})},[t]),e.jsxs(ue,{open:t,onOpenChange:a,children:[e.jsx(Re,{asChild:!0,children:e.jsxs(W,{size:"sm",variant:"outline",className:"space-x-2 gap-0",children:[e.jsx(Ne,{icon:"ion:add"}),e.jsx("div",{children:"创建用户"})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(je,{children:[e.jsx(xe,{children:"创建用户"}),e.jsx(Se,{})]}),e.jsxs(oe,{...n,children:[e.jsxs(j,{children:[e.jsx(f,{children:"邮箱"}),e.jsxs("div",{className:"flex",children:[!n.watch("generate_count")&&e.jsx(g,{control:n.control,name:"email_prefix",render:({field:d})=>e.jsx(S,{className:"flex-[5] rounded-r-none",placeholder:"帐号(批量生成请留空)",...d})}),e.jsx("div",{className:`z-[-1] border border-r-0 border-input px-3 py-1 shadow-sm ${n.watch("generate_count")?"rounded-l-md":"border-l-0"}`,children:"@"}),e.jsx(g,{control:n.control,name:"email_suffix",render:({field:d})=>e.jsx(S,{className:"flex-[4] rounded-l-none",placeholder:"域",...d})})]})]}),e.jsx(g,{control:n.control,name:"password",render:({field:d})=>e.jsxs(j,{children:[e.jsx(f,{children:"密码"}),e.jsx(S,{placeholder:"留空则密码与邮件相同",...d}),e.jsx(k,{})]})}),e.jsx(g,{control:n.control,name:"expired_at",render:({field:d})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(f,{children:"到期时间"}),e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(v,{children:e.jsxs(W,{variant:"outline",className:b("w-full pl-3 text-left font-normal",!d.value&&"text-muted-foreground"),children:[d.value?re(d.value):e.jsx("span",{children:"请选择用户到期日期,留空为长期有效"}),e.jsx(rt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(Be,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(jo,{asChild:!0,children:e.jsx(W,{variant:"outline",className:"w-full",onClick:()=>{d.onChange(null)},children:"长期有效"})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Ts,{mode:"single",selected:d.value?new Date(d.value*1e3):void 0,onSelect:x=>{x&&d.onChange(x?.getTime()/1e3)}})})]})]})]})}),e.jsx(g,{control:n.control,name:"plan_id",render:({field:d})=>e.jsxs(j,{children:[e.jsx(f,{children:"订阅计划"}),e.jsx(v,{children:e.jsxs(B,{value:d.value?d.value.toString():"null",onValueChange:x=>d.onChange(x==="null"?null:parseInt(x)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"无"})}),e.jsxs(U,{children:[e.jsx(z,{value:"null",children:"无"}),l.map(x=>e.jsx(z,{value:x.id.toString(),children:x.name},x.id))]})]})})]})}),!n.watch("email_prefix")&&e.jsx(g,{control:n.control,name:"generate_count",render:({field:d})=>e.jsxs(j,{children:[e.jsx(f,{children:"生成数量"}),e.jsx(S,{type:"number",placeholder:"如果为批量生产请输入生成数量",value:d.value||"",onChange:x=>d.onChange(x.target.value?parseInt(x.target.value):null)})]})})]}),e.jsxs(Ee,{children:[e.jsx(W,{variant:"outline",onClick:()=>a(!1),children:"取消"}),e.jsx(W,{onClick:()=>n.handleSubmit(d=>{md(d).then(({data:x})=>{x&&(L.success("生成成功"),n.reset(),s(),a(!1))})})(),children:"生成"})]})]})]})}const qr=qa,Ur=Ua,_m=Ba,Br=o.forwardRef(({className:s,...t},a)=>e.jsx(Ct,{className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...t,ref:a}));Br.displayName=Ct.displayName;const Cm=ys("fixed overflow-y-scroll z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-md",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-md"}},defaultVariants:{side:"right"}}),xa=o.forwardRef(({side:s="right",className:t,children:a,...n},l)=>e.jsxs(_m,{children:[e.jsx(Br,{}),e.jsxs(St,{ref:l,className:b(Cm({side:s}),t),...n,children:[e.jsxs(Qt,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(Me,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),a]})]}));xa.displayName=St.displayName;const ma=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col space-y-2 text-center sm:text-left",s),...t});ma.displayName="SheetHeader";const Gr=({className:s,...t})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t});Gr.displayName="SheetFooter";const ha=o.forwardRef(({className:s,...t},a)=>e.jsx(kt,{ref:a,className:b("text-lg font-semibold text-foreground",s),...t}));ha.displayName=kt.displayName;const ja=o.forwardRef(({className:s,...t},a)=>e.jsx(Tt,{ref:a,className:b("text-sm text-muted-foreground",s),...t}));ja.displayName=Tt.displayName;const Gs=[{label:"邮箱",value:"email",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"用户ID",value:"id",type:"number",operators:[{label:"等于",value:"eq"}]},{label:"订阅",value:"plan_id",type:"select",operators:[{label:"等于",value:"eq"}],useOptions:!0},{label:"流量",value:"transfer_enable",type:"number",unit:"GB",operators:[{label:"大于",value:"gt"},{label:"小于",value:"lt"},{label:"等于",value:"eq"}]},{label:"已用流量",value:"total_used",type:"number",unit:"GB",operators:[{label:"大于",value:"gt"},{label:"小于",value:"lt"},{label:"等于",value:"eq"}]},{label:"在线设备",value:"online_count",type:"number",operators:[{label:"等于",value:"eq"},{label:"大于",value:"gt"},{label:"小于",value:"lt"}]},{label:"到期时间",value:"expired_at",type:"date",operators:[{label:"早于",value:"lt"},{label:"晚于",value:"gt"},{label:"等于",value:"eq"}]},{label:"UUID",value:"uuid",type:"text",operators:[{label:"等于",value:"eq"}]},{label:"Token",value:"token",type:"text",operators:[{label:"等于",value:"eq"}]},{label:"账号状态",value:"banned",type:"select",operators:[{label:"等于",value:"eq"}],options:[{label:"正常",value:"0"},{label:"禁用",value:"1"}]},{label:"备注",value:"remark",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"邀请人邮箱",value:"inviter_email",type:"text",operators:[{label:"包含",value:"contains"},{label:"等于",value:"eq"}]},{label:"邀请人ID",value:"invite_user_id",type:"number",operators:[{label:"等于",value:"eq"}]},{label:"管理员",value:"is_admin",type:"boolean",operators:[{label:"等于",value:"eq"}]},{label:"员工",value:"is_staff",type:"boolean",operators:[{label:"等于",value:"eq"}]}];function Sm({table:s,refetch:t,permissionGroups:a=[],subscriptionPlans:n=[]}){const l=s.getState().columnFilters.length>0,[c,d]=o.useState([]),[x,r]=o.useState(!1),i=y=>y*1024*1024*1024,h=y=>y/(1024*1024*1024),D=()=>{d([...c,{field:"",operator:"",value:""}])},C=y=>{d(c.filter((N,P)=>P!==y))},m=(y,N,P)=>{const p=[...c];if(p[y]={...p[y],[N]:P},N==="field"){const V=Gs.find(A=>A.value===P);V&&(p[y].operator=V.operators[0].value,p[y].value=V.type==="boolean"?!1:"")}d(p)},w=(y,N)=>{const P=Gs.find(p=>p.value===y.field);if(!P)return null;switch(P.type){case"text":return e.jsx(S,{placeholder:"输入值",value:y.value,onChange:p=>m(N,"value",p.target.value)});case"number":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(S,{type:"number",placeholder:`输入数值${P.unit?`(${P.unit})`:""}`,value:P.unit==="GB"?h(y.value||0):y.value,onChange:p=>{const V=Number(p.target.value);m(N,"value",P.unit==="GB"?i(V):V)}}),P.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:P.unit})]});case"date":return e.jsx(Ts,{mode:"single",selected:y.value,onSelect:p=>m(N,"value",p),className:"rounded-md border"});case"select":return e.jsxs(B,{value:y.value,onValueChange:p=>m(N,"value",p),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择选项"})}),e.jsx(U,{children:P.useOptions?n.map(p=>e.jsx(z,{value:p.value.toString(),children:p.label},p.value)):P.options?.map(p=>e.jsx(z,{value:p.value.toString(),children:p.label},p.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(H,{checked:y.value,onCheckedChange:p=>m(N,"value",p)}),e.jsx(yt,{children:y.value?"是":"否"})]});default:return null}},_=()=>{const y=c.filter(N=>N.field&&N.operator&&N.value!=="").map(N=>{const P=Gs.find(V=>V.value===N.field);let p=N.value;return N.operator==="contains"?{id:N.field,value:p}:(P?.type==="date"&&p instanceof Date&&(p=Math.floor(p.getTime()/1e3)),P?.type==="boolean"&&(p=p?1:0),{id:N.field,value:`${N.operator}:${p}`})});s.setColumnFilters(y),r(!1)};return e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2",children:e.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[e.jsx(wm,{refetch:t}),e.jsx(S,{placeholder:"搜索用户邮箱...",value:s.getColumn("email")?.getFilterValue()??"",onChange:y=>s.getColumn("email")?.setFilterValue(y.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(qr,{open:x,onOpenChange:r,children:[e.jsx(Ur,{asChild:!0,children:e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(go,{className:"mr-2 h-4 w-4"}),"高级筛选",c.length>0&&e.jsx(O,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:c.length})]})}),e.jsxs(xa,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(ma,{children:[e.jsx(ha,{children:"高级筛选"}),e.jsx(ja,{children:"添加一个或多个筛选条件来精确查找用户"})]}),e.jsxs("div",{className:"mt-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-medium",children:"筛选条件"}),e.jsx(T,{variant:"outline",size:"sm",onClick:D,children:"添加条件"})]}),e.jsx(tt,{className:"h-[calc(100vh-280px)] pr-4",children:e.jsx("div",{className:"space-y-4",children:c.map((y,N)=>e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(yt,{children:["条件 ",N+1]}),e.jsx(T,{variant:"ghost",size:"sm",onClick:()=>C(N),children:e.jsx(Me,{className:"h-4 w-4"})})]}),e.jsxs(B,{value:y.field,onValueChange:P=>m(N,"field",P),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择字段"})}),e.jsx(U,{children:Gs.map(P=>e.jsx(z,{value:P.value,children:P.label},P.value))})]}),y.field&&e.jsxs(B,{value:y.operator,onValueChange:P=>m(N,"operator",P),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"选择操作符"})}),e.jsx(U,{children:Gs.find(P=>P.value===y.field)?.operators.map(P=>e.jsx(z,{value:P.value,children:P.label},P.value))})]}),y.field&&y.operator&&w(y,N)]},N))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(T,{variant:"outline",onClick:()=>{d([]),r(!1)},children:"重置"}),e.jsx(T,{onClick:_,children:"应用筛选"})]})]})]})]}),l&&e.jsxs(T,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),d([])},className:"h-8 px-2 lg:px-3",children:["重置筛选",e.jsx(Me,{className:"ml-2 h-4 w-4"})]})]})})}const km=u.object({id:u.number(),email:u.string().email(),invite_user_email:u.string().email().nullable().optional(),password:u.string().optional().nullable(),balance:u.coerce.number(),commission_balance:u.coerce.number(),u:u.number(),d:u.number(),transfer_enable:u.number(),expired_at:u.number().nullable(),plan_id:u.number().nullable(),banned:u.number(),commission_type:u.number(),commission_rate:u.number().nullable(),discount:u.number().nullable(),speed_limit:u.number().nullable(),device_limit:u.number().nullable(),is_admin:u.number(),is_staff:u.number(),remarks:u.string().nullable()}),Yr=o.createContext(void 0);function Tm({children:s,defaultValues:t,open:a,onOpenChange:n}){const[l,c]=o.useState(!1),[d,x]=o.useState(!1),[r,i]=o.useState([]),h=ae({resolver:ie(km),defaultValues:t,mode:"onChange"});o.useEffect(()=>{a!==void 0&&c(a)},[a]);const D=C=>{c(C),n?.(C)};return e.jsx(Yr.Provider,{value:{form:h,formOpen:l,setFormOpen:D,datePickerOpen:d,setDatePickerOpen:x,planList:r,setPlanList:i},children:s})}function Dm(){const s=o.useContext(Yr);if(!s)throw new Error("useUserForm must be used within a UserFormProvider");return s}function Pm({refetch:s}){const{form:t,formOpen:a,setFormOpen:n,datePickerOpen:l,setDatePickerOpen:c,planList:d,setPlanList:x}=Dm();return o.useEffect(()=>{a&&ks().then(({data:r})=>{x(r)})},[a,x]),e.jsxs(oe,{...t,children:[e.jsx(g,{control:t.control,name:"email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"邮箱"}),e.jsx(v,{children:e.jsx(S,{...r,placeholder:"请输入邮箱"})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"invite_user_email",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"邀请人邮箱"}),e.jsx(v,{children:e.jsx(S,{value:r.value||"",onChange:i=>r.onChange(i.target.value?i.target.value:null),placeholder:"请输入邮箱"})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"password",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"密码"}),e.jsx(v,{children:e.jsx(S,{value:r.value||"",onChange:r.onChange,placeholder:"如需修改密码请输入"})}),e.jsx(k,{...r})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(g,{control:t.control,name:"balance",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"余额"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:r.onChange,placeholder:"请输入余额",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"commission_balance",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"佣金余额"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:r.onChange,placeholder:"请输入佣金余额",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"u",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"已用上行"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"已用上行",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{...r})]})}),e.jsx(g,{control:t.control,name:"d",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"已用下行"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"已用下行",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{...r})]})})]}),e.jsx(g,{control:t.control,name:"transfer_enable",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"流量"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value/1024/1024/1024||"",onChange:i=>r.onChange(parseInt(i.target.value)*1024*1024*1024),placeholder:"请输入流量",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"expired_at",render:({field:r})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(f,{children:"到期时间"}),e.jsxs(Qe,{open:l,onOpenChange:c,children:[e.jsx(Ze,{asChild:!0,children:e.jsx(v,{children:e.jsxs(T,{type:"button",variant:"outline",className:b("w-full pl-3 text-left font-normal",!r.value&&"text-muted-foreground"),onClick:()=>c(!0),children:[r.value?re(r.value):e.jsx("span",{children:"请选择用户到期日期,留空为长期有效"}),e.jsx(rt,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Be,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:i=>{i.preventDefault()},onEscapeKeyDown:i=>{i.preventDefault()},children:e.jsxs("div",{className:"flex flex-col space-y-3 p-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{r.onChange(null),c(!1)},children:"长期有效"}),e.jsx(T,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const i=new Date;i.setMonth(i.getMonth()+1),i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3)),c(!1)},children:"一个月"}),e.jsx(T,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const i=new Date;i.setMonth(i.getMonth()+3),i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3)),c(!1)},children:"三个月"})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Ts,{mode:"single",selected:r.value?new Date(r.value*1e3):void 0,onSelect:i=>{if(i){const h=new Date(r.value?r.value*1e3:Date.now());i.setHours(h.getHours(),h.getMinutes(),h.getSeconds()),r.onChange(Math.floor(i.getTime()/1e3))}},disabled:i=>i{const i=new Date;i.setHours(23,59,59,999),r.onChange(Math.floor(i.getTime()/1e3))},className:"h-6 px-2 text-xs",children:"设为当天结束"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{type:"datetime-local",step:"1",value:re(r.value,"YYYY-MM-DDTHH:mm:ss"),onChange:i=>{const h=new Date(i.target.value);isNaN(h.getTime())||r.onChange(Math.floor(h.getTime()/1e3))},className:"flex-1"}),e.jsx(T,{type:"button",variant:"outline",onClick:()=>c(!1),children:"确定"})]})]})]})})]}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"plan_id",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"订阅计划"}),e.jsx(v,{children:e.jsxs(B,{value:r.value?r.value.toString():"null",onValueChange:i=>r.onChange(i==="null"?null:parseInt(i)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"无"})}),e.jsxs(U,{children:[e.jsx(z,{value:"null",children:"无"}),d.map(i=>e.jsx(z,{value:i.id.toString(),children:i.name},i.id))]})]})})]})}),e.jsx(g,{control:t.control,name:"banned",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"账户状态"}),e.jsx(v,{children:e.jsxs(B,{value:r.value.toString(),onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(q,{children:e.jsx(G,{})}),e.jsxs(U,{children:[e.jsx(z,{value:"1",children:"封禁"}),e.jsx(z,{value:"0",children:"正常"})]})]})})]})}),e.jsx(g,{control:t.control,name:"commission_type",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"佣金类型"}),e.jsx(v,{children:e.jsxs(B,{value:r.value.toString(),onValueChange:i=>r.onChange(parseInt(i)),children:[e.jsx(q,{children:e.jsx(G,{placeholder:"无"})}),e.jsxs(U,{children:[e.jsx(z,{value:"0",children:"跟随系统设置"}),e.jsx(z,{value:"1",children:"循环返利"}),e.jsx(z,{value:"2",children:"首次返利"})]})]})})]})}),e.jsx(g,{control:t.control,name:"commission_rate",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"推荐返利比例"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"请输入推荐返利比例(为空则跟随站点设置返利比例)",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})})]})}),e.jsx(g,{control:t.control,name:"discount",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"专享折扣比例"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"请输入专享折扣比例(为空则不享受专享折扣)",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"speed_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"限速"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"留空则不限速",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"Mbps"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"device_limit",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"设备限制"}),e.jsx(v,{children:e.jsxs("div",{className:"flex",children:[e.jsx(S,{type:"number",value:r.value||"",onChange:i=>r.onChange(parseInt(i.currentTarget.value)||null),placeholder:"留空则不限制",className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"台"})]})}),e.jsx(k,{})]})}),e.jsx(g,{control:t.control,name:"is_admin",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"是否管理员"}),e.jsx("div",{className:"py-2",children:e.jsx(v,{children:e.jsx(H,{checked:r.value===1,onCheckedChange:i=>r.onChange(i?1:0)})})})]})}),e.jsx(g,{control:t.control,name:"is_staff",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"是否员工"}),e.jsx("div",{className:"py-2",children:e.jsx(v,{children:e.jsx(H,{checked:r.value===1,onCheckedChange:i=>r.onChange(i?1:0)})})})]})}),e.jsx(g,{control:t.control,name:"remarks",render:({field:r})=>e.jsxs(j,{children:[e.jsx(f,{children:"备注"}),e.jsx(v,{children:e.jsx(gs,{className:"h-24",value:r.value||"",onChange:i=>r.onChange(i.currentTarget.value??null),placeholder:"请在这里记录"})}),e.jsx(k,{})]})}),e.jsxs(Gr,{children:[e.jsx(T,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(T,{type:"submit",onClick:()=>{t.handleSubmit(r=>{ud(r).then(({data:i})=>{i&&(L.success("修改成功"),n(!1),s())})})()},children:"提交"})]})]})}function Wr({refetch:s,defaultValues:t,dialogTrigger:a=e.jsxs(T,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e.jsx(lt,{className:"mr-2 h-4 w-4"}),"编辑用户信息"]})}){const[n,l]=o.useState(!1);return e.jsx(Tm,{defaultValues:t,open:n,onOpenChange:l,children:e.jsxs(qr,{open:n,onOpenChange:l,children:[e.jsx(Ur,{asChild:!0,children:a}),e.jsxs(xa,{className:"max-w-[90%] space-y-4",children:[e.jsxs(ma,{children:[e.jsx(ha,{children:"用户管理"}),e.jsx(ja,{})]}),e.jsx(Pm,{refetch:s})]})]})})}const Jr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m17.71 11.29l-5-5a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21l-5 5a1 1 0 0 0 1.42 1.42L11 9.41V17a1 1 0 0 0 2 0V9.41l3.29 3.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42"})}),Qr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.71 11.29a1 1 0 0 0-1.42 0L13 14.59V7a1 1 0 0 0-2 0v7.59l-3.29-3.3a1 1 0 0 0-1.42 1.42l5 5a1 1 0 0 0 .33.21a.94.94 0 0 0 .76 0a1 1 0 0 0 .33-.21l5-5a1 1 0 0 0 0-1.42"})}),Im=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17 11H9.41l3.3-3.29a1 1 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33a1 1 0 0 0 0 .76a1 1 0 0 0 .21.33l5 5a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42L9.41 13H17a1 1 0 0 0 0-2"})}),Vm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.92 11.62a1 1 0 0 0-.21-.33l-5-5a1 1 0 0 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l5-5a1 1 0 0 0 .21-.33a1 1 0 0 0 0-.76"})}),At=[{accessorKey:"record_at",header:"时间",cell:({row:s})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("time",{className:"text-sm text-muted-foreground",children:Wo(s.original.record_at)})})},{accessorKey:"u",header:"上行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Jr,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:Fs(s.original.u)})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Qr,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:Fs(s.original.d)})]})},{accessorKey:"server_rate",header:"倍率",cell:({row:s})=>{const t=s.original.server_rate;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(O,{variant:"outline",className:"font-mono",children:[t,"x"]})})}},{id:"total",header:"总计",cell:({row:s})=>{const t=(s.original.u+s.original.d)*s.original.server_rate;return e.jsx("div",{className:"flex items-center justify-end font-mono text-sm",children:Fs(t)})}}];function Zr({user_id:s,dialogTrigger:t}){const[a,n]=o.useState(!1),[l,c]=o.useState({pageIndex:0,pageSize:20}),{data:d,isLoading:x}=Q({queryKey:["userStats",s,l,a],queryFn:()=>a?hd({user_id:s,pageSize:l.pageSize,page:l.pageIndex+1}):null}),r=Le({data:d?.data??[],columns:At,pageCount:Math.ceil((d?.total??0)/l.pageSize),state:{pagination:l},manualPagination:!0,getCoreRowModel:$e(),onPaginationChange:c});return e.jsxs(ue,{open:a,onOpenChange:n,children:[e.jsx(Re,{asChild:!0,children:t}),e.jsxs(ce,{className:"sm:max-w-[700px]",children:[e.jsx(je,{children:e.jsx(xe,{children:"流量使用记录"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(la,{children:[e.jsx(ia,{children:r.getHeaderGroups().map(i=>e.jsx(xs,{children:i.headers.map(h=>e.jsx(ca,{className:b("h-10 px-2 text-xs",h.id==="total"&&"text-right"),children:h.isPlaceholder?null:vt(h.column.columnDef.header,h.getContext())},h.id))},i.id))}),e.jsx(oa,{children:x?Array.from({length:l.pageSize}).map((i,h)=>e.jsx(xs,{children:Array.from({length:At.length}).map((D,C)=>e.jsx(Ms,{className:"p-2",children:e.jsx(Fe,{className:"h-6 w-full"})},C))},h)):r.getRowModel().rows?.length?r.getRowModel().rows.map(i=>e.jsx(xs,{"data-state":i.getIsSelected()&&"selected",className:"h-10",children:i.getVisibleCells().map(h=>e.jsx(Ms,{className:"px-2",children:vt(h.column.columnDef.cell,h.getContext())},h.id))},i.id)):e.jsx(xs,{children:e.jsx(Ms,{colSpan:At.length,className:"h-24 text-center",children:"暂无记录"})})})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"每页显示"}),e.jsxs(B,{value:`${r.getState().pagination.pageSize}`,onValueChange:i=>{r.setPageSize(Number(i))},children:[e.jsx(q,{className:"h-8 w-[70px]",children:e.jsx(G,{placeholder:r.getState().pagination.pageSize})}),e.jsx(U,{side:"top",children:[10,20,30,40,50].map(i=>e.jsx(z,{value:`${i}`,children:i},i))})]}),e.jsx("p",{className:"text-sm font-medium",children:"条记录"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm",children:["第 ",r.getState().pagination.pageIndex+1," /"," ",r.getPageCount()," 页"]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r.previousPage(),disabled:!r.getCanPreviousPage()||x,children:e.jsx(Im,{className:"h-4 w-4"})}),e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r.nextPage(),disabled:!r.getCanNextPage()||x,children:e.jsx(Vm,{className:"h-4 w-4"})})]})]})]})]})]})]})}const Rm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M5 18h4.24a1 1 0 0 0 .71-.29l6.92-6.93L19.71 8a1 1 0 0 0 0-1.42l-4.24-4.29a1 1 0 0 0-1.42 0l-2.82 2.83l-6.94 6.93a1 1 0 0 0-.29.71V17a1 1 0 0 0 1 1m9.76-13.59l2.83 2.83l-1.42 1.42l-2.83-2.83ZM6 13.17l5.93-5.93l2.83 2.83L8.83 16H6ZM21 20H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2"})}),Em=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11h-6V5a1 1 0 0 0-2 0v6H5a1 1 0 0 0 0 2h6v6a1 1 0 0 0 2 0v-6h6a1 1 0 0 0 0-2"})}),Fm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 8.94a1.3 1.3 0 0 0-.06-.27v-.09a1 1 0 0 0-.19-.28l-6-6a1 1 0 0 0-.28-.19a.3.3 0 0 0-.09 0a.9.9 0 0 0-.33-.11H10a3 3 0 0 0-3 3v1H6a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-1h1a3 3 0 0 0 3-3zm-6-3.53L17.59 8H16a1 1 0 0 1-1-1ZM15 19a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h1v7a3 3 0 0 0 3 3h5Zm4-4a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3v3a3 3 0 0 0 3 3h3Z"})}),Mm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 11a1 1 0 0 0-1 1a8.05 8.05 0 1 1-2.22-5.5h-2.4a1 1 0 0 0 0 2h4.53a1 1 0 0 0 1-1V3a1 1 0 0 0-2 0v1.77A10 10 0 1 0 22 12a1 1 0 0 0-1-1"})}),zm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9.5 10.5H12a1 1 0 0 0 0-2h-1V8a1 1 0 0 0-2 0v.55a2.5 2.5 0 0 0 .5 4.95h1a.5.5 0 0 1 0 1H8a1 1 0 0 0 0 2h1v.5a1 1 0 0 0 2 0v-.55a2.5 2.5 0 0 0-.5-4.95h-1a.5.5 0 0 1 0-1M21 12h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Z"})}),Om=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12.3 12.22A4.92 4.92 0 0 0 14 8.5a5 5 0 0 0-10 0a4.92 4.92 0 0 0 1.7 3.72A8 8 0 0 0 1 19.5a1 1 0 0 0 2 0a6 6 0 0 1 12 0a1 1 0 0 0 2 0a8 8 0 0 0-4.7-7.28M9 11.5a3 3 0 1 1 3-3a3 3 0 0 1-3 3m9.74.32A5 5 0 0 0 15 3.5a1 1 0 0 0 0 2a3 3 0 0 1 3 3a3 3 0 0 1-1.5 2.59a1 1 0 0 0-.5.84a1 1 0 0 0 .45.86l.39.26l.13.07a7 7 0 0 1 4 6.38a1 1 0 0 0 2 0a9 9 0 0 0-4.23-7.68"})}),Lm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 0 0-6.88 2.77V3a1 1 0 0 0-2 0v4.5a1 1 0 0 0 1 1h4.5a1 1 0 0 0 0-2h-2.4A8 8 0 1 1 4 12a1 1 0 0 0-2 0A10 10 0 1 0 12 2m0 6a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h2a1 1 0 0 0 0-2h-1V9a1 1 0 0 0-1-1"})}),$m=(s,t)=>[{accessorKey:"is_admin",header:({column:a})=>e.jsx(I,{column:a,title:"管理员"}),enableSorting:!1,enableHiding:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n)),size:0},{accessorKey:"is_staff",header:({column:a})=>e.jsx(I,{column:a,title:"员工"}),enableSorting:!1,enableHiding:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n)),size:0},{accessorKey:"id",header:({column:a})=>e.jsx(I,{column:a,title:"ID"}),cell:({row:a})=>e.jsx(O,{variant:"outline",children:a.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:a})=>e.jsx(I,{column:a,title:"邮箱"}),cell:({row:a})=>{const n=a.original.t||0,l=Date.now()/1e3-n<120,c=Math.floor(Date.now()/1e3-n);let d=l?"当前在线":n===0?"从未在线":`最后在线时间: ${re(n)}`;if(!l&&n!==0){const x=Math.floor(c/60),r=Math.floor(x/60),i=Math.floor(r/24);i>0?d+=` 离线时长: ${i}天`:r>0?d+=` 离线时长: ${r}小时`:x>0?d+=` 离线时长: ${x}分钟`:d+=` -离线时长: ${c}秒`}return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:b("size-2.5 rounded-full ring-2 ring-offset-2",l?"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:a.original.email})]})}),e.jsx(ee,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:d})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:a})=>e.jsx(I,{column:a,title:"在线设备"}),cell:({row:a})=>{const n=a.original.device_limit,l=a.original.online_count||0;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(O,{variant:"outline",className:b("min-w-[4rem] justify-center",n!==null&&l>=n?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[l," / ",n===null?"∞":n]})})}),e.jsx(ee,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:n===null?"无设备数限制":`最多可同时在线 ${n} 台设备`})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:a})=>e.jsx(I,{column:a,title:"状态"}),cell:({row:a})=>{const n=a.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(O,{className:b("min-w-20 justify-center transition-colors",n?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:Sd[n]})})},enableSorting:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n))},{accessorKey:"plan_id",header:({column:a})=>e.jsx(I,{column:a,title:"订阅"}),cell:({row:a})=>e.jsx("div",{className:"min-w-[10em] break-all",children:a.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:a})=>e.jsx(I,{column:a,title:"权限组"}),cell:({row:a})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(O,{variant:"outline",className:b("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:a.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:a})=>e.jsx(I,{column:a,title:"已用流量"}),cell:({row:a})=>{const n=Fs(a.original?.total_used),l=Fs(a.original?.transfer_enable),c=a.original?.total_used/a.original?.transfer_enable*100||0;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{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:n}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:b("h-full rounded-full transition-all",c>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(c,100)}%`}})})]})}),e.jsx(ee,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:["总流量配额: ",l]})})]})})}},{accessorKey:"transfer_enable",header:({column:a})=>e.jsx(I,{column:a,title:"总流量"}),cell:({row:a})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:Fs(a.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:a})=>e.jsx(I,{column:a,title:"到期时间"}),cell:({row:a})=>{const n=a.original.expired_at,l=Date.now()/1e3,c=n!=null&&ne.jsx(I,{column:a,title:"余额"}),cell:({row:a})=>{const n=Rs(a.original?.balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:n})]})}},{accessorKey:"commission_balance",header:({column:a})=>e.jsx(I,{column:a,title:"佣金"}),cell:({row:a})=>{const n=Rs(a.original?.commission_balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:n})]})}},{accessorKey:"created_at",header:({column:a})=>e.jsx(I,{column:a,title:"注册时间"}),cell:({row:a})=>e.jsx("div",{className:"truncate",children:re(a.original?.created_at)}),size:1e3},{id:"actions",header:({column:a})=>e.jsx(I,{column:a,className:"justify-end",title:"操作"}),cell:({row:a,table:n})=>e.jsxs(vs,{modal:!0,children:[e.jsx(bs,{asChild:!0,children:e.jsx("div",{className:"text-center",children:e.jsx(W,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":"打开操作菜单",children:e.jsx(bt,{className:"size-4"})})})}),e.jsxs(hs,{align:"end",className:"min-w-[40px]",children:[e.jsx(he,{onSelect:l=>{l.preventDefault()},className:"p-0",children:e.jsx(Yr,{defaultValues:{...a.original,invite_user_email:a.original.invite_user?.email},refetch:s,dialogTrigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Vm,{className:"mr-2"}),"编辑"]})})}),e.jsx(he,{onSelect:l=>l.preventDefault(),className:"p-0",children:e.jsx($r,{defaultValues:{email:a.original.email},trigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Rm,{className:"mr-2 "}),"分配订单"]})})}),e.jsx(he,{onSelect:()=>{Nt(a.original.subscribe_url)},className:"p-0",children:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Em,{className:"mr-2"}),"复制订阅URL"]})}),e.jsx(he,{onSelect:()=>{ud({id:a.original.id}).then(({data:l})=>{l&&L.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Fm,{className:"mr-2 "}),"重置UUID及订阅URL"]})}),e.jsx(he,{onSelect:()=>{},className:"p-0",children:e.jsxs(ws,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=${a.original?.id}`,children:[e.jsx(Mm,{className:"mr-2"}),"TA的订单"]})}),e.jsx(he,{onSelect:()=>{n.setColumnFilters([{id:"invite_user_id",value:a.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(zm,{className:"mr-2 "}),"TA的邀请"]})}),e.jsx(he,{onSelect:l=>l.preventDefault(),className:"p-0",children:e.jsx(Qr,{user_id:a.original?.id,dialogTrigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Om,{className:"mr-2 "}),"TA的流量记录"]})})})]})]})}];function $m(){const[s]=go(),[t,a]=o.useState({}),[n,l]=o.useState({is_admin:!1,is_staff:!1}),[c,d]=o.useState([]),[x,r]=o.useState([]),[i,h]=o.useState({pageIndex:0,pageSize:20});o.useEffect(()=>{const A=s.get("email");A&&d($=>$.some(Y=>Y.id==="email")?$:[...$,{id:"email",value:A}])},[s]);const{refetch:D,data:C,isLoading:m}=Q({queryKey:["userList",i,c,x],queryFn:()=>cd({pageSize:i.pageSize,current:i.pageIndex+1,filter:c,sort:x})}),[w,_]=o.useState([]),[y,N]=o.useState([]);o.useEffect(()=>{Rt().then(({data:A})=>{_(A)}),ks().then(({data:A})=>{N(A)})},[]);const P=w.map(A=>({label:A.name,value:A.id})),p=y.map(A=>({label:A.name,value:A.id})),V=Le({data:C?.data??[],columns:Lm(D),state:{sorting:x,columnVisibility:n,rowSelection:t,columnFilters:c,pagination:i},rowCount:C?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:r,onColumnFiltersChange:d,onColumnVisibilityChange:l,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),onPaginationChange:h,getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnVisibility:{commission_balance:!1,created_at:!1,is_admin:!1,is_staff:!1,permission_group:!1,plan_id:!1},columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:V,toolbar:e.jsx(Cm,{table:V,refetch:D,serverGroupList:w,permissionGroups:P,subscriptionPlans:p})})}function Am(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"用户管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以管理用户,包括增加、删除、编辑、查询等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx("div",{className:"w-full",children:e.jsx($m,{})})})]})]})}const Hm=Object.freeze(Object.defineProperty({__proto__:null,default:Am},Symbol.toStringTag,{value:"Module"}));function Km({column:s,title:t,options:a}){const n=new Set(s?.getFilterValue());return e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(W,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(fo,{className:"mr-2 h-4 w-4"}),t,n?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:n.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:n.size>2?e.jsxs(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[n.size," selected"]}):a.filter(l=>n.has(l.value)).map(l=>e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:l.label},`selected-${l.value}`))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(js,{children:[e.jsx(Cs,{placeholder:t}),e.jsxs(gs,{children:[e.jsx(Ss,{children:"No results found."}),e.jsx(Ve,{children:a.map(l=>{const c=n.has(l.value);return e.jsxs(ve,{onSelect:()=>{c?n.delete(l.value):n.add(l.value);const d=Array.from(n);s?.setFilterValue(d.length?d:void 0)},children:[e.jsx("div",{className:b("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",c?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(po,{className:b("h-4 w-4")})}),l.icon&&e.jsx(l.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:l.label})]},`option-${l.value}`)})}),n.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ls,{}),e.jsx(Ve,{children:e.jsx(ve,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const qm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11H5a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})});function Um({table:s}){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-4",children:[e.jsx(hr,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:t=>s.getColumn("status")?.setFilterValue(t),children:e.jsxs(ta,{className:"grid w-full grid-cols-2",children:[e.jsx(et,{value:"0",children:"已开始"}),e.jsx(et,{value:"1",children:"已关闭"})]})}),s.getColumn("level")&&e.jsx(Km,{column:s.getColumn("level"),title:"优先级",options:[{label:Js[es.LOW],value:es.LOW,icon:qm,color:"gray"},{label:Js[es.MEDIUM],value:es.MEDIUM,icon:Wr,color:"yellow"},{label:Js[es.HIGH],value:es.HIGH,icon:Jr,color:"red"}]})]})})}function Bm(){return e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground",children:[e.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}const Gm=ys("flex gap-2 max-w-[60%] items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),Zr=o.forwardRef(({className:s,variant:t,layout:a,children:n,...l},c)=>e.jsx("div",{className:b(Gm({variant:t,layout:a,className:s}),"relative group"),ref:c,...l,children:o.Children.map(n,d=>o.isValidElement(d)&&typeof d.type!="string"?o.cloneElement(d,{variant:t,layout:a}):d)}));Zr.displayName="ChatBubble";const Ym=ys("p-4",{variants:{variant:{received:"bg-secondary text-secondary-foreground rounded-r-lg rounded-tl-lg",sent:"bg-primary text-primary-foreground rounded-l-lg rounded-tr-lg"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),Xr=o.forwardRef(({className:s,variant:t,layout:a,isLoading:n=!1,children:l,...c},d)=>e.jsx("div",{className:b(Ym({variant:t,layout:a,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:d,...c,children:n?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(Bm,{})}):l}));Xr.displayName="ChatBubbleMessage";const Wm=o.forwardRef(({variant:s,className:t,children:a,...n},l)=>e.jsx("div",{ref:l,className:b("absolute top-1/2 -translate-y-1/2 flex opacity-0 group-hover:opacity-100 transition-opacity duration-200",s==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",t),...n,children:a}));Wm.displayName="ChatBubbleActionWrapper";const el=o.forwardRef(({className:s,...t},a)=>e.jsx(cs,{autoComplete:"off",ref:a,name:"message",className:b("max-h-12 px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",s),...t}));el.displayName="ChatInput";const sl=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29l-4.3 4.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l4.29-4.3l4.29 4.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42Z"})}),tl=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.098 12.634L13 11.423V7a1 1 0 0 0-2 0v5a1 1 0 0 0 .5.866l2.598 1.5a1 1 0 1 0 1-1.732M12 2a10 10 0 1 0 10 10A10.01 10.01 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8.01 8.01 0 0 1-8 8"})}),Jm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M3.71 16.29a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21a1 1 0 0 0-.21.33a1 1 0 0 0 .21 1.09a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1 1 0 0 0 .21-1.09a1 1 0 0 0-.21-.33M7 8h14a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2m-3.29 3.29a1 1 0 0 0-1.09-.21a1.2 1.2 0 0 0-.33.21a1 1 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1 1 0 0 0-.21-.33M21 11H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2M3.71 6.29a1 1 0 0 0-.33-.21a1 1 0 0 0-1.09.21a1.2 1.2 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a1 1 0 0 0 1.09-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1.2 1.2 0 0 0-.21-.33M21 16H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})}),Qm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9 12H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m-1-2h4a1 1 0 0 0 0-2H8a1 1 0 0 0 0 2m1 6H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m12-4h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Zm-6.44-2.83a.8.8 0 0 0-.18-.09a.6.6 0 0 0-.19-.06a1 1 0 0 0-.9.27A1.05 1.05 0 0 0 12 17a1 1 0 0 0 .07.38a1.2 1.2 0 0 0 .22.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21A1 1 0 0 0 14 17a1.05 1.05 0 0 0-.29-.71a2 2 0 0 0-.15-.12m.14-3.88a1 1 0 0 0-1.62.33A1 1 0 0 0 13 14a1 1 0 0 0 1-1a1 1 0 0 0-.08-.38a.9.9 0 0 0-.22-.33"})});function Zm(){return e.jsxs("div",{className:"flex h-full flex-col space-y-4 p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{className:"h-8 w-3/4"}),e.jsx(Fe,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(Fe,{className:"h-20 w-2/3"},s))})]})}function Xm({ticketId:s,dialogTrigger:t}){const a=as(),n=o.useRef(null),[l,c]=o.useState(!1),[d,x]=o.useState(""),[r,i]=o.useState(!1),{data:h,refetch:D,isLoading:C}=Q({queryKey:["ticket",s,l],queryFn:()=>l?hd(s):Promise.resolve(null),refetchInterval:l?5e3:!1,retry:3}),m=h?.data,w=(p="smooth")=>{if(n.current){const{scrollHeight:V,clientHeight:A}=n.current;n.current.scrollTo({top:V-A,behavior:p})}};o.useEffect(()=>{if(!l)return;const p=requestAnimationFrame(()=>{w("instant"),setTimeout(()=>w(),1e3)});return()=>{cancelAnimationFrame(p)}},[l,m?.messages]);const _=async()=>{const p=d.trim();!p||r||(i(!0),jd({id:s,message:p}).then(()=>{x(""),D(),w()}).finally(()=>{i(!1)}))},y=async()=>{mr(s).then(()=>{L.success("工单已关闭"),D()})},N=()=>{m?.user&&a("/finance/order?user_id="+m.user.id)},P=m?.status===Es.CLOSED;return e.jsxs(ue,{open:l,onOpenChange:c,children:[e.jsx(Re,{asChild:!0,children:t??e.jsx(W,{variant:"outline",children:"查看工单"})}),e.jsxs(ce,{className:"flex h-[90vh] max-w-4xl flex-col gap-0 p-0",children:[e.jsx(xe,{}),C?e.jsx(Zm,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col space-y-4 border-b p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:m?.subject}),e.jsx(O,{variant:P?"secondary":"default",children:P?"已关闭":"处理中"}),!P&&e.jsx(Ye,{title:"确认关闭工单",description:"关闭后将无法继续回复,是否确认关闭该工单?",confirmText:"关闭工单",variant:"destructive",onConfirm:y,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(sl,{className:"h-4 w-4"}),"关闭工单"]})})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{children:m?.user?.email})]}),e.jsx(ge,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(tl,{className:"h-4 w-4"}),e.jsxs("span",{children:["创建于 ",re(m?.created_at)]})]}),e.jsx(ge,{orientation:"vertical",className:"h-4"}),e.jsx(O,{variant:"outline",children:m?.level!=null&&Js[m.level]})]})]}),m?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(Yr,{defaultValues:m.user,refetch:D,dialogTrigger:e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"用户信息",children:e.jsx(nt,{className:"h-4 w-4"})})}),e.jsx(Qr,{user_id:m.user.id,dialogTrigger:e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"流量记录",children:e.jsx(Jm,{className:"h-4 w-4"})})}),e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"订单记录",onClick:N,children:e.jsx(Qm,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:n,className:"h-full space-y-4 overflow-y-auto p-6",children:m?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"暂无消息记录"}):m?.messages?.map(p=>e.jsx(Zr,{variant:p.is_me?"sent":"received",className:p.is_me?"ml-auto":"mr-auto",children:e.jsx(Xr,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:p.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:re(p.created_at)})})]})})},p.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(el,{disabled:P||r,placeholder:P?"工单已关闭":"请输入回复内容...",className:"flex-1 resize-none rounded-lg border bg-background p-3 focus-visible:ring-1",value:d,onChange:p=>x(p.target.value),onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),_())}}),e.jsx(W,{disabled:P||r||!d.trim(),onClick:_,children:r?"发送中...":"发送"})]})})]})]})]})}const eh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 4H5a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3m-.41 2l-5.88 5.88a1 1 0 0 1-1.42 0L5.41 6ZM20 17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7.41l5.88 5.88a3 3 0 0 0 4.24 0L20 7.41Z"})}),sh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21.92 11.6C19.9 6.91 16.1 4 12 4s-7.9 2.91-9.92 7.6a1 1 0 0 0 0 .8C4.1 17.09 7.9 20 12 20s7.9-2.91 9.92-7.6a1 1 0 0 0 0-.8M12 18c-3.17 0-6.17-2.29-7.9-6C5.83 8.29 8.83 6 12 6s6.17 2.29 7.9 6c-1.73 3.71-4.73 6-7.9 6m0-10a4 4 0 1 0 4 4a4 4 0 0 0-4-4m0 6a2 2 0 1 1 2-2a2 2 0 0 1-2 2"})}),th=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"工单号"}),cell:({row:t})=>e.jsx(O,{variant:"outline",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:t})=>e.jsx(I,{column:t,title:"主题"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(eh,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"max-w-[500px] truncate font-medium",children:t.getValue("subject")})]}),enableSorting:!1,enableHiding:!1,size:4e3},{accessorKey:"level",header:({column:t})=>e.jsx(I,{column:t,title:"优先级"}),cell:({row:t})=>{const a=t.getValue("level"),n=a===es.LOW?"default":a===es.MEDIUM?"secondary":"destructive";return e.jsx(O,{variant:n,className:"whitespace-nowrap",children:Js[a]})},filterFn:(t,a,n)=>n.includes(t.getValue(a))},{accessorKey:"status",header:({column:t})=>e.jsx(I,{column:t,title:"状态"}),cell:({row:t})=>{const a=t.getValue("status"),n=t.original.reply_status,l=a===Es.CLOSED?kd[Es.CLOSED]:n===0?"已回复":"待回复",c=a===Es.CLOSED?"default":n===0?"secondary":"destructive";return e.jsx(O,{variant:c,className:"whitespace-nowrap",children:l})}},{accessorKey:"updated_at",header:({column:t})=>e.jsx(I,{column:t,title:"最后更新"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(tl,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:re(t.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(I,{column:t,title:"创建时间"}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:re(t.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const a=t.original.status!==Es.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Xm,{ticketId:t.original.id,dialogTrigger:e.jsx(W,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"查看详情",children:e.jsx(sh,{className:"h-4 w-4"})})}),a&&e.jsx(Ye,{title:"确认关闭工单",description:"关闭后将无法继续回复,是否确认关闭该工单?",confirmText:"关闭工单",variant:"destructive",onConfirm:async()=>{mr(t.original.id).then(()=>{L.success("工单已关闭"),s()})},children:e.jsx(W,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"关闭工单",children:e.jsx(sl,{className:"h-4 w-4"})})})]})}}];function ah(){const[s,t]=o.useState({}),[a,n]=o.useState({}),[l,c]=o.useState([{id:"status",value:"0"}]),[d,x]=o.useState([]),[r,i]=o.useState({pageIndex:0,pageSize:20}),{refetch:h,data:D,isLoading:C}=Q({queryKey:["orderList",r,l,d],queryFn:()=>xr({pageSize:r.pageSize,current:r.pageIndex+1,filter:l,sort:d})}),m=Le({data:D?.data??[],columns:th(h),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:r},rowCount:D?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),onPaginationChange:i,getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Um,{table:m,refetch:h}),e.jsx(Ge,{table:m,showPagination:!0})]})}function nh(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:" 工单管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以查看用户工单,包括查看、回复、关闭等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(ah,{})})]})]})}const rh=Object.freeze(Object.defineProperty({__proto__:null,default:nh},Symbol.toStringTag,{value:"Module"}));export{dh as a,oh as c,ch as g,uh as r}; +离线时长: ${c}秒`}return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:b("size-2.5 rounded-full ring-2 ring-offset-2",l?"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:a.original.email})]})}),e.jsx(ee,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:d})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:a})=>e.jsx(I,{column:a,title:"在线设备"}),cell:({row:a})=>{const n=a.original.device_limit,l=a.original.online_count||0;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(O,{variant:"outline",className:b("min-w-[4rem] justify-center",n!==null&&l>=n?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[l," / ",n===null?"∞":n]})})}),e.jsx(ee,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:n===null?"无设备数限制":`最多可同时在线 ${n} 台设备`})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:a})=>e.jsx(I,{column:a,title:"状态"}),cell:({row:a})=>{const n=a.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(O,{className:b("min-w-20 justify-center transition-colors",n?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:kd[n]})})},enableSorting:!0,filterFn:(a,n,l)=>l.includes(a.getValue(n))},{accessorKey:"plan_id",header:({column:a})=>e.jsx(I,{column:a,title:"订阅"}),cell:({row:a})=>e.jsx("div",{className:"min-w-[10em] break-all",children:a.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:a})=>e.jsx(I,{column:a,title:"权限组"}),cell:({row:a})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(O,{variant:"outline",className:b("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:a.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:a})=>e.jsx(I,{column:a,title:"已用流量"}),cell:({row:a})=>{const n=Fs(a.original?.total_used),l=Fs(a.original?.transfer_enable),c=a.original?.total_used/a.original?.transfer_enable*100||0;return e.jsx(le,{delayDuration:100,children:e.jsxs(se,{children:[e.jsx(te,{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:n}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:b("h-full rounded-full transition-all",c>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(c,100)}%`}})})]})}),e.jsx(ee,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:["总流量配额: ",l]})})]})})}},{accessorKey:"transfer_enable",header:({column:a})=>e.jsx(I,{column:a,title:"总流量"}),cell:({row:a})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:Fs(a.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:a})=>e.jsx(I,{column:a,title:"到期时间"}),cell:({row:a})=>{const n=a.original.expired_at,l=Date.now()/1e3,c=n!=null&&ne.jsx(I,{column:a,title:"余额"}),cell:({row:a})=>{const n=Rs(a.original?.balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:n})]})}},{accessorKey:"commission_balance",header:({column:a})=>e.jsx(I,{column:a,title:"佣金"}),cell:({row:a})=>{const n=Rs(a.original?.commission_balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:n})]})}},{accessorKey:"created_at",header:({column:a})=>e.jsx(I,{column:a,title:"注册时间"}),cell:({row:a})=>e.jsx("div",{className:"truncate",children:re(a.original?.created_at)}),size:1e3},{id:"actions",header:({column:a})=>e.jsx(I,{column:a,className:"justify-end",title:"操作"}),cell:({row:a,table:n})=>e.jsxs(vs,{modal:!0,children:[e.jsx(bs,{asChild:!0,children:e.jsx("div",{className:"text-center",children:e.jsx(W,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":"打开操作菜单",children:e.jsx(bt,{className:"size-4"})})})}),e.jsxs(ms,{align:"end",className:"min-w-[40px]",children:[e.jsx(he,{onSelect:l=>{l.preventDefault()},className:"p-0",children:e.jsx(Wr,{defaultValues:{...a.original,invite_user_email:a.original.invite_user?.email},refetch:s,dialogTrigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Rm,{className:"mr-2"}),"编辑"]})})}),e.jsx(he,{onSelect:l=>l.preventDefault(),className:"p-0",children:e.jsx(Ar,{defaultValues:{email:a.original.email},trigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Em,{className:"mr-2 "}),"分配订单"]})})}),e.jsx(he,{onSelect:()=>{Nt(a.original.subscribe_url)},className:"p-0",children:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Fm,{className:"mr-2"}),"复制订阅URL"]})}),e.jsx(he,{onSelect:()=>{xd({id:a.original.id}).then(({data:l})=>{l&&L.success("重置成功")})},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Mm,{className:"mr-2 "}),"重置UUID及订阅URL"]})}),e.jsx(he,{onSelect:()=>{},className:"p-0",children:e.jsxs(ws,{className:"flex items-center px-2 py-1.5",to:`/finance/order?user_id=${a.original?.id}`,children:[e.jsx(zm,{className:"mr-2"}),"TA的订单"]})}),e.jsx(he,{onSelect:()=>{n.setColumnFilters([{id:"invite_user_id",value:a.original?.id}])},children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Om,{className:"mr-2 "}),"TA的邀请"]})}),e.jsx(he,{onSelect:l=>l.preventDefault(),className:"p-0",children:e.jsx(Zr,{user_id:a.original?.id,dialogTrigger:e.jsxs(W,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Lm,{className:"mr-2 "}),"TA的流量记录"]})})})]})]})}];function Am(){const[s]=fo(),[t,a]=o.useState({}),[n,l]=o.useState({is_admin:!1,is_staff:!1}),[c,d]=o.useState([]),[x,r]=o.useState([]),[i,h]=o.useState({pageIndex:0,pageSize:20});o.useEffect(()=>{const A=s.get("email");A&&d($=>$.some(Y=>Y.id==="email")?$:[...$,{id:"email",value:A}])},[s]);const{refetch:D,data:C,isLoading:m}=Q({queryKey:["userList",i,c,x],queryFn:()=>dd({pageSize:i.pageSize,current:i.pageIndex+1,filter:c,sort:x})}),[w,_]=o.useState([]),[y,N]=o.useState([]);o.useEffect(()=>{Rt().then(({data:A})=>{_(A)}),ks().then(({data:A})=>{N(A)})},[]);const P=w.map(A=>({label:A.name,value:A.id})),p=y.map(A=>({label:A.name,value:A.id})),V=Le({data:C?.data??[],columns:$m(D),state:{sorting:x,columnVisibility:n,rowSelection:t,columnFilters:c,pagination:i},rowCount:C?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:r,onColumnFiltersChange:d,onColumnVisibilityChange:l,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),onPaginationChange:h,getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnVisibility:{commission_balance:!1,created_at:!1,is_admin:!1,is_staff:!1,permission_group:!1,plan_id:!1},columnPinning:{right:["actions"]}}});return e.jsx(Ge,{table:V,toolbar:e.jsx(Sm,{table:V,refetch:D,serverGroupList:w,permissionGroups:P,subscriptionPlans:p})})}function Hm(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"用户管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以管理用户,包括增加、删除、编辑、查询等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx("div",{className:"w-full",children:e.jsx(Am,{})})})]})]})}const Km=Object.freeze(Object.defineProperty({__proto__:null,default:Hm},Symbol.toStringTag,{value:"Module"}));function qm({column:s,title:t,options:a}){const n=new Set(s?.getFilterValue());return e.jsxs(Qe,{children:[e.jsx(Ze,{asChild:!0,children:e.jsxs(W,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(po,{className:"mr-2 h-4 w-4"}),t,n?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:n.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:n.size>2?e.jsxs(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[n.size," selected"]}):a.filter(l=>n.has(l.value)).map(l=>e.jsx(O,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:l.label},`selected-${l.value}`))})]})]})}),e.jsx(Be,{className:"w-[200px] p-0",align:"start",children:e.jsxs(hs,{children:[e.jsx(Cs,{placeholder:t}),e.jsxs(js,{children:[e.jsx(Ss,{children:"No results found."}),e.jsx(Ve,{children:a.map(l=>{const c=n.has(l.value);return e.jsxs(ve,{onSelect:()=>{c?n.delete(l.value):n.add(l.value);const d=Array.from(n);s?.setFilterValue(d.length?d:void 0)},children:[e.jsx("div",{className:b("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",c?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(vo,{className:b("h-4 w-4")})}),l.icon&&e.jsx(l.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:l.label})]},`option-${l.value}`)})}),n.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ls,{}),e.jsx(Ve,{children:e.jsx(ve,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Um=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11H5a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})});function Bm({table:s}){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-4",children:[e.jsx(jr,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:t=>s.getColumn("status")?.setFilterValue(t),children:e.jsxs(na,{className:"grid w-full grid-cols-2",children:[e.jsx(et,{value:"0",children:"已开始"}),e.jsx(et,{value:"1",children:"已关闭"})]})}),s.getColumn("level")&&e.jsx(qm,{column:s.getColumn("level"),title:"优先级",options:[{label:Js[es.LOW],value:es.LOW,icon:Um,color:"gray"},{label:Js[es.MEDIUM],value:es.MEDIUM,icon:Jr,color:"yellow"},{label:Js[es.HIGH],value:es.HIGH,icon:Qr,color:"red"}]})]})})}function Gm(){return e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground",children:[e.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}const Ym=ys("flex gap-2 max-w-[60%] items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),Xr=o.forwardRef(({className:s,variant:t,layout:a,children:n,...l},c)=>e.jsx("div",{className:b(Ym({variant:t,layout:a,className:s}),"relative group"),ref:c,...l,children:o.Children.map(n,d=>o.isValidElement(d)&&typeof d.type!="string"?o.cloneElement(d,{variant:t,layout:a}):d)}));Xr.displayName="ChatBubble";const Wm=ys("p-4",{variants:{variant:{received:"bg-secondary text-secondary-foreground rounded-r-lg rounded-tl-lg",sent:"bg-primary text-primary-foreground rounded-l-lg rounded-tr-lg"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),el=o.forwardRef(({className:s,variant:t,layout:a,isLoading:n=!1,children:l,...c},d)=>e.jsx("div",{className:b(Wm({variant:t,layout:a,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:d,...c,children:n?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(Gm,{})}):l}));el.displayName="ChatBubbleMessage";const Jm=o.forwardRef(({variant:s,className:t,children:a,...n},l)=>e.jsx("div",{ref:l,className:b("absolute top-1/2 -translate-y-1/2 flex opacity-0 group-hover:opacity-100 transition-opacity duration-200",s==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",t),...n,children:a}));Jm.displayName="ChatBubbleActionWrapper";const sl=o.forwardRef(({className:s,...t},a)=>e.jsx(gs,{autoComplete:"off",ref:a,name:"message",className:b("max-h-12 px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",s),...t}));sl.displayName="ChatInput";const tl=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29l-4.3 4.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l4.29-4.3l4.29 4.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42Z"})}),al=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.098 12.634L13 11.423V7a1 1 0 0 0-2 0v5a1 1 0 0 0 .5.866l2.598 1.5a1 1 0 1 0 1-1.732M12 2a10 10 0 1 0 10 10A10.01 10.01 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8.01 8.01 0 0 1-8 8"})}),Qm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M3.71 16.29a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21a1 1 0 0 0-.21.33a1 1 0 0 0 .21 1.09a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1 1 0 0 0 .21-1.09a1 1 0 0 0-.21-.33M7 8h14a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2m-3.29 3.29a1 1 0 0 0-1.09-.21a1.2 1.2 0 0 0-.33.21a1 1 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1 1 0 0 0-.21-.33M21 11H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2M3.71 6.29a1 1 0 0 0-.33-.21a1 1 0 0 0-1.09.21a1.2 1.2 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a1 1 0 0 0 1.09-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1.2 1.2 0 0 0-.21-.33M21 16H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})}),Zm=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9 12H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m-1-2h4a1 1 0 0 0 0-2H8a1 1 0 0 0 0 2m1 6H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m12-4h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Zm-6.44-2.83a.8.8 0 0 0-.18-.09a.6.6 0 0 0-.19-.06a1 1 0 0 0-.9.27A1.05 1.05 0 0 0 12 17a1 1 0 0 0 .07.38a1.2 1.2 0 0 0 .22.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21A1 1 0 0 0 14 17a1.05 1.05 0 0 0-.29-.71a2 2 0 0 0-.15-.12m.14-3.88a1 1 0 0 0-1.62.33A1 1 0 0 0 13 14a1 1 0 0 0 1-1a1 1 0 0 0-.08-.38a.9.9 0 0 0-.22-.33"})});function Xm(){return e.jsxs("div",{className:"flex h-full flex-col space-y-4 p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Fe,{className:"h-8 w-3/4"}),e.jsx(Fe,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(Fe,{className:"h-20 w-2/3"},s))})]})}function eh({ticketId:s,dialogTrigger:t}){const a=as(),n=o.useRef(null),[l,c]=o.useState(!1),[d,x]=o.useState(""),[r,i]=o.useState(!1),{data:h,refetch:D,isLoading:C}=Q({queryKey:["ticket",s,l],queryFn:()=>l?jd(s):Promise.resolve(null),refetchInterval:l?5e3:!1,retry:3}),m=h?.data,w=(p="smooth")=>{if(n.current){const{scrollHeight:V,clientHeight:A}=n.current;n.current.scrollTo({top:V-A,behavior:p})}};o.useEffect(()=>{if(!l)return;const p=requestAnimationFrame(()=>{w("instant"),setTimeout(()=>w(),1e3)});return()=>{cancelAnimationFrame(p)}},[l,m?.messages]);const _=async()=>{const p=d.trim();!p||r||(i(!0),gd({id:s,message:p}).then(()=>{x(""),D(),w()}).finally(()=>{i(!1)}))},y=async()=>{hr(s).then(()=>{L.success("工单已关闭"),D()})},N=()=>{m?.user&&a("/finance/order?user_id="+m.user.id)},P=m?.status===Es.CLOSED;return e.jsxs(ue,{open:l,onOpenChange:c,children:[e.jsx(Re,{asChild:!0,children:t??e.jsx(W,{variant:"outline",children:"查看工单"})}),e.jsxs(ce,{className:"flex h-[90vh] max-w-4xl flex-col gap-0 p-0",children:[e.jsx(xe,{}),C?e.jsx(Xm,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col space-y-4 border-b p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:m?.subject}),e.jsx(O,{variant:P?"secondary":"default",children:P?"已关闭":"处理中"}),!P&&e.jsx(Ye,{title:"确认关闭工单",description:"关闭后将无法继续回复,是否确认关闭该工单?",confirmText:"关闭工单",variant:"destructive",onConfirm:y,children:e.jsxs(W,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(tl,{className:"h-4 w-4"}),"关闭工单"]})})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{children:m?.user?.email})]}),e.jsx(ge,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(al,{className:"h-4 w-4"}),e.jsxs("span",{children:["创建于 ",re(m?.created_at)]})]}),e.jsx(ge,{orientation:"vertical",className:"h-4"}),e.jsx(O,{variant:"outline",children:m?.level!=null&&Js[m.level]})]})]}),m?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(Wr,{defaultValues:m.user,refetch:D,dialogTrigger:e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"用户信息",children:e.jsx(nt,{className:"h-4 w-4"})})}),e.jsx(Zr,{user_id:m.user.id,dialogTrigger:e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"流量记录",children:e.jsx(Qm,{className:"h-4 w-4"})})}),e.jsx(W,{variant:"outline",size:"icon",className:"h-8 w-8",title:"订单记录",onClick:N,children:e.jsx(Zm,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:n,className:"h-full space-y-4 overflow-y-auto p-6",children:m?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"暂无消息记录"}):m?.messages?.map(p=>e.jsx(Xr,{variant:p.is_me?"sent":"received",className:p.is_me?"ml-auto":"mr-auto",children:e.jsx(el,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:p.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:re(p.created_at)})})]})})},p.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(sl,{disabled:P||r,placeholder:P?"工单已关闭":"请输入回复内容...",className:"flex-1 resize-none rounded-lg border bg-background p-3 focus-visible:ring-1",value:d,onChange:p=>x(p.target.value),onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),_())}}),e.jsx(W,{disabled:P||r||!d.trim(),onClick:_,children:r?"发送中...":"发送"})]})})]})]})]})}const sh=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 4H5a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3m-.41 2l-5.88 5.88a1 1 0 0 1-1.42 0L5.41 6ZM20 17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7.41l5.88 5.88a3 3 0 0 0 4.24 0L20 7.41Z"})}),th=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21.92 11.6C19.9 6.91 16.1 4 12 4s-7.9 2.91-9.92 7.6a1 1 0 0 0 0 .8C4.1 17.09 7.9 20 12 20s7.9-2.91 9.92-7.6a1 1 0 0 0 0-.8M12 18c-3.17 0-6.17-2.29-7.9-6C5.83 8.29 8.83 6 12 6s6.17 2.29 7.9 6c-1.73 3.71-4.73 6-7.9 6m0-10a4 4 0 1 0 4 4a4 4 0 0 0-4-4m0 6a2 2 0 1 1 2-2a2 2 0 0 1-2 2"})}),ah=s=>[{accessorKey:"id",header:({column:t})=>e.jsx(I,{column:t,title:"工单号"}),cell:({row:t})=>e.jsx(O,{variant:"outline",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:t})=>e.jsx(I,{column:t,title:"主题"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(sh,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"max-w-[500px] truncate font-medium",children:t.getValue("subject")})]}),enableSorting:!1,enableHiding:!1,size:4e3},{accessorKey:"level",header:({column:t})=>e.jsx(I,{column:t,title:"优先级"}),cell:({row:t})=>{const a=t.getValue("level"),n=a===es.LOW?"default":a===es.MEDIUM?"secondary":"destructive";return e.jsx(O,{variant:n,className:"whitespace-nowrap",children:Js[a]})},filterFn:(t,a,n)=>n.includes(t.getValue(a))},{accessorKey:"status",header:({column:t})=>e.jsx(I,{column:t,title:"状态"}),cell:({row:t})=>{const a=t.getValue("status"),n=t.original.reply_status,l=a===Es.CLOSED?Td[Es.CLOSED]:n===0?"已回复":"待回复",c=a===Es.CLOSED?"default":n===0?"secondary":"destructive";return e.jsx(O,{variant:c,className:"whitespace-nowrap",children:l})}},{accessorKey:"updated_at",header:({column:t})=>e.jsx(I,{column:t,title:"最后更新"}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(al,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:re(t.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(I,{column:t,title:"创建时间"}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:re(t.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:t})=>e.jsx(I,{className:"justify-end",column:t,title:"操作"}),cell:({row:t})=>{const a=t.original.status!==Es.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(eh,{ticketId:t.original.id,dialogTrigger:e.jsx(W,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"查看详情",children:e.jsx(th,{className:"h-4 w-4"})})}),a&&e.jsx(Ye,{title:"确认关闭工单",description:"关闭后将无法继续回复,是否确认关闭该工单?",confirmText:"关闭工单",variant:"destructive",onConfirm:async()=>{hr(t.original.id).then(()=>{L.success("工单已关闭"),s()})},children:e.jsx(W,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"关闭工单",children:e.jsx(tl,{className:"h-4 w-4"})})})]})}}];function nh(){const[s,t]=o.useState({}),[a,n]=o.useState({}),[l,c]=o.useState([{id:"status",value:"0"}]),[d,x]=o.useState([]),[r,i]=o.useState({pageIndex:0,pageSize:20}),{refetch:h,data:D,isLoading:C}=Q({queryKey:["orderList",r,l,d],queryFn:()=>mr({pageSize:r.pageSize,current:r.pageIndex+1,filter:l,sort:d})}),m=Le({data:D?.data??[],columns:ah(h),state:{sorting:d,columnVisibility:a,rowSelection:s,columnFilters:l,pagination:r},rowCount:D?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:c,onColumnVisibilityChange:n,getCoreRowModel:$e(),getFilteredRowModel:Ke(),getPaginationRowModel:qe(),onPaginationChange:i,getSortedRowModel:Ue(),getFacetedRowModel:rs(),getFacetedUniqueValues:ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Bm,{table:m,refetch:h}),e.jsx(Ge,{table:m,showPagination:!0})]})}function rh(){return e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(ke,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(Te,{}),e.jsx(De,{})]})]}),e.jsxs(_e,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:" 工单管理"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"在这里可以查看用户工单,包括查看、回复、关闭等操作。"})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(nh,{})})]})]})}const lh=Object.freeze(Object.defineProperty({__proto__:null,default:rh},Symbol.toStringTag,{value:"Module"}));export{uh as a,ch as c,dh as g,xh as r}; diff --git a/public/assets/admin/assets/vendor.js b/public/assets/admin/assets/vendor.js index a027fec..62605d6 100644 --- a/public/assets/admin/assets/vendor.js +++ b/public/assets/admin/assets/vendor.js @@ -540,4 +540,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `:">",o};Zh.prototype.renderInline=function(e,t,n){let r="";const i=this.rules;for(let o=0,a=e.length;o=0&&(r=this.attrs[n][1]),r};nu.prototype.attrJoin=function(t,n){const r=this.attrIndex(t);r<0?this.attrPush([t,n]):this.attrs[r][1]=this.attrs[r][1]+" "+n};function qG(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}qG.prototype.Token=nu;const WVe=/\r\n?|\n/g,VVe=/\0/g;function HVe(e){let t;t=e.src.replace(WVe,` `),t=t.replace(VVe,"�"),e.src=t}function qVe(e){let t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function KVe(e){const t=e.tokens;for(let n=0,r=t.length;n\s]/i.test(e)}function YVe(e){return/^<\/a\s*>/i.test(e)}function ZVe(e){const t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n=0;a--){const u=i[a];if(u.type==="link_close"){for(a--;i[a].level!==u.level&&i[a].type!=="link_open";)a--;continue}if(u.type==="html_inline"&&(GVe(u.content)&&o>0&&o--,YVe(u.content)&&o++),!(o>0)&&u.type==="text"&&e.md.linkify.test(u.content)){const s=u.content;let l=e.md.linkify.match(s);const c=[];let d=u.level,h=0;l.length>0&&l[0].index===0&&a>0&&i[a-1].type==="text_special"&&(l=l.slice(1));for(let v=0;vh){const E=new e.Token("text","",0);E.content=s.slice(h,w),E.level=d,c.push(E)}const x=new e.Token("link_open","a",1);x.attrs=[["href",m]],x.level=d++,x.markup="linkify",x.info="auto",c.push(x);const S=new e.Token("text","",0);S.content=b,S.level=d,c.push(S);const A=new e.Token("link_close","a",-1);A.level=--d,A.markup="linkify",A.info="auto",c.push(A),h=l[v].lastIndex}if(h=0;n--){const r=e[n];r.type==="text"&&!t&&(r.content=r.content.replace(QVe,eHe)),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function nHe(e){let t=0;for(let n=e.length-1;n>=0;n--){const r=e[n];r.type==="text"&&!t&&KG.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),r.type==="link_open"&&r.info==="auto"&&t--,r.type==="link_close"&&r.info==="auto"&&t++}}function rHe(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(XVe.test(e.tokens[t].content)&&tHe(e.tokens[t].children),KG.test(e.tokens[t].content)&&nHe(e.tokens[t].children))}const iHe=/['"]/,gI=/['"]/g,mI="’";function by(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function oHe(e,t){let n;const r=[];for(let i=0;i=0&&!(r[n].level<=a);n--);if(r.length=n+1,o.type!=="text")continue;let u=o.content,s=0,l=u.length;e:for(;s=0)g=u.charCodeAt(c.index-1);else for(n=i-1;n>=0&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n--)if(e[n].content){g=e[n].content.charCodeAt(e[n].content.length-1);break}let m=32;if(s=48&&g<=57&&(h=d=!1),d&&h&&(d=b,h=w),!d&&!h){v&&(o.content=by(o.content,c.index,mI));continue}if(h)for(n=r.length-1;n>=0;n--){let A=r[n];if(r[n].level=0;t--)e.tokens[t].type!=="inline"||!iHe.test(e.tokens[t].content)||oHe(e.tokens[t].children,e)}function uHe(e){let t,n;const r=e.tokens,i=r.length;for(let o=0;o0&&this.level++,this.tokens.push(r),r};Ru.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]};Ru.prototype.skipEmptyLines=function(t){for(let n=this.lineMax;tn;)if(!Vn(this.src.charCodeAt(--t)))return t+1;return t};Ru.prototype.skipChars=function(t,n){for(let r=this.src.length;tr;)if(n!==this.src.charCodeAt(--t))return t+1;return t};Ru.prototype.getLines=function(t,n,r,i){if(t>=n)return"";const o=new Array(n-t);for(let a=0,u=t;ur?o[a]=new Array(s-r+1).join(" ")+this.src.slice(c,d):o[a]=this.src.slice(c,d)}return o.join("")};Ru.prototype.Token=nu;const sHe=65536;function h3(e,t){const n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function yI(e){const t=[],n=e.length;let r=0,i=e.charCodeAt(r),o=!1,a=0,u="";for(;rn)return!1;let i=t+1;if(e.sCount[i]=4)return!1;let o=e.bMarks[i]+e.tShift[i];if(o>=e.eMarks[i])return!1;const a=e.src.charCodeAt(o++);if(a!==124&&a!==45&&a!==58||o>=e.eMarks[i])return!1;const u=e.src.charCodeAt(o++);if(u!==124&&u!==45&&u!==58&&!Vn(u)||a===45&&Vn(u))return!1;for(;o=4)return!1;l=yI(s),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();const d=l.length;if(d===0||d!==c.length)return!1;if(r)return!0;const h=e.parentType;e.parentType="table";const v=e.md.block.ruler.getRules("blockquote"),g=e.push("table_open","table",1),m=[t,0];g.map=m;const b=e.push("thead_open","thead",1);b.map=[t,t+1];const w=e.push("tr_open","tr",1);w.map=[t,t+1];for(let A=0;A=4||(l=yI(s),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),S+=d-l.length,S>sHe))break;if(i===t+2){const C=e.push("tbody_open","tbody",1);C.map=x=[t+2,0]}const E=e.push("tr_open","tr",1);E.map=[i,i+1];for(let C=0;C=4){r++,i=r;continue}break}e.line=i;const o=e.push("code_block","code",0);return o.content=e.getLines(t,i,4+e.blkIndent,!1)+` -`,o.map=[t,e.line],!0}function fHe(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>o)return!1;const a=e.src.charCodeAt(i);if(a!==126&&a!==96)return!1;let u=i;i=e.skipChars(i,a);let s=i-u;if(s<3)return!1;const l=e.src.slice(u,i),c=e.src.slice(i,o);if(a===96&&c.indexOf(String.fromCharCode(a))>=0)return!1;if(r)return!0;let d=t,h=!1;for(;d++,!(d>=n||(i=u=e.bMarks[d]+e.tShift[d],o=e.eMarks[d],i=4)&&(i=e.skipChars(i,a),!(i-u=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;const u=[],s=[],l=[],c=[],d=e.md.block.ruler.getRules("blockquote"),h=e.parentType;e.parentType="blockquote";let v=!1,g;for(g=t;g=o)break;if(e.src.charCodeAt(i++)===62&&!S){let E=e.sCount[g]+1,C,T;e.src.charCodeAt(i)===32?(i++,E++,T=!1,C=!0):e.src.charCodeAt(i)===9?(C=!0,(e.bsCount[g]+E)%4===3?(i++,E++,T=!1):T=!0):C=!1;let M=E;for(u.push(e.bMarks[g]),e.bMarks[g]=i;i=o,s.push(e.bsCount[g]),e.bsCount[g]=e.sCount[g]+1+(C?1:0),l.push(e.sCount[g]),e.sCount[g]=M-E,c.push(e.tShift[g]),e.tShift[g]=i-e.bMarks[g];continue}if(v)break;let A=!1;for(let E=0,C=d.length;E";const w=[t,0];b.map=w,e.md.block.tokenize(e,t,g);const x=e.push("blockquote_close","blockquote",-1);x.markup=">",e.lineMax=a,e.parentType=h,w[1]=e.line;for(let S=0;S=4)return!1;let o=e.bMarks[t]+e.tShift[t];const a=e.src.charCodeAt(o++);if(a!==42&&a!==45&&a!==95)return!1;let u=1;for(;o=r)return-1;let o=e.src.charCodeAt(i++);if(o<48||o>57)return-1;for(;;){if(i>=r)return-1;if(o=e.src.charCodeAt(i++),o>=48&&o<=57){if(i-n>=10)return-1;continue}if(o===41||o===46)break;return-1}return i=4||e.listIndent>=0&&e.sCount[s]-e.listIndent>=4&&e.sCount[s]=e.blkIndent&&(c=!0);let d,h,v;if((v=xI(e,s))>=0){if(d=!0,a=e.bMarks[s]+e.tShift[s],h=Number(e.src.slice(a,v-1)),c&&h!==1)return!1}else if((v=bI(e,s))>=0)d=!1;else return!1;if(c&&e.skipSpaces(v)>=e.eMarks[s])return!1;if(r)return!0;const g=e.src.charCodeAt(v-1),m=e.tokens.length;d?(u=e.push("ordered_list_open","ol",1),h!==1&&(u.attrs=[["start",h]])):u=e.push("bullet_list_open","ul",1);const b=[s,0];u.map=b,u.markup=String.fromCharCode(g);let w=!1;const x=e.md.block.ruler.getRules("list"),S=e.parentType;for(e.parentType="list";s=i?T=1:T=E-A,T>4&&(T=1);const M=A+T;u=e.push("list_item_open","li",1),u.markup=String.fromCharCode(g);const F=[s,0];u.map=F,d&&(u.info=e.src.slice(a,v-1));const U=e.tight,H=e.tShift[s],W=e.sCount[s],ie=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=M,e.tight=!0,e.tShift[s]=C-e.bMarks[s],e.sCount[s]=E,C>=i&&e.isEmpty(s+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,s,n,!0),(!e.tight||w)&&(l=!1),w=e.line-s>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=ie,e.tShift[s]=H,e.sCount[s]=W,e.tight=U,u=e.push("list_item_close","li",-1),u.markup=String.fromCharCode(g),s=e.line,F[1]=s,s>=n||e.sCount[s]=4)break;let Z=!1;for(let G=0,K=x.length;G=4||e.src.charCodeAt(i)!==91)return!1;function u(x){const S=e.lineMax;if(x>=S||e.isEmpty(x))return null;let A=!1;if(e.sCount[x]-e.blkIndent>3&&(A=!0),e.sCount[x]<0&&(A=!0),!A){const T=e.md.block.ruler.getRules("reference"),M=e.parentType;e.parentType="reference";let F=!1;for(let U=0,H=T.length;U"u"&&(e.env.references={}),typeof e.env.references[w]>"u"&&(e.env.references[w]={title:b,href:d}),e.line=a),!0):!1}const mHe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],yHe="[a-zA-Z_:][a-zA-Z0-9:._-]*",bHe="[^\"'=<>`\\x00-\\x20]+",xHe="'[^']*'",wHe='"[^"]*"',_He="(?:"+bHe+"|"+xHe+"|"+wHe+")",SHe="(?:\\s+"+yHe+"(?:\\s*=\\s*"+_He+")?)",GG="<[A-Za-z][A-Za-z0-9\\-]*"+SHe+"*\\s*\\/?>",YG="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",CHe="",EHe="<[?][\\s\\S]*?[?]>",AHe="]*>",OHe="",PHe=new RegExp("^(?:"+GG+"|"+YG+"|"+CHe+"|"+EHe+"|"+AHe+"|"+OHe+")"),kHe=new RegExp("^(?:"+GG+"|"+YG+")"),qf=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(kHe.source+"\\s*$"),/^$/,!1]];function THe(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let a=e.src.slice(i,o),u=0;for(;u=4)return!1;let a=e.src.charCodeAt(i);if(a!==35||i>=o)return!1;let u=1;for(a=e.src.charCodeAt(++i);a===35&&i6||ii&&Vn(e.src.charCodeAt(s-1))&&(o=s),e.line=t+1;const l=e.push("heading_open","h"+String(u),1);l.markup="########".slice(0,u),l.map=[t,e.line];const c=e.push("inline","",0);c.content=e.src.slice(i,o).trim(),c.map=[t,e.line],c.children=[];const d=e.push("heading_close","h"+String(u),-1);return d.markup="########".slice(0,u),!0}function RHe(e,t,n){const r=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const i=e.parentType;e.parentType="paragraph";let o=0,a,u=t+1;for(;u3)continue;if(e.sCount[u]>=e.blkIndent){let v=e.bMarks[u]+e.tShift[u];const g=e.eMarks[u];if(v=g))){o=a===61?1:2;break}}if(e.sCount[u]<0)continue;let h=!1;for(let v=0,g=r.length;v3||e.sCount[o]<0)continue;let l=!1;for(let c=0,d=r.length;c=n||e.sCount[a]=o){e.line=n;break}const s=e.line;let l=!1;for(let c=0;c=e.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");e.tight=!u,e.isEmpty(e.line-1)&&(u=!0),a=e.line,a0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};Ig.prototype.scanDelims=function(e,t){const n=this.posMax,r=this.src.charCodeAt(e),i=e>0?this.src.charCodeAt(e-1):32;let o=e;for(;o0)return!1;const n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;const i=e.pending.match(NHe);if(!i)return!1;const o=i[1],a=e.md.linkify.matchAtStart(e.src.slice(n-o.length));if(!a)return!1;let u=a.url;if(u.length<=o.length)return!1;u=u.replace(/\*+$/,"");const s=e.md.normalizeLink(u);if(!e.md.validateLink(s))return!1;if(!t){e.pending=e.pending.slice(0,-o.length);const l=e.push("link_open","a",1);l.attrs=[["href",s]],l.markup="linkify",l.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(u);const d=e.push("link_close","a",-1);d.markup="linkify",d.info="auto"}return e.pos+=u.length-o.length,!0}function LHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;const r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let o=r-1;for(;o>=1&&e.pending.charCodeAt(o-1)===32;)o--;e.pending=e.pending.slice(0,o),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(n++;n?@[]^_`{|}~-".split("").forEach(function(e){nP[e.charCodeAt(0)]=1});function jHe(e,t){let n=e.pos;const r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push("hardbreak","br",0),n++;n=55296&&i<=56319&&n+1=56320&&u<=57343&&(o+=e.src[n+1],n++)}const a="\\"+o;if(!t){const u=e.push("text_special","",0);i<256&&nP[i]!==0?u.content=o:u.content=a,u.markup=a,u.info="escape"}return e.pos=n+1,!0}function BHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;const i=n;n++;const o=e.posMax;for(;n=0;r--){const i=t[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const o=t[i.end],a=r>0&&t[r-1].end===i.end+1&&t[r-1].marker===i.marker&&t[r-1].token===i.token-1&&t[i.end+1].token===o.token+1,u=String.fromCharCode(i.marker),s=e.tokens[i.token];s.type=a?"strong_open":"em_open",s.tag=a?"strong":"em",s.nesting=1,s.markup=a?u+u:u,s.content="";const l=e.tokens[o.token];l.type=a?"strong_close":"em_close",l.tag=a?"strong":"em",l.nesting=-1,l.markup=a?u+u:u,l.content="",a&&(e.tokens[t[r-1].token].content="",e.tokens[t[i.end+1].token].content="",r--)}}function VHe(e){const t=e.tokens_meta,n=e.tokens_meta.length;_I(e,e.delimiters);for(let r=0;r=d)return!1;if(s=g,i=e.md.helpers.parseLinkDestination(e.src,g,e.posMax),i.ok){for(a=e.md.normalizeLink(i.str),e.md.validateLink(a)?g=i.pos:a="",s=g;g=d||e.src.charCodeAt(g)!==41)&&(l=!0),g++}if(l){if(typeof e.env.references>"u")return!1;if(g=0?r=e.src.slice(s,g++):g=v+1):g=v+1,r||(r=e.src.slice(h,v)),o=e.env.references[n2(r)],!o)return e.pos=c,!1;a=o.href,u=o.title}if(!t){e.pos=h,e.posMax=v;const m=e.push("link_open","a",1),b=[["href",a]];m.attrs=b,u&&b.push(["title",u]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=g,e.posMax=d,!0}function qHe(e,t){let n,r,i,o,a,u,s,l,c="";const d=e.pos,h=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const v=e.pos+2,g=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(g<0)return!1;if(o=g+1,o=h)return!1;for(l=o,u=e.md.helpers.parseLinkDestination(e.src,o,e.posMax),u.ok&&(c=e.md.normalizeLink(u.str),e.md.validateLink(c)?o=u.pos:c=""),l=o;o=h||e.src.charCodeAt(o)!==41)return e.pos=d,!1;o++}else{if(typeof e.env.references>"u")return!1;if(o=0?i=e.src.slice(l,o++):o=g+1):o=g+1,i||(i=e.src.slice(v,g)),a=e.env.references[n2(i)],!a)return e.pos=d,!1;c=a.href,s=a.title}if(!t){r=e.src.slice(v,g);const m=[];e.md.inline.parse(r,e.md,e.env,m);const b=e.push("image","img",0),w=[["src",c],["alt",""]];b.attrs=w,b.children=m,b.content=r,s&&w.push(["title",s])}return e.pos=o,e.posMax=h,!0}const KHe=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,GHe=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function YHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;const r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;const a=e.src.charCodeAt(n);if(a===60)return!1;if(a===62)break}const o=e.src.slice(r+1,n);if(GHe.test(o)){const a=e.md.normalizeLink(o);if(!e.md.validateLink(a))return!1;if(!t){const u=e.push("link_open","a",1);u.attrs=[["href",a]],u.markup="autolink",u.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(o);const l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}if(KHe.test(o)){const a=e.md.normalizeLink("mailto:"+o);if(!e.md.validateLink(a))return!1;if(!t){const u=e.push("link_open","a",1);u.attrs=[["href",a]],u.markup="autolink",u.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(o);const l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}return!1}function ZHe(e){return/^\s]/i.test(e)}function XHe(e){return/^<\/a\s*>/i.test(e)}function QHe(e){const t=e|32;return t>=97&&t<=122}function JHe(e,t){if(!e.md.options.html)return!1;const n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!QHe(i))return!1;const o=e.src.slice(r).match(PHe);if(!o)return!1;if(!t){const a=e.push("html_inline","",0);a.content=o[0],ZHe(a.content)&&e.linkLevel++,XHe(a.content)&&e.linkLevel--}return e.pos+=o[0].length,!0}const eqe=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,tqe=/^&([a-z][a-z0-9]{1,31});/i;function nqe(e,t){const n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){const o=e.src.slice(n).match(eqe);if(o){if(!t){const a=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),u=e.push("text_special","",0);u.content=eP(a)?ix(a):ix(65533),u.markup=o[0],u.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(tqe);if(o){const a=WG(o[0]);if(a!==o[0]){if(!t){const u=e.push("text_special","",0);u.content=a,u.markup=o[0],u.info="entity"}return e.pos+=o[0].length,!0}}}return!1}function SI(e){const t={},n=e.length;if(!n)return;let r=0,i=-2;const o=[];for(let a=0;as;l-=o[l]+1){const d=e[l];if(d.marker===u.marker&&d.open&&d.end<0){let h=!1;if((d.close||u.open)&&(d.length+u.length)%3===0&&(d.length%3!==0||u.length%3!==0)&&(h=!0),!h){const v=l>0&&!e[l-1].open?o[l-1]+1:0;o[a]=a-l+v,o[l]=v,u.open=!1,d.end=a,d.close=!1,c=-1,i=-2;break}}}c!==-1&&(t[u.marker][(u.open?3:0)+(u.length||0)%3]=c)}}function rqe(e){const t=e.tokens_meta,n=e.tokens_meta.length;SI(e.delimiters);for(let r=0;r0&&r++,i[t].type==="text"&&t+1=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;a||e.pos++,o[t]=e.pos};Ng.prototype.tokenize=function(e){const t=this.ruler.getRules(""),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(a){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};Ng.prototype.parse=function(e,t,n,r){const i=new this.State(e,t,n,r);this.tokenize(i);const o=this.ruler2.getRules(""),a=o.length;for(let u=0;u|$))",t.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}function Q6(e){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){e[r]=n[r]})}),e}function i2(e){return Object.prototype.toString.call(e)}function aqe(e){return i2(e)==="[object String]"}function uqe(e){return i2(e)==="[object Object]"}function sqe(e){return i2(e)==="[object RegExp]"}function CI(e){return i2(e)==="[object Function]"}function lqe(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const QG={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function cqe(e){return Object.keys(e||{}).reduce(function(t,n){return t||QG.hasOwnProperty(n)},!1)}const fqe={"http:":{validate:function(e,t,n){const r=e.slice(t);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){const r=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){const r=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},dqe="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",hqe="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function pqe(e){e.__index__=-1,e.__text_cache__=""}function vqe(e){return function(t,n){const r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function EI(){return function(e,t){t.normalize(e)}}function ox(e){const t=e.re=oqe(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(dqe),n.push(t.src_xn),t.src_tlds=n.join("|");function r(u){return u.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),"i");const i=[];e.__compiled__={};function o(u,s){throw new Error('(LinkifyIt) Invalid schema "'+u+'": '+s)}Object.keys(e.__schemas__).forEach(function(u){const s=e.__schemas__[u];if(s===null)return;const l={validate:null,link:null};if(e.__compiled__[u]=l,uqe(s)){sqe(s.validate)?l.validate=vqe(s.validate):CI(s.validate)?l.validate=s.validate:o(u,s),CI(s.normalize)?l.normalize=s.normalize:s.normalize?o(u,s):l.normalize=EI();return}if(aqe(s)){i.push(u);return}o(u,s)}),i.forEach(function(u){e.__compiled__[e.__schemas__[u]]&&(e.__compiled__[u].validate=e.__compiled__[e.__schemas__[u]].validate,e.__compiled__[u].normalize=e.__compiled__[e.__schemas__[u]].normalize)}),e.__compiled__[""]={validate:null,normalize:EI()};const a=Object.keys(e.__compiled__).filter(function(u){return u.length>0&&e.__compiled__[u]}).map(lqe).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+a+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+a+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),pqe(e)}function gqe(e,t){const n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function J6(e,t){const n=new gqe(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function Uo(e,t){if(!(this instanceof Uo))return new Uo(e,t);t||cqe(e)&&(t=e,e={}),this.__opts__=Q6({},QG,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Q6({},fqe,e),this.__compiled__={},this.__tlds__=hqe,this.__tlds_replaced__=!1,this.re={},ox(this)}Uo.prototype.add=function(t,n){return this.__schemas__[t]=n,ox(this),this};Uo.prototype.set=function(t){return this.__opts__=Q6(this.__opts__,t),this};Uo.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let n,r,i,o,a,u,s,l,c;if(this.re.schema_test.test(t)){for(s=this.re.schema_search,s.lastIndex=0;(n=s.exec(t))!==null;)if(o=this.testSchemaAt(t,n[2],s.lastIndex),o){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=t.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l=0&&(i=t.match(this.re.email_fuzzy))!==null&&(a=i.index+i[1].length,u=i.index+i[0].length,(this.__index__<0||athis.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=u))),this.__index__>=0};Uo.prototype.pretest=function(t){return this.re.pretest.test(t)};Uo.prototype.testSchemaAt=function(t,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(t,r,this):0};Uo.prototype.match=function(t){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===t&&(n.push(J6(this,r)),r=this.__last_index__);let i=r?t.slice(r):t;for(;this.test(i);)n.push(J6(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};Uo.prototype.matchAtStart=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return null;const n=this.re.schema_at_start.exec(t);if(!n)return null;const r=this.testSchemaAt(t,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,J6(this,0)):null};Uo.prototype.tlds=function(t,n){return t=Array.isArray(t)?t:[t],n?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(r,i,o){return r!==o[i-1]}).reverse(),ox(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,ox(this),this)};Uo.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};Uo.prototype.onCompile=function(){};const Md=2147483647,mu=36,rP=1,Zv=26,mqe=38,yqe=700,JG=72,eY=128,tY="-",bqe=/^xn--/,xqe=/[^\0-\x7F]/,wqe=/[\x2E\u3002\uFF0E\uFF61]/g,_qe={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g3=mu-rP,yu=Math.floor,m3=String.fromCharCode;function Ys(e){throw new RangeError(_qe[e])}function Sqe(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function nY(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(wqe,".");const i=e.split("."),o=Sqe(i,t).join(".");return r+o}function rY(e){const t=[];let n=0;const r=e.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...e),Eqe=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:mu},AI=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},iY=function(e,t,n){let r=0;for(e=n?yu(e/yqe):e>>1,e+=yu(e/t);e>g3*Zv>>1;r+=mu)e=yu(e/g3);return yu(r+(g3+1)*e/(e+mqe))},oY=function(e){const t=[],n=e.length;let r=0,i=eY,o=JG,a=e.lastIndexOf(tY);a<0&&(a=0);for(let u=0;u=128&&Ys("not-basic"),t.push(e.charCodeAt(u));for(let u=a>0?a+1:0;u=n&&Ys("invalid-input");const h=Eqe(e.charCodeAt(u++));h>=mu&&Ys("invalid-input"),h>yu((Md-r)/c)&&Ys("overflow"),r+=h*c;const v=d<=o?rP:d>=o+Zv?Zv:d-o;if(hyu(Md/g)&&Ys("overflow"),c*=g}const l=t.length+1;o=iY(r-s,l,s==0),yu(r/l)>Md-i&&Ys("overflow"),i+=yu(r/l),r%=l,t.splice(r++,0,i)}return String.fromCodePoint(...t)},aY=function(e){const t=[];e=rY(e);const n=e.length;let r=eY,i=0,o=JG;for(const s of e)s<128&&t.push(m3(s));const a=t.length;let u=a;for(a&&t.push(tY);u=r&&cyu((Md-i)/l)&&Ys("overflow"),i+=(s-r)*l,r=s;for(const c of e)if(cMd&&Ys("overflow"),c===r){let d=i;for(let h=mu;;h+=mu){const v=h<=o?rP:h>=o+Zv?Zv:h-o;if(d=0))try{t.hostname=uY.toASCII(t.hostname)}catch{}return $g(ZO(t))}function Nqe(e){const t=XO(e,!0);if(t.hostname&&(!t.protocol||sY.indexOf(t.protocol)>=0))try{t.hostname=uY.toUnicode(t.hostname)}catch{}return bh(ZO(t),bh.defaultChars+"%")}function Qa(e,t){if(!(this instanceof Qa))return new Qa(e,t);t||JO(e)||(t=e||{},e="default"),this.inline=new Ng,this.block=new r2,this.core=new tP,this.renderer=new Zh,this.linkify=new Uo,this.validateLink=$qe,this.normalizeLink=Iqe,this.normalizeLinkText=Nqe,this.utils=LVe,this.helpers=t2({},UVe),this.options={},this.configure(e),t&&this.set(t)}Qa.prototype.set=function(e){return t2(this.options,e),this};Qa.prototype.configure=function(e){const t=this;if(JO(e)){const n=e;if(e=Mqe[n],!e)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[n].ruler2.enableOnly(e.components[n].rules2)}),this};Qa.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));const r=e.filter(function(i){return n.indexOf(i)<0});if(r.length&&!t)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};Qa.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));const r=e.filter(function(i){return n.indexOf(i)<0});if(r.length&&!t)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};Qa.prototype.use=function(e){const t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this};Qa.prototype.parse=function(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const n=new this.core.State(e,this,t);return this.core.process(n),n.tokens};Qa.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)};Qa.prototype.parseInline=function(e,t){const n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens};Qa.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};var lY={exports:{}};(function(e){(function(t){var n=function(k){var D,$=new Float64Array(16);if(k)for(D=0;D>24&255,k[D+1]=$>>16&255,k[D+2]=$>>8&255,k[D+3]=$&255,k[D+4]=O>>24&255,k[D+5]=O>>16&255,k[D+6]=O>>8&255,k[D+7]=O&255}function m(k,D,$,O,N){var ee,ne=0;for(ee=0;ee>>8)-1}function b(k,D,$,O){return m(k,D,$,O,16)}function w(k,D,$,O){return m(k,D,$,O,32)}function x(k,D,$,O){for(var N=O[0]&255|(O[1]&255)<<8|(O[2]&255)<<16|(O[3]&255)<<24,ee=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,ne=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,he=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,Ce=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,Be=O[4]&255|(O[5]&255)<<8|(O[6]&255)<<16|(O[7]&255)<<24,He=D[0]&255|(D[1]&255)<<8|(D[2]&255)<<16|(D[3]&255)<<24,ct=D[4]&255|(D[5]&255)<<8|(D[6]&255)<<16|(D[7]&255)<<24,Ne=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,rt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=O[8]&255|(O[9]&255)<<8|(O[10]&255)<<16|(O[11]&255)<<24,At=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,vt=$[20]&255|($[21]&255)<<8|($[22]&255)<<16|($[23]&255)<<24,ht=$[24]&255|($[25]&255)<<8|($[26]&255)<<16|($[27]&255)<<24,xt=$[28]&255|($[29]&255)<<8|($[30]&255)<<16|($[31]&255)<<24,wt=O[12]&255|(O[13]&255)<<8|(O[14]&255)<<16|(O[15]&255)<<24,Je=N,st=ee,Qe=ne,Le=he,qe=Ce,Ge=Be,me=He,ve=ct,De=Ne,Pe=rt,Te=bt,ze=At,mt=vt,Nt=ht,Ft=xt,$t=wt,te,Gt=0;Gt<20;Gt+=2)te=Je+mt|0,qe^=te<<7|te>>>25,te=qe+Je|0,De^=te<<9|te>>>23,te=De+qe|0,mt^=te<<13|te>>>19,te=mt+De|0,Je^=te<<18|te>>>14,te=Ge+st|0,Pe^=te<<7|te>>>25,te=Pe+Ge|0,Nt^=te<<9|te>>>23,te=Nt+Pe|0,st^=te<<13|te>>>19,te=st+Nt|0,Ge^=te<<18|te>>>14,te=Te+me|0,Ft^=te<<7|te>>>25,te=Ft+Te|0,Qe^=te<<9|te>>>23,te=Qe+Ft|0,me^=te<<13|te>>>19,te=me+Qe|0,Te^=te<<18|te>>>14,te=$t+ze|0,Le^=te<<7|te>>>25,te=Le+$t|0,ve^=te<<9|te>>>23,te=ve+Le|0,ze^=te<<13|te>>>19,te=ze+ve|0,$t^=te<<18|te>>>14,te=Je+Le|0,st^=te<<7|te>>>25,te=st+Je|0,Qe^=te<<9|te>>>23,te=Qe+st|0,Le^=te<<13|te>>>19,te=Le+Qe|0,Je^=te<<18|te>>>14,te=Ge+qe|0,me^=te<<7|te>>>25,te=me+Ge|0,ve^=te<<9|te>>>23,te=ve+me|0,qe^=te<<13|te>>>19,te=qe+ve|0,Ge^=te<<18|te>>>14,te=Te+Pe|0,ze^=te<<7|te>>>25,te=ze+Te|0,De^=te<<9|te>>>23,te=De+ze|0,Pe^=te<<13|te>>>19,te=Pe+De|0,Te^=te<<18|te>>>14,te=$t+Ft|0,mt^=te<<7|te>>>25,te=mt+$t|0,Nt^=te<<9|te>>>23,te=Nt+mt|0,Ft^=te<<13|te>>>19,te=Ft+Nt|0,$t^=te<<18|te>>>14;Je=Je+N|0,st=st+ee|0,Qe=Qe+ne|0,Le=Le+he|0,qe=qe+Ce|0,Ge=Ge+Be|0,me=me+He|0,ve=ve+ct|0,De=De+Ne|0,Pe=Pe+rt|0,Te=Te+bt|0,ze=ze+At|0,mt=mt+vt|0,Nt=Nt+ht|0,Ft=Ft+xt|0,$t=$t+wt|0,k[0]=Je>>>0&255,k[1]=Je>>>8&255,k[2]=Je>>>16&255,k[3]=Je>>>24&255,k[4]=st>>>0&255,k[5]=st>>>8&255,k[6]=st>>>16&255,k[7]=st>>>24&255,k[8]=Qe>>>0&255,k[9]=Qe>>>8&255,k[10]=Qe>>>16&255,k[11]=Qe>>>24&255,k[12]=Le>>>0&255,k[13]=Le>>>8&255,k[14]=Le>>>16&255,k[15]=Le>>>24&255,k[16]=qe>>>0&255,k[17]=qe>>>8&255,k[18]=qe>>>16&255,k[19]=qe>>>24&255,k[20]=Ge>>>0&255,k[21]=Ge>>>8&255,k[22]=Ge>>>16&255,k[23]=Ge>>>24&255,k[24]=me>>>0&255,k[25]=me>>>8&255,k[26]=me>>>16&255,k[27]=me>>>24&255,k[28]=ve>>>0&255,k[29]=ve>>>8&255,k[30]=ve>>>16&255,k[31]=ve>>>24&255,k[32]=De>>>0&255,k[33]=De>>>8&255,k[34]=De>>>16&255,k[35]=De>>>24&255,k[36]=Pe>>>0&255,k[37]=Pe>>>8&255,k[38]=Pe>>>16&255,k[39]=Pe>>>24&255,k[40]=Te>>>0&255,k[41]=Te>>>8&255,k[42]=Te>>>16&255,k[43]=Te>>>24&255,k[44]=ze>>>0&255,k[45]=ze>>>8&255,k[46]=ze>>>16&255,k[47]=ze>>>24&255,k[48]=mt>>>0&255,k[49]=mt>>>8&255,k[50]=mt>>>16&255,k[51]=mt>>>24&255,k[52]=Nt>>>0&255,k[53]=Nt>>>8&255,k[54]=Nt>>>16&255,k[55]=Nt>>>24&255,k[56]=Ft>>>0&255,k[57]=Ft>>>8&255,k[58]=Ft>>>16&255,k[59]=Ft>>>24&255,k[60]=$t>>>0&255,k[61]=$t>>>8&255,k[62]=$t>>>16&255,k[63]=$t>>>24&255}function S(k,D,$,O){for(var N=O[0]&255|(O[1]&255)<<8|(O[2]&255)<<16|(O[3]&255)<<24,ee=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,ne=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,he=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,Ce=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,Be=O[4]&255|(O[5]&255)<<8|(O[6]&255)<<16|(O[7]&255)<<24,He=D[0]&255|(D[1]&255)<<8|(D[2]&255)<<16|(D[3]&255)<<24,ct=D[4]&255|(D[5]&255)<<8|(D[6]&255)<<16|(D[7]&255)<<24,Ne=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,rt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=O[8]&255|(O[9]&255)<<8|(O[10]&255)<<16|(O[11]&255)<<24,At=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,vt=$[20]&255|($[21]&255)<<8|($[22]&255)<<16|($[23]&255)<<24,ht=$[24]&255|($[25]&255)<<8|($[26]&255)<<16|($[27]&255)<<24,xt=$[28]&255|($[29]&255)<<8|($[30]&255)<<16|($[31]&255)<<24,wt=O[12]&255|(O[13]&255)<<8|(O[14]&255)<<16|(O[15]&255)<<24,Je=N,st=ee,Qe=ne,Le=he,qe=Ce,Ge=Be,me=He,ve=ct,De=Ne,Pe=rt,Te=bt,ze=At,mt=vt,Nt=ht,Ft=xt,$t=wt,te,Gt=0;Gt<20;Gt+=2)te=Je+mt|0,qe^=te<<7|te>>>25,te=qe+Je|0,De^=te<<9|te>>>23,te=De+qe|0,mt^=te<<13|te>>>19,te=mt+De|0,Je^=te<<18|te>>>14,te=Ge+st|0,Pe^=te<<7|te>>>25,te=Pe+Ge|0,Nt^=te<<9|te>>>23,te=Nt+Pe|0,st^=te<<13|te>>>19,te=st+Nt|0,Ge^=te<<18|te>>>14,te=Te+me|0,Ft^=te<<7|te>>>25,te=Ft+Te|0,Qe^=te<<9|te>>>23,te=Qe+Ft|0,me^=te<<13|te>>>19,te=me+Qe|0,Te^=te<<18|te>>>14,te=$t+ze|0,Le^=te<<7|te>>>25,te=Le+$t|0,ve^=te<<9|te>>>23,te=ve+Le|0,ze^=te<<13|te>>>19,te=ze+ve|0,$t^=te<<18|te>>>14,te=Je+Le|0,st^=te<<7|te>>>25,te=st+Je|0,Qe^=te<<9|te>>>23,te=Qe+st|0,Le^=te<<13|te>>>19,te=Le+Qe|0,Je^=te<<18|te>>>14,te=Ge+qe|0,me^=te<<7|te>>>25,te=me+Ge|0,ve^=te<<9|te>>>23,te=ve+me|0,qe^=te<<13|te>>>19,te=qe+ve|0,Ge^=te<<18|te>>>14,te=Te+Pe|0,ze^=te<<7|te>>>25,te=ze+Te|0,De^=te<<9|te>>>23,te=De+ze|0,Pe^=te<<13|te>>>19,te=Pe+De|0,Te^=te<<18|te>>>14,te=$t+Ft|0,mt^=te<<7|te>>>25,te=mt+$t|0,Nt^=te<<9|te>>>23,te=Nt+mt|0,Ft^=te<<13|te>>>19,te=Ft+Nt|0,$t^=te<<18|te>>>14;k[0]=Je>>>0&255,k[1]=Je>>>8&255,k[2]=Je>>>16&255,k[3]=Je>>>24&255,k[4]=Ge>>>0&255,k[5]=Ge>>>8&255,k[6]=Ge>>>16&255,k[7]=Ge>>>24&255,k[8]=Te>>>0&255,k[9]=Te>>>8&255,k[10]=Te>>>16&255,k[11]=Te>>>24&255,k[12]=$t>>>0&255,k[13]=$t>>>8&255,k[14]=$t>>>16&255,k[15]=$t>>>24&255,k[16]=me>>>0&255,k[17]=me>>>8&255,k[18]=me>>>16&255,k[19]=me>>>24&255,k[20]=ve>>>0&255,k[21]=ve>>>8&255,k[22]=ve>>>16&255,k[23]=ve>>>24&255,k[24]=De>>>0&255,k[25]=De>>>8&255,k[26]=De>>>16&255,k[27]=De>>>24&255,k[28]=Pe>>>0&255,k[29]=Pe>>>8&255,k[30]=Pe>>>16&255,k[31]=Pe>>>24&255}function A(k,D,$,O){x(k,D,$,O)}function E(k,D,$,O){S(k,D,$,O)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T(k,D,$,O,N,ee,ne){var he=new Uint8Array(16),Ce=new Uint8Array(64),Be,He;for(He=0;He<16;He++)he[He]=0;for(He=0;He<8;He++)he[He]=ee[He];for(;N>=64;){for(A(Ce,he,ne,C),He=0;He<64;He++)k[D+He]=$[O+He]^Ce[He];for(Be=1,He=8;He<16;He++)Be=Be+(he[He]&255)|0,he[He]=Be&255,Be>>>=8;N-=64,D+=64,O+=64}if(N>0)for(A(Ce,he,ne,C),He=0;He=64;){for(A(ne,ee,N,C),Ce=0;Ce<64;Ce++)k[D+Ce]=ne[Ce];for(he=1,Ce=8;Ce<16;Ce++)he=he+(ee[Ce]&255)|0,ee[Ce]=he&255,he>>>=8;$-=64,D+=64}if($>0)for(A(ne,ee,N,C),Ce=0;Ce<$;Ce++)k[D+Ce]=ne[Ce];return 0}function F(k,D,$,O,N){var ee=new Uint8Array(32);E(ee,O,N,C);for(var ne=new Uint8Array(8),he=0;he<8;he++)ne[he]=O[he+16];return M(k,D,$,ne,ee)}function U(k,D,$,O,N,ee,ne){var he=new Uint8Array(32);E(he,ee,ne,C);for(var Ce=new Uint8Array(8),Be=0;Be<8;Be++)Ce[Be]=ee[Be+16];return T(k,D,$,O,N,Ce,he)}var H=function(k){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var D,$,O,N,ee,ne,he,Ce;D=k[0]&255|(k[1]&255)<<8,this.r[0]=D&8191,$=k[2]&255|(k[3]&255)<<8,this.r[1]=(D>>>13|$<<3)&8191,O=k[4]&255|(k[5]&255)<<8,this.r[2]=($>>>10|O<<6)&7939,N=k[6]&255|(k[7]&255)<<8,this.r[3]=(O>>>7|N<<9)&8191,ee=k[8]&255|(k[9]&255)<<8,this.r[4]=(N>>>4|ee<<12)&255,this.r[5]=ee>>>1&8190,ne=k[10]&255|(k[11]&255)<<8,this.r[6]=(ee>>>14|ne<<2)&8191,he=k[12]&255|(k[13]&255)<<8,this.r[7]=(ne>>>11|he<<5)&8065,Ce=k[14]&255|(k[15]&255)<<8,this.r[8]=(he>>>8|Ce<<8)&8191,this.r[9]=Ce>>>5&127,this.pad[0]=k[16]&255|(k[17]&255)<<8,this.pad[1]=k[18]&255|(k[19]&255)<<8,this.pad[2]=k[20]&255|(k[21]&255)<<8,this.pad[3]=k[22]&255|(k[23]&255)<<8,this.pad[4]=k[24]&255|(k[25]&255)<<8,this.pad[5]=k[26]&255|(k[27]&255)<<8,this.pad[6]=k[28]&255|(k[29]&255)<<8,this.pad[7]=k[30]&255|(k[31]&255)<<8};H.prototype.blocks=function(k,D,$){for(var O=this.fin?0:2048,N,ee,ne,he,Ce,Be,He,ct,Ne,rt,bt,At,vt,ht,xt,wt,Je,st,Qe,Le=this.h[0],qe=this.h[1],Ge=this.h[2],me=this.h[3],ve=this.h[4],De=this.h[5],Pe=this.h[6],Te=this.h[7],ze=this.h[8],mt=this.h[9],Nt=this.r[0],Ft=this.r[1],$t=this.r[2],te=this.r[3],Gt=this.r[4],on=this.r[5],an=this.r[6],Lt=this.r[7],un=this.r[8],tn=this.r[9];$>=16;)N=k[D+0]&255|(k[D+1]&255)<<8,Le+=N&8191,ee=k[D+2]&255|(k[D+3]&255)<<8,qe+=(N>>>13|ee<<3)&8191,ne=k[D+4]&255|(k[D+5]&255)<<8,Ge+=(ee>>>10|ne<<6)&8191,he=k[D+6]&255|(k[D+7]&255)<<8,me+=(ne>>>7|he<<9)&8191,Ce=k[D+8]&255|(k[D+9]&255)<<8,ve+=(he>>>4|Ce<<12)&8191,De+=Ce>>>1&8191,Be=k[D+10]&255|(k[D+11]&255)<<8,Pe+=(Ce>>>14|Be<<2)&8191,He=k[D+12]&255|(k[D+13]&255)<<8,Te+=(Be>>>11|He<<5)&8191,ct=k[D+14]&255|(k[D+15]&255)<<8,ze+=(He>>>8|ct<<8)&8191,mt+=ct>>>5|O,Ne=0,rt=Ne,rt+=Le*Nt,rt+=qe*(5*tn),rt+=Ge*(5*un),rt+=me*(5*Lt),rt+=ve*(5*an),Ne=rt>>>13,rt&=8191,rt+=De*(5*on),rt+=Pe*(5*Gt),rt+=Te*(5*te),rt+=ze*(5*$t),rt+=mt*(5*Ft),Ne+=rt>>>13,rt&=8191,bt=Ne,bt+=Le*Ft,bt+=qe*Nt,bt+=Ge*(5*tn),bt+=me*(5*un),bt+=ve*(5*Lt),Ne=bt>>>13,bt&=8191,bt+=De*(5*an),bt+=Pe*(5*on),bt+=Te*(5*Gt),bt+=ze*(5*te),bt+=mt*(5*$t),Ne+=bt>>>13,bt&=8191,At=Ne,At+=Le*$t,At+=qe*Ft,At+=Ge*Nt,At+=me*(5*tn),At+=ve*(5*un),Ne=At>>>13,At&=8191,At+=De*(5*Lt),At+=Pe*(5*an),At+=Te*(5*on),At+=ze*(5*Gt),At+=mt*(5*te),Ne+=At>>>13,At&=8191,vt=Ne,vt+=Le*te,vt+=qe*$t,vt+=Ge*Ft,vt+=me*Nt,vt+=ve*(5*tn),Ne=vt>>>13,vt&=8191,vt+=De*(5*un),vt+=Pe*(5*Lt),vt+=Te*(5*an),vt+=ze*(5*on),vt+=mt*(5*Gt),Ne+=vt>>>13,vt&=8191,ht=Ne,ht+=Le*Gt,ht+=qe*te,ht+=Ge*$t,ht+=me*Ft,ht+=ve*Nt,Ne=ht>>>13,ht&=8191,ht+=De*(5*tn),ht+=Pe*(5*un),ht+=Te*(5*Lt),ht+=ze*(5*an),ht+=mt*(5*on),Ne+=ht>>>13,ht&=8191,xt=Ne,xt+=Le*on,xt+=qe*Gt,xt+=Ge*te,xt+=me*$t,xt+=ve*Ft,Ne=xt>>>13,xt&=8191,xt+=De*Nt,xt+=Pe*(5*tn),xt+=Te*(5*un),xt+=ze*(5*Lt),xt+=mt*(5*an),Ne+=xt>>>13,xt&=8191,wt=Ne,wt+=Le*an,wt+=qe*on,wt+=Ge*Gt,wt+=me*te,wt+=ve*$t,Ne=wt>>>13,wt&=8191,wt+=De*Ft,wt+=Pe*Nt,wt+=Te*(5*tn),wt+=ze*(5*un),wt+=mt*(5*Lt),Ne+=wt>>>13,wt&=8191,Je=Ne,Je+=Le*Lt,Je+=qe*an,Je+=Ge*on,Je+=me*Gt,Je+=ve*te,Ne=Je>>>13,Je&=8191,Je+=De*$t,Je+=Pe*Ft,Je+=Te*Nt,Je+=ze*(5*tn),Je+=mt*(5*un),Ne+=Je>>>13,Je&=8191,st=Ne,st+=Le*un,st+=qe*Lt,st+=Ge*an,st+=me*on,st+=ve*Gt,Ne=st>>>13,st&=8191,st+=De*te,st+=Pe*$t,st+=Te*Ft,st+=ze*Nt,st+=mt*(5*tn),Ne+=st>>>13,st&=8191,Qe=Ne,Qe+=Le*tn,Qe+=qe*un,Qe+=Ge*Lt,Qe+=me*an,Qe+=ve*on,Ne=Qe>>>13,Qe&=8191,Qe+=De*Gt,Qe+=Pe*te,Qe+=Te*$t,Qe+=ze*Ft,Qe+=mt*Nt,Ne+=Qe>>>13,Qe&=8191,Ne=(Ne<<2)+Ne|0,Ne=Ne+rt|0,rt=Ne&8191,Ne=Ne>>>13,bt+=Ne,Le=rt,qe=bt,Ge=At,me=vt,ve=ht,De=xt,Pe=wt,Te=Je,ze=st,mt=Qe,D+=16,$-=16;this.h[0]=Le,this.h[1]=qe,this.h[2]=Ge,this.h[3]=me,this.h[4]=ve,this.h[5]=De,this.h[6]=Pe,this.h[7]=Te,this.h[8]=ze,this.h[9]=mt},H.prototype.finish=function(k,D){var $=new Uint16Array(10),O,N,ee,ne;if(this.leftover){for(ne=this.leftover,this.buffer[ne++]=1;ne<16;ne++)this.buffer[ne]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(O=this.h[1]>>>13,this.h[1]&=8191,ne=2;ne<10;ne++)this.h[ne]+=O,O=this.h[ne]>>>13,this.h[ne]&=8191;for(this.h[0]+=O*5,O=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=O,O=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=O,$[0]=this.h[0]+5,O=$[0]>>>13,$[0]&=8191,ne=1;ne<10;ne++)$[ne]=this.h[ne]+O,O=$[ne]>>>13,$[ne]&=8191;for($[9]-=8192,N=(O^1)-1,ne=0;ne<10;ne++)$[ne]&=N;for(N=~N,ne=0;ne<10;ne++)this.h[ne]=this.h[ne]&N|$[ne];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,ee=this.h[0]+this.pad[0],this.h[0]=ee&65535,ne=1;ne<8;ne++)ee=(this.h[ne]+this.pad[ne]|0)+(ee>>>16)|0,this.h[ne]=ee&65535;k[D+0]=this.h[0]>>>0&255,k[D+1]=this.h[0]>>>8&255,k[D+2]=this.h[1]>>>0&255,k[D+3]=this.h[1]>>>8&255,k[D+4]=this.h[2]>>>0&255,k[D+5]=this.h[2]>>>8&255,k[D+6]=this.h[3]>>>0&255,k[D+7]=this.h[3]>>>8&255,k[D+8]=this.h[4]>>>0&255,k[D+9]=this.h[4]>>>8&255,k[D+10]=this.h[5]>>>0&255,k[D+11]=this.h[5]>>>8&255,k[D+12]=this.h[6]>>>0&255,k[D+13]=this.h[6]>>>8&255,k[D+14]=this.h[7]>>>0&255,k[D+15]=this.h[7]>>>8&255},H.prototype.update=function(k,D,$){var O,N;if(this.leftover){for(N=16-this.leftover,N>$&&(N=$),O=0;O=16&&(N=$-$%16,this.blocks(k,D,N),D+=N,$-=N),$){for(O=0;O<$;O++)this.buffer[this.leftover+O]=k[D+O];this.leftover+=$}};function W(k,D,$,O,N,ee){var ne=new H(ee);return ne.update($,O,N),ne.finish(k,D),0}function ie(k,D,$,O,N,ee){var ne=new Uint8Array(16);return W(ne,0,$,O,N,ee),b(k,D,ne,0)}function Z(k,D,$,O,N){var ee;if($<32)return-1;for(U(k,0,D,0,$,O,N),W(k,16,k,32,$-32,k),ee=0;ee<16;ee++)k[ee]=0;return 0}function G(k,D,$,O,N){var ee,ne=new Uint8Array(32);if($<32||(F(ne,0,32,O,N),ie(D,16,D,32,$-32,ne)!==0))return-1;for(U(k,0,D,0,$,O,N),ee=0;ee<32;ee++)k[ee]=0;return 0}function K(k,D){var $;for($=0;$<16;$++)k[$]=D[$]|0}function V(k){var D,$,O=1;for(D=0;D<16;D++)$=k[D]+O+65535,O=Math.floor($/65536),k[D]=$-O*65536;k[0]+=O-1+37*(O-1)}function B(k,D,$){for(var O,N=~($-1),ee=0;ee<16;ee++)O=N&(k[ee]^D[ee]),k[ee]^=O,D[ee]^=O}function q(k,D){var $,O,N,ee=n(),ne=n();for($=0;$<16;$++)ne[$]=D[$];for(V(ne),V(ne),V(ne),O=0;O<2;O++){for(ee[0]=ne[0]-65517,$=1;$<15;$++)ee[$]=ne[$]-65535-(ee[$-1]>>16&1),ee[$-1]&=65535;ee[15]=ne[15]-32767-(ee[14]>>16&1),N=ee[15]>>16&1,ee[14]&=65535,B(ne,ee,1-N)}for($=0;$<16;$++)k[2*$]=ne[$]&255,k[2*$+1]=ne[$]>>8}function Y(k,D){var $=new Uint8Array(32),O=new Uint8Array(32);return q($,k),q(O,D),w($,0,O,0)}function ue(k){var D=new Uint8Array(32);return q(D,k),D[0]&1}function Q(k,D){var $;for($=0;$<16;$++)k[$]=D[2*$]+(D[2*$+1]<<8);k[15]&=32767}function J(k,D,$){for(var O=0;O<16;O++)k[O]=D[O]+$[O]}function se(k,D,$){for(var O=0;O<16;O++)k[O]=D[O]-$[O]}function de(k,D,$){var O,N,ee=0,ne=0,he=0,Ce=0,Be=0,He=0,ct=0,Ne=0,rt=0,bt=0,At=0,vt=0,ht=0,xt=0,wt=0,Je=0,st=0,Qe=0,Le=0,qe=0,Ge=0,me=0,ve=0,De=0,Pe=0,Te=0,ze=0,mt=0,Nt=0,Ft=0,$t=0,te=$[0],Gt=$[1],on=$[2],an=$[3],Lt=$[4],un=$[5],tn=$[6],Kn=$[7],vn=$[8],Pn=$[9],Gn=$[10],Yn=$[11],xr=$[12],$r=$[13],Ir=$[14],Nr=$[15];O=D[0],ee+=O*te,ne+=O*Gt,he+=O*on,Ce+=O*an,Be+=O*Lt,He+=O*un,ct+=O*tn,Ne+=O*Kn,rt+=O*vn,bt+=O*Pn,At+=O*Gn,vt+=O*Yn,ht+=O*xr,xt+=O*$r,wt+=O*Ir,Je+=O*Nr,O=D[1],ne+=O*te,he+=O*Gt,Ce+=O*on,Be+=O*an,He+=O*Lt,ct+=O*un,Ne+=O*tn,rt+=O*Kn,bt+=O*vn,At+=O*Pn,vt+=O*Gn,ht+=O*Yn,xt+=O*xr,wt+=O*$r,Je+=O*Ir,st+=O*Nr,O=D[2],he+=O*te,Ce+=O*Gt,Be+=O*on,He+=O*an,ct+=O*Lt,Ne+=O*un,rt+=O*tn,bt+=O*Kn,At+=O*vn,vt+=O*Pn,ht+=O*Gn,xt+=O*Yn,wt+=O*xr,Je+=O*$r,st+=O*Ir,Qe+=O*Nr,O=D[3],Ce+=O*te,Be+=O*Gt,He+=O*on,ct+=O*an,Ne+=O*Lt,rt+=O*un,bt+=O*tn,At+=O*Kn,vt+=O*vn,ht+=O*Pn,xt+=O*Gn,wt+=O*Yn,Je+=O*xr,st+=O*$r,Qe+=O*Ir,Le+=O*Nr,O=D[4],Be+=O*te,He+=O*Gt,ct+=O*on,Ne+=O*an,rt+=O*Lt,bt+=O*un,At+=O*tn,vt+=O*Kn,ht+=O*vn,xt+=O*Pn,wt+=O*Gn,Je+=O*Yn,st+=O*xr,Qe+=O*$r,Le+=O*Ir,qe+=O*Nr,O=D[5],He+=O*te,ct+=O*Gt,Ne+=O*on,rt+=O*an,bt+=O*Lt,At+=O*un,vt+=O*tn,ht+=O*Kn,xt+=O*vn,wt+=O*Pn,Je+=O*Gn,st+=O*Yn,Qe+=O*xr,Le+=O*$r,qe+=O*Ir,Ge+=O*Nr,O=D[6],ct+=O*te,Ne+=O*Gt,rt+=O*on,bt+=O*an,At+=O*Lt,vt+=O*un,ht+=O*tn,xt+=O*Kn,wt+=O*vn,Je+=O*Pn,st+=O*Gn,Qe+=O*Yn,Le+=O*xr,qe+=O*$r,Ge+=O*Ir,me+=O*Nr,O=D[7],Ne+=O*te,rt+=O*Gt,bt+=O*on,At+=O*an,vt+=O*Lt,ht+=O*un,xt+=O*tn,wt+=O*Kn,Je+=O*vn,st+=O*Pn,Qe+=O*Gn,Le+=O*Yn,qe+=O*xr,Ge+=O*$r,me+=O*Ir,ve+=O*Nr,O=D[8],rt+=O*te,bt+=O*Gt,At+=O*on,vt+=O*an,ht+=O*Lt,xt+=O*un,wt+=O*tn,Je+=O*Kn,st+=O*vn,Qe+=O*Pn,Le+=O*Gn,qe+=O*Yn,Ge+=O*xr,me+=O*$r,ve+=O*Ir,De+=O*Nr,O=D[9],bt+=O*te,At+=O*Gt,vt+=O*on,ht+=O*an,xt+=O*Lt,wt+=O*un,Je+=O*tn,st+=O*Kn,Qe+=O*vn,Le+=O*Pn,qe+=O*Gn,Ge+=O*Yn,me+=O*xr,ve+=O*$r,De+=O*Ir,Pe+=O*Nr,O=D[10],At+=O*te,vt+=O*Gt,ht+=O*on,xt+=O*an,wt+=O*Lt,Je+=O*un,st+=O*tn,Qe+=O*Kn,Le+=O*vn,qe+=O*Pn,Ge+=O*Gn,me+=O*Yn,ve+=O*xr,De+=O*$r,Pe+=O*Ir,Te+=O*Nr,O=D[11],vt+=O*te,ht+=O*Gt,xt+=O*on,wt+=O*an,Je+=O*Lt,st+=O*un,Qe+=O*tn,Le+=O*Kn,qe+=O*vn,Ge+=O*Pn,me+=O*Gn,ve+=O*Yn,De+=O*xr,Pe+=O*$r,Te+=O*Ir,ze+=O*Nr,O=D[12],ht+=O*te,xt+=O*Gt,wt+=O*on,Je+=O*an,st+=O*Lt,Qe+=O*un,Le+=O*tn,qe+=O*Kn,Ge+=O*vn,me+=O*Pn,ve+=O*Gn,De+=O*Yn,Pe+=O*xr,Te+=O*$r,ze+=O*Ir,mt+=O*Nr,O=D[13],xt+=O*te,wt+=O*Gt,Je+=O*on,st+=O*an,Qe+=O*Lt,Le+=O*un,qe+=O*tn,Ge+=O*Kn,me+=O*vn,ve+=O*Pn,De+=O*Gn,Pe+=O*Yn,Te+=O*xr,ze+=O*$r,mt+=O*Ir,Nt+=O*Nr,O=D[14],wt+=O*te,Je+=O*Gt,st+=O*on,Qe+=O*an,Le+=O*Lt,qe+=O*un,Ge+=O*tn,me+=O*Kn,ve+=O*vn,De+=O*Pn,Pe+=O*Gn,Te+=O*Yn,ze+=O*xr,mt+=O*$r,Nt+=O*Ir,Ft+=O*Nr,O=D[15],Je+=O*te,st+=O*Gt,Qe+=O*on,Le+=O*an,qe+=O*Lt,Ge+=O*un,me+=O*tn,ve+=O*Kn,De+=O*vn,Pe+=O*Pn,Te+=O*Gn,ze+=O*Yn,mt+=O*xr,Nt+=O*$r,Ft+=O*Ir,$t+=O*Nr,ee+=38*st,ne+=38*Qe,he+=38*Le,Ce+=38*qe,Be+=38*Ge,He+=38*me,ct+=38*ve,Ne+=38*De,rt+=38*Pe,bt+=38*Te,At+=38*ze,vt+=38*mt,ht+=38*Nt,xt+=38*Ft,wt+=38*$t,N=1,O=ee+N+65535,N=Math.floor(O/65536),ee=O-N*65536,O=ne+N+65535,N=Math.floor(O/65536),ne=O-N*65536,O=he+N+65535,N=Math.floor(O/65536),he=O-N*65536,O=Ce+N+65535,N=Math.floor(O/65536),Ce=O-N*65536,O=Be+N+65535,N=Math.floor(O/65536),Be=O-N*65536,O=He+N+65535,N=Math.floor(O/65536),He=O-N*65536,O=ct+N+65535,N=Math.floor(O/65536),ct=O-N*65536,O=Ne+N+65535,N=Math.floor(O/65536),Ne=O-N*65536,O=rt+N+65535,N=Math.floor(O/65536),rt=O-N*65536,O=bt+N+65535,N=Math.floor(O/65536),bt=O-N*65536,O=At+N+65535,N=Math.floor(O/65536),At=O-N*65536,O=vt+N+65535,N=Math.floor(O/65536),vt=O-N*65536,O=ht+N+65535,N=Math.floor(O/65536),ht=O-N*65536,O=xt+N+65535,N=Math.floor(O/65536),xt=O-N*65536,O=wt+N+65535,N=Math.floor(O/65536),wt=O-N*65536,O=Je+N+65535,N=Math.floor(O/65536),Je=O-N*65536,ee+=N-1+37*(N-1),N=1,O=ee+N+65535,N=Math.floor(O/65536),ee=O-N*65536,O=ne+N+65535,N=Math.floor(O/65536),ne=O-N*65536,O=he+N+65535,N=Math.floor(O/65536),he=O-N*65536,O=Ce+N+65535,N=Math.floor(O/65536),Ce=O-N*65536,O=Be+N+65535,N=Math.floor(O/65536),Be=O-N*65536,O=He+N+65535,N=Math.floor(O/65536),He=O-N*65536,O=ct+N+65535,N=Math.floor(O/65536),ct=O-N*65536,O=Ne+N+65535,N=Math.floor(O/65536),Ne=O-N*65536,O=rt+N+65535,N=Math.floor(O/65536),rt=O-N*65536,O=bt+N+65535,N=Math.floor(O/65536),bt=O-N*65536,O=At+N+65535,N=Math.floor(O/65536),At=O-N*65536,O=vt+N+65535,N=Math.floor(O/65536),vt=O-N*65536,O=ht+N+65535,N=Math.floor(O/65536),ht=O-N*65536,O=xt+N+65535,N=Math.floor(O/65536),xt=O-N*65536,O=wt+N+65535,N=Math.floor(O/65536),wt=O-N*65536,O=Je+N+65535,N=Math.floor(O/65536),Je=O-N*65536,ee+=N-1+37*(N-1),k[0]=ee,k[1]=ne,k[2]=he,k[3]=Ce,k[4]=Be,k[5]=He,k[6]=ct,k[7]=Ne,k[8]=rt,k[9]=bt,k[10]=At,k[11]=vt,k[12]=ht,k[13]=xt,k[14]=wt,k[15]=Je}function Se(k,D){de(k,D,D)}function ge(k,D){var $=n(),O;for(O=0;O<16;O++)$[O]=D[O];for(O=253;O>=0;O--)Se($,$),O!==2&&O!==4&&de($,$,D);for(O=0;O<16;O++)k[O]=$[O]}function Ze(k,D){var $=n(),O;for(O=0;O<16;O++)$[O]=D[O];for(O=250;O>=0;O--)Se($,$),O!==1&&de($,$,D);for(O=0;O<16;O++)k[O]=$[O]}function Oe(k,D,$){var O=new Uint8Array(32),N=new Float64Array(80),ee,ne,he=n(),Ce=n(),Be=n(),He=n(),ct=n(),Ne=n();for(ne=0;ne<31;ne++)O[ne]=D[ne];for(O[31]=D[31]&127|64,O[0]&=248,Q(N,$),ne=0;ne<16;ne++)Ce[ne]=N[ne],He[ne]=he[ne]=Be[ne]=0;for(he[0]=He[0]=1,ne=254;ne>=0;--ne)ee=O[ne>>>3]>>>(ne&7)&1,B(he,Ce,ee),B(Be,He,ee),J(ct,he,Be),se(he,he,Be),J(Be,Ce,He),se(Ce,Ce,He),Se(He,ct),Se(Ne,he),de(he,Be,he),de(Be,Ce,ct),J(ct,he,Be),se(he,he,Be),Se(Ce,he),se(Be,He,Ne),de(he,Be,s),J(he,he,He),de(Be,Be,he),de(he,He,Ne),de(He,Ce,N),Se(Ce,ct),B(he,Ce,ee),B(Be,He,ee);for(ne=0;ne<16;ne++)N[ne+16]=he[ne],N[ne+32]=Be[ne],N[ne+48]=Ce[ne],N[ne+64]=He[ne];var rt=N.subarray(32),bt=N.subarray(16);return ge(rt,rt),de(bt,bt,rt),q(k,bt),0}function Fe(k,D){return Oe(k,D,o)}function $e(k,D){return r(D,32),Fe(k,D)}function be(k,D,$){var O=new Uint8Array(32);return Oe(O,$,D),E(k,i,O,C)}var yt=Z,lt=G;function It(k,D,$,O,N,ee){var ne=new Uint8Array(32);return be(ne,N,ee),yt(k,D,$,O,ne)}function mn(k,D,$,O,N,ee){var ne=new Uint8Array(32);return be(ne,N,ee),lt(k,D,$,O,ne)}var en=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function re(k,D,$,O){for(var N=new Int32Array(16),ee=new Int32Array(16),ne,he,Ce,Be,He,ct,Ne,rt,bt,At,vt,ht,xt,wt,Je,st,Qe,Le,qe,Ge,me,ve,De,Pe,Te,ze,mt=k[0],Nt=k[1],Ft=k[2],$t=k[3],te=k[4],Gt=k[5],on=k[6],an=k[7],Lt=D[0],un=D[1],tn=D[2],Kn=D[3],vn=D[4],Pn=D[5],Gn=D[6],Yn=D[7],xr=0;O>=128;){for(qe=0;qe<16;qe++)Ge=8*qe+xr,N[qe]=$[Ge+0]<<24|$[Ge+1]<<16|$[Ge+2]<<8|$[Ge+3],ee[qe]=$[Ge+4]<<24|$[Ge+5]<<16|$[Ge+6]<<8|$[Ge+7];for(qe=0;qe<80;qe++)if(ne=mt,he=Nt,Ce=Ft,Be=$t,He=te,ct=Gt,Ne=on,rt=an,bt=Lt,At=un,vt=tn,ht=Kn,xt=vn,wt=Pn,Je=Gn,st=Yn,me=an,ve=Yn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=(te>>>14|vn<<18)^(te>>>18|vn<<14)^(vn>>>9|te<<23),ve=(vn>>>14|te<<18)^(vn>>>18|te<<14)^(te>>>9|vn<<23),De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=te&Gt^~te&on,ve=vn&Pn^~vn&Gn,De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=en[qe*2],ve=en[qe*2+1],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=N[qe%16],ve=ee[qe%16],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,Qe=Te&65535|ze<<16,Le=De&65535|Pe<<16,me=Qe,ve=Le,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=(mt>>>28|Lt<<4)^(Lt>>>2|mt<<30)^(Lt>>>7|mt<<25),ve=(Lt>>>28|mt<<4)^(mt>>>2|Lt<<30)^(mt>>>7|Lt<<25),De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=mt&Nt^mt&Ft^Nt&Ft,ve=Lt&un^Lt&tn^un&tn,De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,rt=Te&65535|ze<<16,st=De&65535|Pe<<16,me=Be,ve=ht,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=Qe,ve=Le,De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,Be=Te&65535|ze<<16,ht=De&65535|Pe<<16,Nt=ne,Ft=he,$t=Ce,te=Be,Gt=He,on=ct,an=Ne,mt=rt,un=bt,tn=At,Kn=vt,vn=ht,Pn=xt,Gn=wt,Yn=Je,Lt=st,qe%16===15)for(Ge=0;Ge<16;Ge++)me=N[Ge],ve=ee[Ge],De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=N[(Ge+9)%16],ve=ee[(Ge+9)%16],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Qe=N[(Ge+1)%16],Le=ee[(Ge+1)%16],me=(Qe>>>1|Le<<31)^(Qe>>>8|Le<<24)^Qe>>>7,ve=(Le>>>1|Qe<<31)^(Le>>>8|Qe<<24)^(Le>>>7|Qe<<25),De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Qe=N[(Ge+14)%16],Le=ee[(Ge+14)%16],me=(Qe>>>19|Le<<13)^(Le>>>29|Qe<<3)^Qe>>>6,ve=(Le>>>19|Qe<<13)^(Qe>>>29|Le<<3)^(Le>>>6|Qe<<26),De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,N[Ge]=Te&65535|ze<<16,ee[Ge]=De&65535|Pe<<16;me=mt,ve=Lt,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[0],ve=D[0],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[0]=mt=Te&65535|ze<<16,D[0]=Lt=De&65535|Pe<<16,me=Nt,ve=un,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[1],ve=D[1],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[1]=Nt=Te&65535|ze<<16,D[1]=un=De&65535|Pe<<16,me=Ft,ve=tn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[2],ve=D[2],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[2]=Ft=Te&65535|ze<<16,D[2]=tn=De&65535|Pe<<16,me=$t,ve=Kn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[3],ve=D[3],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[3]=$t=Te&65535|ze<<16,D[3]=Kn=De&65535|Pe<<16,me=te,ve=vn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[4],ve=D[4],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[4]=te=Te&65535|ze<<16,D[4]=vn=De&65535|Pe<<16,me=Gt,ve=Pn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[5],ve=D[5],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[5]=Gt=Te&65535|ze<<16,D[5]=Pn=De&65535|Pe<<16,me=on,ve=Gn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[6],ve=D[6],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[6]=on=Te&65535|ze<<16,D[6]=Gn=De&65535|Pe<<16,me=an,ve=Yn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[7],ve=D[7],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[7]=an=Te&65535|ze<<16,D[7]=Yn=De&65535|Pe<<16,xr+=128,O-=128}return O}function pe(k,D,$){var O=new Int32Array(8),N=new Int32Array(8),ee=new Uint8Array(256),ne,he=$;for(O[0]=1779033703,O[1]=3144134277,O[2]=1013904242,O[3]=2773480762,O[4]=1359893119,O[5]=2600822924,O[6]=528734635,O[7]=1541459225,N[0]=4089235720,N[1]=2227873595,N[2]=4271175723,N[3]=1595750129,N[4]=2917565137,N[5]=725511199,N[6]=4215389547,N[7]=327033209,re(O,N,D,$),$%=128,ne=0;ne<$;ne++)ee[ne]=D[he-$+ne];for(ee[$]=128,$=256-128*($<112?1:0),ee[$-9]=0,g(ee,$-8,he/536870912|0,he<<3),re(O,N,ee,$),ne=0;ne<8;ne++)g(k,8*ne,O[ne],N[ne]);return 0}function ye(k,D){var $=n(),O=n(),N=n(),ee=n(),ne=n(),he=n(),Ce=n(),Be=n(),He=n();se($,k[1],k[0]),se(He,D[1],D[0]),de($,$,He),J(O,k[0],k[1]),J(He,D[0],D[1]),de(O,O,He),de(N,k[3],D[3]),de(N,N,c),de(ee,k[2],D[2]),J(ee,ee,ee),se(ne,O,$),se(he,ee,N),J(Ce,ee,N),J(Be,O,$),de(k[0],ne,he),de(k[1],Be,Ce),de(k[2],Ce,he),de(k[3],ne,Be)}function Ue(k,D,$){var O;for(O=0;O<4;O++)B(k[O],D[O],$)}function je(k,D){var $=n(),O=n(),N=n();ge(N,D[2]),de($,D[0],N),de(O,D[1],N),q(k,O),k[31]^=ue($)<<7}function ke(k,D,$){var O,N;for(K(k[0],a),K(k[1],u),K(k[2],u),K(k[3],a),N=255;N>=0;--N)O=$[N/8|0]>>(N&7)&1,Ue(k,D,O),ye(D,k),ye(k,k),Ue(k,D,O)}function nt(k,D){var $=[n(),n(),n(),n()];K($[0],d),K($[1],h),K($[2],u),de($[3],d,h),ke(k,$,D)}function gt(k,D,$){var O=new Uint8Array(64),N=[n(),n(),n(),n()],ee;for($||r(D,32),pe(O,D,32),O[0]&=248,O[31]&=127,O[31]|=64,nt(N,O),je(k,N),ee=0;ee<32;ee++)D[ee+32]=k[ee];return 0}var bn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Vt(k,D){var $,O,N,ee;for(O=63;O>=32;--O){for($=0,N=O-32,ee=O-12;N>4)*bn[N],$=D[N]>>8,D[N]&=255;for(N=0;N<32;N++)D[N]-=$*bn[N];for(O=0;O<32;O++)D[O+1]+=D[O]>>8,k[O]=D[O]&255}function xn(k){var D=new Float64Array(64),$;for($=0;$<64;$++)D[$]=k[$];for($=0;$<64;$++)k[$]=0;Vt(k,D)}function Ii(k,D,$,O){var N=new Uint8Array(64),ee=new Uint8Array(64),ne=new Uint8Array(64),he,Ce,Be=new Float64Array(64),He=[n(),n(),n(),n()];pe(N,O,32),N[0]&=248,N[31]&=127,N[31]|=64;var ct=$+64;for(he=0;he<$;he++)k[64+he]=D[he];for(he=0;he<32;he++)k[32+he]=N[32+he];for(pe(ne,k.subarray(32),$+32),xn(ne),nt(He,ne),je(k,He),he=32;he<64;he++)k[he]=O[he];for(pe(ee,k,$+64),xn(ee),he=0;he<64;he++)Be[he]=0;for(he=0;he<32;he++)Be[he]=ne[he];for(he=0;he<32;he++)for(Ce=0;Ce<32;Ce++)Be[he+Ce]+=ee[he]*N[Ce];return Vt(k.subarray(32),Be),ct}function br(k,D){var $=n(),O=n(),N=n(),ee=n(),ne=n(),he=n(),Ce=n();return K(k[2],u),Q(k[1],D),Se(N,k[1]),de(ee,N,l),se(N,N,k[2]),J(ee,k[2],ee),Se(ne,ee),Se(he,ne),de(Ce,he,ne),de($,Ce,N),de($,$,ee),Ze($,$),de($,$,N),de($,$,ee),de($,$,ee),de(k[0],$,ee),Se(O,k[0]),de(O,O,ee),Y(O,N)&&de(k[0],k[0],v),Se(O,k[0]),de(O,O,ee),Y(O,N)?-1:(ue(k[0])===D[31]>>7&&se(k[0],a,k[0]),de(k[3],k[0],k[1]),0)}function yi(k,D,$,O){var N,ee=new Uint8Array(32),ne=new Uint8Array(64),he=[n(),n(),n(),n()],Ce=[n(),n(),n(),n()];if($<64||br(Ce,O))return-1;for(N=0;N<$;N++)k[N]=D[N];for(N=0;N<32;N++)k[N+32]=O[N];if(pe(ne,k,$),xn(ne),ke(he,Ce,ne),nt(Ce,D.subarray(32)),ye(he,Ce),je(ee,he),$-=64,w(D,0,ee,0)){for(N=0;N<$;N++)k[N]=0;return-1}for(N=0;N<$;N++)k[N]=D[N+64];return $}var ar=32,ui=24,bi=32,Rr=16,Yi=32,go=32,xi=32,Dr=32,wa=32,_t=ui,dn=bi,wn=Rr,qn=64,ur=32,Zr=64,mo=32,ql=64;t.lowlevel={crypto_core_hsalsa20:E,crypto_stream_xor:U,crypto_stream:F,crypto_stream_salsa20_xor:T,crypto_stream_salsa20:M,crypto_onetimeauth:W,crypto_onetimeauth_verify:ie,crypto_verify_16:b,crypto_verify_32:w,crypto_secretbox:Z,crypto_secretbox_open:G,crypto_scalarmult:Oe,crypto_scalarmult_base:Fe,crypto_box_beforenm:be,crypto_box_afternm:yt,crypto_box:It,crypto_box_open:mn,crypto_box_keypair:$e,crypto_hash:pe,crypto_sign:Ii,crypto_sign_keypair:gt,crypto_sign_open:yi,crypto_secretbox_KEYBYTES:ar,crypto_secretbox_NONCEBYTES:ui,crypto_secretbox_ZEROBYTES:bi,crypto_secretbox_BOXZEROBYTES:Rr,crypto_scalarmult_BYTES:Yi,crypto_scalarmult_SCALARBYTES:go,crypto_box_PUBLICKEYBYTES:xi,crypto_box_SECRETKEYBYTES:Dr,crypto_box_BEFORENMBYTES:wa,crypto_box_NONCEBYTES:_t,crypto_box_ZEROBYTES:dn,crypto_box_BOXZEROBYTES:wn,crypto_sign_BYTES:qn,crypto_sign_PUBLICKEYBYTES:ur,crypto_sign_SECRETKEYBYTES:Zr,crypto_sign_SEEDBYTES:mo,crypto_hash_BYTES:ql,gf:n,D:l,L:bn,pack25519:q,unpack25519:Q,M:de,A:J,S:Se,Z:se,pow2523:Ze,add:ye,set25519:K,modL:Vt,scalarmult:ke,scalarbase:nt};function yf(k,D){if(k.length!==ar)throw new Error("bad key size");if(D.length!==ui)throw new Error("bad nonce size")}function oe(k,D){if(k.length!==xi)throw new Error("bad public key size");if(D.length!==Dr)throw new Error("bad secret key size")}function le(){for(var k=0;k=0},t.sign.keyPair=function(){var k=new Uint8Array(ur),D=new Uint8Array(Zr);return gt(k,D),{publicKey:k,secretKey:D}},t.sign.keyPair.fromSecretKey=function(k){if(le(k),k.length!==Zr)throw new Error("bad secret key size");for(var D=new Uint8Array(ur),$=0;$"u"?typeof Buffer.from<"u"?(t.encodeBase64=function(r){return Buffer.from(r).toString("base64")},t.decodeBase64=function(r){return n(r),new Uint8Array(Array.prototype.slice.call(Buffer.from(r,"base64"),0))}):(t.encodeBase64=function(r){return new Buffer(r).toString("base64")},t.decodeBase64=function(r){return n(r),new Uint8Array(Array.prototype.slice.call(new Buffer(r,"base64"),0))}):(t.encodeBase64=function(r){var i,o=[],a=r.length;for(i=0;i{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:a,disabled:u,value:s="on",onCheckedChange:l,form:c,...d}=e,[h,v]=y.useState(null),g=Kt(t,A=>v(A)),m=y.useRef(!1),b=h?c||!!h.closest("form"):!0,[w=!1,x]=Ga({prop:i,defaultProp:o,onChange:l}),S=y.useRef(w);return y.useEffect(()=>{const A=h?.form;if(A){const E=()=>x(S.current);return A.addEventListener("reset",E),()=>A.removeEventListener("reset",E)}},[h,x]),I.jsxs(Lqe,{scope:n,state:w,disabled:u,children:[I.jsx(pt.button,{type:"button",role:"checkbox","aria-checked":bl(w)?"mixed":w,"aria-required":a,"data-state":pY(w),"data-disabled":u?"":void 0,disabled:u,value:s,...d,ref:g,onKeyDown:Ye(e.onKeyDown,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:Ye(e.onClick,A=>{x(E=>bl(E)?!0:!E),b&&(m.current=A.isPropagationStopped(),m.current||A.stopPropagation())})}),b&&I.jsx(Bqe,{control:h,bubbles:!m.current,name:r,value:s,checked:w,required:a,disabled:u,form:c,style:{transform:"translateX(-100%)"},defaultChecked:bl(o)?!1:o})]})});fY.displayName=iP;var dY="CheckboxIndicator",hY=y.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=jqe(dY,n);return I.jsx(oi,{present:r||bl(o.state)||o.state===!0,children:I.jsx(pt.span,{"data-state":pY(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});hY.displayName=dY;var Bqe=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,a=y.useRef(null),u=hO(n),s=jA(t);y.useEffect(()=>{const c=a.current,d=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(d,"checked").set;if(u!==n&&v){const g=new Event("click",{bubbles:r});c.indeterminate=bl(n),v.call(c,bl(n)?!1:n),c.dispatchEvent(g)}},[u,n,r]);const l=y.useRef(bl(n)?!1:n);return I.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??l.current,...o,tabIndex:-1,ref:a,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function bl(e){return e==="indeterminate"}function pY(e){return bl(e)?"indeterminate":e?"checked":"unchecked"}var $Ze=fY,IZe=hY;export{_Ge as $,spe as A,DKe as B,BKe as C,fpe as D,dpe as E,jKe as F,bB as G,eGe as H,hKe as I,ppe as J,lpe as K,cpe as L,oKe as M,hGe as N,Uqe as O,Kqe as P,$Ke as Q,j as R,Sl as S,hpe as T,Npe as U,Fpe as V,OGe as W,XKe as X,PGe as Y,yGe as Z,bGe as _,Zqe as a,zYe as a$,SGe as a0,EGe as a1,KKe as a2,CGe as a3,nGe as a4,wGe as a5,AGe as a6,gGe as a7,mGe as a8,xGe as a9,NGe as aA,aGe as aB,fYe as aC,mKe as aD,SKe as aE,xYe as aF,wYe as aG,_Ye as aH,Yqe as aI,OYe as aJ,PYe as aK,kYe as aL,AYe as aM,MYe as aN,DYe as aO,RYe as aP,$Ye as aQ,YKe as aR,WYe as aS,QKe as aT,VYe as aU,IYe as aV,NYe as aW,FYe as aX,jYe as aY,BYe as aZ,UYe as a_,MGe as aa,$Ge as ab,RGe as ac,DGe as ad,Hqe as ae,rKe as af,uKe as ag,_Ke as ah,Qqe as ai,sKe as aj,yKe as ak,aKe as al,dKe as am,wKe as an,xKe as ao,pKe as ap,bKe as aq,nKe as ar,eKe as as,lKe as at,OKe as au,AKe as av,CKe as aw,PKe as ax,gKe as ay,iKe as az,rg as b,AZe as b$,HYe as b0,LYe as b1,GYe as b2,ZKe as b3,QYe as b4,JYe as b5,ZYe as b6,XYe as b7,qS as b8,FKe as b9,UGe as bA,jGe as bB,qYe as bC,Ui as bD,aZe as bE,uZe as bF,aYe as bG,hYe as bH,cYe as bI,nYe as bJ,XGe as bK,ZGe as bL,sZe as bM,tKe as bN,EKe as bO,vKe as bP,Jqe as bQ,cZe as bR,fZe as bS,LKe as bT,rGe as bU,iGe as bV,yZe as bW,xZe as bX,QGe as bY,BGe as bZ,EZe as b_,mf as ba,HGe as bb,SYe as bc,CYe as bd,lO as be,cO as bf,rIe as bg,Yu as bh,vf as bi,Kh as bj,KYe as bk,uYe as bl,VGe as bm,LGe as bn,WGe as bo,zGe as bp,mYe as bq,vYe as br,nZe as bs,rZe as bt,iZe as bu,GBe as bv,eze as bw,eZe as bx,sYe as by,FGe as bz,cn as c,kZe as c0,TZe as c1,OZe as c2,PZe as c3,_Ze as c4,SZe as c5,CZe as c6,oGe as c7,sGe as c8,pYe as c9,fGe as cA,GKe as cB,tGe as cC,cGe as cD,iYe as cE,KGe as cF,WBe as cG,uGe as cH,qqe as cI,JGe as cJ,qGe as cK,bZe as ca,dZe as cb,vZe as cc,gZe as cd,mZe as ce,gYe as cf,oYe as cg,GGe as ch,YGe as ci,yYe as cj,hZe as ck,pZe as cl,Qa as cm,yr as cn,lGe as co,Gc as cp,MZe as cq,RZe as cr,dYe as cs,eYe as ct,rYe as cu,lYe as cv,tYe as cw,$Ze as cx,IZe as cy,JKe as cz,Wqe as d,Kr as e,RKe as f,TKe as g,MKe as h,kKe as i,I as j,mk as k,NKe as l,Vqe as m,VKe as n,mA as o,fKe as p,cKe as q,y as r,qKe as s,Xqe as t,QF as u,HKe as v,Gqe as w,zKe as x,WKe as y,UKe as z}; +`,o.map=[t,e.line],!0}function fHe(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>o)return!1;const a=e.src.charCodeAt(i);if(a!==126&&a!==96)return!1;let u=i;i=e.skipChars(i,a);let s=i-u;if(s<3)return!1;const l=e.src.slice(u,i),c=e.src.slice(i,o);if(a===96&&c.indexOf(String.fromCharCode(a))>=0)return!1;if(r)return!0;let d=t,h=!1;for(;d++,!(d>=n||(i=u=e.bMarks[d]+e.tShift[d],o=e.eMarks[d],i=4)&&(i=e.skipChars(i,a),!(i-u=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;const u=[],s=[],l=[],c=[],d=e.md.block.ruler.getRules("blockquote"),h=e.parentType;e.parentType="blockquote";let v=!1,g;for(g=t;g=o)break;if(e.src.charCodeAt(i++)===62&&!S){let E=e.sCount[g]+1,C,T;e.src.charCodeAt(i)===32?(i++,E++,T=!1,C=!0):e.src.charCodeAt(i)===9?(C=!0,(e.bsCount[g]+E)%4===3?(i++,E++,T=!1):T=!0):C=!1;let M=E;for(u.push(e.bMarks[g]),e.bMarks[g]=i;i=o,s.push(e.bsCount[g]),e.bsCount[g]=e.sCount[g]+1+(C?1:0),l.push(e.sCount[g]),e.sCount[g]=M-E,c.push(e.tShift[g]),e.tShift[g]=i-e.bMarks[g];continue}if(v)break;let A=!1;for(let E=0,C=d.length;E";const w=[t,0];b.map=w,e.md.block.tokenize(e,t,g);const x=e.push("blockquote_close","blockquote",-1);x.markup=">",e.lineMax=a,e.parentType=h,w[1]=e.line;for(let S=0;S=4)return!1;let o=e.bMarks[t]+e.tShift[t];const a=e.src.charCodeAt(o++);if(a!==42&&a!==45&&a!==95)return!1;let u=1;for(;o=r)return-1;let o=e.src.charCodeAt(i++);if(o<48||o>57)return-1;for(;;){if(i>=r)return-1;if(o=e.src.charCodeAt(i++),o>=48&&o<=57){if(i-n>=10)return-1;continue}if(o===41||o===46)break;return-1}return i=4||e.listIndent>=0&&e.sCount[s]-e.listIndent>=4&&e.sCount[s]=e.blkIndent&&(c=!0);let d,h,v;if((v=xI(e,s))>=0){if(d=!0,a=e.bMarks[s]+e.tShift[s],h=Number(e.src.slice(a,v-1)),c&&h!==1)return!1}else if((v=bI(e,s))>=0)d=!1;else return!1;if(c&&e.skipSpaces(v)>=e.eMarks[s])return!1;if(r)return!0;const g=e.src.charCodeAt(v-1),m=e.tokens.length;d?(u=e.push("ordered_list_open","ol",1),h!==1&&(u.attrs=[["start",h]])):u=e.push("bullet_list_open","ul",1);const b=[s,0];u.map=b,u.markup=String.fromCharCode(g);let w=!1;const x=e.md.block.ruler.getRules("list"),S=e.parentType;for(e.parentType="list";s=i?T=1:T=E-A,T>4&&(T=1);const M=A+T;u=e.push("list_item_open","li",1),u.markup=String.fromCharCode(g);const F=[s,0];u.map=F,d&&(u.info=e.src.slice(a,v-1));const U=e.tight,H=e.tShift[s],W=e.sCount[s],ie=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=M,e.tight=!0,e.tShift[s]=C-e.bMarks[s],e.sCount[s]=E,C>=i&&e.isEmpty(s+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,s,n,!0),(!e.tight||w)&&(l=!1),w=e.line-s>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=ie,e.tShift[s]=H,e.sCount[s]=W,e.tight=U,u=e.push("list_item_close","li",-1),u.markup=String.fromCharCode(g),s=e.line,F[1]=s,s>=n||e.sCount[s]=4)break;let Z=!1;for(let G=0,K=x.length;G=4||e.src.charCodeAt(i)!==91)return!1;function u(x){const S=e.lineMax;if(x>=S||e.isEmpty(x))return null;let A=!1;if(e.sCount[x]-e.blkIndent>3&&(A=!0),e.sCount[x]<0&&(A=!0),!A){const T=e.md.block.ruler.getRules("reference"),M=e.parentType;e.parentType="reference";let F=!1;for(let U=0,H=T.length;U"u"&&(e.env.references={}),typeof e.env.references[w]>"u"&&(e.env.references[w]={title:b,href:d}),e.line=a),!0):!1}const mHe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],yHe="[a-zA-Z_:][a-zA-Z0-9:._-]*",bHe="[^\"'=<>`\\x00-\\x20]+",xHe="'[^']*'",wHe='"[^"]*"',_He="(?:"+bHe+"|"+xHe+"|"+wHe+")",SHe="(?:\\s+"+yHe+"(?:\\s*=\\s*"+_He+")?)",GG="<[A-Za-z][A-Za-z0-9\\-]*"+SHe+"*\\s*\\/?>",YG="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",CHe="",EHe="<[?][\\s\\S]*?[?]>",AHe="]*>",OHe="",PHe=new RegExp("^(?:"+GG+"|"+YG+"|"+CHe+"|"+EHe+"|"+AHe+"|"+OHe+")"),kHe=new RegExp("^(?:"+GG+"|"+YG+")"),qf=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(kHe.source+"\\s*$"),/^$/,!1]];function THe(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let a=e.src.slice(i,o),u=0;for(;u=4)return!1;let a=e.src.charCodeAt(i);if(a!==35||i>=o)return!1;let u=1;for(a=e.src.charCodeAt(++i);a===35&&i6||ii&&Vn(e.src.charCodeAt(s-1))&&(o=s),e.line=t+1;const l=e.push("heading_open","h"+String(u),1);l.markup="########".slice(0,u),l.map=[t,e.line];const c=e.push("inline","",0);c.content=e.src.slice(i,o).trim(),c.map=[t,e.line],c.children=[];const d=e.push("heading_close","h"+String(u),-1);return d.markup="########".slice(0,u),!0}function RHe(e,t,n){const r=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const i=e.parentType;e.parentType="paragraph";let o=0,a,u=t+1;for(;u3)continue;if(e.sCount[u]>=e.blkIndent){let v=e.bMarks[u]+e.tShift[u];const g=e.eMarks[u];if(v=g))){o=a===61?1:2;break}}if(e.sCount[u]<0)continue;let h=!1;for(let v=0,g=r.length;v3||e.sCount[o]<0)continue;let l=!1;for(let c=0,d=r.length;c=n||e.sCount[a]=o){e.line=n;break}const s=e.line;let l=!1;for(let c=0;c=e.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");e.tight=!u,e.isEmpty(e.line-1)&&(u=!0),a=e.line,a0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};Ig.prototype.scanDelims=function(e,t){const n=this.posMax,r=this.src.charCodeAt(e),i=e>0?this.src.charCodeAt(e-1):32;let o=e;for(;o0)return!1;const n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;const i=e.pending.match(NHe);if(!i)return!1;const o=i[1],a=e.md.linkify.matchAtStart(e.src.slice(n-o.length));if(!a)return!1;let u=a.url;if(u.length<=o.length)return!1;u=u.replace(/\*+$/,"");const s=e.md.normalizeLink(u);if(!e.md.validateLink(s))return!1;if(!t){e.pending=e.pending.slice(0,-o.length);const l=e.push("link_open","a",1);l.attrs=[["href",s]],l.markup="linkify",l.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(u);const d=e.push("link_close","a",-1);d.markup="linkify",d.info="auto"}return e.pos+=u.length-o.length,!0}function LHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;const r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let o=r-1;for(;o>=1&&e.pending.charCodeAt(o-1)===32;)o--;e.pending=e.pending.slice(0,o),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(n++;n?@[]^_`{|}~-".split("").forEach(function(e){nP[e.charCodeAt(0)]=1});function jHe(e,t){let n=e.pos;const r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push("hardbreak","br",0),n++;n=55296&&i<=56319&&n+1=56320&&u<=57343&&(o+=e.src[n+1],n++)}const a="\\"+o;if(!t){const u=e.push("text_special","",0);i<256&&nP[i]!==0?u.content=o:u.content=a,u.markup=a,u.info="escape"}return e.pos=n+1,!0}function BHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;const i=n;n++;const o=e.posMax;for(;n=0;r--){const i=t[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const o=t[i.end],a=r>0&&t[r-1].end===i.end+1&&t[r-1].marker===i.marker&&t[r-1].token===i.token-1&&t[i.end+1].token===o.token+1,u=String.fromCharCode(i.marker),s=e.tokens[i.token];s.type=a?"strong_open":"em_open",s.tag=a?"strong":"em",s.nesting=1,s.markup=a?u+u:u,s.content="";const l=e.tokens[o.token];l.type=a?"strong_close":"em_close",l.tag=a?"strong":"em",l.nesting=-1,l.markup=a?u+u:u,l.content="",a&&(e.tokens[t[r-1].token].content="",e.tokens[t[i.end+1].token].content="",r--)}}function VHe(e){const t=e.tokens_meta,n=e.tokens_meta.length;_I(e,e.delimiters);for(let r=0;r=d)return!1;if(s=g,i=e.md.helpers.parseLinkDestination(e.src,g,e.posMax),i.ok){for(a=e.md.normalizeLink(i.str),e.md.validateLink(a)?g=i.pos:a="",s=g;g=d||e.src.charCodeAt(g)!==41)&&(l=!0),g++}if(l){if(typeof e.env.references>"u")return!1;if(g=0?r=e.src.slice(s,g++):g=v+1):g=v+1,r||(r=e.src.slice(h,v)),o=e.env.references[n2(r)],!o)return e.pos=c,!1;a=o.href,u=o.title}if(!t){e.pos=h,e.posMax=v;const m=e.push("link_open","a",1),b=[["href",a]];m.attrs=b,u&&b.push(["title",u]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=g,e.posMax=d,!0}function qHe(e,t){let n,r,i,o,a,u,s,l,c="";const d=e.pos,h=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const v=e.pos+2,g=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(g<0)return!1;if(o=g+1,o=h)return!1;for(l=o,u=e.md.helpers.parseLinkDestination(e.src,o,e.posMax),u.ok&&(c=e.md.normalizeLink(u.str),e.md.validateLink(c)?o=u.pos:c=""),l=o;o=h||e.src.charCodeAt(o)!==41)return e.pos=d,!1;o++}else{if(typeof e.env.references>"u")return!1;if(o=0?i=e.src.slice(l,o++):o=g+1):o=g+1,i||(i=e.src.slice(v,g)),a=e.env.references[n2(i)],!a)return e.pos=d,!1;c=a.href,s=a.title}if(!t){r=e.src.slice(v,g);const m=[];e.md.inline.parse(r,e.md,e.env,m);const b=e.push("image","img",0),w=[["src",c],["alt",""]];b.attrs=w,b.children=m,b.content=r,s&&w.push(["title",s])}return e.pos=o,e.posMax=h,!0}const KHe=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,GHe=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function YHe(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;const r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;const a=e.src.charCodeAt(n);if(a===60)return!1;if(a===62)break}const o=e.src.slice(r+1,n);if(GHe.test(o)){const a=e.md.normalizeLink(o);if(!e.md.validateLink(a))return!1;if(!t){const u=e.push("link_open","a",1);u.attrs=[["href",a]],u.markup="autolink",u.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(o);const l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}if(KHe.test(o)){const a=e.md.normalizeLink("mailto:"+o);if(!e.md.validateLink(a))return!1;if(!t){const u=e.push("link_open","a",1);u.attrs=[["href",a]],u.markup="autolink",u.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(o);const l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}return!1}function ZHe(e){return/^\s]/i.test(e)}function XHe(e){return/^<\/a\s*>/i.test(e)}function QHe(e){const t=e|32;return t>=97&&t<=122}function JHe(e,t){if(!e.md.options.html)return!1;const n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!QHe(i))return!1;const o=e.src.slice(r).match(PHe);if(!o)return!1;if(!t){const a=e.push("html_inline","",0);a.content=o[0],ZHe(a.content)&&e.linkLevel++,XHe(a.content)&&e.linkLevel--}return e.pos+=o[0].length,!0}const eqe=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,tqe=/^&([a-z][a-z0-9]{1,31});/i;function nqe(e,t){const n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){const o=e.src.slice(n).match(eqe);if(o){if(!t){const a=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),u=e.push("text_special","",0);u.content=eP(a)?ix(a):ix(65533),u.markup=o[0],u.info="entity"}return e.pos+=o[0].length,!0}}else{const o=e.src.slice(n).match(tqe);if(o){const a=WG(o[0]);if(a!==o[0]){if(!t){const u=e.push("text_special","",0);u.content=a,u.markup=o[0],u.info="entity"}return e.pos+=o[0].length,!0}}}return!1}function SI(e){const t={},n=e.length;if(!n)return;let r=0,i=-2;const o=[];for(let a=0;as;l-=o[l]+1){const d=e[l];if(d.marker===u.marker&&d.open&&d.end<0){let h=!1;if((d.close||u.open)&&(d.length+u.length)%3===0&&(d.length%3!==0||u.length%3!==0)&&(h=!0),!h){const v=l>0&&!e[l-1].open?o[l-1]+1:0;o[a]=a-l+v,o[l]=v,u.open=!1,d.end=a,d.close=!1,c=-1,i=-2;break}}}c!==-1&&(t[u.marker][(u.open?3:0)+(u.length||0)%3]=c)}}function rqe(e){const t=e.tokens_meta,n=e.tokens_meta.length;SI(e.delimiters);for(let r=0;r0&&r++,i[t].type==="text"&&t+1=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;a||e.pos++,o[t]=e.pos};Ng.prototype.tokenize=function(e){const t=this.ruler.getRules(""),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(a){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};Ng.prototype.parse=function(e,t,n,r){const i=new this.State(e,t,n,r);this.tokenize(i);const o=this.ruler2.getRules(""),a=o.length;for(let u=0;u|$))",t.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}function Q6(e){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){e[r]=n[r]})}),e}function i2(e){return Object.prototype.toString.call(e)}function aqe(e){return i2(e)==="[object String]"}function uqe(e){return i2(e)==="[object Object]"}function sqe(e){return i2(e)==="[object RegExp]"}function CI(e){return i2(e)==="[object Function]"}function lqe(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const QG={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function cqe(e){return Object.keys(e||{}).reduce(function(t,n){return t||QG.hasOwnProperty(n)},!1)}const fqe={"http:":{validate:function(e,t,n){const r=e.slice(t);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){const r=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){const r=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},dqe="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",hqe="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function pqe(e){e.__index__=-1,e.__text_cache__=""}function vqe(e){return function(t,n){const r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function EI(){return function(e,t){t.normalize(e)}}function ox(e){const t=e.re=oqe(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(dqe),n.push(t.src_xn),t.src_tlds=n.join("|");function r(u){return u.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),"i");const i=[];e.__compiled__={};function o(u,s){throw new Error('(LinkifyIt) Invalid schema "'+u+'": '+s)}Object.keys(e.__schemas__).forEach(function(u){const s=e.__schemas__[u];if(s===null)return;const l={validate:null,link:null};if(e.__compiled__[u]=l,uqe(s)){sqe(s.validate)?l.validate=vqe(s.validate):CI(s.validate)?l.validate=s.validate:o(u,s),CI(s.normalize)?l.normalize=s.normalize:s.normalize?o(u,s):l.normalize=EI();return}if(aqe(s)){i.push(u);return}o(u,s)}),i.forEach(function(u){e.__compiled__[e.__schemas__[u]]&&(e.__compiled__[u].validate=e.__compiled__[e.__schemas__[u]].validate,e.__compiled__[u].normalize=e.__compiled__[e.__schemas__[u]].normalize)}),e.__compiled__[""]={validate:null,normalize:EI()};const a=Object.keys(e.__compiled__).filter(function(u){return u.length>0&&e.__compiled__[u]}).map(lqe).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+a+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+a+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),pqe(e)}function gqe(e,t){const n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function J6(e,t){const n=new gqe(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function Uo(e,t){if(!(this instanceof Uo))return new Uo(e,t);t||cqe(e)&&(t=e,e={}),this.__opts__=Q6({},QG,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Q6({},fqe,e),this.__compiled__={},this.__tlds__=hqe,this.__tlds_replaced__=!1,this.re={},ox(this)}Uo.prototype.add=function(t,n){return this.__schemas__[t]=n,ox(this),this};Uo.prototype.set=function(t){return this.__opts__=Q6(this.__opts__,t),this};Uo.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let n,r,i,o,a,u,s,l,c;if(this.re.schema_test.test(t)){for(s=this.re.schema_search,s.lastIndex=0;(n=s.exec(t))!==null;)if(o=this.testSchemaAt(t,n[2],s.lastIndex),o){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=t.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l=0&&(i=t.match(this.re.email_fuzzy))!==null&&(a=i.index+i[1].length,u=i.index+i[0].length,(this.__index__<0||athis.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=u))),this.__index__>=0};Uo.prototype.pretest=function(t){return this.re.pretest.test(t)};Uo.prototype.testSchemaAt=function(t,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(t,r,this):0};Uo.prototype.match=function(t){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===t&&(n.push(J6(this,r)),r=this.__last_index__);let i=r?t.slice(r):t;for(;this.test(i);)n.push(J6(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};Uo.prototype.matchAtStart=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return null;const n=this.re.schema_at_start.exec(t);if(!n)return null;const r=this.testSchemaAt(t,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,J6(this,0)):null};Uo.prototype.tlds=function(t,n){return t=Array.isArray(t)?t:[t],n?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(r,i,o){return r!==o[i-1]}).reverse(),ox(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,ox(this),this)};Uo.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};Uo.prototype.onCompile=function(){};const Md=2147483647,mu=36,rP=1,Zv=26,mqe=38,yqe=700,JG=72,eY=128,tY="-",bqe=/^xn--/,xqe=/[^\0-\x7F]/,wqe=/[\x2E\u3002\uFF0E\uFF61]/g,_qe={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},g3=mu-rP,yu=Math.floor,m3=String.fromCharCode;function Ys(e){throw new RangeError(_qe[e])}function Sqe(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}function nY(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(wqe,".");const i=e.split("."),o=Sqe(i,t).join(".");return r+o}function rY(e){const t=[];let n=0;const r=e.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...e),Eqe=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:mu},AI=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},iY=function(e,t,n){let r=0;for(e=n?yu(e/yqe):e>>1,e+=yu(e/t);e>g3*Zv>>1;r+=mu)e=yu(e/g3);return yu(r+(g3+1)*e/(e+mqe))},oY=function(e){const t=[],n=e.length;let r=0,i=eY,o=JG,a=e.lastIndexOf(tY);a<0&&(a=0);for(let u=0;u=128&&Ys("not-basic"),t.push(e.charCodeAt(u));for(let u=a>0?a+1:0;u=n&&Ys("invalid-input");const h=Eqe(e.charCodeAt(u++));h>=mu&&Ys("invalid-input"),h>yu((Md-r)/c)&&Ys("overflow"),r+=h*c;const v=d<=o?rP:d>=o+Zv?Zv:d-o;if(hyu(Md/g)&&Ys("overflow"),c*=g}const l=t.length+1;o=iY(r-s,l,s==0),yu(r/l)>Md-i&&Ys("overflow"),i+=yu(r/l),r%=l,t.splice(r++,0,i)}return String.fromCodePoint(...t)},aY=function(e){const t=[];e=rY(e);const n=e.length;let r=eY,i=0,o=JG;for(const s of e)s<128&&t.push(m3(s));const a=t.length;let u=a;for(a&&t.push(tY);u=r&&cyu((Md-i)/l)&&Ys("overflow"),i+=(s-r)*l,r=s;for(const c of e)if(cMd&&Ys("overflow"),c===r){let d=i;for(let h=mu;;h+=mu){const v=h<=o?rP:h>=o+Zv?Zv:h-o;if(d=0))try{t.hostname=uY.toASCII(t.hostname)}catch{}return $g(ZO(t))}function Nqe(e){const t=XO(e,!0);if(t.hostname&&(!t.protocol||sY.indexOf(t.protocol)>=0))try{t.hostname=uY.toUnicode(t.hostname)}catch{}return bh(ZO(t),bh.defaultChars+"%")}function Qa(e,t){if(!(this instanceof Qa))return new Qa(e,t);t||JO(e)||(t=e||{},e="default"),this.inline=new Ng,this.block=new r2,this.core=new tP,this.renderer=new Zh,this.linkify=new Uo,this.validateLink=$qe,this.normalizeLink=Iqe,this.normalizeLinkText=Nqe,this.utils=LVe,this.helpers=t2({},UVe),this.options={},this.configure(e),t&&this.set(t)}Qa.prototype.set=function(e){return t2(this.options,e),this};Qa.prototype.configure=function(e){const t=this;if(JO(e)){const n=e;if(e=Mqe[n],!e)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[n].ruler2.enableOnly(e.components[n].rules2)}),this};Qa.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));const r=e.filter(function(i){return n.indexOf(i)<0});if(r.length&&!t)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};Qa.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));const r=e.filter(function(i){return n.indexOf(i)<0});if(r.length&&!t)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};Qa.prototype.use=function(e){const t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this};Qa.prototype.parse=function(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const n=new this.core.State(e,this,t);return this.core.process(n),n.tokens};Qa.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)};Qa.prototype.parseInline=function(e,t){const n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens};Qa.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};var lY={exports:{}};(function(e){(function(t){var n=function(k){var D,$=new Float64Array(16);if(k)for(D=0;D>24&255,k[D+1]=$>>16&255,k[D+2]=$>>8&255,k[D+3]=$&255,k[D+4]=O>>24&255,k[D+5]=O>>16&255,k[D+6]=O>>8&255,k[D+7]=O&255}function m(k,D,$,O,N){var ee,ne=0;for(ee=0;ee>>8)-1}function b(k,D,$,O){return m(k,D,$,O,16)}function w(k,D,$,O){return m(k,D,$,O,32)}function x(k,D,$,O){for(var N=O[0]&255|(O[1]&255)<<8|(O[2]&255)<<16|(O[3]&255)<<24,ee=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,ne=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,he=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,Ce=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,Be=O[4]&255|(O[5]&255)<<8|(O[6]&255)<<16|(O[7]&255)<<24,He=D[0]&255|(D[1]&255)<<8|(D[2]&255)<<16|(D[3]&255)<<24,ct=D[4]&255|(D[5]&255)<<8|(D[6]&255)<<16|(D[7]&255)<<24,Ne=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,rt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=O[8]&255|(O[9]&255)<<8|(O[10]&255)<<16|(O[11]&255)<<24,At=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,vt=$[20]&255|($[21]&255)<<8|($[22]&255)<<16|($[23]&255)<<24,ht=$[24]&255|($[25]&255)<<8|($[26]&255)<<16|($[27]&255)<<24,xt=$[28]&255|($[29]&255)<<8|($[30]&255)<<16|($[31]&255)<<24,wt=O[12]&255|(O[13]&255)<<8|(O[14]&255)<<16|(O[15]&255)<<24,Je=N,st=ee,Qe=ne,Le=he,qe=Ce,Ge=Be,me=He,ve=ct,De=Ne,Pe=rt,Te=bt,ze=At,mt=vt,Nt=ht,Ft=xt,$t=wt,te,Gt=0;Gt<20;Gt+=2)te=Je+mt|0,qe^=te<<7|te>>>25,te=qe+Je|0,De^=te<<9|te>>>23,te=De+qe|0,mt^=te<<13|te>>>19,te=mt+De|0,Je^=te<<18|te>>>14,te=Ge+st|0,Pe^=te<<7|te>>>25,te=Pe+Ge|0,Nt^=te<<9|te>>>23,te=Nt+Pe|0,st^=te<<13|te>>>19,te=st+Nt|0,Ge^=te<<18|te>>>14,te=Te+me|0,Ft^=te<<7|te>>>25,te=Ft+Te|0,Qe^=te<<9|te>>>23,te=Qe+Ft|0,me^=te<<13|te>>>19,te=me+Qe|0,Te^=te<<18|te>>>14,te=$t+ze|0,Le^=te<<7|te>>>25,te=Le+$t|0,ve^=te<<9|te>>>23,te=ve+Le|0,ze^=te<<13|te>>>19,te=ze+ve|0,$t^=te<<18|te>>>14,te=Je+Le|0,st^=te<<7|te>>>25,te=st+Je|0,Qe^=te<<9|te>>>23,te=Qe+st|0,Le^=te<<13|te>>>19,te=Le+Qe|0,Je^=te<<18|te>>>14,te=Ge+qe|0,me^=te<<7|te>>>25,te=me+Ge|0,ve^=te<<9|te>>>23,te=ve+me|0,qe^=te<<13|te>>>19,te=qe+ve|0,Ge^=te<<18|te>>>14,te=Te+Pe|0,ze^=te<<7|te>>>25,te=ze+Te|0,De^=te<<9|te>>>23,te=De+ze|0,Pe^=te<<13|te>>>19,te=Pe+De|0,Te^=te<<18|te>>>14,te=$t+Ft|0,mt^=te<<7|te>>>25,te=mt+$t|0,Nt^=te<<9|te>>>23,te=Nt+mt|0,Ft^=te<<13|te>>>19,te=Ft+Nt|0,$t^=te<<18|te>>>14;Je=Je+N|0,st=st+ee|0,Qe=Qe+ne|0,Le=Le+he|0,qe=qe+Ce|0,Ge=Ge+Be|0,me=me+He|0,ve=ve+ct|0,De=De+Ne|0,Pe=Pe+rt|0,Te=Te+bt|0,ze=ze+At|0,mt=mt+vt|0,Nt=Nt+ht|0,Ft=Ft+xt|0,$t=$t+wt|0,k[0]=Je>>>0&255,k[1]=Je>>>8&255,k[2]=Je>>>16&255,k[3]=Je>>>24&255,k[4]=st>>>0&255,k[5]=st>>>8&255,k[6]=st>>>16&255,k[7]=st>>>24&255,k[8]=Qe>>>0&255,k[9]=Qe>>>8&255,k[10]=Qe>>>16&255,k[11]=Qe>>>24&255,k[12]=Le>>>0&255,k[13]=Le>>>8&255,k[14]=Le>>>16&255,k[15]=Le>>>24&255,k[16]=qe>>>0&255,k[17]=qe>>>8&255,k[18]=qe>>>16&255,k[19]=qe>>>24&255,k[20]=Ge>>>0&255,k[21]=Ge>>>8&255,k[22]=Ge>>>16&255,k[23]=Ge>>>24&255,k[24]=me>>>0&255,k[25]=me>>>8&255,k[26]=me>>>16&255,k[27]=me>>>24&255,k[28]=ve>>>0&255,k[29]=ve>>>8&255,k[30]=ve>>>16&255,k[31]=ve>>>24&255,k[32]=De>>>0&255,k[33]=De>>>8&255,k[34]=De>>>16&255,k[35]=De>>>24&255,k[36]=Pe>>>0&255,k[37]=Pe>>>8&255,k[38]=Pe>>>16&255,k[39]=Pe>>>24&255,k[40]=Te>>>0&255,k[41]=Te>>>8&255,k[42]=Te>>>16&255,k[43]=Te>>>24&255,k[44]=ze>>>0&255,k[45]=ze>>>8&255,k[46]=ze>>>16&255,k[47]=ze>>>24&255,k[48]=mt>>>0&255,k[49]=mt>>>8&255,k[50]=mt>>>16&255,k[51]=mt>>>24&255,k[52]=Nt>>>0&255,k[53]=Nt>>>8&255,k[54]=Nt>>>16&255,k[55]=Nt>>>24&255,k[56]=Ft>>>0&255,k[57]=Ft>>>8&255,k[58]=Ft>>>16&255,k[59]=Ft>>>24&255,k[60]=$t>>>0&255,k[61]=$t>>>8&255,k[62]=$t>>>16&255,k[63]=$t>>>24&255}function S(k,D,$,O){for(var N=O[0]&255|(O[1]&255)<<8|(O[2]&255)<<16|(O[3]&255)<<24,ee=$[0]&255|($[1]&255)<<8|($[2]&255)<<16|($[3]&255)<<24,ne=$[4]&255|($[5]&255)<<8|($[6]&255)<<16|($[7]&255)<<24,he=$[8]&255|($[9]&255)<<8|($[10]&255)<<16|($[11]&255)<<24,Ce=$[12]&255|($[13]&255)<<8|($[14]&255)<<16|($[15]&255)<<24,Be=O[4]&255|(O[5]&255)<<8|(O[6]&255)<<16|(O[7]&255)<<24,He=D[0]&255|(D[1]&255)<<8|(D[2]&255)<<16|(D[3]&255)<<24,ct=D[4]&255|(D[5]&255)<<8|(D[6]&255)<<16|(D[7]&255)<<24,Ne=D[8]&255|(D[9]&255)<<8|(D[10]&255)<<16|(D[11]&255)<<24,rt=D[12]&255|(D[13]&255)<<8|(D[14]&255)<<16|(D[15]&255)<<24,bt=O[8]&255|(O[9]&255)<<8|(O[10]&255)<<16|(O[11]&255)<<24,At=$[16]&255|($[17]&255)<<8|($[18]&255)<<16|($[19]&255)<<24,vt=$[20]&255|($[21]&255)<<8|($[22]&255)<<16|($[23]&255)<<24,ht=$[24]&255|($[25]&255)<<8|($[26]&255)<<16|($[27]&255)<<24,xt=$[28]&255|($[29]&255)<<8|($[30]&255)<<16|($[31]&255)<<24,wt=O[12]&255|(O[13]&255)<<8|(O[14]&255)<<16|(O[15]&255)<<24,Je=N,st=ee,Qe=ne,Le=he,qe=Ce,Ge=Be,me=He,ve=ct,De=Ne,Pe=rt,Te=bt,ze=At,mt=vt,Nt=ht,Ft=xt,$t=wt,te,Gt=0;Gt<20;Gt+=2)te=Je+mt|0,qe^=te<<7|te>>>25,te=qe+Je|0,De^=te<<9|te>>>23,te=De+qe|0,mt^=te<<13|te>>>19,te=mt+De|0,Je^=te<<18|te>>>14,te=Ge+st|0,Pe^=te<<7|te>>>25,te=Pe+Ge|0,Nt^=te<<9|te>>>23,te=Nt+Pe|0,st^=te<<13|te>>>19,te=st+Nt|0,Ge^=te<<18|te>>>14,te=Te+me|0,Ft^=te<<7|te>>>25,te=Ft+Te|0,Qe^=te<<9|te>>>23,te=Qe+Ft|0,me^=te<<13|te>>>19,te=me+Qe|0,Te^=te<<18|te>>>14,te=$t+ze|0,Le^=te<<7|te>>>25,te=Le+$t|0,ve^=te<<9|te>>>23,te=ve+Le|0,ze^=te<<13|te>>>19,te=ze+ve|0,$t^=te<<18|te>>>14,te=Je+Le|0,st^=te<<7|te>>>25,te=st+Je|0,Qe^=te<<9|te>>>23,te=Qe+st|0,Le^=te<<13|te>>>19,te=Le+Qe|0,Je^=te<<18|te>>>14,te=Ge+qe|0,me^=te<<7|te>>>25,te=me+Ge|0,ve^=te<<9|te>>>23,te=ve+me|0,qe^=te<<13|te>>>19,te=qe+ve|0,Ge^=te<<18|te>>>14,te=Te+Pe|0,ze^=te<<7|te>>>25,te=ze+Te|0,De^=te<<9|te>>>23,te=De+ze|0,Pe^=te<<13|te>>>19,te=Pe+De|0,Te^=te<<18|te>>>14,te=$t+Ft|0,mt^=te<<7|te>>>25,te=mt+$t|0,Nt^=te<<9|te>>>23,te=Nt+mt|0,Ft^=te<<13|te>>>19,te=Ft+Nt|0,$t^=te<<18|te>>>14;k[0]=Je>>>0&255,k[1]=Je>>>8&255,k[2]=Je>>>16&255,k[3]=Je>>>24&255,k[4]=Ge>>>0&255,k[5]=Ge>>>8&255,k[6]=Ge>>>16&255,k[7]=Ge>>>24&255,k[8]=Te>>>0&255,k[9]=Te>>>8&255,k[10]=Te>>>16&255,k[11]=Te>>>24&255,k[12]=$t>>>0&255,k[13]=$t>>>8&255,k[14]=$t>>>16&255,k[15]=$t>>>24&255,k[16]=me>>>0&255,k[17]=me>>>8&255,k[18]=me>>>16&255,k[19]=me>>>24&255,k[20]=ve>>>0&255,k[21]=ve>>>8&255,k[22]=ve>>>16&255,k[23]=ve>>>24&255,k[24]=De>>>0&255,k[25]=De>>>8&255,k[26]=De>>>16&255,k[27]=De>>>24&255,k[28]=Pe>>>0&255,k[29]=Pe>>>8&255,k[30]=Pe>>>16&255,k[31]=Pe>>>24&255}function A(k,D,$,O){x(k,D,$,O)}function E(k,D,$,O){S(k,D,$,O)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function T(k,D,$,O,N,ee,ne){var he=new Uint8Array(16),Ce=new Uint8Array(64),Be,He;for(He=0;He<16;He++)he[He]=0;for(He=0;He<8;He++)he[He]=ee[He];for(;N>=64;){for(A(Ce,he,ne,C),He=0;He<64;He++)k[D+He]=$[O+He]^Ce[He];for(Be=1,He=8;He<16;He++)Be=Be+(he[He]&255)|0,he[He]=Be&255,Be>>>=8;N-=64,D+=64,O+=64}if(N>0)for(A(Ce,he,ne,C),He=0;He=64;){for(A(ne,ee,N,C),Ce=0;Ce<64;Ce++)k[D+Ce]=ne[Ce];for(he=1,Ce=8;Ce<16;Ce++)he=he+(ee[Ce]&255)|0,ee[Ce]=he&255,he>>>=8;$-=64,D+=64}if($>0)for(A(ne,ee,N,C),Ce=0;Ce<$;Ce++)k[D+Ce]=ne[Ce];return 0}function F(k,D,$,O,N){var ee=new Uint8Array(32);E(ee,O,N,C);for(var ne=new Uint8Array(8),he=0;he<8;he++)ne[he]=O[he+16];return M(k,D,$,ne,ee)}function U(k,D,$,O,N,ee,ne){var he=new Uint8Array(32);E(he,ee,ne,C);for(var Ce=new Uint8Array(8),Be=0;Be<8;Be++)Ce[Be]=ee[Be+16];return T(k,D,$,O,N,Ce,he)}var H=function(k){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var D,$,O,N,ee,ne,he,Ce;D=k[0]&255|(k[1]&255)<<8,this.r[0]=D&8191,$=k[2]&255|(k[3]&255)<<8,this.r[1]=(D>>>13|$<<3)&8191,O=k[4]&255|(k[5]&255)<<8,this.r[2]=($>>>10|O<<6)&7939,N=k[6]&255|(k[7]&255)<<8,this.r[3]=(O>>>7|N<<9)&8191,ee=k[8]&255|(k[9]&255)<<8,this.r[4]=(N>>>4|ee<<12)&255,this.r[5]=ee>>>1&8190,ne=k[10]&255|(k[11]&255)<<8,this.r[6]=(ee>>>14|ne<<2)&8191,he=k[12]&255|(k[13]&255)<<8,this.r[7]=(ne>>>11|he<<5)&8065,Ce=k[14]&255|(k[15]&255)<<8,this.r[8]=(he>>>8|Ce<<8)&8191,this.r[9]=Ce>>>5&127,this.pad[0]=k[16]&255|(k[17]&255)<<8,this.pad[1]=k[18]&255|(k[19]&255)<<8,this.pad[2]=k[20]&255|(k[21]&255)<<8,this.pad[3]=k[22]&255|(k[23]&255)<<8,this.pad[4]=k[24]&255|(k[25]&255)<<8,this.pad[5]=k[26]&255|(k[27]&255)<<8,this.pad[6]=k[28]&255|(k[29]&255)<<8,this.pad[7]=k[30]&255|(k[31]&255)<<8};H.prototype.blocks=function(k,D,$){for(var O=this.fin?0:2048,N,ee,ne,he,Ce,Be,He,ct,Ne,rt,bt,At,vt,ht,xt,wt,Je,st,Qe,Le=this.h[0],qe=this.h[1],Ge=this.h[2],me=this.h[3],ve=this.h[4],De=this.h[5],Pe=this.h[6],Te=this.h[7],ze=this.h[8],mt=this.h[9],Nt=this.r[0],Ft=this.r[1],$t=this.r[2],te=this.r[3],Gt=this.r[4],on=this.r[5],an=this.r[6],Lt=this.r[7],un=this.r[8],tn=this.r[9];$>=16;)N=k[D+0]&255|(k[D+1]&255)<<8,Le+=N&8191,ee=k[D+2]&255|(k[D+3]&255)<<8,qe+=(N>>>13|ee<<3)&8191,ne=k[D+4]&255|(k[D+5]&255)<<8,Ge+=(ee>>>10|ne<<6)&8191,he=k[D+6]&255|(k[D+7]&255)<<8,me+=(ne>>>7|he<<9)&8191,Ce=k[D+8]&255|(k[D+9]&255)<<8,ve+=(he>>>4|Ce<<12)&8191,De+=Ce>>>1&8191,Be=k[D+10]&255|(k[D+11]&255)<<8,Pe+=(Ce>>>14|Be<<2)&8191,He=k[D+12]&255|(k[D+13]&255)<<8,Te+=(Be>>>11|He<<5)&8191,ct=k[D+14]&255|(k[D+15]&255)<<8,ze+=(He>>>8|ct<<8)&8191,mt+=ct>>>5|O,Ne=0,rt=Ne,rt+=Le*Nt,rt+=qe*(5*tn),rt+=Ge*(5*un),rt+=me*(5*Lt),rt+=ve*(5*an),Ne=rt>>>13,rt&=8191,rt+=De*(5*on),rt+=Pe*(5*Gt),rt+=Te*(5*te),rt+=ze*(5*$t),rt+=mt*(5*Ft),Ne+=rt>>>13,rt&=8191,bt=Ne,bt+=Le*Ft,bt+=qe*Nt,bt+=Ge*(5*tn),bt+=me*(5*un),bt+=ve*(5*Lt),Ne=bt>>>13,bt&=8191,bt+=De*(5*an),bt+=Pe*(5*on),bt+=Te*(5*Gt),bt+=ze*(5*te),bt+=mt*(5*$t),Ne+=bt>>>13,bt&=8191,At=Ne,At+=Le*$t,At+=qe*Ft,At+=Ge*Nt,At+=me*(5*tn),At+=ve*(5*un),Ne=At>>>13,At&=8191,At+=De*(5*Lt),At+=Pe*(5*an),At+=Te*(5*on),At+=ze*(5*Gt),At+=mt*(5*te),Ne+=At>>>13,At&=8191,vt=Ne,vt+=Le*te,vt+=qe*$t,vt+=Ge*Ft,vt+=me*Nt,vt+=ve*(5*tn),Ne=vt>>>13,vt&=8191,vt+=De*(5*un),vt+=Pe*(5*Lt),vt+=Te*(5*an),vt+=ze*(5*on),vt+=mt*(5*Gt),Ne+=vt>>>13,vt&=8191,ht=Ne,ht+=Le*Gt,ht+=qe*te,ht+=Ge*$t,ht+=me*Ft,ht+=ve*Nt,Ne=ht>>>13,ht&=8191,ht+=De*(5*tn),ht+=Pe*(5*un),ht+=Te*(5*Lt),ht+=ze*(5*an),ht+=mt*(5*on),Ne+=ht>>>13,ht&=8191,xt=Ne,xt+=Le*on,xt+=qe*Gt,xt+=Ge*te,xt+=me*$t,xt+=ve*Ft,Ne=xt>>>13,xt&=8191,xt+=De*Nt,xt+=Pe*(5*tn),xt+=Te*(5*un),xt+=ze*(5*Lt),xt+=mt*(5*an),Ne+=xt>>>13,xt&=8191,wt=Ne,wt+=Le*an,wt+=qe*on,wt+=Ge*Gt,wt+=me*te,wt+=ve*$t,Ne=wt>>>13,wt&=8191,wt+=De*Ft,wt+=Pe*Nt,wt+=Te*(5*tn),wt+=ze*(5*un),wt+=mt*(5*Lt),Ne+=wt>>>13,wt&=8191,Je=Ne,Je+=Le*Lt,Je+=qe*an,Je+=Ge*on,Je+=me*Gt,Je+=ve*te,Ne=Je>>>13,Je&=8191,Je+=De*$t,Je+=Pe*Ft,Je+=Te*Nt,Je+=ze*(5*tn),Je+=mt*(5*un),Ne+=Je>>>13,Je&=8191,st=Ne,st+=Le*un,st+=qe*Lt,st+=Ge*an,st+=me*on,st+=ve*Gt,Ne=st>>>13,st&=8191,st+=De*te,st+=Pe*$t,st+=Te*Ft,st+=ze*Nt,st+=mt*(5*tn),Ne+=st>>>13,st&=8191,Qe=Ne,Qe+=Le*tn,Qe+=qe*un,Qe+=Ge*Lt,Qe+=me*an,Qe+=ve*on,Ne=Qe>>>13,Qe&=8191,Qe+=De*Gt,Qe+=Pe*te,Qe+=Te*$t,Qe+=ze*Ft,Qe+=mt*Nt,Ne+=Qe>>>13,Qe&=8191,Ne=(Ne<<2)+Ne|0,Ne=Ne+rt|0,rt=Ne&8191,Ne=Ne>>>13,bt+=Ne,Le=rt,qe=bt,Ge=At,me=vt,ve=ht,De=xt,Pe=wt,Te=Je,ze=st,mt=Qe,D+=16,$-=16;this.h[0]=Le,this.h[1]=qe,this.h[2]=Ge,this.h[3]=me,this.h[4]=ve,this.h[5]=De,this.h[6]=Pe,this.h[7]=Te,this.h[8]=ze,this.h[9]=mt},H.prototype.finish=function(k,D){var $=new Uint16Array(10),O,N,ee,ne;if(this.leftover){for(ne=this.leftover,this.buffer[ne++]=1;ne<16;ne++)this.buffer[ne]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(O=this.h[1]>>>13,this.h[1]&=8191,ne=2;ne<10;ne++)this.h[ne]+=O,O=this.h[ne]>>>13,this.h[ne]&=8191;for(this.h[0]+=O*5,O=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=O,O=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=O,$[0]=this.h[0]+5,O=$[0]>>>13,$[0]&=8191,ne=1;ne<10;ne++)$[ne]=this.h[ne]+O,O=$[ne]>>>13,$[ne]&=8191;for($[9]-=8192,N=(O^1)-1,ne=0;ne<10;ne++)$[ne]&=N;for(N=~N,ne=0;ne<10;ne++)this.h[ne]=this.h[ne]&N|$[ne];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,ee=this.h[0]+this.pad[0],this.h[0]=ee&65535,ne=1;ne<8;ne++)ee=(this.h[ne]+this.pad[ne]|0)+(ee>>>16)|0,this.h[ne]=ee&65535;k[D+0]=this.h[0]>>>0&255,k[D+1]=this.h[0]>>>8&255,k[D+2]=this.h[1]>>>0&255,k[D+3]=this.h[1]>>>8&255,k[D+4]=this.h[2]>>>0&255,k[D+5]=this.h[2]>>>8&255,k[D+6]=this.h[3]>>>0&255,k[D+7]=this.h[3]>>>8&255,k[D+8]=this.h[4]>>>0&255,k[D+9]=this.h[4]>>>8&255,k[D+10]=this.h[5]>>>0&255,k[D+11]=this.h[5]>>>8&255,k[D+12]=this.h[6]>>>0&255,k[D+13]=this.h[6]>>>8&255,k[D+14]=this.h[7]>>>0&255,k[D+15]=this.h[7]>>>8&255},H.prototype.update=function(k,D,$){var O,N;if(this.leftover){for(N=16-this.leftover,N>$&&(N=$),O=0;O=16&&(N=$-$%16,this.blocks(k,D,N),D+=N,$-=N),$){for(O=0;O<$;O++)this.buffer[this.leftover+O]=k[D+O];this.leftover+=$}};function W(k,D,$,O,N,ee){var ne=new H(ee);return ne.update($,O,N),ne.finish(k,D),0}function ie(k,D,$,O,N,ee){var ne=new Uint8Array(16);return W(ne,0,$,O,N,ee),b(k,D,ne,0)}function Z(k,D,$,O,N){var ee;if($<32)return-1;for(U(k,0,D,0,$,O,N),W(k,16,k,32,$-32,k),ee=0;ee<16;ee++)k[ee]=0;return 0}function G(k,D,$,O,N){var ee,ne=new Uint8Array(32);if($<32||(F(ne,0,32,O,N),ie(D,16,D,32,$-32,ne)!==0))return-1;for(U(k,0,D,0,$,O,N),ee=0;ee<32;ee++)k[ee]=0;return 0}function K(k,D){var $;for($=0;$<16;$++)k[$]=D[$]|0}function V(k){var D,$,O=1;for(D=0;D<16;D++)$=k[D]+O+65535,O=Math.floor($/65536),k[D]=$-O*65536;k[0]+=O-1+37*(O-1)}function B(k,D,$){for(var O,N=~($-1),ee=0;ee<16;ee++)O=N&(k[ee]^D[ee]),k[ee]^=O,D[ee]^=O}function q(k,D){var $,O,N,ee=n(),ne=n();for($=0;$<16;$++)ne[$]=D[$];for(V(ne),V(ne),V(ne),O=0;O<2;O++){for(ee[0]=ne[0]-65517,$=1;$<15;$++)ee[$]=ne[$]-65535-(ee[$-1]>>16&1),ee[$-1]&=65535;ee[15]=ne[15]-32767-(ee[14]>>16&1),N=ee[15]>>16&1,ee[14]&=65535,B(ne,ee,1-N)}for($=0;$<16;$++)k[2*$]=ne[$]&255,k[2*$+1]=ne[$]>>8}function Y(k,D){var $=new Uint8Array(32),O=new Uint8Array(32);return q($,k),q(O,D),w($,0,O,0)}function ue(k){var D=new Uint8Array(32);return q(D,k),D[0]&1}function Q(k,D){var $;for($=0;$<16;$++)k[$]=D[2*$]+(D[2*$+1]<<8);k[15]&=32767}function J(k,D,$){for(var O=0;O<16;O++)k[O]=D[O]+$[O]}function se(k,D,$){for(var O=0;O<16;O++)k[O]=D[O]-$[O]}function de(k,D,$){var O,N,ee=0,ne=0,he=0,Ce=0,Be=0,He=0,ct=0,Ne=0,rt=0,bt=0,At=0,vt=0,ht=0,xt=0,wt=0,Je=0,st=0,Qe=0,Le=0,qe=0,Ge=0,me=0,ve=0,De=0,Pe=0,Te=0,ze=0,mt=0,Nt=0,Ft=0,$t=0,te=$[0],Gt=$[1],on=$[2],an=$[3],Lt=$[4],un=$[5],tn=$[6],Kn=$[7],vn=$[8],Pn=$[9],Gn=$[10],Yn=$[11],xr=$[12],$r=$[13],Ir=$[14],Nr=$[15];O=D[0],ee+=O*te,ne+=O*Gt,he+=O*on,Ce+=O*an,Be+=O*Lt,He+=O*un,ct+=O*tn,Ne+=O*Kn,rt+=O*vn,bt+=O*Pn,At+=O*Gn,vt+=O*Yn,ht+=O*xr,xt+=O*$r,wt+=O*Ir,Je+=O*Nr,O=D[1],ne+=O*te,he+=O*Gt,Ce+=O*on,Be+=O*an,He+=O*Lt,ct+=O*un,Ne+=O*tn,rt+=O*Kn,bt+=O*vn,At+=O*Pn,vt+=O*Gn,ht+=O*Yn,xt+=O*xr,wt+=O*$r,Je+=O*Ir,st+=O*Nr,O=D[2],he+=O*te,Ce+=O*Gt,Be+=O*on,He+=O*an,ct+=O*Lt,Ne+=O*un,rt+=O*tn,bt+=O*Kn,At+=O*vn,vt+=O*Pn,ht+=O*Gn,xt+=O*Yn,wt+=O*xr,Je+=O*$r,st+=O*Ir,Qe+=O*Nr,O=D[3],Ce+=O*te,Be+=O*Gt,He+=O*on,ct+=O*an,Ne+=O*Lt,rt+=O*un,bt+=O*tn,At+=O*Kn,vt+=O*vn,ht+=O*Pn,xt+=O*Gn,wt+=O*Yn,Je+=O*xr,st+=O*$r,Qe+=O*Ir,Le+=O*Nr,O=D[4],Be+=O*te,He+=O*Gt,ct+=O*on,Ne+=O*an,rt+=O*Lt,bt+=O*un,At+=O*tn,vt+=O*Kn,ht+=O*vn,xt+=O*Pn,wt+=O*Gn,Je+=O*Yn,st+=O*xr,Qe+=O*$r,Le+=O*Ir,qe+=O*Nr,O=D[5],He+=O*te,ct+=O*Gt,Ne+=O*on,rt+=O*an,bt+=O*Lt,At+=O*un,vt+=O*tn,ht+=O*Kn,xt+=O*vn,wt+=O*Pn,Je+=O*Gn,st+=O*Yn,Qe+=O*xr,Le+=O*$r,qe+=O*Ir,Ge+=O*Nr,O=D[6],ct+=O*te,Ne+=O*Gt,rt+=O*on,bt+=O*an,At+=O*Lt,vt+=O*un,ht+=O*tn,xt+=O*Kn,wt+=O*vn,Je+=O*Pn,st+=O*Gn,Qe+=O*Yn,Le+=O*xr,qe+=O*$r,Ge+=O*Ir,me+=O*Nr,O=D[7],Ne+=O*te,rt+=O*Gt,bt+=O*on,At+=O*an,vt+=O*Lt,ht+=O*un,xt+=O*tn,wt+=O*Kn,Je+=O*vn,st+=O*Pn,Qe+=O*Gn,Le+=O*Yn,qe+=O*xr,Ge+=O*$r,me+=O*Ir,ve+=O*Nr,O=D[8],rt+=O*te,bt+=O*Gt,At+=O*on,vt+=O*an,ht+=O*Lt,xt+=O*un,wt+=O*tn,Je+=O*Kn,st+=O*vn,Qe+=O*Pn,Le+=O*Gn,qe+=O*Yn,Ge+=O*xr,me+=O*$r,ve+=O*Ir,De+=O*Nr,O=D[9],bt+=O*te,At+=O*Gt,vt+=O*on,ht+=O*an,xt+=O*Lt,wt+=O*un,Je+=O*tn,st+=O*Kn,Qe+=O*vn,Le+=O*Pn,qe+=O*Gn,Ge+=O*Yn,me+=O*xr,ve+=O*$r,De+=O*Ir,Pe+=O*Nr,O=D[10],At+=O*te,vt+=O*Gt,ht+=O*on,xt+=O*an,wt+=O*Lt,Je+=O*un,st+=O*tn,Qe+=O*Kn,Le+=O*vn,qe+=O*Pn,Ge+=O*Gn,me+=O*Yn,ve+=O*xr,De+=O*$r,Pe+=O*Ir,Te+=O*Nr,O=D[11],vt+=O*te,ht+=O*Gt,xt+=O*on,wt+=O*an,Je+=O*Lt,st+=O*un,Qe+=O*tn,Le+=O*Kn,qe+=O*vn,Ge+=O*Pn,me+=O*Gn,ve+=O*Yn,De+=O*xr,Pe+=O*$r,Te+=O*Ir,ze+=O*Nr,O=D[12],ht+=O*te,xt+=O*Gt,wt+=O*on,Je+=O*an,st+=O*Lt,Qe+=O*un,Le+=O*tn,qe+=O*Kn,Ge+=O*vn,me+=O*Pn,ve+=O*Gn,De+=O*Yn,Pe+=O*xr,Te+=O*$r,ze+=O*Ir,mt+=O*Nr,O=D[13],xt+=O*te,wt+=O*Gt,Je+=O*on,st+=O*an,Qe+=O*Lt,Le+=O*un,qe+=O*tn,Ge+=O*Kn,me+=O*vn,ve+=O*Pn,De+=O*Gn,Pe+=O*Yn,Te+=O*xr,ze+=O*$r,mt+=O*Ir,Nt+=O*Nr,O=D[14],wt+=O*te,Je+=O*Gt,st+=O*on,Qe+=O*an,Le+=O*Lt,qe+=O*un,Ge+=O*tn,me+=O*Kn,ve+=O*vn,De+=O*Pn,Pe+=O*Gn,Te+=O*Yn,ze+=O*xr,mt+=O*$r,Nt+=O*Ir,Ft+=O*Nr,O=D[15],Je+=O*te,st+=O*Gt,Qe+=O*on,Le+=O*an,qe+=O*Lt,Ge+=O*un,me+=O*tn,ve+=O*Kn,De+=O*vn,Pe+=O*Pn,Te+=O*Gn,ze+=O*Yn,mt+=O*xr,Nt+=O*$r,Ft+=O*Ir,$t+=O*Nr,ee+=38*st,ne+=38*Qe,he+=38*Le,Ce+=38*qe,Be+=38*Ge,He+=38*me,ct+=38*ve,Ne+=38*De,rt+=38*Pe,bt+=38*Te,At+=38*ze,vt+=38*mt,ht+=38*Nt,xt+=38*Ft,wt+=38*$t,N=1,O=ee+N+65535,N=Math.floor(O/65536),ee=O-N*65536,O=ne+N+65535,N=Math.floor(O/65536),ne=O-N*65536,O=he+N+65535,N=Math.floor(O/65536),he=O-N*65536,O=Ce+N+65535,N=Math.floor(O/65536),Ce=O-N*65536,O=Be+N+65535,N=Math.floor(O/65536),Be=O-N*65536,O=He+N+65535,N=Math.floor(O/65536),He=O-N*65536,O=ct+N+65535,N=Math.floor(O/65536),ct=O-N*65536,O=Ne+N+65535,N=Math.floor(O/65536),Ne=O-N*65536,O=rt+N+65535,N=Math.floor(O/65536),rt=O-N*65536,O=bt+N+65535,N=Math.floor(O/65536),bt=O-N*65536,O=At+N+65535,N=Math.floor(O/65536),At=O-N*65536,O=vt+N+65535,N=Math.floor(O/65536),vt=O-N*65536,O=ht+N+65535,N=Math.floor(O/65536),ht=O-N*65536,O=xt+N+65535,N=Math.floor(O/65536),xt=O-N*65536,O=wt+N+65535,N=Math.floor(O/65536),wt=O-N*65536,O=Je+N+65535,N=Math.floor(O/65536),Je=O-N*65536,ee+=N-1+37*(N-1),N=1,O=ee+N+65535,N=Math.floor(O/65536),ee=O-N*65536,O=ne+N+65535,N=Math.floor(O/65536),ne=O-N*65536,O=he+N+65535,N=Math.floor(O/65536),he=O-N*65536,O=Ce+N+65535,N=Math.floor(O/65536),Ce=O-N*65536,O=Be+N+65535,N=Math.floor(O/65536),Be=O-N*65536,O=He+N+65535,N=Math.floor(O/65536),He=O-N*65536,O=ct+N+65535,N=Math.floor(O/65536),ct=O-N*65536,O=Ne+N+65535,N=Math.floor(O/65536),Ne=O-N*65536,O=rt+N+65535,N=Math.floor(O/65536),rt=O-N*65536,O=bt+N+65535,N=Math.floor(O/65536),bt=O-N*65536,O=At+N+65535,N=Math.floor(O/65536),At=O-N*65536,O=vt+N+65535,N=Math.floor(O/65536),vt=O-N*65536,O=ht+N+65535,N=Math.floor(O/65536),ht=O-N*65536,O=xt+N+65535,N=Math.floor(O/65536),xt=O-N*65536,O=wt+N+65535,N=Math.floor(O/65536),wt=O-N*65536,O=Je+N+65535,N=Math.floor(O/65536),Je=O-N*65536,ee+=N-1+37*(N-1),k[0]=ee,k[1]=ne,k[2]=he,k[3]=Ce,k[4]=Be,k[5]=He,k[6]=ct,k[7]=Ne,k[8]=rt,k[9]=bt,k[10]=At,k[11]=vt,k[12]=ht,k[13]=xt,k[14]=wt,k[15]=Je}function Se(k,D){de(k,D,D)}function ge(k,D){var $=n(),O;for(O=0;O<16;O++)$[O]=D[O];for(O=253;O>=0;O--)Se($,$),O!==2&&O!==4&&de($,$,D);for(O=0;O<16;O++)k[O]=$[O]}function Ze(k,D){var $=n(),O;for(O=0;O<16;O++)$[O]=D[O];for(O=250;O>=0;O--)Se($,$),O!==1&&de($,$,D);for(O=0;O<16;O++)k[O]=$[O]}function Oe(k,D,$){var O=new Uint8Array(32),N=new Float64Array(80),ee,ne,he=n(),Ce=n(),Be=n(),He=n(),ct=n(),Ne=n();for(ne=0;ne<31;ne++)O[ne]=D[ne];for(O[31]=D[31]&127|64,O[0]&=248,Q(N,$),ne=0;ne<16;ne++)Ce[ne]=N[ne],He[ne]=he[ne]=Be[ne]=0;for(he[0]=He[0]=1,ne=254;ne>=0;--ne)ee=O[ne>>>3]>>>(ne&7)&1,B(he,Ce,ee),B(Be,He,ee),J(ct,he,Be),se(he,he,Be),J(Be,Ce,He),se(Ce,Ce,He),Se(He,ct),Se(Ne,he),de(he,Be,he),de(Be,Ce,ct),J(ct,he,Be),se(he,he,Be),Se(Ce,he),se(Be,He,Ne),de(he,Be,s),J(he,he,He),de(Be,Be,he),de(he,He,Ne),de(He,Ce,N),Se(Ce,ct),B(he,Ce,ee),B(Be,He,ee);for(ne=0;ne<16;ne++)N[ne+16]=he[ne],N[ne+32]=Be[ne],N[ne+48]=Ce[ne],N[ne+64]=He[ne];var rt=N.subarray(32),bt=N.subarray(16);return ge(rt,rt),de(bt,bt,rt),q(k,bt),0}function Fe(k,D){return Oe(k,D,o)}function $e(k,D){return r(D,32),Fe(k,D)}function be(k,D,$){var O=new Uint8Array(32);return Oe(O,$,D),E(k,i,O,C)}var yt=Z,lt=G;function It(k,D,$,O,N,ee){var ne=new Uint8Array(32);return be(ne,N,ee),yt(k,D,$,O,ne)}function mn(k,D,$,O,N,ee){var ne=new Uint8Array(32);return be(ne,N,ee),lt(k,D,$,O,ne)}var en=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function re(k,D,$,O){for(var N=new Int32Array(16),ee=new Int32Array(16),ne,he,Ce,Be,He,ct,Ne,rt,bt,At,vt,ht,xt,wt,Je,st,Qe,Le,qe,Ge,me,ve,De,Pe,Te,ze,mt=k[0],Nt=k[1],Ft=k[2],$t=k[3],te=k[4],Gt=k[5],on=k[6],an=k[7],Lt=D[0],un=D[1],tn=D[2],Kn=D[3],vn=D[4],Pn=D[5],Gn=D[6],Yn=D[7],xr=0;O>=128;){for(qe=0;qe<16;qe++)Ge=8*qe+xr,N[qe]=$[Ge+0]<<24|$[Ge+1]<<16|$[Ge+2]<<8|$[Ge+3],ee[qe]=$[Ge+4]<<24|$[Ge+5]<<16|$[Ge+6]<<8|$[Ge+7];for(qe=0;qe<80;qe++)if(ne=mt,he=Nt,Ce=Ft,Be=$t,He=te,ct=Gt,Ne=on,rt=an,bt=Lt,At=un,vt=tn,ht=Kn,xt=vn,wt=Pn,Je=Gn,st=Yn,me=an,ve=Yn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=(te>>>14|vn<<18)^(te>>>18|vn<<14)^(vn>>>9|te<<23),ve=(vn>>>14|te<<18)^(vn>>>18|te<<14)^(te>>>9|vn<<23),De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=te&Gt^~te&on,ve=vn&Pn^~vn&Gn,De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=en[qe*2],ve=en[qe*2+1],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=N[qe%16],ve=ee[qe%16],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,Qe=Te&65535|ze<<16,Le=De&65535|Pe<<16,me=Qe,ve=Le,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=(mt>>>28|Lt<<4)^(Lt>>>2|mt<<30)^(Lt>>>7|mt<<25),ve=(Lt>>>28|mt<<4)^(mt>>>2|Lt<<30)^(mt>>>7|Lt<<25),De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,me=mt&Nt^mt&Ft^Nt&Ft,ve=Lt&un^Lt&tn^un&tn,De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,rt=Te&65535|ze<<16,st=De&65535|Pe<<16,me=Be,ve=ht,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=Qe,ve=Le,De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,Be=Te&65535|ze<<16,ht=De&65535|Pe<<16,Nt=ne,Ft=he,$t=Ce,te=Be,Gt=He,on=ct,an=Ne,mt=rt,un=bt,tn=At,Kn=vt,vn=ht,Pn=xt,Gn=wt,Yn=Je,Lt=st,qe%16===15)for(Ge=0;Ge<16;Ge++)me=N[Ge],ve=ee[Ge],De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=N[(Ge+9)%16],ve=ee[(Ge+9)%16],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Qe=N[(Ge+1)%16],Le=ee[(Ge+1)%16],me=(Qe>>>1|Le<<31)^(Qe>>>8|Le<<24)^Qe>>>7,ve=(Le>>>1|Qe<<31)^(Le>>>8|Qe<<24)^(Le>>>7|Qe<<25),De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Qe=N[(Ge+14)%16],Le=ee[(Ge+14)%16],me=(Qe>>>19|Le<<13)^(Le>>>29|Qe<<3)^Qe>>>6,ve=(Le>>>19|Qe<<13)^(Qe>>>29|Le<<3)^(Le>>>6|Qe<<26),De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,N[Ge]=Te&65535|ze<<16,ee[Ge]=De&65535|Pe<<16;me=mt,ve=Lt,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[0],ve=D[0],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[0]=mt=Te&65535|ze<<16,D[0]=Lt=De&65535|Pe<<16,me=Nt,ve=un,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[1],ve=D[1],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[1]=Nt=Te&65535|ze<<16,D[1]=un=De&65535|Pe<<16,me=Ft,ve=tn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[2],ve=D[2],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[2]=Ft=Te&65535|ze<<16,D[2]=tn=De&65535|Pe<<16,me=$t,ve=Kn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[3],ve=D[3],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[3]=$t=Te&65535|ze<<16,D[3]=Kn=De&65535|Pe<<16,me=te,ve=vn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[4],ve=D[4],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[4]=te=Te&65535|ze<<16,D[4]=vn=De&65535|Pe<<16,me=Gt,ve=Pn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[5],ve=D[5],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[5]=Gt=Te&65535|ze<<16,D[5]=Pn=De&65535|Pe<<16,me=on,ve=Gn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[6],ve=D[6],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[6]=on=Te&65535|ze<<16,D[6]=Gn=De&65535|Pe<<16,me=an,ve=Yn,De=ve&65535,Pe=ve>>>16,Te=me&65535,ze=me>>>16,me=k[7],ve=D[7],De+=ve&65535,Pe+=ve>>>16,Te+=me&65535,ze+=me>>>16,Pe+=De>>>16,Te+=Pe>>>16,ze+=Te>>>16,k[7]=an=Te&65535|ze<<16,D[7]=Yn=De&65535|Pe<<16,xr+=128,O-=128}return O}function pe(k,D,$){var O=new Int32Array(8),N=new Int32Array(8),ee=new Uint8Array(256),ne,he=$;for(O[0]=1779033703,O[1]=3144134277,O[2]=1013904242,O[3]=2773480762,O[4]=1359893119,O[5]=2600822924,O[6]=528734635,O[7]=1541459225,N[0]=4089235720,N[1]=2227873595,N[2]=4271175723,N[3]=1595750129,N[4]=2917565137,N[5]=725511199,N[6]=4215389547,N[7]=327033209,re(O,N,D,$),$%=128,ne=0;ne<$;ne++)ee[ne]=D[he-$+ne];for(ee[$]=128,$=256-128*($<112?1:0),ee[$-9]=0,g(ee,$-8,he/536870912|0,he<<3),re(O,N,ee,$),ne=0;ne<8;ne++)g(k,8*ne,O[ne],N[ne]);return 0}function ye(k,D){var $=n(),O=n(),N=n(),ee=n(),ne=n(),he=n(),Ce=n(),Be=n(),He=n();se($,k[1],k[0]),se(He,D[1],D[0]),de($,$,He),J(O,k[0],k[1]),J(He,D[0],D[1]),de(O,O,He),de(N,k[3],D[3]),de(N,N,c),de(ee,k[2],D[2]),J(ee,ee,ee),se(ne,O,$),se(he,ee,N),J(Ce,ee,N),J(Be,O,$),de(k[0],ne,he),de(k[1],Be,Ce),de(k[2],Ce,he),de(k[3],ne,Be)}function Ue(k,D,$){var O;for(O=0;O<4;O++)B(k[O],D[O],$)}function je(k,D){var $=n(),O=n(),N=n();ge(N,D[2]),de($,D[0],N),de(O,D[1],N),q(k,O),k[31]^=ue($)<<7}function ke(k,D,$){var O,N;for(K(k[0],a),K(k[1],u),K(k[2],u),K(k[3],a),N=255;N>=0;--N)O=$[N/8|0]>>(N&7)&1,Ue(k,D,O),ye(D,k),ye(k,k),Ue(k,D,O)}function nt(k,D){var $=[n(),n(),n(),n()];K($[0],d),K($[1],h),K($[2],u),de($[3],d,h),ke(k,$,D)}function gt(k,D,$){var O=new Uint8Array(64),N=[n(),n(),n(),n()],ee;for($||r(D,32),pe(O,D,32),O[0]&=248,O[31]&=127,O[31]|=64,nt(N,O),je(k,N),ee=0;ee<32;ee++)D[ee+32]=k[ee];return 0}var bn=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Vt(k,D){var $,O,N,ee;for(O=63;O>=32;--O){for($=0,N=O-32,ee=O-12;N>4)*bn[N],$=D[N]>>8,D[N]&=255;for(N=0;N<32;N++)D[N]-=$*bn[N];for(O=0;O<32;O++)D[O+1]+=D[O]>>8,k[O]=D[O]&255}function xn(k){var D=new Float64Array(64),$;for($=0;$<64;$++)D[$]=k[$];for($=0;$<64;$++)k[$]=0;Vt(k,D)}function Ii(k,D,$,O){var N=new Uint8Array(64),ee=new Uint8Array(64),ne=new Uint8Array(64),he,Ce,Be=new Float64Array(64),He=[n(),n(),n(),n()];pe(N,O,32),N[0]&=248,N[31]&=127,N[31]|=64;var ct=$+64;for(he=0;he<$;he++)k[64+he]=D[he];for(he=0;he<32;he++)k[32+he]=N[32+he];for(pe(ne,k.subarray(32),$+32),xn(ne),nt(He,ne),je(k,He),he=32;he<64;he++)k[he]=O[he];for(pe(ee,k,$+64),xn(ee),he=0;he<64;he++)Be[he]=0;for(he=0;he<32;he++)Be[he]=ne[he];for(he=0;he<32;he++)for(Ce=0;Ce<32;Ce++)Be[he+Ce]+=ee[he]*N[Ce];return Vt(k.subarray(32),Be),ct}function br(k,D){var $=n(),O=n(),N=n(),ee=n(),ne=n(),he=n(),Ce=n();return K(k[2],u),Q(k[1],D),Se(N,k[1]),de(ee,N,l),se(N,N,k[2]),J(ee,k[2],ee),Se(ne,ee),Se(he,ne),de(Ce,he,ne),de($,Ce,N),de($,$,ee),Ze($,$),de($,$,N),de($,$,ee),de($,$,ee),de(k[0],$,ee),Se(O,k[0]),de(O,O,ee),Y(O,N)&&de(k[0],k[0],v),Se(O,k[0]),de(O,O,ee),Y(O,N)?-1:(ue(k[0])===D[31]>>7&&se(k[0],a,k[0]),de(k[3],k[0],k[1]),0)}function yi(k,D,$,O){var N,ee=new Uint8Array(32),ne=new Uint8Array(64),he=[n(),n(),n(),n()],Ce=[n(),n(),n(),n()];if($<64||br(Ce,O))return-1;for(N=0;N<$;N++)k[N]=D[N];for(N=0;N<32;N++)k[N+32]=O[N];if(pe(ne,k,$),xn(ne),ke(he,Ce,ne),nt(Ce,D.subarray(32)),ye(he,Ce),je(ee,he),$-=64,w(D,0,ee,0)){for(N=0;N<$;N++)k[N]=0;return-1}for(N=0;N<$;N++)k[N]=D[N+64];return $}var ar=32,ui=24,bi=32,Rr=16,Yi=32,go=32,xi=32,Dr=32,wa=32,_t=ui,dn=bi,wn=Rr,qn=64,ur=32,Zr=64,mo=32,ql=64;t.lowlevel={crypto_core_hsalsa20:E,crypto_stream_xor:U,crypto_stream:F,crypto_stream_salsa20_xor:T,crypto_stream_salsa20:M,crypto_onetimeauth:W,crypto_onetimeauth_verify:ie,crypto_verify_16:b,crypto_verify_32:w,crypto_secretbox:Z,crypto_secretbox_open:G,crypto_scalarmult:Oe,crypto_scalarmult_base:Fe,crypto_box_beforenm:be,crypto_box_afternm:yt,crypto_box:It,crypto_box_open:mn,crypto_box_keypair:$e,crypto_hash:pe,crypto_sign:Ii,crypto_sign_keypair:gt,crypto_sign_open:yi,crypto_secretbox_KEYBYTES:ar,crypto_secretbox_NONCEBYTES:ui,crypto_secretbox_ZEROBYTES:bi,crypto_secretbox_BOXZEROBYTES:Rr,crypto_scalarmult_BYTES:Yi,crypto_scalarmult_SCALARBYTES:go,crypto_box_PUBLICKEYBYTES:xi,crypto_box_SECRETKEYBYTES:Dr,crypto_box_BEFORENMBYTES:wa,crypto_box_NONCEBYTES:_t,crypto_box_ZEROBYTES:dn,crypto_box_BOXZEROBYTES:wn,crypto_sign_BYTES:qn,crypto_sign_PUBLICKEYBYTES:ur,crypto_sign_SECRETKEYBYTES:Zr,crypto_sign_SEEDBYTES:mo,crypto_hash_BYTES:ql,gf:n,D:l,L:bn,pack25519:q,unpack25519:Q,M:de,A:J,S:Se,Z:se,pow2523:Ze,add:ye,set25519:K,modL:Vt,scalarmult:ke,scalarbase:nt};function yf(k,D){if(k.length!==ar)throw new Error("bad key size");if(D.length!==ui)throw new Error("bad nonce size")}function oe(k,D){if(k.length!==xi)throw new Error("bad public key size");if(D.length!==Dr)throw new Error("bad secret key size")}function le(){for(var k=0;k=0},t.sign.keyPair=function(){var k=new Uint8Array(ur),D=new Uint8Array(Zr);return gt(k,D),{publicKey:k,secretKey:D}},t.sign.keyPair.fromSecretKey=function(k){if(le(k),k.length!==Zr)throw new Error("bad secret key size");for(var D=new Uint8Array(ur),$=0;$"u"?typeof Buffer.from<"u"?(t.encodeBase64=function(r){return Buffer.from(r).toString("base64")},t.decodeBase64=function(r){return n(r),new Uint8Array(Array.prototype.slice.call(Buffer.from(r,"base64"),0))}):(t.encodeBase64=function(r){return new Buffer(r).toString("base64")},t.decodeBase64=function(r){return n(r),new Uint8Array(Array.prototype.slice.call(new Buffer(r,"base64"),0))}):(t.encodeBase64=function(r){var i,o=[],a=r.length;for(i=0;i{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:a,disabled:u,value:s="on",onCheckedChange:l,form:c,...d}=e,[h,v]=y.useState(null),g=Kt(t,A=>v(A)),m=y.useRef(!1),b=h?c||!!h.closest("form"):!0,[w=!1,x]=Ga({prop:i,defaultProp:o,onChange:l}),S=y.useRef(w);return y.useEffect(()=>{const A=h?.form;if(A){const E=()=>x(S.current);return A.addEventListener("reset",E),()=>A.removeEventListener("reset",E)}},[h,x]),I.jsxs(Lqe,{scope:n,state:w,disabled:u,children:[I.jsx(pt.button,{type:"button",role:"checkbox","aria-checked":bl(w)?"mixed":w,"aria-required":a,"data-state":pY(w),"data-disabled":u?"":void 0,disabled:u,value:s,...d,ref:g,onKeyDown:Ye(e.onKeyDown,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:Ye(e.onClick,A=>{x(E=>bl(E)?!0:!E),b&&(m.current=A.isPropagationStopped(),m.current||A.stopPropagation())})}),b&&I.jsx(Bqe,{control:h,bubbles:!m.current,name:r,value:s,checked:w,required:a,disabled:u,form:c,style:{transform:"translateX(-100%)"},defaultChecked:bl(o)?!1:o})]})});fY.displayName=iP;var dY="CheckboxIndicator",hY=y.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=jqe(dY,n);return I.jsx(oi,{present:r||bl(o.state)||o.state===!0,children:I.jsx(pt.span,{"data-state":pY(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});hY.displayName=dY;var Bqe=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,a=y.useRef(null),u=hO(n),s=jA(t);y.useEffect(()=>{const c=a.current,d=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(d,"checked").set;if(u!==n&&v){const g=new Event("click",{bubbles:r});c.indeterminate=bl(n),v.call(c,bl(n)?!1:n),c.dispatchEvent(g)}},[u,n,r]);const l=y.useRef(bl(n)?!1:n);return I.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??l.current,...o,tabIndex:-1,ref:a,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function bl(e){return e==="indeterminate"}function pY(e){return bl(e)?"indeterminate":e?"checked":"unchecked"}var $Ze=fY,IZe=hY;export{_Ge as $,spe as A,DKe as B,BKe as C,fpe as D,dpe as E,jKe as F,bB as G,eGe as H,hKe as I,ppe as J,lpe as K,cpe as L,oKe as M,hGe as N,Uqe as O,Kqe as P,$Ke as Q,j as R,Sl as S,hpe as T,Npe as U,Fpe as V,OGe as W,XKe as X,PGe as Y,yGe as Z,bGe as _,Zqe as a,zYe as a$,SGe as a0,EGe as a1,KKe as a2,CGe as a3,nGe as a4,wGe as a5,AGe as a6,gGe as a7,mGe as a8,xGe as a9,NGe as aA,aGe as aB,fYe as aC,mKe as aD,SKe as aE,xYe as aF,wYe as aG,_Ye as aH,Yqe as aI,OYe as aJ,PYe as aK,kYe as aL,AYe as aM,MYe as aN,DYe as aO,RYe as aP,$Ye as aQ,YKe as aR,WYe as aS,QKe as aT,VYe as aU,IYe as aV,NYe as aW,FYe as aX,jYe as aY,BYe as aZ,UYe as a_,MGe as aa,$Ge as ab,RGe as ac,DGe as ad,Hqe as ae,rKe as af,uKe as ag,_Ke as ah,Qqe as ai,sKe as aj,yKe as ak,aKe as al,dKe as am,wKe as an,xKe as ao,pKe as ap,bKe as aq,nKe as ar,eKe as as,lKe as at,OKe as au,AKe as av,CKe as aw,PKe as ax,gKe as ay,iKe as az,rg as b,AZe as b$,HYe as b0,LYe as b1,GYe as b2,ZKe as b3,QYe as b4,JYe as b5,ZYe as b6,XYe as b7,qS as b8,FKe as b9,UGe as bA,jGe as bB,qYe as bC,Ui as bD,aZe as bE,uZe as bF,aYe as bG,hYe as bH,cYe as bI,nYe as bJ,XGe as bK,ZGe as bL,sZe as bM,tKe as bN,EKe as bO,vKe as bP,Jqe as bQ,cZe as bR,fZe as bS,LKe as bT,rGe as bU,iGe as bV,yZe as bW,xZe as bX,QGe as bY,BGe as bZ,EZe as b_,mf as ba,HGe as bb,SYe as bc,CYe as bd,lO as be,cO as bf,rIe as bg,Yu as bh,vf as bi,Kh as bj,KYe as bk,uYe as bl,VGe as bm,LGe as bn,WGe as bo,zGe as bp,mYe as bq,vYe as br,nZe as bs,rZe as bt,iZe as bu,GBe as bv,eze as bw,eZe as bx,sYe as by,FGe as bz,cn as c,kZe as c0,TZe as c1,OZe as c2,PZe as c3,_Ze as c4,SZe as c5,CZe as c6,oGe as c7,sGe as c8,pYe as c9,fGe as cA,GKe as cB,tGe as cC,cGe as cD,iYe as cE,KGe as cF,WBe as cG,uGe as cH,qqe as cI,JGe as cJ,qGe as cK,bZe as ca,dZe as cb,vZe as cc,gZe as cd,mZe as ce,gYe as cf,oYe as cg,GGe as ch,YGe as ci,yYe as cj,Qa as ck,yr as cl,hZe as cm,pZe as cn,lGe as co,Gc as cp,MZe as cq,RZe as cr,dYe as cs,eYe as ct,rYe as cu,lYe as cv,tYe as cw,$Ze as cx,IZe as cy,JKe as cz,Wqe as d,Kr as e,RKe as f,TKe as g,MKe as h,kKe as i,I as j,mk as k,NKe as l,Vqe as m,VKe as n,mA as o,fKe as p,cKe as q,y as r,qKe as s,Xqe as t,QF as u,HKe as v,Gqe as w,zKe as x,WKe as y,UKe as z};