function Hv(r,a){for(var l=0;li[c]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function l(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(c){if(c.ep)return;c.ep=!0;const u=l(c);fetch(c.href,u)}})();function qm(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Tc={exports:{}},Pa={},Ic={exports:{}},Fe={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Vh;function Kv(){if(Vh)return Fe;Vh=1;var r=Symbol.for("react.element"),a=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.iterator;function E(S){return S===null||typeof S!="object"?null:(S=v&&S[v]||S["@@iterator"],typeof S=="function"?S:null)}var P={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,j={};function N(S,O,se){this.props=S,this.context=O,this.refs=j,this.updater=se||P}N.prototype.isReactComponent={},N.prototype.setState=function(S,O){if(typeof S!="object"&&typeof S!="function"&&S!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,S,O,"setState")},N.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function k(){}k.prototype=N.prototype;function R(S,O,se){this.props=S,this.context=O,this.refs=j,this.updater=se||P}var b=R.prototype=new k;b.constructor=R,C(b,N.prototype),b.isPureReactComponent=!0;var T=Array.isArray,B=Object.prototype.hasOwnProperty,G={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function V(S,O,se){var oe,be={},me=null,Y=null;if(O!=null)for(oe in O.ref!==void 0&&(Y=O.ref),O.key!==void 0&&(me=""+O.key),O)B.call(O,oe)&&!M.hasOwnProperty(oe)&&(be[oe]=O[oe]);var xe=arguments.length-2;if(xe===1)be.children=se;else if(1>>1,O=A[S];if(0>>1;Sc(be,$))mec(Y,be)?(A[S]=Y,A[me]=$,S=me):(A[S]=be,A[oe]=$,S=oe);else if(mec(Y,$))A[S]=Y,A[me]=$,S=me;else break e}}return X}function c(A,X){var $=A.sortIndex-X.sortIndex;return $!==0?$:A.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;r.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();r.unstable_now=function(){return f.now()-m}}var x=[],y=[],g=1,v=null,E=3,P=!1,C=!1,j=!1,N=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(A){for(var X=l(y);X!==null;){if(X.callback===null)i(y);else if(X.startTime<=A)i(y),X.sortIndex=X.expirationTime,a(x,X);else break;X=l(y)}}function T(A){if(j=!1,b(A),!C)if(l(x)!==null)C=!0,Q(B);else{var X=l(y);X!==null&&K(T,X.startTime-A)}}function B(A,X){C=!1,j&&(j=!1,k(V),V=-1),P=!0;var $=E;try{for(b(X),v=l(x);v!==null&&(!(v.expirationTime>X)||A&&!ce());){var S=v.callback;if(typeof S=="function"){v.callback=null,E=v.priorityLevel;var O=S(v.expirationTime<=X);X=r.unstable_now(),typeof O=="function"?v.callback=O:v===l(x)&&i(x),b(X)}else i(x);v=l(x)}if(v!==null)var se=!0;else{var oe=l(y);oe!==null&&K(T,oe.startTime-X),se=!1}return se}finally{v=null,E=$,P=!1}}var G=!1,M=null,V=-1,ee=5,de=-1;function ce(){return!(r.unstable_now()-deA||125S?(A.sortIndex=$,a(y,A),l(x)===null&&A===l(y)&&(j?(k(V),V=-1):j=!0,K(T,$-S))):(A.sortIndex=O,a(x,A),C||P||(C=!0,Q(B))),A},r.unstable_shouldYield=ce,r.unstable_wrapCallback=function(A){var X=E;return function(){var $=E;E=X;try{return A.apply(this,arguments)}finally{E=$}}}})(Lc)),Lc}var Gh;function qv(){return Gh||(Gh=1,Mc.exports=Yv()),Mc.exports}/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Qh;function Xv(){if(Qh)return Ft;Qh=1;var r=Nd(),a=qv();function l(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),x=Object.prototype.hasOwnProperty,y=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,g={},v={};function E(e){return x.call(v,e)?!0:x.call(g,e)?!1:y.test(e)?v[e]=!0:(g[e]=!0,!1)}function P(e,n,s,o){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return o?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function C(e,n,s,o){if(n===null||typeof n>"u"||P(e,n,s,o))return!0;if(o)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function j(e,n,s,o,d,h,w){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=o,this.attributeNamespace=d,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=w}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){N[e]=new j(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];N[n]=new j(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){N[e]=new j(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){N[e]=new j(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){N[e]=new j(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){N[e]=new j(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){N[e]=new j(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){N[e]=new j(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){N[e]=new j(e,5,!1,e.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function R(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(k,R);N[n]=new j(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(k,R);N[n]=new j(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(k,R);N[n]=new j(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){N[e]=new j(e,1,!1,e.toLowerCase(),null,!1,!1)}),N.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){N[e]=new j(e,1,!1,e.toLowerCase(),null,!0,!0)});function b(e,n,s,o){var d=N.hasOwnProperty(n)?N[n]:null;(d!==null?d.type!==0:o||!(2_||d[w]!==h[_]){var L=` `+d[w].replace(" at new "," at ");return e.displayName&&L.includes("")&&(L=L.replace("",e.displayName)),L}while(1<=w&&0<=_);break}}}finally{se=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?O(e):""}function be(e){switch(e.tag){case 5:return O(e.type);case 16:return O("Lazy");case 13:return O("Suspense");case 19:return O("SuspenseList");case 0:case 2:case 15:return e=oe(e.type,!1),e;case 11:return e=oe(e.type.render,!1),e;case 1:return e=oe(e.type,!0),e;default:return""}}function me(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case G:return"Portal";case ee:return"Profiler";case V:return"StrictMode";case ue:return"Suspense";case H:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ce:return(e.displayName||"Context")+".Consumer";case de:return(e._context.displayName||"Context")+".Provider";case le:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case W:return n=e.displayName||null,n!==null?n:me(e.type)||"Memo";case Q:n=e._payload,e=e._init;try{return me(e(n))}catch{}}return null}function Y(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(n);case 8:return n===V?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function xe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function I(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function re(e){var n=I(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),o=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var d=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(w){o=""+w,h.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function fe(e){e._valueTracker||(e._valueTracker=re(e))}function Ee(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),o="";return e&&(o=I(e)?e.checked?"true":"false":e.value),e=o,e!==s?(n.setValue(e),!0):!1}function Ie(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function De(e,n){var s=n.checked;return $({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Ye(e,n){var s=n.defaultValue==null?"":n.defaultValue,o=n.checked!=null?n.checked:n.defaultChecked;s=xe(n.value!=null?n.value:s),e._wrapperState={initialChecked:o,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function tt(e,n){n=n.checked,n!=null&&b(e,"checked",n,!1)}function Ze(e,n){tt(e,n);var s=xe(n.value),o=n.type;if(s!=null)o==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(o==="submit"||o==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?It(e,n.type,s):n.hasOwnProperty("defaultValue")&&It(e,n.type,xe(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Tt(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var o=n.type;if(!(o!=="submit"&&o!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function It(e,n,s){(n!=="number"||Ie(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Nr=Array.isArray;function Un(e,n,s,o){if(e=e.options,n){n={};for(var d=0;d"+n.valueOf().toString()+"",n=ze.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function sn(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Sr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Yg=["Webkit","ms","Moz","O"];Object.keys(Sr).forEach(function(e){Yg.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Sr[n]=Sr[e]})});function nu(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Sr.hasOwnProperty(e)&&Sr[e]?(""+n).trim():n+"px"}function ru(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var o=s.indexOf("--")===0,d=nu(s,n[s],o);s==="float"&&(s="cssFloat"),o?e.setProperty(s,d):e[s]=d}}var qg=$({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Uo(e,n){if(n){if(qg[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(l(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(l(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(l(61))}if(n.style!=null&&typeof n.style!="object")throw Error(l(62))}}function Wo(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ho=null;function Ko(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Go=null,Xr=null,Jr=null;function su(e){if(e=ha(e)){if(typeof Go!="function")throw Error(l(280));var n=e.stateNode;n&&(n=il(n),Go(e.stateNode,e.type,n))}}function au(e){Xr?Jr?Jr.push(e):Jr=[e]:Xr=e}function lu(){if(Xr){var e=Xr,n=Jr;if(Jr=Xr=null,su(e),n)for(e=0;e>>=0,e===0?32:31-(o0(e)/i0|0)|0}var Wa=64,Ha=4194304;function Ys(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ka(e,n){var s=e.pendingLanes;if(s===0)return 0;var o=0,d=e.suspendedLanes,h=e.pingedLanes,w=s&268435455;if(w!==0){var _=w&~d;_!==0?o=Ys(_):(h&=w,h!==0&&(o=Ys(h)))}else w=s&~d,w!==0?o=Ys(w):h!==0&&(o=Ys(h));if(o===0)return 0;if(n!==0&&n!==o&&(n&d)===0&&(d=o&-o,h=n&-n,d>=h||d===16&&(h&4194240)!==0))return n;if((o&4)!==0&&(o|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=o;0s;s++)n.push(e);return n}function qs(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-an(n),e[n]=s}function f0(e,n){var s=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var o=e.eventTimes;for(e=e.expirationTimes;0=sa),Mu=" ",Lu=!1;function Ou(e,n){switch(e){case"keyup":return $0.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Du(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ts=!1;function V0(e,n){switch(e){case"compositionend":return Du(n);case"keypress":return n.which!==32?null:(Lu=!0,Mu);case"textInput":return e=n.data,e===Mu&&Lu?null:e;default:return null}}function U0(e,n){if(ts)return e==="compositionend"||!ui&&Ou(e,n)?(e=Pu(),Xa=ai=Qn=null,ts=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-e};e=o}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Wu(s)}}function Ku(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Ku(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Gu(){for(var e=window,n=Ie();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=Ie(e.document)}return n}function mi(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function J0(e){var n=Gu(),s=e.focusedElem,o=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&Ku(s.ownerDocument.documentElement,s)){if(o!==null&&mi(s)){if(n=o.start,e=o.end,e===void 0&&(e=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(e,s.value.length);else if(e=(n=s.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var d=s.textContent.length,h=Math.min(o.start,d);o=o.end===void 0?h:Math.min(o.end,d),!e.extend&&h>o&&(d=o,o=h,h=d),d=Hu(s,h);var w=Hu(s,o);d&&w&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==w.node||e.focusOffset!==w.offset)&&(n=n.createRange(),n.setStart(d.node,d.offset),e.removeAllRanges(),h>o?(e.addRange(n),e.extend(w.node,w.offset)):(n.setEnd(w.node,w.offset),e.addRange(n)))}}for(n=[],e=s;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,ns=null,pi=null,ia=null,xi=!1;function Qu(e,n,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;xi||ns==null||ns!==Ie(o)||(o=ns,"selectionStart"in o&&mi(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),ia&&oa(ia,o)||(ia=o,o=al(pi,"onSelect"),0os||(e.current=Pi[os],Pi[os]=null,os--)}function qe(e,n){os++,Pi[os]=e.current,e.current=n}var Jn={},Nt=Xn(Jn),At=Xn(!1),Er=Jn;function is(e,n){var s=e.type.contextTypes;if(!s)return Jn;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===n)return o.__reactInternalMemoizedMaskedChildContext;var d={},h;for(h in s)d[h]=n[h];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=d),d}function Mt(e){return e=e.childContextTypes,e!=null}function cl(){Je(At),Je(Nt)}function df(e,n,s){if(Nt.current!==Jn)throw Error(l(168));qe(Nt,n),qe(At,s)}function uf(e,n,s){var o=e.stateNode;if(n=n.childContextTypes,typeof o.getChildContext!="function")return s;o=o.getChildContext();for(var d in o)if(!(d in n))throw Error(l(108,Y(e)||"Unknown",d));return $({},s,o)}function dl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Jn,Er=Nt.current,qe(Nt,e),qe(At,At.current),!0}function ff(e,n,s){var o=e.stateNode;if(!o)throw Error(l(169));s?(e=uf(e,n,Er),o.__reactInternalMemoizedMergedChildContext=e,Je(At),Je(Nt),qe(Nt,e)):Je(At),qe(At,s)}var Tn=null,ul=!1,Ri=!1;function hf(e){Tn===null?Tn=[e]:Tn.push(e)}function dv(e){ul=!0,hf(e)}function Zn(){if(!Ri&&Tn!==null){Ri=!0;var e=0,n=Qe;try{var s=Tn;for(Qe=1;e>=w,d-=w,In=1<<32-an(n)+d|s<_e?(vt=Re,Re=null):vt=Re.sibling;var We=J(F,Re,z[_e],ae);if(We===null){Re===null&&(Re=vt);break}e&&Re&&We.alternate===null&&n(F,Re),D=h(We,D,_e),Pe===null?Se=We:Pe.sibling=We,Pe=We,Re=vt}if(_e===z.length)return s(F,Re),et&&Rr(F,_e),Se;if(Re===null){for(;_e_e?(vt=Re,Re=null):vt=Re.sibling;var ir=J(F,Re,We.value,ae);if(ir===null){Re===null&&(Re=vt);break}e&&Re&&ir.alternate===null&&n(F,Re),D=h(ir,D,_e),Pe===null?Se=ir:Pe.sibling=ir,Pe=ir,Re=vt}if(We.done)return s(F,Re),et&&Rr(F,_e),Se;if(Re===null){for(;!We.done;_e++,We=z.next())We=te(F,We.value,ae),We!==null&&(D=h(We,D,_e),Pe===null?Se=We:Pe.sibling=We,Pe=We);return et&&Rr(F,_e),Se}for(Re=o(F,Re);!We.done;_e++,We=z.next())We=pe(Re,F,_e,We.value,ae),We!==null&&(e&&We.alternate!==null&&Re.delete(We.key===null?_e:We.key),D=h(We,D,_e),Pe===null?Se=We:Pe.sibling=We,Pe=We);return e&&Re.forEach(function(Wv){return n(F,Wv)}),et&&Rr(F,_e),Se}function ot(F,D,z,ae){if(typeof z=="object"&&z!==null&&z.type===M&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case B:e:{for(var Se=z.key,Pe=D;Pe!==null;){if(Pe.key===Se){if(Se=z.type,Se===M){if(Pe.tag===7){s(F,Pe.sibling),D=d(Pe,z.props.children),D.return=F,F=D;break e}}else if(Pe.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===Q&&yf(Se)===Pe.type){s(F,Pe.sibling),D=d(Pe,z.props),D.ref=ma(F,Pe,z),D.return=F,F=D;break e}s(F,Pe);break}else n(F,Pe);Pe=Pe.sibling}z.type===M?(D=Dr(z.props.children,F.mode,ae,z.key),D.return=F,F=D):(ae=zl(z.type,z.key,z.props,null,F.mode,ae),ae.ref=ma(F,D,z),ae.return=F,F=ae)}return w(F);case G:e:{for(Pe=z.key;D!==null;){if(D.key===Pe)if(D.tag===4&&D.stateNode.containerInfo===z.containerInfo&&D.stateNode.implementation===z.implementation){s(F,D.sibling),D=d(D,z.children||[]),D.return=F,F=D;break e}else{s(F,D);break}else n(F,D);D=D.sibling}D=kc(z,F.mode,ae),D.return=F,F=D}return w(F);case Q:return Pe=z._init,ot(F,D,Pe(z._payload),ae)}if(Nr(z))return ve(F,D,z,ae);if(X(z))return Ne(F,D,z,ae);pl(F,z)}return typeof z=="string"&&z!==""||typeof z=="number"?(z=""+z,D!==null&&D.tag===6?(s(F,D.sibling),D=d(D,z),D.return=F,F=D):(s(F,D),D=Cc(z,F.mode,ae),D.return=F,F=D),w(F)):s(F,D)}return ot}var fs=wf(!0),jf=wf(!1),xl=Xn(null),gl=null,hs=null,Li=null;function Oi(){Li=hs=gl=null}function Di(e){var n=xl.current;Je(xl),e._currentValue=n}function Fi(e,n,s){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===s)break;e=e.return}}function ms(e,n){gl=e,Li=hs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(Lt=!0),e.firstContext=null)}function Yt(e){var n=e._currentValue;if(Li!==e)if(e={context:e,memoizedValue:n,next:null},hs===null){if(gl===null)throw Error(l(308));hs=e,gl.dependencies={lanes:0,firstContext:e}}else hs=hs.next=e;return n}var _r=null;function zi(e){_r===null?_r=[e]:_r.push(e)}function bf(e,n,s,o){var d=n.interleaved;return d===null?(s.next=s,zi(n)):(s.next=d.next,d.next=s),n.interleaved=s,Mn(e,o)}function Mn(e,n){e.lanes|=n;var s=e.alternate;for(s!==null&&(s.lanes|=n),s=e,e=e.return;e!==null;)e.childLanes|=n,s=e.alternate,s!==null&&(s.childLanes|=n),s=e,e=e.return;return s.tag===3?s.stateNode:null}var er=!1;function $i(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ln(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function tr(e,n,s){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Ue&2)!==0){var d=o.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),o.pending=n,Mn(e,s)}return d=o.interleaved,d===null?(n.next=n,zi(o)):(n.next=d.next,d.next=n),o.interleaved=n,Mn(e,s)}function vl(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var o=n.lanes;o&=e.pendingLanes,s|=o,n.lanes=s,ei(e,s)}}function Sf(e,n){var s=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,s===o)){var d=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var w={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};h===null?d=h=w:h=h.next=w,s=s.next}while(s!==null);h===null?d=h=n:h=h.next=n}else d=h=n;s={baseState:o.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:o.shared,effects:o.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function yl(e,n,s,o){var d=e.updateQueue;er=!1;var h=d.firstBaseUpdate,w=d.lastBaseUpdate,_=d.shared.pending;if(_!==null){d.shared.pending=null;var L=_,U=L.next;L.next=null,w===null?h=U:w.next=U,w=L;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,_=Z.lastBaseUpdate,_!==w&&(_===null?Z.firstBaseUpdate=U:_.next=U,Z.lastBaseUpdate=L))}if(h!==null){var te=d.baseState;w=0,Z=U=L=null,_=h;do{var J=_.lane,pe=_.eventTime;if((o&J)===J){Z!==null&&(Z=Z.next={eventTime:pe,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var ve=e,Ne=_;switch(J=n,pe=s,Ne.tag){case 1:if(ve=Ne.payload,typeof ve=="function"){te=ve.call(pe,te,J);break e}te=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Ne.payload,J=typeof ve=="function"?ve.call(pe,te,J):ve,J==null)break e;te=$({},te,J);break e;case 2:er=!0}}_.callback!==null&&_.lane!==0&&(e.flags|=64,J=d.effects,J===null?d.effects=[_]:J.push(_))}else pe={eventTime:pe,lane:J,tag:_.tag,payload:_.payload,callback:_.callback,next:null},Z===null?(U=Z=pe,L=te):Z=Z.next=pe,w|=J;if(_=_.next,_===null){if(_=d.shared.pending,_===null)break;J=_,_=J.next,J.next=null,d.lastBaseUpdate=J,d.shared.pending=null}}while(!0);if(Z===null&&(L=te),d.baseState=L,d.firstBaseUpdate=U,d.lastBaseUpdate=Z,n=d.shared.interleaved,n!==null){d=n;do w|=d.lane,d=d.next;while(d!==n)}else h===null&&(d.shared.lanes=0);Ar|=w,e.lanes=w,e.memoizedState=te}}function Cf(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var o=Hi.transition;Hi.transition={};try{e(!1),n()}finally{Qe=s,Hi.transition=o}}function Wf(){return qt().memoizedState}function mv(e,n,s){var o=ar(e);if(s={lane:o,action:s,hasEagerState:!1,eagerState:null,next:null},Hf(e))Kf(n,s);else if(s=bf(e,n,s,o),s!==null){var d=Rt();fn(s,e,o,d),Gf(s,n,o)}}function pv(e,n,s){var o=ar(e),d={lane:o,action:s,hasEagerState:!1,eagerState:null,next:null};if(Hf(e))Kf(n,d);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var w=n.lastRenderedState,_=h(w,s);if(d.hasEagerState=!0,d.eagerState=_,ln(_,w)){var L=n.interleaved;L===null?(d.next=d,zi(n)):(d.next=L.next,L.next=d),n.interleaved=d;return}}catch{}finally{}s=bf(e,n,d,o),s!==null&&(d=Rt(),fn(s,e,o,d),Gf(s,n,o))}}function Hf(e){var n=e.alternate;return e===rt||n!==null&&n===rt}function Kf(e,n){va=bl=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function Gf(e,n,s){if((s&4194240)!==0){var o=n.lanes;o&=e.pendingLanes,s|=o,n.lanes=s,ei(e,s)}}var Cl={readContext:Yt,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useInsertionEffect:St,useLayoutEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useMutableSource:St,useSyncExternalStore:St,useId:St,unstable_isNewReconciler:!1},xv={readContext:Yt,useCallback:function(e,n){return bn().memoizedState=[e,n===void 0?null:n],e},useContext:Yt,useEffect:Of,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Nl(4194308,4,zf.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Nl(4194308,4,e,n)},useInsertionEffect:function(e,n){return Nl(4,2,e,n)},useMemo:function(e,n){var s=bn();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var o=bn();return n=s!==void 0?s(n):n,o.memoizedState=o.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},o.queue=e,e=e.dispatch=mv.bind(null,rt,e),[o.memoizedState,e]},useRef:function(e){var n=bn();return e={current:e},n.memoizedState=e},useState:Mf,useDebugValue:Ji,useDeferredValue:function(e){return bn().memoizedState=e},useTransition:function(){var e=Mf(!1),n=e[0];return e=hv.bind(null,e[1]),bn().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var o=rt,d=bn();if(et){if(s===void 0)throw Error(l(407));s=s()}else{if(s=n(),gt===null)throw Error(l(349));(Ir&30)!==0||Rf(o,n,s)}d.memoizedState=s;var h={value:s,getSnapshot:n};return d.queue=h,Of(Tf.bind(null,o,h,e),[e]),o.flags|=2048,ja(9,_f.bind(null,o,h,s,n),void 0,null),s},useId:function(){var e=bn(),n=gt.identifierPrefix;if(et){var s=An,o=In;s=(o&~(1<<32-an(o)-1)).toString(32)+s,n=":"+n+"R"+s,s=ya++,0<\/script>",e=e.removeChild(e.firstChild)):typeof o.is=="string"?e=w.createElement(s,{is:o.is}):(e=w.createElement(s),s==="select"&&(w=e,o.multiple?w.multiple=!0:o.size&&(w.size=o.size))):e=w.createElementNS(e,s),e[wn]=n,e[fa]=o,hh(e,n,!1,!1),n.stateNode=e;e:{switch(w=Wo(s,o),s){case"dialog":Xe("cancel",e),Xe("close",e),d=o;break;case"iframe":case"object":case"embed":Xe("load",e),d=o;break;case"video":case"audio":for(d=0;dys&&(n.flags|=128,o=!0,ba(h,!1),n.lanes=4194304)}else{if(!o)if(e=wl(w),e!==null){if(n.flags|=128,o=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),ba(h,!0),h.tail===null&&h.tailMode==="hidden"&&!w.alternate&&!et)return Ct(n),null}else 2*lt()-h.renderingStartTime>ys&&s!==1073741824&&(n.flags|=128,o=!0,ba(h,!1),n.lanes=4194304);h.isBackwards?(w.sibling=n.child,n.child=w):(s=h.last,s!==null?s.sibling=w:n.child=w,h.last=w)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=lt(),n.sibling=null,s=nt.current,qe(nt,o?s&1|2:s&1),n):(Ct(n),null);case 22:case 23:return bc(),o=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(n.flags|=8192),o&&(n.mode&1)!==0?(Vt&1073741824)!==0&&(Ct(n),n.subtreeFlags&6&&(n.flags|=8192)):Ct(n),null;case 24:return null;case 25:return null}throw Error(l(156,n.tag))}function Sv(e,n){switch(Ti(n),n.tag){case 1:return Mt(n.type)&&cl(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ps(),Je(At),Je(Nt),Wi(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return Vi(n),null;case 13:if(Je(nt),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(l(340));us()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Je(nt),null;case 4:return ps(),null;case 10:return Di(n.type._context),null;case 22:case 23:return bc(),null;case 24:return null;default:return null}}var Rl=!1,kt=!1,Cv=typeof WeakSet=="function"?WeakSet:Set,ge=null;function gs(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(o){at(e,n,o)}else s.current=null}function dc(e,n,s){try{s()}catch(o){at(e,n,o)}}var xh=!1;function kv(e,n){if(bi=Ya,e=Gu(),mi(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var o=s.getSelection&&s.getSelection();if(o&&o.rangeCount!==0){s=o.anchorNode;var d=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var w=0,_=-1,L=-1,U=0,Z=0,te=e,J=null;t:for(;;){for(var pe;te!==s||d!==0&&te.nodeType!==3||(_=w+d),te!==h||o!==0&&te.nodeType!==3||(L=w+o),te.nodeType===3&&(w+=te.nodeValue.length),(pe=te.firstChild)!==null;)J=te,te=pe;for(;;){if(te===e)break t;if(J===s&&++U===d&&(_=w),J===h&&++Z===o&&(L=w),(pe=te.nextSibling)!==null)break;te=J,J=te.parentNode}te=pe}s=_===-1||L===-1?null:{start:_,end:L}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ni={focusedElem:e,selectionRange:s},Ya=!1,ge=n;ge!==null;)if(n=ge,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ge=e;else for(;ge!==null;){n=ge;try{var ve=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(ve!==null){var Ne=ve.memoizedProps,ot=ve.memoizedState,F=n.stateNode,D=F.getSnapshotBeforeUpdate(n.elementType===n.type?Ne:cn(n.type,Ne),ot);F.__reactInternalSnapshotBeforeUpdate=D}break;case 3:var z=n.stateNode.containerInfo;z.nodeType===1?z.textContent="":z.nodeType===9&&z.documentElement&&z.removeChild(z.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(ae){at(n,n.return,ae)}if(e=n.sibling,e!==null){e.return=n.return,ge=e;break}ge=n.return}return ve=xh,xh=!1,ve}function Na(e,n,s){var o=n.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var d=o=o.next;do{if((d.tag&e)===e){var h=d.destroy;d.destroy=void 0,h!==void 0&&dc(n,s,h)}d=d.next}while(d!==o)}}function _l(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var o=s.create;s.destroy=o()}s=s.next}while(s!==n)}}function uc(e){var n=e.ref;if(n!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof n=="function"?n(e):n.current=e}}function gh(e){var n=e.alternate;n!==null&&(e.alternate=null,gh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[wn],delete n[fa],delete n[Ei],delete n[iv],delete n[cv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function vh(e){return e.tag===5||e.tag===3||e.tag===4}function yh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function fc(e,n,s){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(e,n):s.insertBefore(e,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(e,s)):(n=s,n.appendChild(e)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=ol));else if(o!==4&&(e=e.child,e!==null))for(fc(e,n,s),e=e.sibling;e!==null;)fc(e,n,s),e=e.sibling}function hc(e,n,s){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(o!==4&&(e=e.child,e!==null))for(hc(e,n,s),e=e.sibling;e!==null;)hc(e,n,s),e=e.sibling}var wt=null,dn=!1;function nr(e,n,s){for(s=s.child;s!==null;)wh(e,n,s),s=s.sibling}function wh(e,n,s){if(yn&&typeof yn.onCommitFiberUnmount=="function")try{yn.onCommitFiberUnmount(Ua,s)}catch{}switch(s.tag){case 5:kt||gs(s,n);case 6:var o=wt,d=dn;wt=null,nr(e,n,s),wt=o,dn=d,wt!==null&&(dn?(e=wt,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):wt.removeChild(s.stateNode));break;case 18:wt!==null&&(dn?(e=wt,s=s.stateNode,e.nodeType===8?ki(e.parentNode,s):e.nodeType===1&&ki(e,s),ta(e)):ki(wt,s.stateNode));break;case 4:o=wt,d=dn,wt=s.stateNode.containerInfo,dn=!0,nr(e,n,s),wt=o,dn=d;break;case 0:case 11:case 14:case 15:if(!kt&&(o=s.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){d=o=o.next;do{var h=d,w=h.destroy;h=h.tag,w!==void 0&&((h&2)!==0||(h&4)!==0)&&dc(s,n,w),d=d.next}while(d!==o)}nr(e,n,s);break;case 1:if(!kt&&(gs(s,n),o=s.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=s.memoizedProps,o.state=s.memoizedState,o.componentWillUnmount()}catch(_){at(s,n,_)}nr(e,n,s);break;case 21:nr(e,n,s);break;case 22:s.mode&1?(kt=(o=kt)||s.memoizedState!==null,nr(e,n,s),kt=o):nr(e,n,s);break;default:nr(e,n,s)}}function jh(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Cv),n.forEach(function(o){var d=Lv.bind(null,e,o);s.has(o)||(s.add(o),o.then(d,d))})}}function un(e,n){var s=n.deletions;if(s!==null)for(var o=0;od&&(d=w),o&=~h}if(o=d,o=lt()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*Pv(o/1960))-o,10e?16:e,sr===null)var o=!1;else{if(e=sr,sr=null,Ll=0,(Ue&6)!==0)throw Error(l(331));var d=Ue;for(Ue|=4,ge=e.current;ge!==null;){var h=ge,w=h.child;if((ge.flags&16)!==0){var _=h.deletions;if(_!==null){for(var L=0;L<_.length;L++){var U=_[L];for(ge=U;ge!==null;){var Z=ge;switch(Z.tag){case 0:case 11:case 15:Na(8,Z,h)}var te=Z.child;if(te!==null)te.return=Z,ge=te;else for(;ge!==null;){Z=ge;var J=Z.sibling,pe=Z.return;if(gh(Z),Z===U){ge=null;break}if(J!==null){J.return=pe,ge=J;break}ge=pe}}}var ve=h.alternate;if(ve!==null){var Ne=ve.child;if(Ne!==null){ve.child=null;do{var ot=Ne.sibling;Ne.sibling=null,Ne=ot}while(Ne!==null)}}ge=h}}if((h.subtreeFlags&2064)!==0&&w!==null)w.return=h,ge=w;else e:for(;ge!==null;){if(h=ge,(h.flags&2048)!==0)switch(h.tag){case 0:case 11:case 15:Na(9,h,h.return)}var F=h.sibling;if(F!==null){F.return=h.return,ge=F;break e}ge=h.return}}var D=e.current;for(ge=D;ge!==null;){w=ge;var z=w.child;if((w.subtreeFlags&2064)!==0&&z!==null)z.return=w,ge=z;else e:for(w=D;ge!==null;){if(_=ge,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:_l(9,_)}}catch(Se){at(_,_.return,Se)}if(_===w){ge=null;break e}var ae=_.sibling;if(ae!==null){ae.return=_.return,ge=ae;break e}ge=_.return}}if(Ue=d,Zn(),yn&&typeof yn.onPostCommitFiberRoot=="function")try{yn.onPostCommitFiberRoot(Ua,e)}catch{}o=!0}return o}finally{Qe=s,Xt.transition=n}}return!1}function Ah(e,n,s){n=xs(s,n),n=Xf(e,n,1),e=tr(e,n,1),n=Rt(),e!==null&&(qs(e,1,n),Dt(e,n))}function at(e,n,s){if(e.tag===3)Ah(e,e,s);else for(;n!==null;){if(n.tag===3){Ah(n,e,s);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(rr===null||!rr.has(o))){e=xs(s,e),e=Jf(n,e,1),n=tr(n,e,1),e=Rt(),n!==null&&(qs(n,1,e),Dt(n,e));break}}n=n.return}}function Av(e,n,s){var o=e.pingCache;o!==null&&o.delete(n),n=Rt(),e.pingedLanes|=e.suspendedLanes&s,gt===e&&(jt&s)===s&&(mt===4||mt===3&&(jt&130023424)===jt&&500>lt()-xc?Lr(e,0):pc|=s),Dt(e,n)}function Mh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Ha,Ha<<=1,(Ha&130023424)===0&&(Ha=4194304)));var s=Rt();e=Mn(e,n),e!==null&&(qs(e,n,s),Dt(e,s))}function Mv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Mh(e,s)}function Lv(e,n){var s=0;switch(e.tag){case 13:var o=e.stateNode,d=e.memoizedState;d!==null&&(s=d.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(l(314))}o!==null&&o.delete(n),Mh(e,s)}var Lh;Lh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||At.current)Lt=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return Lt=!1,bv(e,n,s);Lt=(e.flags&131072)!==0}else Lt=!1,et&&(n.flags&1048576)!==0&&mf(n,hl,n.index);switch(n.lanes=0,n.tag){case 2:var o=n.type;Pl(e,n),e=n.pendingProps;var d=is(n,Nt.current);ms(n,s),d=Gi(null,n,o,e,d,s);var h=Qi();return n.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Mt(o)?(h=!0,dl(n)):h=!1,n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,$i(n),d.updater=kl,n.stateNode=d,d._reactInternals=n,ec(n,o,e,s),n=sc(null,n,o,!0,h,s)):(n.tag=0,et&&h&&_i(n),Pt(null,n,d,s),n=n.child),n;case 16:o=n.elementType;e:{switch(Pl(e,n),e=n.pendingProps,d=o._init,o=d(o._payload),n.type=o,d=n.tag=Dv(o),e=cn(o,e),d){case 0:n=rc(null,n,o,e,s);break e;case 1:n=oh(null,n,o,e,s);break e;case 11:n=nh(null,n,o,e,s);break e;case 14:n=rh(null,n,o,cn(o.type,e),s);break e}throw Error(l(306,o,""))}return n;case 0:return o=n.type,d=n.pendingProps,d=n.elementType===o?d:cn(o,d),rc(e,n,o,d,s);case 1:return o=n.type,d=n.pendingProps,d=n.elementType===o?d:cn(o,d),oh(e,n,o,d,s);case 3:e:{if(ih(n),e===null)throw Error(l(387));o=n.pendingProps,h=n.memoizedState,d=h.element,Nf(e,n),yl(n,o,null,s);var w=n.memoizedState;if(o=w.element,h.isDehydrated)if(h={element:o,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){d=xs(Error(l(423)),n),n=ch(e,n,o,s,d);break e}else if(o!==d){d=xs(Error(l(424)),n),n=ch(e,n,o,s,d);break e}else for(Bt=qn(n.stateNode.containerInfo.firstChild),$t=n,et=!0,on=null,s=jf(n,null,o,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(us(),o===d){n=On(e,n,s);break e}Pt(e,n,o,s)}n=n.child}return n;case 5:return kf(n),e===null&&Ai(n),o=n.type,d=n.pendingProps,h=e!==null?e.memoizedProps:null,w=d.children,Si(o,d)?w=null:h!==null&&Si(o,h)&&(n.flags|=32),lh(e,n),Pt(e,n,w,s),n.child;case 6:return e===null&&Ai(n),null;case 13:return dh(e,n,s);case 4:return Bi(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=fs(n,null,o,s):Pt(e,n,o,s),n.child;case 11:return o=n.type,d=n.pendingProps,d=n.elementType===o?d:cn(o,d),nh(e,n,o,d,s);case 7:return Pt(e,n,n.pendingProps,s),n.child;case 8:return Pt(e,n,n.pendingProps.children,s),n.child;case 12:return Pt(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(o=n.type._context,d=n.pendingProps,h=n.memoizedProps,w=d.value,qe(xl,o._currentValue),o._currentValue=w,h!==null)if(ln(h.value,w)){if(h.children===d.children&&!At.current){n=On(e,n,s);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var _=h.dependencies;if(_!==null){w=h.child;for(var L=_.firstContext;L!==null;){if(L.context===o){if(h.tag===1){L=Ln(-1,s&-s),L.tag=2;var U=h.updateQueue;if(U!==null){U=U.shared;var Z=U.pending;Z===null?L.next=L:(L.next=Z.next,Z.next=L),U.pending=L}}h.lanes|=s,L=h.alternate,L!==null&&(L.lanes|=s),Fi(h.return,s,n),_.lanes|=s;break}L=L.next}}else if(h.tag===10)w=h.type===n.type?null:h.child;else if(h.tag===18){if(w=h.return,w===null)throw Error(l(341));w.lanes|=s,_=w.alternate,_!==null&&(_.lanes|=s),Fi(w,s,n),w=h.sibling}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===n){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}Pt(e,n,d.children,s),n=n.child}return n;case 9:return d=n.type,o=n.pendingProps.children,ms(n,s),d=Yt(d),o=o(d),n.flags|=1,Pt(e,n,o,s),n.child;case 14:return o=n.type,d=cn(o,n.pendingProps),d=cn(o.type,d),rh(e,n,o,d,s);case 15:return sh(e,n,n.type,n.pendingProps,s);case 17:return o=n.type,d=n.pendingProps,d=n.elementType===o?d:cn(o,d),Pl(e,n),n.tag=1,Mt(o)?(e=!0,dl(n)):e=!1,ms(n,s),Yf(n,o,d),ec(n,o,d,s),sc(null,n,o,!0,e,s);case 19:return fh(e,n,s);case 22:return ah(e,n,s)}throw Error(l(156,n.tag))};function Oh(e,n){return mu(e,n)}function Ov(e,n,s,o){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jt(e,n,s,o){return new Ov(e,n,s,o)}function Sc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Dv(e){if(typeof e=="function")return Sc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===le)return 11;if(e===W)return 14}return 2}function or(e,n){var s=e.alternate;return s===null?(s=Jt(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function zl(e,n,s,o,d,h){var w=2;if(o=e,typeof e=="function")Sc(e)&&(w=1);else if(typeof e=="string")w=5;else e:switch(e){case M:return Dr(s.children,d,h,n);case V:w=8,d|=8;break;case ee:return e=Jt(12,s,n,d|2),e.elementType=ee,e.lanes=h,e;case ue:return e=Jt(13,s,n,d),e.elementType=ue,e.lanes=h,e;case H:return e=Jt(19,s,n,d),e.elementType=H,e.lanes=h,e;case K:return $l(s,d,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:w=10;break e;case ce:w=9;break e;case le:w=11;break e;case W:w=14;break e;case Q:w=16,o=null;break e}throw Error(l(130,e==null?e:typeof e,""))}return n=Jt(w,s,n,d),n.elementType=e,n.type=o,n.lanes=h,n}function Dr(e,n,s,o){return e=Jt(7,e,o,n),e.lanes=s,e}function $l(e,n,s,o){return e=Jt(22,e,o,n),e.elementType=K,e.lanes=s,e.stateNode={isHidden:!1},e}function Cc(e,n,s){return e=Jt(6,e,null,n),e.lanes=s,e}function kc(e,n,s){return n=Jt(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Fv(e,n,s,o,d){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Zo(0),this.expirationTimes=Zo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zo(0),this.identifierPrefix=o,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function Ec(e,n,s,o,d,h,w,_,L){return e=new Fv(e,n,s,_,L),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Jt(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:o,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},$i(h),e}function zv(e,n,s){var o=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(a){console.error(a)}}return r(),Ac.exports=Xv(),Ac.exports}var qh;function Jv(){if(qh)return Gl;qh=1;var r=Xm();return Gl.createRoot=r.createRoot,Gl.hydrateRoot=r.hydrateRoot,Gl}var Zv=Jv(),La=Xm();const ey=qm(La);/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Ta(){return Ta=Object.assign?Object.assign.bind():function(r){for(var a=1;a"u")throw new Error(a)}function Sd(r,a){if(!r){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function ny(){return Math.random().toString(36).substr(2,8)}function Jh(r,a){return{usr:r.state,key:r.key,idx:a}}function Jc(r,a,l,i){return l===void 0&&(l=null),Ta({pathname:typeof r=="string"?r:r.pathname,search:"",hash:""},typeof a=="string"?Ts(a):a,{state:l,key:a&&a.key||i||ny()})}function co(r){let{pathname:a="/",search:l="",hash:i=""}=r;return l&&l!=="?"&&(a+=l.charAt(0)==="?"?l:"?"+l),i&&i!=="#"&&(a+=i.charAt(0)==="#"?i:"#"+i),a}function Ts(r){let a={};if(r){let l=r.indexOf("#");l>=0&&(a.hash=r.substr(l),r=r.substr(0,l));let i=r.indexOf("?");i>=0&&(a.search=r.substr(i),r=r.substr(0,i)),r&&(a.pathname=r)}return a}function ry(r,a,l,i){i===void 0&&(i={});let{window:c=document.defaultView,v5Compat:u=!1}=i,f=c.history,m=hr.Pop,x=null,y=g();y==null&&(y=0,f.replaceState(Ta({},f.state,{idx:y}),""));function g(){return(f.state||{idx:null}).idx}function v(){m=hr.Pop;let N=g(),k=N==null?null:N-y;y=N,x&&x({action:m,location:j.location,delta:k})}function E(N,k){m=hr.Push;let R=Jc(j.location,N,k);y=g()+1;let b=Jh(R,y),T=j.createHref(R);try{f.pushState(b,"",T)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;c.location.assign(T)}u&&x&&x({action:m,location:j.location,delta:1})}function P(N,k){m=hr.Replace;let R=Jc(j.location,N,k);y=g();let b=Jh(R,y),T=j.createHref(R);f.replaceState(b,"",T),u&&x&&x({action:m,location:j.location,delta:0})}function C(N){let k=c.location.origin!=="null"?c.location.origin:c.location.href,R=typeof N=="string"?N:co(N);return R=R.replace(/ $/,"%20"),ct(k,"No window.location.(origin|href) available to create URL for href: "+R),new URL(R,k)}let j={get action(){return m},get location(){return r(c,f)},listen(N){if(x)throw new Error("A history only accepts one active listener");return c.addEventListener(Xh,v),x=N,()=>{c.removeEventListener(Xh,v),x=null}},createHref(N){return a(c,N)},createURL:C,encodeLocation(N){let k=C(N);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:E,replace:P,go(N){return f.go(N)}};return j}var Zh;(function(r){r.data="data",r.deferred="deferred",r.redirect="redirect",r.error="error"})(Zh||(Zh={}));function sy(r,a,l){return l===void 0&&(l="/"),ay(r,a,l)}function ay(r,a,l,i){let c=typeof a=="string"?Ts(a):a,u=Cd(c.pathname||"/",l);if(u==null)return null;let f=Jm(r);ly(f);let m=null;for(let x=0;m==null&&x{let x={relativePath:m===void 0?u.path||"":m,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};x.relativePath.startsWith("/")&&(ct(x.relativePath.startsWith(i),'Absolute route path "'+x.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),x.relativePath=x.relativePath.slice(i.length));let y=mr([i,x.relativePath]),g=l.concat(x);u.children&&u.children.length>0&&(ct(u.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+y+'".')),Jm(u.children,a,g,y)),!(u.path==null&&!u.index)&&a.push({path:y,score:hy(y,u.index),routesMeta:g})};return r.forEach((u,f)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))c(u,f);else for(let x of Zm(u.path))c(u,f,x)}),a}function Zm(r){let a=r.split("/");if(a.length===0)return[];let[l,...i]=a,c=l.endsWith("?"),u=l.replace(/\?$/,"");if(i.length===0)return c?[u,""]:[u];let f=Zm(i.join("/")),m=[];return m.push(...f.map(x=>x===""?u:[u,x].join("/"))),c&&m.push(...f),m.map(x=>r.startsWith("/")&&x===""?"/":x)}function ly(r){r.sort((a,l)=>a.score!==l.score?l.score-a.score:my(a.routesMeta.map(i=>i.childrenIndex),l.routesMeta.map(i=>i.childrenIndex)))}const oy=/^:[\w-]+$/,iy=3,cy=2,dy=1,uy=10,fy=-2,em=r=>r==="*";function hy(r,a){let l=r.split("/"),i=l.length;return l.some(em)&&(i+=fy),a&&(i+=cy),l.filter(c=>!em(c)).reduce((c,u)=>c+(oy.test(u)?iy:u===""?dy:uy),i)}function my(r,a){return r.length===a.length&&r.slice(0,-1).every((i,c)=>i===a[c])?r[r.length-1]-a[a.length-1]:0}function py(r,a,l){let{routesMeta:i}=r,c={},u="/",f=[];for(let m=0;m{let{paramName:E,isOptional:P}=g;if(E==="*"){let j=m[v]||"";f=u.slice(0,u.length-j.length).replace(/(.)\/+$/,"$1")}const C=m[v];return P&&!C?y[E]=void 0:y[E]=(C||"").replace(/%2F/g,"/"),y},{}),pathname:u,pathnameBase:f,pattern:r}}function gy(r,a,l){a===void 0&&(a=!1),l===void 0&&(l=!0),Sd(r==="*"||!r.endsWith("*")||r.endsWith("/*"),'Route path "'+r+'" will be treated as if it were '+('"'+r.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+r.replace(/\*$/,"/*")+'".'));let i=[],c="^"+r.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,m,x)=>(i.push({paramName:m,isOptional:x!=null}),x?"/?([^\\/]+)?":"/([^\\/]+)"));return r.endsWith("*")?(i.push({paramName:"*"}),c+=r==="*"||r==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):l?c+="\\/*$":r!==""&&r!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,a?void 0:"i"),i]}function vy(r){try{return r.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Sd(!1,'The URL path "'+r+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),r}}function Cd(r,a){if(a==="/")return r;if(!r.toLowerCase().startsWith(a.toLowerCase()))return null;let l=a.endsWith("/")?a.length-1:a.length,i=r.charAt(l);return i&&i!=="/"?null:r.slice(l)||"/"}const yy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wy=r=>yy.test(r);function jy(r,a){a===void 0&&(a="/");let{pathname:l,search:i="",hash:c=""}=typeof r=="string"?Ts(r):r,u;if(l)if(wy(l))u=l;else{if(l.includes("//")){let f=l;l=l.replace(/\/\/+/g,"/"),Sd(!1,"Pathnames cannot have embedded double slashes - normalizing "+(f+" -> "+l))}l.startsWith("/")?u=tm(l.substring(1),"/"):u=tm(l,a)}else u=a;return{pathname:u,search:Sy(i),hash:Cy(c)}}function tm(r,a){let l=a.replace(/\/+$/,"").split("/");return r.split("/").forEach(c=>{c===".."?l.length>1&&l.pop():c!=="."&&l.push(c)}),l.length>1?l.join("/"):"/"}function Oc(r,a,l,i){return"Cannot include a '"+r+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+l+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function by(r){return r.filter((a,l)=>l===0||a.route.path&&a.route.path.length>0)}function kd(r,a){let l=by(r);return a?l.map((i,c)=>c===l.length-1?i.pathname:i.pathnameBase):l.map(i=>i.pathnameBase)}function Ed(r,a,l,i){i===void 0&&(i=!1);let c;typeof r=="string"?c=Ts(r):(c=Ta({},r),ct(!c.pathname||!c.pathname.includes("?"),Oc("?","pathname","search",c)),ct(!c.pathname||!c.pathname.includes("#"),Oc("#","pathname","hash",c)),ct(!c.search||!c.search.includes("#"),Oc("#","search","hash",c)));let u=r===""||c.pathname==="",f=u?"/":c.pathname,m;if(f==null)m=l;else{let v=a.length-1;if(!i&&f.startsWith("..")){let E=f.split("/");for(;E[0]==="..";)E.shift(),v-=1;c.pathname=E.join("/")}m=v>=0?a[v]:"/"}let x=jy(c,m),y=f&&f!=="/"&&f.endsWith("/"),g=(u||f===".")&&l.endsWith("/");return!x.pathname.endsWith("/")&&(y||g)&&(x.pathname+="/"),x}const mr=r=>r.join("/").replace(/\/\/+/g,"/"),Ny=r=>r.replace(/\/+$/,"").replace(/^\/*/,"/"),Sy=r=>!r||r==="?"?"":r.startsWith("?")?r:"?"+r,Cy=r=>!r||r==="#"?"":r.startsWith("#")?r:"#"+r;function ky(r){return r!=null&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.internal=="boolean"&&"data"in r}const ep=["post","put","patch","delete"];new Set(ep);const Ey=["get",...ep];new Set(Ey);/** * React Router v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Ia(){return Ia=Object.assign?Object.assign.bind():function(r){for(var a=1;a{m.current=!0}),p.useCallback(function(y,g){if(g===void 0&&(g={}),!m.current)return;if(typeof y=="number"){i.go(y);return}let v=Ed(y,JSON.parse(f),u,g.relative==="path");r==null&&a!=="/"&&(v.pathname=v.pathname==="/"?a:mr([a,v.pathname])),(g.replace?i.replace:i.push)(v,g.state,g)},[a,i,f,u,r])}const Ty=p.createContext(null);function Iy(r){let a=p.useContext(Vn).outlet;return a&&p.createElement(Ty.Provider,{value:r},a)}function rp(r,a){let{relative:l}=a===void 0?{}:a,{future:i}=p.useContext(yr),{matches:c}=p.useContext(Vn),{pathname:u}=Yr(),f=JSON.stringify(kd(c,i.v7_relativeSplatPath));return p.useMemo(()=>Ed(r,JSON.parse(f),u,l==="path"),[r,f,u,l])}function Ay(r,a){return My(r,a)}function My(r,a,l,i){Is()||ct(!1);let{navigator:c}=p.useContext(yr),{matches:u}=p.useContext(Vn),f=u[u.length-1],m=f?f.params:{};f&&f.pathname;let x=f?f.pathnameBase:"/";f&&f.route;let y=Yr(),g;if(a){var v;let N=typeof a=="string"?Ts(a):a;x==="/"||(v=N.pathname)!=null&&v.startsWith(x)||ct(!1),g=N}else g=y;let E=g.pathname||"/",P=E;if(x!=="/"){let N=x.replace(/^\//,"").split("/");P="/"+E.replace(/^\//,"").split("/").slice(N.length).join("/")}let C=sy(r,{pathname:P}),j=zy(C&&C.map(N=>Object.assign({},N,{params:Object.assign({},m,N.params),pathname:mr([x,c.encodeLocation?c.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?x:mr([x,c.encodeLocation?c.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),u,l,i);return a&&j?p.createElement(So.Provider,{value:{location:Ia({pathname:"/",search:"",hash:"",state:null,key:"default"},g),navigationType:hr.Pop}},j):j}function Ly(){let r=Uy(),a=ky(r)?r.status+" "+r.statusText:r instanceof Error?r.message:JSON.stringify(r),l=r instanceof Error?r.stack:null,c={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},a),l?p.createElement("pre",{style:c},l):null,null)}const Oy=p.createElement(Ly,null);class Dy extends p.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,l){return l.location!==a.location||l.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:l.error,location:l.location,revalidation:a.revalidation||l.revalidation}}componentDidCatch(a,l){console.error("React Router caught the following error during render",a,l)}render(){return this.state.error!==void 0?p.createElement(Vn.Provider,{value:this.props.routeContext},p.createElement(tp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Fy(r){let{routeContext:a,match:l,children:i}=r,c=p.useContext(Pd);return c&&c.static&&c.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=l.route.id),p.createElement(Vn.Provider,{value:a},i)}function zy(r,a,l,i){var c;if(a===void 0&&(a=[]),l===void 0&&(l=null),i===void 0&&(i=null),r==null){var u;if(!l)return null;if(l.errors)r=l.matches;else if((u=i)!=null&&u.v7_partialHydration&&a.length===0&&!l.initialized&&l.matches.length>0)r=l.matches;else return null}let f=r,m=(c=l)==null?void 0:c.errors;if(m!=null){let g=f.findIndex(v=>v.route.id&&(m==null?void 0:m[v.route.id])!==void 0);g>=0||ct(!1),f=f.slice(0,Math.min(f.length,g+1))}let x=!1,y=-1;if(l&&i&&i.v7_partialHydration)for(let g=0;g=0?f=f.slice(0,y+1):f=[f[0]];break}}}return f.reduceRight((g,v,E)=>{let P,C=!1,j=null,N=null;l&&(P=m&&v.route.id?m[v.route.id]:void 0,j=v.route.errorElement||Oy,x&&(y<0&&E===0?(Hy("route-fallback"),C=!0,N=null):y===E&&(C=!0,N=v.route.hydrateFallbackElement||null)));let k=a.concat(f.slice(0,E+1)),R=()=>{let b;return P?b=j:C?b=N:v.route.Component?b=p.createElement(v.route.Component,null):v.route.element?b=v.route.element:b=g,p.createElement(Fy,{match:v,routeContext:{outlet:g,matches:k,isDataRoute:l!=null},children:b})};return l&&(v.route.ErrorBoundary||v.route.errorElement||E===0)?p.createElement(Dy,{location:l.location,revalidation:l.revalidation,component:j,error:P,children:R(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):R()},null)}var sp=(function(r){return r.UseBlocker="useBlocker",r.UseRevalidator="useRevalidator",r.UseNavigateStable="useNavigate",r})(sp||{}),ap=(function(r){return r.UseBlocker="useBlocker",r.UseLoaderData="useLoaderData",r.UseActionData="useActionData",r.UseRouteError="useRouteError",r.UseNavigation="useNavigation",r.UseRouteLoaderData="useRouteLoaderData",r.UseMatches="useMatches",r.UseRevalidator="useRevalidator",r.UseNavigateStable="useNavigate",r.UseRouteId="useRouteId",r})(ap||{});function $y(r){let a=p.useContext(Pd);return a||ct(!1),a}function By(r){let a=p.useContext(Py);return a||ct(!1),a}function Vy(r){let a=p.useContext(Vn);return a||ct(!1),a}function lp(r){let a=Vy(),l=a.matches[a.matches.length-1];return l.route.id||ct(!1),l.route.id}function Uy(){var r;let a=p.useContext(tp),l=By(),i=lp();return a!==void 0?a:(r=l.errors)==null?void 0:r[i]}function Wy(){let{router:r}=$y(sp.UseNavigateStable),a=lp(ap.UseNavigateStable),l=p.useRef(!1);return np(()=>{l.current=!0}),p.useCallback(function(c,u){u===void 0&&(u={}),l.current&&(typeof c=="number"?r.navigate(c):r.navigate(c,Ia({fromRouteId:a},u)))},[r,a])}const nm={};function Hy(r,a,l){nm[r]||(nm[r]=!0)}function Ky(r,a){r==null||r.v7_startTransition,r==null||r.v7_relativeSplatPath}function Gy(r){let{to:a,replace:l,state:i,relative:c}=r;Is()||ct(!1);let{future:u,static:f}=p.useContext(yr),{matches:m}=p.useContext(Vn),{pathname:x}=Yr(),y=Oa(),g=Ed(a,kd(m,u.v7_relativeSplatPath),x,c==="path"),v=JSON.stringify(g);return p.useEffect(()=>y(JSON.parse(v),{replace:l,state:i,relative:c}),[y,v,c,l,i]),null}function Qy(r){return Iy(r.context)}function it(r){ct(!1)}function Yy(r){let{basename:a="/",children:l=null,location:i,navigationType:c=hr.Pop,navigator:u,static:f=!1,future:m}=r;Is()&&ct(!1);let x=a.replace(/^\/*/,"/"),y=p.useMemo(()=>({basename:x,navigator:u,static:f,future:Ia({v7_relativeSplatPath:!1},m)}),[x,m,u,f]);typeof i=="string"&&(i=Ts(i));let{pathname:g="/",search:v="",hash:E="",state:P=null,key:C="default"}=i,j=p.useMemo(()=>{let N=Cd(g,x);return N==null?null:{location:{pathname:N,search:v,hash:E,state:P,key:C},navigationType:c}},[x,g,v,E,P,C,c]);return j==null?null:p.createElement(yr.Provider,{value:y},p.createElement(So.Provider,{children:l,value:j}))}function qy(r){let{children:a,location:l}=r;return Ay(Zc(a),l)}new Promise(()=>{});function Zc(r,a){a===void 0&&(a=[]);let l=[];return p.Children.forEach(r,(i,c)=>{if(!p.isValidElement(i))return;let u=[...a,c];if(i.type===p.Fragment){l.push.apply(l,Zc(i.props.children,u));return}i.type!==it&&ct(!1),!i.props.index||!i.props.children||ct(!1);let f={id:i.props.id||u.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(f.children=Zc(i.props.children,u)),l.push(f)}),l}/** * React Router DOM v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function ed(){return ed=Object.assign?Object.assign.bind():function(r){for(var a=1;a=0)&&(l[c]=r[c]);return l}function Jy(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}function Zy(r,a){return r.button===0&&(!a||a==="_self")&&!Jy(r)}const ew=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],tw="6";try{window.__reactRouterVersion=tw}catch{}const nw="startTransition",rm=No[nw];function rw(r){let{basename:a,children:l,future:i,window:c}=r,u=p.useRef();u.current==null&&(u.current=ty({window:c,v5Compat:!0}));let f=u.current,[m,x]=p.useState({action:f.action,location:f.location}),{v7_startTransition:y}=i||{},g=p.useCallback(v=>{y&&rm?rm(()=>x(v)):x(v)},[x,y]);return p.useLayoutEffect(()=>f.listen(g),[f,g]),p.useEffect(()=>Ky(i),[i]),p.createElement(Yy,{basename:a,children:l,location:m.location,navigationType:m.action,navigator:f,future:i})}const sw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",aw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,op=p.forwardRef(function(a,l){let{onClick:i,relative:c,reloadDocument:u,replace:f,state:m,target:x,to:y,preventScrollReset:g,viewTransition:v}=a,E=Xy(a,ew),{basename:P}=p.useContext(yr),C,j=!1;if(typeof y=="string"&&aw.test(y)&&(C=y,sw))try{let b=new URL(window.location.href),T=y.startsWith("//")?new URL(b.protocol+y):new URL(y),B=Cd(T.pathname,P);T.origin===b.origin&&B!=null?y=B+T.search+T.hash:j=!0}catch{}let N=Ry(y,{relative:c}),k=lw(y,{replace:f,state:m,target:x,preventScrollReset:g,relative:c,viewTransition:v});function R(b){i&&i(b),b.defaultPrevented||k(b)}return p.createElement("a",ed({},E,{href:C||N,onClick:j||u?i:R,ref:l,target:x}))});var sm;(function(r){r.UseScrollRestoration="useScrollRestoration",r.UseSubmit="useSubmit",r.UseSubmitFetcher="useSubmitFetcher",r.UseFetcher="useFetcher",r.useViewTransitionState="useViewTransitionState"})(sm||(sm={}));var am;(function(r){r.UseFetcher="useFetcher",r.UseFetchers="useFetchers",r.UseScrollRestoration="useScrollRestoration"})(am||(am={}));function lw(r,a){let{target:l,replace:i,state:c,preventScrollReset:u,relative:f,viewTransition:m}=a===void 0?{}:a,x=Oa(),y=Yr(),g=rp(r,{relative:f});return p.useCallback(v=>{if(Zy(v,l)){v.preventDefault();let E=i!==void 0?i:co(y)===co(g);x(r,{replace:E,state:c,preventScrollReset:u,relative:f,viewTransition:m})}},[y,x,g,i,c,l,r,u,f,m])}/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ow=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),iw=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,l,i)=>i?i.toUpperCase():l.toLowerCase()),lm=r=>{const a=iw(r);return a.charAt(0).toUpperCase()+a.slice(1)},ip=(...r)=>r.filter((a,l,i)=>!!a&&a.trim()!==""&&i.indexOf(a)===l).join(" ").trim(),cw=r=>{for(const a in r)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var dw={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uw=p.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:i,className:c="",children:u,iconNode:f,...m},x)=>p.createElement("svg",{ref:x,...dw,width:a,height:a,stroke:r,strokeWidth:i?Number(l)*24/Number(a):l,className:ip("lucide",c),...!u&&!cw(m)&&{"aria-hidden":"true"},...m},[...f.map(([y,g])=>p.createElement(y,g)),...Array.isArray(u)?u:[u]]));/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const je=(r,a)=>{const l=p.forwardRef(({className:i,...c},u)=>p.createElement(uw,{ref:u,iconNode:a,className:ip(`lucide-${ow(lm(r))}`,`lucide-${r}`,i),...c}));return l.displayName=lm(r),l};/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fw=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],om=je("bitcoin",fw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hw=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Ps=je("book-open",hw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mw=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],td=je("calendar",mw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pw=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Co=je("check",pw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xw=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cp=je("chevron-down",xw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gw=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],dp=je("chevron-right",gw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vw=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],yw=je("chevron-up",vw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ww=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],jw=je("circle-alert",ww);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bw=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],nd=je("circle-check-big",bw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],up=je("circle-question-mark",Nw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],im=je("circle-user",Sw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],kw=je("circle-x",Cw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ew=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fp=je("clock",Ew);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pw=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],hp=je("copy",Pw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rw=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],rd=je("credit-card",Rw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _w=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],ko=je("crown",_w);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tw=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],uo=je("dollar-sign",Tw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iw=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Aw=je("download",Iw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mw=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],fo=je("external-link",Mw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lw=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Rd=je("eye",Lw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ow=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Dw=je("file-text",Ow);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fw=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],zw=je("funnel",Fw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $w=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],cm=je("gift",$w);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bw=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],Vw=je("git-merge",Bw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],sd=je("globe",Uw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ww=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],dm=je("history",Ww);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hw=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Kw=je("house",Hw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Qw=je("image",Gw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Ql=je("info",Yw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qw=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],um=je("key",qw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xw=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Jw=je("layout-dashboard",Xw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zw=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],zr=je("link-2",Zw);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ej=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],fm=je("link",ej);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tj=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],nj=je("lock",tj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rj=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],sj=je("log-out",rj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aj=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],lj=je("map-pin",aj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oj=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],ij=je("menu",oj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cj=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],dj=je("message-circle",cj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uj=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],fj=je("palette",uj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hj=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Ur=je("pen-line",hj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mj=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],pj=je("percent",mj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xj=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],gj=je("phone",xj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vj=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],$r=je("plus",vj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yj=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],hm=je("qr-code",yj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wj=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],st=je("refresh-cw",wj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jj=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],pn=je("save",jj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bj=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Br=je("search",bj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nj=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ho=je("settings",Nj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sj=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Cj=je("settings-2",Sj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kj=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ej=je("shield-check",kj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pj=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],ad=je("shopping-bag",Pj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rj=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ld=je("smartphone",Rj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _j=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Tj=je("tag",_j);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ij=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Eo=je("trash-2",Ij);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aj=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],od=je("trending-up",Aj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mj=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],mp=je("undo-2",Mj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lj=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],mm=je("upload",Lj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oj=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],pm=je("user-plus",Oj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dj=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ro=je("user",Dj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fj=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],En=je("users",Fj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zj=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],Rs=je("wallet",zj);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $j=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zn=je("x",$j);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bj=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Vj=je("zap",Bj),_d="admin_token";function Uj(){try{return localStorage.getItem(_d)}catch{return null}}function Wj(r){try{localStorage.setItem(_d,r)}catch{}}function Hj(){try{localStorage.removeItem(_d)}catch{}}const Kj="https://soulapi.quwanzhi.com",Gj=()=>{const r="https://soulapi.quwanzhi.com";return r.length>0?r.replace(/\/$/,""):Kj};function pp(r){const a=Gj(),l=r.startsWith("/")?r:`/${r}`;return a?`${a}${l}`:l}async function Po(r,a={}){const{data:l,...i}=a,c=pp(r),u=new Headers(i.headers),f=Uj();f&&u.set("Authorization",`Bearer ${f}`),l!=null&&!u.has("Content-Type")&&u.set("Content-Type","application/json");const m=l!=null?JSON.stringify(l):i.body,x=await fetch(c,{...i,headers:u,body:m,credentials:"include"}),g=(x.headers.get("Content-Type")||"").includes("application/json")?await x.json():x;if(!x.ok){const v=new Error((g==null?void 0:g.error)||`HTTP ${x.status}`);throw v.status=x.status,v.data=g,v}return g}function He(r,a){return Po(r,{...a,method:"GET"})}function bt(r,a,l){return Po(r,{...l,method:"POST",data:a})}function Wt(r,a,l){return Po(r,{...l,method:"PUT",data:a})}function Td(r,a){return Po(r,{...a,method:"DELETE"})}const Qj=[{icon:Jw,label:"数据概览",href:"/dashboard"},{icon:Ps,label:"内容管理",href:"/content"},{icon:En,label:"用户管理",href:"/users"},{icon:ko,label:"VIP 角色",href:"/vip-roles"},{icon:Rs,label:"交易中心",href:"/distribution"},{icon:Vw,label:"匹配记录",href:"/match-records"},{icon:rd,label:"推广设置",href:"/referral-settings"},{icon:ho,label:"系统设置",href:"/settings"}];function Yj(){const r=Yr(),a=Oa(),[l,i]=p.useState(!1),[c,u]=p.useState(!1);p.useEffect(()=>{i(!0)},[]),p.useEffect(()=>{if(!l)return;u(!1);let m=!1;return He("/api/admin").then(x=>{m||(x&&x.success!==!1?u(!0):a("/login",{replace:!0}))}).catch(()=>{m||a("/login",{replace:!0})}),()=>{m=!0}},[l,a]);const f=async()=>{Hj();try{await bt("/api/admin/logout",{})}catch{}a("/login",{replace:!0})};return!l||!c?t.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[t.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):t.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[t.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[t.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[t.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),t.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),t.jsx("nav",{className:"flex-1 p-4 space-y-1",children:Qj.map(m=>{const x=r.pathname===m.href;return t.jsxs(op,{to:m.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${x?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(m.icon,{className:"w-5 h-5"}),t.jsx("span",{className:"text-sm",children:m.label})]},m.href)})}),t.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:t.jsxs("button",{type:"button",onClick:f,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[t.jsx(sj,{className:"w-5 h-5"}),t.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),t.jsx("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0",children:t.jsx("div",{className:"w-full min-w-[1024px] min-h-full",children:t.jsx(Qy,{})})})]})}function xm(r,a){if(typeof r=="function")return r(a);r!=null&&(r.current=a)}function Id(...r){return a=>{let l=!1;const i=r.map(c=>{const u=xm(c,a);return!l&&typeof u=="function"&&(l=!0),u});if(l)return()=>{for(let c=0;c{let{children:u,...f}=i;xp(u)&&typeof mo=="function"&&(u=mo(u._payload));const m=p.Children.toArray(u),x=m.find(e1);if(x){const y=x.props.children,g=m.map(v=>v===x?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return t.jsx(a,{...f,ref:c,children:p.isValidElement(y)?p.cloneElement(y,void 0,g):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${r}.Slot`,l}var vp=gp("Slot");function Jj(r){const a=p.forwardRef((l,i)=>{let{children:c,...u}=l;if(xp(c)&&typeof mo=="function"&&(c=mo(c._payload)),p.isValidElement(c)){const f=n1(c),m=t1(u,c.props);return c.type!==p.Fragment&&(m.ref=i?Id(i,f):f),p.cloneElement(c,m)}return p.Children.count(c)>1?p.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var Zj=Symbol("radix.slottable");function e1(r){return p.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===Zj}function t1(r,a){const l={...a};for(const i in a){const c=r[i],u=a[i];/^on[A-Z]/.test(i)?c&&u?l[i]=(...m)=>{const x=u(...m);return c(...m),x}:c&&(l[i]=c):i==="style"?l[i]={...c,...u}:i==="className"&&(l[i]=[c,u].filter(Boolean).join(" "))}return{...r,...l}}function n1(r){var i,c;let a=(i=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:i.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}function yp(r){var a,l,i="";if(typeof r=="string"||typeof r=="number")i+=r;else if(typeof r=="object")if(Array.isArray(r)){var c=r.length;for(a=0;atypeof r=="boolean"?`${r}`:r===0?"0":r,vm=wp,jp=(r,a)=>l=>{var i;if((a==null?void 0:a.variants)==null)return vm(r,l==null?void 0:l.class,l==null?void 0:l.className);const{variants:c,defaultVariants:u}=a,f=Object.keys(c).map(y=>{const g=l==null?void 0:l[y],v=u==null?void 0:u[y];if(g===null)return null;const E=gm(g)||gm(v);return c[y][E]}),m=l&&Object.entries(l).reduce((y,g)=>{let[v,E]=g;return E===void 0||(y[v]=E),y},{}),x=a==null||(i=a.compoundVariants)===null||i===void 0?void 0:i.reduce((y,g)=>{let{class:v,className:E,...P}=g;return Object.entries(P).every(C=>{let[j,N]=C;return Array.isArray(N)?N.includes({...u,...m}[j]):{...u,...m}[j]===N})?[...y,v,E]:y},[]);return vm(r,f,x,l==null?void 0:l.class,l==null?void 0:l.className)},r1=(r,a)=>{const l=new Array(r.length+a.length);for(let i=0;i({classGroupId:r,validator:a}),bp=(r=new Map,a=null,l)=>({nextPart:r,validators:a,classGroupId:l}),po="-",ym=[],a1="arbitrary..",l1=r=>{const a=i1(r),{conflictingClassGroups:l,conflictingClassGroupModifiers:i}=r;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return o1(f);const m=f.split(po),x=m[0]===""&&m.length>1?1:0;return Np(m,x,a)},getConflictingClassGroupIds:(f,m)=>{if(m){const x=i[f],y=l[f];return x?y?r1(y,x):x:y||ym}return l[f]||ym}}},Np=(r,a,l)=>{if(r.length-a===0)return l.classGroupId;const c=r[a],u=l.nextPart.get(c);if(u){const y=Np(r,a+1,u);if(y)return y}const f=l.validators;if(f===null)return;const m=a===0?r.join(po):r.slice(a).join(po),x=f.length;for(let y=0;yr.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=r.slice(1,-1),l=a.indexOf(":"),i=a.slice(0,l);return i?a1+i:void 0})(),i1=r=>{const{theme:a,classGroups:l}=r;return c1(l,a)},c1=(r,a)=>{const l=bp();for(const i in r){const c=r[i];Ad(c,l,i,a)}return l},Ad=(r,a,l,i)=>{const c=r.length;for(let u=0;u{if(typeof r=="string"){u1(r,a,l);return}if(typeof r=="function"){f1(r,a,l,i);return}h1(r,a,l,i)},u1=(r,a,l)=>{const i=r===""?a:Sp(a,r);i.classGroupId=l},f1=(r,a,l,i)=>{if(m1(r)){Ad(r(i),a,l,i);return}a.validators===null&&(a.validators=[]),a.validators.push(s1(l,r))},h1=(r,a,l,i)=>{const c=Object.entries(r),u=c.length;for(let f=0;f{let l=r;const i=a.split(po),c=i.length;for(let u=0;u"isThemeGetter"in r&&r.isThemeGetter===!0,p1=r=>{if(r<1)return{get:()=>{},set:()=>{}};let a=0,l=Object.create(null),i=Object.create(null);const c=(u,f)=>{l[u]=f,a++,a>r&&(a=0,i=l,l=Object.create(null))};return{get(u){let f=l[u];if(f!==void 0)return f;if((f=i[u])!==void 0)return c(u,f),f},set(u,f){u in l?l[u]=f:c(u,f)}}},id="!",wm=":",x1=[],jm=(r,a,l,i,c)=>({modifiers:r,hasImportantModifier:a,baseClassName:l,maybePostfixModifierPosition:i,isExternal:c}),g1=r=>{const{prefix:a,experimentalParseClassName:l}=r;let i=c=>{const u=[];let f=0,m=0,x=0,y;const g=c.length;for(let j=0;jx?y-x:void 0;return jm(u,P,E,C)};if(a){const c=a+wm,u=i;i=f=>f.startsWith(c)?u(f.slice(c.length)):jm(x1,!1,f,void 0,!0)}if(l){const c=i;i=u=>l({className:u,parseClassName:c})}return i},v1=r=>{const a=new Map;return r.orderSensitiveModifiers.forEach((l,i)=>{a.set(l,1e6+i)}),l=>{const i=[];let c=[];for(let u=0;u0&&(c.sort(),i.push(...c),c=[]),i.push(f)):c.push(f)}return c.length>0&&(c.sort(),i.push(...c)),i}},y1=r=>({cache:p1(r.cacheSize),parseClassName:g1(r),sortModifiers:v1(r),...l1(r)}),w1=/\s+/,j1=(r,a)=>{const{parseClassName:l,getClassGroupId:i,getConflictingClassGroupIds:c,sortModifiers:u}=a,f=[],m=r.trim().split(w1);let x="";for(let y=m.length-1;y>=0;y-=1){const g=m[y],{isExternal:v,modifiers:E,hasImportantModifier:P,baseClassName:C,maybePostfixModifierPosition:j}=l(g);if(v){x=g+(x.length>0?" "+x:x);continue}let N=!!j,k=i(N?C.substring(0,j):C);if(!k){if(!N){x=g+(x.length>0?" "+x:x);continue}if(k=i(C),!k){x=g+(x.length>0?" "+x:x);continue}N=!1}const R=E.length===0?"":E.length===1?E[0]:u(E).join(":"),b=P?R+id:R,T=b+k;if(f.indexOf(T)>-1)continue;f.push(T);const B=c(k,N);for(let G=0;G0?" "+x:x)}return x},b1=(...r)=>{let a=0,l,i,c="";for(;a{if(typeof r=="string")return r;let a,l="";for(let i=0;i{let l,i,c,u;const f=x=>{const y=a.reduce((g,v)=>v(g),r());return l=y1(y),i=l.cache.get,c=l.cache.set,u=m,m(x)},m=x=>{const y=i(x);if(y)return y;const g=j1(x,l);return c(x,g),g};return u=f,(...x)=>u(b1(...x))},S1=[],pt=r=>{const a=l=>l[r]||S1;return a.isThemeGetter=!0,a},kp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ep=/^\((?:(\w[\w-]*):)?(.+)\)$/i,C1=/^\d+\/\d+$/,k1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,E1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,P1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,R1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,js=r=>C1.test(r),Ae=r=>!!r&&!Number.isNaN(Number(r)),cr=r=>!!r&&Number.isInteger(Number(r)),Dc=r=>r.endsWith("%")&&Ae(r.slice(0,-1)),Fn=r=>k1.test(r),T1=()=>!0,I1=r=>E1.test(r)&&!P1.test(r),Pp=()=>!1,A1=r=>R1.test(r),M1=r=>_1.test(r),L1=r=>!ye(r)&&!we(r),O1=r=>As(r,Tp,Pp),ye=r=>kp.test(r),Fr=r=>As(r,Ip,I1),Fc=r=>As(r,B1,Ae),bm=r=>As(r,Rp,Pp),D1=r=>As(r,_p,M1),Yl=r=>As(r,Ap,A1),we=r=>Ep.test(r),Ra=r=>Ms(r,Ip),F1=r=>Ms(r,V1),Nm=r=>Ms(r,Rp),z1=r=>Ms(r,Tp),$1=r=>Ms(r,_p),ql=r=>Ms(r,Ap,!0),As=(r,a,l)=>{const i=kp.exec(r);return i?i[1]?a(i[1]):l(i[2]):!1},Ms=(r,a,l=!1)=>{const i=Ep.exec(r);return i?i[1]?a(i[1]):l:!1},Rp=r=>r==="position"||r==="percentage",_p=r=>r==="image"||r==="url",Tp=r=>r==="length"||r==="size"||r==="bg-size",Ip=r=>r==="length",B1=r=>r==="number",V1=r=>r==="family-name",Ap=r=>r==="shadow",U1=()=>{const r=pt("color"),a=pt("font"),l=pt("text"),i=pt("font-weight"),c=pt("tracking"),u=pt("leading"),f=pt("breakpoint"),m=pt("container"),x=pt("spacing"),y=pt("radius"),g=pt("shadow"),v=pt("inset-shadow"),E=pt("text-shadow"),P=pt("drop-shadow"),C=pt("blur"),j=pt("perspective"),N=pt("aspect"),k=pt("ease"),R=pt("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[...T(),we,ye],G=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],V=()=>[we,ye,x],ee=()=>[js,"full","auto",...V()],de=()=>[cr,"none","subgrid",we,ye],ce=()=>["auto",{span:["full",cr,we,ye]},cr,we,ye],le=()=>[cr,"auto",we,ye],ue=()=>["auto","min","max","fr",we,ye],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...V()],K=()=>[js,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],A=()=>[r,we,ye],X=()=>[...T(),Nm,bm,{position:[we,ye]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],S=()=>["auto","cover","contain",z1,O1,{size:[we,ye]}],O=()=>[Dc,Ra,Fr],se=()=>["","none","full",y,we,ye],oe=()=>["",Ae,Ra,Fr],be=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[Ae,Dc,Nm,bm],xe=()=>["","none",C,we,ye],I=()=>["none",Ae,we,ye],re=()=>["none",Ae,we,ye],fe=()=>[Ae,we,ye],Ee=()=>[js,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fn],breakpoint:[Fn],color:[T1],container:[Fn],"drop-shadow":[Fn],ease:["in","out","in-out"],font:[L1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fn],shadow:[Fn],spacing:["px",Ae],text:[Fn],"text-shadow":[Fn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",js,ye,we,N]}],container:["container"],columns:[{columns:[Ae,ye,we,m]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:B()}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ee()}],"inset-x":[{"inset-x":ee()}],"inset-y":[{"inset-y":ee()}],start:[{start:ee()}],end:[{end:ee()}],top:[{top:ee()}],right:[{right:ee()}],bottom:[{bottom:ee()}],left:[{left:ee()}],visibility:["visible","invisible","collapse"],z:[{z:[cr,"auto",we,ye]}],basis:[{basis:[js,"full","auto",m,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ae,js,"auto","initial","none",ye]}],grow:[{grow:["",Ae,we,ye]}],shrink:[{shrink:["",Ae,we,ye]}],order:[{order:[cr,"first","last","none",we,ye]}],"grid-cols":[{"grid-cols":de()}],"col-start-end":[{col:ce()}],"col-start":[{"col-start":le()}],"col-end":[{"col-end":le()}],"grid-rows":[{"grid-rows":de()}],"row-start-end":[{row:ce()}],"row-start":[{"row-start":le()}],"row-end":[{"row-end":le()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[m,"screen",...K()]}],"min-w":[{"min-w":[m,"screen","none",...K()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[f]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",l,Ra,Fr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,we,Fc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Dc,ye]}],"font-family":[{font:[F1,ye,a]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,we,ye]}],"line-clamp":[{"line-clamp":[Ae,"none",we,Fc]}],leading:[{leading:[u,...V()]}],"list-image":[{"list-image":["none",we,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...be(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ae,"from-font","auto",we,Fr]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[Ae,"auto",we,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",we,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:S()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},cr,we,ye],radial:["",we,ye],conic:[cr,we,ye]},$1,D1]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:O()}],"gradient-via-pos":[{via:O()}],"gradient-to-pos":[{to:O()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...be(),"hidden","none"]}],"divide-style":[{divide:[...be(),"hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ae,we,ye]}],"outline-w":[{outline:["",Ae,Ra,Fr]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",g,ql,Yl]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",v,ql,Yl]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[Ae,Fr]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",E,ql,Yl]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[Ae,we,ye]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[we,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:S()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,ye]}],filter:[{filter:["","none",we,ye]}],blur:[{blur:xe()}],brightness:[{brightness:[Ae,we,ye]}],contrast:[{contrast:[Ae,we,ye]}],"drop-shadow":[{"drop-shadow":["","none",P,ql,Yl]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",Ae,we,ye]}],"hue-rotate":[{"hue-rotate":[Ae,we,ye]}],invert:[{invert:["",Ae,we,ye]}],saturate:[{saturate:[Ae,we,ye]}],sepia:[{sepia:["",Ae,we,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",we,ye]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[Ae,we,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Ae,we,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ae,we,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ae,we,ye]}],"backdrop-invert":[{"backdrop-invert":["",Ae,we,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Ae,we,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Ae,we,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Ae,we,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ae,"initial",we,ye]}],ease:[{ease:["linear","initial",k,we,ye]}],delay:[{delay:[Ae,we,ye]}],animate:[{animate:["none",R,we,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,we,ye]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:I()}],"rotate-x":[{"rotate-x":I()}],"rotate-y":[{"rotate-y":I()}],"rotate-z":[{"rotate-z":I()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[we,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ee()}],"translate-x":[{"translate-x":Ee()}],"translate-y":[{"translate-y":Ee()}],"translate-z":[{"translate-z":Ee()}],"translate-none":["translate-none"],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",we,ye]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",we,ye]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[Ae,Ra,Fr,Fc]}],stroke:[{stroke:["none",...A()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},W1=N1(U1);function Ge(...r){return W1(wp(r))}const H1=jp("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground 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 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function he({className:r,variant:a,size:l,asChild:i=!1,...c}){const u=i?vp:"button";return t.jsx(u,{"data-slot":"button",className:Ge(H1({variant:a,size:l,className:r})),...c})}function ie({className:r,type:a,...l}){return t.jsx("input",{type:a,"data-slot":"input",className:Ge("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm focus-visible:ring-2 focus-visible:ring-ring",r),...l})}function K1(){const r=Oa(),[a,l]=p.useState(""),[i,c]=p.useState(""),[u,f]=p.useState(""),[m,x]=p.useState(!1),y=async()=>{f(""),x(!0);try{const g=await bt("/api/admin",{username:a.trim(),password:i});if((g==null?void 0:g.success)!==!1&&(g!=null&&g.token)){Wj(g.token),r("/dashboard",{replace:!0});return}f(g.error||"用户名或密码错误")}catch(g){const v=g;f(v.status===401?"用户名或密码错误":(v==null?void 0:v.message)||"网络错误,请重试")}finally{x(!1)}};return t.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[t.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[t.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),t.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),t.jsxs("div",{className:"w-full max-w-md relative z-10",children:[t.jsxs("div",{className:"text-center mb-8",children:[t.jsx("div",{className:"w-16 h-16 bg-[#38bdac]/20 rounded-2xl flex items-center justify-center mx-auto mb-4 border border-[#38bdac]/30",children:t.jsx(Ej,{className:"w-8 h-8 text-[#38bdac]"})}),t.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),t.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),t.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[t.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),t.jsxs("div",{className:"relative",children:[t.jsx(ro,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(ie,{type:"text",value:a,onChange:g=>l(g.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),t.jsxs("div",{className:"relative",children:[t.jsx(nj,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(ie,{type:"password",value:i,onChange:g=>c(g.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:g=>g.key==="Enter"&&y()})]})]}),u&&t.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:u}),t.jsx(he,{onClick:y,disabled:m,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:m?"登录中...":"登录"})]})]}),t.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Ce=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("rounded-xl border bg-card text-card-foreground shadow",r),...a}));Ce.displayName="Card";const Be=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("flex flex-col space-y-1.5 p-6",r),...a}));Be.displayName="CardHeader";const Ve=p.forwardRef(({className:r,...a},l)=>t.jsx("h3",{ref:l,className:Ge("font-semibold leading-none tracking-tight",r),...a}));Ve.displayName="CardTitle";const ft=p.forwardRef(({className:r,...a},l)=>t.jsx("p",{ref:l,className:Ge("text-sm text-muted-foreground",r),...a}));ft.displayName="CardDescription";const ke=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("p-6 pt-0",r),...a}));ke.displayName="CardContent";const G1=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("flex items-center p-6 pt-0",r),...a}));G1.displayName="CardFooter";function Q1(){const r=Oa(),[a,l]=p.useState(!0),[i,c]=p.useState([]),[u,f]=p.useState([]);async function m(){l(!0);try{const[C,j]=await Promise.all([He("/api/db/users"),He("/api/orders")]);C!=null&&C.success&&C.users&&c(C.users),j!=null&&j.success&&j.orders&&f(j.orders)}catch(C){console.error("加载数据失败",C)}finally{l(!1)}}if(p.useEffect(()=>{m()},[]),a)return t.jsxs("div",{className:"p-8 w-full",children:[t.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),t.jsxs("div",{className:"flex flex-col items-center justify-center py-24",children:[t.jsx(st,{className:"w-12 h-12 text-[#38bdac] animate-spin mb-4"}),t.jsx("span",{className:"text-gray-400",children:"加载中..."})]})]});const y=u.filter(C=>C.status==="paid"||C.status==="completed"||C.status==="success").reduce((C,j)=>C+Number(j.amount||0),0),g=i.length,v=u.length,E=C=>{const j=C.productType||"",N=C.description||"";if(N){if(j==="section"&&N.includes("章节")){if(N.includes("-")){const k=N.split("-");if(k.length>=3)return{title:`第${k[1]}章 第${k[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:N,subtitle:"章节购买"}}return j==="fullbook"||N.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:j==="match"||N.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:N,subtitle:j==="section"?"单章":j==="fullbook"?"全书":"其他"}}return j==="section"?{title:`章节 ${C.productId||""}`,subtitle:"单章购买"}:j==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:j==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:j||"其他"}},P=[{title:"总用户数",value:g,icon:En,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:`¥${Number(y).toFixed(2)}`,icon:od,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:v,icon:ad,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:`${g>0?(v/g*100).toFixed(1):0}%`,icon:Ps,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return t.jsxs("div",{className:"p-8 w-full",children:[t.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:P.map((C,j)=>t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>C.link&&r(C.link),children:[t.jsxs(Be,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsx(Ve,{className:"text-sm font-medium text-gray-400",children:C.title}),t.jsx("div",{className:`p-2 rounded-lg ${C.bg}`,children:t.jsx(C.icon,{className:`w-4 h-4 ${C.color}`})})]}),t.jsx(ke,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-2xl font-bold text-white",children:C.value}),t.jsx(dp,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},j))}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"最近订单"})}),t.jsx(ke,{children:t.jsxs("div",{className:"space-y-3",children:[u.slice(-5).reverse().map(C=>{var b;const j=C.referrerId?i.find(T=>T.id===C.referrerId):void 0,N=C.referralCode||(j==null?void 0:j.referralCode)||(j==null?void 0:j.nickname)||(C.referrerId?String(C.referrerId).slice(0,8):""),k=E(C),R=C.userNickname||((b=i.find(T=>T.id===C.userId))==null?void 0:b.nickname)||"匿名用户";return t.jsxs("div",{className:"flex items-start justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30 hover:border-[#38bdac]/30 transition-colors",children:[t.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[C.userAvatar?t.jsx("img",{src:C.userAvatar,alt:R,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:T=>{T.currentTarget.style.display="none";const B=T.currentTarget.nextElementSibling;B&&B.classList.remove("hidden")}}):null,t.jsx("div",{className:`w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 mt-0.5 ${C.userAvatar?"hidden":""}`,children:R.charAt(0)}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"text-sm text-gray-300",children:R}),t.jsx("span",{className:"text-gray-600",children:"·"}),t.jsx("span",{className:"text-sm font-medium text-white truncate",children:k.title})]}),t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[t.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:k.subtitle}),t.jsx("span",{children:new Date(C.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),N&&t.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",N]})]})]}),t.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[t.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(C.amount).toFixed(2)]}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:C.paymentMethod||"微信"})]})]},C.id)}),u.length===0&&t.jsxs("div",{className:"text-center py-12",children:[t.jsx(ad,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),t.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"新注册用户"})}),t.jsx(ke,{children:t.jsxs("div",{className:"space-y-3",children:[i.slice(-5).reverse().map(C=>{var j;return t.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((j=C.nickname)==null?void 0:j.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-white",children:C.nickname||"匿名用户"}),t.jsx("p",{className:"text-xs text-gray-500",children:C.phone||"-"})]})]}),t.jsx("p",{className:"text-xs text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleDateString():"-"})]},C.id)}),i.length===0&&t.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})]})]})]})}const Ls=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{className:"relative w-full overflow-auto",children:t.jsx("table",{ref:l,className:Ge("w-full caption-bottom text-sm",r),...a})}));Ls.displayName="Table";const Os=p.forwardRef(({className:r,...a},l)=>t.jsx("thead",{ref:l,className:Ge("[&_tr]:border-b",r),...a}));Os.displayName="TableHeader";const Ds=p.forwardRef(({className:r,...a},l)=>t.jsx("tbody",{ref:l,className:Ge("[&_tr:last-child]:border-0",r),...a}));Ds.displayName="TableBody";const _t=p.forwardRef(({className:r,...a},l)=>t.jsx("tr",{ref:l,className:Ge("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...a}));_t.displayName="TableRow";const $e=p.forwardRef(({className:r,...a},l)=>t.jsx("th",{ref:l,className:Ge("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",r),...a}));$e.displayName="TableHead";const Me=p.forwardRef(({className:r,...a},l)=>t.jsx("td",{ref:l,className:Ge("p-4 align-middle [&:has([role=checkbox])]:pr-0",r),...a}));Me.displayName="TableCell";const Y1=jp("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Le({className:r,variant:a,asChild:l=!1,...i}){const c=l?vp:"span";return t.jsx(c,{className:Ge(Y1({variant:a}),r),...i})}function Te(r,a,{checkForDefaultPrevented:l=!0}={}){return function(c){if(r==null||r(c),l===!1||!c.defaultPrevented)return a==null?void 0:a(c)}}function q1(r,a){const l=p.createContext(a),i=u=>{const{children:f,...m}=u,x=p.useMemo(()=>m,Object.values(m));return t.jsx(l.Provider,{value:x,children:f})};i.displayName=r+"Provider";function c(u){const f=p.useContext(l);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${r}\``)}return[i,c]}function wr(r,a=[]){let l=[];function i(u,f){const m=p.createContext(f),x=l.length;l=[...l,f];const y=v=>{var k;const{scope:E,children:P,...C}=v,j=((k=E==null?void 0:E[r])==null?void 0:k[x])||m,N=p.useMemo(()=>C,Object.values(C));return t.jsx(j.Provider,{value:N,children:P})};y.displayName=u+"Provider";function g(v,E){var j;const P=((j=E==null?void 0:E[r])==null?void 0:j[x])||m,C=p.useContext(P);if(C)return C;if(f!==void 0)return f;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[y,g]}const c=()=>{const u=l.map(f=>p.createContext(f));return function(m){const x=(m==null?void 0:m[r])||u;return p.useMemo(()=>({[`__scope${r}`]:{...m,[r]:x}}),[m,x])}};return c.scopeName=r,[i,X1(c,...a)]}function X1(...r){const a=r[0];if(r.length===1)return a;const l=()=>{const i=r.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(u){const f=i.reduce((m,{useScope:x,scopeName:y})=>{const v=x(u)[`__scope${y}`];return{...m,...v}},{});return p.useMemo(()=>({[`__scope${a.scopeName}`]:f}),[f])}};return l.scopeName=a.scopeName,l}var Et=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},J1=No[" useId ".trim().toString()]||(()=>{}),Z1=0;function pr(r){const[a,l]=p.useState(J1());return Et(()=>{l(i=>i??String(Z1++))},[r]),a?`radix-${a}`:""}var eb=No[" useInsertionEffect ".trim().toString()]||Et;function Wr({prop:r,defaultProp:a,onChange:l=()=>{},caller:i}){const[c,u,f]=tb({defaultProp:a,onChange:l}),m=r!==void 0,x=m?r:c;{const g=p.useRef(r!==void 0);p.useEffect(()=>{const v=g.current;v!==m&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${m?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=m},[m,i])}const y=p.useCallback(g=>{var v;if(m){const E=nb(g)?g(r):g;E!==r&&((v=f.current)==null||v.call(f,E))}else u(g)},[m,r,u,f]);return[x,y]}function tb({defaultProp:r,onChange:a}){const[l,i]=p.useState(r),c=p.useRef(l),u=p.useRef(a);return eb(()=>{u.current=a},[a]),p.useEffect(()=>{var f;c.current!==l&&((f=u.current)==null||f.call(u,l),c.current=l)},[l,c]),[l,i,u]}function nb(r){return typeof r=="function"}function Aa(r){const a=rb(r),l=p.forwardRef((i,c)=>{const{children:u,...f}=i,m=p.Children.toArray(u),x=m.find(ab);if(x){const y=x.props.children,g=m.map(v=>v===x?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return t.jsx(a,{...f,ref:c,children:p.isValidElement(y)?p.cloneElement(y,void 0,g):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${r}.Slot`,l}function rb(r){const a=p.forwardRef((l,i)=>{const{children:c,...u}=l;if(p.isValidElement(c)){const f=ob(c),m=lb(u,c.props);return c.type!==p.Fragment&&(m.ref=i?Id(i,f):f),p.cloneElement(c,m)}return p.Children.count(c)>1?p.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var sb=Symbol("radix.slottable");function ab(r){return p.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===sb}function lb(r,a){const l={...a};for(const i in a){const c=r[i],u=a[i];/^on[A-Z]/.test(i)?c&&u?l[i]=(...m)=>{const x=u(...m);return c(...m),x}:c&&(l[i]=c):i==="style"?l[i]={...c,...u}:i==="className"&&(l[i]=[c,u].filter(Boolean).join(" "))}return{...r,...l}}function ob(r){var i,c;let a=(i=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:i.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}var ib=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oe=ib.reduce((r,a)=>{const l=Aa(`Primitive.${a}`),i=p.forwardRef((c,u)=>{const{asChild:f,...m}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...m,ref:u})});return i.displayName=`Primitive.${a}`,{...r,[a]:i}},{});function cb(r,a){r&&La.flushSync(()=>r.dispatchEvent(a))}function xr(r){const a=p.useRef(r);return p.useEffect(()=>{a.current=r}),p.useMemo(()=>(...l)=>{var i;return(i=a.current)==null?void 0:i.call(a,...l)},[])}function db(r,a=globalThis==null?void 0:globalThis.document){const l=xr(r);p.useEffect(()=>{const i=c=>{c.key==="Escape"&&l(c)};return a.addEventListener("keydown",i,{capture:!0}),()=>a.removeEventListener("keydown",i,{capture:!0})},[l,a])}var ub="DismissableLayer",cd="dismissableLayer.update",fb="dismissableLayer.pointerDownOutside",hb="dismissableLayer.focusOutside",Sm,Mp=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Md=p.forwardRef((r,a)=>{const{disableOutsidePointerEvents:l=!1,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:f,onDismiss:m,...x}=r,y=p.useContext(Mp),[g,v]=p.useState(null),E=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,P]=p.useState({}),C=Ke(a,M=>v(M)),j=Array.from(y.layers),[N]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(N),R=g?j.indexOf(g):-1,b=y.layersWithOutsidePointerEventsDisabled.size>0,T=R>=k,B=xb(M=>{const V=M.target,ee=[...y.branches].some(de=>de.contains(V));!T||ee||(c==null||c(M),f==null||f(M),M.defaultPrevented||m==null||m())},E),G=gb(M=>{const V=M.target;[...y.branches].some(de=>de.contains(V))||(u==null||u(M),f==null||f(M),M.defaultPrevented||m==null||m())},E);return db(M=>{R===y.layers.size-1&&(i==null||i(M),!M.defaultPrevented&&m&&(M.preventDefault(),m()))},E),p.useEffect(()=>{if(g)return l&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(Sm=E.body.style.pointerEvents,E.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(g)),y.layers.add(g),Cm(),()=>{l&&y.layersWithOutsidePointerEventsDisabled.size===1&&(E.body.style.pointerEvents=Sm)}},[g,E,l,y]),p.useEffect(()=>()=>{g&&(y.layers.delete(g),y.layersWithOutsidePointerEventsDisabled.delete(g),Cm())},[g,y]),p.useEffect(()=>{const M=()=>P({});return document.addEventListener(cd,M),()=>document.removeEventListener(cd,M)},[]),t.jsx(Oe.div,{...x,ref:C,style:{pointerEvents:b?T?"auto":"none":void 0,...r.style},onFocusCapture:Te(r.onFocusCapture,G.onFocusCapture),onBlurCapture:Te(r.onBlurCapture,G.onBlurCapture),onPointerDownCapture:Te(r.onPointerDownCapture,B.onPointerDownCapture)})});Md.displayName=ub;var mb="DismissableLayerBranch",pb=p.forwardRef((r,a)=>{const l=p.useContext(Mp),i=p.useRef(null),c=Ke(a,i);return p.useEffect(()=>{const u=i.current;if(u)return l.branches.add(u),()=>{l.branches.delete(u)}},[l.branches]),t.jsx(Oe.div,{...r,ref:c})});pb.displayName=mb;function xb(r,a=globalThis==null?void 0:globalThis.document){const l=xr(r),i=p.useRef(!1),c=p.useRef(()=>{});return p.useEffect(()=>{const u=m=>{if(m.target&&!i.current){let x=function(){Lp(fb,l,y,{discrete:!0})};const y={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=x,a.addEventListener("click",c.current,{once:!0})):x()}else a.removeEventListener("click",c.current);i.current=!1},f=window.setTimeout(()=>{a.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(f),a.removeEventListener("pointerdown",u),a.removeEventListener("click",c.current)}},[a,l]),{onPointerDownCapture:()=>i.current=!0}}function gb(r,a=globalThis==null?void 0:globalThis.document){const l=xr(r),i=p.useRef(!1);return p.useEffect(()=>{const c=u=>{u.target&&!i.current&&Lp(hb,l,{originalEvent:u},{discrete:!1})};return a.addEventListener("focusin",c),()=>a.removeEventListener("focusin",c)},[a,l]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function Cm(){const r=new CustomEvent(cd);document.dispatchEvent(r)}function Lp(r,a,l,{discrete:i}){const c=l.originalEvent.target,u=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:l});a&&c.addEventListener(r,a,{once:!0}),i?cb(c,u):c.dispatchEvent(u)}var zc="focusScope.autoFocusOnMount",$c="focusScope.autoFocusOnUnmount",km={bubbles:!1,cancelable:!0},vb="FocusScope",Ld=p.forwardRef((r,a)=>{const{loop:l=!1,trapped:i=!1,onMountAutoFocus:c,onUnmountAutoFocus:u,...f}=r,[m,x]=p.useState(null),y=xr(c),g=xr(u),v=p.useRef(null),E=Ke(a,j=>x(j)),P=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(i){let j=function(b){if(P.paused||!m)return;const T=b.target;m.contains(T)?v.current=T:ur(v.current,{select:!0})},N=function(b){if(P.paused||!m)return;const T=b.relatedTarget;T!==null&&(m.contains(T)||ur(v.current,{select:!0}))},k=function(b){if(document.activeElement===document.body)for(const B of b)B.removedNodes.length>0&&ur(m)};document.addEventListener("focusin",j),document.addEventListener("focusout",N);const R=new MutationObserver(k);return m&&R.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",N),R.disconnect()}}},[i,m,P.paused]),p.useEffect(()=>{if(m){Pm.add(P);const j=document.activeElement;if(!m.contains(j)){const k=new CustomEvent(zc,km);m.addEventListener(zc,y),m.dispatchEvent(k),k.defaultPrevented||(yb(Sb(Op(m)),{select:!0}),document.activeElement===j&&ur(m))}return()=>{m.removeEventListener(zc,y),setTimeout(()=>{const k=new CustomEvent($c,km);m.addEventListener($c,g),m.dispatchEvent(k),k.defaultPrevented||ur(j??document.body,{select:!0}),m.removeEventListener($c,g),Pm.remove(P)},0)}}},[m,y,g,P]);const C=p.useCallback(j=>{if(!l&&!i||P.paused)return;const N=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(N&&k){const R=j.currentTarget,[b,T]=wb(R);b&&T?!j.shiftKey&&k===T?(j.preventDefault(),l&&ur(b,{select:!0})):j.shiftKey&&k===b&&(j.preventDefault(),l&&ur(T,{select:!0})):k===R&&j.preventDefault()}},[l,i,P.paused]);return t.jsx(Oe.div,{tabIndex:-1,...f,ref:E,onKeyDown:C})});Ld.displayName=vb;function yb(r,{select:a=!1}={}){const l=document.activeElement;for(const i of r)if(ur(i,{select:a}),document.activeElement!==l)return}function wb(r){const a=Op(r),l=Em(a,r),i=Em(a.reverse(),r);return[l,i]}function Op(r){const a=[],l=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const c=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||c?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;l.nextNode();)a.push(l.currentNode);return a}function Em(r,a){for(const l of r)if(!jb(l,{upTo:a}))return l}function jb(r,{upTo:a}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(a!==void 0&&r===a)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function bb(r){return r instanceof HTMLInputElement&&"select"in r}function ur(r,{select:a=!1}={}){if(r&&r.focus){const l=document.activeElement;r.focus({preventScroll:!0}),r!==l&&bb(r)&&a&&r.select()}}var Pm=Nb();function Nb(){let r=[];return{add(a){const l=r[0];a!==l&&(l==null||l.pause()),r=Rm(r,a),r.unshift(a)},remove(a){var l;r=Rm(r,a),(l=r[0])==null||l.resume()}}}function Rm(r,a){const l=[...r],i=l.indexOf(a);return i!==-1&&l.splice(i,1),l}function Sb(r){return r.filter(a=>a.tagName!=="A")}var Cb="Portal",Od=p.forwardRef((r,a)=>{var m;const{container:l,...i}=r,[c,u]=p.useState(!1);Et(()=>u(!0),[]);const f=l||c&&((m=globalThis==null?void 0:globalThis.document)==null?void 0:m.body);return f?ey.createPortal(t.jsx(Oe.div,{...i,ref:a}),f):null});Od.displayName=Cb;function kb(r,a){return p.useReducer((l,i)=>a[l][i]??l,r)}var Da=r=>{const{present:a,children:l}=r,i=Eb(a),c=typeof l=="function"?l({present:i.isPresent}):p.Children.only(l),u=Ke(i.ref,Pb(c));return typeof l=="function"||i.isPresent?p.cloneElement(c,{ref:u}):null};Da.displayName="Presence";function Eb(r){const[a,l]=p.useState(),i=p.useRef(null),c=p.useRef(r),u=p.useRef("none"),f=r?"mounted":"unmounted",[m,x]=kb(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const y=Xl(i.current);u.current=m==="mounted"?y:"none"},[m]),Et(()=>{const y=i.current,g=c.current;if(g!==r){const E=u.current,P=Xl(y);r?x("MOUNT"):P==="none"||(y==null?void 0:y.display)==="none"?x("UNMOUNT"):x(g&&E!==P?"ANIMATION_OUT":"UNMOUNT"),c.current=r}},[r,x]),Et(()=>{if(a){let y;const g=a.ownerDocument.defaultView??window,v=P=>{const j=Xl(i.current).includes(CSS.escape(P.animationName));if(P.target===a&&j&&(x("ANIMATION_END"),!c.current)){const N=a.style.animationFillMode;a.style.animationFillMode="forwards",y=g.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=N)})}},E=P=>{P.target===a&&(u.current=Xl(i.current))};return a.addEventListener("animationstart",E),a.addEventListener("animationcancel",v),a.addEventListener("animationend",v),()=>{g.clearTimeout(y),a.removeEventListener("animationstart",E),a.removeEventListener("animationcancel",v),a.removeEventListener("animationend",v)}}else x("ANIMATION_END")},[a,x]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:p.useCallback(y=>{i.current=y?getComputedStyle(y):null,l(y)},[])}}function Xl(r){return(r==null?void 0:r.animationName)||"none"}function Pb(r){var i,c;let a=(i=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:i.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}var Bc=0;function Dp(){p.useEffect(()=>{const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",r[0]??_m()),document.body.insertAdjacentElement("beforeend",r[1]??_m()),Bc++,()=>{Bc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Bc--}},[])}function _m(){const r=document.createElement("span");return r.setAttribute("data-radix-focus-guard",""),r.tabIndex=0,r.style.outline="none",r.style.opacity="0",r.style.position="fixed",r.style.pointerEvents="none",r}var Sn=function(){return Sn=Object.assign||function(a){for(var l,i=1,c=arguments.length;i"u")return Hb;var a=Kb(r),l=document.documentElement.clientWidth,i=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,i-l+a[2]-a[0])}},Qb=Bp(),Cs="data-scroll-locked",Yb=function(r,a,l,i){var c=r.left,u=r.top,f=r.right,m=r.gap;return l===void 0&&(l="margin"),` .`.concat(_b,` { overflow: hidden `).concat(i,`; padding-right: `).concat(m,"px ").concat(i,`; } body[`).concat(Cs,`] { overflow: hidden `).concat(i,`; overscroll-behavior: contain; `).concat([a&&"position: relative ".concat(i,";"),l==="margin"&&` padding-left: `.concat(c,`px; padding-top: `).concat(u,`px; padding-right: `).concat(f,`px; margin-left:0; margin-top:0; margin-right: `).concat(m,"px ").concat(i,`; `),l==="padding"&&"padding-right: ".concat(m,"px ").concat(i,";")].filter(Boolean).join(""),` } .`).concat(so,` { right: `).concat(m,"px ").concat(i,`; } .`).concat(ao,` { margin-right: `).concat(m,"px ").concat(i,`; } .`).concat(so," .").concat(so,` { right: 0 `).concat(i,`; } .`).concat(ao," .").concat(ao,` { margin-right: 0 `).concat(i,`; } body[`).concat(Cs,`] { `).concat(Tb,": ").concat(m,`px; } `)},Im=function(){var r=parseInt(document.body.getAttribute(Cs)||"0",10);return isFinite(r)?r:0},qb=function(){p.useEffect(function(){return document.body.setAttribute(Cs,(Im()+1).toString()),function(){var r=Im()-1;r<=0?document.body.removeAttribute(Cs):document.body.setAttribute(Cs,r.toString())}},[])},Xb=function(r){var a=r.noRelative,l=r.noImportant,i=r.gapMode,c=i===void 0?"margin":i;qb();var u=p.useMemo(function(){return Gb(c)},[c]);return p.createElement(Qb,{styles:Yb(u,!a,c,l?"":"!important")})},dd=!1;if(typeof window<"u")try{var Jl=Object.defineProperty({},"passive",{get:function(){return dd=!0,!0}});window.addEventListener("test",Jl,Jl),window.removeEventListener("test",Jl,Jl)}catch{dd=!1}var bs=dd?{passive:!1}:!1,Jb=function(r){return r.tagName==="TEXTAREA"},Vp=function(r,a){if(!(r instanceof Element))return!1;var l=window.getComputedStyle(r);return l[a]!=="hidden"&&!(l.overflowY===l.overflowX&&!Jb(r)&&l[a]==="visible")},Zb=function(r){return Vp(r,"overflowY")},eN=function(r){return Vp(r,"overflowX")},Am=function(r,a){var l=a.ownerDocument,i=a;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var c=Up(r,i);if(c){var u=Wp(r,i),f=u[1],m=u[2];if(f>m)return!0}i=i.parentNode}while(i&&i!==l.body);return!1},tN=function(r){var a=r.scrollTop,l=r.scrollHeight,i=r.clientHeight;return[a,l,i]},nN=function(r){var a=r.scrollLeft,l=r.scrollWidth,i=r.clientWidth;return[a,l,i]},Up=function(r,a){return r==="v"?Zb(a):eN(a)},Wp=function(r,a){return r==="v"?tN(a):nN(a)},rN=function(r,a){return r==="h"&&a==="rtl"?-1:1},sN=function(r,a,l,i,c){var u=rN(r,window.getComputedStyle(a).direction),f=u*i,m=l.target,x=a.contains(m),y=!1,g=f>0,v=0,E=0;do{if(!m)break;var P=Wp(r,m),C=P[0],j=P[1],N=P[2],k=j-N-u*C;(C||k)&&Up(r,m)&&(v+=k,E+=C);var R=m.parentNode;m=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!x&&m!==document.body||x&&(a.contains(m)||a===m));return(g&&Math.abs(v)<1||!g&&Math.abs(E)<1)&&(y=!0),y},Zl=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},Mm=function(r){return[r.deltaX,r.deltaY]},Lm=function(r){return r&&"current"in r?r.current:r},aN=function(r,a){return r[0]===a[0]&&r[1]===a[1]},lN=function(r){return` .block-interactivity-`.concat(r,` {pointer-events: none;} .allow-interactivity-`).concat(r,` {pointer-events: all;} `)},oN=0,Ns=[];function iN(r){var a=p.useRef([]),l=p.useRef([0,0]),i=p.useRef(),c=p.useState(oN++)[0],u=p.useState(Bp)[0],f=p.useRef(r);p.useEffect(function(){f.current=r},[r]),p.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(c));var j=Rb([r.lockRef.current],(r.shards||[]).map(Lm),!0).filter(Boolean);return j.forEach(function(N){return N.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),j.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(c))})}}},[r.inert,r.lockRef.current,r.shards]);var m=p.useCallback(function(j,N){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!f.current.allowPinchZoom;var k=Zl(j),R=l.current,b="deltaX"in j?j.deltaX:R[0]-k[0],T="deltaY"in j?j.deltaY:R[1]-k[1],B,G=j.target,M=Math.abs(b)>Math.abs(T)?"h":"v";if("touches"in j&&M==="h"&&G.type==="range")return!1;var V=window.getSelection(),ee=V&&V.anchorNode,de=ee?ee===G||ee.contains(G):!1;if(de)return!1;var ce=Am(M,G);if(!ce)return!0;if(ce?B=M:(B=M==="v"?"h":"v",ce=Am(M,G)),!ce)return!1;if(!i.current&&"changedTouches"in j&&(b||T)&&(i.current=B),!B)return!0;var le=i.current||B;return sN(le,N,j,le==="h"?b:T)},[]),x=p.useCallback(function(j){var N=j;if(!(!Ns.length||Ns[Ns.length-1]!==u)){var k="deltaY"in N?Mm(N):Zl(N),R=a.current.filter(function(B){return B.name===N.type&&(B.target===N.target||N.target===B.shadowParent)&&aN(B.delta,k)})[0];if(R&&R.should){N.cancelable&&N.preventDefault();return}if(!R){var b=(f.current.shards||[]).map(Lm).filter(Boolean).filter(function(B){return B.contains(N.target)}),T=b.length>0?m(N,b[0]):!f.current.noIsolation;T&&N.cancelable&&N.preventDefault()}}},[]),y=p.useCallback(function(j,N,k,R){var b={name:j,delta:N,target:k,should:R,shadowParent:cN(k)};a.current.push(b),setTimeout(function(){a.current=a.current.filter(function(T){return T!==b})},1)},[]),g=p.useCallback(function(j){l.current=Zl(j),i.current=void 0},[]),v=p.useCallback(function(j){y(j.type,Mm(j),j.target,m(j,r.lockRef.current))},[]),E=p.useCallback(function(j){y(j.type,Zl(j),j.target,m(j,r.lockRef.current))},[]);p.useEffect(function(){return Ns.push(u),r.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:E}),document.addEventListener("wheel",x,bs),document.addEventListener("touchmove",x,bs),document.addEventListener("touchstart",g,bs),function(){Ns=Ns.filter(function(j){return j!==u}),document.removeEventListener("wheel",x,bs),document.removeEventListener("touchmove",x,bs),document.removeEventListener("touchstart",g,bs)}},[]);var P=r.removeScrollBar,C=r.inert;return p.createElement(p.Fragment,null,C?p.createElement(u,{styles:lN(c)}):null,P?p.createElement(Xb,{noRelative:r.noRelative,gapMode:r.gapMode}):null)}function cN(r){for(var a=null;r!==null;)r instanceof ShadowRoot&&(a=r.host,r=r.host),r=r.parentNode;return a}const dN=Fb($p,iN);var Dd=p.forwardRef(function(r,a){return p.createElement(Ro,Sn({},r,{ref:a,sideCar:dN}))});Dd.classNames=Ro.classNames;var uN=function(r){if(typeof document>"u")return null;var a=Array.isArray(r)?r[0]:r;return a.ownerDocument.body},Ss=new WeakMap,eo=new WeakMap,to={},Hc=0,Hp=function(r){return r&&(r.host||Hp(r.parentNode))},fN=function(r,a){return a.map(function(l){if(r.contains(l))return l;var i=Hp(l);return i&&r.contains(i)?i:(console.error("aria-hidden",l,"in not contained inside",r,". Doing nothing"),null)}).filter(function(l){return!!l})},hN=function(r,a,l,i){var c=fN(a,Array.isArray(r)?r:[r]);to[l]||(to[l]=new WeakMap);var u=to[l],f=[],m=new Set,x=new Set(c),y=function(v){!v||m.has(v)||(m.add(v),y(v.parentNode))};c.forEach(y);var g=function(v){!v||x.has(v)||Array.prototype.forEach.call(v.children,function(E){if(m.has(E))g(E);else try{var P=E.getAttribute(i),C=P!==null&&P!=="false",j=(Ss.get(E)||0)+1,N=(u.get(E)||0)+1;Ss.set(E,j),u.set(E,N),f.push(E),j===1&&C&&eo.set(E,!0),N===1&&E.setAttribute(l,"true"),C||E.setAttribute(i,"true")}catch(k){console.error("aria-hidden: cannot operate on ",E,k)}})};return g(a),m.clear(),Hc++,function(){f.forEach(function(v){var E=Ss.get(v)-1,P=u.get(v)-1;Ss.set(v,E),u.set(v,P),E||(eo.has(v)||v.removeAttribute(i),eo.delete(v)),P||v.removeAttribute(l)}),Hc--,Hc||(Ss=new WeakMap,Ss=new WeakMap,eo=new WeakMap,to={})}},Kp=function(r,a,l){l===void 0&&(l="data-aria-hidden");var i=Array.from(Array.isArray(r)?r:[r]),c=uN(r);return c?(i.push.apply(i,Array.from(c.querySelectorAll("[aria-live], script"))),hN(i,c,l,"aria-hidden")):function(){return null}},_o="Dialog",[Gp]=wr(_o),[mN,vn]=Gp(_o),Qp=r=>{const{__scopeDialog:a,children:l,open:i,defaultOpen:c,onOpenChange:u,modal:f=!0}=r,m=p.useRef(null),x=p.useRef(null),[y,g]=Wr({prop:i,defaultProp:c??!1,onChange:u,caller:_o});return t.jsx(mN,{scope:a,triggerRef:m,contentRef:x,contentId:pr(),titleId:pr(),descriptionId:pr(),open:y,onOpenChange:g,onOpenToggle:p.useCallback(()=>g(v=>!v),[g]),modal:f,children:l})};Qp.displayName=_o;var Yp="DialogTrigger",pN=p.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=vn(Yp,l),u=Ke(a,c.triggerRef);return t.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":$d(c.open),...i,ref:u,onClick:Te(r.onClick,c.onOpenToggle)})});pN.displayName=Yp;var Fd="DialogPortal",[xN,qp]=Gp(Fd,{forceMount:void 0}),Xp=r=>{const{__scopeDialog:a,forceMount:l,children:i,container:c}=r,u=vn(Fd,a);return t.jsx(xN,{scope:a,forceMount:l,children:p.Children.map(i,f=>t.jsx(Da,{present:l||u.open,children:t.jsx(Od,{asChild:!0,container:c,children:f})}))})};Xp.displayName=Fd;var xo="DialogOverlay",Jp=p.forwardRef((r,a)=>{const l=qp(xo,r.__scopeDialog),{forceMount:i=l.forceMount,...c}=r,u=vn(xo,r.__scopeDialog);return u.modal?t.jsx(Da,{present:i||u.open,children:t.jsx(vN,{...c,ref:a})}):null});Jp.displayName=xo;var gN=Aa("DialogOverlay.RemoveScroll"),vN=p.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=vn(xo,l);return t.jsx(Dd,{as:gN,allowPinchZoom:!0,shards:[c.contentRef],children:t.jsx(Oe.div,{"data-state":$d(c.open),...i,ref:a,style:{pointerEvents:"auto",...i.style}})})}),Hr="DialogContent",Zp=p.forwardRef((r,a)=>{const l=qp(Hr,r.__scopeDialog),{forceMount:i=l.forceMount,...c}=r,u=vn(Hr,r.__scopeDialog);return t.jsx(Da,{present:i||u.open,children:u.modal?t.jsx(yN,{...c,ref:a}):t.jsx(wN,{...c,ref:a})})});Zp.displayName=Hr;var yN=p.forwardRef((r,a)=>{const l=vn(Hr,r.__scopeDialog),i=p.useRef(null),c=Ke(a,l.contentRef,i);return p.useEffect(()=>{const u=i.current;if(u)return Kp(u)},[]),t.jsx(ex,{...r,ref:c,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(r.onCloseAutoFocus,u=>{var f;u.preventDefault(),(f=l.triggerRef.current)==null||f.focus()}),onPointerDownOutside:Te(r.onPointerDownOutside,u=>{const f=u.detail.originalEvent,m=f.button===0&&f.ctrlKey===!0;(f.button===2||m)&&u.preventDefault()}),onFocusOutside:Te(r.onFocusOutside,u=>u.preventDefault())})}),wN=p.forwardRef((r,a)=>{const l=vn(Hr,r.__scopeDialog),i=p.useRef(!1),c=p.useRef(!1);return t.jsx(ex,{...r,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var f,m;(f=r.onCloseAutoFocus)==null||f.call(r,u),u.defaultPrevented||(i.current||(m=l.triggerRef.current)==null||m.focus(),u.preventDefault()),i.current=!1,c.current=!1},onInteractOutside:u=>{var x,y;(x=r.onInteractOutside)==null||x.call(r,u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const f=u.target;((y=l.triggerRef.current)==null?void 0:y.contains(f))&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&c.current&&u.preventDefault()}})}),ex=p.forwardRef((r,a)=>{const{__scopeDialog:l,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:u,...f}=r,m=vn(Hr,l),x=p.useRef(null),y=Ke(a,x);return Dp(),t.jsxs(t.Fragment,{children:[t.jsx(Ld,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:c,onUnmountAutoFocus:u,children:t.jsx(Md,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":$d(m.open),...f,ref:y,onDismiss:()=>m.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(jN,{titleId:m.titleId}),t.jsx(NN,{contentRef:x,descriptionId:m.descriptionId})]})]})}),zd="DialogTitle",tx=p.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=vn(zd,l);return t.jsx(Oe.h2,{id:c.titleId,...i,ref:a})});tx.displayName=zd;var nx="DialogDescription",rx=p.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=vn(nx,l);return t.jsx(Oe.p,{id:c.descriptionId,...i,ref:a})});rx.displayName=nx;var sx="DialogClose",ax=p.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=vn(sx,l);return t.jsx(Oe.button,{type:"button",...i,ref:a,onClick:Te(r.onClick,()=>c.onOpenChange(!1))})});ax.displayName=sx;function $d(r){return r?"open":"closed"}var lx="DialogTitleWarning",[tk,ox]=q1(lx,{contentName:Hr,titleName:zd,docsSlug:"dialog"}),jN=({titleId:r})=>{const a=ox(lx),l=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return p.useEffect(()=>{r&&(document.getElementById(r)||console.error(l))},[l,r]),null},bN="DialogDescriptionWarning",NN=({contentRef:r,descriptionId:a})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ox(bN).contentName}}.`;return p.useEffect(()=>{var u;const c=(u=r.current)==null?void 0:u.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(i))},[i,r,a]),null},SN=Qp,CN=Xp,kN=Jp,EN=Zp,PN=tx,RN=rx,_N=ax;function tn(r){return t.jsx(SN,{"data-slot":"dialog",...r})}function TN(r){return t.jsx(CN,{...r})}const ix=p.forwardRef(({className:r,...a},l)=>t.jsx(kN,{ref:l,className:Ge("fixed inset-0 z-50 bg-black/50",r),...a}));ix.displayName="DialogOverlay";const Ht=p.forwardRef(({className:r,children:a,showCloseButton:l=!0,...i},c)=>t.jsxs(TN,{children:[t.jsx(ix,{}),t.jsxs(EN,{ref:c,className:Ge("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg sm:max-w-lg",r),...i,children:[a,l&&t.jsxs(_N,{className:"absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[t.jsx(zn,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ht.displayName="DialogContent";function nn({className:r,...a}){return t.jsx("div",{className:Ge("flex flex-col gap-2 text-center sm:text-left",r),...a})}function mn({className:r,...a}){return t.jsx("div",{className:Ge("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",r),...a})}function rn(r){return t.jsx(PN,{className:"text-lg font-semibold leading-none",...r})}function IN(r){return t.jsx(RN,{className:"text-sm text-muted-foreground",...r})}function cx(r,a){const[l,i]=p.useState(r);return p.useEffect(()=>{const c=setTimeout(()=>i(r),a);return()=>clearTimeout(c)},[r,a]),l}function Vr({page:r,totalPages:a,total:l,pageSize:i,onPageChange:c,onPageSizeChange:u,pageSizeOptions:f=[10,20,50,100]}){return a<=1&&!u?null:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[t.jsxs("span",{children:["共 ",l," 条"]}),u&&t.jsx("select",{value:i,onChange:m=>u(Number(m.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:f.map(m=>t.jsxs("option",{value:m,children:[m," 条/页"]},m))})]}),a>1&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>c(1),disabled:r<=1,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"首页"}),t.jsx("button",{type:"button",onClick:()=>c(r-1),disabled:r<=1,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"上一页"}),t.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[r," / ",a]}),t.jsx("button",{type:"button",onClick:()=>c(r+1),disabled:r>=a,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),t.jsx("button",{type:"button",onClick:()=>c(a),disabled:r>=a,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"末页"})]})]})}function AN(){const[r,a]=p.useState([]),[l,i]=p.useState([]),[c,u]=p.useState(0),[f,m]=p.useState(0),[x,y]=p.useState(0),[g,v]=p.useState(1),[E,P]=p.useState(10),[C,j]=p.useState(""),N=cx(C,300),[k,R]=p.useState("all"),[b,T]=p.useState(!0),[B,G]=p.useState(null),[M,V]=p.useState(null),[ee,de]=p.useState(""),[ce,le]=p.useState(!1);async function ue(){T(!0),G(null);try{const $=k==="all"?"":k==="completed"?"completed":k,S=new URLSearchParams({page:String(g),pageSize:String(E),...$&&{status:$},...N&&{search:N}}),[O,se]=await Promise.all([He(`/api/orders?${S}`),He("/api/db/users?page=1&pageSize=500")]);O!=null&&O.success&&(a(O.orders||[]),u(O.total??0),m(O.totalRevenue??0),y(O.todayRevenue??0)),se!=null&&se.success&&se.users&&i(se.users)}catch($){console.error("加载订单失败",$),G("加载订单失败,请检查网络后重试")}finally{T(!1)}}p.useEffect(()=>{v(1)},[N,k]),p.useEffect(()=>{ue()},[g,E,N,k]);const H=$=>{var S;return $.userNickname||((S=l.find(O=>O.id===$.userId))==null?void 0:S.nickname)||"匿名用户"},W=$=>{var S;return((S=l.find(O=>O.id===$))==null?void 0:S.phone)||"-"},Q=$=>{const S=$.productType||$.type||"",O=$.description||"";if(O){if(S==="section"&&O.includes("章节")){if(O.includes("-")){const se=O.split("-");if(se.length>=3)return{name:`第${se[1]}章 第${se[2]}节`,type:"《一场Soul的创业实验》"}}return{name:O,type:"章节购买"}}return S==="fullbook"||O.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:S==="vip"||O.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:S==="match"||O.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:O,type:"其他"}}return S==="section"?{name:`章节 ${$.productId||$.sectionId||""}`,type:"单章"}:S==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:S==="vip"?{name:"VIP年度会员",type:"VIP"}:S==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:S||"其他"}},K=Math.ceil(c/E)||1;async function A(){var $;if(!(!(M!=null&&M.orderSn)&&!(M!=null&&M.id))){le(!0),G(null);try{const S=await Wt("/api/admin/orders/refund",{orderSn:M.orderSn||M.id,reason:ee||void 0});S!=null&&S.success?(V(null),de(""),ue()):G((S==null?void 0:S.error)||"退款失败")}catch(S){const O=S;G((($=O==null?void 0:O.data)==null?void 0:$.error)||"退款失败,请检查网络后重试")}finally{le(!1)}}}function X(){if(r.length===0){alert("暂无数据可导出");return}const $=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],S=r.map(me=>{const Y=Q(me);return[me.orderSn||me.id||"",H(me),W(me.userId),Y.name,Number(me.amount||0).toFixed(2),me.paymentMethod==="wechat"?"微信支付":me.paymentMethod==="alipay"?"支付宝":me.paymentMethod||"微信支付",me.status==="refunded"?"已退款":me.status==="paid"||me.status==="completed"?"已完成":me.status==="pending"||me.status==="created"?"待支付":"已失败",me.status==="refunded"&&me.refundReason?me.refundReason:"-",me.referrerEarnings?Number(me.referrerEarnings).toFixed(2):"-",me.createdAt?new Date(me.createdAt).toLocaleString("zh-CN"):""].join(",")}),O="\uFEFF"+[$.join(","),...S].join(` `),se=new Blob([O],{type:"text/csv;charset=utf-8"}),oe=URL.createObjectURL(se),be=document.createElement("a");be.href=oe,be.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,be.click(),URL.revokeObjectURL(oe)}return t.jsxs("div",{className:"p-8 w-full",children:[B&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:B}),t.jsx("button",{type:"button",onClick:()=>G(null),className:"hover:text-red-300",children:"×"})]}),t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),t.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",r.length," 笔订单"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(he,{variant:"outline",onClick:ue,disabled:b,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${b?"animate-spin":""}`}),"刷新"]}),t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"text-gray-400",children:"总收入:"}),t.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",f.toFixed(2)]}),t.jsx("span",{className:"text-gray-600",children:"|"}),t.jsx("span",{className:"text-gray-400",children:"今日:"}),t.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",x.toFixed(2)]})]})]})]}),t.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[t.jsxs("div",{className:"relative flex-1 max-w-md",children:[t.jsx(Br,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(ie,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:C,onChange:$=>j($.target.value)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(zw,{className:"w-4 h-4 text-gray-400"}),t.jsxs("select",{value:k,onChange:$=>R($.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[t.jsx("option",{value:"all",children:"全部状态"}),t.jsx("option",{value:"completed",children:"已完成"}),t.jsx("option",{value:"pending",children:"待支付"}),t.jsx("option",{value:"created",children:"已创建"}),t.jsx("option",{value:"failed",children:"已失败"}),t.jsx("option",{value:"refunded",children:"已退款"})]})]}),t.jsxs(he,{variant:"outline",onClick:X,disabled:r.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Aw,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:b?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(st,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs("div",{children:[t.jsxs(Ls,{children:[t.jsx(Os,{children:t.jsxs(_t,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx($e,{className:"text-gray-400",children:"订单号"}),t.jsx($e,{className:"text-gray-400",children:"用户"}),t.jsx($e,{className:"text-gray-400",children:"商品"}),t.jsx($e,{className:"text-gray-400",children:"金额"}),t.jsx($e,{className:"text-gray-400",children:"支付方式"}),t.jsx($e,{className:"text-gray-400",children:"状态"}),t.jsx($e,{className:"text-gray-400",children:"退款原因"}),t.jsx($e,{className:"text-gray-400",children:"分销佣金"}),t.jsx($e,{className:"text-gray-400",children:"下单时间"}),t.jsx($e,{className:"text-gray-400",children:"操作"})]})}),t.jsxs(Ds,{children:[r.map($=>{const S=Q($);return t.jsxs(_t,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsxs(Me,{className:"font-mono text-xs text-gray-400",children:[($.orderSn||$.id||"").slice(0,12),"..."]}),t.jsx(Me,{children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:H($)}),t.jsx("p",{className:"text-gray-500 text-xs",children:W($.userId)})]})}),t.jsx(Me,{children:t.jsxs("div",{children:[t.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[S.name,($.productType||$.type)==="vip"&&t.jsx(Le,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),t.jsx("p",{className:"text-gray-500 text-xs",children:S.type})]})}),t.jsxs(Me,{className:"text-[#38bdac] font-bold",children:["¥",Number($.amount||0).toFixed(2)]}),t.jsx(Me,{className:"text-gray-300",children:$.paymentMethod==="wechat"?"微信支付":$.paymentMethod==="alipay"?"支付宝":$.paymentMethod||"微信支付"}),t.jsx(Me,{children:$.status==="refunded"?t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):$.status==="paid"||$.status==="completed"?t.jsx(Le,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):$.status==="pending"||$.status==="created"?t.jsx(Le,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):t.jsx(Le,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),t.jsx(Me,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:$.refundReason,children:$.status==="refunded"&&$.refundReason?$.refundReason:"-"}),t.jsx(Me,{className:"text-[#FFD700]",children:$.referrerEarnings?`¥${Number($.referrerEarnings).toFixed(2)}`:"-"}),t.jsx(Me,{className:"text-gray-400 text-sm",children:new Date($.createdAt).toLocaleString("zh-CN")}),t.jsx(Me,{children:($.status==="paid"||$.status==="completed")&&t.jsxs(he,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{V($),de("")},children:[t.jsx(mp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},$.id)}),r.length===0&&t.jsx(_t,{children:t.jsx(Me,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),t.jsx(Vr,{page:g,totalPages:K,total:c,pageSize:E,onPageChange:v,onPageSizeChange:$=>{P($),v(1)}})]})})}),t.jsx(tn,{open:!!M,onOpenChange:$=>!$&&V(null),children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(nn,{children:t.jsx(rn,{className:"text-white",children:"订单退款"})}),M&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",M.orderSn||M.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(M.amount||0).toFixed(2)]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),t.jsx("div",{className:"form-input",children:t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:ee,onChange:$=>de($.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(mn,{children:[t.jsx(he,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>V(null),disabled:ce,children:"取消"}),t.jsx(he,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:A,disabled:ce,children:ce?"退款中...":"确认退款"})]})]})})]})}var MN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],LN=MN.reduce((r,a)=>{const l=gp(`Primitive.${a}`),i=p.forwardRef((c,u)=>{const{asChild:f,...m}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...m,ref:u})});return i.displayName=`Primitive.${a}`,{...r,[a]:i}},{}),ON="Label",dx=p.forwardRef((r,a)=>t.jsx(LN.label,{...r,ref:a,onMouseDown:l=>{var c;l.target.closest("button, input, select, textarea")||((c=r.onMouseDown)==null||c.call(r,l),!l.defaultPrevented&&l.detail>1&&l.preventDefault())}}));dx.displayName=ON;var ux=dx;const ne=p.forwardRef(({className:r,...a},l)=>t.jsx(ux,{ref:l,className:Ge("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",r),...a}));ne.displayName=ux.displayName;function Bd(r){const a=p.useRef({value:r,previous:r});return p.useMemo(()=>(a.current.value!==r&&(a.current.previous=a.current.value,a.current.value=r),a.current.previous),[r])}function Vd(r){const[a,l]=p.useState(void 0);return Et(()=>{if(r){l({width:r.offsetWidth,height:r.offsetHeight});const i=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const u=c[0];let f,m;if("borderBoxSize"in u){const x=u.borderBoxSize,y=Array.isArray(x)?x[0]:x;f=y.inlineSize,m=y.blockSize}else f=r.offsetWidth,m=r.offsetHeight;l({width:f,height:m})});return i.observe(r,{box:"border-box"}),()=>i.unobserve(r)}else l(void 0)},[r]),a}var To="Switch",[DN]=wr(To),[FN,zN]=DN(To),fx=p.forwardRef((r,a)=>{const{__scopeSwitch:l,name:i,checked:c,defaultChecked:u,required:f,disabled:m,value:x="on",onCheckedChange:y,form:g,...v}=r,[E,P]=p.useState(null),C=Ke(a,b=>P(b)),j=p.useRef(!1),N=E?g||!!E.closest("form"):!0,[k,R]=Wr({prop:c,defaultProp:u??!1,onChange:y,caller:To});return t.jsxs(FN,{scope:l,checked:k,disabled:m,children:[t.jsx(Oe.button,{type:"button",role:"switch","aria-checked":k,"aria-required":f,"data-state":xx(k),"data-disabled":m?"":void 0,disabled:m,value:x,...v,ref:C,onClick:Te(r.onClick,b=>{R(T=>!T),N&&(j.current=b.isPropagationStopped(),j.current||b.stopPropagation())})}),N&&t.jsx(px,{control:E,bubbles:!j.current,name:i,value:x,checked:k,required:f,disabled:m,form:g,style:{transform:"translateX(-100%)"}})]})});fx.displayName=To;var hx="SwitchThumb",mx=p.forwardRef((r,a)=>{const{__scopeSwitch:l,...i}=r,c=zN(hx,l);return t.jsx(Oe.span,{"data-state":xx(c.checked),"data-disabled":c.disabled?"":void 0,...i,ref:a})});mx.displayName=hx;var $N="SwitchBubbleInput",px=p.forwardRef(({__scopeSwitch:r,control:a,checked:l,bubbles:i=!0,...c},u)=>{const f=p.useRef(null),m=Ke(f,u),x=Bd(l),y=Vd(a);return p.useEffect(()=>{const g=f.current;if(!g)return;const v=window.HTMLInputElement.prototype,P=Object.getOwnPropertyDescriptor(v,"checked").set;if(x!==l&&P){const C=new Event("click",{bubbles:i});P.call(g,l),g.dispatchEvent(C)}},[x,l,i]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:l,...c,tabIndex:-1,ref:m,style:{...c.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});px.displayName=$N;function xx(r){return r?"checked":"unchecked"}var gx=fx,BN=mx;const ut=p.forwardRef(({className:r,...a},l)=>t.jsx(gx,{className:Ge("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-[#38bdac] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a1628] disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-gray-600 data-[state=checked]:bg-[#38bdac]",r),...a,ref:l,children:t.jsx(BN,{className:Ge("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));ut.displayName=gx.displayName;function Ud(r){const a=r+"CollectionProvider",[l,i]=wr(a),[c,u]=l(a,{collectionRef:{current:null},itemMap:new Map}),f=j=>{const{scope:N,children:k}=j,R=dr.useRef(null),b=dr.useRef(new Map).current;return t.jsx(c,{scope:N,itemMap:b,collectionRef:R,children:k})};f.displayName=a;const m=r+"CollectionSlot",x=Aa(m),y=dr.forwardRef((j,N)=>{const{scope:k,children:R}=j,b=u(m,k),T=Ke(N,b.collectionRef);return t.jsx(x,{ref:T,children:R})});y.displayName=m;const g=r+"CollectionItemSlot",v="data-radix-collection-item",E=Aa(g),P=dr.forwardRef((j,N)=>{const{scope:k,children:R,...b}=j,T=dr.useRef(null),B=Ke(N,T),G=u(g,k);return dr.useEffect(()=>(G.itemMap.set(T,{ref:T,...b}),()=>void G.itemMap.delete(T))),t.jsx(E,{[v]:"",ref:B,children:R})});P.displayName=g;function C(j){const N=u(r+"CollectionConsumer",j);return dr.useCallback(()=>{const R=N.collectionRef.current;if(!R)return[];const b=Array.from(R.querySelectorAll(`[${v}]`));return Array.from(N.itemMap.values()).sort((G,M)=>b.indexOf(G.ref.current)-b.indexOf(M.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:f,Slot:y,ItemSlot:P},C,i]}var VN=p.createContext(void 0);function Io(r){const a=p.useContext(VN);return r||a||"ltr"}var Kc="rovingFocusGroup.onEntryFocus",UN={bubbles:!1,cancelable:!0},Fa="RovingFocusGroup",[ud,vx,WN]=Ud(Fa),[HN,yx]=wr(Fa,[WN]),[KN,GN]=HN(Fa),wx=p.forwardRef((r,a)=>t.jsx(ud.Provider,{scope:r.__scopeRovingFocusGroup,children:t.jsx(ud.Slot,{scope:r.__scopeRovingFocusGroup,children:t.jsx(QN,{...r,ref:a})})}));wx.displayName=Fa;var QN=p.forwardRef((r,a)=>{const{__scopeRovingFocusGroup:l,orientation:i,loop:c=!1,dir:u,currentTabStopId:f,defaultCurrentTabStopId:m,onCurrentTabStopIdChange:x,onEntryFocus:y,preventScrollOnEntryFocus:g=!1,...v}=r,E=p.useRef(null),P=Ke(a,E),C=Io(u),[j,N]=Wr({prop:f,defaultProp:m??null,onChange:x,caller:Fa}),[k,R]=p.useState(!1),b=xr(y),T=vx(l),B=p.useRef(!1),[G,M]=p.useState(0);return p.useEffect(()=>{const V=E.current;if(V)return V.addEventListener(Kc,b),()=>V.removeEventListener(Kc,b)},[b]),t.jsx(KN,{scope:l,orientation:i,dir:C,loop:c,currentTabStopId:j,onItemFocus:p.useCallback(V=>N(V),[N]),onItemShiftTab:p.useCallback(()=>R(!0),[]),onFocusableItemAdd:p.useCallback(()=>M(V=>V+1),[]),onFocusableItemRemove:p.useCallback(()=>M(V=>V-1),[]),children:t.jsx(Oe.div,{tabIndex:k||G===0?-1:0,"data-orientation":i,...v,ref:P,style:{outline:"none",...r.style},onMouseDown:Te(r.onMouseDown,()=>{B.current=!0}),onFocus:Te(r.onFocus,V=>{const ee=!B.current;if(V.target===V.currentTarget&&ee&&!k){const de=new CustomEvent(Kc,UN);if(V.currentTarget.dispatchEvent(de),!de.defaultPrevented){const ce=T().filter(Q=>Q.focusable),le=ce.find(Q=>Q.active),ue=ce.find(Q=>Q.id===j),W=[le,ue,...ce].filter(Boolean).map(Q=>Q.ref.current);Nx(W,g)}}B.current=!1}),onBlur:Te(r.onBlur,()=>R(!1))})})}),jx="RovingFocusGroupItem",bx=p.forwardRef((r,a)=>{const{__scopeRovingFocusGroup:l,focusable:i=!0,active:c=!1,tabStopId:u,children:f,...m}=r,x=pr(),y=u||x,g=GN(jx,l),v=g.currentTabStopId===y,E=vx(l),{onFocusableItemAdd:P,onFocusableItemRemove:C,currentTabStopId:j}=g;return p.useEffect(()=>{if(i)return P(),()=>C()},[i,P,C]),t.jsx(ud.ItemSlot,{scope:l,id:y,focusable:i,active:c,children:t.jsx(Oe.span,{tabIndex:v?0:-1,"data-orientation":g.orientation,...m,ref:a,onMouseDown:Te(r.onMouseDown,N=>{i?g.onItemFocus(y):N.preventDefault()}),onFocus:Te(r.onFocus,()=>g.onItemFocus(y)),onKeyDown:Te(r.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){g.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const k=XN(N,g.orientation,g.dir);if(k!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let b=E().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")b.reverse();else if(k==="prev"||k==="next"){k==="prev"&&b.reverse();const T=b.indexOf(N.currentTarget);b=g.loop?JN(b,T+1):b.slice(T+1)}setTimeout(()=>Nx(b))}}),children:typeof f=="function"?f({isCurrentTabStop:v,hasTabStop:j!=null}):f})})});bx.displayName=jx;var YN={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qN(r,a){return a!=="rtl"?r:r==="ArrowLeft"?"ArrowRight":r==="ArrowRight"?"ArrowLeft":r}function XN(r,a,l){const i=qN(r.key,l);if(!(a==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(a==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return YN[i]}function Nx(r,a=!1){const l=document.activeElement;for(const i of r)if(i===l||(i.focus({preventScroll:a}),document.activeElement!==l))return}function JN(r,a){return r.map((l,i)=>r[(a+i)%r.length])}var ZN=wx,e2=bx,Ao="Tabs",[t2]=wr(Ao,[yx]),Sx=yx(),[n2,Wd]=t2(Ao),Cx=p.forwardRef((r,a)=>{const{__scopeTabs:l,value:i,onValueChange:c,defaultValue:u,orientation:f="horizontal",dir:m,activationMode:x="automatic",...y}=r,g=Io(m),[v,E]=Wr({prop:i,onChange:c,defaultProp:u??"",caller:Ao});return t.jsx(n2,{scope:l,baseId:pr(),value:v,onValueChange:E,orientation:f,dir:g,activationMode:x,children:t.jsx(Oe.div,{dir:g,"data-orientation":f,...y,ref:a})})});Cx.displayName=Ao;var kx="TabsList",Ex=p.forwardRef((r,a)=>{const{__scopeTabs:l,loop:i=!0,...c}=r,u=Wd(kx,l),f=Sx(l);return t.jsx(ZN,{asChild:!0,...f,orientation:u.orientation,dir:u.dir,loop:i,children:t.jsx(Oe.div,{role:"tablist","aria-orientation":u.orientation,...c,ref:a})})});Ex.displayName=kx;var Px="TabsTrigger",Rx=p.forwardRef((r,a)=>{const{__scopeTabs:l,value:i,disabled:c=!1,...u}=r,f=Wd(Px,l),m=Sx(l),x=Ix(f.baseId,i),y=Ax(f.baseId,i),g=i===f.value;return t.jsx(e2,{asChild:!0,...m,focusable:!c,active:g,children:t.jsx(Oe.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":y,"data-state":g?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:x,...u,ref:a,onMouseDown:Te(r.onMouseDown,v=>{!c&&v.button===0&&v.ctrlKey===!1?f.onValueChange(i):v.preventDefault()}),onKeyDown:Te(r.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&f.onValueChange(i)}),onFocus:Te(r.onFocus,()=>{const v=f.activationMode!=="manual";!g&&!c&&v&&f.onValueChange(i)})})})});Rx.displayName=Px;var _x="TabsContent",Tx=p.forwardRef((r,a)=>{const{__scopeTabs:l,value:i,forceMount:c,children:u,...f}=r,m=Wd(_x,l),x=Ix(m.baseId,i),y=Ax(m.baseId,i),g=i===m.value,v=p.useRef(g);return p.useEffect(()=>{const E=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(E)},[]),t.jsx(Da,{present:c||g,children:({present:E})=>t.jsx(Oe.div,{"data-state":g?"active":"inactive","data-orientation":m.orientation,role:"tabpanel","aria-labelledby":x,hidden:!E,id:y,tabIndex:0,...f,ref:a,style:{...r.style,animationDuration:v.current?"0s":void 0},children:E&&u})})});Tx.displayName=_x;function Ix(r,a){return`${r}-trigger-${a}`}function Ax(r,a){return`${r}-content-${a}`}var r2=Cx,Mx=Ex,Lx=Rx,Ox=Tx;const Hd=r2,Mo=p.forwardRef(({className:r,...a},l)=>t.jsx(Mx,{ref:l,className:Ge("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",r),...a}));Mo.displayName=Mx.displayName;const Zt=p.forwardRef(({className:r,...a},l)=>t.jsx(Lx,{ref:l,className:Ge("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",r),...a}));Zt.displayName=Lx.displayName;const en=p.forwardRef(({className:r,...a},l)=>t.jsx(Ox,{ref:l,className:Ge("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r),...a}));en.displayName=Ox.displayName;function s2({open:r,onClose:a,userId:l,onUserUpdated:i}){var Q;const[c,u]=p.useState(null),[f,m]=p.useState([]),[x,y]=p.useState([]),[g,v]=p.useState(!1),[E,P]=p.useState(!1),[C,j]=p.useState(!1),[N,k]=p.useState("info"),[R,b]=p.useState(""),[T,B]=p.useState(""),[G,M]=p.useState([]),[V,ee]=p.useState("");p.useEffect(()=>{r&&l&&de()},[r,l]);async function de(){if(l){v(!0);try{const K=await He(`/api/db/users?id=${encodeURIComponent(l)}`);if(K!=null&&K.success&&K.user){const A=K.user;u(A),b(A.phone||""),B(A.nickname||""),M(typeof A.tags=="string"?JSON.parse(A.tags||"[]"):[])}try{const A=await He(`/api/user/track?userId=${encodeURIComponent(l)}&limit=50`);A!=null&&A.success&&A.tracks&&m(A.tracks)}catch{m([])}try{const A=await He(`/api/db/users/referrals?userId=${encodeURIComponent(l)}`);A!=null&&A.success&&A.referrals&&y(A.referrals)}catch{y([])}}catch(K){console.error("Load user detail error:",K)}finally{v(!1)}}}async function ce(){if(!(c!=null&&c.phone)){alert("用户未绑定手机号,无法同步");return}P(!0);try{const K=await bt("/api/ckb/sync",{action:"full_sync",phone:c.phone,userId:c.id});K!=null&&K.success?(alert("同步成功"),de()):alert("同步失败: "+(K==null?void 0:K.error))}catch(K){console.error("Sync CKB error:",K),alert("同步失败")}finally{P(!1)}}async function le(){if(c){j(!0);try{const K={id:c.id,phone:R||void 0,nickname:T||void 0,tags:JSON.stringify(G)},A=await Wt("/api/db/users",K);A!=null&&A.success?(alert("保存成功"),de(),i==null||i()):alert("保存失败: "+(A==null?void 0:A.error))}catch(K){console.error("Save user error:",K),alert("保存失败")}finally{j(!1)}}}const ue=()=>{V&&!G.includes(V)&&(M([...G,V]),ee(""))},H=K=>{M(G.filter(A=>A!==K))},W=K=>{const X={view_chapter:Ps,purchase:ad,match:En,login:ro,register:ro,share:zr,bind_phone:gj,bind_wechat:dj}[K]||dm;return t.jsx(X,{className:"w-4 h-4"})};return r?t.jsx(tn,{open:r,onOpenChange:()=>a(),children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx(ro,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(c==null?void 0:c.phone)&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"})]})}),g?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(st,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):c?t.jsxs("div",{className:"flex flex-col h-[70vh]",children:[t.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-4",children:[t.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac]",children:c.avatar?t.jsx("img",{src:c.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Q=c.nickname)==null?void 0:Q.charAt(0))||"?"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h3",{className:"text-lg font-bold text-white",children:c.nickname}),c.isAdmin&&t.jsx(Le,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),c.hasFullBook&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"})]}),t.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[c.phone?`📱 ${c.phone}`:"未绑定手机",c.wechatId&&` · 💬 ${c.wechatId}`]}),t.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["ID: ",c.id," · 推广码: ",c.referralCode??"-"]})]}),t.jsxs("div",{className:"text-right",children:[t.jsxs("p",{className:"text-[#38bdac] font-bold",children:["¥",(c.earnings||0).toFixed(2)]}),t.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),t.jsxs(Hd,{value:N,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs(Mo,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-4",children:[t.jsx(Zt,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"基础信息"}),t.jsx(Zt,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"标签体系"}),t.jsx(Zt,{value:"tracks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"行为轨迹"}),t.jsx(Zt,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"关系链路"})]}),t.jsxs(en,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"手机号"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:R,onChange:K=>b(K.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"昵称"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:T,onChange:K=>B(K.target.value)})]})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),t.jsx("p",{className:"text-2xl font-bold text-white",children:c.referralCount??0})]}),t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),t.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(c.pendingEarnings??0).toFixed(2)]})]}),t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),t.jsx("p",{className:"text-sm text-white",children:c.createdAt?new Date(c.createdAt).toLocaleDateString():"-"})]})]}),t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(zr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),t.jsx(he,{size:"sm",onClick:ce,disabled:E||!c.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(st,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(st,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-gray-500",children:"同步状态:"}),c.ckbSyncedAt?t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-gray-500",children:"最后同步:"}),t.jsx("span",{className:"text-gray-300 ml-1",children:c.ckbSyncedAt?new Date(c.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),t.jsx(en,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx(Tj,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"系统标签"})]}),t.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[G.map((K,A)=>t.jsxs(Le,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[K,t.jsx("button",{type:"button",onClick:()=>H(K),className:"ml-1 hover:text-red-400",children:t.jsx(zn,{className:"w-3 h-3"})})]},A)),G.length===0&&t.jsx("span",{className:"text-gray-500 text-sm",children:"暂无标签"})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"添加新标签",value:V,onChange:K=>ee(K.target.value),onKeyDown:K=>K.key==="Enter"&&ue()}),t.jsx(he,{onClick:ue,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})}),t.jsx(en,{value:"tracks",className:"flex-1 overflow-auto",children:t.jsx("div",{className:"space-y-2",children:f.length>0?f.map(K=>t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:W(K.action)}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-white font-medium",children:K.actionLabel}),K.chapterTitle&&t.jsxs("span",{className:"text-gray-400 text-sm",children:["- ",K.chapterTitle]})]}),t.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:[t.jsx(fp,{className:"w-3 h-3 inline mr-1"}),K.timeAgo," · ",new Date(K.createdAt).toLocaleString()]})]})]},K.id)):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(dm,{className:"w-10 h-10 text-[#38bdac]/40 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-400",children:"暂无行为轨迹"})]})})}),t.jsx(en,{value:"relations",className:"flex-1 overflow-auto space-y-4",children:t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(zr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"推荐的用户"})]}),t.jsxs(Le,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:["共 ",x.length," 人"]})]}),t.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto",children:x.length>0?x.map((K,A)=>{var $;const X=K;return t.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:(($=X.nickname)==null?void 0:$.charAt(0))||"?"}),t.jsx("span",{className:"text-white text-sm",children:X.nickname})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[X.status==="vip"&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),t.jsx("span",{className:"text-gray-500 text-xs",children:X.createdAt?new Date(X.createdAt).toLocaleDateString():""})]})]},X.id||A)}):t.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-gray-700 mt-4",children:[t.jsxs(he,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(zn,{className:"w-4 h-4 mr-2"}),"关闭"]}),t.jsxs(he,{onClick:le,disabled:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),C?"保存中...":"保存修改"]})]})]}):t.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}const Gc={isVip:!1,vipExpireDate:"",vipSort:"",vipRole:"",vipRoleCustom:"",vipName:"",vipProject:"",vipContact:"",vipBio:""};function a2({open:r,onClose:a,userId:l,userNickname:i="",onSaved:c}){const[u,f]=p.useState(Gc),[m,x]=p.useState([]),[y,g]=p.useState(!1),[v,E]=p.useState(!1);p.useEffect(()=>{if(!r){f(Gc);return}let C=!1;return g(!0),Promise.all([He("/api/db/vip-roles"),l?He(`/api/db/users?id=${encodeURIComponent(l)}`):Promise.resolve(null)]).then(([j,N])=>{if(C)return;const k=j!=null&&j.success&&j.data?j.data:[];x(k);const R=N&&N.user?N.user:null;if(R){const b=String(R.vipRole??""),T=k.some(B=>B.name===b);f({isVip:!!(R.isVip??!1),vipExpireDate:R.vipExpireDate?String(R.vipExpireDate).slice(0,10):"",vipSort:typeof R.vipSort=="number"?R.vipSort:"",vipRole:T?b:b?"__custom__":"",vipRoleCustom:T?"":b,vipName:String(R.vipName??""),vipProject:String(R.vipProject??""),vipContact:String(R.vipContact??""),vipBio:String(R.vipBio??"")})}else f(Gc)}).catch(j=>{C||console.error("Load error:",j)}).finally(()=>{C||g(!1)}),()=>{C=!0}},[r,l]);async function P(){if(l){if(u.isVip&&!u.vipExpireDate.trim()){alert("开启 VIP 时请填写有效到期日");return}if(u.isVip&&u.vipExpireDate.trim()){const C=new Date(u.vipExpireDate);if(isNaN(C.getTime())){alert("到期日格式无效,请使用 YYYY-MM-DD");return}}E(!0);try{const C=u.vipRole==="__custom__"?u.vipRoleCustom.trim():u.vipRole,j={id:l,isVip:u.isVip,vipExpireDate:u.isVip?u.vipExpireDate:void 0,vipSort:u.vipSort===""?void 0:u.vipSort,vipRole:C||void 0,vipName:u.vipName||void 0,vipProject:u.vipProject||void 0,vipContact:u.vipContact||void 0,vipBio:u.vipBio||void 0},N=await Wt("/api/db/users",j);N!=null&&N.success?(alert("VIP 设置已保存"),c==null||c(),a()):alert("保存失败: "+(N==null?void 0:N.error))}catch(C){console.error("Save VIP error:",C),alert("保存失败")}finally{E(!1)}}}return r?t.jsx(tn,{open:r,onOpenChange:()=>a(),children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx(ko,{className:"w-5 h-5 text-amber-400"}),"设置 VIP - ",i||l]})}),y?t.jsx("div",{className:"py-8 text-center text-gray-400",children:"加载中..."}):t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(ne,{className:"text-gray-300",children:"VIP 会员"}),t.jsx(ut,{checked:u.isVip,onCheckedChange:C=>f(j=>({...j,isVip:C}))})]}),u.isVip&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300",children:["到期日 (YYYY-MM-DD) ",t.jsx("span",{className:"text-amber-400",children:"*"})]}),t.jsx(ie,{type:"date",className:"bg-[#0a1628] border-gray-700 text-white",value:u.vipExpireDate,onChange:C=>f(j=>({...j,vipExpireDate:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"排序"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"数字越小越靠前,留空按时间",value:u.vipSort===""?"":u.vipSort,onChange:C=>{const j=C.target.value;f(N=>({...N,vipSort:j===""?"":parseInt(j,10)||0}))}})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"角色"}),t.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md px-3 py-2",value:u.vipRole,onChange:C=>f(j=>({...j,vipRole:C.target.value})),children:[t.jsx("option",{value:"",children:"请选择或下方手动填写"}),m.map(C=>t.jsx("option",{value:C.name,children:C.name},C.id)),t.jsx("option",{value:"__custom__",children:"其他(手动填写)"})]}),u.vipRole==="__custom__"&&t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"输入自定义角色",value:u.vipRoleCustom,onChange:C=>f(j=>({...j,vipRoleCustom:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"VIP 展示名"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创业老板排行展示名",value:u.vipName,onChange:C=>f(j=>({...j,vipName:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"项目/公司"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"项目名称",value:u.vipProject,onChange:C=>f(j=>({...j,vipProject:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"联系方式"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"微信号或手机",value:u.vipContact,onChange:C=>f(j=>({...j,vipContact:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"一句话简介"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"简要描述业务",value:u.vipBio,onChange:C=>f(j=>({...j,vipBio:C.target.value}))})]})]}),t.jsxs(mn,{children:[t.jsxs(he,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(zn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(he,{onClick:P,disabled:v||y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存"]})]})]})}):null}function l2(){var qr,Vs,Us,Ws,Hs;const[r,a]=p.useState([]),[l,i]=p.useState(0),[c,u]=p.useState(1),[f,m]=p.useState(10),[x,y]=p.useState(""),g=cx(x,300),[v,E]=p.useState("all"),[P,C]=p.useState(!0),[j,N]=p.useState(null),[k,R]=p.useState(!1),[b,T]=p.useState(!1),[B,G]=p.useState(null),[M,V]=p.useState(""),[ee,de]=p.useState(""),[ce,le]=p.useState(!1),[ue,H]=p.useState(!1),[W,Q]=p.useState({referrals:[],stats:{}}),[K,A]=p.useState(!1),[X,$]=p.useState(null),[S,O]=p.useState(!1),[se,oe]=p.useState(null),[be,me]=p.useState(!1),[Y,xe]=p.useState(null),[I,re]=p.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1});async function fe(){C(!0),N(null);try{const q=new URLSearchParams({page:String(c),pageSize:String(f),search:g,...v==="vip"&&{vip:"true"}}),ze=await He(`/api/db/users?${q}`);ze!=null&&ze.success?(a(ze.users||[]),i(ze.total??0)):N((ze==null?void 0:ze.error)||"加载失败")}catch(q){console.error("Load users error:",q),N("网络错误,请检查连接")}finally{C(!1)}}p.useEffect(()=>{u(1)},[g,v]),p.useEffect(()=>{fe()},[c,f,g,v]);const Ee=Math.ceil(l/f)||1;async function Ie(q){if(confirm("确定要删除这个用户吗?"))try{const ze=await Td(`/api/db/users?id=${encodeURIComponent(q)}`);ze!=null&&ze.success?fe():alert("删除失败: "+((ze==null?void 0:ze.error)||"未知错误"))}catch(ze){console.error("Delete user error:",ze),alert("删除失败")}}const De=q=>{G(q),re({phone:q.phone||"",nickname:q.nickname||"",password:"",isAdmin:!!(q.isAdmin??!1),hasFullBook:!!(q.hasFullBook??!1)}),R(!0)},Ye=()=>{G(null),re({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),R(!0)};async function tt(){if(!I.phone||!I.nickname){alert("请填写手机号和昵称");return}le(!0);try{if(B){const q=await Wt("/api/db/users",{id:B.id,nickname:I.nickname,isAdmin:I.isAdmin,hasFullBook:I.hasFullBook,...I.password&&{password:I.password}});if(!(q!=null&&q.success)){alert("更新失败: "+((q==null?void 0:q.error)||"未知错误"));return}}else{const q=await bt("/api/db/users",{phone:I.phone,nickname:I.nickname,password:I.password,isAdmin:I.isAdmin});if(!(q!=null&&q.success)){alert("创建失败: "+((q==null?void 0:q.error)||"未知错误"));return}}R(!1),fe()}catch(q){console.error("Save user error:",q),alert("保存失败")}finally{le(!1)}}const Ze=q=>{G(q),V(""),de(""),T(!0)};async function Tt(q){$(q),H(!0),A(!0);try{const ze=await He(`/api/db/users/referrals?userId=${encodeURIComponent(q.id)}`);ze!=null&&ze.success?Q({referrals:ze.referrals||[],stats:ze.stats||{}}):Q({referrals:[],stats:{}})}catch(ze){console.error("Load referrals error:",ze),Q({referrals:[],stats:{}})}finally{A(!1)}}const It=q=>{oe(q.id),O(!0)},Nr=q=>{xe(q),me(!0)};async function Un(){if(!M){alert("请输入新密码");return}if(M!==ee){alert("两次输入的密码不一致");return}if(M.length<6){alert("密码长度不能少于6位");return}le(!0);try{const q=await Wt("/api/db/users",{id:B==null?void 0:B.id,password:M});q!=null&&q.success?(alert("密码修改成功"),T(!1)):alert("密码修改失败: "+((q==null?void 0:q.error)||"未知错误"))}catch(q){console.error("Change password error:",q),alert("密码修改失败")}finally{le(!1)}}return t.jsxs("div",{className:"p-8 w-full",children:[j&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:j}),t.jsx("button",{type:"button",onClick:()=>N(null),className:"hover:text-red-300",children:"×"})]}),t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),t.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",l," 位注册用户",v==="vip"&&",当前筛选 VIP"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(he,{variant:"outline",onClick:fe,disabled:P,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${P?"animate-spin":""}`}),"刷新"]}),t.jsxs("select",{value:v,onChange:q=>{E(q.target.value),u(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[t.jsx("option",{value:"all",children:"全部用户"}),t.jsx("option",{value:"vip",children:"VIP会员"})]}),t.jsxs("div",{className:"relative",children:[t.jsx(Br,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(ie,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-64",value:x,onChange:q=>y(q.target.value)})]}),t.jsxs(he,{onClick:Ye,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pm,{className:"w-4 h-4 mr-2"}),"添加用户"]})]})]}),t.jsx(tn,{open:k,onOpenChange:R,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[B?t.jsx(Ur,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx(pm,{className:"w-5 h-5 text-[#38bdac]"}),B?"编辑用户":"添加用户"]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"手机号"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:I.phone,onChange:q=>re({...I,phone:q.target.value}),disabled:!!B})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"昵称"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:I.nickname,onChange:q=>re({...I,nickname:q.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:B?"新密码 (留空则不修改)":"密码"}),t.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:B?"留空则不修改":"请输入密码",value:I.password,onChange:q=>re({...I,password:q.target.value})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(ne,{className:"text-gray-300",children:"管理员权限"}),t.jsx(ut,{checked:I.isAdmin,onCheckedChange:q=>re({...I,isAdmin:q})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(ne,{className:"text-gray-300",children:"已购全书"}),t.jsx(ut,{checked:I.hasFullBook,onCheckedChange:q=>re({...I,hasFullBook:q})})]})]}),t.jsxs(mn,{children:[t.jsxs(he,{variant:"outline",onClick:()=>R(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(zn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(he,{onClick:tt,disabled:ce,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),ce?"保存中...":"保存"]})]})]})}),t.jsx(tn,{open:b,onOpenChange:T,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx(um,{className:"w-5 h-5 text-[#38bdac]"}),"修改密码"]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["用户:",B==null?void 0:B.nickname]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["手机号:",B==null?void 0:B.phone]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"新密码"}),t.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入新密码 (至少6位)",value:M,onChange:q=>V(q.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"确认密码"}),t.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请再次输入新密码",value:ee,onChange:q=>de(q.target.value)})]})]}),t.jsxs(mn,{children:[t.jsx(he,{variant:"outline",onClick:()=>T(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(he,{onClick:Un,disabled:ce,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ce?"保存中...":"确认修改"})]})]})}),t.jsx(s2,{open:S,onClose:()=>O(!1),userId:se,onUserUpdated:fe}),t.jsx(a2,{open:be,onClose:()=>{me(!1),xe(null)},userId:(Y==null?void 0:Y.id)??null,userNickname:Y==null?void 0:Y.nickname,onSaved:fe}),t.jsx(tn,{open:ue,onOpenChange:H,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx(En,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系详情 - ",X==null?void 0:X.nickname]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[t.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[t.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((qr=W.stats)==null?void 0:qr.total)||0}),t.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),t.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[t.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Vs=W.stats)==null?void 0:Vs.purchased)||0}),t.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),t.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[t.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((Us=W.stats)==null?void 0:Us.earnings)||0).toFixed(2)]}),t.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),t.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[t.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((Ws=W.stats)==null?void 0:Ws.pendingEarnings)||0).toFixed(2)]}),t.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),K?t.jsxs("div",{className:"flex items-center justify-center py-8",children:[t.jsx(st,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Hs=W.referrals)==null?void 0:Hs.length)??0)>0?t.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(W.referrals??[]).map((q,ze)=>{var sn;const yt=q;return t.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((sn=yt.nickname)==null?void 0:sn.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white text-sm",children:yt.nickname}),t.jsx("div",{className:"text-xs text-gray-500",children:yt.phone||(yt.hasOpenId?"微信用户":"未绑定")})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[yt.status==="vip"&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),yt.status==="paid"&&t.jsxs(Le,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",yt.purchasedSections,"章"]}),yt.status==="free"&&t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),t.jsx("span",{className:"text-xs text-gray-500",children:yt.createdAt?new Date(yt.createdAt).toLocaleDateString():""})]})]},yt.id||ze)})}):t.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),t.jsx(mn,{children:t.jsx(he,{variant:"outline",onClick:()=>H(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:P?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(st,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs("div",{children:[t.jsxs(Ls,{children:[t.jsx(Os,{children:t.jsxs(_t,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx($e,{className:"text-gray-400",children:"用户信息"}),t.jsx($e,{className:"text-gray-400",children:"绑定信息"}),t.jsx($e,{className:"text-gray-400",children:"购买状态"}),t.jsx($e,{className:"text-gray-400",children:"分销收益"}),t.jsx($e,{className:"text-gray-400",children:"推广码"}),t.jsx($e,{className:"text-gray-400",children:"注册时间"}),t.jsx($e,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(Ds,{children:[r.map(q=>{var ze,yt,sn;return t.jsxs(_t,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(Me,{children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:q.avatar?t.jsx("img",{src:q.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((ze=q.nickname)==null?void 0:ze.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("p",{className:"font-medium text-white",children:q.nickname}),q.isAdmin&&t.jsx(Le,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),q.openId&&!((yt=q.id)!=null&&yt.startsWith("user_"))&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),t.jsx("p",{className:"text-xs text-gray-500 font-mono",children:q.openId?q.openId.slice(0,12)+"...":(sn=q.id)==null?void 0:sn.slice(0,12)})]})]})}),t.jsx(Me,{children:t.jsxs("div",{className:"space-y-1",children:[q.phone&&t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[t.jsx("span",{className:"text-gray-500",children:"📱"}),t.jsx("span",{className:"text-gray-300",children:q.phone})]}),q.wechatId&&t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[t.jsx("span",{className:"text-gray-500",children:"💬"}),t.jsx("span",{className:"text-gray-300",children:q.wechatId})]}),q.openId&&t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[t.jsx("span",{className:"text-gray-500",children:"🔗"}),t.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:q.openId,children:[q.openId.slice(0,12),"..."]})]}),!q.phone&&!q.wechatId&&!q.openId&&t.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),t.jsx(Me,{children:q.hasFullBook?t.jsx(Le,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):t.jsx(Le,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),t.jsx(Me,{children:t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(q.earnings||0)).toFixed(2)]}),parseFloat(String(q.pendingEarnings||0))>0&&t.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(q.pendingEarnings||0)).toFixed(2)]}),t.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Tt(q),onKeyDown:Sr=>Sr.key==="Enter"&&Tt(q),role:"button",tabIndex:0,children:[t.jsx(En,{className:"w-3 h-3"}),"绑定",q.referralCount||0,"人"]})]})}),t.jsx(Me,{children:t.jsx("code",{className:"text-[#38bdac] text-xs bg-[#38bdac]/10 px-2 py-0.5 rounded",children:q.referralCode||"-"})}),t.jsx(Me,{className:"text-gray-400",children:q.createdAt?new Date(q.createdAt).toLocaleDateString():"-"}),t.jsx(Me,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>Nr(q),className:"text-gray-400 hover:text-amber-400 hover:bg-amber-400/10",title:"设置 VIP",children:t.jsx(ko,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>It(q),className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"查看详情",children:t.jsx(Rd,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>De(q),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑",children:t.jsx(Ur,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>Ze(q),className:"text-gray-400 hover:text-yellow-400 hover:bg-yellow-400/10",title:"修改密码",children:t.jsx(um,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Ie(q.id),title:"删除",children:t.jsx(Eo,{className:"w-4 h-4"})})]})})]},q.id)}),r.length===0&&t.jsx(_t,{children:t.jsx(Me,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),t.jsx(Vr,{page:c,totalPages:Ee,total:l,pageSize:f,onPageChange:u,onPageSizeChange:q=>{m(q),u(1)}})]})})})]})}function o2(){const[r,a]=p.useState("overview"),[l,i]=p.useState([]),[c,u]=p.useState(null),[f,m]=p.useState([]),[x,y]=p.useState([]),[g,v]=p.useState([]),[E,P]=p.useState(!0),[C,j]=p.useState(null),[N,k]=p.useState(""),[R,b]=p.useState("all"),[T,B]=p.useState(1),[G,M]=p.useState(10),[V,ee]=p.useState(0),[de,ce]=p.useState(new Set),[le,ue]=p.useState(null),[H,W]=p.useState(""),[Q,K]=p.useState(!1);p.useEffect(()=>{A()},[]),p.useEffect(()=>{B(1)},[r,R]),p.useEffect(()=>{X(r)},[r]),p.useEffect(()=>{["orders","bindings","withdrawals"].includes(r)&&X(r,!0)},[T,G,R,N]);async function A(){j(null);try{const I=await He("/api/admin/distribution/overview");I!=null&&I.success&&I.overview&&u(I.overview)}catch(I){console.error("[Admin] 概览接口异常:",I),j("加载概览失败")}try{const I=await He("/api/db/users");v((I==null?void 0:I.users)||[])}catch(I){console.error("[Admin] 用户数据加载失败:",I)}}async function X(I,re=!1){var fe;if(!(!re&&de.has(I))){P(!0);try{const Ee=g;switch(I){case"overview":break;case"orders":{try{const Ie=new URLSearchParams({page:String(T),pageSize:String(G),...R!=="all"&&{status:R},...N&&{search:N}}),De=await He(`/api/orders?${Ie}`);if(De!=null&&De.success&&De.orders){const Ye=De.orders.map(tt=>{const Ze=Ee.find(It=>It.id===tt.userId),Tt=tt.referrerId?Ee.find(It=>It.id===tt.referrerId):null;return{...tt,amount:parseFloat(String(tt.amount))||0,userNickname:(Ze==null?void 0:Ze.nickname)||tt.userNickname||"未知用户",userPhone:(Ze==null?void 0:Ze.phone)||tt.userPhone||"-",referrerNickname:(Tt==null?void 0:Tt.nickname)||null,referrerCode:(Tt==null?void 0:Tt.referralCode)??null,type:tt.productType||tt.type}});i(Ye),ee(De.total??Ye.length)}else i([]),ee(0)}catch(Ie){console.error(Ie),j("加载订单失败"),i([])}break}case"bindings":{try{const Ie=new URLSearchParams({page:String(T),pageSize:String(G),...R!=="all"&&{status:R}}),De=await He(`/api/db/distribution?${Ie}`);m((De==null?void 0:De.bindings)||[]),ee((De==null?void 0:De.total)??((fe=De==null?void 0:De.bindings)==null?void 0:fe.length)??0)}catch(Ie){console.error(Ie),j("加载绑定数据失败"),m([])}break}case"withdrawals":{try{const Ie=R==="completed"?"success":R==="rejected"?"failed":R,De=new URLSearchParams({...Ie&&Ie!=="all"&&{status:Ie},page:String(T),pageSize:String(G)}),Ye=await He(`/api/admin/withdrawals?${De}`);if(Ye!=null&&Ye.success&&Ye.withdrawals){const tt=Ye.withdrawals.map(Ze=>({...Ze,account:Ze.account??"未绑定微信号",status:Ze.status==="success"?"completed":Ze.status==="failed"?"rejected":Ze.status}));y(tt),ee((Ye==null?void 0:Ye.total)??tt.length)}else Ye!=null&&Ye.success||j(`获取提现记录失败: ${(Ye==null?void 0:Ye.error)||"未知错误"}`),y([])}catch(Ie){console.error(Ie),j("加载提现数据失败"),y([])}break}}ce(Ie=>new Set(Ie).add(I))}catch(Ee){console.error(Ee)}finally{P(!1)}}}async function $(){j(null),ce(I=>{const re=new Set(I);return re.delete(r),re}),r==="overview"&&A(),await X(r,!0)}async function S(I){if(confirm("确认审核通过并打款?"))try{const re=await Wt("/api/admin/withdrawals",{id:I,action:"approve"});if(!(re!=null&&re.success)){const fe=(re==null?void 0:re.message)||(re==null?void 0:re.error)||"操作失败";alert(fe);return}await $()}catch(re){console.error(re),alert("操作失败")}}async function O(I){const re=prompt("请输入拒绝原因:");if(re)try{const fe=await Wt("/api/admin/withdrawals",{id:I,action:"reject",errorMessage:re});if(!(fe!=null&&fe.success)){alert((fe==null?void 0:fe.error)||"操作失败");return}await $()}catch(fe){console.error(fe),alert("操作失败")}}async function se(){var I;if(!(!(le!=null&&le.orderSn)&&!(le!=null&&le.id))){K(!0),j(null);try{const re=await Wt("/api/admin/orders/refund",{orderSn:le.orderSn||le.id,reason:H||void 0});re!=null&&re.success?(ue(null),W(""),await X("orders",!0)):j((re==null?void 0:re.error)||"退款失败")}catch(re){const fe=re;j(((I=fe==null?void 0:fe.data)==null?void 0:I.error)||"退款失败,请检查网络后重试")}finally{K(!1)}}}function oe(I){const re={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},fe={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return t.jsx(Le,{className:`${re[I]||"bg-gray-500/20 text-gray-400"} border-0`,children:fe[I]||I})}const be=Math.ceil(V/G)||1,me=l,Y=f.filter(I=>{var fe,Ee,Ie,De;if(!N)return!0;const re=N.toLowerCase();return((fe=I.refereeNickname)==null?void 0:fe.toLowerCase().includes(re))||((Ee=I.refereePhone)==null?void 0:Ee.includes(re))||((Ie=I.referrerName)==null?void 0:Ie.toLowerCase().includes(re))||((De=I.referrerCode)==null?void 0:De.toLowerCase().includes(re))}),xe=x.filter(I=>{var fe;if(!N)return!0;const re=N.toLowerCase();return((fe=I.userName)==null?void 0:fe.toLowerCase().includes(re))||I.account&&I.account.toLowerCase().includes(re)});return t.jsxs("div",{className:"p-8 w-full",children:[C&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:C}),t.jsx("button",{type:"button",onClick:()=>j(null),className:"hover:text-red-300",children:"×"})]}),t.jsxs("div",{className:"flex items-center justify-between mb-8",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:"交易中心"}),t.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),t.jsxs(he,{onClick:$,disabled:E,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`}),"刷新数据"]})]}),t.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4",children:[{key:"overview",label:"数据概览",icon:od},{key:"orders",label:"订单管理",icon:uo},{key:"bindings",label:"绑定管理",icon:zr},{key:"withdrawals",label:"提现审核",icon:Rs}].map(I=>t.jsxs("button",{type:"button",onClick:()=>{a(I.key),b("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${r===I.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[t.jsx(I.icon,{className:"w-4 h-4"}),I.label]},I.key))}),E?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(st,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs(t.Fragment,{children:[r==="overview"&&c&&t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{className:"p-6",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),t.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c.todayClicks})]}),t.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:t.jsx(Rd,{className:"w-6 h-6 text-blue-400"})})]})})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{className:"p-6",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),t.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c.todayBindings})]}),t.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:t.jsx(zr,{className:"w-6 h-6 text-green-400"})})]})})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{className:"p-6",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),t.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c.todayConversions})]}),t.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:t.jsx(nd,{className:"w-6 h-6 text-purple-400"})})]})})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{className:"p-6",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),t.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",c.todayEarnings.toFixed(2)]})]}),t.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:t.jsx(uo,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(Ce,{className:"bg-orange-500/10 border-orange-500/30",children:t.jsx(ke,{className:"p-6",children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:t.jsx(fp,{className:"w-6 h-6 text-orange-400"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),t.jsxs("p",{className:"text-2xl font-bold text-white",children:[c.expiringBindings," 个"]}),t.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),t.jsx(Ce,{className:"bg-blue-500/10 border-blue-500/30",children:t.jsx(ke,{className:"p-6",children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:t.jsx(Rs,{className:"w-6 h-6 text-blue-400"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),t.jsxs("p",{className:"text-2xl font-bold text-white",children:[c.pendingWithdrawals," 笔"]}),t.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",c.pendingWithdrawAmount.toFixed(2)]})]}),t.jsx(he,{onClick:()=>a("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(td,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),t.jsx(ke,{children:t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.monthClicks})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.monthBindings})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.monthConversions})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),t.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",c.monthEarnings.toFixed(2)]})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(od,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),t.jsxs(ke,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.totalClicks.toLocaleString()})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.totalBindings.toLocaleString()})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.totalConversions})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),t.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",c.totalEarnings.toFixed(2)]})]})]}),t.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[t.jsx("span",{className:"text-gray-300",children:"点击转化率"}),t.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[c.conversionRate,"%"]})]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(En,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),t.jsx(ke,{children:t.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[t.jsx("p",{className:"text-3xl font-bold text-white",children:c.totalDistributors}),t.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[t.jsx("p",{className:"text-3xl font-bold text-green-400",children:c.activeDistributors}),t.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[t.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),t.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[t.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),t.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),r==="orders"&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Br,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ie,{value:N,onChange:I=>k(I.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:R,onChange:I=>b(I.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[t.jsx("option",{value:"all",children:"全部状态"}),t.jsx("option",{value:"completed",children:"已完成"}),t.jsx("option",{value:"pending",children:"待支付"}),t.jsx("option",{value:"failed",children:"已失败"}),t.jsx("option",{value:"refunded",children:"已退款"})]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-0",children:[l.length===0?t.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[t.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-700/50",children:me.map(I=>{var re,fe;return t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(re=I.id)==null?void 0:re.slice(0,12),"..."]}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:I.userNickname}),t.jsx("p",{className:"text-gray-500 text-xs",children:I.userPhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:(()=>{const Ee=I.productType||I.type;return Ee==="fullbook"?`${I.bookName||"《底层逻辑》"} - 全本`:Ee==="match"?"匹配次数购买":`${I.bookName||"《底层逻辑》"} - ${I.sectionTitle||I.chapterTitle||`章节${I.productId||I.sectionId||""}`}`})()}),t.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Ee=I.productType||I.type;return Ee==="fullbook"?"全书解锁":Ee==="match"?"功能权益":I.chapterTitle||"单章购买"})()})]})}),t.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof I.amount=="number"?I.amount.toFixed(2):parseFloat(String(I.amount||"0")).toFixed(2)]}),t.jsx("td",{className:"p-4 text-gray-300",children:I.paymentMethod==="wechat"?"微信支付":I.paymentMethod==="alipay"?"支付宝":I.paymentMethod||"微信支付"}),t.jsx("td",{className:"p-4",children:I.status==="refunded"?t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):I.status==="completed"||I.status==="paid"?t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):I.status==="pending"||I.status==="created"?t.jsx(Le,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):t.jsx(Le,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),t.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:I.refundReason,children:I.status==="refunded"&&I.refundReason?I.refundReason:"-"}),t.jsx("td",{className:"p-4 text-gray-300 text-sm",children:I.referrerId||I.referralCode?t.jsxs("span",{title:I.referralCode||I.referrerCode||I.referrerId||"",children:[I.referrerNickname||I.referralCode||I.referrerCode||((fe=I.referrerId)==null?void 0:fe.slice(0,8)),(I.referralCode||I.referrerCode)&&` (${I.referralCode||I.referrerCode})`]}):"-"}),t.jsx("td",{className:"p-4 text-[#FFD700]",children:I.referrerEarnings?`¥${(typeof I.referrerEarnings=="number"?I.referrerEarnings:parseFloat(String(I.referrerEarnings))).toFixed(2)}`:"-"}),t.jsx("td",{className:"p-4 text-gray-400 text-sm",children:I.createdAt?new Date(I.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:(I.status==="paid"||I.status==="completed")&&t.jsxs(he,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{ue(I),W("")},children:[t.jsx(mp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},I.id)})})]})}),r==="orders"&&t.jsx(Vr,{page:T,totalPages:be,total:V,pageSize:G,onPageChange:B,onPageSizeChange:I=>{M(I),B(1)}})]})})]}),r==="bindings"&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Br,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ie,{value:N,onChange:I=>k(I.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:R,onChange:I=>b(I.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[t.jsx("option",{value:"all",children:"全部状态"}),t.jsx("option",{value:"active",children:"有效"}),t.jsx("option",{value:"converted",children:"已转化"}),t.jsx("option",{value:"expired",children:"已过期"})]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-0",children:[Y.length===0?t.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[t.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Y.map(I=>t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-medium",children:I.refereeNickname||"匿名用户"}),t.jsx("p",{className:"text-gray-500 text-xs",children:I.refereePhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white",children:I.referrerName||"-"}),t.jsx("p",{className:"text-gray-500 text-xs font-mono",children:I.referrerCode})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:I.boundAt?new Date(I.boundAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:I.expiresAt?new Date(I.expiresAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:oe(I.status)}),t.jsx("td",{className:"p-4",children:I.commission?t.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",I.commission.toFixed(2)]}):t.jsx("span",{className:"text-gray-500",children:"-"})})]},I.id))})]})}),r==="bindings"&&t.jsx(Vr,{page:T,totalPages:be,total:V,pageSize:G,onPageChange:B,onPageSizeChange:I=>{M(I),B(1)}})]})})]}),r==="withdrawals"&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Br,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ie,{value:N,onChange:I=>k(I.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:R,onChange:I=>b(I.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[t.jsx("option",{value:"all",children:"全部状态"}),t.jsx("option",{value:"pending",children:"待审核"}),t.jsx("option",{value:"completed",children:"已完成"}),t.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-0",children:[xe.length===0?t.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[t.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),t.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-700/50",children:xe.map(I=>t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsx("td",{className:"p-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[I.userAvatar?t.jsx("img",{src:I.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):t.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(I.userName||I.name||"?").slice(0,1)}),t.jsx("p",{className:"text-white font-medium",children:I.userName||I.name})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",I.amount.toFixed(2)]})}),t.jsx("td",{className:"p-4",children:t.jsx(Le,{className:I.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:I.method==="wechat"?"微信":"支付宝"})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-mono text-xs",children:I.account}),t.jsx("p",{className:"text-gray-500 text-xs",children:I.name})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:I.createdAt?new Date(I.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:oe(I.status)}),t.jsx("td",{className:"p-4 text-right",children:I.status==="pending"&&t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsxs(he,{size:"sm",onClick:()=>S(I.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(nd,{className:"w-4 h-4 mr-1"}),"通过"]}),t.jsxs(he,{size:"sm",variant:"outline",onClick:()=>O(I.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[t.jsx(kw,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},I.id))})]})}),r==="withdrawals"&&t.jsx(Vr,{page:T,totalPages:be,total:V,pageSize:G,onPageChange:B,onPageSizeChange:I=>{M(I),B(1)}})]})})]})]}),t.jsx(tn,{open:!!le,onOpenChange:I=>!I&&ue(null),children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(nn,{children:t.jsx(rn,{className:"text-white",children:"订单退款"})}),le&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",le.orderSn||le.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof le.amount=="number"?le.amount.toFixed(2):parseFloat(String(le.amount||"0")).toFixed(2)]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),t.jsx("div",{className:"form-input",children:t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:H,onChange:I=>W(I.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(mn,{children:[t.jsx(he,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>ue(null),disabled:Q,children:"取消"}),t.jsx(he,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:se,disabled:Q,children:Q?"退款中...":"确认退款"})]})]})})]})}function i2(){const[r,a]=p.useState([]),[l,i]=p.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[c,u]=p.useState(!0),[f,m]=p.useState(null),[x,y]=p.useState("all"),[g,v]=p.useState(1),[E,P]=p.useState(10),[C,j]=p.useState(0),[N,k]=p.useState(null);async function R(){var M,V,ee,de,ce,le,ue;u(!0),m(null);try{const H=new URLSearchParams({status:x,page:String(g),pageSize:String(E)}),W=await He(`/api/admin/withdrawals?${H}`);if(W!=null&&W.success){const Q=W.withdrawals||[];a(Q),j(W.total??((M=W.stats)==null?void 0:M.total)??Q.length),i({total:((V=W.stats)==null?void 0:V.total)??W.total??Q.length,pendingCount:((ee=W.stats)==null?void 0:ee.pendingCount)??0,pendingAmount:((de=W.stats)==null?void 0:de.pendingAmount)??0,successCount:((ce=W.stats)==null?void 0:ce.successCount)??0,successAmount:((le=W.stats)==null?void 0:le.successAmount)??0,failedCount:((ue=W.stats)==null?void 0:ue.failedCount)??0})}else m("加载提现记录失败")}catch(H){console.error("Load withdrawals error:",H),m("加载失败,请检查网络后重试")}finally{u(!1)}}p.useEffect(()=>{v(1)},[x]),p.useEffect(()=>{R()},[x,g,E]);const b=Math.ceil(C/E)||1;async function T(M){const V=r.find(ee=>ee.id===M);if(V!=null&&V.userCommissionInfo&&V.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${V.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(M);try{const ee=await Wt("/api/admin/withdrawals",{id:M,action:"approve"});ee!=null&&ee.success?R():alert("操作失败: "+((ee==null?void 0:ee.error)??""))}catch{alert("操作失败")}finally{k(null)}}async function B(M){const V=prompt("请输入拒绝原因(将返还用户余额):");if(V){k(M);try{const ee=await Wt("/api/admin/withdrawals",{id:M,action:"reject",errorMessage:V});ee!=null&&ee.success?R():alert("操作失败: "+((ee==null?void 0:ee.error)??""))}catch{alert("操作失败")}finally{k(null)}}}function G(M){switch(M){case"pending":return t.jsx(Le,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return t.jsx(Le,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return t.jsx(Le,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return t.jsx(Le,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return t.jsx(Le,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 border-0",children:M})}}return t.jsxs("div",{className:"p-8 w-full",children:[f&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:f}),t.jsx("button",{type:"button",onClick:()=>m(null),className:"hover:text-red-300",children:"×"})]}),t.jsxs("div",{className:"flex justify-between items-start mb-8",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),t.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),t.jsxs(he,{variant:"outline",onClick:R,disabled:c,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),t.jsx(Ce,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:t.jsx(ke,{className:"p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(uo,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),t.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[t.jsxs("p",{children:["• ",t.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",t.jsx("span",{className:"text-white font-medium",children:"90%"})]}),t.jsxs("p",{children:["• ",t.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),t.jsxs("p",{children:["• ",t.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),t.jsxs("p",{children:["• ",t.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),t.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-4 text-center",children:[t.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:l.total}),t.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-4 text-center",children:[t.jsx("div",{className:"text-3xl font-bold text-orange-400",children:l.pendingCount}),t.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),t.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",l.pendingAmount.toFixed(2)]})]})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-4 text-center",children:[t.jsx("div",{className:"text-3xl font-bold text-green-400",children:l.successCount}),t.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),t.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",l.successAmount.toFixed(2)]})]})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-4 text-center",children:[t.jsx("div",{className:"text-3xl font-bold text-red-400",children:l.failedCount}),t.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),t.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(M=>t.jsx(he,{variant:x===M?"default":"outline",size:"sm",onClick:()=>y(M),className:x===M?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:M==="all"?"全部":M==="pending"?"待处理":M==="success"?"已完成":"已拒绝"},M))}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:c?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(st,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):r.length===0?t.jsxs("div",{className:"text-center py-12",children:[t.jsx(Rs,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),t.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[t.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),t.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-700/50",children:r.map(M=>t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsx("td",{className:"p-4 text-gray-400",children:new Date(M.createdAt??"").toLocaleString()}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[M.userAvatar?t.jsx("img",{src:M.userAvatar,alt:M.userName??"",className:"w-8 h-8 rounded-full object-cover"}):t.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(M.userName??"?").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-white",children:M.userName??"未知"}),t.jsx("p",{className:"text-xs text-gray-500",children:M.userPhone??M.referralCode??(M.userId??"").slice(0,10)})]})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(M.amount).toFixed(2)]})}),t.jsx("td",{className:"p-4",children:M.userCommissionInfo?t.jsxs("div",{className:"text-xs space-y-1",children:[t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),t.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",M.userCommissionInfo.totalCommission.toFixed(2)]})]}),t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{className:"text-gray-500",children:"已提现:"}),t.jsxs("span",{className:"text-gray-400",children:["¥",M.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{className:"text-gray-500",children:"待审核:"}),t.jsxs("span",{className:"text-orange-400",children:["¥",M.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),t.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[t.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),t.jsxs("span",{className:M.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",M.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):t.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),t.jsxs("td",{className:"p-4",children:[G(M.status),M.errorMessage&&t.jsx("p",{className:"text-xs text-red-400 mt-1",children:M.errorMessage})]}),t.jsx("td",{className:"p-4 text-gray-400",children:M.processedAt?new Date(M.processedAt).toLocaleString():"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:M.userConfirmedAt?t.jsxs("span",{className:"text-green-400",title:M.userConfirmedAt,children:["已确认 ",new Date(M.userConfirmedAt).toLocaleString()]}):"-"}),t.jsxs("td",{className:"p-4 text-right",children:[(M.status==="pending"||M.status==="pending_confirm")&&t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t.jsxs(he,{size:"sm",onClick:()=>T(M.id),disabled:N===M.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[t.jsx(Co,{className:"w-4 h-4 mr-1"}),"批准"]}),t.jsxs(he,{size:"sm",variant:"outline",onClick:()=>B(M.id),disabled:N===M.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[t.jsx(zn,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(M.status==="success"||M.status==="completed")&&M.transactionId&&t.jsx("span",{className:"text-xs text-gray-500 font-mono",children:M.transactionId})]})]},M.id))})]})}),t.jsx(Vr,{page:g,totalPages:b,total:C,pageSize:E,onPageChange:v,onPageSizeChange:M=>{P(M),v(1)}})]})})})]})}const ks=p.forwardRef(({className:r,...a},l)=>t.jsx("textarea",{className:Ge("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:l,...a}));ks.displayName="Textarea";function go(r,[a,l]){return Math.min(l,Math.max(a,r))}const c2=["top","right","bottom","left"],gr=Math.min,Ut=Math.max,vo=Math.round,no=Math.floor,kn=r=>({x:r,y:r}),d2={left:"right",right:"left",bottom:"top",top:"bottom"},u2={start:"end",end:"start"};function fd(r,a,l){return Ut(r,gr(a,l))}function $n(r,a){return typeof r=="function"?r(a):r}function Bn(r){return r.split("-")[0]}function Fs(r){return r.split("-")[1]}function Kd(r){return r==="x"?"y":"x"}function Gd(r){return r==="y"?"height":"width"}const f2=new Set(["top","bottom"]);function Cn(r){return f2.has(Bn(r))?"y":"x"}function Qd(r){return Kd(Cn(r))}function h2(r,a,l){l===void 0&&(l=!1);const i=Fs(r),c=Qd(r),u=Gd(c);let f=c==="x"?i===(l?"end":"start")?"right":"left":i==="start"?"bottom":"top";return a.reference[u]>a.floating[u]&&(f=yo(f)),[f,yo(f)]}function m2(r){const a=yo(r);return[hd(r),a,hd(a)]}function hd(r){return r.replace(/start|end/g,a=>u2[a])}const Om=["left","right"],Dm=["right","left"],p2=["top","bottom"],x2=["bottom","top"];function g2(r,a,l){switch(r){case"top":case"bottom":return l?a?Dm:Om:a?Om:Dm;case"left":case"right":return a?p2:x2;default:return[]}}function v2(r,a,l,i){const c=Fs(r);let u=g2(Bn(r),l==="start",i);return c&&(u=u.map(f=>f+"-"+c),a&&(u=u.concat(u.map(hd)))),u}function yo(r){return r.replace(/left|right|bottom|top/g,a=>d2[a])}function y2(r){return{top:0,right:0,bottom:0,left:0,...r}}function Dx(r){return typeof r!="number"?y2(r):{top:r,right:r,bottom:r,left:r}}function wo(r){const{x:a,y:l,width:i,height:c}=r;return{width:i,height:c,top:l,left:a,right:a+i,bottom:l+c,x:a,y:l}}function Fm(r,a,l){let{reference:i,floating:c}=r;const u=Cn(a),f=Qd(a),m=Gd(f),x=Bn(a),y=u==="y",g=i.x+i.width/2-c.width/2,v=i.y+i.height/2-c.height/2,E=i[m]/2-c[m]/2;let P;switch(x){case"top":P={x:g,y:i.y-c.height};break;case"bottom":P={x:g,y:i.y+i.height};break;case"right":P={x:i.x+i.width,y:v};break;case"left":P={x:i.x-c.width,y:v};break;default:P={x:i.x,y:i.y}}switch(Fs(a)){case"start":P[f]-=E*(l&&y?-1:1);break;case"end":P[f]+=E*(l&&y?-1:1);break}return P}async function w2(r,a){var l;a===void 0&&(a={});const{x:i,y:c,platform:u,rects:f,elements:m,strategy:x}=r,{boundary:y="clippingAncestors",rootBoundary:g="viewport",elementContext:v="floating",altBoundary:E=!1,padding:P=0}=$n(a,r),C=Dx(P),N=m[E?v==="floating"?"reference":"floating":v],k=wo(await u.getClippingRect({element:(l=await(u.isElement==null?void 0:u.isElement(N)))==null||l?N:N.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(m.floating)),boundary:y,rootBoundary:g,strategy:x})),R=v==="floating"?{x:i,y:c,width:f.floating.width,height:f.floating.height}:f.reference,b=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m.floating)),T=await(u.isElement==null?void 0:u.isElement(b))?await(u.getScale==null?void 0:u.getScale(b))||{x:1,y:1}:{x:1,y:1},B=wo(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:m,rect:R,offsetParent:b,strategy:x}):R);return{top:(k.top-B.top+C.top)/T.y,bottom:(B.bottom-k.bottom+C.bottom)/T.y,left:(k.left-B.left+C.left)/T.x,right:(B.right-k.right+C.right)/T.x}}const j2=async(r,a,l)=>{const{placement:i="bottom",strategy:c="absolute",middleware:u=[],platform:f}=l,m=u.filter(Boolean),x=await(f.isRTL==null?void 0:f.isRTL(a));let y=await f.getElementRects({reference:r,floating:a,strategy:c}),{x:g,y:v}=Fm(y,i,x),E=i,P={},C=0;for(let N=0;N({name:"arrow",options:r,async fn(a){const{x:l,y:i,placement:c,rects:u,platform:f,elements:m,middlewareData:x}=a,{element:y,padding:g=0}=$n(r,a)||{};if(y==null)return{};const v=Dx(g),E={x:l,y:i},P=Qd(c),C=Gd(P),j=await f.getDimensions(y),N=P==="y",k=N?"top":"left",R=N?"bottom":"right",b=N?"clientHeight":"clientWidth",T=u.reference[C]+u.reference[P]-E[P]-u.floating[C],B=E[P]-u.reference[P],G=await(f.getOffsetParent==null?void 0:f.getOffsetParent(y));let M=G?G[b]:0;(!M||!await(f.isElement==null?void 0:f.isElement(G)))&&(M=m.floating[b]||u.floating[C]);const V=T/2-B/2,ee=M/2-j[C]/2-1,de=gr(v[k],ee),ce=gr(v[R],ee),le=de,ue=M-j[C]-ce,H=M/2-j[C]/2+V,W=fd(le,H,ue),Q=!x.arrow&&Fs(c)!=null&&H!==W&&u.reference[C]/2-(HH<=0)){var ce,le;const H=(((ce=u.flip)==null?void 0:ce.index)||0)+1,W=M[H];if(W&&(!(v==="alignment"?R!==Cn(W):!1)||de.every(A=>Cn(A.placement)===R?A.overflows[0]>0:!0)))return{data:{index:H,overflows:de},reset:{placement:W}};let Q=(le=de.filter(K=>K.overflows[0]<=0).sort((K,A)=>K.overflows[1]-A.overflows[1])[0])==null?void 0:le.placement;if(!Q)switch(P){case"bestFit":{var ue;const K=(ue=de.filter(A=>{if(G){const X=Cn(A.placement);return X===R||X==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(X=>X>0).reduce((X,$)=>X+$,0)]).sort((A,X)=>A[1]-X[1])[0])==null?void 0:ue[0];K&&(Q=K);break}case"initialPlacement":Q=m;break}if(c!==Q)return{reset:{placement:Q}}}return{}}}};function zm(r,a){return{top:r.top-a.height,right:r.right-a.width,bottom:r.bottom-a.height,left:r.left-a.width}}function $m(r){return c2.some(a=>r[a]>=0)}const S2=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(a){const{rects:l,platform:i}=a,{strategy:c="referenceHidden",...u}=$n(r,a);switch(c){case"referenceHidden":{const f=await i.detectOverflow(a,{...u,elementContext:"reference"}),m=zm(f,l.reference);return{data:{referenceHiddenOffsets:m,referenceHidden:$m(m)}}}case"escaped":{const f=await i.detectOverflow(a,{...u,altBoundary:!0}),m=zm(f,l.floating);return{data:{escapedOffsets:m,escaped:$m(m)}}}default:return{}}}}},Fx=new Set(["left","top"]);async function C2(r,a){const{placement:l,platform:i,elements:c}=r,u=await(i.isRTL==null?void 0:i.isRTL(c.floating)),f=Bn(l),m=Fs(l),x=Cn(l)==="y",y=Fx.has(f)?-1:1,g=u&&x?-1:1,v=$n(a,r);let{mainAxis:E,crossAxis:P,alignmentAxis:C}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return m&&typeof C=="number"&&(P=m==="end"?C*-1:C),x?{x:P*g,y:E*y}:{x:E*y,y:P*g}}const k2=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(a){var l,i;const{x:c,y:u,placement:f,middlewareData:m}=a,x=await C2(a,r);return f===((l=m.offset)==null?void 0:l.placement)&&(i=m.arrow)!=null&&i.alignmentOffset?{}:{x:c+x.x,y:u+x.y,data:{...x,placement:f}}}}},E2=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(a){const{x:l,y:i,placement:c,platform:u}=a,{mainAxis:f=!0,crossAxis:m=!1,limiter:x={fn:k=>{let{x:R,y:b}=k;return{x:R,y:b}}},...y}=$n(r,a),g={x:l,y:i},v=await u.detectOverflow(a,y),E=Cn(Bn(c)),P=Kd(E);let C=g[P],j=g[E];if(f){const k=P==="y"?"top":"left",R=P==="y"?"bottom":"right",b=C+v[k],T=C-v[R];C=fd(b,C,T)}if(m){const k=E==="y"?"top":"left",R=E==="y"?"bottom":"right",b=j+v[k],T=j-v[R];j=fd(b,j,T)}const N=x.fn({...a,[P]:C,[E]:j});return{...N,data:{x:N.x-l,y:N.y-i,enabled:{[P]:f,[E]:m}}}}}},P2=function(r){return r===void 0&&(r={}),{options:r,fn(a){const{x:l,y:i,placement:c,rects:u,middlewareData:f}=a,{offset:m=0,mainAxis:x=!0,crossAxis:y=!0}=$n(r,a),g={x:l,y:i},v=Cn(c),E=Kd(v);let P=g[E],C=g[v];const j=$n(m,a),N=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(x){const b=E==="y"?"height":"width",T=u.reference[E]-u.floating[b]+N.mainAxis,B=u.reference[E]+u.reference[b]-N.mainAxis;PB&&(P=B)}if(y){var k,R;const b=E==="y"?"width":"height",T=Fx.has(Bn(c)),B=u.reference[v]-u.floating[b]+(T&&((k=f.offset)==null?void 0:k[v])||0)+(T?0:N.crossAxis),G=u.reference[v]+u.reference[b]+(T?0:((R=f.offset)==null?void 0:R[v])||0)-(T?N.crossAxis:0);CG&&(C=G)}return{[E]:P,[v]:C}}}},R2=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(a){var l,i;const{placement:c,rects:u,platform:f,elements:m}=a,{apply:x=()=>{},...y}=$n(r,a),g=await f.detectOverflow(a,y),v=Bn(c),E=Fs(c),P=Cn(c)==="y",{width:C,height:j}=u.floating;let N,k;v==="top"||v==="bottom"?(N=v,k=E===(await(f.isRTL==null?void 0:f.isRTL(m.floating))?"start":"end")?"left":"right"):(k=v,N=E==="end"?"top":"bottom");const R=j-g.top-g.bottom,b=C-g.left-g.right,T=gr(j-g[N],R),B=gr(C-g[k],b),G=!a.middlewareData.shift;let M=T,V=B;if((l=a.middlewareData.shift)!=null&&l.enabled.x&&(V=b),(i=a.middlewareData.shift)!=null&&i.enabled.y&&(M=R),G&&!E){const de=Ut(g.left,0),ce=Ut(g.right,0),le=Ut(g.top,0),ue=Ut(g.bottom,0);P?V=C-2*(de!==0||ce!==0?de+ce:Ut(g.left,g.right)):M=j-2*(le!==0||ue!==0?le+ue:Ut(g.top,g.bottom))}await x({...a,availableWidth:V,availableHeight:M});const ee=await f.getDimensions(m.floating);return C!==ee.width||j!==ee.height?{reset:{rects:!0}}:{}}}};function Lo(){return typeof window<"u"}function zs(r){return zx(r)?(r.nodeName||"").toLowerCase():"#document"}function Kt(r){var a;return(r==null||(a=r.ownerDocument)==null?void 0:a.defaultView)||window}function Rn(r){var a;return(a=(zx(r)?r.ownerDocument:r.document)||window.document)==null?void 0:a.documentElement}function zx(r){return Lo()?r instanceof Node||r instanceof Kt(r).Node:!1}function xn(r){return Lo()?r instanceof Element||r instanceof Kt(r).Element:!1}function Pn(r){return Lo()?r instanceof HTMLElement||r instanceof Kt(r).HTMLElement:!1}function Bm(r){return!Lo()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof Kt(r).ShadowRoot}const _2=new Set(["inline","contents"]);function za(r){const{overflow:a,overflowX:l,overflowY:i,display:c}=gn(r);return/auto|scroll|overlay|hidden|clip/.test(a+i+l)&&!_2.has(c)}const T2=new Set(["table","td","th"]);function I2(r){return T2.has(zs(r))}const A2=[":popover-open",":modal"];function Oo(r){return A2.some(a=>{try{return r.matches(a)}catch{return!1}})}const M2=["transform","translate","scale","rotate","perspective"],L2=["transform","translate","scale","rotate","perspective","filter"],O2=["paint","layout","strict","content"];function Yd(r){const a=qd(),l=xn(r)?gn(r):r;return M2.some(i=>l[i]?l[i]!=="none":!1)||(l.containerType?l.containerType!=="normal":!1)||!a&&(l.backdropFilter?l.backdropFilter!=="none":!1)||!a&&(l.filter?l.filter!=="none":!1)||L2.some(i=>(l.willChange||"").includes(i))||O2.some(i=>(l.contain||"").includes(i))}function D2(r){let a=vr(r);for(;Pn(a)&&!_s(a);){if(Yd(a))return a;if(Oo(a))return null;a=vr(a)}return null}function qd(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const F2=new Set(["html","body","#document"]);function _s(r){return F2.has(zs(r))}function gn(r){return Kt(r).getComputedStyle(r)}function Do(r){return xn(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function vr(r){if(zs(r)==="html")return r;const a=r.assignedSlot||r.parentNode||Bm(r)&&r.host||Rn(r);return Bm(a)?a.host:a}function $x(r){const a=vr(r);return _s(a)?r.ownerDocument?r.ownerDocument.body:r.body:Pn(a)&&za(a)?a:$x(a)}function Ma(r,a,l){var i;a===void 0&&(a=[]),l===void 0&&(l=!0);const c=$x(r),u=c===((i=r.ownerDocument)==null?void 0:i.body),f=Kt(c);if(u){const m=md(f);return a.concat(f,f.visualViewport||[],za(c)?c:[],m&&l?Ma(m):[])}return a.concat(c,Ma(c,[],l))}function md(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Bx(r){const a=gn(r);let l=parseFloat(a.width)||0,i=parseFloat(a.height)||0;const c=Pn(r),u=c?r.offsetWidth:l,f=c?r.offsetHeight:i,m=vo(l)!==u||vo(i)!==f;return m&&(l=u,i=f),{width:l,height:i,$:m}}function Xd(r){return xn(r)?r:r.contextElement}function Es(r){const a=Xd(r);if(!Pn(a))return kn(1);const l=a.getBoundingClientRect(),{width:i,height:c,$:u}=Bx(a);let f=(u?vo(l.width):l.width)/i,m=(u?vo(l.height):l.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!m||!Number.isFinite(m))&&(m=1),{x:f,y:m}}const z2=kn(0);function Vx(r){const a=Kt(r);return!qd()||!a.visualViewport?z2:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function $2(r,a,l){return a===void 0&&(a=!1),!l||a&&l!==Kt(r)?!1:a}function Kr(r,a,l,i){a===void 0&&(a=!1),l===void 0&&(l=!1);const c=r.getBoundingClientRect(),u=Xd(r);let f=kn(1);a&&(i?xn(i)&&(f=Es(i)):f=Es(r));const m=$2(u,l,i)?Vx(u):kn(0);let x=(c.left+m.x)/f.x,y=(c.top+m.y)/f.y,g=c.width/f.x,v=c.height/f.y;if(u){const E=Kt(u),P=i&&xn(i)?Kt(i):i;let C=E,j=md(C);for(;j&&i&&P!==C;){const N=Es(j),k=j.getBoundingClientRect(),R=gn(j),b=k.left+(j.clientLeft+parseFloat(R.paddingLeft))*N.x,T=k.top+(j.clientTop+parseFloat(R.paddingTop))*N.y;x*=N.x,y*=N.y,g*=N.x,v*=N.y,x+=b,y+=T,C=Kt(j),j=md(C)}}return wo({width:g,height:v,x,y})}function Fo(r,a){const l=Do(r).scrollLeft;return a?a.left+l:Kr(Rn(r)).left+l}function Ux(r,a){const l=r.getBoundingClientRect(),i=l.left+a.scrollLeft-Fo(r,l),c=l.top+a.scrollTop;return{x:i,y:c}}function B2(r){let{elements:a,rect:l,offsetParent:i,strategy:c}=r;const u=c==="fixed",f=Rn(i),m=a?Oo(a.floating):!1;if(i===f||m&&u)return l;let x={scrollLeft:0,scrollTop:0},y=kn(1);const g=kn(0),v=Pn(i);if((v||!v&&!u)&&((zs(i)!=="body"||za(f))&&(x=Do(i)),Pn(i))){const P=Kr(i);y=Es(i),g.x=P.x+i.clientLeft,g.y=P.y+i.clientTop}const E=f&&!v&&!u?Ux(f,x):kn(0);return{width:l.width*y.x,height:l.height*y.y,x:l.x*y.x-x.scrollLeft*y.x+g.x+E.x,y:l.y*y.y-x.scrollTop*y.y+g.y+E.y}}function V2(r){return Array.from(r.getClientRects())}function U2(r){const a=Rn(r),l=Do(r),i=r.ownerDocument.body,c=Ut(a.scrollWidth,a.clientWidth,i.scrollWidth,i.clientWidth),u=Ut(a.scrollHeight,a.clientHeight,i.scrollHeight,i.clientHeight);let f=-l.scrollLeft+Fo(r);const m=-l.scrollTop;return gn(i).direction==="rtl"&&(f+=Ut(a.clientWidth,i.clientWidth)-c),{width:c,height:u,x:f,y:m}}const Vm=25;function W2(r,a){const l=Kt(r),i=Rn(r),c=l.visualViewport;let u=i.clientWidth,f=i.clientHeight,m=0,x=0;if(c){u=c.width,f=c.height;const g=qd();(!g||g&&a==="fixed")&&(m=c.offsetLeft,x=c.offsetTop)}const y=Fo(i);if(y<=0){const g=i.ownerDocument,v=g.body,E=getComputedStyle(v),P=g.compatMode==="CSS1Compat"&&parseFloat(E.marginLeft)+parseFloat(E.marginRight)||0,C=Math.abs(i.clientWidth-v.clientWidth-P);C<=Vm&&(u-=C)}else y<=Vm&&(u+=y);return{width:u,height:f,x:m,y:x}}const H2=new Set(["absolute","fixed"]);function K2(r,a){const l=Kr(r,!0,a==="fixed"),i=l.top+r.clientTop,c=l.left+r.clientLeft,u=Pn(r)?Es(r):kn(1),f=r.clientWidth*u.x,m=r.clientHeight*u.y,x=c*u.x,y=i*u.y;return{width:f,height:m,x,y}}function Um(r,a,l){let i;if(a==="viewport")i=W2(r,l);else if(a==="document")i=U2(Rn(r));else if(xn(a))i=K2(a,l);else{const c=Vx(r);i={x:a.x-c.x,y:a.y-c.y,width:a.width,height:a.height}}return wo(i)}function Wx(r,a){const l=vr(r);return l===a||!xn(l)||_s(l)?!1:gn(l).position==="fixed"||Wx(l,a)}function G2(r,a){const l=a.get(r);if(l)return l;let i=Ma(r,[],!1).filter(m=>xn(m)&&zs(m)!=="body"),c=null;const u=gn(r).position==="fixed";let f=u?vr(r):r;for(;xn(f)&&!_s(f);){const m=gn(f),x=Yd(f);!x&&m.position==="fixed"&&(c=null),(u?!x&&!c:!x&&m.position==="static"&&!!c&&H2.has(c.position)||za(f)&&!x&&Wx(r,f))?i=i.filter(g=>g!==f):c=m,f=vr(f)}return a.set(r,i),i}function Q2(r){let{element:a,boundary:l,rootBoundary:i,strategy:c}=r;const f=[...l==="clippingAncestors"?Oo(a)?[]:G2(a,this._c):[].concat(l),i],m=f[0],x=f.reduce((y,g)=>{const v=Um(a,g,c);return y.top=Ut(v.top,y.top),y.right=gr(v.right,y.right),y.bottom=gr(v.bottom,y.bottom),y.left=Ut(v.left,y.left),y},Um(a,m,c));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function Y2(r){const{width:a,height:l}=Bx(r);return{width:a,height:l}}function q2(r,a,l){const i=Pn(a),c=Rn(a),u=l==="fixed",f=Kr(r,!0,u,a);let m={scrollLeft:0,scrollTop:0};const x=kn(0);function y(){x.x=Fo(c)}if(i||!i&&!u)if((zs(a)!=="body"||za(c))&&(m=Do(a)),i){const P=Kr(a,!0,u,a);x.x=P.x+a.clientLeft,x.y=P.y+a.clientTop}else c&&y();u&&!i&&c&&y();const g=c&&!i&&!u?Ux(c,m):kn(0),v=f.left+m.scrollLeft-x.x-g.x,E=f.top+m.scrollTop-x.y-g.y;return{x:v,y:E,width:f.width,height:f.height}}function Qc(r){return gn(r).position==="static"}function Wm(r,a){if(!Pn(r)||gn(r).position==="fixed")return null;if(a)return a(r);let l=r.offsetParent;return Rn(r)===l&&(l=l.ownerDocument.body),l}function Hx(r,a){const l=Kt(r);if(Oo(r))return l;if(!Pn(r)){let c=vr(r);for(;c&&!_s(c);){if(xn(c)&&!Qc(c))return c;c=vr(c)}return l}let i=Wm(r,a);for(;i&&I2(i)&&Qc(i);)i=Wm(i,a);return i&&_s(i)&&Qc(i)&&!Yd(i)?l:i||D2(r)||l}const X2=async function(r){const a=this.getOffsetParent||Hx,l=this.getDimensions,i=await l(r.floating);return{reference:q2(r.reference,await a(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function J2(r){return gn(r).direction==="rtl"}const Z2={convertOffsetParentRelativeRectToViewportRelativeRect:B2,getDocumentElement:Rn,getClippingRect:Q2,getOffsetParent:Hx,getElementRects:X2,getClientRects:V2,getDimensions:Y2,getScale:Es,isElement:xn,isRTL:J2};function Kx(r,a){return r.x===a.x&&r.y===a.y&&r.width===a.width&&r.height===a.height}function eS(r,a){let l=null,i;const c=Rn(r);function u(){var m;clearTimeout(i),(m=l)==null||m.disconnect(),l=null}function f(m,x){m===void 0&&(m=!1),x===void 0&&(x=1),u();const y=r.getBoundingClientRect(),{left:g,top:v,width:E,height:P}=y;if(m||a(),!E||!P)return;const C=no(v),j=no(c.clientWidth-(g+E)),N=no(c.clientHeight-(v+P)),k=no(g),b={rootMargin:-C+"px "+-j+"px "+-N+"px "+-k+"px",threshold:Ut(0,gr(1,x))||1};let T=!0;function B(G){const M=G[0].intersectionRatio;if(M!==x){if(!T)return f();M?f(!1,M):i=setTimeout(()=>{f(!1,1e-7)},1e3)}M===1&&!Kx(y,r.getBoundingClientRect())&&f(),T=!1}try{l=new IntersectionObserver(B,{...b,root:c.ownerDocument})}catch{l=new IntersectionObserver(B,b)}l.observe(r)}return f(!0),u}function tS(r,a,l,i){i===void 0&&(i={});const{ancestorScroll:c=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:m=typeof IntersectionObserver=="function",animationFrame:x=!1}=i,y=Xd(r),g=c||u?[...y?Ma(y):[],...Ma(a)]:[];g.forEach(k=>{c&&k.addEventListener("scroll",l,{passive:!0}),u&&k.addEventListener("resize",l)});const v=y&&m?eS(y,l):null;let E=-1,P=null;f&&(P=new ResizeObserver(k=>{let[R]=k;R&&R.target===y&&P&&(P.unobserve(a),cancelAnimationFrame(E),E=requestAnimationFrame(()=>{var b;(b=P)==null||b.observe(a)})),l()}),y&&!x&&P.observe(y),P.observe(a));let C,j=x?Kr(r):null;x&&N();function N(){const k=Kr(r);j&&!Kx(j,k)&&l(),j=k,C=requestAnimationFrame(N)}return l(),()=>{var k;g.forEach(R=>{c&&R.removeEventListener("scroll",l),u&&R.removeEventListener("resize",l)}),v==null||v(),(k=P)==null||k.disconnect(),P=null,x&&cancelAnimationFrame(C)}}const nS=k2,rS=E2,sS=N2,aS=R2,lS=S2,Hm=b2,oS=P2,iS=(r,a,l)=>{const i=new Map,c={platform:Z2,...l},u={...c.platform,_c:i};return j2(r,a,{...c,platform:u})};var cS=typeof document<"u",dS=function(){},lo=cS?p.useLayoutEffect:dS;function jo(r,a){if(r===a)return!0;if(typeof r!=typeof a)return!1;if(typeof r=="function"&&r.toString()===a.toString())return!0;let l,i,c;if(r&&a&&typeof r=="object"){if(Array.isArray(r)){if(l=r.length,l!==a.length)return!1;for(i=l;i--!==0;)if(!jo(r[i],a[i]))return!1;return!0}if(c=Object.keys(r),l=c.length,l!==Object.keys(a).length)return!1;for(i=l;i--!==0;)if(!{}.hasOwnProperty.call(a,c[i]))return!1;for(i=l;i--!==0;){const u=c[i];if(!(u==="_owner"&&r.$$typeof)&&!jo(r[u],a[u]))return!1}return!0}return r!==r&&a!==a}function Gx(r){return typeof window>"u"?1:(r.ownerDocument.defaultView||window).devicePixelRatio||1}function Km(r,a){const l=Gx(r);return Math.round(a*l)/l}function Yc(r){const a=p.useRef(r);return lo(()=>{a.current=r}),a}function uS(r){r===void 0&&(r={});const{placement:a="bottom",strategy:l="absolute",middleware:i=[],platform:c,elements:{reference:u,floating:f}={},transform:m=!0,whileElementsMounted:x,open:y}=r,[g,v]=p.useState({x:0,y:0,strategy:l,placement:a,middlewareData:{},isPositioned:!1}),[E,P]=p.useState(i);jo(E,i)||P(i);const[C,j]=p.useState(null),[N,k]=p.useState(null),R=p.useCallback(A=>{A!==G.current&&(G.current=A,j(A))},[]),b=p.useCallback(A=>{A!==M.current&&(M.current=A,k(A))},[]),T=u||C,B=f||N,G=p.useRef(null),M=p.useRef(null),V=p.useRef(g),ee=x!=null,de=Yc(x),ce=Yc(c),le=Yc(y),ue=p.useCallback(()=>{if(!G.current||!M.current)return;const A={placement:a,strategy:l,middleware:E};ce.current&&(A.platform=ce.current),iS(G.current,M.current,A).then(X=>{const $={...X,isPositioned:le.current!==!1};H.current&&!jo(V.current,$)&&(V.current=$,La.flushSync(()=>{v($)}))})},[E,a,l,ce,le]);lo(()=>{y===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,v(A=>({...A,isPositioned:!1})))},[y]);const H=p.useRef(!1);lo(()=>(H.current=!0,()=>{H.current=!1}),[]),lo(()=>{if(T&&(G.current=T),B&&(M.current=B),T&&B){if(de.current)return de.current(T,B,ue);ue()}},[T,B,ue,de,ee]);const W=p.useMemo(()=>({reference:G,floating:M,setReference:R,setFloating:b}),[R,b]),Q=p.useMemo(()=>({reference:T,floating:B}),[T,B]),K=p.useMemo(()=>{const A={position:l,left:0,top:0};if(!Q.floating)return A;const X=Km(Q.floating,g.x),$=Km(Q.floating,g.y);return m?{...A,transform:"translate("+X+"px, "+$+"px)",...Gx(Q.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:X,top:$}},[l,m,Q.floating,g.x,g.y]);return p.useMemo(()=>({...g,update:ue,refs:W,elements:Q,floatingStyles:K}),[g,ue,W,Q,K])}const fS=r=>{function a(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:r,fn(l){const{element:i,padding:c}=typeof r=="function"?r(l):r;return i&&a(i)?i.current!=null?Hm({element:i.current,padding:c}).fn(l):{}:i?Hm({element:i,padding:c}).fn(l):{}}}},hS=(r,a)=>({...nS(r),options:[r,a]}),mS=(r,a)=>({...rS(r),options:[r,a]}),pS=(r,a)=>({...oS(r),options:[r,a]}),xS=(r,a)=>({...sS(r),options:[r,a]}),gS=(r,a)=>({...aS(r),options:[r,a]}),vS=(r,a)=>({...lS(r),options:[r,a]}),yS=(r,a)=>({...fS(r),options:[r,a]});var wS="Arrow",Qx=p.forwardRef((r,a)=>{const{children:l,width:i=10,height:c=5,...u}=r;return t.jsx(Oe.svg,{...u,ref:a,width:i,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:r.asChild?l:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});Qx.displayName=wS;var jS=Qx,Jd="Popper",[Yx,qx]=wr(Jd),[bS,Xx]=Yx(Jd),Jx=r=>{const{__scopePopper:a,children:l}=r,[i,c]=p.useState(null);return t.jsx(bS,{scope:a,anchor:i,onAnchorChange:c,children:l})};Jx.displayName=Jd;var Zx="PopperAnchor",eg=p.forwardRef((r,a)=>{const{__scopePopper:l,virtualRef:i,...c}=r,u=Xx(Zx,l),f=p.useRef(null),m=Ke(a,f),x=p.useRef(null);return p.useEffect(()=>{const y=x.current;x.current=(i==null?void 0:i.current)||f.current,y!==x.current&&u.onAnchorChange(x.current)}),i?null:t.jsx(Oe.div,{...c,ref:m})});eg.displayName=Zx;var Zd="PopperContent",[NS,SS]=Yx(Zd),tg=p.forwardRef((r,a)=>{var Y,xe,I,re,fe,Ee;const{__scopePopper:l,side:i="bottom",sideOffset:c=0,align:u="center",alignOffset:f=0,arrowPadding:m=0,avoidCollisions:x=!0,collisionBoundary:y=[],collisionPadding:g=0,sticky:v="partial",hideWhenDetached:E=!1,updatePositionStrategy:P="optimized",onPlaced:C,...j}=r,N=Xx(Zd,l),[k,R]=p.useState(null),b=Ke(a,Ie=>R(Ie)),[T,B]=p.useState(null),G=Vd(T),M=(G==null?void 0:G.width)??0,V=(G==null?void 0:G.height)??0,ee=i+(u!=="center"?"-"+u:""),de=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},ce=Array.isArray(y)?y:[y],le=ce.length>0,ue={padding:de,boundary:ce.filter(kS),altBoundary:le},{refs:H,floatingStyles:W,placement:Q,isPositioned:K,middlewareData:A}=uS({strategy:"fixed",placement:ee,whileElementsMounted:(...Ie)=>tS(...Ie,{animationFrame:P==="always"}),elements:{reference:N.anchor},middleware:[hS({mainAxis:c+V,alignmentAxis:f}),x&&mS({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?pS():void 0,...ue}),x&&xS({...ue}),gS({...ue,apply:({elements:Ie,rects:De,availableWidth:Ye,availableHeight:tt})=>{const{width:Ze,height:Tt}=De.reference,It=Ie.floating.style;It.setProperty("--radix-popper-available-width",`${Ye}px`),It.setProperty("--radix-popper-available-height",`${tt}px`),It.setProperty("--radix-popper-anchor-width",`${Ze}px`),It.setProperty("--radix-popper-anchor-height",`${Tt}px`)}}),T&&yS({element:T,padding:m}),ES({arrowWidth:M,arrowHeight:V}),E&&vS({strategy:"referenceHidden",...ue})]}),[X,$]=sg(Q),S=xr(C);Et(()=>{K&&(S==null||S())},[K,S]);const O=(Y=A.arrow)==null?void 0:Y.x,se=(xe=A.arrow)==null?void 0:xe.y,oe=((I=A.arrow)==null?void 0:I.centerOffset)!==0,[be,me]=p.useState();return Et(()=>{k&&me(window.getComputedStyle(k).zIndex)},[k]),t.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:K?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(re=A.transformOrigin)==null?void 0:re.x,(fe=A.transformOrigin)==null?void 0:fe.y].join(" "),...((Ee=A.hide)==null?void 0:Ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:r.dir,children:t.jsx(NS,{scope:l,placedSide:X,onArrowChange:B,arrowX:O,arrowY:se,shouldHideArrow:oe,children:t.jsx(Oe.div,{"data-side":X,"data-align":$,...j,ref:b,style:{...j.style,animation:K?void 0:"none"}})})})});tg.displayName=Zd;var ng="PopperArrow",CS={top:"bottom",right:"left",bottom:"top",left:"right"},rg=p.forwardRef(function(a,l){const{__scopePopper:i,...c}=a,u=SS(ng,i),f=CS[u.placedSide];return t.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:t.jsx(jS,{...c,ref:l,style:{...c.style,display:"block"}})})});rg.displayName=ng;function kS(r){return r!==null}var ES=r=>({name:"transformOrigin",options:r,fn(a){var N,k,R;const{placement:l,rects:i,middlewareData:c}=a,f=((N=c.arrow)==null?void 0:N.centerOffset)!==0,m=f?0:r.arrowWidth,x=f?0:r.arrowHeight,[y,g]=sg(l),v={start:"0%",center:"50%",end:"100%"}[g],E=(((k=c.arrow)==null?void 0:k.x)??0)+m/2,P=(((R=c.arrow)==null?void 0:R.y)??0)+x/2;let C="",j="";return y==="bottom"?(C=f?v:`${E}px`,j=`${-x}px`):y==="top"?(C=f?v:`${E}px`,j=`${i.floating.height+x}px`):y==="right"?(C=`${-x}px`,j=f?v:`${P}px`):y==="left"&&(C=`${i.floating.width+x}px`,j=f?v:`${P}px`),{data:{x:C,y:j}}}});function sg(r){const[a,l="center"]=r.split("-");return[a,l]}var PS=Jx,RS=eg,_S=tg,TS=rg,ag=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),IS="VisuallyHidden",AS=p.forwardRef((r,a)=>t.jsx(Oe.span,{...r,ref:a,style:{...ag,...r.style}}));AS.displayName=IS;var MS=[" ","Enter","ArrowUp","ArrowDown"],LS=[" ","Enter"],Gr="Select",[zo,$o,OS]=Ud(Gr),[$s]=wr(Gr,[OS,qx]),Bo=qx(),[DS,jr]=$s(Gr),[FS,zS]=$s(Gr),lg=r=>{const{__scopeSelect:a,children:l,open:i,defaultOpen:c,onOpenChange:u,value:f,defaultValue:m,onValueChange:x,dir:y,name:g,autoComplete:v,disabled:E,required:P,form:C}=r,j=Bo(a),[N,k]=p.useState(null),[R,b]=p.useState(null),[T,B]=p.useState(!1),G=Io(y),[M,V]=Wr({prop:i,defaultProp:c??!1,onChange:u,caller:Gr}),[ee,de]=Wr({prop:f,defaultProp:m,onChange:x,caller:Gr}),ce=p.useRef(null),le=N?C||!!N.closest("form"):!0,[ue,H]=p.useState(new Set),W=Array.from(ue).map(Q=>Q.props.value).join(";");return t.jsx(PS,{...j,children:t.jsxs(DS,{required:P,scope:a,trigger:N,onTriggerChange:k,valueNode:R,onValueNodeChange:b,valueNodeHasChildren:T,onValueNodeHasChildrenChange:B,contentId:pr(),value:ee,onValueChange:de,open:M,onOpenChange:V,dir:G,triggerPointerDownPosRef:ce,disabled:E,children:[t.jsx(zo.Provider,{scope:a,children:t.jsx(FS,{scope:r.__scopeSelect,onNativeOptionAdd:p.useCallback(Q=>{H(K=>new Set(K).add(Q))},[]),onNativeOptionRemove:p.useCallback(Q=>{H(K=>{const A=new Set(K);return A.delete(Q),A})},[]),children:l})}),le?t.jsxs(Pg,{"aria-hidden":!0,required:P,tabIndex:-1,name:g,autoComplete:v,value:ee,onChange:Q=>de(Q.target.value),disabled:E,form:C,children:[ee===void 0?t.jsx("option",{value:""}):null,Array.from(ue)]},W):null]})})};lg.displayName=Gr;var og="SelectTrigger",ig=p.forwardRef((r,a)=>{const{__scopeSelect:l,disabled:i=!1,...c}=r,u=Bo(l),f=jr(og,l),m=f.disabled||i,x=Ke(a,f.onTriggerChange),y=$o(l),g=p.useRef("touch"),[v,E,P]=_g(j=>{const N=y().filter(b=>!b.disabled),k=N.find(b=>b.value===f.value),R=Tg(N,j,k);R!==void 0&&f.onValueChange(R.value)}),C=j=>{m||(f.onOpenChange(!0),P()),j&&(f.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return t.jsx(RS,{asChild:!0,...u,children:t.jsx(Oe.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:m,"data-disabled":m?"":void 0,"data-placeholder":Rg(f.value)?"":void 0,...c,ref:x,onClick:Te(c.onClick,j=>{j.currentTarget.focus(),g.current!=="mouse"&&C(j)}),onPointerDown:Te(c.onPointerDown,j=>{g.current=j.pointerType;const N=j.target;N.hasPointerCapture(j.pointerId)&&N.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(C(j),j.preventDefault())}),onKeyDown:Te(c.onKeyDown,j=>{const N=v.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&E(j.key),!(N&&j.key===" ")&&MS.includes(j.key)&&(C(),j.preventDefault())})})})});ig.displayName=og;var cg="SelectValue",dg=p.forwardRef((r,a)=>{const{__scopeSelect:l,className:i,style:c,children:u,placeholder:f="",...m}=r,x=jr(cg,l),{onValueNodeHasChildrenChange:y}=x,g=u!==void 0,v=Ke(a,x.onValueNodeChange);return Et(()=>{y(g)},[y,g]),t.jsx(Oe.span,{...m,ref:v,style:{pointerEvents:"none"},children:Rg(x.value)?t.jsx(t.Fragment,{children:f}):u})});dg.displayName=cg;var $S="SelectIcon",ug=p.forwardRef((r,a)=>{const{__scopeSelect:l,children:i,...c}=r;return t.jsx(Oe.span,{"aria-hidden":!0,...c,ref:a,children:i||"▼"})});ug.displayName=$S;var BS="SelectPortal",fg=r=>t.jsx(Od,{asChild:!0,...r});fg.displayName=BS;var Qr="SelectContent",hg=p.forwardRef((r,a)=>{const l=jr(Qr,r.__scopeSelect),[i,c]=p.useState();if(Et(()=>{c(new DocumentFragment)},[]),!l.open){const u=i;return u?La.createPortal(t.jsx(mg,{scope:r.__scopeSelect,children:t.jsx(zo.Slot,{scope:r.__scopeSelect,children:t.jsx("div",{children:r.children})})}),u):null}return t.jsx(pg,{...r,ref:a})});hg.displayName=Qr;var hn=10,[mg,br]=$s(Qr),VS="SelectContentImpl",US=Aa("SelectContent.RemoveScroll"),pg=p.forwardRef((r,a)=>{const{__scopeSelect:l,position:i="item-aligned",onCloseAutoFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,side:m,sideOffset:x,align:y,alignOffset:g,arrowPadding:v,collisionBoundary:E,collisionPadding:P,sticky:C,hideWhenDetached:j,avoidCollisions:N,...k}=r,R=jr(Qr,l),[b,T]=p.useState(null),[B,G]=p.useState(null),M=Ke(a,Y=>T(Y)),[V,ee]=p.useState(null),[de,ce]=p.useState(null),le=$o(l),[ue,H]=p.useState(!1),W=p.useRef(!1);p.useEffect(()=>{if(b)return Kp(b)},[b]),Dp();const Q=p.useCallback(Y=>{const[xe,...I]=le().map(Ee=>Ee.ref.current),[re]=I.slice(-1),fe=document.activeElement;for(const Ee of Y)if(Ee===fe||(Ee==null||Ee.scrollIntoView({block:"nearest"}),Ee===xe&&B&&(B.scrollTop=0),Ee===re&&B&&(B.scrollTop=B.scrollHeight),Ee==null||Ee.focus(),document.activeElement!==fe))return},[le,B]),K=p.useCallback(()=>Q([V,b]),[Q,V,b]);p.useEffect(()=>{ue&&K()},[ue,K]);const{onOpenChange:A,triggerPointerDownPosRef:X}=R;p.useEffect(()=>{if(b){let Y={x:0,y:0};const xe=re=>{var fe,Ee;Y={x:Math.abs(Math.round(re.pageX)-(((fe=X.current)==null?void 0:fe.x)??0)),y:Math.abs(Math.round(re.pageY)-(((Ee=X.current)==null?void 0:Ee.y)??0))}},I=re=>{Y.x<=10&&Y.y<=10?re.preventDefault():b.contains(re.target)||A(!1),document.removeEventListener("pointermove",xe),X.current=null};return X.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",I,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",I,{capture:!0})}}},[b,A,X]),p.useEffect(()=>{const Y=()=>A(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[A]);const[$,S]=_g(Y=>{const xe=le().filter(fe=>!fe.disabled),I=xe.find(fe=>fe.ref.current===document.activeElement),re=Tg(xe,Y,I);re&&setTimeout(()=>re.ref.current.focus())}),O=p.useCallback((Y,xe,I)=>{const re=!W.current&&!I;(R.value!==void 0&&R.value===xe||re)&&(ee(Y),re&&(W.current=!0))},[R.value]),se=p.useCallback(()=>b==null?void 0:b.focus(),[b]),oe=p.useCallback((Y,xe,I)=>{const re=!W.current&&!I;(R.value!==void 0&&R.value===xe||re)&&ce(Y)},[R.value]),be=i==="popper"?pd:xg,me=be===pd?{side:m,sideOffset:x,align:y,alignOffset:g,arrowPadding:v,collisionBoundary:E,collisionPadding:P,sticky:C,hideWhenDetached:j,avoidCollisions:N}:{};return t.jsx(mg,{scope:l,content:b,viewport:B,onViewportChange:G,itemRefCallback:O,selectedItem:V,onItemLeave:se,itemTextRefCallback:oe,focusSelectedItem:K,selectedItemText:de,position:i,isPositioned:ue,searchRef:$,children:t.jsx(Dd,{as:US,allowPinchZoom:!0,children:t.jsx(Ld,{asChild:!0,trapped:R.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:Te(c,Y=>{var xe;(xe=R.trigger)==null||xe.focus({preventScroll:!0}),Y.preventDefault()}),children:t.jsx(Md,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:t.jsx(be,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:Y=>Y.preventDefault(),...k,...me,onPlaced:()=>H(!0),ref:M,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Te(k.onKeyDown,Y=>{const xe=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!xe&&Y.key.length===1&&S(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let re=le().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){const fe=Y.target,Ee=re.indexOf(fe);re=re.slice(Ee+1)}setTimeout(()=>Q(re)),Y.preventDefault()}})})})})})})});pg.displayName=VS;var WS="SelectItemAlignedPosition",xg=p.forwardRef((r,a)=>{const{__scopeSelect:l,onPlaced:i,...c}=r,u=jr(Qr,l),f=br(Qr,l),[m,x]=p.useState(null),[y,g]=p.useState(null),v=Ke(a,M=>g(M)),E=$o(l),P=p.useRef(!1),C=p.useRef(!0),{viewport:j,selectedItem:N,selectedItemText:k,focusSelectedItem:R}=f,b=p.useCallback(()=>{if(u.trigger&&u.valueNode&&m&&y&&j&&N&&k){const M=u.trigger.getBoundingClientRect(),V=y.getBoundingClientRect(),ee=u.valueNode.getBoundingClientRect(),de=k.getBoundingClientRect();if(u.dir!=="rtl"){const fe=de.left-V.left,Ee=ee.left-fe,Ie=M.left-Ee,De=M.width+Ie,Ye=Math.max(De,V.width),tt=window.innerWidth-hn,Ze=go(Ee,[hn,Math.max(hn,tt-Ye)]);m.style.minWidth=De+"px",m.style.left=Ze+"px"}else{const fe=V.right-de.right,Ee=window.innerWidth-ee.right-fe,Ie=window.innerWidth-M.right-Ee,De=M.width+Ie,Ye=Math.max(De,V.width),tt=window.innerWidth-hn,Ze=go(Ee,[hn,Math.max(hn,tt-Ye)]);m.style.minWidth=De+"px",m.style.right=Ze+"px"}const ce=E(),le=window.innerHeight-hn*2,ue=j.scrollHeight,H=window.getComputedStyle(y),W=parseInt(H.borderTopWidth,10),Q=parseInt(H.paddingTop,10),K=parseInt(H.borderBottomWidth,10),A=parseInt(H.paddingBottom,10),X=W+Q+ue+A+K,$=Math.min(N.offsetHeight*5,X),S=window.getComputedStyle(j),O=parseInt(S.paddingTop,10),se=parseInt(S.paddingBottom,10),oe=M.top+M.height/2-hn,be=le-oe,me=N.offsetHeight/2,Y=N.offsetTop+me,xe=W+Q+Y,I=X-xe;if(xe<=oe){const fe=ce.length>0&&N===ce[ce.length-1].ref.current;m.style.bottom="0px";const Ee=y.clientHeight-j.offsetTop-j.offsetHeight,Ie=Math.max(be,me+(fe?se:0)+Ee+K),De=xe+Ie;m.style.height=De+"px"}else{const fe=ce.length>0&&N===ce[0].ref.current;m.style.top="0px";const Ie=Math.max(oe,W+j.offsetTop+(fe?O:0)+me)+I;m.style.height=Ie+"px",j.scrollTop=xe-oe+j.offsetTop}m.style.margin=`${hn}px 0`,m.style.minHeight=$+"px",m.style.maxHeight=le+"px",i==null||i(),requestAnimationFrame(()=>P.current=!0)}},[E,u.trigger,u.valueNode,m,y,j,N,k,u.dir,i]);Et(()=>b(),[b]);const[T,B]=p.useState();Et(()=>{y&&B(window.getComputedStyle(y).zIndex)},[y]);const G=p.useCallback(M=>{M&&C.current===!0&&(b(),R==null||R(),C.current=!1)},[b,R]);return t.jsx(KS,{scope:l,contentWrapper:m,shouldExpandOnScrollRef:P,onScrollButtonChange:G,children:t.jsx("div",{ref:x,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:t.jsx(Oe.div,{...c,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});xg.displayName=WS;var HS="SelectPopperPosition",pd=p.forwardRef((r,a)=>{const{__scopeSelect:l,align:i="start",collisionPadding:c=hn,...u}=r,f=Bo(l);return t.jsx(_S,{...f,...u,ref:a,align:i,collisionPadding:c,style:{boxSizing:"border-box",...u.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});pd.displayName=HS;var[KS,eu]=$s(Qr,{}),xd="SelectViewport",gg=p.forwardRef((r,a)=>{const{__scopeSelect:l,nonce:i,...c}=r,u=br(xd,l),f=eu(xd,l),m=Ke(a,u.onViewportChange),x=p.useRef(0);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),t.jsx(zo.Slot,{scope:l,children:t.jsx(Oe.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:m,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:Te(c.onScroll,y=>{const g=y.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:E}=f;if(E!=null&&E.current&&v){const P=Math.abs(x.current-g.scrollTop);if(P>0){const C=window.innerHeight-hn*2,j=parseFloat(v.style.minHeight),N=parseFloat(v.style.height),k=Math.max(j,N);if(k0?T:0,v.style.justifyContent="flex-end")}}}x.current=g.scrollTop})})})]})});gg.displayName=xd;var vg="SelectGroup",[GS,QS]=$s(vg),YS=p.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r,c=pr();return t.jsx(GS,{scope:l,id:c,children:t.jsx(Oe.div,{role:"group","aria-labelledby":c,...i,ref:a})})});YS.displayName=vg;var yg="SelectLabel",qS=p.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r,c=QS(yg,l);return t.jsx(Oe.div,{id:c.id,...i,ref:a})});qS.displayName=yg;var bo="SelectItem",[XS,wg]=$s(bo),jg=p.forwardRef((r,a)=>{const{__scopeSelect:l,value:i,disabled:c=!1,textValue:u,...f}=r,m=jr(bo,l),x=br(bo,l),y=m.value===i,[g,v]=p.useState(u??""),[E,P]=p.useState(!1),C=Ke(a,R=>{var b;return(b=x.itemRefCallback)==null?void 0:b.call(x,R,i,c)}),j=pr(),N=p.useRef("touch"),k=()=>{c||(m.onValueChange(i),m.onOpenChange(!1))};if(i==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t.jsx(XS,{scope:l,value:i,disabled:c,textId:j,isSelected:y,onItemTextChange:p.useCallback(R=>{v(b=>b||((R==null?void 0:R.textContent)??"").trim())},[]),children:t.jsx(zo.ItemSlot,{scope:l,value:i,disabled:c,textValue:g,children:t.jsx(Oe.div,{role:"option","aria-labelledby":j,"data-highlighted":E?"":void 0,"aria-selected":y&&E,"data-state":y?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...f,ref:C,onFocus:Te(f.onFocus,()=>P(!0)),onBlur:Te(f.onBlur,()=>P(!1)),onClick:Te(f.onClick,()=>{N.current!=="mouse"&&k()}),onPointerUp:Te(f.onPointerUp,()=>{N.current==="mouse"&&k()}),onPointerDown:Te(f.onPointerDown,R=>{N.current=R.pointerType}),onPointerMove:Te(f.onPointerMove,R=>{var b;N.current=R.pointerType,c?(b=x.onItemLeave)==null||b.call(x):N.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(f.onPointerLeave,R=>{var b;R.currentTarget===document.activeElement&&((b=x.onItemLeave)==null||b.call(x))}),onKeyDown:Te(f.onKeyDown,R=>{var T;((T=x.searchRef)==null?void 0:T.current)!==""&&R.key===" "||(LS.includes(R.key)&&k(),R.key===" "&&R.preventDefault())})})})})});jg.displayName=bo;var _a="SelectItemText",bg=p.forwardRef((r,a)=>{const{__scopeSelect:l,className:i,style:c,...u}=r,f=jr(_a,l),m=br(_a,l),x=wg(_a,l),y=zS(_a,l),[g,v]=p.useState(null),E=Ke(a,k=>v(k),x.onItemTextChange,k=>{var R;return(R=m.itemTextRefCallback)==null?void 0:R.call(m,k,x.value,x.disabled)}),P=g==null?void 0:g.textContent,C=p.useMemo(()=>t.jsx("option",{value:x.value,disabled:x.disabled,children:P},x.value),[x.disabled,x.value,P]),{onNativeOptionAdd:j,onNativeOptionRemove:N}=y;return Et(()=>(j(C),()=>N(C)),[j,N,C]),t.jsxs(t.Fragment,{children:[t.jsx(Oe.span,{id:x.textId,...u,ref:E}),x.isSelected&&f.valueNode&&!f.valueNodeHasChildren?La.createPortal(u.children,f.valueNode):null]})});bg.displayName=_a;var Ng="SelectItemIndicator",Sg=p.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r;return wg(Ng,l).isSelected?t.jsx(Oe.span,{"aria-hidden":!0,...i,ref:a}):null});Sg.displayName=Ng;var gd="SelectScrollUpButton",Cg=p.forwardRef((r,a)=>{const l=br(gd,r.__scopeSelect),i=eu(gd,r.__scopeSelect),[c,u]=p.useState(!1),f=Ke(a,i.onScrollButtonChange);return Et(()=>{if(l.viewport&&l.isPositioned){let m=function(){const y=x.scrollTop>0;u(y)};const x=l.viewport;return m(),x.addEventListener("scroll",m),()=>x.removeEventListener("scroll",m)}},[l.viewport,l.isPositioned]),c?t.jsx(Eg,{...r,ref:f,onAutoScroll:()=>{const{viewport:m,selectedItem:x}=l;m&&x&&(m.scrollTop=m.scrollTop-x.offsetHeight)}}):null});Cg.displayName=gd;var vd="SelectScrollDownButton",kg=p.forwardRef((r,a)=>{const l=br(vd,r.__scopeSelect),i=eu(vd,r.__scopeSelect),[c,u]=p.useState(!1),f=Ke(a,i.onScrollButtonChange);return Et(()=>{if(l.viewport&&l.isPositioned){let m=function(){const y=x.scrollHeight-x.clientHeight,g=Math.ceil(x.scrollTop)x.removeEventListener("scroll",m)}},[l.viewport,l.isPositioned]),c?t.jsx(Eg,{...r,ref:f,onAutoScroll:()=>{const{viewport:m,selectedItem:x}=l;m&&x&&(m.scrollTop=m.scrollTop+x.offsetHeight)}}):null});kg.displayName=vd;var Eg=p.forwardRef((r,a)=>{const{__scopeSelect:l,onAutoScroll:i,...c}=r,u=br("SelectScrollButton",l),f=p.useRef(null),m=$o(l),x=p.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return p.useEffect(()=>()=>x(),[x]),Et(()=>{var g;const y=m().find(v=>v.ref.current===document.activeElement);(g=y==null?void 0:y.ref.current)==null||g.scrollIntoView({block:"nearest"})},[m]),t.jsx(Oe.div,{"aria-hidden":!0,...c,ref:a,style:{flexShrink:0,...c.style},onPointerDown:Te(c.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(i,50))}),onPointerMove:Te(c.onPointerMove,()=>{var y;(y=u.onItemLeave)==null||y.call(u),f.current===null&&(f.current=window.setInterval(i,50))}),onPointerLeave:Te(c.onPointerLeave,()=>{x()})})}),JS="SelectSeparator",ZS=p.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r;return t.jsx(Oe.div,{"aria-hidden":!0,...i,ref:a})});ZS.displayName=JS;var yd="SelectArrow",eC=p.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r,c=Bo(l),u=jr(yd,l),f=br(yd,l);return u.open&&f.position==="popper"?t.jsx(TS,{...c,...i,ref:a}):null});eC.displayName=yd;var tC="SelectBubbleInput",Pg=p.forwardRef(({__scopeSelect:r,value:a,...l},i)=>{const c=p.useRef(null),u=Ke(i,c),f=Bd(a);return p.useEffect(()=>{const m=c.current;if(!m)return;const x=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==a&&g){const v=new Event("change",{bubbles:!0});g.call(m,a),m.dispatchEvent(v)}},[f,a]),t.jsx(Oe.select,{...l,style:{...ag,...l.style},ref:u,defaultValue:a})});Pg.displayName=tC;function Rg(r){return r===""||r===void 0}function _g(r){const a=xr(r),l=p.useRef(""),i=p.useRef(0),c=p.useCallback(f=>{const m=l.current+f;a(m),(function x(y){l.current=y,window.clearTimeout(i.current),y!==""&&(i.current=window.setTimeout(()=>x(""),1e3))})(m)},[a]),u=p.useCallback(()=>{l.current="",window.clearTimeout(i.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(i.current),[]),[l,c,u]}function Tg(r,a,l){const c=a.length>1&&Array.from(a).every(y=>y===a[0])?a[0]:a,u=l?r.indexOf(l):-1;let f=nC(r,Math.max(u,0));c.length===1&&(f=f.filter(y=>y!==l));const x=f.find(y=>y.textValue.toLowerCase().startsWith(c.toLowerCase()));return x!==l?x:void 0}function nC(r,a){return r.map((l,i)=>r[(a+i)%r.length])}var rC=lg,Ig=ig,sC=dg,aC=ug,lC=fg,Ag=hg,oC=gg,Mg=jg,iC=bg,cC=Sg,dC=Cg,uC=kg;const qc=rC,Xc=sC,oo=p.forwardRef(({className:r,children:a,...l},i)=>t.jsxs(Ig,{ref:i,className:Ge("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",r),...l,children:[a,t.jsx(aC,{asChild:!0,children:t.jsx(cp,{className:"h-4 w-4 opacity-50"})})]}));oo.displayName=Ig.displayName;const io=p.forwardRef(({className:r,children:a,position:l="popper",...i},c)=>t.jsx(lC,{children:t.jsxs(Ag,{ref:c,className:Ge("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",l==="popper"&&"data-[side=bottom]:translate-y-1",r),position:l,...i,children:[t.jsx(dC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(yw,{className:"h-4 w-4"})}),t.jsx(oC,{className:"p-1",children:a}),t.jsx(uC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(cp,{className:"h-4 w-4"})})]})}));io.displayName=Ag.displayName;const fr=p.forwardRef(({className:r,children:a,...l},i)=>t.jsxs(Mg,{ref:i,className:Ge("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...l,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(cC,{children:t.jsx(Co,{className:"h-4 w-4"})})}),t.jsx(iC,{children:a})]}));fr.displayName=Mg.displayName;function fC(r){const a=new Map;for(const l of r){const i=l.partId||"part-1",c=l.partTitle||"未分类",u=l.chapterId||"chapter-1",f=l.chapterTitle||"未分类";a.has(i)||a.set(i,{id:i,title:c,chapters:new Map});const m=a.get(i);m.chapters.has(u)||m.chapters.set(u,{id:u,title:f,sections:[]}),m.chapters.get(u).sections.push({id:l.id,title:l.title,price:l.price??1,filePath:l.filePath,isFree:l.isFree})}return Array.from(a.values()).map(l=>({...l,chapters:Array.from(l.chapters.values())}))}function hC(){const[r,a]=p.useState([]),[l,i]=p.useState(!0),[c,u]=p.useState([]),[f,m]=p.useState(null),[x,y]=p.useState(!1),[g,v]=p.useState(!1),[E,P]=p.useState(!1),[C,j]=p.useState(""),[N,k]=p.useState([]),[R,b]=p.useState(!1),[T,B]=p.useState(!1),G=p.useRef(null),[M,V]=p.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),ee=fC(r),de=r.length,ce=async()=>{i(!0);try{const S=await He("/api/db/book?action=list");a(Array.isArray(S==null?void 0:S.sections)?S.sections:[]),c.length===0&&ee.length>0&&u([ee[0].id])}catch(S){console.error(S),a([])}finally{i(!1)}};p.useEffect(()=>{ce()},[]),p.useEffect(()=>{!l&&ee.length>0&&c.length===0&&u([ee[0].id])},[l,ee.length,c.length]);const le=S=>{u(O=>O.includes(S)?O.filter(se=>se!==S):[...O,S])},ue=async S=>{if(confirm(`确定要删除章节「${S.title}」吗?此操作不可恢复。`))try{const O=await Td(`/api/db/book?id=${encodeURIComponent(S.id)}`);O&&O.success!==!1?(alert("已删除"),ce()):alert("删除失败: "+(O&&typeof O=="object"&&"error"in O?O.error:"未知错误"))}catch(O){console.error(O),alert("删除失败")}},H=async S=>{v(!0);try{const O=await He(`/api/db/book?action=read&id=${encodeURIComponent(S.id)}`);O!=null&&O.success&&O.section?m({id:S.id,title:O.section.title??S.title,price:O.section.price??S.price,content:O.section.content??"",filePath:S.filePath,isFree:S.isFree||S.price===0}):(m({id:S.id,title:S.title,price:S.price,content:"",filePath:S.filePath,isFree:S.isFree}),O&&!O.success&&alert("无法读取文件内容: "+(O.error||"未知错误")))}catch(O){console.error(O),m({id:S.id,title:S.title,price:S.price,content:"",filePath:S.filePath,isFree:S.isFree})}finally{v(!1)}},W=async()=>{var S;if(f){P(!0);try{let O=f.content||"";const se=[new RegExp(`^#+\\s*${f.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${f.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(S=f.title)==null?void 0:S.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const be of se)O=O.replace(be,"");O=O.replace(/^\s*\n+/,"").trim();const oe=await Wt("/api/db/book",{id:f.id,title:f.title,price:f.isFree?0:f.price,content:O,isFree:f.isFree||f.price===0,saveToFile:!0});oe&&oe.success!==!1?(alert(`已保存章节: ${f.title}`),m(null),ce()):alert("保存失败: "+(oe&&typeof oe=="object"&&"error"in oe?oe.error:"未知错误"))}catch(O){console.error(O),alert("保存失败")}finally{P(!1)}}},Q=async()=>{if(!M.id||!M.title){alert("请填写章节ID和标题");return}P(!0);try{const S=await Wt("/api/db/book",{id:M.id,title:M.title,price:M.price,content:M.content,partId:M.partId,chapterId:M.chapterId,saveToFile:!1});S&&S.success!==!1?(alert(`章节创建成功: ${M.title}`),y(!1),V({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),ce()):alert("创建失败: "+(S&&typeof S=="object"&&"error"in S?S.error:"未知错误"))}catch(S){console.error(S),alert("创建失败")}finally{P(!1)}},K=async S=>{var se,oe;const O=(se=S.target.files)==null?void 0:se[0];if(O){B(!0);try{const be=new FormData;be.append("file",O),be.append("folder","book-images");const Y=await(await fetch(pp("/api/upload"),{method:"POST",body:be,credentials:"include"})).json();if(Y!=null&&Y.success&&((oe=Y==null?void 0:Y.data)!=null&&oe.url)){const xe=`![${O.name}](${Y.data.url})`;f&&m({...f,content:(f.content||"")+` `+xe}),alert(`图片上传成功: ${Y.data.url}`)}else alert("上传失败: "+((Y==null?void 0:Y.error)||"未知错误"))}catch(be){console.error(be),alert("上传失败")}finally{B(!1),G.current&&(G.current.value="")}}},A=async()=>{var S;if(C.trim()){b(!0);try{const O=await He(`/api/search?q=${encodeURIComponent(C)}`);O!=null&&O.success&&((S=O.data)!=null&&S.results)?k(O.data.results):(k([]),O&&!O.success&&alert("搜索失败: "+O.error))}catch(O){console.error(O),k([]),alert("搜索失败")}finally{b(!1)}}},X=ee.find(S=>S.id===M.partId),$=(X==null?void 0:X.chapters)??[];return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),t.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",ee.length," 篇 · ",de," 节内容"]})]}),t.jsx("div",{className:"flex gap-2",children:t.jsxs(he,{onClick:()=>{const S=typeof window<"u"?`${window.location.origin}/api-doc`:"";S&&window.open(S,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(zr,{className:"w-4 h-4 mr-2"}),"API 接口"]})})]}),t.jsx(tn,{open:x,onOpenChange:y,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx($r,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"章节ID *"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:M.id,onChange:S=>V({...M,id:S.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:M.price,onChange:S=>V({...M,price:Number(S.target.value)})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"章节标题 *"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:M.title,onChange:S=>V({...M,title:S.target.value})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"所属篇"}),t.jsxs(qc,{value:M.partId,onValueChange:S=>V({...M,partId:S,chapterId:"chapter-1"}),children:[t.jsx(oo,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(Xc,{})}),t.jsxs(io,{className:"bg-[#0f2137] border-gray-700",children:[ee.map(S=>t.jsx(fr,{value:S.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:S.title},S.id)),ee.length===0&&t.jsx(fr,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"所属章"}),t.jsxs(qc,{value:M.chapterId,onValueChange:S=>V({...M,chapterId:S}),children:[t.jsx(oo,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(Xc,{})}),t.jsxs(io,{className:"bg-[#0f2137] border-gray-700",children:[$.map(S=>t.jsx(fr,{value:S.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:S.title},S.id)),$.length===0&&t.jsx(fr,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsx(ks,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[300px] font-mono text-sm placeholder:text-gray-500",placeholder:"输入章节内容...",value:M.content,onChange:S=>V({...M,content:S.target.value})})]})]}),t.jsxs(mn,{children:[t.jsx(he,{variant:"outline",onClick:()=>y(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(he,{onClick:Q,disabled:E||!M.id||!M.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(st,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):t.jsxs(t.Fragment,{children:[t.jsx($r,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),t.jsx(tn,{open:!!f,onOpenChange:()=>m(null),children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx(Ur,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),f&&t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"章节ID"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.id,disabled:!0})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.isFree?0:f.price,onChange:S=>m({...f,price:Number(S.target.value),isFree:Number(S.target.value)===0}),disabled:f.isFree})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"免费章节"}),t.jsx("div",{className:"flex items-center h-10",children:t.jsxs("label",{className:"flex items-center cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:f.isFree||f.price===0,onChange:S=>m({...f,isFree:S.target.checked,price:S.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),t.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"章节标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.title,onChange:S=>m({...f,title:S.target.value})})]}),f.filePath&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"文件路径"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:f.filePath,disabled:!0})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(ne,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:G,type:"file",accept:"image/*",onChange:K,className:"hidden"}),t.jsxs(he,{variant:"outline",size:"sm",onClick:()=>{var S;return(S=G.current)==null?void 0:S.click()},disabled:T,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[T?t.jsx(st,{className:"w-4 h-4 mr-1 animate-spin"}):t.jsx(Qw,{className:"w-4 h-4 mr-1"}),"上传图片"]})]})]}),g?t.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[t.jsx(st,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsx(ks,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[400px] font-mono text-sm placeholder:text-gray-500",placeholder:"此处输入章节内容,支持Markdown格式...",value:f.content,onChange:S=>m({...f,content:S.target.value})})]})]}),t.jsxs(mn,{children:[t.jsxs(he,{variant:"outline",onClick:()=>m(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(zn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsx(he,{onClick:W,disabled:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(st,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),t.jsxs(Hd,{defaultValue:"chapters",className:"space-y-6",children:[t.jsxs(Mo,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[t.jsxs(Zt,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Ps,{className:"w-4 h-4 mr-2"}),"章节管理"]}),t.jsxs(Zt,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Br,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),t.jsxs(Zt,{value:"hooks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Cj,{className:"w-4 h-4 mr-2"}),"钩子配置"]})]}),t.jsxs(en,{value:"chapters",className:"space-y-4",children:[t.jsxs(he,{onClick:()=>y(!0),className:"w-full bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[t.jsx($r,{className:"w-4 h-4 mr-2"}),"新建章节"]}),l?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(st,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):ee.map((S,O)=>t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl overflow-hidden",children:[t.jsx(Be,{className:"cursor-pointer hover:bg-[#162840] transition-colors",onClick:()=>le(S.id),children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("span",{className:"text-[#38bdac] font-mono text-sm",children:["0",O+1]}),t.jsx(Ve,{className:"text-white",children:S.title}),t.jsxs(Le,{variant:"outline",className:"text-gray-400 border-gray-600",children:[S.chapters.reduce((se,oe)=>se+oe.sections.length,0)," 节"]})]}),t.jsx(dp,{className:`w-5 h-5 text-gray-400 transition-transform ${c.includes(S.id)?"rotate-90":""}`})]})}),c.includes(S.id)&&t.jsx(ke,{className:"pt-0 pb-4",children:t.jsx("div",{className:"space-y-3 pl-8 border-l-2 border-gray-700",children:S.chapters.map(se=>t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"font-medium text-gray-300",children:se.title}),t.jsx("div",{className:"space-y-1",children:se.sections.map(oe=>t.jsxs("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg hover:bg-[#162840] text-sm group transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(nd,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-gray-400",children:oe.title})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-[#38bdac] font-medium",children:oe.price===0?"免费":`¥${oe.price}`}),t.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>H(oe),className:"text-gray-500 hover:text-[#38bdac] hover:bg-[#38bdac]/10 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(Rd,{className:"w-4 h-4 mr-1"}),"读取"]}),t.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>H(oe),className:"text-gray-500 hover:text-[#38bdac] hover:bg-[#38bdac]/10 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(Ur,{className:"w-4 h-4 mr-1"}),"编辑"]}),t.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>ue(oe),className:"text-gray-500 hover:text-red-400 hover:bg-red-500/10 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(Eo,{className:"w-4 h-4 mr-1"}),"删除"]})]})]},oe.id))})]},se.id))})})]},S.id))]}),t.jsx(en,{value:"search",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"内容搜索"})}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:C,onChange:S=>j(S.target.value),onKeyDown:S=>S.key==="Enter"&&A()}),t.jsx(he,{onClick:A,disabled:R||!C.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:R?t.jsx(st,{className:"w-4 h-4 animate-spin"}):t.jsx(Br,{className:"w-4 h-4"})})]}),N.length>0&&t.jsxs("div",{className:"space-y-2 mt-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",N.length," 个结果"]}),N.map(S=>t.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>H({id:S.id,title:S.title,price:S.price??1,filePath:""}),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-[#38bdac] font-mono text-xs mr-2",children:S.id}),t.jsx("span",{className:"text-white",children:S.title})]}),t.jsx(Le,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:S.matchType==="title"?"标题匹配":"内容匹配"})]}),S.snippet&&t.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:S.snippet}),(S.partTitle||S.chapterTitle)&&t.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[S.partTitle," · ",S.chapterTitle]})]},S.id))]})]})]})}),t.jsx(en,{value:"hooks",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"引流钩子配置"})}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"grid w-full max-w-sm items-center gap-1.5",children:[t.jsx(ne,{htmlFor:"hook-chapter",className:"text-gray-300",children:"触发章节"}),t.jsxs(qc,{defaultValue:"3",children:[t.jsx(oo,{id:"hook-chapter",className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(Xc,{placeholder:"选择章节"})}),t.jsxs(io,{className:"bg-[#0f2137] border-gray-700",children:[t.jsx(fr,{value:"1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第一章"}),t.jsx(fr,{value:"2",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第二章"}),t.jsx(fr,{value:"3",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第三章 (默认)"})]})]})]}),t.jsxs("div",{className:"grid w-full gap-1.5",children:[t.jsx(ne,{htmlFor:"message",className:"text-gray-300",children:"引流文案"}),t.jsx(ks,{placeholder:"输入引导用户加群的文案...",id:"message",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",defaultValue:"阅读更多精彩内容,请加入Soul创业实验派对群..."})]}),t.jsx(he,{className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:"保存配置"})]})]})})]})]})}function mC(){const[r,a]=p.useState([]),[l,i]=p.useState(null),[c,u]=p.useState(!0),[f,m]=p.useState(null),[x,y]=p.useState([]),[g,v]=p.useState(null),[E,P]=p.useState(1);async function C(){u(!0),m(null);try{const R=await He("/api/admin/chapters");R!=null&&R.success&&R.data?(a(R.data.structure??[]),i(R.data.stats??null)):m("加载章节失败")}catch(R){console.error("加载章节失败:",R),m("加载失败,请检查网络后重试")}finally{u(!1)}}p.useEffect(()=>{C()},[]);const j=R=>{y(b=>b.includes(R)?b.filter(T=>T!==R):[...b,R])},N=async R=>{try{const b=await bt("/api/admin/chapters",{action:"updatePrice",chapterId:R,data:{price:E}});b!=null&&b.success&&(alert("价格更新成功"),v(null),C())}catch(b){console.error("更新价格失败:",b)}},k=async(R,b)=>{try{const T=await bt("/api/admin/chapters",{action:"toggleFree",chapterId:R,data:{isFree:!b}});T!=null&&T.success&&(alert("状态更新成功"),C())}catch(T){console.error("更新状态失败:",T)}};return c?t.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:t.jsx("div",{className:"text-xl text-gray-400",children:"加载中..."})}):t.jsxs("div",{className:"min-h-screen bg-black text-white",children:[t.jsx("div",{className:"sticky top-0 bg-black/90 backdrop-blur border-b border-white/10 z-50",children:t.jsxs("div",{className:"w-full min-w-[1024px] px-4 py-4 flex items-center justify-between",children:[t.jsx("h1",{className:"text-xl font-bold",children:"章节管理"}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("button",{type:"button",onClick:C,disabled:c,className:"px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 text-white disabled:opacity-50",children:"刷新"}),t.jsx("button",{type:"button",onClick:()=>y(r.map(R=>R.id)),className:"px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 text-white",children:"展开全部"}),t.jsx("button",{type:"button",onClick:()=>y([]),className:"px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 text-white",children:"收起全部"})]})]})}),t.jsxs("div",{className:"w-full min-w-[1024px] px-4 py-8",children:[f&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:f}),t.jsx("button",{type:"button",onClick:()=>m(null),className:"hover:text-red-300",children:"×"})]}),l&&t.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-8",children:[t.jsxs("div",{className:"bg-gradient-to-br from-cyan-500/20 to-cyan-500/5 border border-cyan-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-cyan-400",children:l.totalSections}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"总章节数"})]}),t.jsxs("div",{className:"bg-gradient-to-br from-green-500/20 to-green-500/5 border border-green-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-green-400",children:l.freeSections}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"免费章节"})]}),t.jsxs("div",{className:"bg-gradient-to-br from-yellow-500/20 to-yellow-500/5 border border-yellow-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-yellow-400",children:l.paidSections}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"付费章节"})]}),t.jsxs("div",{className:"bg-gradient-to-br from-purple-500/20 to-purple-500/5 border border-purple-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-purple-400",children:l.totalParts}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"篇章数"})]})]}),t.jsx("div",{className:"space-y-4",children:r.map(R=>t.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer hover:bg-white/5",onClick:()=>j(R.id),onKeyDown:b=>b.key==="Enter"&&j(R.id),role:"button",tabIndex:0,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-2xl",children:R.type==="preface"?"📖":R.type==="epilogue"?"🎬":R.type==="appendix"?"📎":"📚"}),t.jsx("span",{className:"font-semibold text-white",children:R.title}),t.jsxs("span",{className:"text-white/40 text-sm",children:["(",R.chapters.reduce((b,T)=>{var B;return b+(((B=T.sections)==null?void 0:B.length)||1)},0)," 节)"]})]}),t.jsx("span",{className:"text-white/40",children:x.includes(R.id)?"▲":"▼"})]}),x.includes(R.id)&&t.jsx("div",{className:"border-t border-white/10",children:R.chapters.map(b=>t.jsx("div",{className:"border-b border-white/5 last:border-b-0",children:b.sections?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-6 py-3 bg-white/5 text-white/70 font-medium",children:b.title}),t.jsx("div",{className:"divide-y divide-white/5",children:b.sections.map(T=>t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 hover:bg-white/5",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:T.isFree?"text-green-400":"text-yellow-400",children:T.isFree?"🔓":"🔒"}),t.jsx("span",{className:"text-white/80",children:T.id}),t.jsx("span",{className:"text-white/60",children:T.title})]}),t.jsx("div",{className:"flex items-center gap-3",children:g===T.id?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"number",value:E,onChange:B=>P(Number(B.target.value)),className:"w-20 px-2 py-1 bg-white/10 border border-white/20 rounded text-white",min:0,step:.1}),t.jsx("button",{type:"button",onClick:()=>N(T.id),className:"px-3 py-1 bg-cyan-500 text-black rounded text-sm",children:"保存"}),t.jsx("button",{type:"button",onClick:()=>v(null),className:"px-3 py-1 bg-white/20 rounded text-sm text-white",children:"取消"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:`px-2 py-1 rounded text-xs ${T.isFree?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:T.isFree?"免费":`¥${T.price}`}),t.jsx("button",{type:"button",onClick:()=>{v(T.id),P(T.price)},className:"px-2 py-1 text-xs bg-white/10 rounded hover:bg-white/20 text-white",children:"编辑价格"}),t.jsx("button",{type:"button",onClick:()=>k(T.id,T.isFree),className:"px-2 py-1 text-xs bg-white/10 rounded hover:bg-white/20 text-white",children:T.isFree?"设为付费":"设为免费"})]})})]},T.id))})]}):t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 hover:bg-white/5",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:b.isFree?"text-green-400":"text-yellow-400",children:b.isFree?"🔓":"🔒"}),t.jsx("span",{className:"text-white/80",children:b.title})]}),t.jsx("span",{className:`px-2 py-1 rounded text-xs ${b.isFree?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:b.isFree?"免费":`¥${b.price??1}`})]})},b.id))})]},R.id))})]})]})}var Lg=["PageUp","PageDown"],Og=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Dg={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Bs="Slider",[wd,pC,xC]=Ud(Bs),[Fg]=wr(Bs,[xC]),[gC,Vo]=Fg(Bs),zg=p.forwardRef((r,a)=>{const{name:l,min:i=0,max:c=100,step:u=1,orientation:f="horizontal",disabled:m=!1,minStepsBetweenThumbs:x=0,defaultValue:y=[i],value:g,onValueChange:v=()=>{},onValueCommit:E=()=>{},inverted:P=!1,form:C,...j}=r,N=p.useRef(new Set),k=p.useRef(0),b=f==="horizontal"?vC:yC,[T=[],B]=Wr({prop:g,defaultProp:y,onChange:ce=>{var ue;(ue=[...N.current][k.current])==null||ue.focus(),v(ce)}}),G=p.useRef(T);function M(ce){const le=SC(T,ce);de(ce,le)}function V(ce){de(ce,k.current)}function ee(){const ce=G.current[k.current];T[k.current]!==ce&&E(T)}function de(ce,le,{commit:ue}={commit:!1}){const H=PC(u),W=RC(Math.round((ce-i)/u)*u+i,H),Q=go(W,[i,c]);B((K=[])=>{const A=bC(K,Q,le);if(EC(A,x*u)){k.current=A.indexOf(Q);const X=String(A)!==String(K);return X&&ue&&E(A),X?A:K}else return K})}return t.jsx(gC,{scope:r.__scopeSlider,name:l,disabled:m,min:i,max:c,valueIndexToChangeRef:k,thumbs:N.current,values:T,orientation:f,form:C,children:t.jsx(wd.Provider,{scope:r.__scopeSlider,children:t.jsx(wd.Slot,{scope:r.__scopeSlider,children:t.jsx(b,{"aria-disabled":m,"data-disabled":m?"":void 0,...j,ref:a,onPointerDown:Te(j.onPointerDown,()=>{m||(G.current=T)}),min:i,max:c,inverted:P,onSlideStart:m?void 0:M,onSlideMove:m?void 0:V,onSlideEnd:m?void 0:ee,onHomeKeyDown:()=>!m&&de(i,0,{commit:!0}),onEndKeyDown:()=>!m&&de(c,T.length-1,{commit:!0}),onStepKeyDown:({event:ce,direction:le})=>{if(!m){const W=Lg.includes(ce.key)||ce.shiftKey&&Og.includes(ce.key)?10:1,Q=k.current,K=T[Q],A=u*W*le;de(K+A,Q,{commit:!0})}}})})})})});zg.displayName=Bs;var[$g,Bg]=Fg(Bs,{startEdge:"left",endEdge:"right",size:"width",direction:1}),vC=p.forwardRef((r,a)=>{const{min:l,max:i,dir:c,inverted:u,onSlideStart:f,onSlideMove:m,onSlideEnd:x,onStepKeyDown:y,...g}=r,[v,E]=p.useState(null),P=Ke(a,b=>E(b)),C=p.useRef(void 0),j=Io(c),N=j==="ltr",k=N&&!u||!N&&u;function R(b){const T=C.current||v.getBoundingClientRect(),B=[0,T.width],M=tu(B,k?[l,i]:[i,l]);return C.current=T,M(b-T.left)}return t.jsx($g,{scope:r.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:t.jsx(Vg,{dir:j,"data-orientation":"horizontal",...g,ref:P,style:{...g.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const T=R(b.clientX);f==null||f(T)},onSlideMove:b=>{const T=R(b.clientX);m==null||m(T)},onSlideEnd:()=>{C.current=void 0,x==null||x()},onStepKeyDown:b=>{const B=Dg[k?"from-left":"from-right"].includes(b.key);y==null||y({event:b,direction:B?-1:1})}})})}),yC=p.forwardRef((r,a)=>{const{min:l,max:i,inverted:c,onSlideStart:u,onSlideMove:f,onSlideEnd:m,onStepKeyDown:x,...y}=r,g=p.useRef(null),v=Ke(a,g),E=p.useRef(void 0),P=!c;function C(j){const N=E.current||g.current.getBoundingClientRect(),k=[0,N.height],b=tu(k,P?[i,l]:[l,i]);return E.current=N,b(j-N.top)}return t.jsx($g,{scope:r.__scopeSlider,startEdge:P?"bottom":"top",endEdge:P?"top":"bottom",size:"height",direction:P?1:-1,children:t.jsx(Vg,{"data-orientation":"vertical",...y,ref:v,style:{...y.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const N=C(j.clientY);u==null||u(N)},onSlideMove:j=>{const N=C(j.clientY);f==null||f(N)},onSlideEnd:()=>{E.current=void 0,m==null||m()},onStepKeyDown:j=>{const k=Dg[P?"from-bottom":"from-top"].includes(j.key);x==null||x({event:j,direction:k?-1:1})}})})}),Vg=p.forwardRef((r,a)=>{const{__scopeSlider:l,onSlideStart:i,onSlideMove:c,onSlideEnd:u,onHomeKeyDown:f,onEndKeyDown:m,onStepKeyDown:x,...y}=r,g=Vo(Bs,l);return t.jsx(Oe.span,{...y,ref:a,onKeyDown:Te(r.onKeyDown,v=>{v.key==="Home"?(f(v),v.preventDefault()):v.key==="End"?(m(v),v.preventDefault()):Lg.concat(Og).includes(v.key)&&(x(v),v.preventDefault())}),onPointerDown:Te(r.onPointerDown,v=>{const E=v.target;E.setPointerCapture(v.pointerId),v.preventDefault(),g.thumbs.has(E)?E.focus():i(v)}),onPointerMove:Te(r.onPointerMove,v=>{v.target.hasPointerCapture(v.pointerId)&&c(v)}),onPointerUp:Te(r.onPointerUp,v=>{const E=v.target;E.hasPointerCapture(v.pointerId)&&(E.releasePointerCapture(v.pointerId),u(v))})})}),Ug="SliderTrack",Wg=p.forwardRef((r,a)=>{const{__scopeSlider:l,...i}=r,c=Vo(Ug,l);return t.jsx(Oe.span,{"data-disabled":c.disabled?"":void 0,"data-orientation":c.orientation,...i,ref:a})});Wg.displayName=Ug;var jd="SliderRange",Hg=p.forwardRef((r,a)=>{const{__scopeSlider:l,...i}=r,c=Vo(jd,l),u=Bg(jd,l),f=p.useRef(null),m=Ke(a,f),x=c.values.length,y=c.values.map(E=>Qg(E,c.min,c.max)),g=x>1?Math.min(...y):0,v=100-Math.max(...y);return t.jsx(Oe.span,{"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,...i,ref:m,style:{...r.style,[u.startEdge]:g+"%",[u.endEdge]:v+"%"}})});Hg.displayName=jd;var bd="SliderThumb",Kg=p.forwardRef((r,a)=>{const l=pC(r.__scopeSlider),[i,c]=p.useState(null),u=Ke(a,m=>c(m)),f=p.useMemo(()=>i?l().findIndex(m=>m.ref.current===i):-1,[l,i]);return t.jsx(wC,{...r,ref:u,index:f})}),wC=p.forwardRef((r,a)=>{const{__scopeSlider:l,index:i,name:c,...u}=r,f=Vo(bd,l),m=Bg(bd,l),[x,y]=p.useState(null),g=Ke(a,R=>y(R)),v=x?f.form||!!x.closest("form"):!0,E=Vd(x),P=f.values[i],C=P===void 0?0:Qg(P,f.min,f.max),j=NC(i,f.values.length),N=E==null?void 0:E[m.size],k=N?CC(N,C,m.direction):0;return p.useEffect(()=>{if(x)return f.thumbs.add(x),()=>{f.thumbs.delete(x)}},[x,f.thumbs]),t.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[m.startEdge]:`calc(${C}% + ${k}px)`},children:[t.jsx(wd.ItemSlot,{scope:r.__scopeSlider,children:t.jsx(Oe.span,{role:"slider","aria-label":r["aria-label"]||j,"aria-valuemin":f.min,"aria-valuenow":P,"aria-valuemax":f.max,"aria-orientation":f.orientation,"data-orientation":f.orientation,"data-disabled":f.disabled?"":void 0,tabIndex:f.disabled?void 0:0,...u,ref:g,style:P===void 0?{display:"none"}:r.style,onFocus:Te(r.onFocus,()=>{f.valueIndexToChangeRef.current=i})})}),v&&t.jsx(Gg,{name:c??(f.name?f.name+(f.values.length>1?"[]":""):void 0),form:f.form,value:P},i)]})});Kg.displayName=bd;var jC="RadioBubbleInput",Gg=p.forwardRef(({__scopeSlider:r,value:a,...l},i)=>{const c=p.useRef(null),u=Ke(c,i),f=Bd(a);return p.useEffect(()=>{const m=c.current;if(!m)return;const x=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==a&&g){const v=new Event("input",{bubbles:!0});g.call(m,a),m.dispatchEvent(v)}},[f,a]),t.jsx(Oe.input,{style:{display:"none"},...l,ref:u,defaultValue:a})});Gg.displayName=jC;function bC(r=[],a,l){const i=[...r];return i[l]=a,i.sort((c,u)=>c-u)}function Qg(r,a,l){const u=100/(l-a)*(r-a);return go(u,[0,100])}function NC(r,a){return a>2?`Value ${r+1} of ${a}`:a===2?["Minimum","Maximum"][r]:void 0}function SC(r,a){if(r.length===1)return 0;const l=r.map(c=>Math.abs(c-a)),i=Math.min(...l);return l.indexOf(i)}function CC(r,a,l){const i=r/2,u=tu([0,50],[0,i]);return(i-u(a)*l)*l}function kC(r){return r.slice(0,-1).map((a,l)=>r[l+1]-a)}function EC(r,a){if(a>0){const l=kC(r);return Math.min(...l)>=a}return!0}function tu(r,a){return l=>{if(r[0]===r[1]||a[0]===a[1])return a[0];const i=(a[1]-a[0])/(r[1]-r[0]);return a[0]+i*(l-r[0])}}function PC(r){return(String(r).split(".")[1]||"").length}function RC(r,a){const l=Math.pow(10,a);return Math.round(r*l)/l}var _C=zg,TC=Wg,IC=Hg,AC=Kg;function MC({className:r,defaultValue:a,value:l,min:i=0,max:c=100,...u}){const f=p.useMemo(()=>Array.isArray(l)?l:Array.isArray(a)?a:[i,c],[l,a,i,c]);return t.jsxs(_C,{defaultValue:a,value:l,min:i,max:c,className:Ge("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",r),...u,children:[t.jsx(TC,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:t.jsx(IC,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:f.length},(m,x)=>t.jsx(AC,{className:"block size-4 shrink-0 rounded-full border-2 border-[#38bdac] bg-white shadow-sm focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},x))]})}const LC={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function OC(){const[r,a]=p.useState(LC),[l,i]=p.useState(!0),[c,u]=p.useState(!1);p.useEffect(()=>{He("/api/admin/referral-settings").then(x=>{const y=x==null?void 0:x.data;y&&typeof y=="object"&&a({distributorShare:y.distributorShare??90,minWithdrawAmount:y.minWithdrawAmount??10,bindingDays:y.bindingDays??30,userDiscount:y.userDiscount??5,enableAutoWithdraw:y.enableAutoWithdraw??!1,vipOrderShareVip:y.vipOrderShareVip??20,vipOrderShareNonVip:y.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>i(!1))},[]);const f=async()=>{u(!0);try{const x={distributorShare:Number(r.distributorShare)||0,minWithdrawAmount:Number(r.minWithdrawAmount)||0,bindingDays:Number(r.bindingDays)||0,userDiscount:Number(r.userDiscount)||0,enableAutoWithdraw:!!r.enableAutoWithdraw,vipOrderShareVip:Number(r.vipOrderShareVip)||20,vipOrderShareNonVip:Number(r.vipOrderShareNonVip)||10},y=await bt("/api/admin/referral-settings",x);if(!y||y.success===!1){alert("保存失败: "+(y&&typeof y=="object"&&"error"in y?y.error:""));return}alert(`✅ 分销配置已保存成功! • 小程序与网站的推广规则会一起生效 • 绑定关系会使用新的天数配置 • 佣金比例会立即应用到新订单 如有缓存,请刷新前台/小程序页面。`)}catch(x){console.error(x),alert("保存失败: "+(x instanceof Error?x.message:String(x)))}finally{u(!1)}},m=x=>y=>{const g=parseFloat(y.target.value||"0");a(v=>({...v,[x]:isNaN(g)?0:g}))};return l?t.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(Rs,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),t.jsxs(he,{onClick:f,disabled:c||l,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(pj,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),t.jsx(ft,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),t.jsx(ke,{className:"space-y-6",children:t.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(Ql,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),t.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.userDiscount,onChange:m("userDiscount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(En,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(MC,{className:"flex-1",min:10,max:100,step:1,value:[r.distributorShare],onValueChange:([x])=>a(y=>({...y,distributorShare:x}))}),t.jsx(ie,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:r.distributorShare,onChange:m("distributorShare")})]}),t.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",t.jsxs("span",{className:"text-[#38bdac] font-mono",children:[r.distributorShare,"%"]}),";会员订单见下方。"]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(Ql,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),t.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.vipOrderShareVip,onChange:m("vipOrderShareVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(Ql,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),t.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.vipOrderShareNonVip,onChange:m("vipOrderShareNonVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(En,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),t.jsx(ie,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:r.bindingDays,onChange:m("bindingDays")}),t.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(Rs,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),t.jsx(ft,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),t.jsx(ke,{className:"space-y-6",children:t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"最低提现金额(元)"}),t.jsx(ie,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:r.minWithdrawAmount,onChange:m("minWithdrawAmount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",t.jsx(Le,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),t.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[t.jsx(ut,{checked:r.enableAutoWithdraw,onCheckedChange:x=>a(y=>({...y,enableAutoWithdraw:x}))}),t.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[t.jsx(Ql,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),t.jsxs(ke,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[t.jsxs("p",{children:["1. 以上配置会写入"," ",t.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),t.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),t.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}const DC={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},FC={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},zC={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...FC}},$C={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0};function BC(){const[r,a]=p.useState(zC),[l,i]=p.useState(["preface","epilogue","1.1","appendix-1","appendix-2","appendix-3"]),[c,u]=p.useState(""),[f,m]=p.useState($C),[x,y]=p.useState(DC),[g,v]=p.useState(!1),[E,P]=p.useState(!0),[C,j]=p.useState(!1),[N,k]=p.useState(""),[R,b]=p.useState(""),[T,B]=p.useState(!1),[G,M]=p.useState(!1),V=(H,W,Q=!1)=>{k(H),b(W),B(Q),j(!0)};p.useEffect(()=>{(async()=>{try{const W=await He("/api/admin/settings");if(!W||W.success===!1)return;if(Array.isArray(W.freeChapters)&&W.freeChapters.length&&i(W.freeChapters),W.featureConfig&&Object.keys(W.featureConfig).length&&m(Q=>({...Q,...W.featureConfig})),W.mpConfig&&typeof W.mpConfig=="object"&&y(Q=>({...Q,...W.mpConfig})),W.siteSettings&&typeof W.siteSettings=="object"){const Q=W.siteSettings;a(K=>({...K,...typeof Q.sectionPrice=="number"&&{sectionPrice:Q.sectionPrice},...typeof Q.baseBookPrice=="number"&&{baseBookPrice:Q.baseBookPrice},...typeof Q.distributorShare=="number"&&{distributorShare:Q.distributorShare},...Q.authorInfo&&typeof Q.authorInfo=="object"&&{authorInfo:{...K.authorInfo,...Q.authorInfo}}}))}}catch(W){console.error("Load settings error:",W)}finally{P(!1)}})()},[]);const ee=async(H,W)=>{M(!0);try{const Q=await bt("/api/admin/settings",{featureConfig:H});if(!Q||Q.success===!1){W(),V("保存失败",(Q==null?void 0:Q.error)??"未知错误",!0);return}V("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(Q){console.error("Save feature config error:",Q),W(),V("保存失败",Q instanceof Error?Q.message:String(Q),!0)}finally{M(!1)}},de=(H,W)=>{const Q=f,K={...Q,[H]:W};m(K),ee(K,()=>m(Q))},ce=async()=>{v(!0);try{const H=await bt("/api/admin/settings",{freeChapters:l,featureConfig:f,siteSettings:{sectionPrice:r.sectionPrice,baseBookPrice:r.baseBookPrice,distributorShare:r.distributorShare,authorInfo:r.authorInfo},mpConfig:{...x,appId:x.appId||"",withdrawSubscribeTmplId:x.withdrawSubscribeTmplId||"",mchId:x.mchId||"",minWithdraw:typeof x.minWithdraw=="number"?x.minWithdraw:10}});if(!H||H.success===!1){V("保存失败",(H==null?void 0:H.error)??"未知错误",!0);return}V("已保存","设置已保存成功。")}catch(H){console.error("Save settings error:",H),V("保存失败",H instanceof Error?H.message:String(H),!0)}finally{v(!1)}},le=()=>{c&&!l.includes(c)&&(i([...l,c]),u(""))},ue=H=>{i(l.filter(W=>W!==H))};return E?t.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),t.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),t.jsxs(he,{onClick:ce,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(im,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),t.jsx(ft,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(im,{className:"w-3 h-3"}),"主理人名称"]}),t.jsx(ie,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:r.authorInfo.name??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,name:H.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(td,{className:"w-3 h-3"}),"开播日期"]}),t.jsx(ie,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:r.authorInfo.startDate??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,startDate:H.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(td,{className:"w-3 h-3"}),"直播时间"]}),t.jsx(ie,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:r.authorInfo.liveTime??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,liveTime:H.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(lj,{className:"w-3 h-3"}),"直播平台"]}),t.jsx(ie,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:r.authorInfo.platform??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,platform:H.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(Ps,{className:"w-3 h-3"}),"简介描述"]}),t.jsx(ie,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:r.authorInfo.description??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,description:H.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),t.jsx(ks,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:r.authorInfo.bio??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,bio:H.target.value}}))})]}),t.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[t.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(r.authorInfo.name??"K").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-semibold",children:r.authorInfo.name}),t.jsx("p",{className:"text-gray-400 text-xs",children:r.authorInfo.description}),t.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",r.authorInfo.liveTime," · ",r.authorInfo.platform]})]})]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(uo,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),t.jsx(ke,{className:"space-y-4",children:t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"单节价格 (元)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:r.sectionPrice,onChange:H=>a(W=>({...W,sectionPrice:Number.parseFloat(H.target.value)||1}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"整本价格 (元)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:r.baseBookPrice,onChange:H=>a(W=>({...W,baseBookPrice:Number.parseFloat(H.target.value)||9.9}))})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(ld,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),t.jsx(ft,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),t.jsx(ke,{className:"space-y-4",children:t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"小程序 AppID"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:x.appId??"",onChange:H=>y(W=>({...W,appId:H.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"提现订阅模板 ID"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:x.withdrawSubscribeTmplId??"",onChange:H=>y(W=>({...W,withdrawSubscribeTmplId:H.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"微信支付商户号"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:x.mchId??"",onChange:H=>y(W=>({...W,mchId:H.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"最低提现金额 (元)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:x.minWithdraw??10,onChange:H=>y(W=>({...W,minWithdraw:Number.parseFloat(H.target.value)||10}))})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(cm,{className:"w-5 h-5 text-[#38bdac]"}),"免费章节"]}),t.jsx(ft,{className:"text-gray-400",children:"设置哪些章节对所有用户免费开放"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(H=>t.jsxs("span",{className:"inline-flex items-center gap-1 bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30 px-3 py-1 rounded-md text-sm",children:[H,t.jsx("button",{type:"button",onClick:()=>ue(H),className:"ml-1 hover:text-red-400",children:t.jsx(zn,{className:"w-3 h-3"})})]},H))}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",placeholder:"输入章节ID,如 1.2、2.1、preface",value:c,onChange:H=>u(H.target.value),onKeyDown:H=>H.key==="Enter"&&le()}),t.jsxs(he,{onClick:le,className:"bg-[#38bdac] hover:bg-[#2da396]",children:[t.jsx($r,{className:"w-4 h-4 mr-1"}),"添加"]})]}),t.jsx("p",{className:"text-xs text-gray-500",children:"常用ID: preface(序言), epilogue(尾声), appendix-1/2/3(附录), 1.1/1.2等(章节)"})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(ho,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),t.jsx(ft,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(En,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(ne,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),t.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),t.jsx(ut,{id:"match-enabled",checked:f.matchEnabled,disabled:G,onCheckedChange:H=>de("matchEnabled",H)})]}),t.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(cm,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(ne,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),t.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),t.jsx(ut,{id:"referral-enabled",checked:f.referralEnabled,disabled:G,onCheckedChange:H=>de("referralEnabled",H)})]}),t.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ps,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(ne,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),t.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),t.jsx(ut,{id:"search-enabled",checked:f.searchEnabled,disabled:G,onCheckedChange:H=>de("searchEnabled",H)})]}),t.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ho,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(ne,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),t.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),t.jsx(ut,{id:"about-enabled",checked:f.aboutEnabled,disabled:G,onCheckedChange:H=>de("aboutEnabled",H)})]})]}),t.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:t.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]}),t.jsx(tn,{open:C,onOpenChange:j,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[t.jsxs(nn,{children:[t.jsx(rn,{className:T?"text-red-400":"text-[#38bdac]",children:N}),t.jsx(IN,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:R})]}),t.jsx(mn,{className:"mt-4",children:t.jsx(he,{onClick:()=>j(!1),className:T?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const Gm={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function VC(){const[r,a]=p.useState(!1),[l,i]=p.useState(Gm),[c,u]=p.useState(""),f=async()=>{a(!0);try{const k=await He("/api/config");k!=null&&k.paymentMethods&&i({...Gm,...k.paymentMethods})}catch(k){console.error(k)}finally{a(!1)}};p.useEffect(()=>{f()},[]);const m=async()=>{a(!0);try{await bt("/api/db/config",{key:"payment_methods",value:l,description:"支付方式配置"}),alert("配置已保存!")}catch(k){console.error("保存失败:",k),alert("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{a(!1)}},x=(k,R)=>{navigator.clipboard.writeText(k),u(R),setTimeout(()=>u(""),2e3)},y=(k,R)=>{i(b=>({...b,wechat:{...b.wechat,[k]:R}}))},g=(k,R)=>{i(b=>({...b,alipay:{...b.alipay,[k]:R}}))},v=(k,R)=>{i(b=>({...b,usdt:{...b.usdt,[k]:R}}))},E=(k,R)=>{i(b=>({...b,paypal:{...b.paypal,[k]:R}}))},P=l.wechat,C=l.alipay,j=l.usdt,N=l.paypal;return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),t.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(he,{variant:"outline",onClick:f,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`}),"同步配置"]}),t.jsxs(he,{onClick:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),t.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(up,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm",children:[t.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),t.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[t.jsx("li",{children:"打开微信,进入目标微信群"}),t.jsx("li",{children:'点击右上角"..." → "群二维码"'}),t.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),t.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),t.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),t.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),t.jsxs(Hd,{defaultValue:"wechat",className:"space-y-6",children:[t.jsxs(Mo,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[t.jsxs(Zt,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[t.jsx(ld,{className:"w-4 h-4 mr-2"}),"微信"]}),t.jsxs(Zt,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[t.jsx(rd,{className:"w-4 h-4 mr-2"}),"支付宝"]}),t.jsxs(Zt,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[t.jsx(om,{className:"w-4 h-4 mr-2"}),"USDT"]}),t.jsxs(Zt,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[t.jsx(sd,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),t.jsx(en,{value:"wechat",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Ve,{className:"text-[#07C160] flex items-center gap-2",children:[t.jsx(ld,{className:"w-5 h-5"}),"微信支付配置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),t.jsx(ut,{checked:!!P.enabled,onCheckedChange:k=>y("enabled",k)})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"网站AppID"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(P.websiteAppId??""),onChange:k=>y("websiteAppId",k.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"商户号"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(P.merchantId??""),onChange:k=>y("merchantId",k.target.value)})]})]}),t.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[t.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[t.jsx(fo,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"微信收款码/支付链接"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(P.qrCode??""),onChange:k=>y("qrCode",k.target.value)}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),t.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[t.jsx(ne,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),t.jsx(ie,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(P.groupQrCode??""),onChange:k=>y("groupQrCode",k.target.value)}),t.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),t.jsx(en,{value:"alipay",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Ve,{className:"text-[#1677FF] flex items-center gap-2",children:[t.jsx(rd,{className:"w-5 h-5"}),"支付宝配置"]}),t.jsx(ft,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),t.jsx(ut,{checked:!!C.enabled,onCheckedChange:k=>g("enabled",k)})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"合作者身份 (PID)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(C.partnerId??""),onChange:k=>g("partnerId",k.target.value)}),t.jsx(he,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>x(String(C.partnerId??""),"pid"),children:c==="pid"?t.jsx(Co,{className:"w-4 h-4 text-green-500"}):t.jsx(hp,{className:"w-4 h-4 text-gray-400"})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"安全校验码 (Key)"}),t.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(C.securityKey??""),onChange:k=>g("securityKey",k.target.value)})]})]}),t.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[t.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[t.jsx(fo,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(C.qrCode??""),onChange:k=>g("qrCode",k.target.value)}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),t.jsx(en,{value:"usdt",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Ve,{className:"text-[#26A17B] flex items-center gap-2",children:[t.jsx(om,{className:"w-5 h-5"}),"USDT配置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),t.jsx(ut,{checked:!!j.enabled,onCheckedChange:k=>v("enabled",k)})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"网络类型"}),t.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(j.network??"TRC20"),onChange:k=>v("network",k.target.value),children:[t.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),t.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),t.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"收款地址"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(j.address??""),onChange:k=>v("address",k.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>v("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),t.jsx(en,{value:"paypal",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Ve,{className:"text-[#169BD7] flex items-center gap-2",children:[t.jsx(sd,{className:"w-5 h-5"}),"PayPal配置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),t.jsx(ut,{checked:!!N.enabled,onCheckedChange:k=>E("enabled",k)})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"PayPal邮箱"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(N.email??""),onChange:k=>E("email",k.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:k=>E("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const UC={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},WC={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},HC={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function KC(){const[r,a]=p.useState({siteConfig:{...UC},menuConfig:{...WC},pageConfig:{...HC}}),[l,i]=p.useState(!1),[c,u]=p.useState(!1);p.useEffect(()=>{He("/api/config").then(g=>{g!=null&&g.siteConfig&&a(v=>({...v,siteConfig:{...v.siteConfig,...g.siteConfig}})),g!=null&&g.menuConfig&&a(v=>({...v,menuConfig:{...v.menuConfig,...g.menuConfig}})),g!=null&&g.pageConfig&&a(v=>({...v,pageConfig:{...v.pageConfig,...g.pageConfig}}))}).catch(console.error)},[]);const f=async()=>{u(!0);try{await bt("/api/db/config",{key:"site_config",value:r.siteConfig,description:"网站基础配置"}),await bt("/api/db/config",{key:"menu_config",value:r.menuConfig,description:"底部菜单配置"}),await bt("/api/db/config",{key:"page_config",value:r.pageConfig,description:"页面标题配置"}),i(!0),setTimeout(()=>i(!1),2e3),alert("配置已保存")}catch(g){console.error(g),alert("保存失败: "+(g instanceof Error?g.message:String(g)))}finally{u(!1)}},m=r.siteConfig,x=r.menuConfig,y=r.pageConfig;return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),t.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),t.jsxs(he,{onClick:f,disabled:c,className:`${l?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),c?"保存中...":l?"已保存":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(sd,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),t.jsx(ft,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),t.jsx(ie,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:m.siteName??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,siteName:g.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),t.jsx(ie,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:m.siteTitle??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,siteTitle:g.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),t.jsx(ie,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:m.siteDescription??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,siteDescription:g.target.value}}))})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),t.jsx(ie,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:m.logo??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,logo:g.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),t.jsx(ie,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:m.favicon??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,favicon:g.target.value}}))})]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(fj,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),t.jsx(ft,{className:"text-gray-400",children:"配置网站主题色"})]}),t.jsx(ke,{children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"space-y-2 flex-1",children:[t.jsx(ne,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ie,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:m.primaryColor??"#00CED1",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,primaryColor:g.target.value}}))}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:m.primaryColor??"#00CED1",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,primaryColor:g.target.value}}))})]})]}),t.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:m.primaryColor??"#00CED1"},children:"预览"})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(ij,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),t.jsx(ft,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),t.jsx(ke,{className:"space-y-4",children:Object.entries(x).map(([g,v])=>t.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[t.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[t.jsx(ut,{checked:(v==null?void 0:v.enabled)??!0,onCheckedChange:E=>a(P=>({...P,menuConfig:{...P.menuConfig,[g]:{...v,enabled:E}}}))}),t.jsx("span",{className:"text-gray-300 w-16 capitalize",children:g}),t.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(v==null?void 0:v.label)??"",onChange:E=>a(P=>({...P,menuConfig:{...P.menuConfig,[g]:{...v,label:E.target.value}}}))})]}),t.jsx("span",{className:`text-sm ${v!=null&&v.enabled?"text-green-400":"text-gray-500"}`,children:v!=null&&v.enabled?"显示":"隐藏"})]},g))})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Dw,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"首页标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.homeTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,homeTitle:g.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"首页副标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.homeSubtitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,homeSubtitle:g.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"目录页标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.chaptersTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,chaptersTitle:g.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"匹配页标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.matchTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,matchTitle:g.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"我的页标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.myTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,myTitle:g.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"关于作者标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.aboutTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,aboutTitle:g.target.value}}))})]})]})]})]})]})]})}function GC(){const[r,a]=p.useState(""),[l,i]=p.useState(""),[c,u]=p.useState(""),[f,m]=p.useState({}),x=async()=>{var P,C,j,N;try{const k=await He("/api/config"),R=(C=(P=k==null?void 0:k.liveQRCodes)==null?void 0:P[0])==null?void 0:C.urls;Array.isArray(R)&&a(R.join(` `));const b=(N=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:N.groupQrCode;b&&i(b),m({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};p.useEffect(()=>{x()},[]);const y=(P,C)=>{navigator.clipboard.writeText(P),u(C),setTimeout(()=>u(""),2e3)},g=async()=>{try{const P=r.split(` `).map(j=>j.trim()).filter(Boolean),C=[...f.liveQRCodes||[]];C[0]?C[0].urls=P:C.push({id:"live-1",name:"微信群活码",urls:P,clickCount:0}),await bt("/api/db/config",{key:"live_qr_codes",value:C,description:"群活码配置"}),alert("群活码配置已保存!"),await x()}catch(P){console.error(P),alert("保存失败: "+(P instanceof Error?P.message:String(P)))}},v=async()=>{var P;try{await bt("/api/db/config",{key:"payment_methods",value:{...f.paymentMethods||{},wechat:{...((P=f.paymentMethods)==null?void 0:P.wechat)||{},groupQrCode:l}},description:"支付方式配置"}),alert("微信群链接已保存!用户支付成功后将自动跳转"),await x()}catch(C){console.error(C),alert("保存失败: "+(C instanceof Error?C.message:String(C)))}},E=()=>{l?window.open(l,"_blank"):alert("请先配置微信群链接")};return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),t.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),t.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(up,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm",children:[t.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),t.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[t.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[t.jsx("li",{children:"访问草料二维码创建活码"}),t.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),t.jsx("li",{children:"复制生成的短链接填入下方配置"}),t.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),t.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[t.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),t.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),t.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),t.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-[#07C160] flex items-center gap-2",children:[t.jsx(hm,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),t.jsx(ft,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(fm,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:l,onChange:P=>i(P.target.value)}),t.jsx(he,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>y(l,"group"),children:c==="group"?t.jsx(Co,{className:"w-4 h-4 text-green-500"}):t.jsx(hp,{className:"w-4 h-4 text-gray-400"})})]}),t.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[t.jsx(fo,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(he,{onClick:v,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[t.jsx(mm,{className:"w-4 h-4 mr-2"}),"保存配置"]}),t.jsxs(he,{onClick:E,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[t.jsx(fo,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(hm,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),t.jsx(ft,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(fm,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),t.jsx(ks,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:r,onChange:P=>a(P.target.value)}),t.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),t.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[t.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),t.jsxs("span",{className:"font-bold text-[#38bdac]",children:[r.split(` `).filter(Boolean).length," 个"]})]}),t.jsxs(he,{onClick:g,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(mm,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),t.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[t.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),t.jsxs("div",{className:"space-y-3 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),t.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),t.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const Qm={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"商业顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},QC=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function YC(){const[r,a]=p.useState(Qm),[l,i]=p.useState(!0),[c,u]=p.useState(!1),[f,m]=p.useState(!1),[x,y]=p.useState(null),[g,v]=p.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),E=async()=>{i(!0);try{const b=await He("/api/db/config/full?key=match_config"),T=(b==null?void 0:b.data)??(b==null?void 0:b.config);T&&a({...Qm,...T})}catch(b){console.error("加载匹配配置失败:",b)}finally{i(!1)}};p.useEffect(()=>{E()},[]);const P=async()=>{u(!0);try{const b=await bt("/api/db/config",{key:"match_config",value:r,description:"匹配功能配置"});b&&b.success!==!1?alert("配置保存成功!"):alert("保存失败: "+(b&&typeof b=="object"&&"error"in b?b.error:"未知错误"))}catch(b){console.error("保存配置失败:",b),alert("保存失败")}finally{u(!1)}},C=b=>{y(b),v({id:b.id,label:b.label,matchLabel:b.matchLabel,icon:b.icon,matchFromDB:b.matchFromDB,showJoinAfterMatch:b.showJoinAfterMatch,price:b.price,enabled:b.enabled}),m(!0)},j=()=>{y(null),v({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),m(!0)},N=()=>{if(!g.id||!g.label){alert("请填写类型ID和名称");return}const b=[...r.matchTypes];if(x){const T=b.findIndex(B=>B.id===x.id);T!==-1&&(b[T]={...g})}else{if(b.some(T=>T.id===g.id)){alert("类型ID已存在");return}b.push({...g})}a({...r,matchTypes:b}),m(!1)},k=b=>{confirm("确定要删除这个匹配类型吗?")&&a({...r,matchTypes:r.matchTypes.filter(T=>T.id!==b)})},R=b=>{a({...r,matchTypes:r.matchTypes.map(T=>T.id===b?{...T,enabled:!T.enabled}:T)})};return t.jsxs("div",{className:"p-8 w-full space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(ho,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(he,{variant:"outline",onClick:E,disabled:l,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]}),t.jsxs(he,{onClick:P,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Vj,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),t.jsxs(ke,{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"每日免费匹配次数"}),t.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.freeMatchLimit,onChange:b=>a({...r,freeMatchLimit:parseInt(b.target.value,10)||0})}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"付费匹配价格(元)"}),t.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:r.matchPrice,onChange:b=>a({...r,matchPrice:parseFloat(b.target.value)||1})}),t.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"每日最大匹配次数"}),t.jsx(ie,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.settings.maxMatchesPerDay,onChange:b=>a({...r,settings:{...r.settings,maxMatchesPerDay:parseInt(b.target.value,10)||10}})}),t.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),t.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ut,{checked:r.settings.enableFreeMatches,onCheckedChange:b=>a({...r,settings:{...r.settings,enableFreeMatches:b}})}),t.jsx(ne,{className:"text-gray-300",children:"启用免费匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ut,{checked:r.settings.enablePaidMatches,onCheckedChange:b=>a({...r,settings:{...r.settings,enablePaidMatches:b}})}),t.jsx(ne,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs(Be,{className:"flex flex-row items-center justify-between",children:[t.jsxs("div",{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(En,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),t.jsx(ft,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),t.jsxs(he,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx($r,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),t.jsx(ke,{children:t.jsxs(Ls,{children:[t.jsx(Os,{children:t.jsxs(_t,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx($e,{className:"text-gray-400",children:"图标"}),t.jsx($e,{className:"text-gray-400",children:"类型ID"}),t.jsx($e,{className:"text-gray-400",children:"显示名称"}),t.jsx($e,{className:"text-gray-400",children:"匹配标签"}),t.jsx($e,{className:"text-gray-400",children:"价格"}),t.jsx($e,{className:"text-gray-400",children:"数据库匹配"}),t.jsx($e,{className:"text-gray-400",children:"状态"}),t.jsx($e,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsx(Ds,{children:r.matchTypes.map(b=>t.jsxs(_t,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(Me,{children:t.jsx("span",{className:"text-2xl",children:b.icon})}),t.jsx(Me,{className:"font-mono text-gray-300",children:b.id}),t.jsx(Me,{className:"text-white font-medium",children:b.label}),t.jsx(Me,{className:"text-gray-300",children:b.matchLabel}),t.jsx(Me,{children:t.jsxs(Le,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",b.price]})}),t.jsx(Me,{children:b.matchFromDB?t.jsx(Le,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):t.jsx(Le,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),t.jsx(Me,{children:t.jsx(ut,{checked:b.enabled,onCheckedChange:()=>R(b.id)})}),t.jsx(Me,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>C(b),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:t.jsx(Ur,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>k(b.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:t.jsx(Eo,{className:"w-4 h-4"})})]})})]},b.id))})]})})]}),t.jsx(tn,{open:f,onOpenChange:m,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[x?t.jsx(Ur,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx($r,{className:"w-5 h-5 text-[#38bdac]"}),x?"编辑匹配类型":"添加匹配类型"]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"类型ID(英文)"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:g.id,onChange:b=>v({...g,id:b.target.value}),disabled:!!x})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"图标"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:QC.map(b=>t.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${g.icon===b?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>v({...g,icon:b}),children:b},b))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"显示名称"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:g.label,onChange:b=>v({...g,label:b.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"匹配标签"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:g.matchLabel,onChange:b=>v({...g,matchLabel:b.target.value})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"单次匹配价格(元)"}),t.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:g.price,onChange:b=>v({...g,price:parseFloat(b.target.value)||1})})]}),t.jsxs("div",{className:"flex gap-6 pt-2",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ut,{checked:g.matchFromDB,onCheckedChange:b=>v({...g,matchFromDB:b})}),t.jsx(ne,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ut,{checked:g.showJoinAfterMatch,onCheckedChange:b=>v({...g,showJoinAfterMatch:b})}),t.jsx(ne,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ut,{checked:g.enabled,onCheckedChange:b=>v({...g,enabled:b})}),t.jsx(ne,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),t.jsxs(mn,{children:[t.jsx(he,{variant:"outline",onClick:()=>m(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsxs(he,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const Ym={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function qC(){const[r,a]=p.useState([]),[l,i]=p.useState(0),[c,u]=p.useState(1),[f,m]=p.useState(10),[x,y]=p.useState(""),[g,v]=p.useState(!0),[E,P]=p.useState(null);async function C(){v(!0),P(null);try{const N=new URLSearchParams({page:String(c),pageSize:String(f)});x&&N.set("matchType",x);const k=await He(`/api/db/match-records?${N}`);k!=null&&k.success?(a(k.records||[]),i(k.total??0)):P("加载匹配记录失败")}catch(N){console.error("加载匹配记录失败",N),P("加载失败,请检查网络后重试")}finally{v(!1)}}p.useEffect(()=>{C()},[c,x]);const j=Math.ceil(l/f)||1;return t.jsxs("div",{className:"p-8 w-full",children:[E&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:E}),t.jsx("button",{type:"button",onClick:()=>P(null),className:"hover:text-red-300",children:"×"})]}),t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),t.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",l," 条记录"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("select",{value:x,onChange:N=>{y(N.target.value),u(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[t.jsx("option",{value:"",children:"全部类型"}),Object.entries(Ym).map(([N,k])=>t.jsx("option",{value:N,children:k},N))]}),t.jsxs("button",{type:"button",onClick:C,disabled:g,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[t.jsx(st,{className:`w-4 h-4 ${g?"animate-spin":""}`}),"刷新"]})]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:g?t.jsxs("div",{className:"flex justify-center py-12",children:[t.jsx(st,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs(t.Fragment,{children:[t.jsxs(Ls,{children:[t.jsx(Os,{children:t.jsxs(_t,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx($e,{className:"text-gray-400",children:"发起人"}),t.jsx($e,{className:"text-gray-400",children:"匹配到"}),t.jsx($e,{className:"text-gray-400",children:"类型"}),t.jsx($e,{className:"text-gray-400",children:"联系方式"}),t.jsx($e,{className:"text-gray-400",children:"匹配时间"})]})}),t.jsxs(Ds,{children:[r.map(N=>t.jsxs(_t,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(Me,{children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[N.userAvatar?t.jsx("img",{src:N.userAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const R=k.currentTarget.nextElementSibling;R&&R.classList.remove("hidden")}}):null,t.jsx("span",{className:N.userAvatar?"hidden":"",children:(N.userNickname||N.userId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:N.userNickname||N.userId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[N.userId.slice(0,16),"..."]})]})]})}),t.jsx(Me,{children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[N.matchedUserAvatar?t.jsx("img",{src:N.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const R=k.currentTarget.nextElementSibling;R&&R.classList.remove("hidden")}}):null,t.jsx("span",{className:N.matchedUserAvatar?"hidden":"",children:(N.matchedNickname||N.matchedUserId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:N.matchedNickname||N.matchedUserId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[N.matchedUserId.slice(0,16),"..."]})]})]})}),t.jsx(Me,{children:t.jsx(Le,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Ym[N.matchType]||N.matchType})}),t.jsxs(Me,{className:"text-gray-400 text-sm",children:[N.phone&&t.jsxs("div",{children:["📱 ",N.phone]}),N.wechatId&&t.jsxs("div",{children:["💬 ",N.wechatId]}),!N.phone&&!N.wechatId&&"-"]}),t.jsx(Me,{className:"text-gray-400",children:N.createdAt?new Date(N.createdAt).toLocaleString():"-"})]},N.id)),r.length===0&&t.jsx(_t,{children:t.jsx(Me,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),t.jsx(Vr,{page:c,totalPages:j,total:l,pageSize:f,onPageChange:u,onPageSizeChange:N=>{m(N),u(1)}})]})})})]})}function XC(){const[r,a]=p.useState([]),[l,i]=p.useState(!0),[c,u]=p.useState(!1),[f,m]=p.useState(null),[x,y]=p.useState(""),[g,v]=p.useState(0),[E,P]=p.useState(!1);async function C(){i(!0);try{const b=await He("/api/db/vip-roles");b!=null&&b.success&&b.data&&a(b.data)}catch(b){console.error("Load roles error:",b)}finally{i(!1)}}p.useEffect(()=>{C()},[]);const j=()=>{m(null),y(""),v(r.length>0?Math.max(...r.map(b=>b.sort))+1:0),u(!0)},N=b=>{m(b),y(b.name),v(b.sort),u(!0)},k=async()=>{if(!x.trim()){alert("角色名称不能为空");return}P(!0);try{if(f){const b=await Wt("/api/db/vip-roles",{id:f.id,name:x.trim(),sort:g});b!=null&&b.success?(u(!1),C()):alert("更新失败: "+(b==null?void 0:b.error))}else{const b=await bt("/api/db/vip-roles",{name:x.trim(),sort:g});b!=null&&b.success?(u(!1),C()):alert("新增失败: "+(b==null?void 0:b.error))}}catch(b){console.error("Save error:",b),alert("保存失败")}finally{P(!1)}},R=async b=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const T=await Td(`/api/db/vip-roles?id=${b}`);T!=null&&T.success?C():alert("删除失败: "+(T==null?void 0:T.error))}catch(T){console.error("Delete error:",T),alert("删除失败")}};return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(ko,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),t.jsxs(he,{onClick:j,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx($r,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Ls,{children:[t.jsx(Os,{children:t.jsxs(_t,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx($e,{className:"text-gray-400",children:"ID"}),t.jsx($e,{className:"text-gray-400",children:"角色名称"}),t.jsx($e,{className:"text-gray-400",children:"排序"}),t.jsx($e,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(Ds,{children:[r.map(b=>t.jsxs(_t,{className:"border-gray-700/50",children:[t.jsx(Me,{className:"text-gray-300",children:b.id}),t.jsx(Me,{className:"text-white",children:b.name}),t.jsx(Me,{className:"text-gray-400",children:b.sort}),t.jsxs(Me,{className:"text-right",children:[t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>N(b),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(Ur,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>R(b.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Eo,{className:"w-4 h-4"})})]})]},b.id)),r.length===0&&t.jsx(_t,{children:t.jsx(Me,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),t.jsx(tn,{open:c,onOpenChange:u,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[t.jsx(nn,{children:t.jsx(rn,{className:"text-white",children:f?"编辑角色":"新增角色"})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"角色名称"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创始人、投资人",value:x,onChange:b=>y(b.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:g,onChange:b=>v(parseInt(b.target.value,10)||0)})]})]}),t.jsxs(mn,{children:[t.jsxs(he,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(zn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(he,{onClick:k,disabled:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),E?"保存中...":"保存"]})]})]})})]})}function JC(){return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[t.jsx(zr,{className:"w-8 h-8 text-[#38bdac]"}),t.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),t.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"1. 接口总览"})}),t.jsxs(ke,{className:"space-y-4 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),t.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[t.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),t.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),t.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),t.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),t.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),t.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),t.jsx("li",{children:"/api/config — 配置系统"})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),t.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),t.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"2. 书籍内容"})}),t.jsxs(ke,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[t.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),t.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),t.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"3. 支付"})}),t.jsxs(ke,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[t.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),t.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),t.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"4. 分销与用户"})}),t.jsxs(ke,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[t.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),t.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),t.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"5. 管理后台"})}),t.jsxs(ke,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[t.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),t.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),t.jsx("p",{children:"GET /api/orders — 订单列表"})]})]}),t.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function ZC(){const r=Yr();return t.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:t.jsxs("div",{className:"text-center max-w-md",children:[t.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:t.jsx(jw,{className:"w-10 h-10"})}),t.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),t.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),t.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:r.pathname}),t.jsx(he,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:t.jsxs(op,{to:"/",children:[t.jsx(Kw,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function ek(){return t.jsxs(qy,{children:[t.jsx(it,{path:"/login",element:t.jsx(K1,{})}),t.jsxs(it,{path:"/",element:t.jsx(Yj,{}),children:[t.jsx(it,{index:!0,element:t.jsx(Gy,{to:"/dashboard",replace:!0})}),t.jsx(it,{path:"dashboard",element:t.jsx(Q1,{})}),t.jsx(it,{path:"orders",element:t.jsx(AN,{})}),t.jsx(it,{path:"users",element:t.jsx(l2,{})}),t.jsx(it,{path:"distribution",element:t.jsx(o2,{})}),t.jsx(it,{path:"withdrawals",element:t.jsx(i2,{})}),t.jsx(it,{path:"content",element:t.jsx(hC,{})}),t.jsx(it,{path:"chapters",element:t.jsx(mC,{})}),t.jsx(it,{path:"referral-settings",element:t.jsx(OC,{})}),t.jsx(it,{path:"vip-roles",element:t.jsx(XC,{})}),t.jsx(it,{path:"settings",element:t.jsx(BC,{})}),t.jsx(it,{path:"payment",element:t.jsx(VC,{})}),t.jsx(it,{path:"site",element:t.jsx(KC,{})}),t.jsx(it,{path:"qrcodes",element:t.jsx(GC,{})}),t.jsx(it,{path:"match",element:t.jsx(YC,{})}),t.jsx(it,{path:"match-records",element:t.jsx(qC,{})}),t.jsx(it,{path:"api-doc",element:t.jsx(JC,{})})]}),t.jsx(it,{path:"*",element:t.jsx(ZC,{})})]})}Zv.createRoot(document.getElementById("root")).render(t.jsx(p.StrictMode,{children:t.jsx(rw,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:t.jsx(ek,{})})}));